JBoss Tools SVN: r15820 - in trunk/seam/tests/org.jboss.tools.seam.core.test: src/org/jboss/tools/seam/core/test and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-06-09 10:15:27 -0400 (Tue, 09 Jun 2009)
New Revision: 15820
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/projects/TestScanner/WebContent/WEB-INF/components.xml
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/ScannerTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4393 Tests added
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/projects/TestScanner/WebContent/WEB-INF/components.xml
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/projects/TestScanner/WebContent/WEB-INF/components.xml 2009-06-09 14:04:35 UTC (rev 15819)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/projects/TestScanner/WebContent/WEB-INF/components.xml 2009-06-09 14:15:27 UTC (rev 15820)
@@ -33,4 +33,7 @@
<factory name="factory1" scope="conversation"/>
+ <component class="java.lang.Boolean" name="duplicated"/>
+ <component class="java.lang.Boolean" name="duplicated"/>
+
</components>
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/ScannerTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/ScannerTest.java 2009-06-09 14:04:35 UTC (rev 15819)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/ScannerTest.java 2009-06-09 14:15:27 UTC (rev 15820)
@@ -170,6 +170,16 @@
assertTrue("Declared factory 'factory1' is not found in components.xml", factory != null);
ISeamXmlFactory af = (ISeamXmlFactory)factory;
assertTrue("Scope of 'factory1' must be 'conversation'", af.getScope() == ScopeType.CONVERSATION);
+
+ //4. components.xml has duplicated entry
+ //<component class="java.lang.Boolean" name="duplicated"/>
+ // check that
+ // both declarations for "duplicated" are loaded
+ int duplicatedCount = 0;
+ for (int i = 0; i < cs.length; i++) {
+ if("duplicated".equals(cs[i].getName())) duplicatedCount++;
+ }
+ assertEquals("There are 2 declarations of component \"duplicated\" in xml.", 2, duplicatedCount);
}
private ISeamComponentDeclaration findDeclaration(ISeamComponentDeclaration[] declarations, String name) {
15 years, 6 months
JBoss Tools SVN: r15819 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-06-09 10:04:35 -0400 (Tue, 09 Jun 2009)
New Revision: 15819
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXmlComponentDeclaration.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4393
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXmlComponentDeclaration.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXmlComponentDeclaration.java 2009-06-09 13:57:08 UTC (rev 15818)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamXmlComponentDeclaration.java 2009-06-09 14:04:35 UTC (rev 15819)
@@ -31,7 +31,7 @@
String className = null;
String installed = null;
String jndiName = null;
- String precedence = null;
+ String precedence = "20";
String scope = null;
boolean isClassNameGuessed = false;
@@ -123,6 +123,9 @@
public void setPrecedence(String precedence) {
this.precedence = precedence;
+ if(precedence == null || precedence.length() == 0) {
+ precedence = "20";
+ }
}
public void setPrecedence(IValueInfo value) {
15 years, 6 months
JBoss Tools SVN: r15818 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-06-09 09:57:08 -0400 (Tue, 09 Jun 2009)
New Revision: 15818
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponent.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4393
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponent.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponent.java 2009-06-09 13:53:09 UTC (rev 15817)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponent.java 2009-06-09 13:57:08 UTC (rev 15818)
@@ -115,6 +115,7 @@
//ignore here
}
}
+ if(xml.size() > 0) return 20;
ISeamJavaComponentDeclaration javaDeclaration = getJavaDeclaration();
if(javaDeclaration != null) return javaDeclaration.getPrecedence();
return 20;
15 years, 6 months
JBoss Tools SVN: r15817 - in trunk/seam/plugins/org.jboss.tools.seam.xml: resources/meta and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-06-09 09:53:09 -0400 (Tue, 09 Jun 2009)
New Revision: 15817
Added:
trunk/seam/plugins/org.jboss.tools.seam.xml/src/org/jboss/tools/seam/xml/components/model/SeamComponetImpl.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.xml/plugin.xml
trunk/seam/plugins/org.jboss.tools.seam.xml/resources/meta/seam-components.meta
Log:
https://jira.jboss.org/jira/browse/JBIDE-4393
Modified: trunk/seam/plugins/org.jboss.tools.seam.xml/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.xml/plugin.xml 2009-06-09 13:49:35 UTC (rev 15816)
+++ trunk/seam/plugins/org.jboss.tools.seam.xml/plugin.xml 2009-06-09 13:53:09 UTC (rev 15817)
@@ -46,6 +46,9 @@
<xclass id="org.jboss.tools.seam.xml.components.model.SeamComponentsEntityRecognizer"
class="org.jboss.tools.seam.xml.components.model.SeamComponentsEntityRecognizer"/>
+ <xclass id="org.jboss.tools.seam.xml.components.model.SeamComponetImpl"
+ class="org.jboss.tools.seam.xml.components.model.SeamComponetImpl"/>
+
<xclass id="org.jboss.tools.seam.xml.components.model.constraint.ListELConstraint"
class="org.jboss.tools.seam.xml.components.model.constraint.ListELConstraint"/>
<xclass id="org.jboss.tools.seam.xml.components.model.constraint.IntELConstraint"
Modified: trunk/seam/plugins/org.jboss.tools.seam.xml/resources/meta/seam-components.meta
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.xml/resources/meta/seam-components.meta 2009-06-09 13:49:35 UTC (rev 15816)
+++ trunk/seam/plugins/org.jboss.tools.seam.xml/resources/meta/seam-components.meta 2009-06-09 13:53:09 UTC (rev 15817)
@@ -1268,8 +1268,9 @@
</XActionItem>
<XDependencies/>
</XModelEntity>
- <XModelEntity ImplementingClass="%Custom%"
- PROPERTIES="formFactory=%Default%;formLayout=org.jboss.tools.seam.xml.ui.editor.form.SeamXMLFormLayoutData;children=%Ordered%"
+ <XModelEntity
+ ImplementingClass="org.jboss.tools.seam.xml.components.model.SeamComponetImpl"
+ PROPERTIES="formFactory=%Default%;formLayout=org.jboss.tools.seam.xml.ui.editor.form.SeamXMLFormLayoutData;children=%Ordered%;unique=true"
XMLSUBPATH="component" name="SeamComponent">
<XChildrenEntities>
<XChildEntity name="SeamProperty"/>
@@ -1333,6 +1334,7 @@
<XModelAttribute TRIM="no" name="comment" visibility="false" xmlname="#comment">
<Editor name="Note"/>
</XModelAttribute>
+ <XModelAttribute name="_id_" visibility="false"/>
</XModelAttributes>
<XActionItem kind="list">
<XActionItem kind="list" name="CreateActions">
@@ -1391,8 +1393,9 @@
</XActionItem>
<XDependencies/>
</XModelEntity>
- <XModelEntity ImplementingClass="%Custom%"
- PROPERTIES="formFactory=%Default%;formLayout=org.jboss.tools.seam.xml.ui.editor.form.SeamXMLFormLayoutData;children=%Ordered%"
+ <XModelEntity
+ ImplementingClass="org.jboss.tools.seam.xml.components.model.SeamComponetImpl"
+ PROPERTIES="formFactory=%Default%;formLayout=org.jboss.tools.seam.xml.ui.editor.form.SeamXMLFormLayoutData;children=%Ordered%;unique=true"
XMLSUBPATH="component" name="SeamComponent20">
<XChildrenEntities>
<XChildEntity name="SeamProperty"/>
@@ -1474,6 +1477,7 @@
<XModelAttribute TRIM="no" name="comment" visibility="false" xmlname="#comment">
<Editor name="Note"/>
</XModelAttribute>
+ <XModelAttribute name="_id_" visibility="false"/>
</XModelAttributes>
<XActionItem kind="list">
<XActionItem kind="list" name="CreateActions">
@@ -1516,8 +1520,9 @@
</XActionItem>
<XDependencies/>
</XModelEntity>
- <XModelEntity ImplementingClass="%Custom%"
- PROPERTIES="formFactory=%Default%;formLayout=org.jboss.tools.seam.xml.ui.editor.form.SeamXMLFormLayoutData;children=%Ordered%"
+ <XModelEntity
+ ImplementingClass="org.jboss.tools.seam.xml.components.model.SeamComponetImpl"
+ PROPERTIES="formFactory=%Default%;formLayout=org.jboss.tools.seam.xml.ui.editor.form.SeamXMLFormLayoutData;children=%Ordered%;unique=true"
XMLSUBPATH="component" name="SeamComponent21">
<XChildrenEntities>
<XChildEntity name="SeamProperty"/>
@@ -1541,6 +1546,7 @@
<XModelAttribute TRIM="no" name="comment" visibility="false" xmlname="#comment">
<Editor name="Note"/>
</XModelAttribute>
+ <XModelAttribute name="_id_" visibility="false"/>
</XModelAttributes>
<XActionItem kind="list">
<XActionItem kind="list" name="CreateActions">
Added: trunk/seam/plugins/org.jboss.tools.seam.xml/src/org/jboss/tools/seam/xml/components/model/SeamComponetImpl.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.xml/src/org/jboss/tools/seam/xml/components/model/SeamComponetImpl.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.xml/src/org/jboss/tools/seam/xml/components/model/SeamComponetImpl.java 2009-06-09 13:53:09 UTC (rev 15817)
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.tools.seam.xml.components.model;
+
+import org.jboss.tools.common.model.impl.CustomizedObjectImpl;
+import org.jboss.tools.common.model.util.XModelObjectLoaderUtil;
+
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class SeamComponetImpl extends CustomizedObjectImpl {
+ private static final long serialVersionUID = 1L;
+
+ public SeamComponetImpl() {}
+
+ public String getPathPart() {
+ String id = get(XModelObjectLoaderUtil.ATTR_ID_NAME);
+ if(id == null || id.length() == 0) {
+ return super.getPathPart();
+ } else {
+ return "" + super.getPathPart() + ":" + id;
+ }
+ }
+
+}
Property changes on: trunk/seam/plugins/org.jboss.tools.seam.xml/src/org/jboss/tools/seam/xml/components/model/SeamComponetImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 6 months
JBoss Tools SVN: r15816 - in trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common: meta/action/impl/handlers and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-06-09 09:49:35 -0400 (Tue, 09 Jun 2009)
New Revision: 15816
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/DefaultWizardDataValidator.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/handlers/DefaultCreateHandler.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/engines/impl/EnginesLoader.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/AbstractExtendedXMLFileImpl.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/RegularObjectImpl.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseResourceUtil.java
Log:
https://jira.jboss.org/jira/browse/ JBIDE-4393
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/DefaultWizardDataValidator.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/DefaultWizardDataValidator.java 2009-06-09 12:31:48 UTC (rev 15815)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/DefaultWizardDataValidator.java 2009-06-09 13:49:35 UTC (rev 15816)
@@ -114,7 +114,9 @@
protected boolean checkChild(XModelObject parent, String entity, Properties data) {
XModelObject o = support.getTarget().getModel().createModelObject(entity, data);
- if(o.getModelEntity().getAttribute(XModelObjectLoaderUtil.ATTR_ID_NAME) != null) return true;
+ if(o.getModelEntity().getAttribute(XModelObjectLoaderUtil.ATTR_ID_NAME) != null
+ && !"true".equals(o.getModelEntity().getProperty("unique"))) return true;
+ System.out.println(o.getModelEntity().getProperty("unique") + ":" + o.getPathPart());
if(o != null && parent == support.getTarget().getParent() && o.getPathPart().equals(support.getTarget().getPathPart())) return true;
if(o != null) message = DefaultCreateHandler.getContainsMessage(parent, o);
return message == null;
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/handlers/DefaultCreateHandler.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/handlers/DefaultCreateHandler.java 2009-06-09 12:31:48 UTC (rev 15815)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/action/impl/handlers/DefaultCreateHandler.java 2009-06-09 13:49:35 UTC (rev 15816)
@@ -145,12 +145,20 @@
public static void addCreatedObject(XModelObject parent, XModelObject child, Properties whereSelect) throws XModelException {
addCreatedObject(parent, child, true, whereSelect);
}
-
+
public static String getContainsMessage(XModelObject parent, XModelObject child) {
+ return getContainsMessage(parent, child, true);
+ }
+
+ private static String getContainsMessage(XModelObject parent, XModelObject child, boolean forceUnique) {
String pathpart = child.getPathPart();
XModelObject e = parent.getChildByPath(pathpart);
if(e != null && e != parent && e != parent.getParent()) {
- if(child.getModelEntity().getAttribute(XModelObjectLoaderUtil.ATTR_ID_NAME) != null) return null;
+ if(child.getModelEntity().getAttribute(XModelObjectLoaderUtil.ATTR_ID_NAME) != null) {
+ if(!forceUnique || !"true".equals(child.getModelEntity().getProperty("unique"))) {
+ return null;
+ }
+ }
String tp = title(parent, true), tc = title(child, false), te = title(e, false);
String mes = (tc.equals(te))
? bundle.getMessage("model", "CONTAINS_OBJECT_1",
@@ -172,7 +180,7 @@
public static void addCreatedObject(XModelObject parent, final XModelObject child, boolean registerundo, final int whereSelect) throws XModelException {
if(child == null) throw new XModelException(getMessageById("OBJECT_CREATION_FAILURE"));
- String mes = getContainsMessage(parent, child);
+ String mes = getContainsMessage(parent, child, false);
if(mes != null) throw new XModelException(mes);
String ce = child.getModelEntity().getName();
XChild c = parent.getModelEntity().getChild(ce);
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/engines/impl/EnginesLoader.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/engines/impl/EnginesLoader.java 2009-06-09 12:31:48 UTC (rev 15815)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/engines/impl/EnginesLoader.java 2009-06-09 13:49:35 UTC (rev 15816)
@@ -84,10 +84,17 @@
c = findAppropriateChild(set, cs[i], map);
if(c == null) {
c = cs[i].copy();
+ object.addChild(c);
} else {
- merge(c, cs[i], fire);
+ boolean has_id = c.getModelEntity().getAttribute(XModelObjectLoaderUtil.ATTR_ID_NAME) != null;
+ if(has_id) {
+ c.removeFromParent();
+ EnginesLoader.merge(c, cs[i], false);
+ object.addChild(c);
+ } else {
+ EnginesLoader.merge(c, cs[i], fire);
+ }
}
- object.addChild(c);
} else if(c.getModelEntity().getName().equals(cs[i].getModelEntity().getName())) {
merge(c, cs[i], fire);
} else {
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/AbstractExtendedXMLFileImpl.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/AbstractExtendedXMLFileImpl.java 2009-06-09 12:31:48 UTC (rev 15815)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/filesystems/impl/AbstractExtendedXMLFileImpl.java 2009-06-09 13:49:35 UTC (rev 15816)
@@ -291,7 +291,14 @@
c = cs[i].copy();
addChild(c);
} else {
- EnginesLoader.merge(c, cs[i], fire);
+ boolean has_id = c.getModelEntity().getAttribute(XModelObjectLoaderUtil.ATTR_ID_NAME) != null;
+ if(has_id) {
+ c.removeFromParent();
+ EnginesLoader.merge(c, cs[i], false);
+ addChild(c);
+ } else {
+ EnginesLoader.merge(c, cs[i], fire);
+ }
}
} else if(c.getModelEntity().getName().equals(cs[i].getModelEntity().getName())) {
EnginesLoader.merge(c, cs[i], fire);
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/RegularObjectImpl.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/RegularObjectImpl.java 2009-06-09 12:31:48 UTC (rev 15815)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/RegularObjectImpl.java 2009-06-09 13:49:35 UTC (rev 15816)
@@ -14,6 +14,7 @@
import org.jboss.tools.common.model.*;
import org.jboss.tools.common.meta.*;
import org.jboss.tools.common.model.event.XModelTreeEvent;
+import org.jboss.tools.common.model.util.XModelObjectLoaderUtil;
public class RegularObjectImpl extends XModelObjectImpl implements XOrderedObject {
private static final long serialVersionUID = 7942041044569562286L;
@@ -106,8 +107,19 @@
RegularObjectImpl p = (RegularObjectImpl)po;
XModelObject c = p.children.change(this, opp, npp);
if(c != null) {
- if(ov == null) properties.remove(name); else super.set(name, ov);
- elementExists(c, name, value);
+ if(getModelEntity().getAttribute(XModelObjectLoaderUtil.ATTR_ID_NAME) != null) {
+ int k = 1;
+ while(c != null) {
+ super.set(XModelObjectLoaderUtil.ATTR_ID_NAME, "" + k);
+ npp = getPathPart();
+ c = p.children.change(this, opp, npp);
+ k++;
+ }
+ return;
+ } else {
+ if(ov == null) properties.remove(name); else super.set(name, ov);
+ elementExists(c, name, value);
+ }
}
}
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseResourceUtil.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseResourceUtil.java 2009-06-09 12:31:48 UTC (rev 15815)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseResourceUtil.java 2009-06-09 13:49:35 UTC (rev 15816)
@@ -210,16 +210,21 @@
}
return false;
}
-
+ static int count = 0;
public static IModelNature getModelNature(IProject p) {
if(p == null || !p.isOpen()) return null;
String[] natures = getModelNatureNames();
for (int i = 0; i < natures.length; i++) {
try {
if(p.hasNature(natures[i])) {
+ long t1 = System.currentTimeMillis();
+ count++;
if(!ModelNature.checkModelNature(p, natures[i])) {
continue;
}
+ long dt = System.currentTimeMillis() - t1;
+ count += (int)dt;
+// System.out.println("--->" + count);
IModelNature n = (IModelNature)p.getNature(natures[i]);
if(n == null) return null;
n = testNature(n);
15 years, 6 months
JBoss Tools SVN: r15815 - in trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam: internal/core/refactoring and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2009-06-09 08:31:48 -0400 (Tue, 09 Jun 2009)
New Revision: 15815
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCoreMessages.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/messages.properties
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/RenameComponentProcessor.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/RenameSeamContextVariableProcessor.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRenameProcessor.java
Log:
Seam Refactor: Added warning message if component has a declaration which is located in jar file https://jira.jboss.org/jira/browse/JBIDE-1077
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCoreMessages.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCoreMessages.java 2009-06-09 12:12:35 UTC (rev 15814)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCoreMessages.java 2009-06-09 12:31:48 UTC (rev 15815)
@@ -44,4 +44,5 @@
public static String RENAME_SEAM_COMPONENT_PROCESSOR_TITLE;
public static String RENAME_SEAM_COMPONENT_PROCESSOR_THIS_IS_NOT_A_SEAM_COMPONENT;
public static String RENAME_SEAM_CONTEXT_VARIABLE_PROCESSOR_TITLE;
+ public static String SEAM_RENAME_PROCESSOR_COMPONENT_HAS_DECLARATION_FROM_JAR;
}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/messages.properties
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/messages.properties 2009-06-09 12:12:35 UTC (rev 15814)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/messages.properties 2009-06-09 12:31:48 UTC (rev 15815)
@@ -32,4 +32,5 @@
RENAME_SEAM_COMPONENT_PROCESSOR_TITLE=Rename Seam Component
RENAME_SEAM_COMPONENT_PROCESSOR_THIS_IS_NOT_A_SEAM_COMPONENT=This is not a Seam Component.
RENAME_SEAM_CONTEXT_VARIABLE_PROCESSOR_TITLE=Rename Seam Context Variable
+SEAM_RENAME_PROCESSOR_COMPONENT_HAS_DECLARATION_FROM_JAR=This component has a declaration which is located in jar file
SEAM_INSTALL_WIZARD_PROJECT_NAME_WITH_UPPERCASE=Project names which start with a capital letter may break Seam/JSF applications; use lower case.
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/RenameComponentProcessor.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/RenameComponentProcessor.java 2009-06-09 12:12:35 UTC (rev 15814)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/RenameComponentProcessor.java 2009-06-09 12:31:48 UTC (rev 15815)
@@ -56,7 +56,10 @@
public RefactoringStatus checkFinalConditions(IProgressMonitor pm,
CheckConditionsContext context) throws CoreException,
OperationCanceledException {
- return new RefactoringStatus();
+ RefactoringStatus status = new RefactoringStatus();
+ if(component != null && isJarDeclarations(component))
+ status.addWarning(SeamCoreMessages.SEAM_RENAME_PROCESSOR_COMPONENT_HAS_DECLARATION_FROM_JAR);
+ return status;
}
/*
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/RenameSeamContextVariableProcessor.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/RenameSeamContextVariableProcessor.java 2009-06-09 12:12:35 UTC (rev 15814)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/RenameSeamContextVariableProcessor.java 2009-06-09 12:31:48 UTC (rev 15815)
@@ -53,7 +53,11 @@
public RefactoringStatus checkFinalConditions(IProgressMonitor pm,
CheckConditionsContext context) throws CoreException,
OperationCanceledException {
- return new RefactoringStatus();
+ RefactoringStatus status = new RefactoringStatus();
+ ISeamComponent component = checkComponent();
+ if(component != null && isJarDeclarations(component))
+ status.addWarning(SeamCoreMessages.SEAM_RENAME_PROCESSOR_COMPONENT_HAS_DECLARATION_FROM_JAR);
+ return status;
}
/*
@@ -64,9 +68,6 @@
public RefactoringStatus checkInitialConditions(IProgressMonitor pm)
throws CoreException, OperationCanceledException {
RefactoringStatus result = new RefactoringStatus();
-// if(getNewName()==null) {
-// result.addFatalError(SeamCoreMessages.RENAME_SEAM_COMPONENT_PROCESSOR_THIS_IS_NOT_A_SEAM_COMPONENT);
-// }
return result;
}
@@ -77,6 +78,7 @@
@Override
public Change createChange(IProgressMonitor pm) throws CoreException,
OperationCanceledException {
+
rootChange = new CompositeChange(SeamCoreMessages.RENAME_SEAM_CONTEXT_VARIABLE_PROCESSOR_TITLE);
ISeamComponent component = checkComponent();
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRenameProcessor.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRenameProcessor.java 2009-06-09 12:12:35 UTC (rev 15814)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRenameProcessor.java 2009-06-09 12:31:48 UTC (rev 15815)
@@ -22,6 +22,7 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jdt.internal.ui.text.FastJavaPartitionScanner;
import org.eclipse.jdt.ui.text.IJavaPartitions;
import org.eclipse.jface.text.BadLocationException;
@@ -29,6 +30,7 @@
import org.eclipse.jface.text.rules.IToken;
import org.eclipse.jface.text.rules.Token;
import org.eclipse.ltk.core.refactoring.CompositeChange;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
import org.eclipse.ltk.core.refactoring.TextFileChange;
import org.eclipse.ltk.core.refactoring.participants.RenameProcessor;
import org.eclipse.text.edits.MultiTextEdit;
@@ -59,6 +61,7 @@
import org.jboss.tools.seam.core.ISeamJavaComponentDeclaration;
import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.core.ISeamXmlComponentDeclaration;
+import org.jboss.tools.seam.core.SeamCoreMessages;
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.SeamProjectsSet;
import org.jboss.tools.seam.internal.core.SeamComponentDeclaration;
@@ -80,7 +83,7 @@
protected static final String SEAM_PROPERTIES_FILE = "seam.properties"; //$NON-NLS-1$
private SeamContextValidationHelper coreHelper = new SeamContextValidationHelper();
-
+
protected CompositeChange rootChange;
protected TextFileChange lastChange;
protected IFile declarationFile=null;
@@ -315,8 +318,24 @@
}
}
+ protected boolean isJarDeclarations(ISeamComponent component) throws CoreException{
+ if(component.getJavaDeclaration() != null){
+ if(coreHelper.isJar(component.getJavaDeclaration()))
+ return true;
+ }
+
+ Set<ISeamXmlComponentDeclaration> xmlDecls = component.getXmlDeclarations();
+
+ for(ISeamXmlComponentDeclaration xmlDecl : xmlDecls){
+ if(coreHelper.isJar(xmlDecl))
+ return true;
+ }
+ return false;
+ }
+
private void renameJavaDeclaration(ISeamJavaComponentDeclaration javaDecl) throws CoreException{
IFile file = (IFile)javaDecl.getResource();
+
if(file != null && !coreHelper.isJar(javaDecl)){
ITextSourceReference location = ((SeamComponentDeclaration)javaDecl).getLocationFor(ISeamXmlComponentDeclaration.NAME);
if(location != null && !isBadLocation(location)){
@@ -328,8 +347,9 @@
declarationFile = file;
}
- private void renameXMLDeclaration(ISeamXmlComponentDeclaration xmlDecl){
+ private void renameXMLDeclaration(ISeamXmlComponentDeclaration xmlDecl) throws CoreException{
IFile file = (IFile)xmlDecl.getResource();
+
if(file != null && !coreHelper.isJar(xmlDecl)){
ITextSourceReference location = ((SeamComponentDeclaration)xmlDecl).getLocationFor(ISeamXmlComponentDeclaration.NAME);
if(location != null && !isBadLocation(location))
15 years, 6 months
JBoss Tools SVN: r15814 - in trunk/seam/plugins/org.jboss.tools.seam.xml: schemas and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2009-06-09 08:12:35 -0400 (Tue, 09 Jun 2009)
New Revision: 15814
Added:
trunk/seam/plugins/org.jboss.tools.seam.xml/schemas/cache-2.1.xsd
trunk/seam/plugins/org.jboss.tools.seam.xml/schemas/document-2.1.xsd
trunk/seam/plugins/org.jboss.tools.seam.xml/schemas/pageflow-2.1.xsd
Modified:
trunk/seam/plugins/org.jboss.tools.seam.xml/plugin.xml
trunk/seam/plugins/org.jboss.tools.seam.xml/schemas/core-2.1.xsd
trunk/seam/plugins/org.jboss.tools.seam.xml/schemas/international-2.1.xsd
trunk/seam/plugins/org.jboss.tools.seam.xml/schemas/pages-2.1.xsd
trunk/seam/plugins/org.jboss.tools.seam.xml/schemas/ui-2.1.xsd
Log:
https://jira.jboss.org/jira/browse/JBIDE-4444
Modified: trunk/seam/plugins/org.jboss.tools.seam.xml/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.xml/plugin.xml 2009-06-09 10:57:08 UTC (rev 15813)
+++ trunk/seam/plugins/org.jboss.tools.seam.xml/plugin.xml 2009-06-09 12:12:35 UTC (rev 15814)
@@ -115,8 +115,6 @@
publicId="-//JBoss/Seam Component Configuration DTD 1.1//EN"
uri="dtds/components-1.1.dtd"/>
-
-
<uri
name="http://jboss.com/products/seam/async-2.0.xsd"
uri="schemas/async-2.0.xsd"/>
@@ -142,6 +140,10 @@
uri="schemas/components-2.1.xsd"/>
<uri
+ name="http://jboss.com/products/seam/cache-2.1.xsd"
+ uri="schemas/cache-2.1.xsd"/>
+
+ <uri
name="http://jboss.com/products/seam/core-2.0.xsd"
uri="schemas/core-2.0.xsd"/>
@@ -158,6 +160,10 @@
uri="schemas/drools-2.1.xsd"/>
<uri
+ name="http://jboss.com/products/seam/document-2.1.xsd"
+ uri="schemas/document-2.1.xsd"/>
+
+ <uri
name="http://jboss.com/products/seam/framework-2.0.xsd"
uri="schemas/framework-2.0.xsd"/>
@@ -202,6 +208,10 @@
uri="schemas/pageflow-2.0.xsd"/>
<uri
+ name="http://jboss.com/products/seam/pageflow-2.1.xsd"
+ uri="schemas/pageflow-2.1.xsd"/>
+
+ <uri
name="http://jboss.com/products/seam/pages-2.0.xsd"
uri="schemas/pages-2.0.xsd"/>
Added: trunk/seam/plugins/org.jboss.tools.seam.xml/schemas/cache-2.1.xsd
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.xml/schemas/cache-2.1.xsd (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.xml/schemas/cache-2.1.xsd 2009-06-09 12:12:35 UTC (rev 15814)
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified"
+ targetNamespace="http://jboss.com/products/seam/cache"
+ xmlns:cache="http://jboss.com/products/seam/cache"
+ xmlns:components="http://jboss.com/products/seam/components"
+ attributeFormDefault="unqualified">
+ <xs:import namespace="http://jboss.com/products/seam/components"
+ schemaLocation="components-2.1.xsd" />
+
+ <xs:element name="eh-cache-provider">
+ <xs:annotation>
+ <xs:documentation>The EHCache provider</xs:documentation>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:attributeGroup ref="components:attlist.component" />
+ <xs:attributeGroup ref="cache:attlist.cacheProvider" />
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="jboss-cache-provider">
+ <xs:annotation>
+ <xs:documentation>The JBoss 1.x Cache provider</xs:documentation>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:attributeGroup ref="components:attlist.component" />
+ <xs:attributeGroup ref="cache:attlist.cacheProvider" />
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="jboss-cache2-provider">
+ <xs:annotation>
+ <xs:documentation>The JBoss 2.x cache provider</xs:documentation>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:attributeGroup ref="components:attlist.component" />
+ <xs:attributeGroup ref="cache:attlist.cacheProvider" />
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="jboss-pojo-cache-provider">
+ <xs:annotation>
+ <xs:documentation>The JBoss 1.x POJOCache provider</xs:documentation>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:attributeGroup ref="components:attlist.component" />
+ <xs:attributeGroup ref="cache:attlist.cacheProvider" />
+ </xs:complexType>
+ </xs:element>
+
+ <xs:attributeGroup name="attlist.cacheProvider">
+ <xs:attribute name="default-region" type="components:string" />
+ <xs:attribute name="configuration" type="components:string" />
+ </xs:attributeGroup>
+
+</xs:schema>
Property changes on: trunk/seam/plugins/org.jboss.tools.seam.xml/schemas/cache-2.1.xsd
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/seam/plugins/org.jboss.tools.seam.xml/schemas/core-2.1.xsd
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.xml/schemas/core-2.1.xsd 2009-06-09 10:57:08 UTC (rev 15813)
+++ trunk/seam/plugins/org.jboss.tools.seam.xml/schemas/core-2.1.xsd 2009-06-09 12:12:35 UTC (rev 15814)
@@ -51,7 +51,6 @@
<xs:attribute name="jndi-pattern" type="components:string" />
<xs:attribute name="security-enabled" type="components:boolean" />
<xs:attribute name="transaction-management-enabled" type="components:boolean"/>
- <xs:attribute name="user-transaction-name" type="components:string"/>
</xs:attributeGroup>
<xs:element name="manager">
Added: trunk/seam/plugins/org.jboss.tools.seam.xml/schemas/document-2.1.xsd
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.xml/schemas/document-2.1.xsd (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.xml/schemas/document-2.1.xsd 2009-06-09 12:12:35 UTC (rev 15814)
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:doc="http://jboss.com/products/seam/document"
+ xmlns:components="http://jboss.com/products/seam/components"
+ targetNamespace="http://jboss.com/products/seam/document"
+ elementFormDefault="qualified"
+ attributeFormDefault="unqualified">
+
+ <xs:import namespace="http://jboss.com/products/seam/components"
+ schemaLocation="components-2.1.xsd"/>
+
+ <xs:element name="document-store">
+ <xs:annotation>
+ <xs:documentation>
+ The document store is used to store rendered documents for download on a later request.
+ </xs:documentation>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:attributeGroup ref="components:attlist.component"/>
+ <xs:attributeGroup ref="doc:attlist.docstore"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:attributeGroup name="attlist.docstore">
+ <xs:attribute name="error-page" type="components:string">
+ <xs:annotation>
+ <xs:documentation>
+ When a document had expired or otherwise cannot be loaded, this page is displayed.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="use-extensions" type="components:boolean">
+ <xs:annotation>
+ <xs:documentation>
+ Controls whether or not the URLs for documents should contain their correct file name
+ extensions. Using file name extensions requires additional configuration in web.xml.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ </xs:attributeGroup>
+</xs:schema>
Property changes on: trunk/seam/plugins/org.jboss.tools.seam.xml/schemas/document-2.1.xsd
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/seam/plugins/org.jboss.tools.seam.xml/schemas/international-2.1.xsd
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.xml/schemas/international-2.1.xsd 2009-06-09 10:57:08 UTC (rev 15813)
+++ trunk/seam/plugins/org.jboss.tools.seam.xml/schemas/international-2.1.xsd 2009-06-09 12:12:35 UTC (rev 15814)
@@ -56,4 +56,17 @@
<xs:attribute name="cookie-enabled" type="components:boolean" />
</xs:attributeGroup>
+ <xs:element name="time-zones">
+ <xs:annotation>
+ <xs:documentation>The time zones provider component</xs:documentation>
+ </xs:annotation>
+ <xs:complexType mixed="true">
+ <xs:attributeGroup ref="components:attlist.component"/>
+ <xs:attributeGroup ref="international:attlist.timeZones"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:attributeGroup name="attlist.timeZones">
+ <xs:attribute name="wrap" type="components:boolean" />
+ </xs:attributeGroup>
+
</xs:schema>
Added: trunk/seam/plugins/org.jboss.tools.seam.xml/schemas/pageflow-2.1.xsd
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.xml/schemas/pageflow-2.1.xsd (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.xml/schemas/pageflow-2.1.xsd 2009-06-09 12:12:35 UTC (rev 15814)
@@ -0,0 +1,326 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<xs:schema xmlns="http://jboss.com/products/seam/pageflow"
+ targetNamespace="http://jboss.com/products/seam/pageflow"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified">
+
+ <!-- PAGEFLOW-DEFINITION -->
+ <!-- ################### -->
+ <xs:element name="pageflow-definition">
+ <xs:complexType>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:group ref="start-node-elements" />
+ <xs:group ref="node-elements" />
+ <xs:group ref="end-node-elements" />
+ <xs:group ref="action-elements" />
+ <xs:element ref="event" />
+ <xs:element ref="exception-handler" />
+ </xs:choice>
+ <xs:attribute name="name" type="xs:string" use="required" />
+ <xs:attribute name="start-page" type="xs:string" />
+ </xs:complexType>
+ </xs:element>
+
+ <!-- NODES -->
+ <!-- ##### -->
+ <xs:element name="start-state">
+ <xs:complexType>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="transition" />
+ <xs:element ref="event" />
+ <xs:element ref="exception-handler" />
+ </xs:choice>
+ <xs:attribute name="name" type="xs:string" />
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="end-state">
+ <xs:complexType>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="event" />
+ <xs:element ref="exception-handler" />
+ </xs:choice>
+ <xs:attribute name="name" type="xs:string" use="required" />
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="process-state">
+ <xs:complexType>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="sub-process" />
+ <xs:element ref="transition" />
+ <xs:element ref="event" />
+ <xs:element ref="exception-handler" />
+ </xs:choice>
+ <xs:attribute name="name" type="xs:string" />
+ <xs:attribute name="binding" type="bindingType" />
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="sub-process">
+ <xs:complexType>
+ <xs:attribute name="name" type="xs:string" use="required" />
+ <xs:attribute name="version" type="xs:integer" />
+ <xs:attribute name="binding" type="bindingType" />
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="start-page">
+ <xs:complexType>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:group ref="page-elements" />
+ </xs:choice>
+ <xs:attributeGroup ref="page-attributes" />
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="decision">
+ <xs:complexType>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:element name="handler" type="delegation" />
+ <xs:element ref="event" />
+ <xs:element ref="exception-handler" />
+ <xs:element name="transition">
+ <xs:complexType>
+ <xs:choice minOccurs="0"
+ maxOccurs="unbounded">
+ <xs:element name="condition">
+ <xs:complexType mixed="true">
+ <xs:sequence minOccurs="0"
+ maxOccurs="unbounded">
+ <xs:any processContents="lax"
+ minOccurs="0" maxOccurs="unbounded" />
+ </xs:sequence>
+ <xs:attribute name="expression"
+ type="xs:string" />
+ </xs:complexType>
+ </xs:element>
+ <xs:group ref="action-elements" />
+ <xs:element ref="exception-handler" />
+ </xs:choice>
+ <xs:attribute name="to" type="xs:string"
+ use="required" />
+ <xs:attribute name="name" type="xs:string" />
+ </xs:complexType>
+ </xs:element>
+ </xs:choice>
+ <xs:attribute name="name" type="xs:string" use="required" />
+ <xs:attribute name="expression" type="xs:string" />
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="page">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:choice minOccurs="0" maxOccurs="1">
+ <xs:element ref="end-conversation" />
+ </xs:choice>
+ <xs:choice minOccurs="0" maxOccurs="1">
+ <xs:element ref="end-task" />
+ </xs:choice>
+ <xs:group ref="page-elements" />
+ </xs:sequence>
+ <xs:attributeGroup ref="page-attributes" />
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="redirect" />
+ <xs:element name="description" type="xs:string" />
+
+ <xs:element name="end-conversation">
+ <xs:complexType>
+ <xs:attribute name="before-redirect" type="booleanType" />
+ <xs:attribute name="create-process" type="xs:string" />
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="end-task">
+ <xs:complexType>
+ <xs:attribute name="transition" type="xs:string" />
+ </xs:complexType>
+ </xs:element>
+
+ <!-- TRANSITION -->
+ <!-- ########## -->
+ <xs:element name="transition">
+ <xs:complexType>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:group ref="action-elements" />
+ <xs:element ref="exception-handler" />
+ </xs:choice>
+ <xs:attribute name="to" type="xs:string" use="required" />
+ <xs:attribute name="name" type="xs:string" />
+ </xs:complexType>
+ </xs:element>
+
+ <!-- ACTIONS -->
+ <!-- ####### -->
+ <xs:element name="action">
+ <xs:complexType mixed="true">
+ <xs:sequence>
+ <xs:any processContents="lax" minOccurs="0"
+ maxOccurs="unbounded" />
+ </xs:sequence>
+ <xs:attribute name="class" type="xs:string" />
+ <xs:attribute name="config-type" default="field" type="xs:string" />
+ <xs:attribute name="name" type="xs:string" />
+ <xs:attribute name="ref-name" type="xs:string" />
+ <xs:attribute name="accept-propagated-events"
+ type="booleanType" default="true" />
+ <xs:attribute name="expression" type="xs:string" />
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="script">
+ <xs:complexType mixed="true">
+ <xs:sequence>
+ <xs:any processContents="lax" minOccurs="0"
+ maxOccurs="unbounded" />
+ </xs:sequence>
+ <xs:attribute name="name" type="xs:string" />
+ <xs:attribute name="accept-propagated-events"
+ type="booleanType" default="true" />
+ </xs:complexType>
+ </xs:element>
+
+ <!-- EVENT -->
+ <!-- ##### -->
+ <xs:element name="event">
+ <xs:complexType>
+ <xs:choice minOccurs="0" maxOccurs="unbounded">
+ <xs:group ref="action-elements" />
+ </xs:choice>
+ <xs:attribute name="type" use="required">
+ <xs:simpleType>
+ <xs:union>
+ <xs:simpleType>
+ <xs:restriction base="xs:string" />
+ </xs:simpleType>
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="node-enter" />
+ <xs:enumeration value="node-leave" />
+ <xs:enumeration value="process-start" />
+ <xs:enumeration value="process-end" />
+ <xs:enumeration value="task-create" />
+ <xs:enumeration value="task-assign" />
+ <xs:enumeration value="task-start" />
+ <xs:enumeration value="task-end" />
+ <xs:enumeration value="before-signal" />
+ <xs:enumeration value="after-signal" />
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:union>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
+
+ <!-- EXCEPTION-HANDLER -->
+ <!-- ################# -->
+ <xs:element name="exception-handler">
+ <xs:complexType>
+ <xs:choice minOccurs="1" maxOccurs="unbounded">
+ <xs:element ref="action" />
+ <xs:element ref="script" />
+ </xs:choice>
+ <xs:attribute name="exception-class" type="xs:string" />
+ </xs:complexType>
+ </xs:element>
+
+ <!-- TYPES AND GROUPS -->
+ <!-- ################ -->
+ <xs:complexType name="delegation" mixed="true">
+ <xs:sequence>
+ <xs:any processContents="lax" minOccurs="0"
+ maxOccurs="unbounded" />
+ </xs:sequence>
+ <xs:attribute name="class" type="xs:string" />
+ <xs:attribute name="config-type" default="field" type="xs:string" />
+ </xs:complexType>
+
+ <xs:simpleType name="configType">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="field" />
+ <xs:enumeration value="bean" />
+ <xs:enumeration value="constructor" />
+ <xs:enumeration value="configuration-property" />
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="booleanType">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="yes" />
+ <xs:enumeration value="no" />
+ <xs:enumeration value="true" />
+ <xs:enumeration value="false" />
+ <xs:enumeration value="on" />
+ <xs:enumeration value="off" />
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="enabledType">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="enabled" />
+ <xs:enumeration value="disabled" />
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:group name="start-node-elements">
+ <xs:choice>
+ <xs:element ref="start-state" />
+ <xs:element ref="start-page" />
+ </xs:choice>
+ </xs:group>
+
+ <xs:group name="node-elements">
+ <xs:choice>
+ <xs:element ref="page" />
+ <xs:element ref="decision" />
+ <xs:element ref="process-state" />
+ </xs:choice>
+ </xs:group>
+
+ <xs:group name="end-node-elements">
+ <xs:choice>
+ <xs:element ref="end-state" />
+ </xs:choice>
+ </xs:group>
+
+ <xs:group name="action-elements">
+ <xs:choice>
+ <xs:element ref="action" />
+ <xs:element ref="script"/>
+ </xs:choice>
+ </xs:group>
+
+ <xs:group name="page-elements">
+ <xs:sequence>
+ <xs:element ref="description" maxOccurs="1" minOccurs="0"/>
+ <xs:element ref="redirect" maxOccurs="1" minOccurs="0"/>
+ <xs:element ref="event" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="exception-handler" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="transition" maxOccurs="unbounded" minOccurs="0"/>
+ <xs:group ref="action-elements" minOccurs="0" maxOccurs="1" />
+ </xs:sequence>
+ </xs:group>
+
+ <xs:attributeGroup name="page-attributes">
+ <xs:attribute name="redirect" type="xs:boolean" />
+ <xs:attribute name="switch" type="enabledType" />
+ <xs:attribute name="no-conversation-view-id" type="xs:string" />
+ <xs:attribute name="timeout" type="xs:int" />
+ <xs:attribute name="back" type="enabledType" />
+ <xs:attribute name="view-id" type="xs:string" use="required" />
+ <xs:attribute name="name" type="xs:string" use="required" />
+ </xs:attributeGroup>
+
+ <xs:simpleType name="bindingType">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="late" />
+ <xs:enumeration value="early" />
+ </xs:restriction>
+ </xs:simpleType>
+
+</xs:schema>
Property changes on: trunk/seam/plugins/org.jboss.tools.seam.xml/schemas/pageflow-2.1.xsd
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/seam/plugins/org.jboss.tools.seam.xml/schemas/pages-2.1.xsd
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.xml/schemas/pages-2.1.xsd 2009-06-09 10:57:08 UTC (rev 15813)
+++ trunk/seam/plugins/org.jboss.tools.seam.xml/schemas/pages-2.1.xsd 2009-06-09 12:12:35 UTC (rev 15814)
@@ -56,6 +56,9 @@
<xs:attributeGroup name="attlist.exception">
<xs:attribute name="class" type="xs:token"/>
<xs:attribute name="log" type="pages:tf-boolean"/>
+ <xs:attribute name="log-level" type="pages:loglevel-values"/>
+
+ <!-- The logLevel attribute is deprecated and will be removed in the next major version! Please use log-level instead -->
<xs:attribute name="logLevel" type="pages:loglevel-values"/>
</xs:attributeGroup>
@@ -140,6 +143,7 @@
<xs:attribute name="validator" type="xs:token" />
<xs:attribute name="validatorId" type="xs:token" />
<xs:attribute name="required" type="pages:tf-boolean"/>
+ <xs:attribute name="validateModel" default="true" type="pages:tf-boolean"/>
</xs:attributeGroup>
<xs:element name="header">
@@ -183,7 +187,7 @@
<xs:attribute name="execute" use="required" type="pages:method-expression" />
</xs:attributeGroup>
- <xs:element name="restrict" type="pages:value-expression">
+ <xs:element name="restrict" type="pages:boolean-value-expression" default="true">
<xs:annotation>
<xs:documentation>Security restrictions</xs:documentation>
</xs:annotation>
@@ -218,7 +222,7 @@
</xs:complexType>
</xs:element>
<xs:attributeGroup name="attlist.navigation">
- <xs:attribute name="from-action" type="pages:method-expression" />
+ <xs:attribute name="from-action" type="pages:from-action-expression" />
<xs:attribute name="evaluate" type="pages:method-expression" />
</xs:attributeGroup>
@@ -245,7 +249,7 @@
</xs:complexType>
</xs:element>
<xs:attributeGroup name="attlist.rule">
- <xs:attribute name="if-outcome" type="pages:value-expression" />
+ <xs:attribute name="if-outcome" type="pages:outcome-expression" />
<xs:attribute name="if" type="pages:boolean-value-expression" />
</xs:attributeGroup>
@@ -462,7 +466,7 @@
<xs:pattern value="http://.*|https://.*"/>
</xs:restriction>
</xs:simpleType>
-
+
<xs:simpleType name="url-expression">
<xs:union memberTypes="pages:url pages:method-expression"></xs:union>
</xs:simpleType>
@@ -473,17 +477,31 @@
<xs:enumeration value="http"/>
</xs:restriction>
</xs:simpleType>
+
+ <xs:simpleType name="outcome">
+ <xs:restriction base="xs:string">
+ <xs:pattern value="[^#\{\}]+"/>
+ </xs:restriction>
+ </xs:simpleType>
<xs:simpleType name="view-id">
<xs:restriction base="xs:string">
<xs:pattern value="(/.*)|\*"/>
</xs:restriction>
</xs:simpleType>
-
+
<xs:simpleType name="view-id-expression">
- <xs:union memberTypes="pages:view-id pages:method-expression"></xs:union>
+ <xs:union memberTypes="pages:view-id pages:value-expression"></xs:union>
</xs:simpleType>
+ <xs:simpleType name="outcome-expression">
+ <xs:union memberTypes="pages:outcome pages:value-expression"></xs:union>
+ </xs:simpleType>
+
+ <xs:simpleType name="from-action-expression">
+ <xs:union memberTypes="pages:outcome pages:method-expression"></xs:union>
+ </xs:simpleType>
+
<xs:simpleType name="ableness">
<xs:restriction base="xs:token">
<xs:enumeration value="enabled"/>
@@ -610,7 +628,9 @@
</xs:simpleType>
<xs:simpleType name="value-expression">
- <xs:restriction base="xs:token"/>
+ <xs:restriction base="xs:token">
+ <xs:pattern value="#\{.*\}"/>
+ </xs:restriction>
</xs:simpleType>
<xs:simpleType name="boolean-value-expression">
Modified: trunk/seam/plugins/org.jboss.tools.seam.xml/schemas/ui-2.1.xsd
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.xml/schemas/ui-2.1.xsd 2009-06-09 10:57:08 UTC (rev 15813)
+++ trunk/seam/plugins/org.jboss.tools.seam.xml/schemas/ui-2.1.xsd 2009-06-09 12:12:35 UTC (rev 15814)
@@ -25,5 +25,12 @@
<xs:attribute name="entity-loader" type="xs:string" />
</xs:complexType>
</xs:element>
+
+ <xs:element name="render-stamp-store">
+ <xs:complexType>
+ <xs:attributeGroup ref="components:attlist.component" />
+ <xs:attribute name="max-size" type="xs:int" />
+ </xs:complexType>
+ </xs:element>
</xs:schema>
15 years, 6 months
JBoss Tools SVN: r15813 - in trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui: META-INF and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2009-06-09 06:57:08 -0400 (Tue, 09 Jun 2009)
New Revision: 15813
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/WTPOveridePlugin.java
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/AddModuleDependenciesPropertiesPage.java
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/AddModulesToEarPropertiesPage.java
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/ComponentDependencyContentProvider.java
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/EarModuleDependenciesPropertyPage.java
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/J2EEDependenciesPage.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/META-INF/MANIFEST.MF
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/plugin.xml
Log:
Cleaned up... still needs "performOK" to work but it's getting there. Periodic checkin since I don't think this is even in the build yet.
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/META-INF/MANIFEST.MF 2009-06-09 10:48:57 UTC (rev 15812)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/META-INF/MANIFEST.MF 2009-06-09 10:57:08 UTC (rev 15813)
@@ -3,7 +3,7 @@
Bundle-Name: WTP UI Overrides
Bundle-SymbolicName: org.jboss.ide.eclipse.as.wtp.override.ui;singleton:=true
Bundle-Version: 1.0.0.qualifier
-Bundle-Activator: org.jboss.ide.eclipse.as.wtp.override.WTPOveridePlugin
+Bundle-Activator: org.jboss.ide.eclipse.as.wtp.override.ui.WTPOveridePlugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.core.resources;bundle-version="3.5.0",
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/plugin.xml 2009-06-09 10:48:57 UTC (rev 15812)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/plugin.xml 2009-06-09 10:57:08 UTC (rev 15813)
@@ -9,7 +9,7 @@
adaptable="true"
objectClass="org.eclipse.core.resources.IProject"
name="JEE Module Dependencies (JBT Beta)"
- class="org.jboss.ide.eclipse.as.wtp.override.ui.properypage.J2EEDependenciesPage"
+ class="org.jboss.ide.eclipse.as.wtp.override.ui.propertypage.J2EEDependenciesPage"
id="org.jboss.ide.eclipse.as.wtp.override.ui.J2EEDependenciesPage">
<enabledWhen>
<and>
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/WTPOveridePlugin.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/WTPOveridePlugin.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/WTPOveridePlugin.java 2009-06-09 10:57:08 UTC (rev 15813)
@@ -0,0 +1,61 @@
+package org.jboss.ide.eclipse.as.wtp.override.ui;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class WTPOveridePlugin extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.ide.eclipse.as.wtp.override.ui"; //$NON-NLS-1$
+
+ // The shared instance
+ private static WTPOveridePlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public WTPOveridePlugin() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static WTPOveridePlugin getDefault() {
+ return plugin;
+ }
+
+ public static void log(Exception e) {
+ log(e.getMessage(), e);
+ }
+
+ public static void log(String message, Exception e) {
+ IStatus status = new Status(IStatus.ERROR, PLUGIN_ID, message, e);
+ getDefault().getLog().log(status);
+ }
+
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/AddModuleDependenciesPropertiesPage.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/AddModuleDependenciesPropertiesPage.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/AddModuleDependenciesPropertiesPage.java 2009-06-09 10:57:08 UTC (rev 15813)
@@ -0,0 +1,1206 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are 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:
+ * IBM Corporation - initial API and implementation
+ * David Schneider, david.schneider(a)unisys.com - [142500] WTP properties pages fonts don't follow Eclipse preferences
+ * Stefan Dimov, stefan.dimov(a)sap.com - bugs 207826, 222651
+ *******************************************************************************/
+package org.jboss.ide.eclipse.as.wtp.override.ui.propertypage;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.ui.wizards.BuildPathDialogAccess;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.ICellModifier;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.TableLayout;
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.jface.window.Window;
+import org.eclipse.jst.j2ee.internal.AvailableJ2EEComponentsForEARContentProvider;
+import org.eclipse.jst.j2ee.internal.IJ2EEDependenciesControl;
+import org.eclipse.jst.j2ee.internal.ManifestUIResourceHandler;
+import org.eclipse.jst.j2ee.internal.common.J2EEVersionUtil;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
+import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
+import org.eclipse.jst.j2ee.project.facet.IJ2EEFacetConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.internal.resources.VirtualArchiveComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider;
+
+
+public abstract class AddModuleDependenciesPropertiesPage implements Listener, IJ2EEDependenciesControl {
+
+ protected final String PATH_SEPARATOR = ComponentDependencyContentProvider.PATH_SEPARATOR;
+ protected boolean showRuntimePath;
+ protected final IProject project;
+ protected final J2EEDependenciesPage propPage;
+ protected IVirtualComponent rootComponent = null;
+ protected Text componentNameText;
+ protected Label availableModules;
+ protected CheckboxTableViewer availableComponentsViewer;
+ protected Button selectAllButton;
+ protected Button deselectAllButton;
+ protected Button projectButton;
+ protected Button projectJarButton;
+ protected Button externalJarButton;
+ protected Button addVariableButton;
+ protected Composite buttonColumn;
+ protected static final IStatus OK_STATUS = IDataModelProvider.OK_STATUS;
+ protected Listener tableListener;
+ protected Listener labelListener;
+
+
+ protected HashMap<IVirtualComponent, String> oldComponentToRuntimePath = new HashMap<IVirtualComponent, String>();
+
+ // This should keep a list of all elements currently in the list, even if unchecked
+ protected HashMap<Object, String> objectToRuntimePath = new HashMap<Object, String>();
+
+
+ //[Bug 238264] the cached list elements that are new and need to be manually added to the viewer
+ // Can be an IProject or IVirtualComponent
+ protected ArrayList<Object> addedElements= new ArrayList<Object>();
+
+ /**
+ * Constructor for AddModulestoEARPropertiesControl.
+ */
+ public AddModuleDependenciesPropertiesPage(final IProject project, final J2EEDependenciesPage page) {
+ this.project = project;
+ this.propPage = page;
+ rootComponent = ComponentCore.createComponent(project);
+ this.showRuntimePath = true;
+ }
+
+ protected boolean getShowRuntimePath() {
+ return this.showRuntimePath;
+ }
+
+ protected void setShowRuntimePath(boolean bool) {
+ this.showRuntimePath = bool;
+ }
+
+ /*
+ * UI Creation Methods
+ */
+
+ public Composite createContents(final Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginWidth = 0;
+ layout.marginWidth = 0;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ J2EEDependenciesPage.createDescriptionComposite(composite, ManifestUIResourceHandler.EAR_Modules_Desc);
+ createListGroup(composite);
+ refresh();
+ Dialog.applyDialogFont(parent);
+ return composite;
+ }
+
+ protected void createListGroup(Composite parent) {
+ Composite listGroup = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ listGroup.setLayout(layout);
+ GridData gData = new GridData(GridData.FILL_BOTH);
+ gData.horizontalIndent = 5;
+ listGroup.setLayoutData(gData);
+
+ availableModules = new Label(listGroup, SWT.NONE);
+ gData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
+ availableModules.setText(J2EEUIMessages.getResourceString("AVAILABLE_J2EE_COMPONENTS")); //$NON-NLS-1$ = "Available dependent JARs:"
+ availableModules.setLayoutData(gData);
+ createTableComposite(listGroup);
+ }
+
+ protected void createTableComposite(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridData gData = new GridData(GridData.FILL_BOTH);
+ composite.setLayoutData(gData);
+ fillComposite(composite);
+ }
+
+ public void fillComposite(Composite parent) {
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ layout.marginHeight = 0;
+ parent.setLayout(layout);
+ parent.setLayoutData(new GridData(GridData.FILL_BOTH));
+ createTable(parent);
+ createButtonColumn(parent);
+ }
+
+ protected void createButtonColumn(Composite parent) {
+ buttonColumn = createButtonColumnComposite(parent);
+ GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END);
+ buttonColumn.setLayoutData(data);
+ createPushButtons();
+ }
+
+ // TODO add a project button here
+ protected void createPushButtons() {
+ String SELECT_ALL_BUTTON = ManifestUIResourceHandler.Select_All_3;
+ String DE_SELECT_ALL_BUTTON = ManifestUIResourceHandler.Deselect_All_4;
+
+ selectAllButton = createPushButton(SELECT_ALL_BUTTON);
+ deselectAllButton = createPushButton(DE_SELECT_ALL_BUTTON);
+ projectButton = createPushButton("Add Project...");
+ projectJarButton = createPushButton(J2EEUIMessages.getResourceString(J2EEUIMessages.PROJECT_JAR));
+ externalJarButton = createPushButton(J2EEUIMessages.getResourceString(J2EEUIMessages.EXTERNAL_JAR));
+ addVariableButton = createPushButton(J2EEUIMessages.getResourceString(J2EEUIMessages.ADDVARIABLE));
+ }
+
+ protected Button createPushButton(String label) {
+ Button aButton = new Button(buttonColumn, SWT.PUSH);
+ aButton.setText(label);
+ aButton.addListener(SWT.Selection, this);
+ aButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ return aButton;
+ }
+
+ public Composite createButtonColumnComposite(Composite parent) {
+ Composite aButtonColumn = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ aButtonColumn.setLayout(layout);
+ GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
+ aButtonColumn.setLayoutData(data);
+ return aButtonColumn;
+ }
+
+ public Group createGroup(Composite parent) {
+ return new Group(parent, SWT.NULL);
+ }
+
+ protected void createTable(Composite parent) {
+ availableComponentsViewer = createAvailableComponentsViewer(parent);
+ GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL);
+ availableComponentsViewer.getTable().setLayoutData(gd);
+
+ if (rootComponent != null) {
+ ComponentDependencyContentProvider provider = createProvider();
+ provider.setRuntimePaths(objectToRuntimePath);
+ availableComponentsViewer.setContentProvider(provider);
+ availableComponentsViewer.setLabelProvider(provider);
+ availableComponentsViewer.setFilters(new ViewerFilter[]{provider});
+ addTableListeners();
+ }
+ }
+
+ /**
+ * Subclasses should over-ride this and extend the class
+ */
+ protected ComponentDependencyContentProvider createProvider() {
+ int j2eeVersion = J2EEVersionUtil.convertVersionStringToInt(rootComponent);
+ return new ComponentDependencyContentProvider(rootComponent);
+ }
+
+ /*
+ * Listeners of various events
+ */
+
+ protected void addTableListeners() {
+ addCheckStateListener();
+ addHoverHelpListeners();
+ addDoubleClickListener();
+ }
+
+ protected void addHoverHelpListeners() {
+ final Table table = availableComponentsViewer.getTable();
+ createLabelListener(table);
+ createTableListener(table);
+ table.addListener(SWT.Dispose, tableListener);
+ table.addListener(SWT.KeyDown, tableListener);
+ table.addListener(SWT.MouseMove, tableListener);
+ table.addListener(SWT.MouseHover, tableListener);
+ }
+
+ protected void createLabelListener(final Table table) {
+ labelListener = new Listener () {
+ public void handleEvent (Event event) {
+ Label label = (Label)event.widget;
+ Shell shell = label.getShell ();
+ switch (event.type) {
+ case SWT.MouseDown:
+ Event e = new Event ();
+ e.item = (TableItem) label.getData ("_TABLEITEM");
+ table.setSelection (new TableItem [] {(TableItem) e.item});
+ table.notifyListeners (SWT.Selection, e);
+ shell.dispose ();
+ table.setFocus();
+ break;
+ case SWT.MouseExit:
+ shell.dispose ();
+ break;
+ }
+ }
+ };
+ }
+
+ protected void createTableListener(final Table table) {
+ tableListener = new Listener () {
+ Shell tip = null;
+ Label label = null;
+ public void handleEvent (Event event) {
+ switch (event.type) {
+ case SWT.Dispose:
+ case SWT.KeyDown:
+ case SWT.MouseMove: {
+ if (tip == null) break;
+ tip.dispose ();
+ tip = null;
+ label = null;
+ break;
+ }
+ case SWT.MouseHover: {
+ TableItem item = table.getItem (new Point (event.x, event.y));
+ if (item != null) {
+ if (!item.getGrayed())
+ return;
+ if (tip != null && !tip.isDisposed ()) tip.dispose ();
+ tip = new Shell (PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+ .getShell(), SWT.ON_TOP | SWT.NO_FOCUS | SWT.TOOL);
+ tip.setBackground (Display.getDefault().getSystemColor (SWT.COLOR_INFO_BACKGROUND));
+ FillLayout layout = new FillLayout ();
+ layout.marginWidth = 2;
+ tip.setLayout (layout);
+ label = new Label (tip, SWT.WRAP);
+ label.setForeground (Display.getDefault().getSystemColor (SWT.COLOR_INFO_FOREGROUND));
+ label.setBackground (Display.getDefault().getSystemColor (SWT.COLOR_INFO_BACKGROUND));
+ label.setData ("_TABLEITEM", item); //$NON-NLS-1$
+ label.setText (J2EEUIMessages.getResourceString(J2EEUIMessages.HOVER_HELP_FOR_DISABLED_LIBS));
+ label.addListener (SWT.MouseExit, labelListener);
+ label.addListener (SWT.MouseDown, labelListener);
+ Point size = tip.computeSize (SWT.DEFAULT, SWT.DEFAULT);
+ Rectangle rect = item.getBounds (0);
+ Point pt = table.toDisplay (rect.x, rect.y);
+ tip.setBounds (pt.x, pt.y - size.y, size.x, size.y);
+ tip.setVisible (true);
+ }
+ }
+ }
+ }
+ };
+ }
+
+ protected void addDoubleClickListener() {
+ availableComponentsViewer.setColumnProperties(new String[] {"a", "b", "c"});
+ CellEditor[] editors = new CellEditor[]{new TextCellEditor(), new TextCellEditor(), new TextCellEditor(availableComponentsViewer.getTable())};
+ availableComponentsViewer.setCellEditors(editors);
+ availableComponentsViewer.setCellModifier(new RuntimePathCellModifier());
+ }
+
+ private class RuntimePathCellModifier implements ICellModifier {
+
+ public boolean canModify(Object element, String property) {
+ int columnIndex = Arrays.asList(availableComponentsViewer.getColumnProperties()).indexOf(property);
+ if( columnIndex == 2 ) {
+ if( element instanceof VirtualArchiveComponent ) {
+ try {
+ boolean sameProject =
+ ((VirtualArchiveComponent)element).getWorkspaceRelativePath() != null
+ && ((VirtualArchiveComponent)element).getWorkspaceRelativePath().segment(0)
+ .equals(rootComponent.getProject().getName());
+ return !(sameProject && isPhysicallyAdded(((VirtualArchiveComponent)element)));
+ } catch( IllegalArgumentException iae) {}
+ }
+ return true;
+ }
+ return false;
+ }
+
+ public Object getValue(Object element, String property) {
+ return objectToRuntimePath.get(element) == null ?
+ new Path("/").toString() :
+ objectToRuntimePath.get(element);
+ }
+
+ public void modify(Object element, String property, Object value) {
+ if( element instanceof TableItem ) {
+ TableItem item = (TableItem)element;
+ item.setText(2, (String)value);
+ objectToRuntimePath.put(item.getData(), (String)value);
+ }
+ }
+
+ }
+
+ public void handleEvent(Event event) {
+ if (event.widget == selectAllButton)
+ handleSelectAllButtonPressed();
+ else if (event.widget == deselectAllButton)
+ handleDeselectAllButtonPressed();
+ else if(event.widget == projectButton)
+ handleSelectProjectButton();
+ else if(event.widget == projectJarButton)
+ handleSelectProjectJarButton();
+ else if(event.widget == externalJarButton)
+ handleSelectExternalJarButton();
+ else if(event.widget == addVariableButton)
+ handleSelectVariableButton();
+ }
+
+ private void handleSelectAllButtonPressed() {
+ TableItem[] children = availableComponentsViewer.getTable().getItems();
+ for (int i = 0; i < children.length; i++) {
+ TableItem item = children[i];
+ if( !item.getGrayed())
+ item.setChecked(true);
+ }
+ }
+
+ private void handleDeselectAllButtonPressed() {
+ TableItem[] children = availableComponentsViewer.getTable().getItems();
+ for (int i = 0; i < children.length; i++) {
+ TableItem item = children[i];
+ if( !item.getGrayed())
+ item.setChecked(false);
+ }
+ }
+
+ private void handleSelectProjectButton() {
+ SelectProjectDialog d = new SelectProjectDialog(
+ new Shell(), getProjectLabelProvider(), getProjectContentProvider());
+ if( d.open() == Window.OK) {
+ IProject selected = (IProject)d.getFirstResult();
+ addedElements.add(selected);
+ refresh();
+ TableItem[] items = availableComponentsViewer.getTable().getItems();
+ for( int i = 0; i < items.length; i++ )
+ if( items[i].getData().equals(selected))
+ items[i].setChecked(true);
+ }
+ }
+
+ protected class SelectProjectDialog extends ElementTreeSelectionDialog {
+ public SelectProjectDialog(Shell parent, ILabelProvider labelProvider,
+ ITreeContentProvider contentProvider) {
+ super(parent, labelProvider, contentProvider);
+ setAllowMultiple(false);
+ setTitle("Select a Project");
+ setInput(ResourcesPlugin.getWorkspace());
+ }
+ }
+ protected ILabelProvider getProjectLabelProvider() {
+ return new LabelProvider() {
+ public Image getImage(Object element) {
+ if( element instanceof IProject )
+ return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_PROJECT);
+ return null;
+ }
+ public String getText(Object element) {
+ if( element instanceof IProject )
+ return ((IProject)element).getName();
+ return element == null ? "" : element.toString();//$NON-NLS-1$
+ }
+ };
+ }
+ protected ITreeContentProvider getProjectContentProvider() {
+ return new ITreeContentProvider() {
+ public Object[] getElements(Object inputElement) {
+ return ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ }
+ public Object[] getChildren(Object parentElement) {
+ return null;
+ }
+ public Object getParent(Object element) {
+ return null;
+ }
+ public boolean hasChildren(Object element) {
+ return false;
+ }
+ public void dispose() {
+ }
+ public void inputChanged(Viewer viewer, Object oldInput,
+ Object newInput) {
+ }
+
+ };
+ }
+
+ protected IProject[] filterAddProjectList(IProject[] list) {
+ return list;
+ }
+
+
+ /**
+ * [Bug 238264]
+ * Add an archive as a potential new reference for this.earComponent
+ * NOTE1: the given archive will not be added as a potential reference if there is already a reference to it
+ * NOTE2: the given archive will only be added as an actual reference when this.performOk is invoked
+ *
+ * @param archive the archive to add as a potential new reference in this.earComponent
+ *
+ */
+ private void addPotentialNewReference(IVirtualComponent archive) {
+ //check to see if a reference to the given archive already exists
+ IVirtualReference [] existingRefs = rootComponent.getReferences();
+ IVirtualComponent referencedComponent;
+ boolean refAlreadyExists = false;
+ for(int i=0;i<existingRefs.length && !refAlreadyExists;i++){
+ referencedComponent = existingRefs[i].getReferencedComponent();
+ refAlreadyExists = referencedComponent.equals(archive);
+ }
+
+ // verify it's not already in the list... ugh
+ TableItem[] allItems = availableComponentsViewer.getTable().getItems();
+ for( int i = 0; i < allItems.length; i++ ) {
+ if( allItems[i].getData().equals(archive)) {
+ allItems[i].setChecked(true);
+ refAlreadyExists = true;
+ }
+ }
+
+ // only add the archive as a potentialy new reference if it does not already exist
+ // also force check it
+ if(!refAlreadyExists) {
+ this.objectToRuntimePath.put(archive, new Path("/").toString());
+ this.addedElements.add(archive);
+ availableComponentsViewer.add(archive);
+ TableItem[] items = availableComponentsViewer.getTable().getItems();
+ for( int i = 0; i < items.length; i++ ) {
+ if(items[i].getData().equals(archive))
+ items[i].setChecked(true);
+ }
+
+ } else {
+ //TODO should inform user that they selected an already referenced archive?
+ }
+ }
+
+ private void handleSelectExternalJarButton(){
+ IPath[] selected= BuildPathDialogAccess.chooseExternalJAREntries(propPage.getShell());
+
+ if (selected != null) {
+ for (int i= 0; i < selected.length; i++) {
+
+ String type = VirtualArchiveComponent.LIBARCHIVETYPE + IPath.SEPARATOR;
+ IVirtualComponent archive = ComponentCore.createArchiveComponent( rootComponent.getProject(), type +
+ selected[i].toString());
+
+ this.addPotentialNewReference(archive);
+ }
+ refresh();
+ }
+
+ }
+
+ private void handleSelectVariableButton(){
+ IPath existingPath[] = new Path[0];
+ IPath[] paths = BuildPathDialogAccess.chooseVariableEntries(propPage.getShell(), existingPath);
+
+ if (paths != null) {
+ refresh();
+ for (int i = 0; i < paths.length; i++) {
+ IPath resolvedPath= JavaCore.getResolvedVariablePath(paths[i]);
+
+ java.io.File file = new java.io.File(resolvedPath.toOSString());
+ if( file.isFile() && file.exists()){
+ String type = VirtualArchiveComponent.VARARCHIVETYPE + IPath.SEPARATOR;
+
+ IVirtualComponent archive = ComponentCore.createArchiveComponent( rootComponent.getProject(), type +
+ paths[i].toString());
+
+ this.addPotentialNewReference(archive);
+ }else{
+ //display error
+ }
+ }
+ refresh();
+ }
+ }
+
+
+
+ // TODO FIX THIS
+ protected void addCheckStateListener() {
+ availableComponentsViewer.addCheckStateListener(new ICheckStateListener() {
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ CheckboxTableViewer vr = (CheckboxTableViewer)event.getSource();
+ Object element = event.getElement();
+ if (vr.getGrayed(element))
+ vr.setChecked(element, !vr.getChecked(element));
+ Object o = event.getSource();
+
+ // TODO : check for conflict + dependency res
+ }
+ });
+ }
+
+
+
+ public CheckboxTableViewer createAvailableComponentsViewer(Composite parent) {
+ int flags = SWT.CHECK | SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI;
+
+ Table table = new Table(parent, flags);
+ availableComponentsViewer = new CheckboxTableViewer(table);
+
+ // set up table layout
+ TableLayout tableLayout = new org.eclipse.jface.viewers.TableLayout();
+ tableLayout.addColumnData(new ColumnWeightData(300, true));
+ tableLayout.addColumnData(new ColumnWeightData(300, true));
+ if (showRuntimePath)
+ tableLayout.addColumnData(new ColumnWeightData(200, true));
+ table.setLayout(tableLayout);
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+ availableComponentsViewer.setSorter(null);
+
+ // table columns
+ TableColumn fileNameColumn = new TableColumn(table, SWT.NONE, 0);
+ fileNameColumn.setText(ManifestUIResourceHandler.JAR_Module_UI_);
+ fileNameColumn.setResizable(true);
+
+ TableColumn projectColumn = new TableColumn(table, SWT.NONE, 1);
+ projectColumn.setText(ManifestUIResourceHandler.Project_UI_);
+ projectColumn.setResizable(true);
+
+ if (showRuntimePath) {
+ TableColumn bndColumn = new TableColumn(table, SWT.NONE, 2);
+ bndColumn.setText(ManifestUIResourceHandler.Packed_In_Lib_UI_);
+ bndColumn.setResizable(true);
+ }
+
+ tableLayout.layout(table, true);
+ return availableComponentsViewer;
+
+ }
+
+ protected boolean isPhysicallyAdded(VirtualArchiveComponent component) {
+ IPath p = null;
+ try {
+ p = component.getProjectRelativePath();
+ return true;
+ } catch (IllegalArgumentException e) {
+ return false;
+ }
+ }
+ private boolean secondShouldBeDisabled(IVirtualComponent component) {
+ if(component.isBinary()) return false;
+ if (JavaEEProjectUtilities.isApplicationClientComponent(component)) return true;
+ if (JavaEEProjectUtilities.isEARProject(component.getProject()) && component.isBinary()) return false;
+ if (JavaEEProjectUtilities.isEJBComponent(component)) return true;
+ if (JavaEEProjectUtilities.isDynamicWebComponent(component)) return true;
+ if (JavaEEProjectUtilities.isJCAComponent(component)) return true;
+ if (JavaEEProjectUtilities.isStaticWebProject(component.getProject())) return true;
+ if (JavaEEProjectUtilities.isProjectOfType(component.getProject(), IJ2EEFacetConstants.JAVA)) return false;
+ return false;
+ }
+
+
+
+ private boolean isInLibDir(VirtualArchiveComponent comp) {
+ IPath p = comp.getProjectRelativePath();
+ if (p.segmentCount() == 2)
+ return false;
+ return true;
+ }
+
+ private boolean isConflict(Object lib) {
+ IProject libProj = (lib instanceof IProject) ? (IProject)lib : ((IVirtualComponent)lib).getProject();
+ IProject earProject = rootComponent.getProject();
+ try {
+ IVirtualComponent cmp = ComponentCore.createComponent(earProject);
+ IProject[] earRefProjects = earProject.getReferencedProjects();
+ for (int i = 0; i < earRefProjects.length; i++) {
+ if (!J2EEProjectUtilities.isEARProject(earRefProjects[i]) &&
+ !earRefProjects[i].equals(libProj)) {
+ IVirtualComponent cmp1 = ComponentCore.createComponent(earRefProjects[i]);
+ IVirtualReference[] refs = cmp1.getReferences();
+ for (int j = 0; j < refs.length; j++) {
+ if (refs[j].getReferencedComponent().getProject().equals(libProj)) return true;
+ }
+ }
+ }
+ return false;
+ } catch (CoreException ce) {
+ J2EEUIPlugin.logError(ce);
+ }
+ return false;
+ }
+
+ private void handleSelectProjectJarButton(){
+ IPath[] selected= BuildPathDialogAccess.chooseJAREntries(propPage.getShell(), project.getLocation(), new IPath[0]);
+
+ if (selected != null) {
+ for (int i= 0; i < selected.length; i++) {
+ //IPath fullPath = project.getFile(selected[i]).getFullPath();
+ String type = VirtualArchiveComponent.LIBARCHIVETYPE + IPath.SEPARATOR;
+ IVirtualComponent archive = ComponentCore.createArchiveComponent( rootComponent.getProject(), type +
+ selected[i].makeRelative().toString());
+
+ this.addPotentialNewReference(archive);
+ }
+ refresh();
+ }
+
+ }
+ private boolean hasInitialized = false;
+ /**
+ * This should only be called on changes, such as adding a project
+ * reference, adding a lib reference etc.
+ *
+ * It will reset the input, manually re-add missing elements, and do other tasks
+ */
+ public void refresh() {
+ TableItem[] items = availableComponentsViewer.getTable().getItems();
+ HashMap<Object, Boolean> checked = cacheChecked();
+ resetTableUI();
+ if( !hasInitialized) {
+ initialize();
+ resetTableUI();
+ }
+
+ /*
+ * Re-check any added elements that were checked but now lost their check
+ */
+ TableItem[] newItems = availableComponentsViewer.getTable().getItems();
+ for( int i = 0; i < newItems.length; i++ ) {
+ if( checked.containsKey(newItems[i].getData()))
+ newItems[i].setChecked(checked.get(newItems[i].getData()));
+ }
+ }
+
+ protected HashMap<Object, Boolean> cacheChecked() {
+ // preserve selections / check / etc of new (added) entities
+ TableItem [] items = availableComponentsViewer.getTable().getItems();
+ HashMap<Object, Boolean> checked = new HashMap<Object,Boolean>();
+ if( addedElements != null ) {
+ int j = 0;
+ for( int i = 0; i < items.length; i++ ) {
+ if( addedElements.contains(items[i].getData()))
+ checked.put(items[i].getData(), items[i].getChecked());
+ }
+ }
+ return checked;
+ }
+
+ protected void resetTableUI() {
+ IWorkspaceRoot input = ResourcesPlugin.getWorkspace().getRoot();
+ availableComponentsViewer.setInput(input);
+ GridData data = new GridData(GridData.FILL_BOTH);
+ int numlines = Math.min(10, availableComponentsViewer.getTable().getItemCount());
+ data.heightHint = availableComponentsViewer.getTable().getItemHeight() * numlines;
+ availableComponentsViewer.getTable().setLayoutData(data);
+ GridData btndata = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
+ buttonColumn.setLayoutData(btndata);
+
+ //[Bug 238264] for all the jars in the cache temparaly list them in the grid
+ for(Object addedElement : this.addedElements) {
+ availableComponentsViewer.add(addedElement);
+ }
+ }
+
+ protected void initialize() {
+ TableItem [] items = availableComponentsViewer.getTable().getItems();
+
+ // First initialize the paths
+ Object data;
+ for( int i = 0; i < items.length; i++ ) {
+ data = items[i].getData();
+ if( data instanceof IVirtualComponent ) {
+ IVirtualReference ref = rootComponent.getReference(((IVirtualComponent)data).getName());
+ String val = ref == null ? new Path(PATH_SEPARATOR).toString() : ref.getRuntimePath().toString();
+ objectToRuntimePath.put(data, val);
+ }
+ }
+
+ // Then initialize the UI
+ List forceCheck = new ArrayList();
+ forceCheck.addAll(getChildrenComponents());
+ forceCheck.addAll(getCPComponents());
+ for( int i = 0; i < items.length; i++ ) {
+ if( forceCheck.contains(items[i].getData()))
+ items[i].setChecked(true);
+
+ if( items[i].getData() instanceof VirtualArchiveComponent )
+ items[i].setGrayed(isPhysicallyAdded(((VirtualArchiveComponent)items[i].getData())));
+ }
+ hasInitialized = true;
+ }
+ protected List getChildrenComponents() {
+ List list = new ArrayList();
+ IVirtualReference refs[] = rootComponent.getReferences();
+ for( int i=0; i< refs.length; i++){
+ if( isChildComponent(refs[i]))
+ list.add(refs[i].getReferencedComponent());
+ }
+ return list;
+ }
+
+ protected boolean isChildComponent(IVirtualReference ref) {
+// if ((ref.getRuntimePath().isRoot() && !inLibFolder) ||
+// (!ref.getRuntimePath().isRoot() && inLibFolder) ||
+// !isVersion5) {
+ return true;
+ }
+
+ protected List getCPComponents() {
+ List list = new ArrayList();
+ Map pathToComp = new HashMap();
+ IVirtualReference refs[] = rootComponent.getReferences();
+ for( int i=0; i< refs.length; i++){
+ if( isChildComponent(refs[i])) {
+ IVirtualComponent comp = refs[i].getReferencedComponent();
+ addClasspathComponentDependencies(list, pathToComp, comp);
+ }
+ }
+ return list;
+ }
+
+ protected void addClasspathComponentDependencies(final List componentList, final Map pathToComp, final IVirtualComponent referencedComponent) {
+ AvailableJ2EEComponentsForEARContentProvider.addClasspathComponentDependencies(componentList, pathToComp, referencedComponent);
+ }
+
+
+ /*
+ * Clean-up methods are below. These include
+ * performCancel, performDefaults, performOK, and
+ * any other methods that are called *only* by this one.
+ */
+ public void setVisible(boolean visible) {
+ }
+
+ public void performDefaults() {
+ }
+
+ public boolean performCancel() {
+ return true;
+ }
+
+ public void dispose() {
+ Table table = null;
+ if (availableComponentsViewer != null) {
+ table = availableComponentsViewer.getTable();
+ if (table == null)
+ return;
+ }
+ table.removeListener(SWT.Dispose, tableListener);
+ table.removeListener(SWT.KeyDown, tableListener);
+ table.removeListener(SWT.MouseMove, tableListener);
+ table.removeListener(SWT.MouseHover, tableListener);
+ }
+
+ protected abstract boolean performOk(IProgressMonitor monitor);
+ public boolean performOk() {
+ NullProgressMonitor monitor = new NullProgressMonitor();
+ boolean subResult = performOk(monitor);
+ if( !subResult )
+ return false;
+
+// removeModulesFromEAR(monitor);
+// addModulesToEAR(monitor);
+// refresh();
+
+ Iterator i = addedElements.iterator();
+ while(i.hasNext()) {
+ Object o = i.next();
+ System.out.println("Adding " + o + " to path " + objectToRuntimePath.get(o));
+ }
+ return true;
+ }
+
+
+// /*
+// * Methods called directly from OK
+// */
+// private IStatus addModulesToEAR(IProgressMonitor monitor) {
+// IStatus stat = OK_STATUS;
+// try {
+// if( earComponent != null ){
+// final List list = newJ2EEModulesToAdd(false);
+// final List bndList = newJ2EEModulesToAdd(true);
+// final boolean shouldRun = (list != null && !list.isEmpty()) || !javaProjectsList.isEmpty();
+// final boolean shouldBndRun = isVersion5 &&
+// ((bndList != null && !bndList.isEmpty()) || !javaLibProjectsList.isEmpty());
+// if(shouldRun || shouldBndRun){
+// IWorkspaceRunnable runnable = new IWorkspaceRunnable(){
+//
+// public void run(IProgressMonitor monitor) throws CoreException{
+// if (shouldRun) {
+// execAddOp(monitor, list, J2EEConstants.EAR_ROOT_DIR);
+// execAddOp1(monitor, javaProjectsList, j2eeComponentList, J2EEConstants.EAR_ROOT_DIR);
+// }
+// if (shouldBndRun) {
+// execAddOp(monitor, bndList, libDir);
+// execAddOp1(monitor, javaLibProjectsList, j2eeLibElementList, libDir);
+// }
+// }
+// };
+// J2EEUIPlugin.getWorkspace().run(runnable, monitor);
+// }
+// }
+// } catch (Exception e) {
+// J2EEUIPlugin.logError(e);
+// }
+//
+// //[Bug 238264] clear out the cache because they should all either be added as references now
+// // or no longer checked and therefore not wanted by the user
+// this.addedJARComponents.clear();
+//
+// return OK_STATUS;
+// }
+//
+// private List newJ2EEModulesToAdd(boolean inLibFolder){
+// if (inLibFolder && !isVersion5) return null;
+// List newComps = new ArrayList();
+// List comps = inLibFolder ? j2eeLibElementList : j2eeComponentList;
+// if (comps != null && !comps.isEmpty()){
+// for (int i = 0; i < comps.size(); i++){
+// IVirtualComponent handle = (IVirtualComponent)comps.get(i);
+// if (ClasspathDependencyUtil.isClasspathComponentDependency(handle)) {
+// continue;
+// }
+// if( !inEARAlready(handle))
+// newComps.add(handle);
+// }
+// }
+// return newComps;
+// }
+//
+// /**
+// *
+// * @param componentHandle
+// * @return
+// * @description returns true is a component is already in the EAR as a dependent
+// */
+// protected boolean inEARAlready(IVirtualComponent component){
+// IVirtualReference refs[] = rootComponent.getReferences();
+// for( int i=0; i< refs.length; i++){
+// IVirtualReference ref = refs[i];
+// if ( ref.getReferencedComponent().equals( component ))
+// return true;
+// }
+// return false;
+// }
+
+// private void updateLibDir(IProgressMonitor monitor) {
+// if (libDir.equals(oldLibDir)) return;
+// final IEARModelProvider earModel = (IEARModelProvider)ModelProviderManager.getModelProvider(project);
+// final Application app = (Application)ModelProviderManager.getModelProvider(project).getModelObject();
+// oldLibDir = app.getLibraryDirectory();
+// if (oldLibDir == null) oldLibDir = J2EEConstants.EAR_DEFAULT_LIB_DIR;
+// earModel.modify(new Runnable() {
+// public void run() {
+// app.setLibraryDirectory(libDir);
+// }}, null);
+// }
+//
+// private void remComps(List list, String path) {
+// if( !list.isEmpty()){
+// try {
+// // remove the components from the EAR
+// IDataModelOperation op = removeComponentFromEAROperation(earComponent, list, path);
+// op.execute(null, null);
+// // if that succeeded, remove all EAR-scope J2EE dependencies on these components
+// J2EEComponentClasspathUpdater.getInstance().queueUpdateEAR(earComponent.getProject());
+// } catch (ExecutionException e) {
+// J2EEUIPlugin.logError(e);
+// }
+// }
+// }
+//
+// private IStatus removeModulesFromEAR(IProgressMonitor monitor) {
+// IStatus stat = OK_STATUS;
+// if (!isVersion5) {
+// if(earComponent != null && j2eeComponentList != null) {
+// List list = getComponentsToRemove();
+// remComps(list, J2EEConstants.EAR_ROOT_DIR);
+// }
+// } else {
+// if( earComponent != null && j2eeComponentList != null) {
+// List[] list = getComponentsToRemoveUpdate(!libDir.equals(oldLibDir));
+// remComps(list[0], J2EEConstants.EAR_ROOT_DIR);
+//
+// remComps(list[1], oldLibDir);
+// }
+// }
+// return stat;
+// }
+//
+// protected IDataModelOperation removeComponentFromEAROperation(IVirtualComponent sourceComponent, List targetComponentsHandles, String dir) {
+// IDataModel model = DataModelFactory.createDataModel(new RemoveComponentFromEnterpriseApplicationDataModelProvider());
+// model.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT, sourceComponent);
+// List modHandlesList = (List) model.getProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST);
+// modHandlesList.addAll(targetComponentsHandles);
+// model.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST, modHandlesList);
+// model.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_DEPLOY_PATH, dir);
+// return model.getDefaultOperation();
+// }
+//
+// protected List getComponentsToRemove(){
+// //j2eeComponentList = getCheckedJ2EEElementsAsList();
+// List list = new ArrayList();
+// if( earComponent != null && list != null ){
+// IVirtualReference[] oldrefs = earComponent.getReferences();
+// for (int j = 0; j < oldrefs.length; j++) {
+// IVirtualReference ref = oldrefs[j];
+// IVirtualComponent handle = ref.getReferencedComponent();
+// if(!j2eeComponentList.contains(handle) && (isVersion5 ? !j2eeLibElementList.contains(handle) : true)){
+// if ((handle instanceof VirtualArchiveComponent) && (isPhysicallyAdded((VirtualArchiveComponent)handle)))
+// continue;
+// list.add(handle);
+// }
+// }
+// }
+// return list;
+// }
+//
+// // EAR5 case
+// protected List[] getComponentsToRemoveUpdate(boolean dirUpdated){
+// //j2eeComponentList = getCheckedJ2EEElementsAsList();
+// List[] list = new ArrayList[2];
+// list[0] = new ArrayList();
+// list[1] = new ArrayList();
+// if( earComponent != null && list != null ){
+// IVirtualReference[] oldrefs = earComponent.getReferences();
+// for (int j = 0; j < oldrefs.length; j++) {
+// IVirtualReference ref = oldrefs[j];
+// IVirtualComponent handle = ref.getReferencedComponent();
+// if (handle instanceof VirtualArchiveComponent) {
+// VirtualArchiveComponent comp = (VirtualArchiveComponent)handle;
+// if (isPhysicallyAdded(comp))
+// continue;
+// }
+// if(!j2eeComponentList.contains(handle) && ref.getRuntimePath().isRoot()) {
+// list[0].add(handle);
+// }
+// if((!j2eeLibElementList.contains(handle) || dirUpdated) &&
+// ref.getRuntimePath().toString().equals(oldLibDir)) {
+// list[1].add(handle);
+// }
+// }
+// }
+// return list;
+// }
+//
+//
+// /*
+// * Operations called from OK
+// */
+//
+// private void execAddOp(IProgressMonitor monitor, List componentList, String path) throws CoreException {
+// if (componentList == null || componentList.isEmpty()) return;
+// IDataModel dm = DataModelFactory.createDataModel(new AddComponentToEnterpriseApplicationDataModelProvider());
+//
+// dm.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT, earComponent);
+// dm.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST, componentList);
+//
+// //[Bug 238264] the uri map needs to be manually set correctly
+// Map uriMap = new HashMap();
+// IVirtualComponent virtComp;
+// String virtCompURIMapName;
+// for(int i=0; i<componentList.size(); i++) {
+// virtComp = (IVirtualComponent)componentList.get(i);
+// virtCompURIMapName = getVirtualComponentNameWithExtension(virtComp);
+// uriMap.put(virtComp, virtCompURIMapName);
+// }
+// dm.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_TO_URI_MAP, uriMap);
+//
+// if (isVersion5) dm.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_DEPLOY_PATH, path);
+//
+// IStatus stat = dm.validateProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST);
+// if (stat != OK_STATUS)
+// throw new CoreException(stat);
+// try {
+// dm.getDefaultOperation().execute(monitor, null);
+// } catch (ExecutionException e) {
+// J2EEUIPlugin.logError(e);
+// }
+// }
+//
+// private void execAddOp1(IProgressMonitor monitor, List jProjList, List j2eeCompList, String path)
+// throws CoreException {
+// if (!jProjList.isEmpty()) {
+// Set moduleProjects = new HashSet();
+// for (int i = 0; i < jProjList.size(); i++) {
+// try {
+// IProject proj = (IProject) jProjList.get(i);
+// moduleProjects.add(proj);
+// IDataModel migrationdm = DataModelFactory.createDataModel(new JavaProjectMigrationDataModelProvider());
+// migrationdm.setProperty(IJavaProjectMigrationDataModelProperties.PROJECT_NAME, proj.getName());
+// migrationdm.getDefaultOperation().execute(monitor, null);
+//
+//
+// IDataModel refdm = DataModelFactory.createDataModel(new CreateReferenceComponentsDataModelProvider());
+// List targetCompList = (List) refdm.getProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST);
+//
+// IVirtualComponent targetcomponent = ComponentCore.createComponent(proj);
+// targetCompList.add(targetcomponent);
+//
+// refdm.setProperty(ICreateReferenceComponentsDataModelProperties.SOURCE_COMPONENT, earComponent);
+// refdm.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENT_LIST, targetCompList);
+// if (isVersion5) refdm.setProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_DEPLOY_PATH, path);
+//
+//
+// // referenced java projects should have archiveName attribute
+// ((Map)refdm.getProperty(ICreateReferenceComponentsDataModelProperties.TARGET_COMPONENTS_TO_URI_MAP)).put(targetcomponent, proj.getName().replace(' ', '_') + IJ2EEModuleConstants.JAR_EXT);
+//
+// refdm.getDefaultOperation().execute(monitor, null);
+// j2eeCompList.add(targetcomponent);
+// } catch (ExecutionException e) {
+// J2EEUIPlugin.logError(e);
+// }
+// }
+// EarFacetRuntimeHandler.updateModuleProjectRuntime(earComponent.getProject(), moduleProjects, new NullProgressMonitor());
+// } // end
+//
+// }
+//
+//
+//
+// /*
+// * Methods called From the Operations (which are called from OK)
+// */
+//
+// /**
+// * Method returns the name of the given IVirtualComponent being sure the correct extension
+// * is on the end of the name, this is important for internal projects. Added for [Bug 241509]
+// *
+// * @param virtComp the IVirtualComponent to get the name of with the correct extension
+// * @return the name of the given IVirtualComponent with the correct extension
+// */
+// private String getVirtualComponentNameWithExtension(IVirtualComponent virtComp) {
+// String virtCompURIMapName = this.getURIMappingName(virtComp);
+//
+// boolean linkedToEAR = true;
+// try {
+// if(virtComp.isBinary()){
+// linkedToEAR = ((J2EEModuleVirtualArchiveComponent)virtComp).isLinkedToEAR();
+// ((J2EEModuleVirtualArchiveComponent)virtComp).setLinkedToEAR(false);
+// }
+// if(JavaEEProjectUtilities.isDynamicWebComponent(virtComp)) {
+// if(!virtCompURIMapName.endsWith(IJ2EEModuleConstants.WAR_EXT)) {
+// //web module URIs need to end in WAR
+// virtCompURIMapName += IJ2EEModuleConstants.WAR_EXT;
+// }
+// } else if(JavaEEProjectUtilities.isJCAComponent(virtComp)) {
+// if(!virtCompURIMapName.endsWith(IJ2EEModuleConstants.RAR_EXT)) {
+// //connector module URIs need to end in RAR
+// virtCompURIMapName += IJ2EEModuleConstants.RAR_EXT;
+// }
+// } else if(!virtCompURIMapName.endsWith(IJ2EEModuleConstants.JAR_EXT)) {
+// //all other modules (EJB, AppClient, Utility) need to end in JAR
+// virtCompURIMapName += IJ2EEModuleConstants.JAR_EXT;
+// }
+// } finally {
+// if(virtComp.isBinary()){
+// ((J2EEModuleVirtualArchiveComponent)virtComp).setLinkedToEAR(linkedToEAR);
+// }
+// }
+// return virtCompURIMapName;
+// }
+//
+// /**
+// * [Bug 238264]
+// * determines a unique URI mapping name for a given component
+// * this is in case two components have the same name.
+// *
+// * @return returns a valid (none duplicate) uri mapping name for the given component\
+// */
+// private String getURIMappingName(IVirtualComponent archive) {
+//
+// //get the default uri map name for the given archive
+// IPath componentPath = Path.fromOSString(archive.getName());
+// String uriMapName = componentPath.lastSegment().replace(' ', '_');
+//
+//
+// //check to be sure this uri mapping is not already in use by another reference
+// boolean dupeArchiveName;
+// String refedCompName;
+// int lastDotIndex;
+// String increment;
+// IVirtualReference [] existingRefs = earComponent.getReferences();
+// for(int i=0;i<existingRefs.length;i++){
+// refedCompName = existingRefs[i].getReferencedComponent().getName();
+//
+// //if uri mapping names of the refed component and the given archive are the same
+// // find a new uri map name for the given archive
+// if(existingRefs[i].getArchiveName().equals(uriMapName)){
+// dupeArchiveName = true;
+// //find a new uriMapName for the given component
+// for(int j=1; dupeArchiveName; j++){
+// lastDotIndex = uriMapName.lastIndexOf('.');
+// increment = "_"+j; //$NON-NLS-1$
+//
+// //create the new potential name
+// if(lastDotIndex != -1){
+// uriMapName = uriMapName.substring(0, lastDotIndex) + increment + uriMapName.substring(lastDotIndex);
+// } else {
+// uriMapName = uriMapName.substring(0)+increment;
+// }
+//
+// //determine if the new potential name is valid
+// for(int k=0; k<existingRefs.length; k++) {
+// dupeArchiveName = existingRefs[k].getArchiveName().equals(uriMapName);
+// if(dupeArchiveName) {
+// break;
+// }
+// }
+// }
+// }
+// }
+//
+// return uriMapName;
+// }
+//
+//
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/AddModulesToEarPropertiesPage.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/AddModulesToEarPropertiesPage.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/AddModulesToEarPropertiesPage.java 2009-06-09 10:57:08 UTC (rev 15813)
@@ -0,0 +1,19 @@
+package org.jboss.ide.eclipse.as.wtp.override.ui.propertypage;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+public class AddModulesToEarPropertiesPage extends
+ AddModuleDependenciesPropertiesPage {
+
+
+ public AddModulesToEarPropertiesPage(IProject project,
+ J2EEDependenciesPage page) {
+ super(project, page);
+ }
+
+ protected boolean performOk(IProgressMonitor monitor) {
+ return false;
+ }
+
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/ComponentDependencyContentProvider.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/ComponentDependencyContentProvider.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/ComponentDependencyContentProvider.java 2009-06-09 10:57:08 UTC (rev 15813)
@@ -0,0 +1,201 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are 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:
+ * IBM Corporation - initial API and implementation
+ * Stefan Dimov, stefan.dimov(a)sap.com - bug 207826
+ *******************************************************************************/
+package org.jboss.ide.eclipse.as.wtp.override.ui.propertypage;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.jst.j2ee.application.internal.operations.ClassPathSelection;
+import org.eclipse.jst.j2ee.classpathdep.ClasspathDependencyUtil;
+import org.eclipse.jst.j2ee.classpathdep.IClasspathDependencyConstants;
+import org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.ModuleCoreNature;
+import org.eclipse.wst.common.componentcore.internal.resources.VirtualArchiveComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualReference;
+
+public class ComponentDependencyContentProvider extends ViewerFilter implements IStructuredContentProvider, ITableLabelProvider {
+
+ final static String PATH_SEPARATOR = String.valueOf(IPath.SEPARATOR);
+
+ private IVirtualComponent rootComponent;
+ private HashMap<Object, String> runtimePaths;
+
+ public ComponentDependencyContentProvider(IVirtualComponent rootComponent) {
+ super();
+ this.rootComponent = rootComponent;
+ }
+
+ public void setRuntimePaths(HashMap<Object, String> paths) {
+ this.runtimePaths = paths;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+ */
+ public Object[] getElements(Object inputElement) {
+ if( rootComponent == null )
+ return new Object[]{};
+
+ Object[] empty = new Object[0];
+ if (!(inputElement instanceof IWorkspaceRoot))
+ return empty;
+ IProject[] projects = ((IWorkspaceRoot) inputElement).getProjects();
+ if (projects == null || projects.length == 0)
+ return empty;
+ List validCompList = new ArrayList();
+ HashMap pathToComp = new HashMap();
+ for (int i = 0; i < projects.length; i++) {
+ // get flexible project
+ IProject project = projects[i];
+ if(ModuleCoreNature.isFlexibleProject(project)){
+ IVirtualComponent component = ComponentCore.createComponent(project);
+ if( !component.equals(rootComponent))
+ validCompList.add(component);
+ else {
+ IVirtualReference[] newrefs = component.getReferences();
+ for( int k=0; k< newrefs.length; k++ ){
+ IVirtualReference tmpref = newrefs[k];
+ IVirtualComponent referencedcomp = tmpref.getReferencedComponent();
+ boolean isBinary = referencedcomp.isBinary();
+ if( isBinary ){
+ validCompList.add(referencedcomp);
+ } else {
+ addClasspathComponentDependencies(validCompList,pathToComp, referencedcomp);
+ }
+ }
+ }
+ } else if (project.exists() && project.isAccessible() ){
+ if( !project.getName().startsWith(".") ) //$NON-NLS-1$
+ validCompList.add(project);
+ }
+ }
+ return validCompList.toArray();
+ }
+
+ public static void addClasspathComponentDependencies(final List componentList, HashMap pathToComp, final IVirtualComponent referencedComponent) {
+ if (referencedComponent instanceof J2EEModuleVirtualComponent) {
+ J2EEModuleVirtualComponent j2eeComp = (J2EEModuleVirtualComponent) referencedComponent;
+ IVirtualReference[] cpRefs = j2eeComp.getJavaClasspathReferences();
+ for (int j=0; j < cpRefs.length; j++) {
+ String unresolvedURI = null;
+ // only ../ mappings supported at this level
+ if (!cpRefs[j].getRuntimePath().equals(IClasspathDependencyConstants.RUNTIME_MAPPING_INTO_CONTAINER_PATH)) {
+ continue;
+ }
+ // if the absolute path for this component already has a mapping, skip (the comp might be contributed by more than
+ // one child module)
+ final IPath path = ClasspathDependencyUtil.getClasspathVirtualReferenceLocation(cpRefs[j]);
+ final IVirtualComponent comp = (IVirtualComponent) pathToComp.get(path);
+ if (comp != null) {
+ // replace with a temp VirtualArchiveComponent whose IProject is set to a new pseudo name that is
+ // the concatenation of all project contributions for that archive
+ if (comp instanceof VirtualArchiveComponent) {
+ final VirtualArchiveComponent oldComp = (VirtualArchiveComponent) comp;
+ componentList.remove(comp);
+ final VirtualArchiveComponent newComponent = ClassPathSelection.updateDisplayVirtualArchiveComponent(oldComp, cpRefs[j]);
+ pathToComp.put(path, newComponent);
+ componentList.add(newComponent);
+ }
+ continue;
+ } else {
+ pathToComp.put(path, cpRefs[j].getReferencedComponent());
+ }
+ componentList.add(cpRefs[j].getReferencedComponent());
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
+ */
+ public Image getColumnImage(Object element, int columnIndex) {
+ return null;
+ }
+
+ /*
+ * Because the Dependency page modifies the rows by hand,
+ * and also because there's a Cell modifier used, we need
+ * to know the most recent change, so we reference runtimePaths
+ */
+ public String getColumnText(Object element, int columnIndex) {
+ if (element instanceof IVirtualComponent) {
+ IVirtualComponent comp = (IVirtualComponent)element;
+ String name = ""; //$NON-NLS-1$
+ if( columnIndex == 0 ){
+ if (ClasspathDependencyUtil.isClasspathComponentDependency(comp)) {
+ return ClasspathDependencyUtil.getClasspathComponentDependencyDisplayString(comp);
+ }
+ name = comp.getName();
+ return name;
+ } else if (columnIndex == 1) {
+ return comp.getProject().getName();
+ } else if (columnIndex == 2) {
+ if( runtimePaths == null || runtimePaths.get(element) == null) {
+ return new Path(PATH_SEPARATOR).toString();
+ }
+ return runtimePaths.get(element);
+ }
+ } else if (element instanceof IProject){
+ if (columnIndex != 2) {
+ return ((IProject)element).getName();
+ } else {
+ if( runtimePaths == null || runtimePaths.get(element) == null) {
+ return new Path(PATH_SEPARATOR).toString();
+ }
+ return runtimePaths.get(element);
+ }
+ }
+ return null;
+ }
+
+ /*
+ * Do we want this element to be shown or not?
+ */
+ @Override
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ return true;
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+ public void dispose() {
+ }
+
+ public void addListener(ILabelProviderListener listener) {
+ }
+
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ public void removeListener(ILabelProviderListener listener) {
+ }
+
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/EarModuleDependenciesPropertyPage.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/EarModuleDependenciesPropertyPage.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/EarModuleDependenciesPropertyPage.java 2009-06-09 10:57:08 UTC (rev 15813)
@@ -0,0 +1,194 @@
+package org.jboss.ide.eclipse.as.wtp.override.ui.propertypage;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jst.j2ee.internal.J2EEConstants;
+import org.eclipse.jst.j2ee.internal.J2EEVersionConstants;
+import org.eclipse.jst.j2ee.internal.dialogs.ChangeLibDirDialog;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIPlugin;
+import org.eclipse.jst.j2ee.model.IEARModelProvider;
+import org.eclipse.jst.j2ee.model.ModelProviderManager;
+import org.eclipse.jst.j2ee.project.EarUtilities;
+import org.eclipse.jst.j2ee.project.JavaEEProjectUtilities;
+import org.eclipse.jst.javaee.application.Application;
+import org.eclipse.jst.jee.project.facet.EarCreateDeploymentFilesDataModelProvider;
+import org.eclipse.jst.jee.project.facet.ICreateDeploymentFilesDataModelProperties;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
+import org.eclipse.wst.common.componentcore.resources.IVirtualFile;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+
+public class EarModuleDependenciesPropertyPage extends
+ AddModuleDependenciesPropertiesPage {
+ protected Button changeLibPathButton;
+ protected String libDir = null;
+ protected String oldLibDir;
+ protected boolean isVersion5;
+ public EarModuleDependenciesPropertyPage(IProject project,
+ J2EEDependenciesPage page) {
+ super(project, page);
+ initMemberVariables();
+ }
+
+ protected void initMemberVariables() {
+ boolean hasEE5Facet = false;
+ try {
+ IFacetedProject facetedProject = ProjectFacetsManager.create(project);
+ if(facetedProject != null){
+ IProjectFacetVersion facetVersion = facetedProject.getProjectFacetVersion(EarUtilities.ENTERPRISE_APPLICATION_FACET);
+ if(facetVersion.equals(EarUtilities.ENTERPRISE_APPLICATION_50)){
+ hasEE5Facet = true;
+ }
+ }
+ } catch (CoreException e) {
+ J2EEUIPlugin.logError(e);
+ }
+
+ if(hasEE5Facet){
+ String earDDVersion = JavaEEProjectUtilities.getJ2EEDDProjectVersion(project);
+ if (earDDVersion.equals(J2EEVersionConstants.VERSION_5_0_TEXT)) {
+ isVersion5 = true;
+ Application app = (Application)ModelProviderManager.getModelProvider(project).getModelObject();
+ if (app != null)
+ oldLibDir = app.getLibraryDirectory();
+ if (oldLibDir == null) oldLibDir = J2EEConstants.EAR_DEFAULT_LIB_DIR;
+ libDir = oldLibDir;
+ }
+ }
+ }
+
+ protected ComponentDependencyContentProvider createProvider() {
+ return new EarComponentDependencyContentProvider(rootComponent);
+ }
+
+ protected void createPushButtons() {
+ super.createPushButtons();
+ if (isVersion5)
+ changeLibPathButton = createPushButton(J2EEUIMessages.getResourceString(J2EEUIMessages.CHANGE_LIB_DIR));//$NON-NLS-1$
+
+ }
+
+ public void handleEvent(Event event) {
+ if( event.widget == changeLibPathButton)
+ handleChangeLibDirButton(true);
+ else
+ super.handleEvent(event);
+ }
+
+
+ private void handleChangeLibDirButton(boolean warnBlank) {
+ IVirtualFile vFile = rootComponent.getRootFolder().getFile(new Path(J2EEConstants.APPLICATION_DD_URI));
+ if (!vFile.exists()) {
+ if (!MessageDialog.openQuestion(null,
+ J2EEUIMessages.getResourceString(J2EEUIMessages.NO_DD_MSG_TITLE),
+ J2EEUIMessages.getResourceString(J2EEUIMessages.GEN_DD_QUESTION))) return;
+ createDD(new NullProgressMonitor());
+ }
+ Application app = (Application)ModelProviderManager.getModelProvider(project).getModelObject();
+ if (libDir == null) {
+ libDir = app.getLibraryDirectory();
+ if (libDir == null) libDir = J2EEConstants.EAR_DEFAULT_LIB_DIR;
+ }
+
+ ChangeLibDirDialog dlg = new ChangeLibDirDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+ .getShell(), libDir, warnBlank);
+ if (dlg.open() == Dialog.CANCEL) return;
+ libDir = dlg.getValue().trim();
+ if (libDir.length() > 0) {
+ if (!libDir.startsWith(J2EEConstants.EAR_ROOT_DIR)) libDir = IPath.SEPARATOR + libDir;
+ }
+ }
+
+ protected void createDD(IProgressMonitor monitor) {
+ if( rootComponent != null ){
+ IDataModelOperation op = generateEARDDOperation();
+ try {
+ op.execute(monitor, null);
+ } catch (ExecutionException e) {
+ J2EEUIPlugin.logError(e);
+ }
+ }
+ }
+
+ protected IDataModelOperation generateEARDDOperation() {
+ IDataModel model = DataModelFactory.createDataModel(new EarCreateDeploymentFilesDataModelProvider());
+ model.setProperty(ICreateDeploymentFilesDataModelProperties.GENERATE_DD, rootComponent);
+ model.setProperty(ICreateDeploymentFilesDataModelProperties.TARGET_PROJECT, project);
+ return model.getDefaultOperation();
+ }
+
+ private void updateLibDir(IProgressMonitor monitor) {
+ if (libDir.equals(oldLibDir)) return;
+ final IEARModelProvider earModel = (IEARModelProvider)ModelProviderManager.getModelProvider(project);
+ final Application app = (Application)ModelProviderManager.getModelProvider(project).getModelObject();
+ oldLibDir = app.getLibraryDirectory();
+ if (oldLibDir == null) oldLibDir = J2EEConstants.EAR_DEFAULT_LIB_DIR;
+ earModel.modify(new Runnable() {
+ public void run() {
+ app.setLibraryDirectory(libDir);
+ }}, null);
+ }
+
+ public boolean performOk(IProgressMonitor monitor) {
+ if (isVersion5) {
+ if (libDir.length() == 0) {
+
+ MessageDialog dlg = new MessageDialog(null,
+ J2EEUIMessages.getResourceString(J2EEUIMessages.BLANK_LIB_DIR),
+ null, J2EEUIMessages.getResourceString(J2EEUIMessages.BLANK_LIB_DIR_WARN_QUESTION),
+ MessageDialog.QUESTION, new String[] {J2EEUIMessages.YES_BUTTON,
+ J2EEUIMessages.NO_BUTTON,
+ J2EEUIMessages.CANCEL_BUTTON}, 1);
+ switch (dlg.open()) {
+ case 0: break;
+ case 1: {
+ handleChangeLibDirButton(false);
+ return false;
+ }
+ case 2: return false;
+ default: return false;
+ }
+ }
+ updateLibDir(monitor);
+ }
+ return true;
+ }
+
+ public class EarComponentDependencyContentProvider
+ extends ComponentDependencyContentProvider {
+
+ public EarComponentDependencyContentProvider(
+ IVirtualComponent rootComponent) {
+ super(rootComponent);
+ }
+
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ List forceCheck = new ArrayList();
+ forceCheck.addAll(getChildrenComponents());
+ forceCheck.addAll(getCPComponents());
+ if( forceCheck.contains(element) || addedElements.contains(element))
+ return true;
+ return false;
+ }
+ }
+
+}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/J2EEDependenciesPage.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/J2EEDependenciesPage.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/propertypage/J2EEDependenciesPage.java 2009-06-09 10:57:08 UTC (rev 15813)
@@ -0,0 +1,261 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are 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:
+ * IBM Corporation - initial implementation as prop page heirarchy
+ * rfrost(a)bea.com - conversion to single property page impl
+ *******************************************************************************/
+
+package org.jboss.ide.eclipse.as.wtp.override.ui.propertypage;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jst.j2ee.internal.IJ2EEDependenciesControl;
+import org.eclipse.jst.j2ee.internal.JARDependencyPropertiesPage;
+import org.eclipse.jst.j2ee.internal.ManifestUIResourceHandler;
+import org.eclipse.jst.j2ee.internal.WebLibDependencyPropertiesPage;
+import org.eclipse.jst.j2ee.internal.WebRefDependencyPropertiesPage;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants;
+import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+
+
+/*
+ * The only change in this file between here and upstream is
+ * the method createEARContent
+ */
+
+/**
+ * Primary project property page for J2EE dependencies; content is dynamically
+ * generated based on the project facets and will be comprised by a
+ * set of IJ2EEDependenciesControl implementations.
+ */
+public class J2EEDependenciesPage extends org.eclipse.jst.j2ee.internal.J2EEDependenciesPage {
+
+ public String DESCRIPTION = J2EEUIMessages.getResourceString("DESCRIPTION"); //$NON-NLS-1$
+
+ private IProject project;
+ private IJ2EEDependenciesControl[] controls = new IJ2EEDependenciesControl[0];
+
+ public J2EEDependenciesPage() {
+ super();
+ }
+
+ private Composite getFacetErrorComposite(final Composite parent) {
+ final String errorCheckingFacet = ManifestUIResourceHandler.Error_Checking_Project_Facets;
+ setErrorMessage(errorCheckingFacet);
+ setValid(false);
+ return getErrorComposite(parent, errorCheckingFacet);
+ }
+
+ private Composite getErrorComposite(final Composite parent, final String error) {
+ final Composite composite = new Composite(parent, SWT.NONE);
+ final GridLayout layout = new GridLayout();
+ layout.marginWidth = 0;
+ layout.marginWidth = 0;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ final Label label= new Label(composite, SWT.NONE);
+ label.setText(error);
+ return composite;
+ }
+
+ private Composite getUnreferencedErrorComposite(final Composite parent) {
+ final String msg = ManifestUIResourceHandler.Unreferenced_Module_Error;
+ setErrorMessage(msg);
+ return getErrorComposite(parent, msg);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferencePage#performOk()
+ */
+ public boolean performOk() {
+ for (int i = 0; i < controls.length; i++) {
+ if (controls[i] != null) {
+ if (!controls[i].performOk()) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.PreferencePage#performDefaults()
+ */
+ public void performDefaults() {
+ for (int i = 0; i < controls.length; i++) {
+ if (controls[i] != null) {
+ controls[i].performDefaults();
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.preference.IPreferencePage#performCancel()
+ */
+ public boolean performCancel() {
+ for (int i = 0; i < controls.length; i++) {
+ if (controls[i] != null) {
+ if (!controls[i].performCancel()) {
+ return false;
+ }
+ }
+ }
+ return super.performCancel();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IDialogPage#setVisible(boolean)
+ */
+ public void setVisible(boolean visible) {
+ super.setVisible(visible);
+ for (int i = 0; i < controls.length; i++) {
+ if (controls[i] != null) {
+ controls[i].setVisible(visible);
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IDialogPage#dispose()
+ */
+ public void dispose() {
+ super.dispose();
+ for (int i = 0; i < controls.length; i++) {
+ if(controls[i] != null){
+ controls[i].dispose();
+ }
+ }
+ }
+
+ protected static void createDescriptionComposite(final Composite parent, final String description) {
+ Composite descriptionComp = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ descriptionComp.setLayout(layout);
+ descriptionComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ fillDescription(descriptionComp, description);
+ }
+
+ private static void fillDescription(Composite c, String s) {
+ GridData data = new GridData(GridData.FILL_HORIZONTAL);
+ data.widthHint = 250;
+ Text text = new Text(c, SWT.READ_ONLY | SWT.WRAP);
+ text.setLayoutData(data);
+ text.setText(s);
+ }
+
+ protected Control createContents(Composite parent) {
+
+ // Need to find out what type of project we are handling
+ project = (IProject) getElement().getAdapter(IResource.class);
+ Control created = null;
+ try {
+ final IFacetedProject facetedProject = ProjectFacetsManager.create(project);
+ if (facetedProject == null) {
+ return getFacetErrorComposite(parent);
+ }
+ created = createContents2(parent, facetedProject);
+ } catch (CoreException ce) {
+ return getFacetErrorComposite(parent);
+ }
+
+ if( created == null )
+ return createNonEARContent(parent);
+ return created;
+ }
+
+ /*
+ * This can maybe be replaced with an extension point in the future
+ * This is the area that needs to be extended.
+ */
+ protected Control createContents2(Composite parent, IFacetedProject facetedProject) {
+
+ boolean isEAR = facetedProject.hasProjectFacet(ProjectFacetsManager.getProjectFacet(IModuleConstants.JST_EAR_MODULE));
+ boolean isWEB = facetedProject.hasProjectFacet(ProjectFacetsManager.getProjectFacet(IModuleConstants.JST_WEB_MODULE));
+ if (isEAR) {
+ return createEARContent(parent);
+ } else if (isWEB) {
+ return createWebContent(parent);
+ }
+ return null;
+ }
+
+
+ /*
+ * This method is different from upstream
+ */
+ private Composite createEARContent(final Composite parent) {
+ //AddModuleDependenciesPropertiesPage page = new AddModuleDependenciesPropertiesPage(project, this);
+ EarModuleDependenciesPropertyPage page = new EarModuleDependenciesPropertyPage(project, this);
+ controls = new IJ2EEDependenciesControl[1];
+ controls[0] = page;
+ return page.createContents(parent);
+ }
+
+ private Composite createWebContent(final Composite parent) {
+ final boolean standalone = J2EEProjectUtilities.isStandaloneProject(project);
+
+ if (standalone) {
+ // only need to create the Web Libraries page
+ controls = new IJ2EEDependenciesControl[1];
+ controls[0] = new WebLibDependencyPropertiesPage(project, this);
+ return controls[0].createContents(parent);
+ } else {
+ // Create a tabbed folder with both "J2EE Modules" and "Web Libraries"
+ final TabFolder folder = new TabFolder(parent, SWT.LEFT);
+ folder.setLayoutData(new GridData(GridData.FILL_BOTH));
+ folder.setFont(parent.getFont());
+
+ // Create the two tabs
+ controls = new IJ2EEDependenciesControl[2];
+
+ controls[0] = new JARDependencyPropertiesPage(project, this);
+ TabItem tab = new TabItem(folder, SWT.NONE);
+ tab.setControl(controls[0].createContents(folder));
+ tab.setText(ManifestUIResourceHandler.J2EE_Modules);
+ controls[1] = new WebLibDependencyPropertiesPage(project, this);
+ tab = new TabItem(folder, SWT.NONE);
+ tab.setControl(controls[1].createContents(folder));
+ tab.setText(ManifestUIResourceHandler.Web_Libraries);
+
+ folder.setSelection(0);
+ return folder;
+ }
+ }
+
+ private Composite createNonEARContent(final Composite parent) {
+ controls = new IJ2EEDependenciesControl[1];
+ final boolean standalone = J2EEProjectUtilities.isStandaloneProject(project);
+ if (standalone) {
+ // if not referenced by an EAR, check if referenced by a dynamic web project
+ if (J2EEProjectUtilities.getReferencingWebProjects(project).length > 0) {
+ controls[0] = new WebRefDependencyPropertiesPage(project, this);
+ } else {
+ return getUnreferencedErrorComposite(parent);
+ }
+ } else {
+ controls[0] = new JARDependencyPropertiesPage(project, this);
+ }
+
+ return controls[0].createContents(parent);
+ }
+
+}
15 years, 6 months
JBoss Tools SVN: r15812 - in trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override: ui and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2009-06-09 06:48:57 -0400 (Tue, 09 Jun 2009)
New Revision: 15812
Removed:
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/WTPOveridePlugin.java
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/ui/properypage/
Log:
can't manage my svn properly. cleaning out, re-adding
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/WTPOveridePlugin.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/WTPOveridePlugin.java 2009-06-09 01:41:40 UTC (rev 15811)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.override.ui/src/org/jboss/ide/eclipse/as/wtp/override/WTPOveridePlugin.java 2009-06-09 10:48:57 UTC (rev 15812)
@@ -1,61 +0,0 @@
-package org.jboss.ide.eclipse.as.wtp.override;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class WTPOveridePlugin extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.jboss.ide.eclipse.as.wtp.override.ui"; //$NON-NLS-1$
-
- // The shared instance
- private static WTPOveridePlugin plugin;
-
- /**
- * The constructor
- */
- public WTPOveridePlugin() {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static WTPOveridePlugin getDefault() {
- return plugin;
- }
-
- public static void log(Exception e) {
- log(e.getMessage(), e);
- }
-
- public static void log(String message, Exception e) {
- IStatus status = new Status(IStatus.ERROR, PLUGIN_ID, message, e);
- getDefault().getLog().log(status);
- }
-
-}
15 years, 6 months
JBoss Tools SVN: r15811 - in trunk/flow/tests/org.jboss.tools.flow.common.test: META-INF and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2009-06-08 21:41:40 -0400 (Mon, 08 Jun 2009)
New Revision: 15811
Added:
trunk/flow/tests/org.jboss.tools.flow.common.test/.classpath
trunk/flow/tests/org.jboss.tools.flow.common.test/.project
trunk/flow/tests/org.jboss.tools.flow.common.test/META-INF/
trunk/flow/tests/org.jboss.tools.flow.common.test/META-INF/MANIFEST.MF
trunk/flow/tests/org.jboss.tools.flow.common.test/build.properties
trunk/flow/tests/org.jboss.tools.flow.common.test/src/
Log:
initial upload
Added: trunk/flow/tests/org.jboss.tools.flow.common.test/.classpath
===================================================================
--- trunk/flow/tests/org.jboss.tools.flow.common.test/.classpath (rev 0)
+++ trunk/flow/tests/org.jboss.tools.flow.common.test/.classpath 2009-06-09 01:41:40 UTC (rev 15811)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Property changes on: trunk/flow/tests/org.jboss.tools.flow.common.test/.classpath
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/flow/tests/org.jboss.tools.flow.common.test/.project
===================================================================
--- trunk/flow/tests/org.jboss.tools.flow.common.test/.project (rev 0)
+++ trunk/flow/tests/org.jboss.tools.flow.common.test/.project 2009-06-09 01:41:40 UTC (rev 15811)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.flow.common.test</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Property changes on: trunk/flow/tests/org.jboss.tools.flow.common.test/.project
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/flow/tests/org.jboss.tools.flow.common.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/flow/tests/org.jboss.tools.flow.common.test/META-INF/MANIFEST.MF (rev 0)
+++ trunk/flow/tests/org.jboss.tools.flow.common.test/META-INF/MANIFEST.MF 2009-06-09 01:41:40 UTC (rev 15811)
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.jboss.tools.flow.common.test
+Bundle-Version: 1.0.0
+Bundle-Vendor: %pluginProvider
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
Property changes on: trunk/flow/tests/org.jboss.tools.flow.common.test/META-INF/MANIFEST.MF
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/flow/tests/org.jboss.tools.flow.common.test/build.properties
===================================================================
--- trunk/flow/tests/org.jboss.tools.flow.common.test/build.properties (rev 0)
+++ trunk/flow/tests/org.jboss.tools.flow.common.test/build.properties 2009-06-09 01:41:40 UTC (rev 15811)
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
Property changes on: trunk/flow/tests/org.jboss.tools.flow.common.test/build.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 6 months