Author: rob.stryker(a)jboss.com
Date: 2011-11-18 00:10:12 -0500 (Fri, 18 Nov 2011)
New Revision: 36431
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/EarArtifactAdapter.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/META-INF/MANIFEST.MF
trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml
Log:
JBIDE-9893 - browser open for ear project
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/META-INF/MANIFEST.MF 2011-11-18
04:21:00 UTC (rev 36430)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/META-INF/MANIFEST.MF 2011-11-18
05:10:12 UTC (rev 36431)
@@ -22,7 +22,8 @@
org.eclipse.wst.common.frameworks;bundle-version="1.2.0",
org.eclipse.jst.jee;bundle-version="1.0.401",
org.eclipse.core.commands;bundle-version="3.6.0",
- org.eclipse.pde.core;bundle-version="3.7.0"
+ org.eclipse.pde.core;bundle-version="3.7.0",
+ org.eclipse.jst.j2ee.web;bundle-version="1.1.500"
Bundle-ActivationPolicy: lazy
Export-Package: org.jboss.ide.eclipse.as.core,
org.jboss.ide.eclipse.as.core.extensions.descriptors,
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/EarArtifactAdapter.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/EarArtifactAdapter.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/modules/EarArtifactAdapter.java 2011-11-18
05:10:12 UTC (rev 36431)
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.core.modules;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jst.j2ee.internal.web.deployables.WebDeployableArtifactUtil;
+import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IModuleArtifact;
+import org.eclipse.wst.server.core.ServerUtil;
+import org.eclipse.wst.server.core.model.ModuleArtifactAdapterDelegate;
+import org.eclipse.wst.server.core.model.ModuleDelegate;
+
+public class EarArtifactAdapter extends ModuleArtifactAdapterDelegate {
+
+ public EarArtifactAdapter() {
+ }
+
+ @Override
+ public IModuleArtifact getModuleArtifact(Object obj) {
+ if( obj instanceof IProject) {
+ IProject p = (IProject)obj;
+ IModule[] mods = ServerUtil.getModules(p);
+ for( int i = 0; i < mods.length; i++ ) {
+ if( mods[i].getModuleType().getId().equals(IModuleConstants.JST_EAR_MODULE)) {
+ return getArtifactFor(mods[i]);
+ }
+ }
+ }
+ return null;
+ }
+
+ protected IModuleArtifact getArtifactFor(IModule ear) {
+ ModuleDelegate del = (ModuleDelegate)ear.loadAdapter(ModuleDelegate.class, null);
+ IModule[] children = del.getChildModules();
+ IModuleArtifact tmp = null;
+ for( int i = 0; i < children.length; i++ ) {
+ String typeId = children[i].getModuleType().getId();
+ if( typeId.equals(IModuleConstants.JST_WEB_MODULE) ||
typeId.equals(IModuleConstants.WST_WEB_MODULE))
+ tmp = WebDeployableArtifactUtil.getModuleObject(children[i].getProject());
+ if( tmp != null )
+ return tmp;
+ }
+ return null;
+ }
+
+}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml 2011-11-18 04:21:00 UTC (rev
36430)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/plugin.xml 2011-11-18 05:10:12 UTC (rev
36431)
@@ -1091,4 +1091,24 @@
</publisher>
</extension>
+
+ <extension
+ point="org.eclipse.wst.server.core.moduleArtifactAdapters">
+ <moduleArtifactAdapter
+ class="org.jboss.ide.eclipse.as.core.modules.EarArtifactAdapter"
+ id="org.jboss.ide.eclipse.as.core.modules.EarArtifactAdapter"
+ priority="20">
+ <enablement>
+ <with variable="selection">
+ <adapt type="org.eclipse.core.resources.IProject">
+ <test
+ forcePluginActivation="true"
+
property="org.eclipse.wst.common.project.facet.core.projectFacet"
+ value="jst.ear">
+ </test>
+ </adapt>
+ </with></enablement>
+ </moduleArtifactAdapter>
+ </extension>
+
</plugin>