Skip to content

Commit

Permalink
apply new icons
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiqiangqian committed Jul 22, 2014
1 parent 830e758 commit 3ed1234
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 110 deletions.
Expand Up @@ -140,6 +140,13 @@
</documentation>
</annotation>
</attribute>
<attribute name="largeIcon" type="string">
<annotation>
<documentation>
The large icon to show in the Palette
</documentation>
</annotation>
</attribute>
<attribute name="category" type="string">
<annotation>
<documentation>
Expand Down
Expand Up @@ -48,7 +48,6 @@
import org.eclipse.gef.ui.actions.CopyTemplateAction;
import org.eclipse.gef.ui.actions.DeleteAction;
import org.eclipse.gef.ui.actions.EditorPartAction;
import org.eclipse.gef.ui.actions.GEFActionConstants;
import org.eclipse.gef.ui.actions.RedoAction;
import org.eclipse.gef.ui.actions.SaveAction;
import org.eclipse.gef.ui.actions.SelectionAction;
Expand All @@ -57,23 +56,15 @@
import org.eclipse.gef.ui.actions.UpdateAction;
import org.eclipse.gef.ui.actions.ZoomInAction;
import org.eclipse.gef.ui.actions.ZoomOutAction;
import org.eclipse.gef.ui.palette.CustomizeAction;
import org.eclipse.gef.ui.palette.FlyoutPaletteComposite;
import org.eclipse.gef.ui.palette.FlyoutPaletteComposite.FlyoutPreferences;
import org.eclipse.gef.ui.palette.LayoutAction;
import org.eclipse.gef.ui.palette.PaletteContextMenuProvider;
import org.eclipse.gef.ui.palette.PaletteEditPartFactory;
import org.eclipse.gef.ui.palette.PaletteViewer;
import org.eclipse.gef.ui.palette.PaletteViewerPreferences;
import org.eclipse.gef.ui.palette.PaletteViewerProvider;
import org.eclipse.gef.ui.palette.SettingsAction;
import org.eclipse.gef.ui.palette.customize.PaletteSettingsDialog;
import org.eclipse.gef.ui.parts.GraphicalEditor;
import org.eclipse.gef.ui.views.palette.PalettePage;
import org.eclipse.gef.ui.views.palette.PaletteViewerPage;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
Expand Down Expand Up @@ -127,7 +118,8 @@ public abstract class GraphicalEditorWithFlyoutPalette extends GraphicalEditor i
// editor part.
private static boolean shellActiveFlag = false;

// record the last activated shell, used for dataset or datasource selection.
// record the last activated shell, used for dataset or datasource
// selection.
private static Shell lastActiveShell = null;

// Used for multiple window case. When the shell is activated and it's not
Expand Down Expand Up @@ -287,77 +279,7 @@ protected PaletteViewerProvider createPaletteViewerProvider( )

