Skip to content

Commit

Permalink
Copy and paste on data model column that causes exception
Browse files Browse the repository at this point in the history
Dispose the tab page before disposing the tab folder.
  • Loading branch information
cchao authored and zhiqiangqian committed Jul 22, 2014
1 parent 7f9086f commit 9d9bd37
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
package org.eclipse.birt.report.designer.ui.views.attributes;

import java.util.HashMap;
import java.util.Iterator;

import org.eclipse.birt.report.designer.internal.ui.views.attributes.page.AttributePage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CTabItem;
import org.eclipse.swt.widgets.Composite;
Expand Down Expand Up @@ -124,4 +126,19 @@ protected void refresh( Composite parent, Object object, boolean init )
}
}

public void dispose( )
{
if ( itemMap != null && itemMap.values( ) != null )
{
Iterator<Object> iter = itemMap.values( ).iterator( );
while ( iter.hasNext( ) )
{
Object value = iter.next( );
if ( value instanceof AttributePage )
{
( (AttributePage) value ).dispose( );
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,15 @@ public IPageGenerator getPageGenerator( List selection )
{
typeInfo = Messages.getFormattedString( "AttributesBuilder.Label.Generic", new String[]{GuiExtensionManager.getExtensionDisplayName( selection.get( 0 ) )} ); //$NON-NLS-1$
}
if( DEFAULT_NONE.equals( typeInfo ) )
if ( DEFAULT_NONE.equals( typeInfo ) )
{
if( element instanceof DesignElementHandle )
if ( element instanceof DesignElementHandle )
{
String displayName = ( (DesignElementHandle) element ).getDefn( ).getDisplayName( );
if( displayName != null && !displayName.equals( "" ) )
String displayName = ( (DesignElementHandle) element ).getDefn( )
.getDisplayName( );
if ( displayName != null && !displayName.equals( "" ) )
{
typeInfo = Messages.getFormattedString( "AttributesBuilder.Label.Generic", new String[]{ displayName });//$NON-NLS-1$
typeInfo = Messages.getFormattedString( "AttributesBuilder.Label.Generic", new String[]{displayName} );//$NON-NLS-1$
}
}
}
Expand Down Expand Up @@ -150,6 +151,10 @@ else if ( element.getClass( ) != input.getClass( ) )
&& pageGenerator.getControl( ) != null
&& !pageGenerator.getControl( ).isDisposed( ) )
{
if ( pageGenerator instanceof AbstractPageGenerator )
{
( (AbstractPageGenerator) pageGenerator ).dispose( );
}
pageGenerator.getControl( ).dispose( );
}
pageGenerator = ng;
Expand Down Expand Up @@ -182,7 +187,13 @@ else if ( element.getClass( ) != input.getClass( ) )
if ( pageGenerator != null
&& pageGenerator.getControl( ) != null
&& !pageGenerator.getControl( ).isDisposed( ) )
{
if ( pageGenerator instanceof AbstractPageGenerator )
{
( (AbstractPageGenerator) pageGenerator ).dispose( );
}
pageGenerator.getControl( ).dispose( );
}
pageGenerator = (IPageGenerator) pageGeneratorClass.newInstance( );
if ( pageGenerator instanceof TabPageGenerator )
{
Expand Down Expand Up @@ -271,7 +282,7 @@ else if ( type == ModelClassWrapper.class )
{
// this is to populate the wrapped type info
getGeneratorClass( ( (ModelClassWrapper) obj ).getElement( ) );

return MessagePageGenerator.class;
}
else if ( type == LabelHandle.class )
Expand Down Expand Up @@ -336,8 +347,9 @@ else if ( type == CascadingParameterGroupHandle.class )
}
else if ( obj instanceof ModuleHandle )
{
typeInfo = Messages.getFormattedString( "AttributesBuilder.Label.Generic", new String[]{ ( (DesignElementHandle) obj ).getDefn( ) //$NON-NLS-1$
.getDisplayName( )} );
typeInfo = Messages.getFormattedString( "AttributesBuilder.Label.Generic", new String[]{( (DesignElementHandle) obj ).getDefn( ) //$NON-NLS-1$
.getDisplayName( )
} );
return CategoryPageGenerator.class;
}
else
Expand Down

0 comments on commit 9d9bd37

Please sign in to comment.