Author: bbrodt
Date: 2011-03-15 14:39:52 -0400 (Tue, 15 Mar 2011)
New Revision: 29796
Modified:
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/EditMessagePropertyDialog.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/util/BPELEditModelClient.java
Log:
https://issues.jboss.org/browse/JBIDE-8075
Undo change from previous checkin for this JIRA - the artifacts WSDL was always being
created (at editor startup) instead of as needed (when adding the first CorrelationSet)
Modified:
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/EditMessagePropertyDialog.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/EditMessagePropertyDialog.java 2011-03-15
16:05:04 UTC (rev 29795)
+++
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/EditMessagePropertyDialog.java 2011-03-15
18:39:52 UTC (rev 29796)
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.bpel.ui.dialogs;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
@@ -22,6 +23,7 @@
import org.eclipse.bpel.ui.BPELEditor;
import org.eclipse.bpel.ui.IHelpContextIds;
import org.eclipse.bpel.ui.Messages;
+import org.eclipse.bpel.ui.commands.AddImportCommand;
import org.eclipse.bpel.ui.commands.util.AutoUndoCommand;
import org.eclipse.bpel.ui.details.providers.ColumnTableProvider;
import org.eclipse.bpel.ui.details.providers.ModelLabelProvider;
@@ -606,7 +608,8 @@
*/
protected void createProperty() {
URI uri = getTargetFileURI();
- Resource resource = bpelEditor.getResourceSet().getResource(uri, true);
+
+ final Resource resource = bpelEditor.getResourceSet().getResource(uri, true);
final Definition definition = (Definition) resource.getContents().get(0);
bpelEditor.getCommandFramework().execute(new AutoUndoCommand(definition) {
@@ -647,6 +650,23 @@
// TODO: what if it already had this prefix??
definition.addNamespace("xs", XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001);
//$NON-NLS-1$
}
+
+ //
https://issues.jboss.org/browse/JBIDE-8075
+ // create the artifacts resource if it doesn't already exist
+ if (!targetFile.exists()) {
+ // add the import if not already being imported by this process
+ AddImportCommand cmd = new AddImportCommand(bpelEditor.getProcess(), definition,
null);
+ if (cmd.canDoExecute() && cmd.wouldCreateDuplicateImport() == false) {
+ bpelEditor.getCommandStack().execute(cmd);
+ }
+ try {
+ resource.setModified(true);
+ resource.save(resource.getResourceSet().getLoadOptions());
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
}
});
}
Modified:
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/util/BPELEditModelClient.java
===================================================================
---
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/util/BPELEditModelClient.java 2011-03-15
16:05:04 UTC (rev 29795)
+++
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/util/BPELEditModelClient.java 2011-03-15
18:39:52 UTC (rev 29796)
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.bpel.ui.util;
-import java.io.IOException;
import java.util.Map;
import javax.xml.namespace.QName;
@@ -24,13 +23,12 @@
import org.eclipse.bpel.common.ui.editmodel.ResourceInfo;
import org.eclipse.bpel.model.Process;
import org.eclipse.bpel.ui.IBPELUIConstants;
-import org.eclipse.bpel.ui.commands.AddImportCommand;
import org.eclipse.core.resources.IFile;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IEditorPart;
+
import org.eclipse.wst.wsdl.Definition;
import org.eclipse.wst.wsdl.WSDLFactory;
@@ -99,7 +97,7 @@
if (artifactsFile.exists()) {
artifactsResourceInfo = bpelEditModel.getResourceInfo(artifactsFile);
} else {
- final Resource artifactsResource = bpelEditModel.getResourceSet().createResource(
+ Resource artifactsResource = bpelEditModel.getResourceSet().createResource(
URI.createPlatformResourceURI(artifactsFile.getFullPath().toString()));
// create an empty definition too.
Definition artifactsDefn = WSDLFactory.eINSTANCE.createDefinition();
@@ -107,9 +105,8 @@
// set the target namespace based on the target namespace of the process.
EList bpelContents = getPrimaryResourceInfo().getResource().getContents();
- Process process = null;
if (!bpelContents.isEmpty() && bpelContents.get(0) instanceof Process) {
- process = (Process)bpelContents.get(0);
+ Process process = (Process)bpelContents.get(0);
// TODO: is this correct? can we make a helper to share this with the wizard?
artifactsDefn.setTargetNamespace(process.getTargetNamespace()+"Artifacts");
//$NON-NLS-1$
artifactsDefn.setQName(new QName(artifactsDefn.getTargetNamespace(),
@@ -117,26 +114,6 @@
}
artifactsResource.getContents().add(artifactsDefn);
artifactsResourceInfo = bpelEditModel.getResourceInfo(artifactsFile);
-
- //
https://issues.jboss.org/browse/JBIDE-8075
- // add the import if not already being imported by this process
- AddImportCommand cmd = new AddImportCommand(process, artifactsDefn,
artifactsResourceInfo);
-
- if (cmd.canDoExecute() && cmd.wouldCreateDuplicateImport() == false) {
- getCommandStack().execute(cmd);
- }
- artifactsResource.setModified(true);
-
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- try {
- artifactsResource.save(artifactsResourceInfo.getLoadOptions());
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- });
}
}