protected void configurePaletteViewer( final PaletteViewer viewer )
{
// super.configurePaletteViewer( viewer );

/**
* Hack to remove the Change Icon Size menu item and relative
* dialog components.
*/
viewer.setContextMenu( new PaletteContextMenuProvider( viewer ) {

public void buildContextMenu( IMenuManager menu )
{
GEFActionConstants.addStandardActionGroups( menu );

List lst = getPaletteViewer( ).getSelectedEditParts( );

if ( lst.size( ) == 0 )
{
return;
}

menu.appendToGroup( GEFActionConstants.GROUP_VIEW,
new LayoutAction( getPaletteViewer( ).getPaletteViewerPreferences( ) ) );
if ( getPaletteViewer( ).getCustomizer( ) != null )
{
menu.appendToGroup( GEFActionConstants.GROUP_REST,
new CustomizeAction( getPaletteViewer( ) ) );
}

final PaletteViewer paletteViewer = getPaletteViewer( );

menu.appendToGroup( GEFActionConstants.GROUP_REST,
new SettingsAction( paletteViewer ) {

public void run( )
{
final PaletteViewerPreferences prefs = paletteViewer.getPaletteViewerPreferences( );

Dialog settings = new PaletteSettingsDialog( paletteViewer.getControl( )
.getShell( ),
prefs ) {

protected Control createLayoutSettings(
Composite parent )
{
Composite composite = new Composite( parent,
SWT.NONE );
composite.setFont( parent.getFont( ) );
GridLayout layout = new GridLayout( 1,
false );
composite.setLayout( layout );

Control layoutOptions = createLayoutOptions( composite );
GridData data = new GridData( GridData.VERTICAL_ALIGN_BEGINNING );
layoutOptions.setLayoutData( data );

handleLayoutSettingChanged( prefs.getLayoutSetting( ) );

return composite;
}

protected void handleLayoutSettingChanged(
int newSetting )
{
prefs.setLayoutSetting( newSetting );
}
};

settings.open( );
}
} );
}
} );
super.configurePaletteViewer( viewer );

viewer.addDragSourceListener( new TemplateTransferDragSourceListener( viewer ) );

Expand Down
Expand Up @@ -223,7 +223,7 @@ else if ( PALETTE_MASTERPAGE.equals( type ) )
new ReportElementFactory( IReportElementConstants.REPORT_ELEMENT_EXTENDED
+ point.getExtensionName( ) ),
icon,
icon,
iconLarge,
BasePaletteFactory.getAbstractToolHandleExtendsFromPaletteName( getExtendedPalletTemplateName( point ) ) );
PaletteContainer entry = findCategory( list, category );
if ( entry == null )
Expand Down
Expand Up @@ -330,6 +330,12 @@ else if ( IExtensionConstants.ELEMENT_PALETTE.equals( elementName ) )
loadIconAttribute( newPoint,
element,
IExtensionConstants.ATTRIBUTE_KEY_PALETTE_ICON,
IExtensionConstants.ATTRIBUTE_ICON,
false );
loadIconAttribute( newPoint,
element,
IExtensionConstants.ATTRIBUTE_KEY_PALETTE_ICON_LARGE,
IExtensionConstants.ATTRIBUTE_ICON_LARGE,
false );
loadStringAttribute( newPoint,
element,
Expand Down Expand Up @@ -361,6 +367,7 @@ else if ( IExtensionConstants.ELEMENT_OUTLINE.equals( elementName ) )
loadIconAttribute( newPoint,
element,
IExtensionConstants.ATTRIBUTE_KEY_OUTLINE_ICON,
IExtensionConstants.ATTRIBUTE_ICON,
true );
}
else if ( IExtensionConstants.ELEMENT_DESCRIPTION.equals( elementName ) )
Expand Down Expand Up @@ -401,11 +408,11 @@ private void loadClass( ExtendedElementUIPoint newPoint,

}

private ImageDescriptor getImageDescriptor( IConfigurationElement element )
private ImageDescriptor getImageDescriptor( IConfigurationElement element, String attrName )
{
assert element != null;
IExtension extension = element.getDeclaringExtension( );
String iconPath = element.getAttribute( IExtensionConstants.ATTRIBUTE_ICON );
String iconPath = element.getAttribute( attrName );
if ( iconPath == null )
{
return null;
Expand Down Expand Up @@ -444,19 +451,19 @@ private void loadBooleanAttribute( ExtendedElementUIPoint newPoint,
}

private void loadIconAttribute( ExtendedElementUIPoint newPoint,
IConfigurationElement element, String attributeName, boolean shared )
IConfigurationElement element, String keyName, String attributeName, boolean shared )
{
ImageDescriptor imageDescriptor = getImageDescriptor( element );
ImageDescriptor imageDescriptor = getImageDescriptor( element, attributeName );
if ( imageDescriptor != null )
{
if ( shared )
{
String symbolName = ReportPlatformUIImages.getIconSymbolName( newPoint.getExtensionName( ),
attributeName );
keyName );
ReportPlatformUIImages.declareImage( symbolName,
imageDescriptor );
}
newPoint.setAttribute( attributeName, imageDescriptor );
newPoint.setAttribute( keyName, imageDescriptor );
}
}

Expand Down
Expand Up @@ -111,16 +111,16 @@ private static PaletteContainer createQuickTools( )
AGG_TEMPLATE,
factory,
ReportPlatformUIImages.getImageDescriptor( IReportGraphicConstants.ICON_ELEMENT_AGGREGATION ),
ReportPlatformUIImages.getImageDescriptor( IReportGraphicConstants.ICON_ELEMENT_AGGREGATION ) ) ;
ReportPlatformUIImages.getImageDescriptor( IReportGraphicConstants.ICON_ELEMENT_AGGREGATION_LARGE ) ) ;
quickTools.add( combined );

