Permalink
Browse files

IDE-880

  • Loading branch information...
1 parent 15a127d commit 1cb16c94d4ddab76f2a276923d9acffa6e29bfde @gamerson gamerson committed Mar 28, 2013
@@ -28,7 +28,7 @@
/**
* The activator class controls the plugin life cycle
- *
+ *
* @auther Greg Amerson
*/
public class LiferayServerUIPlugin extends AbstractUIPlugin
@@ -47,7 +47,7 @@
/**
* Returns the shared instance
- *
+ *
* @return the shared instance
*/
public static LiferayServerUIPlugin getDefault()
@@ -57,7 +57,7 @@ public static LiferayServerUIPlugin getDefault()
/**
* Return the image with the given key from the image registry.
- *
+ *
* @param key
* java.lang.String
* @return org.eclipse.jface.parts.IImage
@@ -132,7 +132,7 @@ public void stop( BundleContext context ) throws Exception
/**
* Register an image with the registry.
- *
+ *
* @param key
* java.lang.String
* @param partialURL
@@ -163,7 +163,17 @@ private void registerImage( ImageRegistry registry, String key, String partialUR
protected ImageRegistry createImageRegistry()
{
- ImageRegistry registry = new ImageRegistry();
+ final ImageRegistry registry = new ImageRegistry();
+
+ final String[] pluginTypes = new String[]
+ {
+ "portlet", "hook", "ext", "layouttpl", "theme" //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$ //$NON-NLS-5$
+ };
+
+ for (String type : pluginTypes)
+ {
+ registerImage( registry, type, "/icons/e16/" + type + ".png" ); //$NON-NLS-1$ //$NON-NLS-2$
+ }
registerImage( registry, IMG_WIZ_RUNTIME, "wizban/liferay_wiz.png" ); //$NON-NLS-1$
@@ -25,6 +25,7 @@
import org.eclipse.swt.graphics.Image;
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.ui.internal.view.servers.ModuleServer;
/**
@@ -51,24 +52,31 @@ else if( element instanceof ModuleServer )
{
try
{
- ModuleServer server = (ModuleServer) element;
- IProject project = server.getModule()[0].getProject();
- IFacetedProject facetedProject = ProjectUtil.getFacetedProject( project );
+ final ModuleServer server = (ModuleServer) element;
- if( facetedProject != null )
- {
- IProjectFacet liferayFacet = ProjectUtil.getLiferayFacet( facetedProject );
- ISDKTemplate sdkTemplate = LiferayProjectCore.getSDKTemplate( liferayFacet );
+ // IDE-880 check to make sure this element isn't a nested jar
+ final IModule module = server.getModule()[ server.module.length - 1 ];
- return LiferayServerUIPlugin.imageDescriptorFromPlugin(
- LiferayServerUIPlugin.PLUGIN_ID, "/icons/e16/" + sdkTemplate.getShortName() + ".png" ).createImage(); //$NON-NLS-1$ //$NON-NLS-2$
- }
- else
+ if( "jst.web".equals( module.getModuleType().getId() ) ) //$NON-NLS-1$
{
- String type = ProjectUtil.getLiferayPluginType( project.getLocation().toOSString() );
+ final IProject project = module.getProject();
+ final IFacetedProject facetedProject = ProjectUtil.getFacetedProject( project );
+
+ String imageKey = null;
+
+ if( facetedProject != null )
+ {
+ IProjectFacet liferayFacet = ProjectUtil.getLiferayFacet( facetedProject );
+ ISDKTemplate sdkTemplate = LiferayProjectCore.getSDKTemplate( liferayFacet );
+
+ imageKey = sdkTemplate.getShortName();
+ }
+ else
+ {
+ imageKey = ProjectUtil.getLiferayPluginType( project.getLocation().toOSString() );
+ }
- return LiferayServerUIPlugin.imageDescriptorFromPlugin(
- LiferayServerUIPlugin.PLUGIN_ID, "/icons/e16/" + type + ".png" ).createImage(); //$NON-NLS-1$ //$NON-NLS-2$
+ return LiferayServerUIPlugin.getDefault().getImageRegistry().get( imageKey );
}
}
catch( Exception ex )

0 comments on commit 1cb16c9

Please sign in to comment.