JBoss Tools SVN: r26152 - trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties.
by jbosstools-commits@lists.jboss.org
Author: bbrodt
Date: 2010-10-29 20:09:30 -0400 (Fri, 29 Oct 2010)
New Revision: 26152
Modified:
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/LiteralAssignCategory.java
Log:
OPEN - issue JBIDE-7351: General issues with Variable Initialization, Assign, and Copy
https://jira.jboss.org/browse/JBIDE-7351
Modified: trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/LiteralAssignCategory.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/LiteralAssignCategory.java 2010-10-29 20:20:39 UTC (rev 26151)
+++ trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/LiteralAssignCategory.java 2010-10-30 00:09:30 UTC (rev 26152)
@@ -10,20 +10,31 @@
*******************************************************************************/
package org.eclipse.bpel.ui.properties;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
import org.eclipse.bpel.common.ui.flatui.FlatFormAttachment;
import org.eclipse.bpel.common.ui.flatui.FlatFormData;
import org.eclipse.bpel.model.From;
+import org.eclipse.bpel.model.impl.VariableImpl;
import org.eclipse.bpel.model.resource.BPELResource;
import org.eclipse.bpel.model.util.BPELUtils;
+import org.eclipse.bpel.model.util.XSD2XMLGenerator;
import org.eclipse.bpel.ui.IBPELUIConstants;
import org.eclipse.bpel.ui.Messages;
import org.eclipse.bpel.ui.adapters.IVirtualCopyRuleSide;
import org.eclipse.bpel.ui.util.BPELUtil;
+import org.eclipse.bpel.validator.EmfModelQuery;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;
+import org.eclipse.wst.wsdl.Message;
+import org.eclipse.wst.wsdl.Part;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDTypeDefinition;
/**
@@ -95,6 +106,60 @@
}
if (fromString == null) {
fromString = EMPTY_STRING;
+ // https://jira.jboss.org/browse/JBIDE-7351
+ // if "From" is empty, construct a suitable literal for the variable
+ try {
+ VariableImpl var = (VariableImpl)fOwnerSection.getModel();
+ String rootElement = null;
+ String uriWSDL = null;
+
+ // Variable is defined using "messageType"
+ Message msg = (Message)var.getMessageType();
+ if (msg != null) {
+ if (msg.eIsProxy()) {
+ EObject obj = EmfModelQuery.lookupMessage(getBPELEditor().getProcess(), msg.getQName());
+ if (obj instanceof Message)
+ msg = (Message)obj;
+ }
+ Part part = null;
+ Map parts = msg.getParts();
+ if (parts!=null && !parts.isEmpty()) {
+ Map.Entry entry = (Map.Entry)parts.entrySet().iterator().next();
+ part = (Part)entry.getValue();
+ }
+ if (aModel.getPart() != null)
+ part = aModel.getPart();
+ if (part!=null) {
+ XSDElementDeclaration declaration = part.getElementDeclaration();
+ if (declaration != null) {
+ uriWSDL = declaration.getSchema().getSchemaLocation();
+ rootElement = declaration.getName();
+ }
+ }
+ }
+
+ // Variable is defined using "type"
+ XSDTypeDefinition type = var.getType();
+ if (type != null) {
+ QName qname = new QName(type.getTargetNamespace(), type.getName());
+ rootElement = qname.getLocalPart();
+ uriWSDL = type.eResource().getURI().toString();
+ }
+
+ // Variable is defined using "element"
+ XSDElementDeclaration element = var.getXSDElement();
+ if (element != null) {
+ QName qname = new QName(element.getTargetNamespace(), element
+ .getName());
+ rootElement = qname.getLocalPart();
+ uriWSDL = element.eResource().getURI().toString();
+ }
+
+ XSD2XMLGenerator generator = new XSD2XMLGenerator(uriWSDL, rootElement);
+ fromString = generator.createXML();
+ }
+ catch (Exception e) {
+ }
}
fLiteralText.setText(fromString);
14 years, 1 month
JBoss Tools SVN: r26151 - trunk/build/target-platform.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2010-10-29 16:20:39 -0400 (Fri, 29 Oct 2010)
New Revision: 26151
Modified:
trunk/build/target-platform/e361-wtp322.target
trunk/build/target-platform/e361-wtp322.target.p2mirror.xml
Log:
remove org.eclipse.rap.runtime.sdk.feature.group because it cannot be installed into Eclipse as part of a target platform setup
Modified: trunk/build/target-platform/e361-wtp322.target
===================================================================
--- trunk/build/target-platform/e361-wtp322.target 2010-10-29 19:57:30 UTC (rev 26150)
+++ trunk/build/target-platform/e361-wtp322.target 2010-10-29 20:20:39 UTC (rev 26151)
@@ -159,7 +159,6 @@
<unit version="1.4.0.v20100428-2315-479-9oB56N5BBR6LCA6" id="org.eclipse.emf.validation.feature.group"/>
<unit version="1.4.0.v20100428-2315-23-7w3121133502768" id="org.eclipse.emf.validation.ocl.feature.group"/>
<unit version="2.1.0.v20100606-1530-7A2-AkF7AG8PBU3BRLA" id="org.eclipse.m2m.qvt.oml.runtime.feature.group"/>
- <unit version="1.3.1.20100915-2301" id="org.eclipse.rap.runtime.sdk.feature.group"/>
<repository location="http://download.eclipse.org/releases/helios/"/>
</location>
<location includeAllPlatforms="false" includeMode="planner" type="InstallableUnit">
Modified: trunk/build/target-platform/e361-wtp322.target.p2mirror.xml
===================================================================
--- trunk/build/target-platform/e361-wtp322.target.p2mirror.xml 2010-10-29 19:57:30 UTC (rev 26150)
+++ trunk/build/target-platform/e361-wtp322.target.p2mirror.xml 2010-10-29 20:20:39 UTC (rev 26151)
@@ -147,7 +147,6 @@
<iu version="" id="org.eclipse.emf.validation.feature.group"/>
<iu version="" id="org.eclipse.emf.validation.ocl.feature.group"/>
<iu version="" id="org.eclipse.m2m.qvt.oml.runtime.feature.group"/>
-<iu version="" id="org.eclipse.rap.runtime.sdk.feature.group"/>
<iu version="" id="org.eclipse.jst.jee"/>
<iu version="" id="org.eclipse.wst.common.frameworks"/>
<iu version="" id="org.eclipse.wst.common.project.facet.ui"/>
14 years, 1 month
JBoss Tools SVN: r26150 - trunk/build/target-platform.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2010-10-29 15:57:30 -0400 (Fri, 29 Oct 2010)
New Revision: 26150
Modified:
trunk/build/target-platform/e361-wtp322.target
trunk/build/target-platform/e361-wtp322.target.p2mirror.xml
Log:
update to latest gwt; remove org.eclipse.stp.bpmn.feature.feature.group because it fails to resolve contained plugins
Modified: trunk/build/target-platform/e361-wtp322.target
===================================================================
--- trunk/build/target-platform/e361-wtp322.target 2010-10-29 19:52:37 UTC (rev 26149)
+++ trunk/build/target-platform/e361-wtp322.target 2010-10-29 19:57:30 UTC (rev 26150)
@@ -12,7 +12,7 @@
<repository location="http://m2eclipse.sonatype.org/sites/m2e/"/>
</location>
<location includeAllPlatforms="false" includeMode="planner" type="InstallableUnit">
- <unit version="0.10.0.20100209-0800" id="org.maven.ide.eclipse.wtp.feature.feature.group"/>
+ <unit version="0.11.0.20101024-0955" id="org.maven.ide.eclipse.wtp.feature.feature.group"/>
<repository location="http://m2eclipse.sonatype.org/sites/m2e-extras/"/>
</location>
<location includeAllPlatforms="false" includeMode="planner" type="InstallableUnit">
@@ -105,7 +105,6 @@
<unit version="3.6.1.r361_v20100909-9gF78GrkFqw7GrsZnvz0JWNTeb6fue6896L" id="org.eclipse.platform.feature.group"/>
<unit version="3.6.1.M20100909-0800" id="org.eclipse.platform.ide"/>
<unit version="3.4.1.R36x_v20100823-7M7K7JF90dnJ-WLf3cf4yi" id="org.eclipse.equinox.executable.feature.group"/>
- <unit version="3.4.1.R36x_v20100823-7M7K7JF90dnJ-WLf3cf4yi" id="org.eclipse.equinox.executable"/>
<unit version="3.6.1.M20100909-0800" id="org.eclipse.platform.sdk"/>
<unit version="3.6.1.r361_v20100727-7b7mFL-FET3dhESDgE5_bkJ" id="org.eclipse.pde.feature.group"/>
<unit version="3.6.1.r361_v20100714-0800-7Q7m6DDaKf5o2z-L9LxPSe6ygafz-KKIqk1rr_3j4dn7J" id="org.eclipse.sdk.feature.group"/>
@@ -146,7 +145,7 @@
<unit version="1.2.0.v20100519-2050-67808yE5F-8HAH4HECF4242" id="org.eclipse.zest.feature.group"/>
<unit version="3.1.1.v201008191505" id="org.eclipse.uml2.feature.group"/>
<unit version="3.2.1.v201008191400-7L78FA-8wqbPcNj4qa8R0eViy7vZ" id="org.eclipse.rse.feature.group"/>
- <unit version="1.2.0.201006151053" id="org.eclipse.stp.bpmn.feature.feature.group"/>
+ <!-- <unit version="1.2.0.201006151053" id="org.eclipse.stp.bpmn.feature.feature.group"/> -->
<unit version="1.4.1.v20100909-1000-37708s73533F5C1479I" id="org.eclipse.gmf.runtime.notation.feature.group"/>
<unit version="1.4.1.v20100909-1300-7d9A78FYnmMD7VBZOqOghp2tsgXc" id="org.eclipse.gmf.feature.group"/>
<unit version="2.3.0.v20100421-2359-7c7MFO2FLWUl0im8BjQMa9f" id="org.eclipse.gmf.tooling.feature.group"/>
@@ -160,7 +159,7 @@
<unit version="1.4.0.v20100428-2315-479-9oB56N5BBR6LCA6" id="org.eclipse.emf.validation.feature.group"/>
<unit version="1.4.0.v20100428-2315-23-7w3121133502768" id="org.eclipse.emf.validation.ocl.feature.group"/>
<unit version="2.1.0.v20100606-1530-7A2-AkF7AG8PBU3BRLA" id="org.eclipse.m2m.qvt.oml.runtime.feature.group"/>
- <unit version="${org.eclipse.rap.runtime.sdk.feature.group.version}" id="org.eclipse.rap.runtime.sdk.feature.group"/>
+ <unit version="1.3.1.20100915-2301" id="org.eclipse.rap.runtime.sdk.feature.group"/>
<repository location="http://download.eclipse.org/releases/helios/"/>
</location>
<location includeAllPlatforms="false" includeMode="planner" type="InstallableUnit">
@@ -207,7 +206,7 @@
</location>
<location includeAllPlatforms="false" includeMode="planner" type="InstallableUnit">
<unit version="1.3.3.v201006111317" id="com.google.gdt.eclipse.suite.e36.feature.feature.group"/>
- <unit version="2.0.4.v201006301309" id="com.google.gwt.eclipse.sdkbundle.e36.feature.2.0.4.feature.group"/>
+ <unit version="2.1.0.v201010280102" id="com.google.gwt.eclipse.sdkbundle.e36.feature.2.1.0.feature.group"/>
<repository location="http://dl.google.com/eclipse/plugin/3.6/"/>
</location>
@@ -230,4 +229,4 @@
<feature id="org.mozilla.xpcom.feature"/>
</includeBundles>
<targetJRE path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
-</target>
\ No newline at end of file
+</target>
Modified: trunk/build/target-platform/e361-wtp322.target.p2mirror.xml
===================================================================
--- trunk/build/target-platform/e361-wtp322.target.p2mirror.xml 2010-10-29 19:52:37 UTC (rev 26149)
+++ trunk/build/target-platform/e361-wtp322.target.p2mirror.xml 2010-10-29 19:57:30 UTC (rev 26150)
@@ -97,11 +97,9 @@
<iu version="" id="org.eclipse.platform.feature.group"/>
<iu version="" id="org.eclipse.platform.ide"/>
<iu version="" id="org.eclipse.equinox.executable.feature.group"/>
-<iu version="" id="org.eclipse.equinox.executable"/>
<iu version="" id="org.eclipse.platform.sdk"/>
<iu version="" id="org.eclipse.pde.feature.group"/>
<iu version="" id="org.eclipse.sdk.feature.group"/>
-<iu version="" id="org.eclipse.rcp.feature.group"/>
<iu version="" id="org.eclipse.rcp.id"/>
<iu version="" id="org.eclipse.rcp.sdk.id"/>
<iu version="" id="org.eclipse.releng.tools.feature.group"/>
@@ -136,7 +134,6 @@
<iu version="" id="org.eclipse.zest.feature.group"/>
<iu version="" id="org.eclipse.uml2.feature.group"/>
<iu version="" id="org.eclipse.rse.feature.group"/>
-<iu version="" id="org.eclipse.stp.bpmn.feature.feature.group"/>
<iu version="" id="org.eclipse.gmf.runtime.notation.feature.group"/>
<iu version="" id="org.eclipse.gmf.feature.group"/>
<iu version="" id="org.eclipse.gmf.tooling.feature.group"/>
@@ -150,6 +147,7 @@
<iu version="" id="org.eclipse.emf.validation.feature.group"/>
<iu version="" id="org.eclipse.emf.validation.ocl.feature.group"/>
<iu version="" id="org.eclipse.m2m.qvt.oml.runtime.feature.group"/>
+<iu version="" id="org.eclipse.rap.runtime.sdk.feature.group"/>
<iu version="" id="org.eclipse.jst.jee"/>
<iu version="" id="org.eclipse.wst.common.frameworks"/>
<iu version="" id="org.eclipse.wst.common.project.facet.ui"/>
@@ -186,7 +184,7 @@
<iu version="" id="org.eclipse.wst.ws_ui.feature.feature.group"/>
<iu version="" id="org.eclipse.wst.xml_core.feature.feature.group"/>
<iu version="" id="com.google.gdt.eclipse.suite.e36.feature.feature.group"/>
-<iu version="" id="com.google.gwt.eclipse.sdkbundle.e36.feature.2.0.4.feature.group"/>
+<iu version="" id="com.google.gwt.eclipse.sdkbundle.e36.feature.2.1.0.feature.group"/>
<iu version="" id="org.drools.eclipse.feature.feature.group"/>
<iu version="" id="org.drools.eclipse.task.feature.feature.group"/>
<iu version="" id="org.guvnor.tools.feature.feature.group"/>
14 years, 1 month
JBoss Tools SVN: r26149 - trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/bar/handlers.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2010-10-29 15:52:37 -0400 (Fri, 29 Oct 2010)
New Revision: 26149
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/bar/handlers/SelectionBarHandler.java
Log:
@Override annotations removed from interface implementation methods
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/bar/handlers/SelectionBarHandler.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/bar/handlers/SelectionBarHandler.java 2010-10-29 19:24:20 UTC (rev 26148)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/selection/bar/handlers/SelectionBarHandler.java 2010-10-29 19:52:37 UTC (rev 26149)
@@ -57,13 +57,11 @@
* the command has been executed, so extract extract the needed information
* from the application context.
*/
- @Override
public Object execute(ExecutionEvent event) throws ExecutionException {
HandlerUtil.toggleCommandState(event.getCommand());
return null;
}
- @Override
public void updateElement(UIElement element, Map parameters) {
fireHandlerChanged(new HandlerEvent(this, true, false));
}
14 years, 1 month
JBoss Tools SVN: r26148 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2010-10-29 15:24:20 -0400 (Fri, 29 Oct 2010)
New Revision: 26148
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/IJBossRuntimeResourceConstants.java
Log:
JBOSS_AS constant added into IJBossRuntimeResourceConstants fo fix compilation error
[java] [javac] 36. ERROR in /home/eskimo/Projects/jbds-build/jbds-build/eclipse/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeLocator.java (at line 134)
[java] [javac] IPath path2 = path.append(IJBossRuntimeResourceConstants.JBOSS_AS);
[java] [javac] ^^^^^^^^
[java] [javac] JBOSS_AS cannot be resolved or is not a field
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/IJBossRuntimeResourceConstants.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/IJBossRuntimeResourceConstants.java 2010-10-29 16:16:11 UTC (rev 26147)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/IJBossRuntimeResourceConstants.java 2010-10-29 19:24:20 UTC (rev 26148)
@@ -101,4 +101,5 @@
public static final String DESCRIPTOR_EAR = "META-INF/application.xml"; //$NON-NLS-1$
public static final String DESCRIPTOR_CLIENT = "META-INF/application-client.xml"; //$NON-NLS-1$
public static final String DESCRIPTOR_CONNECTOR = "META-INF/ra.xml"; //$NON-NLS-1$
+ public static final String JBOSS_AS = "JBOSS_AS"; //$NON-NLS-1$
}
14 years, 1 month
JBoss Tools SVN: r26147 - trunk/vpe/plugins/org.jboss.tools.vpe.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2010-10-29 12:16:11 -0400 (Fri, 29 Oct 2010)
New Revision: 26147
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/plugin.properties
trunk/vpe/plugins/org.jboss.tools.vpe/plugin.xml
Log:
https://jira.jboss.org/browse/JBIDE-7383
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/plugin.properties
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/plugin.properties 2010-10-29 15:50:52 UTC (rev 26146)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/plugin.properties 2010-10-29 16:16:11 UTC (rev 26147)
@@ -21,4 +21,5 @@
vpe.toolbar.show_border=Show border for unknown tags
vpe.toolbar.show_non_visual_tags=Show non-visual tags
vpe.toolbar.show_text_formatting=Show text formatting bar
-vpe.toolbar.show_bundle_as_el=Show bundle's messages as EL expressions
\ No newline at end of file
+vpe.toolbar.show_bundle_as_el=Show bundle's messages as EL expressions
+vpe.toolbar.name=VPE Toolbar
\ No newline at end of file
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/plugin.xml
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/plugin.xml 2010-10-29 15:50:52 UTC (rev 26146)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/plugin.xml 2010-10-29 16:16:11 UTC (rev 26147)
@@ -176,6 +176,30 @@
</with>
</or>
</definition>
+ <definition id="org.jboss.tools.ui.vpe.editor.invisibleByDefault">
+ <and>
+ <or>
+ <with variable="activeEditorId">
+ <equals value="org.jboss.tools.jst.jsp.jspeditor.JSPTextEditor"/>
+ </with>
+ <with variable="activeEditorId">
+ <equals value="org.jboss.tools.jst.jsp.jspeditor.HTMLTextEditor"/>
+ </with>
+ <with variable="activeEditorId">
+ <equals value="org.jboss.tools.jst.jsp.jspeditor.DocBookEditor"/>
+ </with>
+ </or>
+ <with
+ variable="activeContexts">
+ <iterate
+ operator="or">
+ <equals
+ value="org.jboss.tools.jst.jsp.toolbars.sampleToolbar">
+ </equals>
+ </iterate>
+ </with>
+ </and>
+ </definition>
</extension>
<extension
point="org.eclipse.ui.menus">
@@ -278,7 +302,7 @@
id="org.jboss.tools.vpe.toolbars.preferencesCommand"
tooltip="%vpe.toolbar.preferences">
<visibleWhen checkEnabled="false">
- <reference definitionId="org.jboss.tools.ui.vpe.editor"/>
+ <reference definitionId="org.jboss.tools.ui.vpe.editor.invisibleByDefault"/>
</visibleWhen>
</command>
<command
@@ -296,7 +320,7 @@
id="org.jboss.tools.vpe.toolbars.pageDesignOptionsCommand"
tooltip="%vpe.toolbar.page_design_options">
<visibleWhen checkEnabled="false">
- <reference definitionId="org.jboss.tools.ui.vpe.editor"/>
+ <reference definitionId="org.jboss.tools.ui.vpe.editor.invisibleByDefault"/>
</visibleWhen>
</command>
<command
@@ -314,7 +338,7 @@
id="org.jboss.tools.vpe.toolbars.showBorderCommand"
tooltip="%vpe.toolbar.show_border">
<visibleWhen checkEnabled="false">
- <reference definitionId="org.jboss.tools.ui.vpe.editor"/>
+ <reference definitionId="org.jboss.tools.ui.vpe.editor.invisibleByDefault"/>
</visibleWhen>
</command>
<command
@@ -324,7 +348,7 @@
id="org.jboss.tools.vpe.toolbars.showNonVisualTagsCommand"
tooltip="%vpe.toolbar.show_non_visual_tags">
<visibleWhen checkEnabled="false">
- <reference definitionId="org.jboss.tools.ui.vpe.editor"/>
+ <reference definitionId="org.jboss.tools.ui.vpe.editor.invisibleByDefault"/>
</visibleWhen>
</command>
<command
@@ -333,9 +357,10 @@
style="toggle"
id="org.jboss.tools.vpe.toolbars.showTextFormattingCommand"
tooltip="%vpe.toolbar.show_text_formatting">
- <visibleWhen checkEnabled="false">
- <reference definitionId="org.jboss.tools.ui.vpe.editor"/>
- </visibleWhen>
+ <visibleWhen
+ checkEnabled="false">
+ <reference definitionId="org.jboss.tools.ui.vpe.editor"/>
+ </visibleWhen>
</command>
<command
commandId="org.jboss.tools.vpe.commands.showBundleAsELCommand"
@@ -344,11 +369,19 @@
id="org.jboss.tools.vpe.toolbars.showBundleAsELCommand"
tooltip="%vpe.toolbar.show_bundle_as_el">
<visibleWhen checkEnabled="false">
- <reference definitionId="org.jboss.tools.ui.vpe.editor"/>
+ <reference definitionId="org.jboss.tools.ui.vpe.editor.invisibleByDefault"/>
</visibleWhen>
</command>
</menuContribution>
- </extension>
+ </extension>
+ <extension
+ point="org.eclipse.ui.actionSets">
+ <actionSet label="%vpe.toolbar.name"
+ description="Contains Vpe Configuration ToolBar Items"
+ id="org.jboss.tools.jst.jsp.toolbars.sampleToolbar"
+ visible="false">
+ </actionSet>
+ </extension>
<extension
point="org.eclipse.ui.exportWizards">
<wizard
14 years, 1 month
JBoss Tools SVN: r26146 - trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-10-29 11:50:52 -0400 (Fri, 29 Oct 2010)
New Revision: 26146
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
Log:
[JBIDE-7367] implemented correct visibility for start and stop instance.
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2010-10-29 15:49:32 UTC (rev 26145)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2010-10-29 15:50:52 UTC (rev 26146)
@@ -1,5 +1,8 @@
2010-10-29 André Dietisheim <adietish(a)redhat.com>
+ * plugin.xml: [JBIDE-7367] implemented correct visibility for start and stop instance.
+ * src/org/jboss/tools/deltacloud/ui/commands/InstanceStoppedPropertyTester.java:
+ [JBIDE-7367] implemented correct visibility for start and stop instance.
* src/org/jboss/tools/deltacloud/ui/views/CVMessages.java (getFormattedString):
[JBIDE-7459] changed to allow variable number of arguments
* src/org/jboss/tools/internal/deltacloud/ui/utils/UIUtils.java (getActiveShell):
14 years, 1 month
JBoss Tools SVN: r26145 - in trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui: META-INF and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-10-29 11:49:32 -0400 (Fri, 29 Oct 2010)
New Revision: 26145
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/InstanceStoppedPropertyTester.java
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/Deltacloud Tools.launch
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/META-INF/MANIFEST.MF
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVMessages.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/utils/UIUtils.java
Log:
[JBIDE-7367] implemented correct visibility for start and stop instance.
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/Deltacloud Tools.launch
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/Deltacloud Tools.launch 2010-10-29 15:44:15 UTC (rev 26144)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/Deltacloud Tools.launch 2010-10-29 15:49:32 UTC (rev 26145)
@@ -11,7 +11,7 @@
<booleanAttribute key="clearwslog" value="false"/>
<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/Deltacloud Tools"/>
<booleanAttribute key="default" value="false"/>
-<stringAttribute key="deselected_workspace_plugins" value="org.eclipse.epp.usagedata.recording,org.eclipse.epp.usagedata.gathering,org.mozilla.xulrunner.cocoa.macosx,org.mozilla.xulrunner.gtk.linux.x86_64,org.mozilla.xulrunner.win32.win32.x86,com.jboss.jbds.usage.branding,org.jboss.tools.usage.test,org.mozilla.xulrunner.gtk.linux.x86,org.eclipse.epp.usagedata.ui,org.mozilla.xulrunner.carbon.macosx,org.mozilla.xpcom,org.jboss.tools.tests"/>
+<stringAttribute key="deselected_workspace_plugins" value="org.eclipse.epp.usagedata.recording,org.eclipse.epp.usagedata.gathering,org.mozilla.xulrunner.cocoa.macosx,org.mozilla.xulrunner.gtk.linux.x86_64,org.jboss.tools.usage.test,org.mozilla.xulrunner.win32.win32.x86,com.jboss.jbds.usage.branding,org.mozilla.xulrunner.gtk.linux.x86,org.eclipse.epp.usagedata.ui,org.mozilla.xulrunner.carbon.macosx,org.mozilla.xpcom,org.jboss.tools.tests"/>
<booleanAttribute key="includeOptional" value="true"/>
<stringAttribute key="location" value="${workspace_loc}/../runtime-New_configuration(1)"/>
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
@@ -23,8 +23,8 @@
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dosgi.requiredJavaVersion=1.5 -XX:MaxPermSize=256m -Xms40m -Xmx1024m"/>
<stringAttribute key="pde.version" value="3.3"/>
<stringAttribute key="product" value="org.eclipse.sdk.ide"/>
-<stringAttribute key="selected_target_plugins" value="org.eclipse.help.webapp@default:default,org.eclipse.equinox.concurrent@default:default,org.apache.ant@default:default,org.eclipse.equinox.security.ui@default:default,org.eclipse.core.net.linux.x86_64@default:false,org.apache.lucene.analysis@default:default,org.eclipse.ecf.provider.filetransfer.ssl@default:false,org.eclipse.ecf.filetransfer@default:default,javax.servlet.jsp@default:default,org.apache.xml.resolver@default:default,org.eclipse.core.commands@default:default,org.eclipse.ltk.ui.refactoring@default:default,org.eclipse.equinox.security@default:default,org.eclipse.wst.common.frameworks@default:default,org.eclipse.equinox.p2.metadata.repository@default:default,org.eclipse.emf.ecore@default:default,org.apache.lucene@default:default,org.eclipse.core.filebuffers@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.emf.common@default:default,org.junit4@default:default,org.eclipse.jdt.compil!
er.tool@default:false,org.eclipse.core.expressions@default:default,org.eclipse.wst.common.emf@default:default,org.eclipse.ecf.identity@default:default,org.eclipse.ecf@default:default,org.eclipse.wst.common.emfworkbench.integration@default:default,org.eclipse.ui.ide@default:default,org.eclipse.ecf.ssl@default:false,org.eclipse.core.databinding.observable@default:default,org.eclipse.rse.services@default:default,org.eclipse.text@default:default,org.apache.commons.logging*1.0.4.v201005080501@default:default,org.eclipse.swtbot.ant.optional.junit4@default:false,org.eclipse.jface.text@default:default,org.apache.jasper@default:default,org.eclipse.core.variables@default:default,org.eclipse.equinox.p2.repository@default:default,org.eclipse.wst.xml.core@default:default,org.apache.commons.httpclient*3.1.0.v201005080502@default:default,org.eclipse.wst.validation@default:default,org.eclipse.equinox.jsp.jasper@default:default,org.eclipse.jdt.debug@default:default,org.eclipse.team.core@def!
ault:default,org.eclipse.wst.common.project.facet.core@default!
:default
,org.eclipse.help.ui@default:default,org.eclipse.core.databinding.beans@default:default,org.junit*4.8.1.v4_8_1_v20100427-1100@default:default,org.eclipse.wst.common.environment@default:default,org.eclipse.equinox.jsp.jasper.registry@default:default,org.eclipse.emf.ecore.change@default:default,org.eclipse.swtbot.ant.optional.junit3@default:false,org.eclipse.jdt.core.manipulation@default:default,org.eclipse.swt@default:default,org.apache.xml.serializer@default:default,org.eclipse.compare@default:default,org.eclipse.equinox.http.servlet@default:default,org.eclipse.core.runtime.compatibility@default:default,org.eclipse.search@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.equinox.p2.engine@default:default,org.eclipse.jdt.launching@default:default,org.eclipse.sdk@default:default,org.eclipse.help@default:default,javax.servlet@default:default,com.instantiations.designer.jdt.fragment@default:false,org.eclipse.core.runtime@default:true,org.eclipse.ui@default!
:default,org.eclipse.equinox.http.jetty@default:default,org.eclipse.wst.common.uriresolver@default:default,org.eclipse.core.filesystem@default:default,org.eclipse.osgi.services@default:default,org.eclipse.jem.util@default:default,org.eclipse.jdt.compiler.apt@default:false,org.eclipse.osgi.util@default:default,org.eclipse.osgi@-1:true,org.eclipse.equinox.p2.metadata@default:default,org.eclipse.ui.forms@default:default,org.eclipse.ui.editors@default:default,org.eclipse.equinox.app@default:default,org.eclipse.core.runtime.compatibility.auth@default:default,org.eclipse.swt.gtk.linux.x86_64@default:false,org.eclipse.wst.common.core@default:default,org.eclipse.rse.core@default:default,org.eclipse.equinox.http.registry@default:default,com.ibm.icu@default:default,javax.xml@default:default,org.eclipse.core.filesystem.linux.x86_64@default:false,org.eclipse.ui.navigator@default:default,org.jboss.tools.xulrunner.initializer@default:false,org.eclipse.ecf.provider.filetransfer@default:de!
fault,org.eclipse.update.configurator@3:true,org.apache.common!
s.codec*
1.3.0.v20100518-1140@default:default,org.jboss.tools.common@default:default,org.eclipse.jdt.core@default:default,org.eclipse.ui.workbench@default:default,org.eclipse.jface@default:default,org.eclipse.wst.sse.core@default:default,org.eclipse.ui.views@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.compare.core@default:default,org.eclipse.jdt.ui@default:default,org.eclipse.debug.core@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.ui.ide.application@default:default,org.eclipse.emf.edit@default:default,org.eclipse.ui.navigator.resources@default:default,org.eclipse.ui.views.properties.tabbed@default:default,org.eclipse.team.ui@default:default,org.eclipse.core.jobs@default:default,org.eclipse.ui.console@default:default,org.eclipse.core.net@default:default,org.eclipse.emf.ecore.xmi@default:default,org.eclipse.core.resources@default:default,org.eclipse.help.appserver@default:default,org.eclipse.ui.workbench.textedi!
tor@default:default,org.hamcrest.core@default:default,org.eclipse.ui.cheatsheets@default:default,org.eclipse.core.databinding@default:default,org.eclipse.help.base@default:default,org.eclipse.ant.core@default:default,org.mortbay.jetty.server@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.ltk.core.refactoring@default:default,org.apache.commons.el@default:default,org.mortbay.jetty.util@default:default,org.eclipse.debug.ui@default:default,org.eclipse.equinox.common@2:true,org.apache.xerces@default:default,org.eclipse.equinox.p2.core@default:default,org.eclipse.equinox.registry@default:default"/>
-<stringAttribute key="selected_workspace_plugins" value="org.jboss.tools.usage@default:default,org.jboss.tools.deltacloud.core@default:default,org.jboss.tools.deltacloud.docs@default:default,org.jboss.tools.deltacloud.test@default:default,org.jboss.tools.deltacloud.ui@default:default,org.jboss.tools.common@default:default,org.jruby.jruby@default:default"/>
+<stringAttribute key="selected_target_plugins" value="com.ibm.icu@default:default,org.eclipse.help.appserver@default:default,org.eclipse.core.runtime.compatibility.auth@default:default,org.eclipse.jdt.core.manipulation@default:default,org.eclipse.debug.ui@default:default,org.eclipse.team.ui@default:default,org.eclipse.ui.ide@default:default,org.eclipse.core.expressions@default:default,org.eclipse.equinox.http.servlet@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.ecf.provider.filetransfer.ssl@default:false,org.eclipse.help.ui@default:default,org.eclipse.core.commands@default:default,org.eclipse.emf.common@default:default,org.eclipse.jface.text@default:default,org.eclipse.swt.gtk.linux.x86_64@default:false,org.eclipse.core.databinding@default:default,org.hamcrest.core@default:default,org.eclipse.swtbot.ant.optional.junit4@default:false,org.eclipse.osgi@-1:true,org.eclipse.equinox.p2.metadata@default:default,org.eclipse.jdt.debug@default:default,org.!
eclipse.rse.core@default:default,org.eclipse.ltk.ui.refactoring@default:default,org.eclipse.ui.editors@default:default,org.junit4@default:default,org.eclipse.search@default:default,org.eclipse.core.variables@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.core.runtime.compatibility@default:default,org.eclipse.emf.edit@default:default,org.eclipse.ui.forms@default:default,org.eclipse.wst.validation@default:default,org.eclipse.update.configurator@3:true,org.eclipse.wst.common.project.facet.core@default:default,org.eclipse.equinox.security@default:default,org.eclipse.core.databinding.beans@default:default,org.eclipse.core.filebuffers@default:default,org.apache.lucene@default:default,org.eclipse.core.runtime@default:true,org.eclipse.ecf.provider.filetransfer@default:default,org.eclipse.ui.workbench.texteditor@default:default,org.eclipse.emf.ecore.xmi@default:default,org.eclipse.wst.common.core@default:default,org.eclipse.compare@default:defaul!
t,org.eclipse.osgi.util@default:default,org.apache.ant@default!
:default
,org.eclipse.ui.workbench@default:default,org.eclipse.swtbot.ant.optional.junit3@default:false,org.jboss.tools.xulrunner.initializer@default:false,org.eclipse.rse.services@default:default,org.eclipse.equinox.http.registry@default:default,org.apache.xml.serializer@default:default,org.eclipse.core.databinding.property@default:default,javax.servlet@default:default,org.eclipse.wst.common.uriresolver@default:default,org.eclipse.jface@default:default,org.eclipse.ecf@default:default,org.eclipse.ui.navigator.resources@default:default,org.jboss.tools.common@default:default,com.instantiations.designer.jdt.fragment@default:false,org.eclipse.compare.core@default:default,org.apache.lucene.analysis@default:default,org.eclipse.ltk.core.refactoring@default:default,org.eclipse.ecf.filetransfer@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.help.webapp@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.core.filesystem.linux.x86_64@default:fal!
se,org.apache.xml.resolver@default:default,org.eclipse.ui.views.properties.tabbed@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.core.net.linux.x86_64@default:false,org.eclipse.team.core@default:default,org.eclipse.equinox.p2.engine@default:default,org.eclipse.ant.core@default:default,org.eclipse.jdt.compiler.apt@default:false,org.eclipse.equinox.jsp.jasper@default:default,org.eclipse.emf.ecore.change@default:default,org.apache.commons.logging*1.0.4.v201005080501@default:default,org.eclipse.equinox.p2.core@default:default,org.apache.commons.httpclient*3.1.0.v201005080502@default:default,org.eclipse.core.resources@default:default,javax.xml@default:default,org.eclipse.jdt.launching@default:default,org.eclipse.wst.xml.core@default:default,org.eclipse.wst.common.emf@default:default,org.mortbay.jetty.server@default:default,org.eclipse.jdt.compiler.tool@default:false,org.eclipse.help.base@default:default,org.eclipse.wst.common.frameworks@default:default!
,org.eclipse.core.filesystem@default:default,org.eclipse.core.!
jobs@def
ault:default,org.eclipse.sdk@default:default,org.eclipse.equinox.p2.repository@default:default,org.eclipse.wst.common.environment@default:default,org.eclipse.debug.core@default:default,org.eclipse.text@default:default,org.eclipse.ecf.ssl@default:false,org.apache.jasper@default:default,org.eclipse.core.net@default:default,org.eclipse.osgi.services@default:default,org.eclipse.ui.views@default:default,org.eclipse.swt@default:default,org.mortbay.jetty.util@default:default,org.eclipse.jdt.ui@default:default,org.eclipse.jdt.core@default:default,org.eclipse.equinox.common@2:true,org.eclipse.ecf.identity@default:default,org.eclipse.jem.util@default:default,org.eclipse.equinox.p2.metadata.repository@default:default,org.eclipse.ui@default:default,org.junit*4.8.1.v4_8_1_v20100427-1100@default:default,org.apache.commons.el@default:default,org.eclipse.equinox.app@default:default,org.eclipse.wst.common.emfworkbench.integration@default:default,org.apache.xerces@default:default,org.eclipse.!
wst.sse.core@default:default,javax.servlet.jsp@default:default,org.eclipse.ui.ide.application@default:default,org.eclipse.equinox.concurrent@default:default,org.eclipse.help@default:default,org.eclipse.ui.console@default:default,org.eclipse.equinox.http.jetty@default:default,org.apache.commons.codec*1.3.0.v20100518-1140@default:default,org.eclipse.equinox.security.ui@default:default,org.eclipse.ui.cheatsheets@default:default,org.eclipse.emf.ecore@default:default,org.eclipse.equinox.jsp.jasper.registry@default:default,org.eclipse.ui.navigator@default:default,org.eclipse.core.runtime.compatibility.registry@default:false"/>
+<stringAttribute key="selected_workspace_plugins" value="org.jboss.tools.deltacloud.test@default:default,org.jboss.tools.common@default:default,org.jboss.tools.deltacloud.ui@default:default,org.jruby.jruby@default:default,org.jboss.tools.usage@default:default,org.jboss.tools.deltacloud.core@default:default,org.jboss.tools.deltacloud.docs@default:default"/>
<booleanAttribute key="show_selected_only" value="false"/>
<stringAttribute key="templateConfig" value="${target_home}/configuration/config.ini"/>
<booleanAttribute key="tracing" value="false"/>
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/META-INF/MANIFEST.MF 2010-10-29 15:44:15 UTC (rev 26144)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/META-INF/MANIFEST.MF 2010-10-29 15:49:32 UTC (rev 26145)
@@ -18,6 +18,7 @@
org.eclipse.core.databinding.observable;bundle-version="[1.3.0,2.0.0)",
org.eclipse.core.databinding.property;bundle-version="[1.3.0,2.0.0)",
org.eclipse.core.databinding.beans;bundle-version="1.2.100",
- org.jboss.tools.common;bundle-version="[3.2.0,4.0.0)"
+ org.jboss.tools.common;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.core.expressions;bundle-version="[3.4.200,4.0.0)"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml 2010-10-29 15:44:15 UTC (rev 26144)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml 2010-10-29 15:49:32 UTC (rev 26145)
@@ -159,9 +159,14 @@
<with
variable="selection">
<iterate operator="and">
- <instanceof
- value="org.jboss.tools.deltacloud.ui.views.CVInstanceElement">
- </instanceof>
+ <and>
+ <instanceof
+ value="org.jboss.tools.deltacloud.ui.views.CVInstanceElement">
+ </instanceof>
+ <test
+ property="org.jboss.tools.deltacloud.ui.instance.isStopped"
+ value="true"/>
+ </and>
</iterate>
</with>
</activeWhen>
@@ -173,9 +178,14 @@
<with
variable="selection">
<iterate>
- <instanceof
- value="org.jboss.tools.deltacloud.ui.views.CVInstanceElement">
- </instanceof>
+ <and>
+ <instanceof
+ value="org.jboss.tools.deltacloud.ui.views.CVInstanceElement">
+ </instanceof>
+ <test
+ property="org.jboss.tools.deltacloud.ui.instance.isStopped"
+ value="false"/>
+ </and>
</iterate>
</with>
</activeWhen>
@@ -720,5 +730,15 @@
name="%command.filterinstances.name">
</command>
</extension>
+ <extension
+ point="org.eclipse.core.expressions.propertyTesters">
+ <propertyTester
+ class="org.jboss.tools.deltacloud.ui.commands.InstanceStoppedPropertyTester"
+ id="org.jboss.tools.deltacloud.ui.commands.InstancePropertyTester"
+ namespace="org.jboss.tools.deltacloud.ui.instance"
+ properties="isStopped"
+ type="org.jboss.tools.deltacloud.ui.views.CVInstanceElement">
+ </propertyTester>
+ </extension>
</plugin>
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/InstanceStoppedPropertyTester.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/InstanceStoppedPropertyTester.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/InstanceStoppedPropertyTester.java 2010-10-29 15:49:32 UTC (rev 26145)
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.deltacloud.ui.commands;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.core.runtime.Assert;
+import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
+import org.jboss.tools.deltacloud.core.client.Instance.InstanceState;
+import org.jboss.tools.deltacloud.ui.views.CVInstanceElement;
+
+/**
+ * A property tester for the command framework that answers if the given
+ * instance is stopped
+ *
+ * @author Andre Dietisheim
+ */
+public class InstanceStoppedPropertyTester extends PropertyTester {
+
+ @Override
+ public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
+ CVInstanceElement cvInstance = (CVInstanceElement) receiver;
+ DeltaCloudInstance instance = (DeltaCloudInstance) cvInstance.getElement();
+ Assert.isTrue(expectedValue instanceof Boolean);
+ Boolean isExpectedValue = (Boolean) expectedValue;
+ boolean isStopped = InstanceState.STOPPED.toString().equals(instance.getState());
+ return isExpectedValue.equals(isStopped);
+ }
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/InstanceStoppedPropertyTester.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVMessages.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVMessages.java 2010-10-29 15:44:15 UTC (rev 26144)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVMessages.java 2010-10-29 15:49:32 UTC (rev 26145)
@@ -32,7 +32,7 @@
return MessageFormat.format(getString(key), new Object[] { arg });
}
- public static String getFormattedString(String key, String[] args) {
- return MessageFormat.format(getString(key), (Object[])args);
+ public static String getFormattedString(String key, String... args) {
+ return MessageFormat.format(getString(key), (Object[]) args);
}
}
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/utils/UIUtils.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/utils/UIUtils.java 2010-10-29 15:44:15 UTC (rev 26144)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/utils/UIUtils.java 2010-10-29 15:49:32 UTC (rev 26145)
@@ -25,6 +25,7 @@
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchActionConstants;
@@ -142,6 +143,13 @@
return workbenchWindow;
}
+ public static Shell getActiveShell()
+ {
+ Shell shell = getActiveWorkbenchWindow().getShell();
+ Assert.isTrue( shell != null && !shell.isDisposed() );
+ return shell;
+ }
+
/**
* Gets the workbench.
*
14 years, 1 month
JBoss Tools SVN: r26144 - in trunk/bpel/plugins: org.eclipse.bpel.model/src/org/eclipse/bpel/model/util and 5 other directories.
by jbosstools-commits@lists.jboss.org
Author: bbrodt
Date: 2010-10-29 11:44:15 -0400 (Fri, 29 Oct 2010)
New Revision: 26144
Added:
trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/util/XSD2XMLGenerator.java
trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/util/XSDComparer.java
Modified:
trunk/bpel/plugins/org.eclipse.bpel.model/META-INF/MANIFEST.MF
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/VariablePartAssignCategory.java
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/EmfModelQuery.java
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/ModelQuery.java
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/helpers/ModelQueryImpl.java
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/model/IModelQuery.java
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/model/Validator.java
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/rules/CValidator.java
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/rules/messages.properties
Log:
OPEN - issue JBIDE-7351: General issues with Variable Initialization, Assign, and Copy
https://jira.jboss.org/browse/JBIDE-7351
Modified: trunk/bpel/plugins/org.eclipse.bpel.model/META-INF/MANIFEST.MF
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.model/META-INF/MANIFEST.MF 2010-10-29 15:01:47 UTC (rev 26143)
+++ trunk/bpel/plugins/org.eclipse.bpel.model/META-INF/MANIFEST.MF 2010-10-29 15:44:15 UTC (rev 26144)
@@ -14,7 +14,9 @@
org.apache.xerces;bundle-version="[2.9.0,3.0.0)",
javax.wsdl;bundle-version="[1.5.0,1.6.0)",
org.eclipse.bpel.common.model;bundle-version="[0.4.0,2.0.0)",
- org.jboss.tools.usage;bundle-version="1.0.0";resolution:=optional
+ org.eclipse.wst.xml.core,
+ org.eclipse.wst.xml.ui,
+ org.eclipse.wst.xsd.ui
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.bpel.model,
org.eclipse.bpel.model.adapters,
@@ -31,3 +33,5 @@
org.eclipse.bpel.model.terms,
org.eclipse.bpel.model.util
Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Import-Package: org.eclipse.wst.xsd.contentmodel.internal,
+ org.eclipse.wst.xml.ui.internal.wizards
Added: trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/util/XSD2XMLGenerator.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/util/XSD2XMLGenerator.java (rev 0)
+++ trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/util/XSD2XMLGenerator.java 2010-10-29 15:44:15 UTC (rev 26144)
@@ -0,0 +1,446 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.eclipse.bpel.model.util;
+
+import java.io.ByteArrayOutputStream;
+import java.io.OutputStreamWriter;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Stack;
+
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.wst.xml.core.internal.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.xml.core.internal.contentmodel.CMDataType;
+import org.eclipse.wst.xml.core.internal.contentmodel.CMDocument;
+import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.xml.core.internal.contentmodel.CMGroup;
+import org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap;
+import org.eclipse.wst.xml.core.internal.contentmodel.CMNode;
+import org.eclipse.wst.xml.core.internal.contentmodel.CMNodeList;
+import org.eclipse.wst.xml.core.internal.contentmodel.ContentModelManager;
+import org.eclipse.wst.xml.core.internal.contentmodel.basic.CMElementDeclarationImpl;
+import org.eclipse.wst.xml.core.internal.contentmodel.basic.CMNamedNodeMapImpl;
+import org.eclipse.wst.xml.core.internal.contentmodel.util.DOMContentBuilder;
+import org.eclipse.wst.xml.core.internal.contentmodel.util.DOMContentBuilderImpl;
+import org.eclipse.wst.xml.core.internal.contentmodel.util.DOMNamespaceInfoManager;
+import org.eclipse.wst.xml.core.internal.contentmodel.util.DOMWriter;
+import org.eclipse.wst.xml.core.internal.contentmodel.util.NamespaceInfo;
+import org.eclipse.wst.xml.ui.internal.wizards.NewXMLGenerator;
+import org.eclipse.wst.xsd.contentmodel.internal.XSDImpl.XSDAttributeUseAdapter;
+import org.eclipse.wst.xsd.contentmodel.internal.XSDImpl.XSDElementDeclarationAdapter;
+import org.eclipse.xsd.XSDAttributeDeclaration;
+import org.eclipse.xsd.XSDAttributeUse;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDEnumerationFacet;
+import org.eclipse.xsd.XSDNamedComponent;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.XSDSimpleTypeDefinition;
+import org.eclipse.xsd.XSDTypeDefinition;
+import org.eclipse.xsd.impl.XSDElementDeclarationImpl;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * This extends the internal NewXMLGenerator and fixes some issues with <choice> elements
+ *
+ * @see https://jira.jboss.org/browse/JBIDE-6748, https://jira.jboss.org/browse/JBIDE-7351
+ * @author Bob Brodt
+ * @date Oct 29, 2010
+ */
+@SuppressWarnings("restriction")
+public class XSD2XMLGenerator extends NewXMLGenerator {
+
+ // this mess is an attempt to insulate ourselves from changes in the DOMCOntentBuilder API
+ public static final int BUILD_OPTIONAL_ATTRIBUTES = 1;
+ public static final int BUILD_OPTIONAL_ELEMENTS = 1 << 1;
+ public static final int BUILD_FIRST_CHOICE = 1 << 2;
+ public static final int BUILD_TEXT_NODES = 1 << 3;
+ public static final int BUILD_FIRST_SUBSTITUTION = 1 << 4;
+ public static final int BUILD_STRUCTURE_ONLY = 1 << 5;
+
+ public static final int BUILD_ONLY_REQUIRED_CONTENT =
+ BUILD_FIRST_CHOICE
+ | BUILD_TEXT_NODES;
+ public static final int BUILD_ALL_CONTENT =
+ BUILD_OPTIONAL_ATTRIBUTES
+ | BUILD_OPTIONAL_ELEMENTS
+ | BUILD_FIRST_CHOICE
+ | BUILD_TEXT_NODES;
+
+ MyDOMContentBuilderImpl contentBuilder = null;
+ protected String queryPath[] = new String[0];
+ protected int myBuildPolicy = BUILD_ONLY_REQUIRED_CONTENT;
+ protected String xsdURI = null;
+
+ /**
+ * @param xsdURI
+ * @param rootElementName
+ */
+ public XSD2XMLGenerator(String xsdURI, String rootName) {
+ setRootElementName(rootName);
+ this.xsdURI = xsdURI;
+ }
+
+
+ /**
+ * Default constructor requires a call to setRoot() which will determine
+ * the root element name and XSD uri
+ */
+ public XSD2XMLGenerator() {
+ super();
+ }
+
+ /**
+ * @param path
+ */
+ public void setQueryPath(String path)
+ {
+ if (path!=null && path.length()>0) {
+ this.queryPath = path.split("/");
+ if (this.queryPath!=null && this.queryPath.length>0) {
+ for (int i=0; i<this.queryPath.length; ++i) {
+ this.queryPath[i] = this.queryPath[i].replaceFirst(".*:", "");
+ }
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.wst.xml.ui.internal.wizards.NewXMLGenerator#setBuildPolicy(int)
+ */
+ @Override
+ public void setBuildPolicy(int buildPolicy) {
+ this.myBuildPolicy = buildPolicy;
+ }
+
+ /**
+ * @return
+ * @throws Exception
+ */
+ public String createXML() throws Exception {
+
+ if (xsdURI==null)
+ throw new IllegalArgumentException("XML Generator: XSD location is unknown");
+
+ CMDocument cmDocument = ContentModelManager.getInstance().createCMDocument(xsdURI, "xsd");
+ setCMDocument(cmDocument);
+ createNamespaceInfoList();
+
+ // create the xml model
+ CMNamedNodeMap map = cmDocument.getElements();
+ CMElementDeclaration cmRootElement = null;
+
+ cmRootElement = (CMElementDeclaration) map.getNamedItem(getRootElementName());
+ if (cmRootElement==null)
+ throw new IllegalArgumentException("XML Generator: Root element \'"+getRootElementName()+"\' is not defined in this XSD");
+
+ Document xmlDocument = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
+
+ createContentBuilder(xmlDocument);
+
+ // do the dirty deed!
+ contentBuilder.createDefaultRootContent(cmDocument, cmRootElement, namespaceInfoList);
+
+ // create an output stream so we can generate a string
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+ OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream);
+
+ DOMWriter domWriter = new DOMWriter(outputStreamWriter);
+
+ // TODO... instead of relying on file extensions, we need to keep
+ // track of the grammar type...
+ // better yet we should create an SSE document so that we can format
+ // it nicely before saving then we won't need the DOMWriter at all
+ domWriter.print(xmlDocument);
+ outputStream.flush();
+ outputStream.close();
+
+ return outputStream.toString();
+ }
+
+ /**
+ * @param xmlDocument
+ */
+ private void createContentBuilder(Document xmlDocument) {
+ contentBuilder = new MyDOMContentBuilderImpl(xmlDocument);
+
+ // convert our build policy to theirs
+ int bp = 0;
+ if ((myBuildPolicy|BUILD_OPTIONAL_ATTRIBUTES) != 0) bp |= DOMContentBuilder.BUILD_OPTIONAL_ATTRIBUTES;
+ if ((myBuildPolicy|BUILD_OPTIONAL_ELEMENTS) != 0) bp |= DOMContentBuilder.BUILD_OPTIONAL_ELEMENTS;
+ if ((myBuildPolicy|BUILD_FIRST_CHOICE) != 0) bp |= DOMContentBuilder.BUILD_FIRST_CHOICE;
+ if ((myBuildPolicy|BUILD_TEXT_NODES) != 0) bp |= DOMContentBuilder.BUILD_TEXT_NODES;
+ if ((myBuildPolicy|BUILD_FIRST_SUBSTITUTION) != 0) bp |= DOMContentBuilder.BUILD_FIRST_SUBSTITUTION;
+ contentBuilder.setBuildPolicy(bp);
+ }
+
+
+ /**
+ * Given a CMNode object, determine the XSD type definition for the Node
+ *
+ * @param cmNode - a CMNode object encapsulating either an Element or an Attribute
+ * @return XSD type definition, or null
+ */
+ public static XSDTypeDefinition getXSDType(CMNode cmNode) {
+ // this code snippet was obtained here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=265274
+ XSDTypeDefinition xsdType = null;
+
+ if(cmNode instanceof CMElementDeclaration) {
+ CMElementDeclaration cmElementDeclaration = (CMElementDeclaration)cmNode;
+ if(cmElementDeclaration instanceof XSDElementDeclarationAdapter) {
+ XSDElementDeclarationAdapter xsdElementDeclarationAdapter = (XSDElementDeclarationAdapter)cmElementDeclaration;
+ Notifier target = xsdElementDeclarationAdapter.getTarget();
+ if(target instanceof XSDElementDeclaration) {
+ XSDElementDeclaration xsdElementDeclaration = (XSDElementDeclaration)target;
+ xsdType = xsdElementDeclaration.getResolvedElementDeclaration().getTypeDefinition();
+ }
+ }
+ }
+ else if(cmNode instanceof CMAttributeDeclaration) {
+ CMAttributeDeclaration cmAttributeDeclaration = (CMAttributeDeclaration)cmNode;
+ if(cmAttributeDeclaration instanceof XSDAttributeUseAdapter) {
+ XSDAttributeUseAdapter xsdAttributeUseAdapter = (XSDAttributeUseAdapter)cmAttributeDeclaration;
+ Notifier target = xsdAttributeUseAdapter.getTarget();
+ if(target instanceof XSDAttributeUse) {
+ XSDAttributeUse xsdAttributeUse = (XSDAttributeUse)target;
+ XSDAttributeDeclaration xsdAttributeDeclaration = xsdAttributeUse.getAttributeDeclaration();
+ if(xsdAttributeDeclaration != null) {
+ xsdType = xsdAttributeDeclaration.getResolvedAttributeDeclaration().getTypeDefinition();
+ }
+ }
+ }
+ }
+
+ return xsdType;
+ }
+
+ /**
+ * Internal class that extends the actual XML generator.
+ * There are a couple of, let's call them "misbehaviors", of the DOMContentBuilder
+ * implementation that we need to correct:
+ * 1. if the caller specified an XPath and if any of the elements in that path are
+ * "choices" then generate the XML for those particular choices, instead of picking
+ * the first choice in the sequence.
+ * 2. if the generated "choice" contains an "enumeration" element, generate the correct
+ * text value for that element, instead of picking the first enumeration value derived
+ * from the base type.
+ */
+ public class MyDOMContentBuilderImpl extends DOMContentBuilderImpl {
+
+ // need to keep track of the current parent CMNode object so we can determine the
+ // XSD type definition when trying to build text content for a node (see createTextNode())
+ protected Stack<CMNode> cmNodeStack = new Stack<CMNode>();
+
+ public MyDOMContentBuilderImpl(Document document) {
+ super(document);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.wst.xml.core.internal.contentmodel.util.DOMContentBuilderImpl#createDefaultRootContent(org.eclipse.wst.xml.core.internal.contentmodel.CMDocument, org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration)
+ */
+ @Override
+ public void createDefaultRootContent(CMDocument cmDocument,
+ CMElementDeclaration rootCMElementDeclaration) throws Exception {
+ if (namespaceInfoList != null) {
+ DOMNamespaceInfoManager manager = new DOMNamespaceInfoManager();
+ String name = rootCMElementDeclaration.getNodeName();
+ if (namespaceInfoList.size() > 0) {
+ NamespaceInfo info = (NamespaceInfo) namespaceInfoList.get(0);
+ if (info.prefix != null && info.prefix.length() > 0) {
+ name = info.prefix + ":" + name; //$NON-NLS-1$
+ }
+ }
+ rootElement = createElement(rootCMElementDeclaration, name, document);
+ if ((myBuildPolicy & BUILD_STRUCTURE_ONLY)==0)
+ manager.addNamespaceInfo(rootElement, namespaceInfoList, true);
+ }
+ createDefaultContent(document, rootCMElementDeclaration);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.wst.xml.core.internal.contentmodel.util.DOMContentBuilderImpl#visitCMGroup(org.eclipse.wst.xml.core.internal.contentmodel.CMGroup)
+ */
+ @Override
+ public void visitCMGroup(CMGroup e) {
+ // this was copied directly from DOMContentBuilderImpl because there is apparently
+ // no way of having CMNode return the "contentHint" property (see original implementation)
+ // short of subclassing CMNode...an example provided by the wtp team would have
+ // helped here.
+ cmGroupStack.push(e);
+
+ int forcedMin = (buildOptionalElements(myBuildPolicy) || alwaysVisit) ? 1 : 0;
+ int min = Math.max(e.getMinOccur(), forcedMin);
+
+ int max = 0;
+ if (e.getMaxOccur() == -1) // unbounded
+ max = getNumOfRepeatableElements();
+ else
+ max = Math.min(e.getMaxOccur(), getNumOfRepeatableElements());
+
+ if (max < min)
+ max = min;
+
+ alwaysVisit = false;
+
+ for (int i = 1; i <= max; i++) {
+ if (e.getOperator() == CMGroup.CHOICE && buildFirstChoice(myBuildPolicy)) {
+ CMNode cmNode = null;
+
+ if (domLevel>0 && domLevel<=queryPath.length)
+ {
+ for (int n=0; n<e.getChildNodes().getLength(); ++n ) {
+ CMNode cn = e.getChildNodes().item(n);
+ if (cn.getNodeName().equals(queryPath[domLevel-1])) {
+ cmNode = cn;
+ break;
+ }
+ }
+ }
+
+ // if no cmNode has been determined from the path, just use the first choice
+ if (cmNode == null) {
+ CMNodeList nodeList = e.getChildNodes();
+ if (nodeList.getLength() > 0) {
+ cmNode = nodeList.item(0);
+ }
+ }
+
+ if (cmNode != null) {
+ visitCMNode(cmNode);
+ }
+ }
+ else if (e.getOperator() == CMGroup.ALL // ALL
+ || e.getOperator() == CMGroup.SEQUENCE) // SEQUENCE
+ {
+ // visit all of the content
+ super.visitCMGroup(e);
+ }
+ }
+
+ cmGroupStack.pop();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.wst.xml.core.internal.contentmodel.util.DOMContentBuilderImpl#handlePushParent(org.w3c.dom.Element, org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration)
+ */
+ @Override
+ protected void handlePushParent(Element parent, CMElementDeclaration ed) {
+ super.handlePushParent(parent, ed);
+ cmNodeStack.push(ed);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.wst.xml.core.internal.contentmodel.util.DOMContentBuilderImpl#handlePopParent(org.w3c.dom.Element, org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration)
+ */
+ @Override
+ protected void handlePopParent(Element element, CMElementDeclaration ed) {
+ super.handlePopParent(element, ed);
+ cmNodeStack.pop();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.wst.xml.core.internal.contentmodel.util.DOMContentBuilderImpl#createElement(org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration, java.lang.String, org.w3c.dom.Node)
+ */
+ @Override
+ protected org.w3c.dom.Element createElement(CMElementDeclaration ed, String name, Node parent) {
+ // if building XML that represents only structure, use a generic element name
+ // (either "simpleElem" or "complexElem") instead of the elements actual tag name
+ if ((myBuildPolicy & BUILD_STRUCTURE_ONLY) != 0) {
+ CMDataType dt = ed.getDataType();
+ if (dt!=null)
+ return document.createElement("simpleElem");
+ return document.createElement("complexElem");
+ }
+ return document.createElement(name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.wst.xml.core.internal.contentmodel.util.DOMContentBuilderImpl#createAttribute(org.eclipse.wst.xml.core.internal.contentmodel.CMAttributeDeclaration, java.lang.String, org.w3c.dom.Node)
+ */
+ @Override
+ protected org.w3c.dom.Attr createAttribute(CMAttributeDeclaration ad, String name, Node parent) {
+ // TODO: I think attribute names MUST match even if we're only building XML structure
+ // for the purposes of comparing two XSD fragments...
+ return document.createAttribute(name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.wst.xml.core.internal.contentmodel.util.DOMContentBuilderImpl#createTextNode(org.eclipse.wst.xml.core.internal.contentmodel.CMDataType, java.lang.String, org.w3c.dom.Node)
+ */
+ @Override
+ protected org.w3c.dom.Text createTextNode(CMDataType dataType, String value, Node parent) {
+
+ // get XSD type definition from parent object currently at the top of our stack
+ // so that we can get the (reduced) enumeration value types for that element
+ // instead of for the base type (which is what XSDImpl#getEnumeratedValuesForType() does!)
+ if (cmNodeStack.size()>0) {
+ XSDTypeDefinition xsdType = getXSDType(cmNodeStack.peek());
+ if (xsdType!=null) {
+ List result = new ArrayList();
+ getEnumeratedValuesForSimpleType(xsdType, result);
+ if (!result.isEmpty()) {
+ value = (String)result.get(0);
+ return document.createTextNode(value);
+ }
+ }
+ }
+
+ // if building XML that represents only structure, use a generic text value
+ // (the data type) instead of the value determined by the generator (see
+ // XSDTypeUtil#getInstanceValue() for example...)
+ if ((myBuildPolicy & BUILD_STRUCTURE_ONLY) != 0)
+ value = dataType.getDataTypeName();
+
+ return document.createTextNode(value);
+ }
+
+ /**
+ * This was stolen directly from XSDImpl. It builds a list of the enumeration
+ * values for the given XSD type definition.
+ *
+ * @param type - an XSD type definition (presumably determined from a CMNode)
+ * @param result - List to which we will add our results
+ */
+ public void getEnumeratedValuesForSimpleType(XSDTypeDefinition type, List result) {
+ List enumerationFacets = ((XSDSimpleTypeDefinition) type)
+ .getEnumerationFacets();
+ for (Iterator i = enumerationFacets.iterator(); i.hasNext();) {
+ XSDEnumerationFacet enumFacet = (XSDEnumerationFacet) i.next();
+ List values = enumFacet.getValue();
+ for (Iterator j = values.iterator(); j.hasNext();) {
+ Object o = j.next();
+ if (o != null) {
+ if (!result.contains(o)) {
+ result.add(o.toString());
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
Added: trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/util/XSDComparer.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/util/XSDComparer.java (rev 0)
+++ trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/util/XSDComparer.java 2010-10-29 15:44:15 UTC (rev 26144)
@@ -0,0 +1,781 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.eclipse.bpel.model.util;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Stack;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.xsd.*;
+import org.eclipse.xsd.util.XSDConstants;
+
+/**
+ * Compares two XSD fragments for structure and data type compatibility.
+ * Optional components in either the left or right schema may be skipped
+ * over during the comparison unless a strict match is requested (see
+ * <code>setStrict()<code>).
+ *
+ * Components which have a "minOccurs" of 0 are considered optional.
+ * Wildcard components (<xsd:any> elements) will match any component
+ * in the other schema.
+ *
+ * After the comparison, diagnostics are available which indicate the
+ * components in the left and right schema that do not match. Warning
+ * diagnostics are generated whenever optional components were skipped
+ * to force a match.
+ *
+ * @see https://jira.jboss.org/browse/JBIDE-7351
+ * @author Bob Brodt
+ * @date Oct 29, 2010
+ */
+public class XSDComparer {
+
+ protected boolean strict = false;
+ protected boolean debug = false;
+ protected List<XSDDiagnostic> diagnostics;
+
+ public void setStrict(boolean flag) {
+ strict = flag;
+ }
+
+ public void setDebug(boolean flag) {
+ debug = flag;
+ }
+
+ /**
+ * The main comparison function that compares two XSD type definitions.
+ * These may be the entire schema or just fragments within a schema.
+ *
+ * @param type1 - the "left" type definition
+ * @param type2 - the "right" type definition
+ * @return true if the types are compatible, false if not.
+ * Warning diagnostics may still be generated for a successful match.
+ */
+ public boolean compare(XSDTypeDefinition type1, XSDTypeDefinition type2) {
+ boolean result = false;
+ if (type1==null || type2==null)
+ throw new IllegalArgumentException("XSDComparer: XSD types may not be null");
+
+ try {
+ // always clear out diagnostics before we start
+ if (diagnostics!=null)
+ diagnostics.clear();
+
+ // for debugging only: run through the exercises even if the
+ // two objects are one and the same
+ if (!debug && type1==type2)
+ return true;
+
+ result = compare(getChildTerms(type1), getChildTerms(type2), 0);
+ } catch (Exception e) {
+ return false;
+ }
+
+ return result;
+ }
+
+ /**
+ * Compares a list of the immediate children of a component; called recursively
+ * for children that are complex elements.
+ *
+ * @param list1 - children of the "left" schema
+ * @param list2 - children of the "right" schema
+ * @param level - recursion level (for debug printing)
+ * @return true if the left and right children lists are compatible.
+ */
+ protected boolean compare(List<XSDTerm> list1, List<XSDTerm> list2, int level) {
+
+ XSDTerm term1 = null;
+ XSDTerm term2 = null;
+
+ try {
+ int index1 = 0;
+ int index2 = 0;
+ int size1 = list1.size();
+ int size2 = list2.size();
+ while (index1 < size1 && index2 < size2) {
+ term1 = list1.get(index1);
+ term2 = list2.get(index2);
+ if ( term1 instanceof XSDElementDeclaration && term2 instanceof XSDElementDeclaration) {
+ XSDElementDeclaration elem1 = (XSDElementDeclaration)term1;
+ XSDElementDeclaration elem2 = (XSDElementDeclaration)term2;
+ XSDTypeDefinition type1 = elem1.getTypeDefinition();
+ XSDTypeDefinition type2 = elem2.getTypeDefinition();
+ if (type1 instanceof XSDSimpleTypeDefinition && type2 instanceof XSDSimpleTypeDefinition) {
+ dump("Comparing ", elem1, type1, level);
+ dump(" to ", elem2, type2, level);
+ String s1 = getTypeNameHierarchy(elem1);
+ String s2 = getTypeNameHierarchy(elem2);
+ if (!s1.equals(s2)) {
+ addError("different data types: "+s1+" vs "+s2,elem1,elem2);
+ return false;
+ }
+ } else if (type1 instanceof XSDComplexTypeDefinition && type2 instanceof XSDComplexTypeDefinition) {
+ int min1 = getMinOccurs(term1);
+ int min2 = getMinOccurs(term2);
+ int max1 = getMaxOccurs(term1);
+ int max2 = getMaxOccurs(term2);
+ if (strict) {
+ if (min1 != min2 || max1 != max2) {
+ addError("different cardinality: " + min1 + " to " + max1 + " vs " + min2 + " to " + max2, term1,term2);
+ return false;
+ }
+ } else {
+ if (min1 > max2 || min2 > max1) {
+ addError("incompatible cardinality: " + min1 + " to " + max1 + " vs " + min2 + " to " + max2, term1,term2);
+ return false;
+ }
+ }
+ dump("Comparing ", elem1, type1, level);
+ dump(" to ", elem2, type2, level);
+ boolean result = compare(getChildTerms(elem1), getChildTerms(elem2), level + 1);
+ if (!result) {
+ addError("different complex element structures",elem1,elem2);
+ return false;
+ }
+ } else {
+ if (!strict) {
+ // try shifting optional elements and continue from there
+ dump("Elements out of sync - skipping optional elements");
+ if (isOptional(elem1)) {
+ // skip over this one and compare remaining elements
+ List<XSDTerm> newList1 = new ArrayList<XSDTerm>();
+ List<XSDTerm> newList2 = new ArrayList<XSDTerm>();
+ for (int i = index1 + 1; i < size1; ++i)
+ newList1.add(list1.get(i));
+ for (int i = index2; i < size2; ++i)
+ newList2.add(list2.get(i));
+ if (compare(newList1, newList2, level)) {
+ addWarning("skipped optional element(s) in left schema",elem1,elem2);
+ return true;
+ }
+ addError("different complex element structures",elem1,elem2);
+ }
+ if (isOptional(elem2)) {
+ // skip over this one and compare remaining elements
+ List<XSDTerm> newList1 = new ArrayList<XSDTerm>();
+ List<XSDTerm> newList2 = new ArrayList<XSDTerm>();
+ for (int i = index1; i < size1; ++i)
+ newList1.add(list1.get(i));
+ for (int i = index2 + 1; i < size2; ++i)
+ newList2.add(list2.get(i));
+ if (compare(newList1, newList2, level)) {
+ addWarning("skipped optional element(s) in right schema",elem1,elem2);
+ return true;
+ }
+ addError("different complex element structures",elem1,elem2);
+ }
+ }
+ addError("different complex element structures",elem1,elem2);
+ return false;
+ }
+
+ List<XSDAttributeDeclaration> attrs1 = getAttributeDeclarations(elem1);
+ List<XSDAttributeDeclaration> attrs2 = getAttributeDeclarations(elem2);
+ if (attrs1.size() != attrs2.size()) {
+ addError("differing number of attributes",elem1,elem2);
+ return false;
+ }
+ for (int i = 0; i < attrs1.size(); ++i) {
+ XSDAttributeDeclaration attr1 = attrs1.get(i);
+ XSDAttributeDeclaration attr2 = attrs2.get(i);
+ if (!attr1.getQName().equals(attr2.getQName())) {
+ addError("differing attribute names: "+attr1.getQName()+" vs "+attr2.getQName(),elem1,elem2);
+ return false;
+ }
+ if (!attr1.getLexicalValue().equals(attr2.getLexicalValue())) {
+ addError("differing attribute values: "+attr1.getLexicalValue()+" vs "+attr2.getLexicalValue(),elem1,elem2);
+ return false;
+ }
+ }
+
+ } else if (term1 instanceof XSDWildcard && !(term2 instanceof XSDWildcard) ) {
+ // left schema term is a wildcard, right schema is not
+ int min = getMinOccurs(term1);
+ int max = getMinOccurs(term1);
+ if (max==-1)
+ max = size1;
+
+ for (int n=min; n<=max; ++n) {
+ // skip over this one and compare remaining elements
+ List<XSDTerm> newList1 = new ArrayList<XSDTerm>();
+ List<XSDTerm> newList2 = new ArrayList<XSDTerm>();
+ for (int i = index1 + 1 + n; i < size1; ++i)
+ newList1.add(list1.get(i));
+ for (int i = index2; i < size2; ++i)
+ newList2.add(list2.get(i));
+ if (compare(newList1, newList2, level)) {
+ addWarning("skipped optional element(s) in left schema",term1,term2);
+ return true;
+ }
+ }
+ addError("different complex element structures",term1,term2);
+ return false;
+ } else if (term1 instanceof XSDWildcard && !(term2 instanceof XSDWildcard) ) {
+ // right schema is a wildcard, left schema is not
+ int min = getMinOccurs(term2);
+ int max = getMinOccurs(term2);
+ if (max==-1)
+ max = size2;
+
+ for (int n=min; n<=max; ++n) {
+ // skip over this one and compare remaining elements
+ List<XSDTerm> newList1 = new ArrayList<XSDTerm>();
+ List<XSDTerm> newList2 = new ArrayList<XSDTerm>();
+ for (int i = index1; i < size1; ++i)
+ newList1.add(list1.get(i));
+ for (int i = index2 + 1 + n; i < size2; ++i)
+ newList2.add(list2.get(i));
+ if (compare(newList1, newList2, level)) {
+ addWarning("skipped optional element(s) in right schema",term1,term2);
+ return true;
+ }
+ }
+ addError("different complex element structures",term1,term2);
+ return false;
+ } else if (term1 instanceof XSDWildcard && term2 instanceof XSDWildcard) {
+ // both wildcards - it's a match!
+ int min1 = getMinOccurs(term1);
+ int max1 = getMinOccurs(term1);
+ int min2 = getMinOccurs(term2);
+ int max2 = getMinOccurs(term2);
+ if (min1!=min2 || max1!=max2) {
+ // not possible
+ addError("different <xsd:any> cardinality: "+min1+" to "+max1+" vs "+min2+" to "+max2,term1,term2);
+ }
+ }
+
+ ++index1;
+ ++index2;
+ }
+
+ // any leftovers? they must be optional
+ if (strict && size1 != size2) {
+ addError("different number of elements: "+size1+" vs "+size2,term1,term2);
+ return false;
+ }
+
+ if (index1 < size1) {
+ dump("Additional elements in left schema");
+ while (index1 < size1) {
+ term1 = list1.get(index1);
+ if (isOptional(term1)) {
+ dump("Ignoring optional element", term1, null, 1);
+ addWarning("skipped optional element in left schema",term1,term2);
+ term1 = list2.get(++index1);
+ } else {
+ addError("additional elements in left schema",term1,term2);
+ return false;
+ }
+ }
+ }
+
+ if (index2 < size2) {
+ dump("Additional elements in right schema");
+ while (index2 < size2) {
+ term2 = list2.get(index2);
+ if (isOptional(term2)) {
+ dump("Ignoring optional element", term2, null, 1);
+ addWarning("skipped optional element in right schema",term1,term2);
+ term2 = list2.get(++index2);
+ } else {
+ addError("additional elements in right schema",term1,term2);
+ return false;
+ }
+ }
+ }
+
+ } catch (Exception e) {
+ addError("caught exception: "+e.toString(),term1,term2);
+ return false;
+ }
+ dump("*** Schemas are compatible");
+
+ return true;
+ }
+
+ /**
+ * Returns the data type name of the given element, including base types.
+ *
+ * @param elem - the element
+ * @return data type name hierarchy as a ":" separated string
+ */
+ protected String getTypeNameHierarchy(XSDElementDeclaration elem) {
+ String s = "";
+ Stack<String> names = new Stack<String>();
+ XSDTypeDefinition type = elem.getType();
+ while (type != type.getBaseType()) {
+ String name = type.getName();
+ if (name != null)
+ names.push(name);
+ type = type.getBaseType();
+ }
+ while (!names.isEmpty()) {
+ if (s.isEmpty())
+ s = names.pop();
+ else
+ s = s + ":" + names.pop();
+ }
+ return s;
+ }
+
+ /**
+ * Returns a list of immediate children for the specified element.
+ *
+ * @param element - the parent element
+ * @return A list of XSDTerm objects
+ */
+ protected final List<XSDTerm> getChildTerms(XSDElementDeclaration element) {
+ return getChildTerms(element.getType());
+ }
+
+ /**
+ * Returns a list of immediate children for the specified XSD type.
+ *
+ * @param type - the parent type
+ * @return A list of XSDTerm objects
+ */
+ protected final List<XSDTerm> getChildTerms(XSDTypeDefinition type) {
+ final ArrayList<XSDTerm> terms = new ArrayList<XSDTerm>();
+
+ TypeWalker.Visitor visitor = new TypeWalker.Visitor() {
+ public boolean visit(XSDTypeDefinition type) {
+ // simple types don't have children
+ if (type instanceof XSDSimpleTypeDefinition)
+ return true;
+
+ XSDComplexTypeDefinition cType = (XSDComplexTypeDefinition) type;
+
+ visitTerms(cType, new TermVisitor() {
+ public void visit(XSDParticle particle) {
+ // element declaration, or wildcard: add to list
+ XSDParticleContent content = particle.getContent();
+ if (content instanceof XSDElementDeclaration) {
+ XSDElementDeclaration decl = (XSDElementDeclaration) particle.getContent();
+
+ if (decl.isElementDeclarationReference())
+ decl = decl.getResolvedElementDeclaration();
+ // System.out.println("Adding "+decl.getName());
+ terms.add(decl);
+ } else if (content instanceof XSDWildcard) {
+ // System.out.println("Adding <xsd:any>");
+ terms.add((XSDWildcard) content);
+ }
+ }
+ });
+
+ return true;
+ }
+ };
+
+ TypeWalker walker = new TypeWalker(type);
+ walker.walk(visitor);
+
+ return terms;
+ }
+
+ /**
+ * Returns the value of the "minOccurs" attribute for the given XSD element.
+ *
+ * @param term - the XSD element
+ * @return numerical value of "minOccurs" or 1 if the element does not specify
+ */
+ public int getMinOccurs(XSDTerm term) {
+ String smin = term.getElement().getAttribute("minOccurs");
+ int min = 1;
+ if (smin!=null && !smin.isEmpty()) {
+ try {
+ min = Integer.parseInt(smin);
+ } catch (NumberFormatException e) {
+ }
+ }
+ return min;
+ }
+
+ /**
+ * Returns the value of the "maxOccurs" attribute for the given XSD element.
+ *
+ * @param term - the XSD element
+ * @return numerical value of "maxOccurs" or 1 if the element does not specify
+ */
+ public int getMaxOccurs(XSDTerm term) {
+ String smax = term.getElement().getAttribute("maxOccurs");
+ int max = 1;
+ if (smax!=null && !smax.isEmpty()) {
+ try {
+ max = Integer.parseInt(smax);
+ } catch (NumberFormatException e) {
+ if (smax.equalsIgnoreCase("unbounded"))
+ max = -1;
+ }
+ }
+ return max;
+ }
+
+ /**
+ * Returns true if the specified XSD element is optional.
+ *
+ * @param term
+ * @return true if the element has "minOccurs=0"
+ */
+ protected boolean isOptional(XSDTerm term) {
+
+ if (getMinOccurs(term)==0)
+ return true;
+ return false;
+ }
+
+ /**
+ * Examine the content of a complex type and visit each of its particles.
+ * This will expand <xsd:sequence>, <xsd:choice>, <xsd:all>, <xsd:group>
+ * and <xsd:any> elements.
+ *
+ * @param cType - the complex type to examine
+ * @param visitor - a TermVisitor which will be called for each particle found
+ */
+ private void visitTerms(XSDComplexTypeDefinition cType, TermVisitor visitor) {
+
+ // simple types are leaf nodes
+ if (cType.getContent() == null || (cType.getContent() instanceof XSDSimpleTypeDefinition))
+ return;
+
+ // the last particle visited; used to detect <xsd:any> elements
+ XSDParticleContent lastVisited = null;
+
+ // use a queue to simulate the recursion
+ LinkedList<XSDParticle> queue = new LinkedList<XSDParticle>();
+ queue.addLast((XSDParticle) cType.getContent());
+
+ while (!queue.isEmpty()) {
+ XSDParticle particle = (XSDParticle) queue.removeFirst();
+
+ // analyze type of particle content
+ int pType = org.eclipse.xsd.util.XSDUtil.nodeType(particle.getElement());
+ if (pType == XSDConstants.ELEMENT_ELEMENT) {
+ lastVisited = particle.getContent();
+ visitor.visit(particle);
+ } else {
+ // model group
+ XSDModelGroup modelGroup = null;
+ switch (pType) {
+ case XSDConstants.GROUP_ELEMENT:
+ XSDModelGroupDefinition grpDef = (XSDModelGroupDefinition) particle.getContent();
+ if (grpDef.isModelGroupDefinitionReference())
+ grpDef = grpDef.getResolvedModelGroupDefinition();
+
+ modelGroup = grpDef.getModelGroup();
+ break;
+
+ case XSDConstants.CHOICE_ELEMENT:
+ case XSDConstants.ALL_ELEMENT:
+ case XSDConstants.SEQUENCE_ELEMENT:
+ modelGroup = (XSDModelGroup) particle.getContent();
+ break;
+
+ case XSDConstants.ANY_ELEMENT:
+ // see forum post at:
+ // http://www.eclipse.org/forums/index.php?t=msg&th=20437&start=0&S=52ae90dc...
+ //
+ // The XSDWildcard seems to be emitted in the case where an element has no type information;
+ // and it is also emitted in response to an actual xsd:any element appearing in the schema.
+ //
+ // In both cases, the XSDWildcard appears the same (surprisingly it refers to a DOM element
+ // from Xerces of xsd:any). there is confusion here between elements of type anyType, i..e.,
+ // <xsd:element name="x" type=xsd:anyType"/> verses element wildcards <xsd:any>. When matching
+ // element content using the DFA returned by XSDParticle, each element will match either an
+ // element declaration or a wildcard, which you can tell apart easily by whether you've matched
+ // an XSDElementDeclaration or an XSDWildcard.
+ if (lastVisited!=null) {
+ // found an <xsd:any> element - go visit it!
+ lastVisited = particle.getContent();
+ visitor.visit(particle);
+ }
+ break;
+
+ default:
+ // TODO: do we need to handle additional XSD node types?
+ break;
+ }
+
+ if (modelGroup != null) {
+ // enque all particles in the group
+ List<XSDParticle> particles = modelGroup.getParticles();
+ for (XSDParticle p : particles) {
+ queue.addLast(p);
+ }
+
+ lastVisited = null;
+ }
+ }
+ }
+ }
+
+ /**
+ * Returns a list of all attribute declarations declared in the type or any
+ * base type, of the specified element.
+ *
+ * @param element - the element
+ * @return a list of XSDAttributeDeclaration objects
+ */
+ public final List<XSDAttributeDeclaration> getAttributeDeclarations(XSDElementDeclaration element) {
+ final ArrayList<XSDAttributeDeclaration> attributes = new ArrayList<XSDAttributeDeclaration>();
+
+ // walk up the type hierarchy of the element to generate a list of atts
+ TypeWalker walker = new TypeWalker(element.getType());
+
+ TypeWalker.Visitor visitor = new TypeWalker.Visitor() {
+ public boolean visit(XSDTypeDefinition type) {
+
+ // simple types dont have attributes
+ if (type instanceof XSDSimpleTypeDefinition)
+ return true;
+
+ XSDComplexTypeDefinition cType = (XSDComplexTypeDefinition) type;
+
+ // get all the attribute content (groups,or uses) and add to list
+ List<XSDAttributeGroupContent> contents = cType.getAttributeContents();
+ for (XSDAttributeGroupContent content : contents) {
+ if (content instanceof XSDAttributeUse) {
+ // an attribute, add it to the list
+ XSDAttributeUse use = (XSDAttributeUse) content;
+ attributes.add(use.getAttributeDeclaration());
+ } else if (content instanceof XSDAttributeGroupDefinition) {
+ // attribute group, add all atts in group to list
+ XSDAttributeGroupDefinition attGrp = (XSDAttributeGroupDefinition) content;
+
+ if (attGrp.isAttributeGroupDefinitionReference()) {
+ attGrp = attGrp.getResolvedAttributeGroupDefinition();
+ }
+
+ List<XSDAttributeUse> uses = attGrp.getAttributeUses();
+ for (XSDAttributeUse use : uses) {
+ attributes.add(use.getAttributeDeclaration());
+ }
+ }
+ }
+
+ return true;
+ }
+ };
+
+ walker.walk(visitor);
+ return attributes;
+ }
+
+ /**
+ * Returns a list diagnostics of that may have been created
+ * during the comparison
+ *
+ * @return a list of XSDDiagnostic objects
+ */
+ public List<XSDDiagnostic> getDiagnostics() {
+ if (diagnostics==null) {
+ diagnostics = new ArrayList<XSDDiagnostic>();
+ }
+ return diagnostics;
+ }
+
+ /**
+ * Convenience method for formatting diagnostics as strings
+ *
+ * @param index - the index into the diagnostics array
+ * @return a nicely formatted string
+ */
+ public String getDiagnostic(int index) {
+ String msg = "";
+
+ if (diagnostics!=null && index>=0 && index<diagnostics.size()) {
+ XSDDiagnostic d = diagnostics.get(index);
+ String name1 = "";
+ String name2 = "";
+ String schema1 = "";
+ String schema2 = "";
+ XSDTerm comp1 = null;
+ XSDTerm comp2 = null;
+ EList<XSDConcreteComponent> components = d.getComponents();
+ if (components.size()>0 && components.get(0) instanceof XSDTerm)
+ comp1 = (XSDTerm)components.get(0);
+ if (components.size()>1 && components.get(1) instanceof XSDTerm)
+ comp2 = (XSDTerm)components.get(1);
+
+ if (comp1 instanceof XSDElementDeclaration) {
+ name1 = ((XSDElementDeclaration)comp1).getQName();
+ schema1 = comp1.eResource().getURI().toString();
+ }
+ else if (comp1 instanceof XSDWildcard) {
+ name1 = "<xsd:any>";
+ schema1 = comp1.eResource().getURI().toString();
+ }
+ if (comp2 instanceof XSDElementDeclaration) {
+ name2 = ((XSDElementDeclaration)comp2).getQName();
+ schema2 = comp2.eResource().getURI().toString();
+ }
+ else if (comp2 instanceof XSDWildcard) {
+ name2 = "<xsd:any>";
+ schema2 = comp2.eResource().getURI().toString();
+ }
+
+ if ( comp1!=null && comp2!=null ) {
+ msg = "Element <" + name1 + ">" +
+ " in " + schema1 +
+ " differs from <" + name2 + ">";
+ if (!schema1.equals(schema2))
+ msg += " in " + schema2;
+ msg += " - " + d.getMessage();
+ }
+ else {
+ msg =
+ "Schema " + d.getLocationURI() +
+ " - " + d.getMessage();
+ }
+ }
+ return msg;
+ }
+
+ /**
+ * Creates a new diagnostic and adds it to our list.
+ *
+ * @param severity - one of the XSDDiagnosticSeverity values (WARNING, ERROR, etc.)
+ * @param msg - a human-readable message to associate with the diagnostic
+ * @param comp1 - the "left" schema component
+ * @param comp2 - the "right" schema component
+ * @return a newly constructed XSDDiagnostic object
+ */
+ protected XSDDiagnostic addDiagnostic(int severity, String msg, XSDConcreteComponent comp1, XSDConcreteComponent comp2) {
+ XSDDiagnostic diag = XSDFactory.eINSTANCE.createXSDDiagnostic();
+ diag.setSeverity(XSDDiagnosticSeverity.get(severity));
+ diag.setMessage(msg);
+ diag.getComponents().add(comp1);
+ diag.getComponents().add(comp2);
+ getDiagnostics().add(diag);
+
+ return diag;
+ }
+
+ /**
+ * Convenience method for creating a WARNING diagnostic
+ *
+ * @param msg - a human-readable message to associate with the diagnostic
+ * @param comp1 - the "left" schema component
+ * @param comp2 - the "right" schema component
+ * @return a newly constructed XSDDiagnostic object
+ */
+ protected XSDDiagnostic addWarning(String msg, XSDConcreteComponent comp1, XSDConcreteComponent comp2) {
+ return addDiagnostic(XSDDiagnosticSeverity.WARNING, msg, comp1, comp2);
+ }
+
+ /**
+ * Convenience method for creating a WARNING diagnostic
+ *
+ * @param msg - a human-readable message to associate with the diagnostic
+ * @param comp1 - the "left" schema component
+ * @param comp2 - the "right" schema component
+ * @return a newly constructed XSDDiagnostic object
+ */
+ protected XSDDiagnostic addError(String msg, XSDConcreteComponent comp1, XSDConcreteComponent comp2) {
+ return addDiagnostic(XSDDiagnosticSeverity.ERROR, msg, comp1, comp2);
+ }
+
+ /**
+ * Debug message printer
+ *
+ * @param label - a text string to print to stderr
+ */
+ private void dump(String label) {
+
+ if (debug)
+ dump(label, null, null, 0);
+ }
+
+ /**
+ * Debug message printer
+ *
+ * @param label - text string
+ * @param term - an XSD element to dump
+ * @param type - and its type
+ * @param level - indent level
+ */
+ private void dump(String label, XSDTerm term, XSDTypeDefinition type, int level) {
+
+ if (debug) {
+ if (term != null && type != null) {
+ String indent = "";
+ for (int i = 0; i < level; ++i)
+ indent += " ";
+ if (term instanceof XSDElementDeclaration) {
+ XSDElementDeclaration decl = (XSDElementDeclaration) term;
+ if (type instanceof XSDSimpleTypeDefinition)
+ System.err.println(label + indent + "<" + decl.getName() + "> type=\""
+ + this.getTypeNameHierarchy(decl)+"\"");
+ else if (type instanceof XSDComplexTypeDefinition || type == null)
+ System.err.println(label + indent + "<" + decl.getName() + "\">");
+ else
+ System.err.println("dump: unknown XSD type: " + type.getClass().toString());
+ } else if (term instanceof XSDWildcard) {
+ System.err.println(label + indent + "<any/>");
+ } else
+ System.err.println("dump: unknown term: " + term.getClass().toString());
+ } else
+ System.err.println(label);
+ }
+ }
+
+ /**
+ * Simple visitor interface for complex types
+ */
+ private interface TermVisitor {
+ void visit(XSDParticle particle);
+ }
+
+ /**
+ * XSD type hierarchy walker that visits each XSD type from the bottom-up
+ */
+ private static class TypeWalker {
+
+ // bottom of the type hierarchy
+ XSDTypeDefinition base;
+
+ public TypeWalker(XSDTypeDefinition base) {
+ this.base = base;
+ }
+
+ public void walk(Visitor visitor) {
+
+ XSDTypeDefinition type = base;
+
+ while(type != null) {
+ if (!visitor.visit(type))
+ break;
+ // walk up the type hierarchy to the top
+ if (type.equals(type.getBaseType()))
+ break;
+ type = type.getBaseType();
+ }
+ }
+
+ public interface Visitor {
+ boolean visit(XSDTypeDefinition type);
+ }
+ }
+}
Modified: trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/VariablePartAssignCategory.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/VariablePartAssignCategory.java 2010-10-29 15:01:47 UTC (rev 26143)
+++ trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/VariablePartAssignCategory.java 2010-10-29 15:44:15 UTC (rev 26144)
@@ -10,13 +10,10 @@
*******************************************************************************/
package org.eclipse.bpel.ui.properties;
-import java.io.ByteArrayOutputStream;
-import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.Collections;
import javax.xml.namespace.QName;
-import javax.xml.parsers.DocumentBuilderFactory;
import org.eclipse.bpel.common.ui.details.IDetailsAreaConstants;
import org.eclipse.bpel.common.ui.flatui.FlatFormAttachment;
@@ -31,6 +28,7 @@
import org.eclipse.bpel.model.messageproperties.Property;
import org.eclipse.bpel.model.util.BPELConstants;
import org.eclipse.bpel.model.util.BPELUtils;
+import org.eclipse.bpel.model.util.XSD2XMLGenerator;
import org.eclipse.bpel.ui.Messages;
import org.eclipse.bpel.ui.adapters.IVirtualCopyRuleSide;
import org.eclipse.bpel.ui.commands.InsertCopyCommand;
@@ -57,20 +55,10 @@
import org.eclipse.ui.PlatformUI;
import org.eclipse.wst.wsdl.Message;
import org.eclipse.wst.wsdl.Part;
-import org.eclipse.wst.xml.core.internal.contentmodel.CMDocument;
-import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration;
-import org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap;
-import org.eclipse.wst.xml.core.internal.contentmodel.ContentModelManager;
-import org.eclipse.wst.xml.core.internal.contentmodel.util.DOMContentBuilderImpl;
-import org.eclipse.wst.xml.core.internal.contentmodel.util.DOMNamespaceInfoManager;
-import org.eclipse.wst.xml.core.internal.contentmodel.util.DOMWriter;
-import org.eclipse.wst.xml.core.internal.contentmodel.util.NamespaceInfo;
-import org.eclipse.wst.xml.ui.internal.wizards.NewXMLGenerator;
import org.eclipse.xsd.XSDAttributeDeclaration;
import org.eclipse.xsd.XSDElementDeclaration;
import org.eclipse.xsd.XSDNamedComponent;
import org.eclipse.xsd.XSDTypeDefinition;
-import org.w3c.dom.Document;
/**
* An AssignCategory presenting a tree from which the user can select any of: -
@@ -578,16 +566,17 @@
return;
}
- MyNewXMLGenerator generator = new MyNewXMLGenerator();
- generator.setRootElementName(rootElement);
+ // https://jira.jboss.org/browse/JBIDE-7351
+ // use the new and improved XSD -> XML generator
+ // this was an internal class that was moved to org.eclipse.bpel.model.util
+ XSD2XMLGenerator generator = new XSD2XMLGenerator(uriWSDL, rootElement);
- CMDocument cmdoc = ContentModelManager.getInstance().createCMDocument(
- uriWSDL, "xsd");
- generator.setCMDocument(cmdoc);
- generator.createNamespaceInfoList();
+ // be sure to tell the generator which elements in a "choice" we are interested in
+ if (side.getQuery()!=null && side.getQuery().getValue().trim().length()>0)
+ generator.setQueryPath(side.getQuery().getValue());
try {
- String literal = generator.createXML("tmp");
+ String literal = generator.createXML();
Copy copy = BPELFactory.eINSTANCE.createCopy();
Assign a = (Assign) ((To) side.getCopyRuleSide()).getContainer()
.getContainer();
@@ -710,72 +699,4 @@
}
}
-
- class MyNewXMLGenerator extends NewXMLGenerator {
-
- public String createXML(String xmlFileName) throws Exception {
- CMDocument cmDocument = getCMDocument();
-
- // create the xml model
- CMNamedNodeMap nameNodeMap = cmDocument.getElements();
- CMElementDeclaration cmElementDeclaration = (CMElementDeclaration) nameNodeMap
- .getNamedItem(getRootElementName());
-
- Document xmlDocument = DocumentBuilderFactory.newInstance()
- .newDocumentBuilder().newDocument();
- MyDOMContentBuilderImpl contentBuilder = new MyDOMContentBuilderImpl(
- xmlDocument);
-
- contentBuilder.setBuildPolicy(contentBuilder.BUILD_OPTIONAL_ELEMENTS);
- contentBuilder.createDefaultRootContent(cmDocument,
- cmElementDeclaration, namespaceInfoList);
-
- ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
- OutputStreamWriter outputStreamWriter = new OutputStreamWriter(
- outputStream);
-
- DOMWriter domWriter = new DOMWriter(outputStreamWriter);
-
- // TODO... instead of relying on file extensions, we need to keep
- // track of the grammar type
- // better yet we should reate an SSE document so that we can format
- // it
- // nicely before saving
- // then we won't need the DOMWriter at all
- //
- domWriter.print(xmlDocument);
- outputStream.flush();
- outputStream.close();
-
- return outputStream.toString();
- }
-
- }
-
- class MyDOMContentBuilderImpl extends DOMContentBuilderImpl {
-
- public MyDOMContentBuilderImpl(Document document) {
- super(document);
- }
-
- @Override
- public void createDefaultRootContent(CMDocument cmDocument,
- CMElementDeclaration rootCMElementDeclaration) throws Exception {
- if (namespaceInfoList != null) {
- DOMNamespaceInfoManager manager = new DOMNamespaceInfoManager();
- String name = rootCMElementDeclaration.getNodeName();
- if (namespaceInfoList.size() > 0) {
- NamespaceInfo info = (NamespaceInfo) namespaceInfoList
- .get(0);
- if (info.prefix != null && info.prefix.length() > 0) {
- name = info.prefix + ":" + name; //$NON-NLS-1$
- }
- }
- rootElement = createElement(rootCMElementDeclaration, name,
- document);
- manager.addNamespaceInfo(rootElement, namespaceInfoList, true);
- }
- createDefaultContent(document, rootCMElementDeclaration);
- }
- }
}
Modified: trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/EmfModelQuery.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/EmfModelQuery.java 2010-10-29 15:01:47 UTC (rev 26143)
+++ trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/EmfModelQuery.java 2010-10-29 15:44:15 UTC (rev 26144)
@@ -24,8 +24,10 @@
import org.eclipse.bpel.model.partnerlinktype.Role;
import org.eclipse.bpel.model.util.ImportResolver;
import org.eclipse.bpel.model.util.ImportResolverRegistry;
+import org.eclipse.bpel.model.util.XSDComparer;
import org.eclipse.bpel.model.util.WSDLUtil;
import org.eclipse.bpel.model.util.XSDUtil;
+import org.eclipse.bpel.validator.factory.AdapterFactory;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
@@ -43,7 +45,6 @@
import org.eclipse.xsd.XSDSchema;
import org.eclipse.xsd.XSDSimpleTypeDefinition;
import org.eclipse.xsd.XSDTypeDefinition;
-import org.eclipse.xsd.impl.XSDNamedComponentImpl;
/**
*
@@ -60,7 +61,22 @@
public class EmfModelQuery {
static final String CONTEXT_MSG = "The EMF context object object cannot be null";
+
+ // https://jira.jboss.org/browse/JBIDE-7351
+ // we need an instance of this so we can get diagnostics for error reporting
+ XSDComparer xsdComparer;
+
+ public EmfModelQuery() {
+ xsdComparer = new XSDComparer();
+ // if debug mode is set in the builder, force XSD comparison
+ xsdComparer.setDebug(AdapterFactory.DEBUG);
+ }
+
+ public XSDComparer getXSDComparer() {
+ return xsdComparer;
+ }
+
/**
* @param eObj
* @param qname
@@ -498,16 +514,20 @@
* @param dst
* @return true if compatible, false if not.
*/
-
- public static boolean compatiblePartnerActivityMessages (EObject src, EObject dst) {
+ // https://jira.jboss.org/browse/JBIDE-7351
+ // no longer static because of xsdComparer object
+ public boolean compatiblePartnerActivityMessages (EObject src, EObject dst) {
assertTrue(src != null, CONTEXT_MSG);
assertTrue(dst != null, CONTEXT_MSG);
// https://jira.jboss.org/browse/JBIDE-7116
// quick exit
- if (src==dst)
- return true;
+ // https://jira.jboss.org/browse/JBIDE-7351
+ // ...unless we're in debug mode!
+ if (AdapterFactory.DEBUG==false)
+ if (src==dst)
+ return true;
Message srcMsg = null;
Message dstMsg = null;
@@ -594,15 +614,17 @@
* @param dst the destination type
* @return if the types are compatible, false otherwise
*/
-
- public static boolean compatibleType(EObject src, EObject dst) {
+ // https://jira.jboss.org/browse/JBIDE-7351
+ // no longer static because of xsdComparer object
+ public boolean compatibleType(EObject src, EObject dst) {
assertTrue(src != null, CONTEXT_MSG);
assertTrue(dst != null, CONTEXT_MSG);
// https://jira.jboss.org/browse/JBIDE-7116
// quick exit
- if (src==dst)
- return true;
+ if (AdapterFactory.DEBUG==false)
+ if (src==dst)
+ return true;
Message srcMsg = null;
Message dstMsg = null;
@@ -649,9 +671,15 @@
if (srcType != null && dstType != null) {
//https://jira.jboss.org/browse/JBIDE-7116
- if (compatibleType(srcType, dstType)) {
+ // https://jira.jboss.org/browse/JBIDE-7351
+ // use XSDComparer
+ if (xsdComparer.compare(srcType,dstType)) {
return true;
}
+
+ // construct a new comparer to prevent the original
+ // diagnostics from being cleared
+ XSDComparer comp = new XSDComparer();
// check if src is derived from dst.
// 1) src is NCName, dst is string --> compatible.
@@ -660,11 +688,11 @@
do {
// System.out.println("Checking: " + dstType + " against baseType: " + baseType);
// https://jira.jboss.org/browse/JBIDE-7116
- if (compatibleType(dstType, baseType)) {
+ if (comp.compare(baseType,dstType)) {
return true;
}
baseType = baseType.getBaseType();
- } while ( !compatibleType(baseType,baseType.getBaseType()) );
+ } while (baseType!=baseType.getBaseType());
return false;
}
@@ -684,12 +712,15 @@
// https://jira.jboss.org/browse/JBIDE-7116
// new: compare contents of messages
- public static boolean compatibleType(Message src, Message dst) {
+ // https://jira.jboss.org/browse/JBIDE-7351
+ // no longer static because of xsdComparer object
+ public boolean compatibleType(Message src, Message dst) {
assertTrue(src != null, CONTEXT_MSG);
assertTrue(dst != null, CONTEXT_MSG);
- if (src==dst)
- return true;
+ if (AdapterFactory.DEBUG==false)
+ if (src==dst)
+ return true;
if (!src.getQName().equals(dst.getQName()))
return false;
@@ -717,39 +748,45 @@
// https://jira.jboss.org/browse/JBIDE-7116
// new: compare XSDElementDeclaractions
- public static boolean compatibleType(XSDElementDeclaration src, XSDElementDeclaration dst) {
+ // https://jira.jboss.org/browse/JBIDE-7351
+ // no longer static because of xsdComparer object
+ public boolean compatibleType(XSDElementDeclaration src, XSDElementDeclaration dst) {
assertTrue(src != null, CONTEXT_MSG);
assertTrue(dst != null, CONTEXT_MSG);
- if (src==dst)
- return true;
+ if (AdapterFactory.DEBUG==false)
+ if (src==dst)
+ return true;
- // TODO: currently just doing a rudimentary name-only compare
- // need to add XSD compare/diff when the eclipse MDT project builds one
- return XSDNamedComponentImpl.Comparator.getInstance().compare(src,dst) == 0;
+ return compatibleType(src.getTypeDefinition(),dst.getTypeDefinition());
}
// https://jira.jboss.org/browse/JBIDE-7116
// new: compare XSDTypeDefinitions
- public static boolean compatibleType(XSDTypeDefinition src, XSDTypeDefinition dst) {
+ // https://jira.jboss.org/browse/JBIDE-7351
+ // no longer static because of xsdComparer object
+ public boolean compatibleType(XSDTypeDefinition src, XSDTypeDefinition dst) {
assertTrue(src != null, CONTEXT_MSG);
assertTrue(dst != null, CONTEXT_MSG);
- if (src==dst)
- return true;
+ if (AdapterFactory.DEBUG==false)
+ if (src==dst)
+ return true;
- // rudimentary name-only compare
- return XSDNamedComponentImpl.Comparator.getInstance().compare(src,dst) == 0;
+ return xsdComparer.compare(src,dst);
}
// https://jira.jboss.org/browse/JBIDE-7116
// new: compare PortTypes
- public static boolean compatibleType(PortType src, PortType dst) {
+ // https://jira.jboss.org/browse/JBIDE-7351
+ // no longer static because of xsdComparer object
+ public boolean compatibleType(PortType src, PortType dst) {
assertTrue(src != null, CONTEXT_MSG);
assertTrue(dst != null, CONTEXT_MSG);
- if (src==dst)
- return true;
+ if (AdapterFactory.DEBUG==false)
+ if (src==dst)
+ return true;
// do portTypes have to be defined in the same WSDL?
// URI uri1 = src.eResource().getURI();
@@ -777,12 +814,15 @@
// https://jira.jboss.org/browse/JBIDE-7116
// new: compare Operations
- public static boolean compatibleType(Operation src, Operation dst) {
+ // https://jira.jboss.org/browse/JBIDE-7351
+ // no longer static because of xsdComparer object
+ public boolean compatibleType(Operation src, Operation dst) {
assertTrue(src != null, CONTEXT_MSG);
assertTrue(dst != null, CONTEXT_MSG);
- if (src==dst)
- return true;
+ if (AdapterFactory.DEBUG==false)
+ if (src==dst)
+ return true;
if (src.getName()==null || !src.getName().equals(dst.getName()))
return false;
Modified: trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/ModelQuery.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/ModelQuery.java 2010-10-29 15:01:47 UTC (rev 26143)
+++ trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/ModelQuery.java 2010-10-29 15:44:15 UTC (rev 26144)
@@ -25,7 +25,6 @@
import org.eclipse.bpel.validator.model.UndefinedNode;
import org.eclipse.bpel.validator.model.XNotImplemented;
import org.eclipse.core.runtime.IAdapterManager;
-import org.eclipse.core.runtime.Platform;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.wst.wsdl.WSDLElement;
@@ -47,6 +46,9 @@
* @author Michal Chmielewski (michal.chmielewski(a)oracle.com)
* @date Sep 21, 2006
*
+ * https://jira.jboss.org/browse/JBIDE-7351
+ * EMFModelQuery is no longer static because of XSDComparer object
+ * for fetching diagnostics of comparison
*/
@SuppressWarnings("nls")
@@ -137,20 +139,20 @@
case TEST_COMPATIBLE_PARTNER_ACTIVITY_MESSAGE:
// n1 is source
// n2 is destination
- return EmfModelQuery.compatiblePartnerActivityMessages (
+ return emfModelQuery.compatiblePartnerActivityMessages (
adapt(n1,EObject.class,ADAPT_HINT_NONE),
adapt(n2,EObject.class,ADAPT_HINT_NONE) );
case TEST_COMPATIBLE_TYPE :
// n1 is the source
// n2 is the destination
- return EmfModelQuery.compatibleType ( adapt(n1,EObject.class,ADAPT_HINT_NONE), adapt(n2,EObject.class,ADAPT_HINT_NONE));
+ return emfModelQuery.compatibleType ( adapt(n1,EObject.class,ADAPT_HINT_NONE), adapt(n2,EObject.class,ADAPT_HINT_NONE));
case TEST_IS_SIMPLE_TYPE :
if (n1 == null || n1.isResolved() == false) {
return false;
}
- return EmfModelQuery.isSimpleType ( adapt(n1,EObject.class,ADAPT_HINT_NONE) ) ;
+ return emfModelQuery.isSimpleType ( adapt(n1,EObject.class,ADAPT_HINT_NONE) ) ;
case TEST_RESOVLED :
if (n1 == null) {
@@ -276,7 +278,7 @@
case LOOKUP_NODE_IMPORT :
if (context.isResolved()) {
- eObj = EmfModelQuery.lookupImport(adapt(context,EObject.class,ADAPT_HINT_NONE), name );
+ eObj = emfModelQuery.lookupImport(adapt(context,EObject.class,ADAPT_HINT_NONE), name );
}
if (eObj == null) {
@@ -312,7 +314,7 @@
case LOOKUP_NODE_PARTNER_LINK_TYPE :
if ( context.isResolved() ) {
- eObj = EmfModelQuery.lookupPartnerLinkType ( adapt(context,EObject.class,ADAPT_HINT_NONE), qname );
+ eObj = emfModelQuery.lookupPartnerLinkType ( adapt(context,EObject.class,ADAPT_HINT_NONE), qname );
}
if (eObj == null) {
result = new UndefinedNode(IConstants.PLNK_ND_PARTNER_LINK_TYPE, IConstants.AT_NAME, qname.getLocalPart() );
@@ -321,7 +323,7 @@
case LOOKUP_NODE_ROLE :
if ( context.isResolved() ) {
- eObj = EmfModelQuery.lookupRole ( adapt(context,EObject.class,ADAPT_HINT_NONE), name ) ;
+ eObj = emfModelQuery.lookupRole ( adapt(context,EObject.class,ADAPT_HINT_NONE), name ) ;
}
if (eObj == null) {
result = new UndefinedNode(IConstants.PLNK_ND_PARTNER_LINK_TYPE, IConstants.AT_NAME, name );
@@ -330,7 +332,7 @@
case LOOKUP_NODE_OPERATION :
if ( context.isResolved()) {
- eObj = EmfModelQuery.lookupOperation ( adapt(context,EObject.class,ADAPT_HINT_NONE), name );
+ eObj = emfModelQuery.lookupOperation ( adapt(context,EObject.class,ADAPT_HINT_NONE), name );
}
if (eObj == null) {
result = new UndefinedNode ( IConstants.WSDL_ND_OPERATION, IConstants.AT_NAME, name );
@@ -339,7 +341,7 @@
case LOOKUP_NODE_PORT_TYPE :
if ( context.isResolved() ) {
- eObj = EmfModelQuery.lookupPortType ( adapt(context,EObject.class,ADAPT_HINT_NONE), qname) ;
+ eObj = emfModelQuery.lookupPortType ( adapt(context,EObject.class,ADAPT_HINT_NONE), qname) ;
}
if (eObj == null) {
result = new UndefinedNode ( IConstants.WSDL_ND_PORT_TYPE, IConstants.AT_NAME, qname.getLocalPart() );
@@ -348,7 +350,7 @@
case LOOKUP_NODE_MESSAGE_TYPE :
if ( context.isResolved() ) {
- eObj = EmfModelQuery.lookupMessage ( adapt(context,EObject.class,ADAPT_HINT_NONE), qname) ;
+ eObj = emfModelQuery.lookupMessage ( adapt(context,EObject.class,ADAPT_HINT_NONE), qname) ;
}
if (eObj == null) {
result = new UndefinedNode(IConstants.WSDL_ND_MESSAGE, IConstants.AT_NAME, qname.getLocalPart() );
@@ -356,11 +358,11 @@
break;
case LOOKUP_NODE_MESSAGE_PART :
- return adapt(EmfModelQuery.lookupMessagePart ( adapt(context,EObject.class,ADAPT_HINT_NONE), name),INode.class,ADAPT_HINT_NONE );
+ return adapt(emfModelQuery.lookupMessagePart ( adapt(context,EObject.class,ADAPT_HINT_NONE), name),INode.class,ADAPT_HINT_NONE );
case LOOKUP_NODE_XSD_ELEMENT :
if ( context.isResolved() ) {
- eObj = EmfModelQuery.lookupXSDElement ( adapt(context,EObject.class,ADAPT_HINT_NONE), qname);
+ eObj = emfModelQuery.lookupXSDElement ( adapt(context,EObject.class,ADAPT_HINT_NONE), qname);
}
if (eObj == null) {
result = new UndefinedNode(IConstants.AT_ELEMENT,IConstants.AT_NAME, qname.getLocalPart());
@@ -369,7 +371,7 @@
case LOOKUP_NODE_XSD_TYPE :
if (context.isResolved()) {
- eObj = EmfModelQuery.lookupXSDType ( adapt(context,EObject.class,ADAPT_HINT_NONE), qname);
+ eObj = emfModelQuery.lookupXSDType ( adapt(context,EObject.class,ADAPT_HINT_NONE), qname);
}
if (eObj == null) {
result = new UndefinedNode(IConstants.AT_TYPE,IConstants.AT_NAME, qname.getLocalPart());
@@ -378,7 +380,7 @@
case LOOKUP_NODE_PROPERTY :
if (context.isResolved()) {
- eObj = EmfModelQuery.lookupProperty ( adapt(context,EObject.class,ADAPT_HINT_NONE), qname );
+ eObj = emfModelQuery.lookupProperty ( adapt(context,EObject.class,ADAPT_HINT_NONE), qname );
}
if (eObj == null) {
result = new UndefinedNode(IConstants.VPROP_ND_PROPERTY, IConstants.AT_NAME, qname.getLocalPart());
@@ -387,7 +389,7 @@
case LOOKUP_NODE_NAME_STEP :
if (context.isResolved()) {
- eObj = EmfModelQuery.lookupNameStep( adapt(context,EObject.class,ADAPT_HINT_NONE), qname, 0 );
+ eObj = emfModelQuery.lookupNameStep( adapt(context,EObject.class,ADAPT_HINT_NONE), qname, 0 );
}
if (eObj == null) {
result = new UndefinedNode(IConstants.AT_ELEMENT,IConstants.AT_NAME,qname.getLocalPart() );
@@ -396,7 +398,7 @@
case LOOKUP_NODE_NAME_STEP_ATTRIBUTE :
if (context.isResolved()) {
- eObj = EmfModelQuery.lookupNameStep( adapt(context,EObject.class,ADAPT_HINT_NONE), qname, 1 );
+ eObj = emfModelQuery.lookupNameStep( adapt(context,EObject.class,ADAPT_HINT_NONE), qname, 1 );
}
if (eObj == null) {
result = new UndefinedNode(IConstants.AT_ELEMENT,IConstants.AT_NAME,qname.getLocalPart() );
@@ -405,7 +407,7 @@
case LOOKUP_NODE_TYPE_OF_PART :
if (context.isResolved()) {
- eObj = EmfModelQuery.lookupTypeOfPart ( adapt(context,EObject.class,ADAPT_HINT_NONE), qname );
+ eObj = emfModelQuery.lookupTypeOfPart ( adapt(context,EObject.class,ADAPT_HINT_NONE), qname );
}
if (eObj == null) {
result = new UndefinedNode(IConstants.AT_ELEMENT,IConstants.AT_NAME,"Unknown");
Modified: trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/helpers/ModelQueryImpl.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/helpers/ModelQueryImpl.java 2010-10-29 15:01:47 UTC (rev 26143)
+++ trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/helpers/ModelQueryImpl.java 2010-10-29 15:44:15 UTC (rev 26144)
@@ -19,6 +19,7 @@
import javax.xml.namespace.QName;
+import org.eclipse.bpel.validator.EmfModelQuery;
import org.eclipse.bpel.validator.model.Filters;
import org.eclipse.bpel.validator.model.IConstants;
import org.eclipse.bpel.validator.model.IFilter;
@@ -62,17 +63,34 @@
static final protected Selector mSelector = new Selector();
+ /**
+ * https://jira.jboss.org/browse/JBIDE-7351
+ * Need an EmfModelQuery to contain the XSDComparer object so that
+ * we can grab diagnostics from it after a failed XSD compare (used
+ * for error reporting!)
+ */
+ protected EmfModelQuery emfModelQuery;
+
/**
* Protected constructor, just to initialize the basics the basics.
*
*/
public ModelQueryImpl () {
-
+ emfModelQuery = new EmfModelQuery();
}
-
+
/**
+ * Return error message from XSDComparer if assignments are incompatible
+ *
+ * https://jira.jboss.org/browse/JBIDE-7351
+ */
+ public String getDiagnostic(int index)
+ {
+ return emfModelQuery.getXSDComparer().getDiagnostic(index);
+ }
+ /**
* Return an answer that decides whether the model has support for
* the given aspects that the validator wants.
* @param item
Modified: trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/model/IModelQuery.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/model/IModelQuery.java 2010-10-29 15:01:47 UTC (rev 26143)
+++ trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/model/IModelQuery.java 2010-10-29 15:44:15 UTC (rev 26144)
@@ -23,8 +23,14 @@
public interface IModelQuery extends IModelQueryLookups {
-
/**
+ * Return error message from XSDComparer if assignments are incompatible
+ *
+ * https://jira.jboss.org/browse/JBIDE-7351
+ */
+ public String getDiagnostic(int index);
+
+ /**
* Answer the priority with which this implementation of ModelQuery ought to
* be called with.
*
Modified: trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/model/Validator.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/model/Validator.java 2010-10-29 15:01:47 UTC (rev 26143)
+++ trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/model/Validator.java 2010-10-29 15:44:15 UTC (rev 26144)
@@ -605,8 +605,9 @@
* @param node
* @return true if defined, false otherwise
*/
-
- protected boolean isDefined ( INode node ) {
+ // https://jira.jboss.org/browse/JBIDE-7351
+ // no longer static because of XSDComparer in EmfModelQuery
+ protected static boolean isDefined ( INode node ) {
return node != null && node.isResolved();
}
@@ -617,8 +618,9 @@
* @param node
* @return true of undefined, false if defined.
*/
-
- protected boolean isUndefined ( INode node ) {
+ // https://jira.jboss.org/browse/JBIDE-7351
+ // no longer static because of XSDComparer in EmfModelQuery
+ protected static boolean isUndefined ( INode node ) {
return node == null || node.isResolved() == false;
}
Modified: trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/rules/CValidator.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/rules/CValidator.java 2010-10-29 15:01:47 UTC (rev 26143)
+++ trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/rules/CValidator.java 2010-10-29 15:44:15 UTC (rev 26144)
@@ -341,16 +341,17 @@
} else if (bCompatible == false) {
-
+ // https://jira.jboss.org/browse/JBIDE-7351
+ // added diagnostic message for easier location of the incompatibility
problem = createError();
problem.fill("BPELC_COPY__INCOMPATIBLE",
toString(mNode.nodeName()),
"text.term.from",
fromTypeNode,
"text.term.to",
- toTypeNode
+ toTypeNode,
+ mModelQuery.getDiagnostic(0)
);
-
}
}
Modified: trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/rules/messages.properties
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/rules/messages.properties 2010-10-29 15:01:47 UTC (rev 26143)
+++ trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/rules/messages.properties 2010-10-29 15:44:15 UTC (rev 26144)
@@ -856,8 +856,10 @@
# {3}: RHS (from spec)
# {4}: its type
BPELC_COPY__INCOMPATIBLE.summary = Incompatible types of {1} and {3}.
+# https://jira.jboss.org/browse/JBIDE-7351
+# added {5} for diagnostics from XSDComparer
BPELC_COPY__INCOMPATIBLE = The {1} of "{2}" is not \
- compatible with {3} of "{4}"
+ compatible with {3} of "{4}" - {5}
BPELC_COPY__INCOMPATIBLE.fix = Types must be compatible.
#
# ---
14 years, 1 month
JBoss Tools SVN: r26143 - trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-10-29 11:01:47 -0400 (Fri, 29 Oct 2010)
New Revision: 26143
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/StopInstanceHandler.java
Log:
[JBIDE-7367] split into several methods for better readability
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/StopInstanceHandler.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/StopInstanceHandler.java 2010-10-29 14:51:12 UTC (rev 26142)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/StopInstanceHandler.java 2010-10-29 15:01:47 UTC (rev 26143)
@@ -49,18 +49,27 @@
private void stopInstance(CVInstanceElement cvInstance) {
if (cvInstance != null) {
DeltaCloudInstance instance = (DeltaCloudInstance) cvInstance.getElement();
- CloudViewElement element = cvInstance;
- while (!(element instanceof CVCloudElement))
- element = (CloudViewElement) element.getParent();
- CVCloudElement cvcloud = (CVCloudElement) element;
- DeltaCloud cloud = (DeltaCloud) cvcloud.getElement();
- PerformInstanceActionThread t = new PerformInstanceActionThread(cloud, instance,
- DeltaCloudInstance.STOP,
- CVMessages.getString(STOPPING_INSTANCE_TITLE),
- CVMessages.getFormattedString(STOPPING_INSTANCE_MSG, new String[] { instance.getName() }),
- DeltaCloudInstance.STOPPED);
- t.setUser(true);
- t.schedule();
+ DeltaCloud cloud = getCloud(cvInstance);
+ executeInstanceAction(instance, cloud);
}
}
+
+ private DeltaCloud getCloud(CloudViewElement element) {
+ while (!(element instanceof CVCloudElement)) {
+ element = (CloudViewElement) element.getParent();
+ }
+ CVCloudElement cvcloud = (CVCloudElement) element;
+ DeltaCloud cloud = (DeltaCloud) cvcloud.getElement();
+ return cloud;
+ }
+
+ private void executeInstanceAction(DeltaCloudInstance instance, DeltaCloud cloud) {
+ PerformInstanceActionThread t = new PerformInstanceActionThread(cloud, instance,
+ DeltaCloudInstance.STOP,
+ CVMessages.getString(STOPPING_INSTANCE_TITLE),
+ CVMessages.getFormattedString(STOPPING_INSTANCE_MSG, new String[] { instance.getName() }),
+ DeltaCloudInstance.STOPPED);
+ t.setUser(true);
+ t.schedule();
+ }
}
14 years, 1 month