factory = new ReportElementFactory( TIMEPERIOD_TEMPLATE ); //$NON-NLS-1$
factory = new ReportElementFactory( TIMEPERIOD_TEMPLATE );
combined = new QuickToolsCombinedTemplateCreationEntry( Messages.getString( "DesignerPaletteFactory.quicktool.timeperiod.title" ), //$NON-NLS-1$
Messages.getString( "DesignerPaletteFactory.quicktool.timeperiod.toolTip" ), //$NON-NLS-1$
TIMEPERIOD_TEMPLATE,
factory,
ReportPlatformUIImages.getImageDescriptor( IReportGraphicConstants.ICON_ELEMENT_TIMEPERIOD ),
ReportPlatformUIImages.getImageDescriptor( IReportGraphicConstants.ICON_ELEMENT_TIMEPERIOD ) ) ;
ReportPlatformUIImages.getImageDescriptor( IReportGraphicConstants.ICON_ELEMENT_TIMEPERIOD_LARGE ) ) ;
quickTools.add( combined );
return quickTools;
}
Expand All @@ -140,15 +140,15 @@ public Tool createTool( )

protected void performCreation( int button )
{
DNDService.getInstance( ).performDrop( getTemplate( ), //$NON-NLS-1$
DNDService.getInstance( ).performDrop( getTemplate( ),
getTargetEditPart( ),
DND.DROP_DEFAULT,
new DNDLocation( getLocation( ) ) );
}

public void performCreation( EditPart editPart )
{
DNDService.getInstance( ).performDrop( getTemplate( ), //$NON-NLS-1$
DNDService.getInstance( ).performDrop( getTemplate( ),
editPart,
DND.DROP_DEFAULT,
new DNDLocation( getLocation( ) ) );
Expand Down Expand Up @@ -185,7 +185,7 @@ protected boolean handleMove( )
*
* @return Returns the categories list
*/
static List createCategories( )
protected static List createCategories( )
{
List categories = new ArrayList( );
categories.add( createContentCategory( ) );
Expand All @@ -209,7 +209,7 @@ private static PaletteContainer createContentCategory( )
IReportElementConstants.REPORT_ELEMENT_LABEL,
new ReportElementFactory( IReportElementConstants.REPORT_ELEMENT_LABEL ),
ReportPlatformUIImages.getImageDescriptor( IReportGraphicConstants.ICON_ELEMENT_LABEL ),
ReportPlatformUIImages.getImageDescriptor( IReportGraphicConstants.ICON_ELEMENT_LABEL ),
ReportPlatformUIImages.getImageDescriptor( IReportGraphicConstants.ICON_ELEMENT_LABEL_LARGE ),
getAbstractToolHandleExtendsFromPaletteName( IReportElementConstants.REPORT_ELEMENT_LABEL ) );

entries.add( combined );
Expand All @@ -219,7 +219,7 @@ private static PaletteContainer createContentCategory( )
IReportElementConstants.REPORT_ELEMENT_TEXT,
new ReportElementFactory( IReportElementConstants.REPORT_ELEMENT_TEXT ),
ReportPlatformUIImages.getImageDescriptor( IReportGraphicConstants.ICON_ELEMENT_TEXT ),
ReportPlatformUIImages.getImageDescriptor( IReportGraphicConstants.ICON_ELEMENT_TEXT ),
ReportPlatformUIImages.getImageDescriptor( IReportGraphicConstants.ICON_ELEMENT_TEXT_LARGE ),
getAbstractToolHandleExtendsFromPaletteName( IReportElementConstants.REPORT_ELEMENT_TEXT ) );

entries.add( combined );
Expand All @@ -229,7 +229,7 @@ private static PaletteContainer createContentCategory( )
IReportElementConstants.REPORT_ELEMENT_TEXTDATA,
new ReportElementFactory( IReportElementConstants.REPORT_ELEMENT_TEXTDATA ),
ReportPlatformUIImages.getImageDescriptor( IReportGraphicConstants.ICON_ELEMENT_TEXTDATA ),
ReportPlatformUIImages.getImageDescriptor( IReportGraphicConstants.ICON_ELEMENT_TEXTDATA ),
ReportPlatformUIImages.getImageDescriptor( IReportGraphicConstants.ICON_ELEMENT_TEXTDATA_LARGE ),
getAbstractToolHandleExtendsFromPaletteName( IReportElementConstants.REPORT_ELEMENT_TEXTDATA ) );

entries.add( combined );
Expand All @@ -239,7 +239,7 @@ private static PaletteContainer createContentCategory( )
IReportElementConstants.REPORT_ELEMENT_DATA,
new ReportElementFactory( IReportElementConstants.REPORT_ELEMENT_DATA ),
ReportPlatformUIImages.getImageDescriptor( IReportGraphicConstants.ICON_ELEMENT_DATA ),
ReportPlatformUIImages.getImageDescriptor( IReportGraphicConstants.ICON_ELEMENT_DATA ),
ReportPlatformUIImages.getImageDescriptor( IReportGraphicConstants.ICON_ELEMENT_DATA_LARGE ),
getAbstractToolHandleExtendsFromPaletteName( IReportElementConstants.REPORT_ELEMENT_DATA ) );

