Skip to content

Commit

Permalink
refactored ImageRegistry access with dyn. registration for additional…
Browse files Browse the repository at this point in the history
… Images
  • Loading branch information
fgdrf committed Mar 10, 2011
1 parent bec5850 commit e762cb1
Show file tree
Hide file tree
Showing 54 changed files with 227 additions and 436 deletions.
Expand Up @@ -234,7 +234,7 @@ public LabelProvider() {
listeners = new ArrayList<ILabelProviderListener>();

// Create the images
vectorMaps = CatalogUIPlugin.getImageDescriptor(
vectorMaps = CatalogUIPlugin.getDefault().getImageDescriptor(
ISharedImages.FEATURE_OBJ).createImage();
}

Expand Down
Expand Up @@ -239,8 +239,8 @@ public LabelProvider() {
listeners = new ArrayList<ILabelProviderListener>();

// Create the images
vectorMaps = CatalogUIPlugin.getImageDescriptor(ISharedImages.FEATURE_OBJ).createImage();
mainMaps = CatalogUIPlugin.getImageDescriptor(ISharedImages.CATALOG_OBJ).createImage();
vectorMaps = CatalogUIPlugin.getDefault().getImageDescriptor(ISharedImages.FEATURE_OBJ).createImage();
mainMaps = CatalogUIPlugin.getDefault().getImageDescriptor(ISharedImages.CATALOG_OBJ).createImage();
}

/**
Expand Down
Expand Up @@ -313,7 +313,7 @@ public LabelProvider() {
listeners = new ArrayList<ILabelProviderListener>();

// Create the images
rasterMaps = CatalogUIPlugin.getImageDescriptor(ISharedImages.GRID_OBJ).createImage();
rasterMaps = CatalogUIPlugin.getDefault().getImageDescriptor(ISharedImages.GRID_OBJ).createImage();
mainRasterMaps = AbstractUIPlugin
.imageDescriptorFromPlugin(JGrassPlugin.PLUGIN_ID, "icons/obj16/jgrass_obj.gif").createImage(); //$NON-NLS-1$
grassasciiRasterMaps = AbstractUIPlugin.imageDescriptorFromPlugin(JGrassPlugin.PLUGIN_ID,
Expand Down
Expand Up @@ -309,7 +309,7 @@ public LabelProvider() {
listeners = new ArrayList<ILabelProviderListener>();

// Create the images
rasterMaps = CatalogUIPlugin.getImageDescriptor(ISharedImages.GRID_OBJ).createImage();
rasterMaps = CatalogUIPlugin.getDefault().getImageDescriptor(ISharedImages.GRID_OBJ).createImage();
mainRasterMaps = AbstractUIPlugin
.imageDescriptorFromPlugin(JGrassPlugin.PLUGIN_ID, "icons/obj16/jgrass_obj.gif").createImage(); //$NON-NLS-1$
grassasciiRasterMaps = AbstractUIPlugin.imageDescriptorFromPlugin(JGrassPlugin.PLUGIN_ID,
Expand Down
Expand Up @@ -241,7 +241,7 @@ public JGrassMapGeoResourceInfo( IProgressMonitor monitor ) {
.getJGrassCrs();
bounds = new ReferencedEnvelope(fileWindow.getEnvelope(), grassCrs);

super.icon = CatalogUIPlugin.getImageDescriptor(ISharedImages.GRID_OBJ);
super.icon = CatalogUIPlugin.getDefault().getImageDescriptor(ISharedImages.GRID_OBJ);
}
/*
* what if it is a grass ascii raster map?
Expand Down Expand Up @@ -286,7 +286,7 @@ else if (JGrassMapGeoResource.this.type.equals(JGrassConstants.FTRASTERMAP)) {
* what if it is a vector map
*/
else if (JGrassMapGeoResource.this.type.equals(JGrassConstants.GRASS6VECTORMAP)) {
super.icon = CatalogUIPlugin.getImageDescriptor(ISharedImages.FEATURE_OBJ);
super.icon = CatalogUIPlugin.getDefault().getImageDescriptor(ISharedImages.FEATURE_OBJ);
}
/*
* what if it is a point map
Expand Down Expand Up @@ -327,9 +327,9 @@ else if (JGrassMapGeoResource.this.type.equals(JGrassConstants.SITESMAP)) {

bounds = new ReferencedEnvelope(tmpBounds,
((JGrassMapsetGeoResource) JGrassMapGeoResource.this.parent).getJGrassCrs());
super.icon = CatalogUIPlugin.getImageDescriptor(ISharedImages.PIXEL_OBJ);
super.icon = CatalogUIPlugin.getDefault().getImageDescriptor(ISharedImages.PIXEL_OBJ);
} else {
super.icon = CatalogUIPlugin.getImageDescriptor(ISharedImages.GRID_MISSING);
super.icon = CatalogUIPlugin.getDefault().getImageDescriptor(ISharedImages.GRID_MISSING);
}
} catch (Exception e) {
super.icon = AbstractUIPlugin.imageDescriptorFromPlugin(JGrassPlugin.PLUGIN_ID, "icons/obj16/problem.gif"); //$NON-NLS-1$
Expand Down
Expand Up @@ -367,7 +367,7 @@ public JGrassMapsetGeoResourceInfo( IProgressMonitor monitor ) throws IOExceptio
// calculate bounds
JGrassRegion activeRegionWindow = getActiveRegionWindow();
this.bounds = new ReferencedEnvelope(activeRegionWindow.getEnvelope(), getCRS());
super.icon = CatalogUIPlugin.getImageDescriptor(ISharedImages.CATALOG_OBJ);
super.icon = CatalogUIPlugin.getDefault().getImageDescriptor(ISharedImages.CATALOG_OBJ);
}

public CoordinateReferenceSystem getCRS() {
Expand Down Expand Up @@ -405,7 +405,7 @@ public CoordinateReferenceSystem getJGrassCrs() {

public ImageDescriptor getIcon( IProgressMonitor monitor ) {
if (icon == null) {
icon = CatalogUIPlugin.getImageDescriptor(ISharedImages.GRID_OBJ);
icon = CatalogUIPlugin.getDefault().getImageDescriptor(ISharedImages.GRID_OBJ);
}
return icon;
}
Expand Down
Expand Up @@ -93,22 +93,22 @@ public Image getImage( Object element ) {
String name = element.getClass().getSimpleName();

if (element instanceof JDBCDataStoreFactory) {
return CatalogUIPlugin.getImage(ISharedImages.DATABASE_OBJ);
return CatalogUIPlugin.getDefault().getImage(ISharedImages.DATABASE_OBJ);
}
if (element instanceof FileDataStoreFactorySpi) {
return CatalogUIPlugin.getImage(ISharedImages.FEATURE_FILE_OBJ);
return CatalogUIPlugin.getDefault().getImage(ISharedImages.FEATURE_FILE_OBJ);
}
if (name.indexOf("WFSDataStoreFactory") != -1) {
return CatalogUIPlugin.getImage(ISharedImages.WFS_OBJ);
return CatalogUIPlugin.getDefault().getImage(ISharedImages.WFS_OBJ);
}
if (name.indexOf("PropertyDataStoreFactory") != -1){
return CatalogUIPlugin.getImage(ISharedImages.FEATURE_FILE_OBJ );
return CatalogUIPlugin.getDefault().getImage(ISharedImages.FEATURE_FILE_OBJ );
}
if (name.indexOf("PostgisDataStoreFactory")!=-1){
return CatalogUIPlugin.getImage(ISharedImages.DATABASE_OBJ);
return CatalogUIPlugin.getDefault().getImage(ISharedImages.DATABASE_OBJ);
}
if (element instanceof DataStoreFactorySpi) {
return CatalogUIPlugin.getImage(ISharedImages.DATASTORE_OBJ );
return CatalogUIPlugin.getDefault().getImage(ISharedImages.DATASTORE_OBJ );
}
return super.getImage(element);
}
Expand Down
Expand Up @@ -45,7 +45,7 @@ public FeatureSourceGeoResourceInfo( ResourceInfo info ) {
this.title = title.replace('_', ' ');
}

this.icon = CatalogUIPlugin.getImageDescriptor( ISharedImages.FEATURE_OBJ ); // generic!
this.icon = CatalogUIPlugin.getDefault().getImageDescriptor( ISharedImages.FEATURE_OBJ ); // generic!
}
/**
* Can be called to refresh the bounds from the internal info object.
Expand Down
Expand Up @@ -101,7 +101,7 @@ public ID toID( DataAccessFactory factory, Map<String, ? > params ) {

@Override
public ImageDescriptor getIcon() {
return CatalogUIPlugin.getImageDescriptor( ISharedImages.DATABASE_OBJ ); // generic!
return CatalogUIPlugin.getDefault().getImageDescriptor( ISharedImages.DATABASE_OBJ ); // generic!
}
},
FILE {
Expand Down Expand Up @@ -146,7 +146,7 @@ public ID toID( DataAccessFactory factory, Map<String, ? > params ) {
}
@Override
public ImageDescriptor getIcon() {
return CatalogUIPlugin.getImageDescriptor( ISharedImages.FEATURE_FILE_OBJ ); // generic!
return CatalogUIPlugin.getDefault().getImageDescriptor( ISharedImages.FEATURE_FILE_OBJ ); // generic!
}
},
WFS {
Expand All @@ -172,7 +172,7 @@ public ID toID( DataAccessFactory factory, Map<String, ? > params ) {
}
@Override
public ImageDescriptor getIcon() {
return CatalogUIPlugin.getImageDescriptor( ISharedImages.WFS_OBJ ); // generic!
return CatalogUIPlugin.getDefault().getImageDescriptor( ISharedImages.WFS_OBJ ); // generic!
}
},
PROPERTY {
Expand Down Expand Up @@ -202,7 +202,7 @@ public ID toID( DataAccessFactory factory, Map<String, ? > params ) {
}
@Override
public ImageDescriptor getIcon() {
return CatalogUIPlugin.getImageDescriptor( ISharedImages.FEATURE_FILE_OBJ ); // generic!
return CatalogUIPlugin.getDefault().getImageDescriptor( ISharedImages.FEATURE_FILE_OBJ ); // generic!
}
},
OTHER {
Expand Down Expand Up @@ -258,7 +258,7 @@ public ID toID( DataAccessFactory factory, Map<String, ? > params ) {
}
@Override
public ImageDescriptor getIcon() {
return CatalogUIPlugin.getImageDescriptor( ISharedImages.DATASTORE_OBJ ); // generic!
return CatalogUIPlugin.getDefault().getImageDescriptor( ISharedImages.DATASTORE_OBJ ); // generic!
}
};

Expand Down
Expand Up @@ -48,7 +48,7 @@ public class LocalProcessInfo extends IProcessInfo {
if (version != null) {
this.keywords = new String[]{version};
}
icon = CatalogUIPlugin
icon = CatalogUIPlugin.getDefault()
.getImageDescriptor(ISharedImages.GRID_OBJ);
}
}
Expand Down
Expand Up @@ -199,7 +199,7 @@ public void run() {

Messages.initAction(removeAction, "action_remove"); //$NON-NLS-1$
removeAction.setEnabled(false);
removeAction.setImageDescriptor(CatalogUIPlugin.getImageDescriptor(ImageConstants.REMOVE_CO));
removeAction.setImageDescriptor(CatalogUIPlugin.getDefault().getImageDescriptor(ImageConstants.REMOVE_CO));
removeAction.setActionDefinitionId("org.eclipse.ui.edit.delete"); //$NON-NLS-1$
getViewSite().getActionBars().setGlobalActionHandler(ActionFactory.DELETE.getId(), removeAction);
getSite().getKeyBindingService().registerAction(removeAction);
Expand Down Expand Up @@ -335,7 +335,7 @@ private void createToolbar() {
IWorkbenchWindow window = getSite().getWorkbenchWindow();
IAction action = ActionFactory.IMPORT.create(window);

action.setImageDescriptor(CatalogUIPlugin
action.setImageDescriptor(CatalogUIPlugin.getDefault()
.getImageDescriptor(ImageConstants.PATH_ETOOL + "import_wiz.gif")); //$NON-NLS-1$
mgr.add(action);

Expand Down
Expand Up @@ -81,7 +81,7 @@ public ResourceSelectionPage( String pageName ) {
setTitle(Messages.ResourceSelectionPage_title);
setMessage(Messages.ResourceSelectionPage_message);
setDescription(Messages.ResourceSelectionPage_description);
setImageDescriptor(CatalogUIPlugin.getImageDescriptor(ImageConstants.CHOOSE_LAYER_WIZARD));
setImageDescriptor(CatalogUIPlugin.getDefault().getImageDescriptor(ImageConstants.CHOOSE_LAYER_WIZARD));
schemaSelected = null;
}

Expand Down
Expand Up @@ -90,14 +90,14 @@ public Image decorateImage( Image image, Object element ) {
}
switch( service.getStatus() ) {
case CONNECTED:
return overlayCache.applyStatus(image, CatalogUIPlugin
return overlayCache.applyStatus(image, CatalogUIPlugin.getDefault()
.getImageDescriptor(ImageConstants.CONNECTED_OVR));

case NOTCONNECTED:
return overlayCache.applyStatus(image, CatalogUIPlugin.getImageDescriptor(ImageConstants.WAIT_OVR));
return overlayCache.applyStatus(image, CatalogUIPlugin.getDefault().getImageDescriptor(ImageConstants.WAIT_OVR));

case BROKEN:
return overlayCache.applyStatus(image, CatalogUIPlugin.getImageDescriptor(ImageConstants.ERROR_OVR));
return overlayCache.applyStatus(image, CatalogUIPlugin.getDefault().getImageDescriptor(ImageConstants.ERROR_OVR));

default:
return image;
Expand Down
Expand Up @@ -277,7 +277,7 @@ private Text createLabelAndText( Composite parent, String labelText, int textSty
ImageRegistry imageRegistry = CatalogUIPlugin.getDefault().getImageRegistry();
Image image = imageRegistry.get(REQUIRED_DECORATION);
if (image == null) {
image = CatalogUIPlugin.getImageDescriptor(ISharedImages.WARNING_OVR).createImage();
image = CatalogUIPlugin.getDefault().getImageDescriptor(ISharedImages.WARNING_OVR).createImage();
imageRegistry.put(REQUIRED_DECORATION, image);
}
decoration.setImage(image);
Expand Down

0 comments on commit e762cb1

Please sign in to comment.