entries.add( combined );
Expand All @@ -249,7 +249,7 @@ private static PaletteContainer createContentCategory( )
IReportElementConstants.REPORT_ELEMENT_IMAGE,
new ReportElementFactory( IReportElementConstants.REPORT_ELEMENT_IMAGE ),
ReportPlatformUIImages.getImageDescriptor( IReportGraphicConstants.ICON_ELEMENT_IMAGE ),
ReportPlatformUIImages.getImageDescriptor( IReportGraphicConstants.ICON_ELEMENT_IMAGE ),
ReportPlatformUIImages.getImageDescriptor( IReportGraphicConstants.ICON_ELEMENT_IMAGE_LARGE ),
getAbstractToolHandleExtendsFromPaletteName( IReportElementConstants.REPORT_ELEMENT_IMAGE ) );

entries.add( combined );
Expand All @@ -259,7 +259,7 @@ private static PaletteContainer createContentCategory( )
IReportElementConstants.REPORT_ELEMENT_GRID,
new ReportElementFactory( IReportElementConstants.REPORT_ELEMENT_GRID ),
ReportPlatformUIImages.getImageDescriptor( IReportGraphicConstants.ICON_ELEMENT_GRID ),
ReportPlatformUIImages.getImageDescriptor( IReportGraphicConstants.ICON_ELEMENT_GRID ),
ReportPlatformUIImages.getImageDescriptor( IReportGraphicConstants.ICON_ELEMENT_GRID_LARGE ),
getAbstractToolHandleExtendsFromPaletteName( IReportElementConstants.REPORT_ELEMENT_GRID ) );

entries.add( combined );
Expand All @@ -268,7 +268,7 @@ private static PaletteContainer createContentCategory( )
IReportElementConstants.REPORT_ELEMENT_LIST,
new ReportElementFactory( IReportElementConstants.REPORT_ELEMENT_LIST ),
ReportPlatformUIImages.getImageDescriptor( IReportGraphicConstants.ICON_ELEMENT_LIST ),
ReportPlatformUIImages.getImageDescriptor( IReportGraphicConstants.ICON_ELEMENT_LIST ),
ReportPlatformUIImages.getImageDescriptor( IReportGraphicConstants.ICON_ELEMENT_LIST_LARGE ),
getAbstractToolHandleExtendsFromPaletteName( IReportElementConstants.REPORT_ELEMENT_LIST ) );

entries.add( combined );
Expand All @@ -278,7 +278,7 @@ private static PaletteContainer createContentCategory( )
IReportElementConstants.REPORT_ELEMENT_TABLE,
new ReportElementFactory( IReportElementConstants.REPORT_ELEMENT_TABLE ),
ReportPlatformUIImages.getImageDescriptor( IReportGraphicConstants.ICON_ELEMENT_TABLE ),
ReportPlatformUIImages.getImageDescriptor( IReportGraphicConstants.ICON_ELEMENT_TABLE ),
ReportPlatformUIImages.getImageDescriptor( IReportGraphicConstants.ICON_ELEMENT_TABLE_LARGE ),
getAbstractToolHandleExtendsFromPaletteName( IReportElementConstants.REPORT_ELEMENT_TABLE ) );

entries.add( combined );
Expand Down

0 comments on commit 3ed1234

Please sign in to comment.