JBoss Tools SVN: r18969 - in branches/jbosstools-3.1.0.RC1/smooks: plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration and 6 other directories.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2009-12-02 04:03:25 -0500 (Wed, 02 Dec 2009)
New Revision: 18969
Added:
branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/ISmooksEditorInitListener.java
branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksMessage.java
Removed:
branches/jbosstools-3.1.0.RC1/smooks/tests/org.jboss.tools.smooks.core.test/projects/smooks-all-config-files/smooks-config-files/db-extract-transform-load_edi-to-sax-order-mapping.xml
branches/jbosstools-3.1.0.RC1/smooks/tests/org.jboss.tools.smooks.core.test/projects/smooks-all-config-files/smooks-config-files/sj-testimonial_edi-mapping.xml
Modified:
branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/freemarker/FreemarkerPackage.java
branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/RuntimeMetadata.java
branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigurationOverviewPage.java
branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMultiFormEditor.java
branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java
branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/AbstractSmooksFormEditor.java
branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/ConnectionModelFactoryImpl.java
branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksProcessGraphicalEditor.java
branches/jbosstools-3.1.0.RC1/smooks/tests/org.jboss.tools.smooks.core.test/src/org/jboss/tools/smooks/test/openeditor/OpenAllSmooksConfigFileTestCase.java
Log:
JBIDE-5326
DONE
Modified: branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/freemarker/FreemarkerPackage.java
===================================================================
--- branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/freemarker/FreemarkerPackage.java 2009-12-02 07:57:07 UTC (rev 18968)
+++ branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/freemarker/FreemarkerPackage.java 2009-12-02 09:03:25 UTC (rev 18969)
@@ -58,7 +58,7 @@
* <!-- end-user-doc -->
* @generated
*/
- String eNS_PREFIX = "flt";
+ String eNS_PREFIX = "ftl";
/**
* The singleton instance of the package.
Modified: branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/RuntimeMetadata.java
===================================================================
--- branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/RuntimeMetadata.java 2009-12-02 07:57:07 UTC (rev 18968)
+++ branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/RuntimeMetadata.java 2009-12-02 09:03:25 UTC (rev 18969)
@@ -21,7 +21,9 @@
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileNotFoundException;
import java.io.IOException;
+import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
@@ -43,13 +45,13 @@
/**
* Smooks configuration runtime metadata.
* <p/>
- * Verifies the specified config is a Smooks configuration and extracts metadata from the
- * config e.g. input file, dependencies.
+ * Verifies the specified config is a Smooks configuration and extracts metadata
+ * from the config e.g. input file, dependencies.
*
* @author <a href="mailto:tom.fennelly@jboss.com">tom.fennelly(a)jboss.com</a>
*/
public class RuntimeMetadata {
-
+
private Smooks metadataExtractor;
private boolean isSmooksConfig;
private boolean isValidSmooksConfig;
@@ -61,13 +63,15 @@
public RuntimeMetadata() {
metadataExtractor = new Smooks();
- metadataExtractor.addVisitor(new SmooksConfigAsserter(), "/smooks-resource-list", "http://www.milyn.org/xsd/smooks-1.1.xsd");
- metadataExtractor.addVisitor(new InputParamExtractor(), "/smooks-resource-list/params/param", "http://www.milyn.org/xsd/smooks-1.1.xsd");
-
+ metadataExtractor.addVisitor(new SmooksConfigAsserter(), "/smooks-resource-list",
+ "http://www.milyn.org/xsd/smooks-1.1.xsd");
+ metadataExtractor.addVisitor(new InputParamExtractor(), "/smooks-resource-list/params/param",
+ "http://www.milyn.org/xsd/smooks-1.1.xsd");
+
// Build dependency map...
RuntimeDependency.addDependencyChecklist(metadataExtractor);
}
-
+
public boolean isSmooksConfig() {
return isSmooksConfig;
}
@@ -77,29 +81,30 @@
}
public String getErrorMessage() {
- if(isValidSmooksConfig) {
- throw new IllegalStateException("Invalid call to 'getErrorMessage()'. Smooks configuration is NOT invalid.");
+ if (isValidSmooksConfig) {
+ throw new IllegalStateException(
+ "Invalid call to 'getErrorMessage()'. Smooks configuration is NOT invalid.");
}
-
- if(configFile == null) {
+
+ if (configFile == null) {
return "Smooks configuration file not configured, or does not exist.";
- } else if(!configFile.exists()) {
+ } else if (!configFile.exists()) {
return "Specified Smooks configuration file not found.";
- } else if(!configFile.isFile()) {
- return "Specified Smooks configuration file is not a readable file.";
- } else if(!isSmooksConfig) {
- return "Specified Smooks configuration file is not a valid Smooks Configuration.";
- } else if(inputFile == null) {
- return "Specified Smooks configuration 'Input' task is not configured with a sample input file. Please configure the 'Input' task in the Process flow.";
- } else if(!inputFile.exists()) {
- return "Specified Smooks configuration 'Input' task is configured with a sample input file, but the file cannot be found. Please reconfigure the 'Input' task in the Process flow.";
- } else if(!inputFile.isFile()) {
- return "Specified Smooks configuration 'Input' task is configured with a sample input file, but the file cannot be read. Please reconfigure the 'Input' task in the Process flow.";
+ } else if (!configFile.isFile()) {
+ return "Specified Smooks configuration file is not a readable file.";
+ } else if (!isSmooksConfig) {
+ return "Specified Smooks configuration file is not a valid Smooks Configuration.";
+ } else if (inputFile == null) {
+ return "Specified Smooks configuration 'Input' task is not configured with a sample input file. Please configure the 'Input' task in the Process flow.";
+ } else if (!inputFile.exists()) {
+ return "Specified Smooks configuration 'Input' task is configured with a sample input file, but the file cannot be found. Please reconfigure the 'Input' task in the Process flow.";
+ } else if (!inputFile.isFile()) {
+ return "Specified Smooks configuration 'Input' task is configured with a sample input file, but the file cannot be read. Please reconfigure the 'Input' task in the Process flow.";
}
- return "";
+ return "";
}
-
+
public File getConfigFile() {
return configFile;
}
@@ -111,7 +116,7 @@
public File getInputFile() {
return inputFile;
}
-
+
public List<RuntimeDependency> getDependencies() {
return dependencies;
}
@@ -119,57 +124,57 @@
public Set<ProcessNodeType> getNodeTypes() {
return processNodeTypes;
}
-
+
public String getNodeTypesString() {
StringBuilder builder = new StringBuilder();
- for(ProcessNodeType nodeType : processNodeTypes) {
- if(builder.length() > 0) {
+ for (ProcessNodeType nodeType : processNodeTypes) {
+ if (builder.length() > 0) {
builder.append(',');
}
builder.append(nodeType.toString());
}
return builder.toString();
}
-
+
public void setSmooksConfig(IResource smooksConfig) {
reset();
-
- if(smooksConfig != null) {
+
+ if (smooksConfig != null) {
setSmooksConfig(new File(smooksConfig.getRawLocation().toOSString().trim()));
}
}
-
+
public void setSmooksConfig(File file) {
reset();
- if(file != null) {
+ if (file != null) {
configFile = file;
- if(configFile.exists() && configFile.isFile()) {
+ if (configFile.exists() && configFile.isFile()) {
ExecutionContext execContext = metadataExtractor.createExecutionContext();
Properties inputParams = new Properties();
-
+
try {
// Filter the config and capture the input params...
execContext.setAttribute(InputParamExtractor.class, inputParams);
execContext.setAttribute(RuntimeMetadata.class, this);
-
+
metadataExtractor.filterSource(execContext, new StreamSource(new FileInputStream(configFile)));
-
+
inputType = inputParams.getProperty(SmooksModelUtils.INPUT_TYPE);
- if(inputType != null) {
+ if (inputType != null) {
String inputPath = inputParams.getProperty(inputType);
- if(inputPath != null) {
+ if (inputPath != null) {
String resolvedFilePath;
try {
resolvedFilePath = SmooksUIUtils.parseFilePath(inputPath.trim());
- } catch(Exception e) {
+ } catch (Exception e) {
// It's not a valid config...
inputFile = new File(inputPath.trim());
return;
}
-
- inputFile = new File(resolvedFilePath);
- if(inputFile.exists() && inputFile.isFile()) {
+
+ inputFile = new File(resolvedFilePath);
+ if (inputFile.exists() && inputFile.isFile()) {
isValidSmooksConfig = true;
}
}
@@ -181,6 +186,54 @@
}
}
+ public void setSmooksConfig(File file, InputStream inputStream) {
+ reset();
+ if (file != null) {
+ configFile = file;
+ if (configFile.exists() && configFile.isFile()) {
+ if (inputStream == null) {
+ try {
+ inputStream = new FileInputStream(file);
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ }
+ }
+ ExecutionContext execContext = metadataExtractor.createExecutionContext();
+ Properties inputParams = new Properties();
+
+ try {
+ // Filter the config and capture the input params...
+ execContext.setAttribute(InputParamExtractor.class, inputParams);
+ execContext.setAttribute(RuntimeMetadata.class, this);
+
+ metadataExtractor.filterSource(execContext, new StreamSource(inputStream));
+
+ inputType = inputParams.getProperty(SmooksModelUtils.INPUT_TYPE);
+ if (inputType != null) {
+ String inputPath = inputParams.getProperty(inputType);
+ if (inputPath != null) {
+ String resolvedFilePath;
+ try {
+ resolvedFilePath = SmooksUIUtils.parseFilePath(inputPath.trim());
+ } catch (Exception e) {
+ // It's not a valid config...
+ inputFile = new File(inputPath.trim());
+ return;
+ }
+
+ inputFile = new File(resolvedFilePath);
+ if (inputFile.exists() && inputFile.isFile()) {
+ isValidSmooksConfig = true;
+ }
+ }
+ }
+ } catch (Exception e) {
+ // Not a valid Smooks config file
+ }
+ }
+ }
+ }
+
private void reset() {
isSmooksConfig = false;
isValidSmooksConfig = false;
@@ -190,8 +243,9 @@
processNodeTypes.clear();
}
- private static class SmooksConfigAsserter implements SAXVisitBefore {
- public void visitBefore(SAXElement paramElement, ExecutionContext execContext) throws SmooksException, IOException {
+ private static class SmooksConfigAsserter implements SAXVisitBefore {
+ public void visitBefore(SAXElement paramElement, ExecutionContext execContext) throws SmooksException,
+ IOException {
RuntimeMetadata metadata = (RuntimeMetadata) execContext.getAttribute(RuntimeMetadata.class);
metadata.isSmooksConfig = true;
}
@@ -199,22 +253,24 @@
private static class InputParamExtractor implements SAXVisitBefore, SAXVisitAfter {
- public void visitBefore(SAXElement paramElement, ExecutionContext execContext) throws SmooksException, IOException {
+ public void visitBefore(SAXElement paramElement, ExecutionContext execContext) throws SmooksException,
+ IOException {
paramElement.accumulateText();
}
- public void visitAfter(SAXElement paramElement, ExecutionContext execContext) throws SmooksException, IOException {
+ public void visitAfter(SAXElement paramElement, ExecutionContext execContext) throws SmooksException,
+ IOException {
Properties inputParams = (Properties) execContext.getAttribute(InputParamExtractor.class);
-
- if(inputParams != null) {
+
+ if (inputParams != null) {
String paramName = paramElement.getAttribute("name");
-
- if(paramName != null) {
- if(paramName.equals(SmooksModelUtils.INPUT_TYPE)) {
+
+ if (paramName != null) {
+ if (paramName.equals(SmooksModelUtils.INPUT_TYPE)) {
inputParams.setProperty(SmooksModelUtils.INPUT_TYPE, paramElement.getTextContent());
} else {
String paramType = paramElement.getAttribute("type");
- if(paramType != null && paramType.equals(SmooksModelUtils.INPUT_ACTIVE_TYPE)) {
+ if (paramType != null && paramType.equals(SmooksModelUtils.INPUT_ACTIVE_TYPE)) {
inputParams.setProperty(paramName, paramElement.getTextContent());
}
}
Modified: branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigurationOverviewPage.java
===================================================================
--- branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigurationOverviewPage.java 2009-12-02 07:57:07 UTC (rev 18968)
+++ branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigurationOverviewPage.java 2009-12-02 09:03:25 UTC (rev 18969)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.smooks.configuration.editors;
+import java.util.ArrayList;
import java.util.List;
import org.eclipse.emf.common.command.Command;
@@ -22,6 +23,7 @@
import org.eclipse.emf.edit.command.RemoveCommand;
import org.eclipse.emf.edit.command.SetCommand;
import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
@@ -36,6 +38,7 @@
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.forms.IFormColors;
import org.eclipse.ui.forms.IManagedForm;
+import org.eclipse.ui.forms.IMessage;
import org.eclipse.ui.forms.editor.FormEditor;
import org.eclipse.ui.forms.editor.FormPage;
import org.eclipse.ui.forms.widgets.FormToolkit;
@@ -47,6 +50,8 @@
import org.jboss.tools.smooks.configuration.validate.ISmooksModelValidateListener;
import org.jboss.tools.smooks.editor.ISmooksModelProvider;
import org.jboss.tools.smooks.editor.ISourceSynchronizeListener;
+import org.jboss.tools.smooks.graphical.editors.ISmooksEditorInitListener;
+import org.jboss.tools.smooks.graphical.editors.SmooksMessage;
import org.jboss.tools.smooks.model.smooks.DocumentRoot;
import org.jboss.tools.smooks.model.smooks.ParamType;
import org.jboss.tools.smooks.model.smooks.ParamsType;
@@ -59,8 +64,10 @@
*
*/
public class SmooksConfigurationOverviewPage extends FormPage implements ISmooksModelValidateListener,
- ISourceSynchronizeListener {
+ ISourceSynchronizeListener, ISmooksEditorInitListener {
+ private int currentMessageType = IMessageProvider.NONE;
+ private String currentMessage = null;
private ISmooksModelProvider smooksModelProvider;
private ModelPanelCreator defaultSettingPanelCreator;
private Section globalParamSection;
@@ -225,7 +232,8 @@
// pgl.numColumns = 2;
//
// createProfilesSection(profilesComposite, toolkit);
-
+
+ updateFormHeader();
}
private void createSettingSection(Composite settingComposite, FormToolkit toolkit) {
@@ -323,15 +331,15 @@
private void createGlobalParamterSection(Composite globalParamComposite, FormToolkit toolkit) {
if (smooksModelProvider != null) {
- toolkit.createLabel(globalParamComposite, Messages.SmooksConfigurationOverviewPage_FilterTypeLabel).setForeground(
- toolkit.getColors().getColor(IFormColors.TITLE));
+ toolkit.createLabel(globalParamComposite, Messages.SmooksConfigurationOverviewPage_FilterTypeLabel)
+ .setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
GridData gd = new GridData(SWT.FILL, SWT.NONE, true, false);
streamFilterTypeCombo = new Combo(globalParamComposite, SWT.DROP_DOWN | SWT.READ_ONLY);
streamFilterTypeCombo.setItems(new String[] { "SAX", "DOM" }); //$NON-NLS-1$ //$NON-NLS-2$
streamFilterTypeCombo.setLayoutData(gd);
- toolkit.createLabel(globalParamComposite, Messages.SmooksConfigurationOverviewPage_SerializationLabel).setForeground(
- toolkit.getColors().getColor(IFormColors.TITLE));
+ toolkit.createLabel(globalParamComposite, Messages.SmooksConfigurationOverviewPage_SerializationLabel)
+ .setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
gd = new GridData(SWT.FILL, SWT.NONE, true, false);
defaultSerializationOnCheckbox = toolkit.createButton(globalParamComposite, "", SWT.CHECK); //$NON-NLS-1$
defaultSerializationOnCheckbox.setLayoutData(gd);
@@ -599,6 +607,48 @@
return null;
}
+ public void initFailed(int messageType, String message) {
+ this.currentMessage = message;
+ this.currentMessageType = messageType;
+ updateFormHeader();
+ }
+
+ protected void updateFormHeader() {
+ if (currentMessageType == IMessageProvider.NONE) {
+ if (this.getManagedForm() != null) {
+ getManagedForm().getMessageManager().removeAllMessages();
+ getManagedForm().getMessageManager().update();
+
+ streamFilterTypeCombo.setEnabled(true);
+ defaultSerializationOnCheckbox.setEnabled(true);
+ }
+ } else {
+ if (this.getManagedForm() != null) {
+ streamFilterTypeCombo.setEnabled(false);
+ defaultSerializationOnCheckbox.setEnabled(false);
+ String[] messages = currentMessage.split("\n");
+ List<IMessage> messageList = new ArrayList<IMessage>();
+ for (int i = 0; i < messages.length; i++) {
+ String message = messages[i];
+ if (message != null)
+ message.trim();
+ if (message.length() == 0) {
+ continue;
+ }
+ messageList.add(new SmooksMessage(currentMessageType, message));
+ }
+ String mainMessage = null;
+ if (messageList.isEmpty()) {
+ mainMessage = currentMessage;
+ } else {
+ mainMessage = messageList.get(0).getMessage();
+ }
+ this.getManagedForm().getForm().getForm().setMessage(mainMessage, currentMessageType,
+ messageList.toArray(new IMessage[] {}));
+ }
+ }
+ }
+
/*
* The following code has been commented out for now. We may add more
* properties as they become necessary, but for now, this is just extraneous
Modified: branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMultiFormEditor.java
===================================================================
--- branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMultiFormEditor.java 2009-12-02 07:57:07 UTC (rev 18968)
+++ branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMultiFormEditor.java 2009-12-02 09:03:25 UTC (rev 18969)
@@ -75,6 +75,7 @@
optionsPage = createSmooksConfigurationOverviewPage();
addValidateListener(optionsPage);
addSourceSynchronizeListener(optionsPage);
+ addSmooksEditorInitListener(optionsPage);
try {
int index = this.addPage(optionsPage);
setPageText(index, Messages.SmooksMultiFormEditor_opetiontab_label);
@@ -101,6 +102,7 @@
processPage = new SmooksProcessGraphicalEditor(this, "process", Messages.SmooksMultiFormEditor_processpage_name, this); //$NON-NLS-1$
addSourceSynchronizeListener(processPage);
addValidateListener(processPage);
+ addSmooksEditorInitListener(processPage);
try {
int index = this.addPage(processPage);
setPageText(index, Messages.SmooksMultiFormEditor_processtabel_label);
Modified: branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java
===================================================================
--- branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java 2009-12-02 07:57:07 UTC (rev 18968)
+++ branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java 2009-12-02 09:03:25 UTC (rev 18969)
@@ -3005,7 +3005,6 @@
}
public static String judgeSmooksPlatformVersion(EObject smooksModel) {
-
if (smooksModel instanceof org.jboss.tools.smooks.model.smooks.DocumentRoot) {
EMap<String, String> nsMap = ((org.jboss.tools.smooks.model.smooks.DocumentRoot) smooksModel)
.getXMLNSPrefixMap();
@@ -3034,26 +3033,113 @@
params.getParam().add(param);
}
+ protected static String getSelectorValue(EObject model) {
+ if (getSelectorFeature(model) != null) {
+ EStructuralFeature feature = getSelectorFeature(model);
+ Object selectorValue = model.eGet(feature);
+ if (selectorValue != null)
+ return selectorValue.toString();
+ }
+ return null;
+ }
+
+ protected static boolean isJavaPatternSelector(String selector) {
+ if (selector.indexOf('.') != -1) {
+ String[] ss = selector.split("\\.");
+ for (int i = 0; i < ss.length; i++) {
+ String s = ss[i];
+ if (s != null) {
+ char[] chars = s.toCharArray();
+ for (int j = 0; j < chars.length; j++) {
+ char c = chars[j];
+ if (Character.isJavaIdentifierPart(c)) {
+
+ } else {
+ return false;
+ }
+ }
+ }
+ }
+ return true;
+ }
+ return false;
+ }
+
+ protected static void collectSelectorStrings(EObject model, List<String> selectors) {
+ EStructuralFeature feature = getSelectorFeature(model);
+ if (feature != null) {
+ String fullSelector = getSelectorValue(model);
+ if (fullSelector != null) {
+ selectors.add(fullSelector);
+ }
+ }
+ List<EObject> children = model.eContents();
+ for (Iterator<?> iterator = children.iterator(); iterator.hasNext();) {
+ EObject eObject = (EObject) iterator.next();
+ collectSelectorStrings(eObject, selectors);
+ }
+ }
+
+ protected static boolean isJavaPatternSelectorValue(EObject model) {
+ List<String> selectorList = new ArrayList<String>();
+ collectSelectorStrings(model, selectorList);
+ for (Iterator<?> iterator = selectorList.iterator(); iterator.hasNext();) {
+ String fullSelector = (String) iterator.next();
+ String[] selectors = null;
+
+ // '/' is selector seperator
+ if (fullSelector.indexOf("/") != -1) {
+ selectors = fullSelector.split("/");
+ } else {
+ // ' ' is selector seperator too
+ if (fullSelector.indexOf(" ") != -1) {
+ selectors = fullSelector.split(" ");
+ }
+ }
+ if (selectors != null) {
+ for (int k = 0; k < selectors.length; k++) {
+ String selector = selectors[k];
+ if (selector != null)
+ selector = selector.trim();
+ if (selector.length() == 0)
+ continue;
+ if (isJavaPatternSelector(selector)) {
+ return true;
+ }
+ }
+ } else {
+ if (isJavaPatternSelector(fullSelector)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
public static String judgeInputType(EObject smooksModel) {
- String inputType = null;
+ String inputType = SmooksModelUtils.INPUT_TYPE_XML;
if (smooksModel instanceof org.jboss.tools.smooks.model.smooks.DocumentRoot) {
SmooksResourceListType rlist = ((org.jboss.tools.smooks.model.smooks.DocumentRoot) smooksModel)
.getSmooksResourceList();
- if (rlist.getAbstractReader().isEmpty())
- return null;
- AbstractReader reader = rlist.getAbstractReader().get(0);
- if (CsvReader.class.isInstance(reader) || CSV12Reader.class.isInstance(reader)) {
- inputType = SmooksModelUtils.INPUT_TYPE_CSV;
+ if (rlist.getAbstractReader().isEmpty()) {
+ if (isJavaPatternSelectorValue(rlist)) {
+ inputType = SmooksModelUtils.INPUT_TYPE_JAVA;
+ }
+ } else {
+ AbstractReader reader = rlist.getAbstractReader().get(0);
+ if (CsvReader.class.isInstance(reader) || CSV12Reader.class.isInstance(reader)) {
+ inputType = SmooksModelUtils.INPUT_TYPE_CSV;
+ }
+ if (EDIReader.class.isInstance(reader) || EDI12Reader.class.isInstance(reader)) {
+ inputType = SmooksModelUtils.INPUT_TYPE_EDI_1_1;
+ }
+ if (JsonReader.class.isInstance(reader) || Json12Reader.class.isInstance(reader)) {
+ inputType = SmooksModelUtils.INPUT_TYPE_JSON_1_1;
+ }
+ if (ReaderType.class.isInstance(reader)) {
+ inputType = SmooksModelUtils.INPUT_TYPE_CUSTOME;
+ }
}
- if (EDIReader.class.isInstance(reader) || EDI12Reader.class.isInstance(reader)) {
- inputType = SmooksModelUtils.INPUT_TYPE_EDI_1_1;
- }
- if (JsonReader.class.isInstance(reader) || Json12Reader.class.isInstance(reader)) {
- inputType = SmooksModelUtils.INPUT_TYPE_JSON_1_1;
- }
- if (ReaderType.class.isInstance(reader)) {
- inputType = SmooksModelUtils.INPUT_TYPE_CUSTOME;
- }
}
return inputType;
}
Modified: branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/AbstractSmooksFormEditor.java
===================================================================
--- branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/AbstractSmooksFormEditor.java 2009-12-02 07:57:07 UTC (rev 18968)
+++ branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/AbstractSmooksFormEditor.java 2009-12-02 09:03:25 UTC (rev 18969)
@@ -47,6 +47,7 @@
import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;
import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory;
+import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.jface.text.DocumentEvent;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IDocumentListener;
@@ -69,6 +70,7 @@
import org.jboss.tools.smooks.configuration.validate.ISmooksModelValidateListener;
import org.jboss.tools.smooks.configuration.validate.SmooksMarkerHelper;
import org.jboss.tools.smooks.configuration.validate.SmooksModelValidator;
+import org.jboss.tools.smooks.graphical.editors.ISmooksEditorInitListener;
import org.jboss.tools.smooks.model.calc.provider.CalcItemProviderAdapterFactory;
import org.jboss.tools.smooks.model.common.AbstractAnyType;
import org.jboss.tools.smooks.model.common.provider.CommonItemProviderAdapterFactory;
@@ -106,6 +108,8 @@
protected String platformVersion = SmooksConstants.VERSION_1_2;
+ protected List<ISmooksEditorInitListener> smooksInitListener = new ArrayList<ISmooksEditorInitListener>();
+
protected String inputType = null;
protected List<ISourceSynchronizeListener> sourceSynchronizeListener = new ArrayList<ISourceSynchronizeListener>();
@@ -173,6 +177,14 @@
this.platformVersion = platformVersion;
}
+ public void addSmooksEditorInitListener(ISmooksEditorInitListener listener) {
+ this.smooksInitListener.add(listener);
+ }
+
+ public void removeSmooksEditorInitListener(ISmooksEditorInitListener listener) {
+ this.smooksInitListener.remove(listener);
+ }
+
@Override
public Object getAdapter(Class adapter) {
if (adapter == ISmooksModelProvider.class)
@@ -426,15 +438,6 @@
*/
@Override
protected void addPages() {
- // configurationPage = createSmooksConfigurationFormPage();
- // addValidateListener(configurationPage);
- // try {
- // int index = this.addPage(configurationPage);
- // setPageText(index, "Design");
- // } catch (PartInitException e) {
- // e.printStackTrace();
- // }
-
textEditor = createTextEditor();
try {
int index = this.addPage(textEditor, getEditorInput());
@@ -442,6 +445,14 @@
} catch (PartInitException e) {
e.printStackTrace();
}
+
+ Exception exception = checkSmooksConfigContents(null);
+ if (exception != null) {
+ for (Iterator<?> iterator = this.smooksInitListener.iterator(); iterator.hasNext();) {
+ ISmooksEditorInitListener initListener = (ISmooksEditorInitListener) iterator.next();
+ initListener.initFailed(IMessageProvider.WARNING, exception.getMessage());
+ }
+ }
}
protected StructuredTextEditor createTextEditor() {
@@ -500,16 +511,35 @@
IDocumentProvider dp = textEditor.getDocumentProvider();
if (dp == null)
return;
+ Exception exception = null;
+ int messageType = IMessageProvider.NONE;
IDocument document = dp.getDocument(textEditor.getEditorInput());
String conents = document.get();
Resource resource = editingDomain.getResourceSet().getResources().get(0);
resource.unload();
+ InputStream stream = null;
try {
- resource.load(new ByteArrayInputStream(conents.getBytes()), Collections.emptyMap());
+ stream = new ByteArrayInputStream(conents.getBytes());
+ resource.load(stream, Collections.emptyMap());
this.smooksModel = resource.getContents().get(0);
} catch (IOException e) {
smooksModel = null;
+ exception = e;
+ messageType = IMessageProvider.ERROR;
+ } finally {
+ if (stream != null) {
+ try {
+ stream.close();
+ } catch (IOException e) {
+ }
+ }
}
+ if (exception == null) {
+ stream = new ByteArrayInputStream(conents.getBytes());
+ exception = checkSmooksConfigContents(stream);
+ if (exception != null)
+ messageType = IMessageProvider.WARNING;
+ }
setPlatformVersion(SmooksUIUtils.judgeSmooksPlatformVersion(smooksModel));
judgeInputReader();
for (Iterator<?> iterator = this.sourceSynchronizeListener.iterator(); iterator.hasNext();) {
@@ -520,6 +550,14 @@
e.printStackTrace();
}
}
+ String message = null;
+ if (exception != null) {
+ message = exception.getMessage();
+ }
+ for (Iterator<?> iterator = this.smooksInitListener.iterator(); iterator.hasNext();) {
+ ISmooksEditorInitListener initListener = (ISmooksEditorInitListener) iterator.next();
+ initListener.initFailed(messageType, message);
+ }
}
protected void handleDocumentChange() {
@@ -614,7 +652,7 @@
String partName = "smooks editor";
IFile file = null;
RuntimeMetadata runtimeMetadata = new RuntimeMetadata();
-
+
if (input instanceof FileStoreEditorInput) {
try {
filePath = ((FileStoreEditorInput) input).getURI().toURL().getFile();
@@ -632,8 +670,6 @@
if (filePath == null)
throw new PartInitException("Can't get the input file");
-
- assertConfigSupported(runtimeMetadata);
Resource smooksResource = null;
@@ -669,14 +705,17 @@
private void assertConfigSupported(RuntimeMetadata runtimeMetadata) throws PartInitException {
List<RuntimeDependency> dependencies = runtimeMetadata.getDependencies();
-
- for(RuntimeDependency dependency : dependencies) {
- if(!dependency.isSupportedByEditor()) {
+
+ for (RuntimeDependency dependency : dependencies) {
+ if (!dependency.isSupportedByEditor()) {
java.net.URI changeToNS = dependency.getChangeToNS();
- String errorMsg = "\n\nSorry, this configuration is not yet supported by the Smooks Editor because it contains configurations from the '" + dependency.getNamespaceURI() + "' configuration namespace.\n\nPlease open this configuration using the XML Editor.";
-
- if(changeToNS != null) {
- errorMsg += "\n\nFix: Update the configuration to use the '" + changeToNS + "' configuration namespace.";
+ String errorMsg = "\n\nSorry, this configuration is not yet supported by the Smooks Editor because it contains configurations from the '"
+ + dependency.getNamespaceURI()
+ + "' configuration namespace.\n\nPlease open this configuration using the XML Editor.";
+
+ if (changeToNS != null) {
+ errorMsg += "\n\nFix: Update the configuration to use the '" + changeToNS
+ + "' configuration namespace.";
}
throw new PartInitException(errorMsg);
@@ -684,6 +723,41 @@
}
}
+ protected Exception checkSmooksConfigContents(InputStream stream) {
+ // Check
+ Exception exception = null;
+ IFile file = null;
+ String filePath = null;
+ RuntimeMetadata runtimeMetadata = new RuntimeMetadata();
+ IEditorInput input = getEditorInput();
+ if (input instanceof FileStoreEditorInput) {
+ try {
+ filePath = ((FileStoreEditorInput) input).getURI().toURL().getFile();
+ runtimeMetadata.setSmooksConfig(new File(filePath), stream);
+ } catch (MalformedURLException e) {
+ exception = e;
+ // throw new PartInitException("Transform URL to URL error.",
+ // e);
+ }
+ }
+ if (exception == null) {
+ if (input instanceof IFileEditorInput) {
+ file = ((IFileEditorInput) input).getFile();
+ File f = new File(file.getRawLocation().toOSString().trim());
+ runtimeMetadata.setSmooksConfig(f, stream);
+ }
+
+ try {
+
+ assertConfigSupported(runtimeMetadata);
+
+ } catch (PartInitException e) {
+ exception = e;
+ }
+ }
+ return exception;
+ }
+
protected void judgeInputReader() {
SmooksResourceListType resourceList = SmooksUIUtils.getSmooks11ResourceListType(smooksModel);
if (resourceList == null)
Modified: branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/ConnectionModelFactoryImpl.java
===================================================================
--- branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/ConnectionModelFactoryImpl.java 2009-12-02 07:57:07 UTC (rev 18968)
+++ branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/ConnectionModelFactoryImpl.java 2009-12-02 09:03:25 UTC (rev 18969)
@@ -108,6 +108,7 @@
if (beanid.equals(idRefData)) {
AbstractSmooksGraphicalModel sourceGraphModel = SmooksGraphUtil.findSmooksGraphModel(root,
eObject);
+ if(sourceGraphModel == null) continue;
List<TreeNodeConnection> scs = sourceGraphModel.getSourceConnections();
boolean createNewConnection = true;
for (Iterator<?> iterator2 = scs.iterator(); iterator2.hasNext();) {
Added: branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/ISmooksEditorInitListener.java
===================================================================
--- branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/ISmooksEditorInitListener.java (rev 0)
+++ branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/ISmooksEditorInitListener.java 2009-12-02 09:03:25 UTC (rev 18969)
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.smooks.graphical.editors;
+
+/**
+ * @author Dart
+ *
+ */
+public interface ISmooksEditorInitListener {
+ void initFailed(int messageType , String message);
+}
Property changes on: branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/ISmooksEditorInitListener.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksMessage.java
===================================================================
--- branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksMessage.java (rev 0)
+++ branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksMessage.java 2009-12-02 09:03:25 UTC (rev 18969)
@@ -0,0 +1,123 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.smooks.graphical.editors;
+
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.forms.IMessage;
+
+/**
+ * @author Dart
+ *
+ */
+public class SmooksMessage implements IMessage {
+
+ private int messageType;
+
+ private Control control;
+
+ private Object data;
+
+ private Object key;
+
+ private String prefix = "-";
+
+ private String message;
+
+ public SmooksMessage(int messageType , String message){
+ this.setMessage(message);
+ this.setMessageType(messageType);
+ }
+
+ /**
+ * @return the messageType
+ */
+ public int getMessageType() {
+ return messageType;
+ }
+
+ /**
+ * @param messageType the messageType to set
+ */
+ public void setMessageType(int messageType) {
+ this.messageType = messageType;
+ }
+
+ /**
+ * @return the control
+ */
+ public Control getControl() {
+ return control;
+ }
+
+ /**
+ * @param control the control to set
+ */
+ public void setControl(Control control) {
+ this.control = control;
+ }
+
+ /**
+ * @return the data
+ */
+ public Object getData() {
+ return data;
+ }
+
+ /**
+ * @param data the data to set
+ */
+ public void setData(Object data) {
+ this.data = data;
+ }
+
+ /**
+ * @return the key
+ */
+ public Object getKey() {
+ return key;
+ }
+
+ /**
+ * @param key the key to set
+ */
+ public void setKey(Object key) {
+ this.key = key;
+ }
+
+ /**
+ * @return the prefix
+ */
+ public String getPrefix() {
+ return prefix;
+ }
+
+ /**
+ * @param prefix the prefix to set
+ */
+ public void setPrefix(String prefix) {
+ this.prefix = prefix;
+ }
+
+ /**
+ * @return the message
+ */
+ public String getMessage() {
+ return message;
+ }
+
+ /**
+ * @param message the message to set
+ */
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+}
Property changes on: branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksMessage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksProcessGraphicalEditor.java
===================================================================
--- branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksProcessGraphicalEditor.java 2009-12-02 07:57:07 UTC (rev 18968)
+++ branches/jbosstools-3.1.0.RC1/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksProcessGraphicalEditor.java 2009-12-02 09:03:25 UTC (rev 18969)
@@ -37,6 +37,7 @@
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -55,6 +56,7 @@
import org.eclipse.ui.IPropertyListener;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.forms.IManagedForm;
+import org.eclipse.ui.forms.IMessage;
import org.eclipse.ui.forms.editor.FormEditor;
import org.eclipse.ui.forms.editor.FormPage;
import org.eclipse.ui.forms.widgets.FormToolkit;
@@ -68,6 +70,7 @@
import org.eclipse.zest.core.widgets.ZestStyles;
import org.eclipse.zest.layouts.LayoutStyles;
import org.eclipse.zest.layouts.algorithms.HorizontalTreeLayoutAlgorithm;
+import org.jboss.tools.smooks.configuration.editors.GraphicsConstants;
import org.jboss.tools.smooks.configuration.editors.SmooksReaderFormPage;
import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
import org.jboss.tools.smooks.configuration.validate.ISmooksModelValidateListener;
@@ -95,10 +98,14 @@
*/
public class SmooksProcessGraphicalEditor extends FormPage implements ISelectionChangedListener,
ISourceSynchronizeListener, IPropertyListener, ISmooksModelValidateListener, IProcessProvider,
- PropertyChangeListener {
-
+ PropertyChangeListener, ISmooksEditorInitListener {
+
+ private int currentMessageType = IMessageProvider.NONE;
+
+ private String currentMessage = null;
+
private boolean processChanged = false;
-
+
private boolean lockProcessChangeEvent = false;
private List<IAction> processPanelActions = new ArrayList<IAction>();
@@ -135,6 +142,7 @@
public SmooksProcessGraphicalEditor(String id, String title, ISmooksModelProvider provider) {
super(id, title);
this.smooksModelProvider = provider;
+ this.getManagedForm();
}
/**
@@ -518,6 +526,7 @@
public void createPartControl(Composite parent) {
// TODO Auto-generated method stub
super.createPartControl(parent);
+ updateHeaderFormMessage();
}
public GraphViewer getProcessGraphViewer() {
@@ -826,7 +835,7 @@
dirty = (((IEditorPart) object).isDirty() || dirty);
}
}
- return( dirty || processChanged);
+ return (dirty || processChanged);
}
/*
@@ -910,7 +919,8 @@
}
protected void showTaskControl(Object model) {
- if(pageBook == null) return;
+ if (pageBook == null)
+ return;
if (model == null)
pageBook.showEmptyPage();
FormToolkit toolkit = ((AbstractSmooksFormEditor) this.smooksModelProvider).getToolkit();
@@ -1126,7 +1136,8 @@
}
public void propertyChange(PropertyChangeEvent evt) {
- if(lockProcessChangeEvent) return;
+ if (lockProcessChangeEvent)
+ return;
String name = evt.getPropertyName();
Object newtask = evt.getNewValue();
if (ProcessType.PRO_ADD_CHILD.equals(name) || ProcessType.PRO_REMOVE_CHILD.equals(name)) {
@@ -1137,7 +1148,7 @@
processChanged = true;
getManagedForm().dirtyStateChanged();
}
-
+
if (ProcessType.PRO_ADD_CHILD.equals(name)) {
this.showTaskControl(newtask);
}
@@ -1145,4 +1156,52 @@
this.showTaskControl(null);
}
}
+
+ public void initFailed(int messageType, String message) {
+ this.currentMessage = message;
+ this.currentMessageType = messageType;
+ updateHeaderFormMessage();
+ }
+
+ protected void updateHeaderFormMessage() {
+ if (this.getManagedForm() != null) {
+ getManagedForm().getMessageManager().removeAllMessages();
+ getManagedForm().getMessageManager().update();
+ getProcessGraphViewer().getControl().setEnabled(true);
+ getProcessGraphViewer().getControl().setBackground(
+ getManagedForm().getToolkit().getColors().getBackground());
+ }
+ if (currentMessageType != IMessageProvider.NONE && currentMessage != null) {
+ if (this.getProcessGraphViewer() != null) {
+ getProcessGraphViewer().getControl().setBackground(GraphicsConstants.BORDER_CORLOR);
+ getProcessGraphViewer().getControl().setEnabled(false);
+ getProcessGraphViewer().setInput(new Object());
+ showTaskControl(null);
+ }
+ if (this.getManagedForm() != null) {
+
+ String[] messages = currentMessage.split("\n");
+ List<IMessage> messageList = new ArrayList<IMessage>();
+ for (int i = 0; i < messages.length; i++) {
+ String message = messages[i];
+ if (message != null)
+ message.trim();
+ if (message.length() == 0) {
+ continue;
+ }
+ messageList.add(new SmooksMessage(currentMessageType, message));
+ }
+ String mainMessage = null;
+ if (messageList.isEmpty()) {
+ mainMessage = currentMessage;
+ } else {
+ mainMessage = messageList.get(0).getMessage();
+ }
+
+ this.getManagedForm().getForm().getForm().setMessage(mainMessage, currentMessageType,
+ messageList.toArray(new IMessage[] {}));
+
+ }
+ }
+ }
}
Deleted: branches/jbosstools-3.1.0.RC1/smooks/tests/org.jboss.tools.smooks.core.test/projects/smooks-all-config-files/smooks-config-files/db-extract-transform-load_edi-to-sax-order-mapping.xml
===================================================================
--- branches/jbosstools-3.1.0.RC1/smooks/tests/org.jboss.tools.smooks.core.test/projects/smooks-all-config-files/smooks-config-files/db-extract-transform-load_edi-to-sax-order-mapping.xml 2009-12-02 07:57:07 UTC (rev 18968)
+++ branches/jbosstools-3.1.0.RC1/smooks/tests/org.jboss.tools.smooks.core.test/projects/smooks-all-config-files/smooks-config-files/db-extract-transform-load_edi-to-sax-order-mapping.xml 2009-12-02 09:03:25 UTC (rev 18969)
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<medi:edimap xmlns:medi="http://www.milyn.org/schema/edi-message-mapping-1.0.xsd">
-
- <medi:description name="DVD Order" version="1.0"/>
-
- <medi:delimiters segment=" " field="*" component="^" sub-component="~"/>
-
- <medi:segments xmltag="orders">
-
- <medi:segment segcode="MLS" xmltag="message-header">
- <medi:field xmltag="date"/>
- </medi:segment>
-
- <medi:segment segcode="HDR" xmltag="order" minOccurs="1" maxOccurs="-1">
- <medi:field xmltag="order-id"/>
- <medi:field xmltag="status-code"/>
- <medi:field xmltag="net-amount"/>
- <medi:field xmltag="total-amount"/>
- <medi:field xmltag="tax"/>
-
- <medi:segment segcode="CUS" xmltag="customer-details" minOccurs="1" maxOccurs="1">
- <medi:field xmltag="username"/>
- <medi:field xmltag="name">
- <medi:component xmltag="firstname"/>
- <medi:component xmltag="lastname"/>
- </medi:field>
- <medi:field xmltag="state"/>
- </medi:segment>
-
- <medi:segment segcode="ORD" xmltag="order-item" minOccurs="1" maxOccurs="-1">
- <medi:field xmltag="position"/>
- <medi:field xmltag="quantity"/>
- <medi:field xmltag="productId"/>
- <medi:field xmltag="title"/>
- <medi:field xmltag="price"/>
- </medi:segment>
-
- </medi:segment>
-
- </medi:segments>
-
-</medi:edimap>
\ No newline at end of file
Deleted: branches/jbosstools-3.1.0.RC1/smooks/tests/org.jboss.tools.smooks.core.test/projects/smooks-all-config-files/smooks-config-files/sj-testimonial_edi-mapping.xml
===================================================================
--- branches/jbosstools-3.1.0.RC1/smooks/tests/org.jboss.tools.smooks.core.test/projects/smooks-all-config-files/smooks-config-files/sj-testimonial_edi-mapping.xml 2009-12-02 07:57:07 UTC (rev 18968)
+++ branches/jbosstools-3.1.0.RC1/smooks/tests/org.jboss.tools.smooks.core.test/projects/smooks-all-config-files/smooks-config-files/sj-testimonial_edi-mapping.xml 2009-12-02 09:03:25 UTC (rev 18969)
@@ -1,63 +0,0 @@
-<medi:edimap xmlns:medi="http://www.milyn.org/schema/edi-message-mapping-1.0.xsd">
-
- <medi:description name="rollingstock_edi" version="1.0" />
-
- <medi:delimiters segment=" " field="," component="*" sub-component="-"/>
-
- <medi:segments xmltag="rollingstocks">
-
- <medi:segment segcode="Ta" xmltag="rollingstock" minOccurs="0" maxOccurs="-1">
- <medi:field xmltag="departureDate"/>
- <medi:field xmltag="departureTime"/>
- <medi:field xmltag="rollingstockId"/>
- <medi:field xmltag="departureSignature"/>
- <medi:field xmltag="destinationSignature"/>
- <medi:field xmltag="dayLimit"/>
-
- <medi:segment segcode="Tr" xmltag="route" minOccurs="0" maxOccurs="1">
- <medi:field xmltag="route"/>
- </medi:segment>
-
- <medi:segment segcode="Fo" xmltag="vehicle" minOccurs="0" maxOccurs="-1">
- <medi:field xmltag="litt"/>
- <medi:field xmltag="vehicleId"/>
- <medi:field xmltag="originalLitt"/>
- <medi:field xmltag="ticketId"/>
- <medi:field xmltag="vehicleType"/>
- <medi:field xmltag="weight"/>
- <medi:field xmltag="dynamicWeight"/>
- <medi:field xmltag="brakeWeight"/>
- <medi:field xmltag="length"/>
- <medi:field xmltag="nrOfAxles"/>
- <medi:field xmltag="speed"/>
- <medi:field xmltag="serviceType"/>
- <medi:field xmltag="canDoorsBeLocked"/>
- <medi:field xmltag="class1"/>
- <medi:field xmltag="class2"/>
- <medi:field xmltag="couchette"/>
- <medi:field xmltag="nrOfCompartments"/>
- <medi:field xmltag="nrOfPlacesPerCompartment"/>
- <medi:field xmltag="departureStation"/>
- <medi:field xmltag="departureDate"/>
- <medi:field xmltag="departureTime"/>
- <medi:field xmltag="destination"/>
-
-
- <medi:segment segcode="Fx" xmltag="comments" minOccurs="0" maxOccurs="1">
- <medi:field xmltag="comment"/>
- </medi:segment>
-
- <medi:segment segcode="Ft" xmltag="phoneNumber" minOccurs="0" maxOccurs="-1">
- <medi:field xmltag="litt"/>
- <medi:field xmltag="vehicleId"/>
- <medi:field xmltag="phoneNumber"/>
- <medi:field xmltag="function"/>
- <medi:field xmltag="location"/>
- </medi:segment>
- </medi:segment>
-
- </medi:segment>
-
- </medi:segments>
-
-</medi:edimap>
\ No newline at end of file
Modified: branches/jbosstools-3.1.0.RC1/smooks/tests/org.jboss.tools.smooks.core.test/src/org/jboss/tools/smooks/test/openeditor/OpenAllSmooksConfigFileTestCase.java
===================================================================
--- branches/jbosstools-3.1.0.RC1/smooks/tests/org.jboss.tools.smooks.core.test/src/org/jboss/tools/smooks/test/openeditor/OpenAllSmooksConfigFileTestCase.java 2009-12-02 07:57:07 UTC (rev 18968)
+++ branches/jbosstools-3.1.0.RC1/smooks/tests/org.jboss.tools.smooks.core.test/src/org/jboss/tools/smooks/test/openeditor/OpenAllSmooksConfigFileTestCase.java 2009-12-02 09:03:25 UTC (rev 18969)
@@ -25,7 +25,6 @@
import org.eclipse.ui.ide.IDE;
import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
import org.jboss.tools.smooks.editor.AbstractSmooksFormEditor;
-import org.jboss.tools.smooks.model.freemarker.Template;
/**
* @author Dart
15 years, 3 months
JBoss Tools SVN: r18968 - trunk/seam/plugins/org.jboss.tools.seam.core/templates/hibernatetools.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2009-12-02 02:57:07 -0500 (Wed, 02 Dec 2009)
New Revision: 18968
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/templates/hibernatetools/hibernate-console.launch
trunk/seam/plugins/org.jboss.tools.seam.core/templates/hibernatetools/hibernate-console_jpa.launch
Log:
https://jira.jboss.org/jira/browse/JBIDE-5328
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/templates/hibernatetools/hibernate-console.launch
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/templates/hibernatetools/hibernate-console.launch 2009-12-02 07:55:44 UTC (rev 18967)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/templates/hibernatetools/hibernate-console.launch 2009-12-02 07:57:07 UTC (rev 18968)
@@ -1,10 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Hibernate Console launch configuration -->
<launchConfiguration type="org.hibernate.eclipse.launch.ConsoleConfigurationLaunchConfigurationType">
-<stringAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS" value="\@projectName@">
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="4"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/@projectName@"/>
</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="4"/>
+</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="@projectName@"/>
<stringAttribute key="org.hibernate.eclipse.launch.CONFIGURATION_FACTORY" value="JPA"/>
<stringAttribute key="org.hibernate.eclipse.launch.CONNECTION_PROFILE_NAME" value="@connectionProfile@"/>
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/templates/hibernatetools/hibernate-console_jpa.launch
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/templates/hibernatetools/hibernate-console_jpa.launch 2009-12-02 07:55:44 UTC (rev 18967)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/templates/hibernatetools/hibernate-console_jpa.launch 2009-12-02 07:57:07 UTC (rev 18968)
@@ -1,10 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Hibernate Console launch configuration -->
<launchConfiguration type="org.hibernate.eclipse.launch.ConsoleConfigurationLaunchConfigurationType">
-<stringAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS" value="\@projectName@">
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="4"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/@projectName@"/>
</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="4"/>
+</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="@projectName@"/>
<stringAttribute key="org.hibernate.eclipse.launch.CONFIGURATION_FACTORY" value="JPA"/>
<stringAttribute key="org.hibernate.eclipse.launch.USE_JPA_PROJECT_PROFILE" value="true"/>
15 years, 3 months
JBoss Tools SVN: r18967 - in trunk/smooks: plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration and 6 other directories.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2009-12-02 02:55:44 -0500 (Wed, 02 Dec 2009)
New Revision: 18967
Added:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/ISmooksEditorInitListener.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksMessage.java
Removed:
trunk/smooks/tests/org.jboss.tools.smooks.core.test/projects/smooks-all-config-files/smooks-config-files/db-extract-transform-load_edi-to-sax-order-mapping.xml
trunk/smooks/tests/org.jboss.tools.smooks.core.test/projects/smooks-all-config-files/smooks-config-files/sj-testimonial_edi-mapping.xml
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/freemarker/FreemarkerPackage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/RuntimeMetadata.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigFileHandle.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigurationOverviewPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMultiFormEditor.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/AbstractSmooksFormEditor.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksProcessGraphicalEditor.java
trunk/smooks/tests/org.jboss.tools.smooks.core.test/src/org/jboss/tools/smooks/test/openeditor/OpenAllSmooksConfigFileTestCase.java
Log:
JBIDE-5326
Done
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/freemarker/FreemarkerPackage.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/freemarker/FreemarkerPackage.java 2009-12-02 07:41:35 UTC (rev 18966)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/freemarker/FreemarkerPackage.java 2009-12-02 07:55:44 UTC (rev 18967)
@@ -58,7 +58,7 @@
* <!-- end-user-doc -->
* @generated
*/
- String eNS_PREFIX = "flt";
+ String eNS_PREFIX = "ftl";
/**
* The singleton instance of the package.
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/RuntimeMetadata.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/RuntimeMetadata.java 2009-12-02 07:41:35 UTC (rev 18966)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/RuntimeMetadata.java 2009-12-02 07:55:44 UTC (rev 18967)
@@ -21,7 +21,9 @@
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileNotFoundException;
import java.io.IOException;
+import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
@@ -43,13 +45,13 @@
/**
* Smooks configuration runtime metadata.
* <p/>
- * Verifies the specified config is a Smooks configuration and extracts metadata from the
- * config e.g. input file, dependencies.
+ * Verifies the specified config is a Smooks configuration and extracts metadata
+ * from the config e.g. input file, dependencies.
*
* @author <a href="mailto:tom.fennelly@jboss.com">tom.fennelly(a)jboss.com</a>
*/
public class RuntimeMetadata {
-
+
private Smooks metadataExtractor;
private boolean isSmooksConfig;
private boolean isValidSmooksConfig;
@@ -61,13 +63,15 @@
public RuntimeMetadata() {
metadataExtractor = new Smooks();
- metadataExtractor.addVisitor(new SmooksConfigAsserter(), "/smooks-resource-list", "http://www.milyn.org/xsd/smooks-1.1.xsd");
- metadataExtractor.addVisitor(new InputParamExtractor(), "/smooks-resource-list/params/param", "http://www.milyn.org/xsd/smooks-1.1.xsd");
-
+ metadataExtractor.addVisitor(new SmooksConfigAsserter(), "/smooks-resource-list",
+ "http://www.milyn.org/xsd/smooks-1.1.xsd");
+ metadataExtractor.addVisitor(new InputParamExtractor(), "/smooks-resource-list/params/param",
+ "http://www.milyn.org/xsd/smooks-1.1.xsd");
+
// Build dependency map...
RuntimeDependency.addDependencyChecklist(metadataExtractor);
}
-
+
public boolean isSmooksConfig() {
return isSmooksConfig;
}
@@ -77,29 +81,30 @@
}
public String getErrorMessage() {
- if(isValidSmooksConfig) {
- throw new IllegalStateException("Invalid call to 'getErrorMessage()'. Smooks configuration is NOT invalid.");
+ if (isValidSmooksConfig) {
+ throw new IllegalStateException(
+ "Invalid call to 'getErrorMessage()'. Smooks configuration is NOT invalid.");
}
-
- if(configFile == null) {
+
+ if (configFile == null) {
return "Smooks configuration file not configured, or does not exist.";
- } else if(!configFile.exists()) {
+ } else if (!configFile.exists()) {
return "Specified Smooks configuration file not found.";
- } else if(!configFile.isFile()) {
- return "Specified Smooks configuration file is not a readable file.";
- } else if(!isSmooksConfig) {
- return "Specified Smooks configuration file is not a valid Smooks Configuration.";
- } else if(inputFile == null) {
- return "Specified Smooks configuration 'Input' task is not configured with a sample input file. Please configure the 'Input' task in the Process flow.";
- } else if(!inputFile.exists()) {
- return "Specified Smooks configuration 'Input' task is configured with a sample input file, but the file cannot be found. Please reconfigure the 'Input' task in the Process flow.";
- } else if(!inputFile.isFile()) {
- return "Specified Smooks configuration 'Input' task is configured with a sample input file, but the file cannot be read. Please reconfigure the 'Input' task in the Process flow.";
+ } else if (!configFile.isFile()) {
+ return "Specified Smooks configuration file is not a readable file.";
+ } else if (!isSmooksConfig) {
+ return "Specified Smooks configuration file is not a valid Smooks Configuration.";
+ } else if (inputFile == null) {
+ return "Specified Smooks configuration 'Input' task is not configured with a sample input file. Please configure the 'Input' task in the Process flow.";
+ } else if (!inputFile.exists()) {
+ return "Specified Smooks configuration 'Input' task is configured with a sample input file, but the file cannot be found. Please reconfigure the 'Input' task in the Process flow.";
+ } else if (!inputFile.isFile()) {
+ return "Specified Smooks configuration 'Input' task is configured with a sample input file, but the file cannot be read. Please reconfigure the 'Input' task in the Process flow.";
}
- return "";
+ return "";
}
-
+
public File getConfigFile() {
return configFile;
}
@@ -111,7 +116,7 @@
public File getInputFile() {
return inputFile;
}
-
+
public List<RuntimeDependency> getDependencies() {
return dependencies;
}
@@ -119,57 +124,57 @@
public Set<ProcessNodeType> getNodeTypes() {
return processNodeTypes;
}
-
+
public String getNodeTypesString() {
StringBuilder builder = new StringBuilder();
- for(ProcessNodeType nodeType : processNodeTypes) {
- if(builder.length() > 0) {
+ for (ProcessNodeType nodeType : processNodeTypes) {
+ if (builder.length() > 0) {
builder.append(',');
}
builder.append(nodeType.toString());
}
return builder.toString();
}
-
+
public void setSmooksConfig(IResource smooksConfig) {
reset();
-
- if(smooksConfig != null) {
+
+ if (smooksConfig != null) {
setSmooksConfig(new File(smooksConfig.getRawLocation().toOSString().trim()));
}
}
-
+
public void setSmooksConfig(File file) {
reset();
- if(file != null) {
+ if (file != null) {
configFile = file;
- if(configFile.exists() && configFile.isFile()) {
+ if (configFile.exists() && configFile.isFile()) {
ExecutionContext execContext = metadataExtractor.createExecutionContext();
Properties inputParams = new Properties();
-
+
try {
// Filter the config and capture the input params...
execContext.setAttribute(InputParamExtractor.class, inputParams);
execContext.setAttribute(RuntimeMetadata.class, this);
-
+
metadataExtractor.filterSource(execContext, new StreamSource(new FileInputStream(configFile)));
-
+
inputType = inputParams.getProperty(SmooksModelUtils.INPUT_TYPE);
- if(inputType != null) {
+ if (inputType != null) {
String inputPath = inputParams.getProperty(inputType);
- if(inputPath != null) {
+ if (inputPath != null) {
String resolvedFilePath;
try {
resolvedFilePath = SmooksUIUtils.parseFilePath(inputPath.trim());
- } catch(Exception e) {
+ } catch (Exception e) {
// It's not a valid config...
inputFile = new File(inputPath.trim());
return;
}
-
- inputFile = new File(resolvedFilePath);
- if(inputFile.exists() && inputFile.isFile()) {
+
+ inputFile = new File(resolvedFilePath);
+ if (inputFile.exists() && inputFile.isFile()) {
isValidSmooksConfig = true;
}
}
@@ -181,6 +186,54 @@
}
}
+ public void setSmooksConfig(File file, InputStream inputStream) {
+ reset();
+ if (file != null) {
+ configFile = file;
+ if (configFile.exists() && configFile.isFile()) {
+ if (inputStream == null) {
+ try {
+ inputStream = new FileInputStream(file);
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ }
+ }
+ ExecutionContext execContext = metadataExtractor.createExecutionContext();
+ Properties inputParams = new Properties();
+
+ try {
+ // Filter the config and capture the input params...
+ execContext.setAttribute(InputParamExtractor.class, inputParams);
+ execContext.setAttribute(RuntimeMetadata.class, this);
+
+ metadataExtractor.filterSource(execContext, new StreamSource(inputStream));
+
+ inputType = inputParams.getProperty(SmooksModelUtils.INPUT_TYPE);
+ if (inputType != null) {
+ String inputPath = inputParams.getProperty(inputType);
+ if (inputPath != null) {
+ String resolvedFilePath;
+ try {
+ resolvedFilePath = SmooksUIUtils.parseFilePath(inputPath.trim());
+ } catch (Exception e) {
+ // It's not a valid config...
+ inputFile = new File(inputPath.trim());
+ return;
+ }
+
+ inputFile = new File(resolvedFilePath);
+ if (inputFile.exists() && inputFile.isFile()) {
+ isValidSmooksConfig = true;
+ }
+ }
+ }
+ } catch (Exception e) {
+ // Not a valid Smooks config file
+ }
+ }
+ }
+ }
+
private void reset() {
isSmooksConfig = false;
isValidSmooksConfig = false;
@@ -190,8 +243,9 @@
processNodeTypes.clear();
}
- private static class SmooksConfigAsserter implements SAXVisitBefore {
- public void visitBefore(SAXElement paramElement, ExecutionContext execContext) throws SmooksException, IOException {
+ private static class SmooksConfigAsserter implements SAXVisitBefore {
+ public void visitBefore(SAXElement paramElement, ExecutionContext execContext) throws SmooksException,
+ IOException {
RuntimeMetadata metadata = (RuntimeMetadata) execContext.getAttribute(RuntimeMetadata.class);
metadata.isSmooksConfig = true;
}
@@ -199,22 +253,24 @@
private static class InputParamExtractor implements SAXVisitBefore, SAXVisitAfter {
- public void visitBefore(SAXElement paramElement, ExecutionContext execContext) throws SmooksException, IOException {
+ public void visitBefore(SAXElement paramElement, ExecutionContext execContext) throws SmooksException,
+ IOException {
paramElement.accumulateText();
}
- public void visitAfter(SAXElement paramElement, ExecutionContext execContext) throws SmooksException, IOException {
+ public void visitAfter(SAXElement paramElement, ExecutionContext execContext) throws SmooksException,
+ IOException {
Properties inputParams = (Properties) execContext.getAttribute(InputParamExtractor.class);
-
- if(inputParams != null) {
+
+ if (inputParams != null) {
String paramName = paramElement.getAttribute("name");
-
- if(paramName != null) {
- if(paramName.equals(SmooksModelUtils.INPUT_TYPE)) {
+
+ if (paramName != null) {
+ if (paramName.equals(SmooksModelUtils.INPUT_TYPE)) {
inputParams.setProperty(SmooksModelUtils.INPUT_TYPE, paramElement.getTextContent());
} else {
String paramType = paramElement.getAttribute("type");
- if(paramType != null && paramType.equals(SmooksModelUtils.INPUT_ACTIVE_TYPE)) {
+ if (paramType != null && paramType.equals(SmooksModelUtils.INPUT_ACTIVE_TYPE)) {
inputParams.setProperty(paramName, paramElement.getTextContent());
}
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigFileHandle.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigFileHandle.java 2009-12-02 07:41:35 UTC (rev 18966)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigFileHandle.java 2009-12-02 07:55:44 UTC (rev 18967)
@@ -28,7 +28,6 @@
import org.jboss.tools.smooks.model.javabean.JavabeanPackage;
import org.jboss.tools.smooks.model.jmsrouting.JmsroutingPackage;
import org.jboss.tools.smooks.model.json.JsonPackage;
-import org.jboss.tools.smooks.model.medi.MEdiPackage;
import org.jboss.tools.smooks.model.xsl.XslPackage;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
@@ -40,7 +39,7 @@
/**
* @author Dart dpeng(a)redhat.com
- *
+ *
*/
public class SmooksConfigFileHandle extends DefaultHandler {
private boolean correctContentFile = false;
@@ -50,29 +49,17 @@
private String[] smooksSpportURI = null;
private SAXParserFactory fFactory;
-
- public SmooksConfigFileHandle(){
+
+ public SmooksConfigFileHandle() {
super();
smooksSpportURI = createSupportURI();
}
-
- protected String[] createSupportURI(){
- return new String[]{
- org.jboss.tools.smooks.model.smooks.SmooksPackage.eNS_URI,
- EdiPackage.eNS_URI,
- XslPackage.eNS_URI,
- FreemarkerPackage.eNS_URI,
- GroovyPackage.eNS_URI,
- MEdiPackage.eNS_URI,
- CalcPackage.eNS_URI,
- CsvPackage.eNS_URI,
- DatasourcePackage.eNS_URI,
- FileRoutingPackage.eNS_URI,
- IoroutingPackage.eNS_URI,
- JavabeanPackage.eNS_URI,
- JmsroutingPackage.eNS_URI,
- JsonPackage.eNS_URI,
- };
+
+ protected String[] createSupportURI() {
+ return new String[] { org.jboss.tools.smooks.model.smooks.SmooksPackage.eNS_URI, EdiPackage.eNS_URI,
+ XslPackage.eNS_URI, FreemarkerPackage.eNS_URI, GroovyPackage.eNS_URI, CalcPackage.eNS_URI,
+ CsvPackage.eNS_URI, DatasourcePackage.eNS_URI, FileRoutingPackage.eNS_URI, IoroutingPackage.eNS_URI,
+ JavabeanPackage.eNS_URI, JmsroutingPackage.eNS_URI, JsonPackage.eNS_URI, };
}
private final SAXParser createParser(SAXParserFactory parserFactory) throws ParserConfigurationException,
@@ -117,13 +104,11 @@
}
/*
- * Resolve external entity definitions to an empty string. This is to
- * speed up processing of files with external DTDs. Not resolving the
- * contents of the DTD is ok, as only the System ID of the DTD
- * declaration is used.
+ * Resolve external entity definitions to an empty string. This is to speed
+ * up processing of files with external DTDs. Not resolving the contents of
+ * the DTD is ok, as only the System ID of the DTD declaration is used.
*
- * @see
- * org.xml.sax.helpers.DefaultHandler#resolveEntity(java.lang.String,
+ * @see org.xml.sax.helpers.DefaultHandler#resolveEntity(java.lang.String,
* java.lang.String)
*/
public InputSource resolveEntity(String publicId, String systemId) throws SAXException {
@@ -139,6 +124,13 @@
}
}
+ private boolean unSupportUIR(String uri) {
+ if (EdiPackage.eNS_URI.equals(uri)) {
+ return true;
+ }
+ return false;
+ }
+
private boolean containtSmooksURI(String uri) {
for (int i = 0; i < smooksSpportURI.length; i++) {
if (uri != null) {
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigurationOverviewPage.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigurationOverviewPage.java 2009-12-02 07:41:35 UTC (rev 18966)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksConfigurationOverviewPage.java 2009-12-02 07:55:44 UTC (rev 18967)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.smooks.configuration.editors;
+import java.util.ArrayList;
import java.util.List;
import org.eclipse.emf.common.command.Command;
@@ -22,6 +23,7 @@
import org.eclipse.emf.edit.command.RemoveCommand;
import org.eclipse.emf.edit.command.SetCommand;
import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
@@ -36,6 +38,7 @@
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.forms.IFormColors;
import org.eclipse.ui.forms.IManagedForm;
+import org.eclipse.ui.forms.IMessage;
import org.eclipse.ui.forms.editor.FormEditor;
import org.eclipse.ui.forms.editor.FormPage;
import org.eclipse.ui.forms.widgets.FormToolkit;
@@ -47,6 +50,8 @@
import org.jboss.tools.smooks.configuration.validate.ISmooksModelValidateListener;
import org.jboss.tools.smooks.editor.ISmooksModelProvider;
import org.jboss.tools.smooks.editor.ISourceSynchronizeListener;
+import org.jboss.tools.smooks.graphical.editors.ISmooksEditorInitListener;
+import org.jboss.tools.smooks.graphical.editors.SmooksMessage;
import org.jboss.tools.smooks.model.smooks.DocumentRoot;
import org.jboss.tools.smooks.model.smooks.ParamType;
import org.jboss.tools.smooks.model.smooks.ParamsType;
@@ -59,8 +64,10 @@
*
*/
public class SmooksConfigurationOverviewPage extends FormPage implements ISmooksModelValidateListener,
- ISourceSynchronizeListener {
+ ISourceSynchronizeListener, ISmooksEditorInitListener {
+ private int currentMessageType = IMessageProvider.NONE;
+ private String currentMessage = null;
private ISmooksModelProvider smooksModelProvider;
private ModelPanelCreator defaultSettingPanelCreator;
private Section globalParamSection;
@@ -225,7 +232,8 @@
// pgl.numColumns = 2;
//
// createProfilesSection(profilesComposite, toolkit);
-
+
+ updateFormHeader();
}
private void createSettingSection(Composite settingComposite, FormToolkit toolkit) {
@@ -323,15 +331,15 @@
private void createGlobalParamterSection(Composite globalParamComposite, FormToolkit toolkit) {
if (smooksModelProvider != null) {
- toolkit.createLabel(globalParamComposite, Messages.SmooksConfigurationOverviewPage_FilterTypeLabel).setForeground(
- toolkit.getColors().getColor(IFormColors.TITLE));
+ toolkit.createLabel(globalParamComposite, Messages.SmooksConfigurationOverviewPage_FilterTypeLabel)
+ .setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
GridData gd = new GridData(SWT.FILL, SWT.NONE, true, false);
streamFilterTypeCombo = new Combo(globalParamComposite, SWT.DROP_DOWN | SWT.READ_ONLY);
streamFilterTypeCombo.setItems(new String[] { "SAX", "DOM" }); //$NON-NLS-1$ //$NON-NLS-2$
streamFilterTypeCombo.setLayoutData(gd);
- toolkit.createLabel(globalParamComposite, Messages.SmooksConfigurationOverviewPage_SerializationLabel).setForeground(
- toolkit.getColors().getColor(IFormColors.TITLE));
+ toolkit.createLabel(globalParamComposite, Messages.SmooksConfigurationOverviewPage_SerializationLabel)
+ .setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
gd = new GridData(SWT.FILL, SWT.NONE, true, false);
defaultSerializationOnCheckbox = toolkit.createButton(globalParamComposite, "", SWT.CHECK); //$NON-NLS-1$
defaultSerializationOnCheckbox.setLayoutData(gd);
@@ -599,6 +607,48 @@
return null;
}
+ public void initFailed(int messageType, String message) {
+ this.currentMessage = message;
+ this.currentMessageType = messageType;
+ updateFormHeader();
+ }
+
+ protected void updateFormHeader() {
+ if (currentMessageType == IMessageProvider.NONE) {
+ if (this.getManagedForm() != null) {
+ getManagedForm().getMessageManager().removeAllMessages();
+ getManagedForm().getMessageManager().update();
+
+ streamFilterTypeCombo.setEnabled(true);
+ defaultSerializationOnCheckbox.setEnabled(true);
+ }
+ } else {
+ if (this.getManagedForm() != null) {
+ streamFilterTypeCombo.setEnabled(false);
+ defaultSerializationOnCheckbox.setEnabled(false);
+ String[] messages = currentMessage.split("\n");
+ List<IMessage> messageList = new ArrayList<IMessage>();
+ for (int i = 0; i < messages.length; i++) {
+ String message = messages[i];
+ if (message != null)
+ message.trim();
+ if (message.length() == 0) {
+ continue;
+ }
+ messageList.add(new SmooksMessage(currentMessageType, message));
+ }
+ String mainMessage = null;
+ if (messageList.isEmpty()) {
+ mainMessage = currentMessage;
+ } else {
+ mainMessage = messageList.get(0).getMessage();
+ }
+ this.getManagedForm().getForm().getForm().setMessage(mainMessage, currentMessageType,
+ messageList.toArray(new IMessage[] {}));
+ }
+ }
+ }
+
/*
* The following code has been commented out for now. We may add more
* properties as they become necessary, but for now, this is just extraneous
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMultiFormEditor.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMultiFormEditor.java 2009-12-02 07:41:35 UTC (rev 18966)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksMultiFormEditor.java 2009-12-02 07:55:44 UTC (rev 18967)
@@ -75,6 +75,7 @@
optionsPage = createSmooksConfigurationOverviewPage();
addValidateListener(optionsPage);
addSourceSynchronizeListener(optionsPage);
+ addSmooksEditorInitListener(optionsPage);
try {
int index = this.addPage(optionsPage);
setPageText(index, Messages.SmooksMultiFormEditor_opetiontab_label);
@@ -101,6 +102,7 @@
processPage = new SmooksProcessGraphicalEditor(this, "process", Messages.SmooksMultiFormEditor_processpage_name, this); //$NON-NLS-1$
addSourceSynchronizeListener(processPage);
addValidateListener(processPage);
+ addSmooksEditorInitListener(processPage);
try {
int index = this.addPage(processPage);
setPageText(index, Messages.SmooksMultiFormEditor_processtabel_label);
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java 2009-12-02 07:41:35 UTC (rev 18966)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java 2009-12-02 07:55:44 UTC (rev 18967)
@@ -3005,7 +3005,6 @@
}
public static String judgeSmooksPlatformVersion(EObject smooksModel) {
-
if (smooksModel instanceof org.jboss.tools.smooks.model.smooks.DocumentRoot) {
EMap<String, String> nsMap = ((org.jboss.tools.smooks.model.smooks.DocumentRoot) smooksModel)
.getXMLNSPrefixMap();
@@ -3034,26 +3033,113 @@
params.getParam().add(param);
}
+ protected static String getSelectorValue(EObject model) {
+ if (getSelectorFeature(model) != null) {
+ EStructuralFeature feature = getSelectorFeature(model);
+ Object selectorValue = model.eGet(feature);
+ if (selectorValue != null)
+ return selectorValue.toString();
+ }
+ return null;
+ }
+
+ protected static boolean isJavaPatternSelector(String selector) {
+ if (selector.indexOf('.') != -1) {
+ String[] ss = selector.split("\\.");
+ for (int i = 0; i < ss.length; i++) {
+ String s = ss[i];
+ if (s != null) {
+ char[] chars = s.toCharArray();
+ for (int j = 0; j < chars.length; j++) {
+ char c = chars[j];
+ if (Character.isJavaIdentifierPart(c)) {
+
+ } else {
+ return false;
+ }
+ }
+ }
+ }
+ return true;
+ }
+ return false;
+ }
+
+ protected static void collectSelectorStrings(EObject model, List<String> selectors) {
+ EStructuralFeature feature = getSelectorFeature(model);
+ if (feature != null) {
+ String fullSelector = getSelectorValue(model);
+ if (fullSelector != null) {
+ selectors.add(fullSelector);
+ }
+ }
+ List<EObject> children = model.eContents();
+ for (Iterator<?> iterator = children.iterator(); iterator.hasNext();) {
+ EObject eObject = (EObject) iterator.next();
+ collectSelectorStrings(eObject, selectors);
+ }
+ }
+
+ protected static boolean isJavaPatternSelectorValue(EObject model) {
+ List<String> selectorList = new ArrayList<String>();
+ collectSelectorStrings(model, selectorList);
+ for (Iterator<?> iterator = selectorList.iterator(); iterator.hasNext();) {
+ String fullSelector = (String) iterator.next();
+ String[] selectors = null;
+
+ // '/' is selector seperator
+ if (fullSelector.indexOf("/") != -1) {
+ selectors = fullSelector.split("/");
+ } else {
+ // ' ' is selector seperator too
+ if (fullSelector.indexOf(" ") != -1) {
+ selectors = fullSelector.split(" ");
+ }
+ }
+ if (selectors != null) {
+ for (int k = 0; k < selectors.length; k++) {
+ String selector = selectors[k];
+ if (selector != null)
+ selector = selector.trim();
+ if (selector.length() == 0)
+ continue;
+ if (isJavaPatternSelector(selector)) {
+ return true;
+ }
+ }
+ } else {
+ if (isJavaPatternSelector(fullSelector)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
public static String judgeInputType(EObject smooksModel) {
- String inputType = null;
+ String inputType = SmooksModelUtils.INPUT_TYPE_XML;
if (smooksModel instanceof org.jboss.tools.smooks.model.smooks.DocumentRoot) {
SmooksResourceListType rlist = ((org.jboss.tools.smooks.model.smooks.DocumentRoot) smooksModel)
.getSmooksResourceList();
- if (rlist.getAbstractReader().isEmpty())
- return null;
- AbstractReader reader = rlist.getAbstractReader().get(0);
- if (CsvReader.class.isInstance(reader) || CSV12Reader.class.isInstance(reader)) {
- inputType = SmooksModelUtils.INPUT_TYPE_CSV;
+ if (rlist.getAbstractReader().isEmpty()) {
+ if (isJavaPatternSelectorValue(rlist)) {
+ inputType = SmooksModelUtils.INPUT_TYPE_JAVA;
+ }
+ } else {
+ AbstractReader reader = rlist.getAbstractReader().get(0);
+ if (CsvReader.class.isInstance(reader) || CSV12Reader.class.isInstance(reader)) {
+ inputType = SmooksModelUtils.INPUT_TYPE_CSV;
+ }
+ if (EDIReader.class.isInstance(reader) || EDI12Reader.class.isInstance(reader)) {
+ inputType = SmooksModelUtils.INPUT_TYPE_EDI_1_1;
+ }
+ if (JsonReader.class.isInstance(reader) || Json12Reader.class.isInstance(reader)) {
+ inputType = SmooksModelUtils.INPUT_TYPE_JSON_1_1;
+ }
+ if (ReaderType.class.isInstance(reader)) {
+ inputType = SmooksModelUtils.INPUT_TYPE_CUSTOME;
+ }
}
- if (EDIReader.class.isInstance(reader) || EDI12Reader.class.isInstance(reader)) {
- inputType = SmooksModelUtils.INPUT_TYPE_EDI_1_1;
- }
- if (JsonReader.class.isInstance(reader) || Json12Reader.class.isInstance(reader)) {
- inputType = SmooksModelUtils.INPUT_TYPE_JSON_1_1;
- }
- if (ReaderType.class.isInstance(reader)) {
- inputType = SmooksModelUtils.INPUT_TYPE_CUSTOME;
- }
}
return inputType;
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/AbstractSmooksFormEditor.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/AbstractSmooksFormEditor.java 2009-12-02 07:41:35 UTC (rev 18966)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/AbstractSmooksFormEditor.java 2009-12-02 07:55:44 UTC (rev 18967)
@@ -47,6 +47,7 @@
import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;
import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory;
+import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.jface.text.DocumentEvent;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IDocumentListener;
@@ -69,6 +70,7 @@
import org.jboss.tools.smooks.configuration.validate.ISmooksModelValidateListener;
import org.jboss.tools.smooks.configuration.validate.SmooksMarkerHelper;
import org.jboss.tools.smooks.configuration.validate.SmooksModelValidator;
+import org.jboss.tools.smooks.graphical.editors.ISmooksEditorInitListener;
import org.jboss.tools.smooks.model.calc.provider.CalcItemProviderAdapterFactory;
import org.jboss.tools.smooks.model.common.AbstractAnyType;
import org.jboss.tools.smooks.model.common.provider.CommonItemProviderAdapterFactory;
@@ -106,6 +108,8 @@
protected String platformVersion = SmooksConstants.VERSION_1_2;
+ protected List<ISmooksEditorInitListener> smooksInitListener = new ArrayList<ISmooksEditorInitListener>();
+
protected String inputType = null;
protected List<ISourceSynchronizeListener> sourceSynchronizeListener = new ArrayList<ISourceSynchronizeListener>();
@@ -173,6 +177,14 @@
this.platformVersion = platformVersion;
}
+ public void addSmooksEditorInitListener(ISmooksEditorInitListener listener) {
+ this.smooksInitListener.add(listener);
+ }
+
+ public void removeSmooksEditorInitListener(ISmooksEditorInitListener listener) {
+ this.smooksInitListener.remove(listener);
+ }
+
@Override
public Object getAdapter(Class adapter) {
if (adapter == ISmooksModelProvider.class)
@@ -426,15 +438,6 @@
*/
@Override
protected void addPages() {
- // configurationPage = createSmooksConfigurationFormPage();
- // addValidateListener(configurationPage);
- // try {
- // int index = this.addPage(configurationPage);
- // setPageText(index, "Design");
- // } catch (PartInitException e) {
- // e.printStackTrace();
- // }
-
textEditor = createTextEditor();
try {
int index = this.addPage(textEditor, getEditorInput());
@@ -442,6 +445,14 @@
} catch (PartInitException e) {
e.printStackTrace();
}
+
+ Exception exception = checkSmooksConfigContents(null);
+ if (exception != null) {
+ for (Iterator<?> iterator = this.smooksInitListener.iterator(); iterator.hasNext();) {
+ ISmooksEditorInitListener initListener = (ISmooksEditorInitListener) iterator.next();
+ initListener.initFailed(IMessageProvider.WARNING, exception.getMessage());
+ }
+ }
}
protected StructuredTextEditor createTextEditor() {
@@ -500,16 +511,35 @@
IDocumentProvider dp = textEditor.getDocumentProvider();
if (dp == null)
return;
+ Exception exception = null;
+ int messageType = IMessageProvider.NONE;
IDocument document = dp.getDocument(textEditor.getEditorInput());
String conents = document.get();
Resource resource = editingDomain.getResourceSet().getResources().get(0);
resource.unload();
+ InputStream stream = null;
try {
- resource.load(new ByteArrayInputStream(conents.getBytes()), Collections.emptyMap());
+ stream = new ByteArrayInputStream(conents.getBytes());
+ resource.load(stream, Collections.emptyMap());
this.smooksModel = resource.getContents().get(0);
} catch (IOException e) {
smooksModel = null;
+ exception = e;
+ messageType = IMessageProvider.ERROR;
+ } finally {
+ if (stream != null) {
+ try {
+ stream.close();
+ } catch (IOException e) {
+ }
+ }
}
+ if (exception == null) {
+ stream = new ByteArrayInputStream(conents.getBytes());
+ exception = checkSmooksConfigContents(stream);
+ if (exception != null)
+ messageType = IMessageProvider.WARNING;
+ }
setPlatformVersion(SmooksUIUtils.judgeSmooksPlatformVersion(smooksModel));
judgeInputReader();
for (Iterator<?> iterator = this.sourceSynchronizeListener.iterator(); iterator.hasNext();) {
@@ -520,6 +550,14 @@
e.printStackTrace();
}
}
+ String message = null;
+ if (exception != null) {
+ message = exception.getMessage();
+ }
+ for (Iterator<?> iterator = this.smooksInitListener.iterator(); iterator.hasNext();) {
+ ISmooksEditorInitListener initListener = (ISmooksEditorInitListener) iterator.next();
+ initListener.initFailed(messageType, message);
+ }
}
protected void handleDocumentChange() {
@@ -614,7 +652,7 @@
String partName = "smooks editor";
IFile file = null;
RuntimeMetadata runtimeMetadata = new RuntimeMetadata();
-
+
if (input instanceof FileStoreEditorInput) {
try {
filePath = ((FileStoreEditorInput) input).getURI().toURL().getFile();
@@ -632,8 +670,6 @@
if (filePath == null)
throw new PartInitException("Can't get the input file");
-
- assertConfigSupported(runtimeMetadata);
Resource smooksResource = null;
@@ -669,14 +705,17 @@
private void assertConfigSupported(RuntimeMetadata runtimeMetadata) throws PartInitException {
List<RuntimeDependency> dependencies = runtimeMetadata.getDependencies();
-
- for(RuntimeDependency dependency : dependencies) {
- if(!dependency.isSupportedByEditor()) {
+
+ for (RuntimeDependency dependency : dependencies) {
+ if (!dependency.isSupportedByEditor()) {
java.net.URI changeToNS = dependency.getChangeToNS();
- String errorMsg = "\n\nSorry, this configuration is not yet supported by the Smooks Editor because it contains configurations from the '" + dependency.getNamespaceURI() + "' configuration namespace.\n\nPlease open this configuration using the XML Editor.";
-
- if(changeToNS != null) {
- errorMsg += "\n\nFix: Update the configuration to use the '" + changeToNS + "' configuration namespace.";
+ String errorMsg = "\n\nSorry, this configuration is not yet supported by the Smooks Editor because it contains configurations from the '"
+ + dependency.getNamespaceURI()
+ + "' configuration namespace.\n\nPlease open this configuration using the XML Editor.";
+
+ if (changeToNS != null) {
+ errorMsg += "\n\nFix: Update the configuration to use the '" + changeToNS
+ + "' configuration namespace.";
}
throw new PartInitException(errorMsg);
@@ -684,6 +723,41 @@
}
}
+ protected Exception checkSmooksConfigContents(InputStream stream) {
+ // Check
+ Exception exception = null;
+ IFile file = null;
+ String filePath = null;
+ RuntimeMetadata runtimeMetadata = new RuntimeMetadata();
+ IEditorInput input = getEditorInput();
+ if (input instanceof FileStoreEditorInput) {
+ try {
+ filePath = ((FileStoreEditorInput) input).getURI().toURL().getFile();
+ runtimeMetadata.setSmooksConfig(new File(filePath), stream);
+ } catch (MalformedURLException e) {
+ exception = e;
+ // throw new PartInitException("Transform URL to URL error.",
+ // e);
+ }
+ }
+ if (exception == null) {
+ if (input instanceof IFileEditorInput) {
+ file = ((IFileEditorInput) input).getFile();
+ File f = new File(file.getRawLocation().toOSString().trim());
+ runtimeMetadata.setSmooksConfig(f, stream);
+ }
+
+ try {
+
+ assertConfigSupported(runtimeMetadata);
+
+ } catch (PartInitException e) {
+ exception = e;
+ }
+ }
+ return exception;
+ }
+
protected void judgeInputReader() {
SmooksResourceListType resourceList = SmooksUIUtils.getSmooks11ResourceListType(smooksModel);
if (resourceList == null)
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/ISmooksEditorInitListener.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/ISmooksEditorInitListener.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/ISmooksEditorInitListener.java 2009-12-02 07:55:44 UTC (rev 18967)
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.smooks.graphical.editors;
+
+/**
+ * @author Dart
+ *
+ */
+public interface ISmooksEditorInitListener {
+ void initFailed(int messageType , String message);
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/ISmooksEditorInitListener.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksMessage.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksMessage.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksMessage.java 2009-12-02 07:55:44 UTC (rev 18967)
@@ -0,0 +1,123 @@
+/*******************************************************************************
+ * Copyright (c) 2008 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.smooks.graphical.editors;
+
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.forms.IMessage;
+
+/**
+ * @author Dart
+ *
+ */
+public class SmooksMessage implements IMessage {
+
+ private int messageType;
+
+ private Control control;
+
+ private Object data;
+
+ private Object key;
+
+ private String prefix = "-";
+
+ private String message;
+
+ public SmooksMessage(int messageType , String message){
+ this.setMessage(message);
+ this.setMessageType(messageType);
+ }
+
+ /**
+ * @return the messageType
+ */
+ public int getMessageType() {
+ return messageType;
+ }
+
+ /**
+ * @param messageType the messageType to set
+ */
+ public void setMessageType(int messageType) {
+ this.messageType = messageType;
+ }
+
+ /**
+ * @return the control
+ */
+ public Control getControl() {
+ return control;
+ }
+
+ /**
+ * @param control the control to set
+ */
+ public void setControl(Control control) {
+ this.control = control;
+ }
+
+ /**
+ * @return the data
+ */
+ public Object getData() {
+ return data;
+ }
+
+ /**
+ * @param data the data to set
+ */
+ public void setData(Object data) {
+ this.data = data;
+ }
+
+ /**
+ * @return the key
+ */
+ public Object getKey() {
+ return key;
+ }
+
+ /**
+ * @param key the key to set
+ */
+ public void setKey(Object key) {
+ this.key = key;
+ }
+
+ /**
+ * @return the prefix
+ */
+ public String getPrefix() {
+ return prefix;
+ }
+
+ /**
+ * @param prefix the prefix to set
+ */
+ public void setPrefix(String prefix) {
+ this.prefix = prefix;
+ }
+
+ /**
+ * @return the message
+ */
+ public String getMessage() {
+ return message;
+ }
+
+ /**
+ * @param message the message to set
+ */
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksMessage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksProcessGraphicalEditor.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksProcessGraphicalEditor.java 2009-12-02 07:41:35 UTC (rev 18966)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksProcessGraphicalEditor.java 2009-12-02 07:55:44 UTC (rev 18967)
@@ -37,6 +37,7 @@
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -55,6 +56,7 @@
import org.eclipse.ui.IPropertyListener;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.forms.IManagedForm;
+import org.eclipse.ui.forms.IMessage;
import org.eclipse.ui.forms.editor.FormEditor;
import org.eclipse.ui.forms.editor.FormPage;
import org.eclipse.ui.forms.widgets.FormToolkit;
@@ -68,6 +70,7 @@
import org.eclipse.zest.core.widgets.ZestStyles;
import org.eclipse.zest.layouts.LayoutStyles;
import org.eclipse.zest.layouts.algorithms.HorizontalTreeLayoutAlgorithm;
+import org.jboss.tools.smooks.configuration.editors.GraphicsConstants;
import org.jboss.tools.smooks.configuration.editors.SmooksReaderFormPage;
import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
import org.jboss.tools.smooks.configuration.validate.ISmooksModelValidateListener;
@@ -95,10 +98,14 @@
*/
public class SmooksProcessGraphicalEditor extends FormPage implements ISelectionChangedListener,
ISourceSynchronizeListener, IPropertyListener, ISmooksModelValidateListener, IProcessProvider,
- PropertyChangeListener {
-
+ PropertyChangeListener, ISmooksEditorInitListener {
+
+ private int currentMessageType = IMessageProvider.NONE;
+
+ private String currentMessage = null;
+
private boolean processChanged = false;
-
+
private boolean lockProcessChangeEvent = false;
private List<IAction> processPanelActions = new ArrayList<IAction>();
@@ -135,6 +142,7 @@
public SmooksProcessGraphicalEditor(String id, String title, ISmooksModelProvider provider) {
super(id, title);
this.smooksModelProvider = provider;
+ this.getManagedForm();
}
/**
@@ -518,6 +526,7 @@
public void createPartControl(Composite parent) {
// TODO Auto-generated method stub
super.createPartControl(parent);
+ updateHeaderFormMessage();
}
public GraphViewer getProcessGraphViewer() {
@@ -826,7 +835,7 @@
dirty = (((IEditorPart) object).isDirty() || dirty);
}
}
- return( dirty || processChanged);
+ return (dirty || processChanged);
}
/*
@@ -910,7 +919,8 @@
}
protected void showTaskControl(Object model) {
- if(pageBook == null) return;
+ if (pageBook == null)
+ return;
if (model == null)
pageBook.showEmptyPage();
FormToolkit toolkit = ((AbstractSmooksFormEditor) this.smooksModelProvider).getToolkit();
@@ -1126,7 +1136,8 @@
}
public void propertyChange(PropertyChangeEvent evt) {
- if(lockProcessChangeEvent) return;
+ if (lockProcessChangeEvent)
+ return;
String name = evt.getPropertyName();
Object newtask = evt.getNewValue();
if (ProcessType.PRO_ADD_CHILD.equals(name) || ProcessType.PRO_REMOVE_CHILD.equals(name)) {
@@ -1137,7 +1148,7 @@
processChanged = true;
getManagedForm().dirtyStateChanged();
}
-
+
if (ProcessType.PRO_ADD_CHILD.equals(name)) {
this.showTaskControl(newtask);
}
@@ -1145,4 +1156,52 @@
this.showTaskControl(null);
}
}
+
+ public void initFailed(int messageType, String message) {
+ this.currentMessage = message;
+ this.currentMessageType = messageType;
+ updateHeaderFormMessage();
+ }
+
+ protected void updateHeaderFormMessage() {
+ if (this.getManagedForm() != null) {
+ getManagedForm().getMessageManager().removeAllMessages();
+ getManagedForm().getMessageManager().update();
+ getProcessGraphViewer().getControl().setEnabled(true);
+ getProcessGraphViewer().getControl().setBackground(
+ getManagedForm().getToolkit().getColors().getBackground());
+ }
+ if (currentMessageType != IMessageProvider.NONE && currentMessage != null) {
+ if (this.getProcessGraphViewer() != null) {
+ getProcessGraphViewer().getControl().setBackground(GraphicsConstants.BORDER_CORLOR);
+ getProcessGraphViewer().getControl().setEnabled(false);
+ getProcessGraphViewer().setInput(new Object());
+ showTaskControl(null);
+ }
+ if (this.getManagedForm() != null) {
+
+ String[] messages = currentMessage.split("\n");
+ List<IMessage> messageList = new ArrayList<IMessage>();
+ for (int i = 0; i < messages.length; i++) {
+ String message = messages[i];
+ if (message != null)
+ message.trim();
+ if (message.length() == 0) {
+ continue;
+ }
+ messageList.add(new SmooksMessage(currentMessageType, message));
+ }
+ String mainMessage = null;
+ if (messageList.isEmpty()) {
+ mainMessage = currentMessage;
+ } else {
+ mainMessage = messageList.get(0).getMessage();
+ }
+
+ this.getManagedForm().getForm().getForm().setMessage(mainMessage, currentMessageType,
+ messageList.toArray(new IMessage[] {}));
+
+ }
+ }
+ }
}
Deleted: trunk/smooks/tests/org.jboss.tools.smooks.core.test/projects/smooks-all-config-files/smooks-config-files/db-extract-transform-load_edi-to-sax-order-mapping.xml
===================================================================
--- trunk/smooks/tests/org.jboss.tools.smooks.core.test/projects/smooks-all-config-files/smooks-config-files/db-extract-transform-load_edi-to-sax-order-mapping.xml 2009-12-02 07:41:35 UTC (rev 18966)
+++ trunk/smooks/tests/org.jboss.tools.smooks.core.test/projects/smooks-all-config-files/smooks-config-files/db-extract-transform-load_edi-to-sax-order-mapping.xml 2009-12-02 07:55:44 UTC (rev 18967)
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<medi:edimap xmlns:medi="http://www.milyn.org/schema/edi-message-mapping-1.0.xsd">
-
- <medi:description name="DVD Order" version="1.0"/>
-
- <medi:delimiters segment=" " field="*" component="^" sub-component="~"/>
-
- <medi:segments xmltag="orders">
-
- <medi:segment segcode="MLS" xmltag="message-header">
- <medi:field xmltag="date"/>
- </medi:segment>
-
- <medi:segment segcode="HDR" xmltag="order" minOccurs="1" maxOccurs="-1">
- <medi:field xmltag="order-id"/>
- <medi:field xmltag="status-code"/>
- <medi:field xmltag="net-amount"/>
- <medi:field xmltag="total-amount"/>
- <medi:field xmltag="tax"/>
-
- <medi:segment segcode="CUS" xmltag="customer-details" minOccurs="1" maxOccurs="1">
- <medi:field xmltag="username"/>
- <medi:field xmltag="name">
- <medi:component xmltag="firstname"/>
- <medi:component xmltag="lastname"/>
- </medi:field>
- <medi:field xmltag="state"/>
- </medi:segment>
-
- <medi:segment segcode="ORD" xmltag="order-item" minOccurs="1" maxOccurs="-1">
- <medi:field xmltag="position"/>
- <medi:field xmltag="quantity"/>
- <medi:field xmltag="productId"/>
- <medi:field xmltag="title"/>
- <medi:field xmltag="price"/>
- </medi:segment>
-
- </medi:segment>
-
- </medi:segments>
-
-</medi:edimap>
\ No newline at end of file
Deleted: trunk/smooks/tests/org.jboss.tools.smooks.core.test/projects/smooks-all-config-files/smooks-config-files/sj-testimonial_edi-mapping.xml
===================================================================
--- trunk/smooks/tests/org.jboss.tools.smooks.core.test/projects/smooks-all-config-files/smooks-config-files/sj-testimonial_edi-mapping.xml 2009-12-02 07:41:35 UTC (rev 18966)
+++ trunk/smooks/tests/org.jboss.tools.smooks.core.test/projects/smooks-all-config-files/smooks-config-files/sj-testimonial_edi-mapping.xml 2009-12-02 07:55:44 UTC (rev 18967)
@@ -1,63 +0,0 @@
-<medi:edimap xmlns:medi="http://www.milyn.org/schema/edi-message-mapping-1.0.xsd">
-
- <medi:description name="rollingstock_edi" version="1.0" />
-
- <medi:delimiters segment=" " field="," component="*" sub-component="-"/>
-
- <medi:segments xmltag="rollingstocks">
-
- <medi:segment segcode="Ta" xmltag="rollingstock" minOccurs="0" maxOccurs="-1">
- <medi:field xmltag="departureDate"/>
- <medi:field xmltag="departureTime"/>
- <medi:field xmltag="rollingstockId"/>
- <medi:field xmltag="departureSignature"/>
- <medi:field xmltag="destinationSignature"/>
- <medi:field xmltag="dayLimit"/>
-
- <medi:segment segcode="Tr" xmltag="route" minOccurs="0" maxOccurs="1">
- <medi:field xmltag="route"/>
- </medi:segment>
-
- <medi:segment segcode="Fo" xmltag="vehicle" minOccurs="0" maxOccurs="-1">
- <medi:field xmltag="litt"/>
- <medi:field xmltag="vehicleId"/>
- <medi:field xmltag="originalLitt"/>
- <medi:field xmltag="ticketId"/>
- <medi:field xmltag="vehicleType"/>
- <medi:field xmltag="weight"/>
- <medi:field xmltag="dynamicWeight"/>
- <medi:field xmltag="brakeWeight"/>
- <medi:field xmltag="length"/>
- <medi:field xmltag="nrOfAxles"/>
- <medi:field xmltag="speed"/>
- <medi:field xmltag="serviceType"/>
- <medi:field xmltag="canDoorsBeLocked"/>
- <medi:field xmltag="class1"/>
- <medi:field xmltag="class2"/>
- <medi:field xmltag="couchette"/>
- <medi:field xmltag="nrOfCompartments"/>
- <medi:field xmltag="nrOfPlacesPerCompartment"/>
- <medi:field xmltag="departureStation"/>
- <medi:field xmltag="departureDate"/>
- <medi:field xmltag="departureTime"/>
- <medi:field xmltag="destination"/>
-
-
- <medi:segment segcode="Fx" xmltag="comments" minOccurs="0" maxOccurs="1">
- <medi:field xmltag="comment"/>
- </medi:segment>
-
- <medi:segment segcode="Ft" xmltag="phoneNumber" minOccurs="0" maxOccurs="-1">
- <medi:field xmltag="litt"/>
- <medi:field xmltag="vehicleId"/>
- <medi:field xmltag="phoneNumber"/>
- <medi:field xmltag="function"/>
- <medi:field xmltag="location"/>
- </medi:segment>
- </medi:segment>
-
- </medi:segment>
-
- </medi:segments>
-
-</medi:edimap>
\ No newline at end of file
Modified: trunk/smooks/tests/org.jboss.tools.smooks.core.test/src/org/jboss/tools/smooks/test/openeditor/OpenAllSmooksConfigFileTestCase.java
===================================================================
--- trunk/smooks/tests/org.jboss.tools.smooks.core.test/src/org/jboss/tools/smooks/test/openeditor/OpenAllSmooksConfigFileTestCase.java 2009-12-02 07:41:35 UTC (rev 18966)
+++ trunk/smooks/tests/org.jboss.tools.smooks.core.test/src/org/jboss/tools/smooks/test/openeditor/OpenAllSmooksConfigFileTestCase.java 2009-12-02 07:55:44 UTC (rev 18967)
@@ -25,7 +25,6 @@
import org.eclipse.ui.ide.IDE;
import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
import org.jboss.tools.smooks.editor.AbstractSmooksFormEditor;
-import org.jboss.tools.smooks.model.freemarker.Template;
/**
* @author Dart
15 years, 3 months
JBoss Tools SVN: r18966 - in trunk/bpel/plugins: org.eclipse.bpel.common.model/META-INF and 14 other directories.
by jbosstools-commits@lists.jboss.org
Author: Grid.Qian
Date: 2009-12-02 02:41:35 -0500 (Wed, 02 Dec 2009)
New Revision: 18966
Added:
trunk/bpel/plugins/org.eclipse.bpel.ui/.cvsignore
Removed:
trunk/bpel/plugins/org.eclipse.bpel.common.model/.cvsignore
trunk/bpel/plugins/org.eclipse.bpel.common.ui/.cvsignore
trunk/bpel/plugins/org.eclipse.bpel.model/.cvsignore
trunk/bpel/plugins/org.eclipse.bpel.ui/.cvsignore
Modified:
trunk/bpel/plugins/org.eclipse.bpel.common.model/META-INF/MANIFEST.MF
trunk/bpel/plugins/org.eclipse.bpel.common.ui/META-INF/MANIFEST.MF
trunk/bpel/plugins/org.eclipse.bpel.model/META-INF/MANIFEST.MF
trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/util/BPELUtils.java
trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/util/ReconciliationHelper.java
trunk/bpel/plugins/org.eclipse.bpel.ui/.classpath
trunk/bpel/plugins/org.eclipse.bpel.ui/META-INF/MANIFEST.MF
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/BPELMultipageEditorPart.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/ScrollingBPELGraphicalViewer.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/commands/DeleteChildCommand.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/commands/RemoveImportCommand.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/commands/RevalidateLinksCommand.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/BrowseSelectorDialog.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/PartnerLinkSelectorDialog.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/PartnerLinkTypeSelectorDialog.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/PropertySelectorDialog.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/TypeSelectorDialog.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/VariableSelectorDialog.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/editparts/policies/BPELGraphicalEditPolicy.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/FaultCatchNameSection.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/ImportsSection.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/InvokeImplSection.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/InvokeVariableSection.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/MessageExchangeSection.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/util/ModelHelper.java
trunk/bpel/plugins/org.eclipse.bpel.wsil.model/META-INF/MANIFEST.MF
Log:
JBIDE-5349: sync the bpel codes from eclipse bpel codes base
Deleted: trunk/bpel/plugins/org.eclipse.bpel.common.model/.cvsignore
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.common.model/.cvsignore 2009-12-02 07:03:21 UTC (rev 18965)
+++ trunk/bpel/plugins/org.eclipse.bpel.common.model/.cvsignore 2009-12-02 07:41:35 UTC (rev 18966)
@@ -1 +0,0 @@
-bin
Modified: trunk/bpel/plugins/org.eclipse.bpel.common.model/META-INF/MANIFEST.MF
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.common.model/META-INF/MANIFEST.MF 2009-12-02 07:03:21 UTC (rev 18965)
+++ trunk/bpel/plugins/org.eclipse.bpel.common.model/META-INF/MANIFEST.MF 2009-12-02 07:41:35 UTC (rev 18966)
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: Extension Model (Incubation)
Bundle-SymbolicName: org.eclipse.bpel.common.model; singleton:=true
-Bundle-Version: 0.4.0.qualifier
+Bundle-Version: 0.5.0
Bundle-Activator: org.eclipse.bpel.common.extension.model.Activator
Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)",
@@ -57,4 +57,5 @@
org.eclipse.emf.ecore.xmi.util",
org.eclipse.bpel.names
Bundle-Vendor: eclipse.org
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ClassPath: bin
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Deleted: trunk/bpel/plugins/org.eclipse.bpel.common.ui/.cvsignore
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.common.ui/.cvsignore 2009-12-02 07:03:21 UTC (rev 18965)
+++ trunk/bpel/plugins/org.eclipse.bpel.common.ui/.cvsignore 2009-12-02 07:41:35 UTC (rev 18966)
@@ -1 +0,0 @@
-bin
Modified: trunk/bpel/plugins/org.eclipse.bpel.common.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.common.ui/META-INF/MANIFEST.MF 2009-12-02 07:03:21 UTC (rev 18965)
+++ trunk/bpel/plugins/org.eclipse.bpel.common.ui/META-INF/MANIFEST.MF 2009-12-02 07:41:35 UTC (rev 18966)
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: Common UI (Incubation)
Bundle-SymbolicName: org.eclipse.bpel.common.ui; singleton:=true
-Bundle-Version: 0.4.0.qualifier
+Bundle-Version: 0.5.0
Bundle-Activator: org.eclipse.bpel.common.ui.CommonUIPlugin
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui;bundle-version="[3.4.0,4.0.0)",
@@ -11,8 +11,8 @@
org.eclipse.core.resources;bundle-version="[3.4.0,4.0.0)",
org.eclipse.gef;bundle-version="[3.4.0,4.0.0)",
org.eclipse.emf.ecore.change;bundle-version="[2.4.0,3.0.0)",
- org.eclipse.bpel.model;bundle-version="0.4.0"
-Bundle-ActivationPolicy: lazy
+ org.eclipse.bpel.model;bundle-version="0.5.0"
+Eclipse-LazyStart: true
Export-Package: org.eclipse.bpel.common.ui,
org.eclipse.bpel.common.ui.assist,
org.eclipse.bpel.common.ui.calendar,
@@ -29,5 +29,6 @@
org.eclipse.bpel.common.ui.markers,
org.eclipse.bpel.common.ui.palette,
org.eclipse.bpel.common.ui.tray
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Vendor: eclipse.org
+Bundle-ClassPath: bin
Deleted: trunk/bpel/plugins/org.eclipse.bpel.model/.cvsignore
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.model/.cvsignore 2009-12-02 07:03:21 UTC (rev 18965)
+++ trunk/bpel/plugins/org.eclipse.bpel.model/.cvsignore 2009-12-02 07:41:35 UTC (rev 18966)
@@ -1 +0,0 @@
-bin
Modified: trunk/bpel/plugins/org.eclipse.bpel.model/META-INF/MANIFEST.MF
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.model/META-INF/MANIFEST.MF 2009-12-02 07:03:21 UTC (rev 18965)
+++ trunk/bpel/plugins/org.eclipse.bpel.model/META-INF/MANIFEST.MF 2009-12-02 07:41:35 UTC (rev 18966)
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: BPEL Model (Incubation)
Bundle-SymbolicName: org.eclipse.bpel.model; singleton:=true
-Bundle-Version: 0.4.0.qualifier
+Bundle-Version: 0.5.0
Bundle-Activator: org.eclipse.bpel.model.BPELPlugin$Implementation
Bundle-Vendor: eclipse.org
Bundle-Localization: plugin
@@ -12,8 +12,8 @@
org.eclipse.xsd;bundle-version="[2.4.0,3.0.0)",
org.eclipse.wst.wsdl;bundle-version="[1.1.200,2.0.0)",
org.apache.xerces;bundle-version="[2.9.0,3.0.0)",
- org.eclipse.bpel.common.model;bundle-version="0.4.0",
- javax.wsdl;bundle-version="[1.5.0,1.6.0)"
+ javax.wsdl;bundle-version="[1.5.0,1.6.0)",
+ org.eclipse.bpel.common.model;bundle-version="0.5.0"
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.bpel.model,
org.eclipse.bpel.model.adapters,
@@ -29,4 +29,5 @@
org.eclipse.bpel.model.resource,
org.eclipse.bpel.model.terms,
org.eclipse.bpel.model.util
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ClassPath: bin
Modified: trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/util/BPELUtils.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/util/BPELUtils.java 2009-12-02 07:03:21 UTC (rev 18965)
+++ trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/util/BPELUtils.java 2009-12-02 07:41:35 UTC (rev 18966)
@@ -27,6 +27,7 @@
import org.apache.xerces.dom.AttrImpl;
import org.apache.xerces.dom.DocumentImpl;
import org.apache.xerces.jaxp.DocumentBuilderFactoryImpl;
+import org.eclipse.bpel.model.BPELPackage;
import org.eclipse.bpel.model.Correlation;
import org.eclipse.bpel.model.CorrelationSet;
import org.eclipse.bpel.model.CorrelationSets;
@@ -272,15 +273,17 @@
* the reference object.
* @return the process object, or null
*/
-
- static public Process getProcess(EObject eObj) {
- EObject context = eObj;
-
- while (context != null) {
- if (context instanceof Process) {
- return (Process) context;
+ public static Process getProcess(Object object) {
+ if (object instanceof EObject) {
+ // check if *this* is already the process object
+ if (object instanceof Process)
+ return (Process)object;
+ EObject cont = ((EObject)object).eContainer();
+ while (cont != null) {
+ if (cont.eClass() == BPELPackage.eINSTANCE.getProcess())
+ return (Process)cont;
+ cont = cont.eContainer();
}
- context = context.eContainer();
}
return null;
}
Modified: trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/util/ReconciliationHelper.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/util/ReconciliationHelper.java 2009-12-02 07:03:21 UTC (rev 18965)
+++ trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/util/ReconciliationHelper.java 2009-12-02 07:41:35 UTC (rev 18966)
@@ -57,12 +57,15 @@
import org.eclipse.bpel.model.OnAlarm;
import org.eclipse.bpel.model.OnEvent;
import org.eclipse.bpel.model.OnMessage;
+import org.eclipse.bpel.model.PartnerActivity;
import org.eclipse.bpel.model.PartnerLink;
import org.eclipse.bpel.model.PartnerLinks;
import org.eclipse.bpel.model.Pick;
import org.eclipse.bpel.model.Process;
import org.eclipse.bpel.model.Query;
+import org.eclipse.bpel.model.Receive;
import org.eclipse.bpel.model.RepeatUntil;
+import org.eclipse.bpel.model.Reply;
import org.eclipse.bpel.model.Scope;
import org.eclipse.bpel.model.Sequence;
import org.eclipse.bpel.model.ServiceRef;
@@ -71,6 +74,7 @@
import org.eclipse.bpel.model.Target;
import org.eclipse.bpel.model.Targets;
import org.eclipse.bpel.model.TerminationHandler;
+import org.eclipse.bpel.model.Throw;
import org.eclipse.bpel.model.To;
import org.eclipse.bpel.model.ToPart;
import org.eclipse.bpel.model.ToParts;
@@ -84,6 +88,7 @@
import org.eclipse.bpel.model.impl.PartnerLinksImpl;
import org.eclipse.bpel.model.impl.VariablesImpl;
import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.wst.wsdl.WSDLElement;
import org.w3c.dom.CDATASection;
@@ -300,6 +305,183 @@
return null;
}
+
+ private static void updateLinkNameReferences(Link link, String name) {
+ if(link.getSources() != null && !link.getSources().isEmpty()) {
+ ((Source)link.getSources().get(0)).getElement().setAttribute(BPELConstants.AT_LINK_NAME, name);
+ }
+ if(link.getTargets() != null && !link.getTargets().isEmpty()) {
+ ((Target)link.getTargets().get(0)).getElement().setAttribute(BPELConstants.AT_LINK_NAME, name);
+ }
+ }
+
+ private static void updateMessageExchangeNameReferences(MessageExchange messExchange, String name) {
+ Process process = BPELUtils.getProcess(messExchange);
+ TreeIterator iter = process.eAllContents();
+ //TODO make more efficient for Scope!!!
+ while(iter.hasNext()) {
+ Object object = iter.next();
+ // receive
+ if(object instanceof Receive) {
+ Receive receive = (Receive) object;
+ if(messExchange.equals(receive.getMessageExchange())) {
+ receive.getElement().setAttribute(BPELConstants.AT_MESSAGE_EXCHANGE, name);
+ }
+ // reply
+ } else if(object instanceof Reply) {
+ Reply reply = (Reply) object;
+ if(messExchange.equals(reply.getMessageExchange())) {
+ reply.getElement().setAttribute(BPELConstants.AT_MESSAGE_EXCHANGE, name);
+ }
+ // onMessage
+ } else if(object instanceof OnMessage) {
+ OnMessage onMessage = (OnMessage)object;
+ if(messExchange.equals(onMessage.getMessageExchange())) {
+ onMessage.getElement().setAttribute(BPELConstants.AT_MESSAGE_EXCHANGE, name);
+ }
+ // onEvent
+ } else if(object instanceof OnEvent) {
+ OnEvent onEvent = (OnEvent)object;
+ if(messExchange.equals(onEvent.getMessageExchange())) {
+ onEvent.getElement().setAttribute(BPELConstants.AT_MESSAGE_EXCHANGE, name);
+ }
+ }
+ // scope
+ }
+ }
+
+ private static void updateCorrelationSetNameReferences(CorrelationSet corrSet, String name) {
+ // difference correlation and correlationsets?
+ Process process = BPELUtils.getProcess(corrSet);
+ TreeIterator iter = process.eAllContents();
+ while(iter.hasNext()) {
+ Object object = iter.next();
+ // receive, reply, invoke
+ if(object instanceof PartnerActivity) {
+ PartnerActivity partnerAct = (PartnerActivity) object;
+ partnerAct.getCorrelations();
+ // TODO
+ }
+ // scope
+ // correlation
+
+ // onMessage
+ else if(object instanceof OnMessage) {
+ OnMessage onMessage = (OnMessage)object;
+ onMessage.getCorrelations();
+ // TODO
+ // onEvent
+ } else if(object instanceof OnEvent) {
+ OnEvent onEvent = (OnEvent)object;
+ Correlations correlations = onEvent.getCorrelations();
+ // TODO
+ }
+ // TODO onEvent.getcorrelationssets does what?
+ }
+ }
+
+ private static void updatePartnerLinkNameReferences(PartnerLink partnerLink, String name) {
+ // TODO
+ }
+
+ private static void updateVariableNameReferences(Variable variable, String name) {
+ Process process = BPELUtils.getProcess(variable);
+ TreeIterator iter = process.eAllContents();
+ while(iter.hasNext()) {
+ Object object = iter.next();
+
+ // TODO refactor the code if possible
+ // from
+ if(object instanceof From) {
+ From from = (From) object;
+ if(variable.equals(from.getVariable())) {
+ from.getElement().setAttribute(BPELConstants.AT_VARIABLE, name);
+ }
+ // to
+ } else if (object instanceof To) {
+ To to = (To) object;
+ if(variable.equals(to.getVariable())) {
+ to.getElement().setAttribute(BPELConstants.AT_VARIABLE, name);
+ }
+ // receive
+ } else if(object instanceof Receive) {
+ Receive receive = (Receive)object;
+ if(variable.equals(receive.getVariable())) {
+ receive.getElement().setAttribute(BPELConstants.AT_VARIABLE, name);
+ }
+ // reply
+ } else if (object instanceof Reply) {
+ Reply reply = (Reply)object;
+ if(variable.equals(reply.getVariable())) {
+ reply.getElement().setAttribute(BPELConstants.AT_VARIABLE, name);
+ }
+ // invoke
+ } else if (object instanceof Invoke) {
+ Invoke invoke = (Invoke)object;
+ // fromparts
+ if(invoke.getFromParts() != null) {
+ FromParts fromParts = invoke.getFromParts();
+ EList<FromPart> list = fromParts.getChildren();
+ for (FromPart fromPart : list) {
+ if(variable.equals(fromPart.getToVariable())) {
+ fromPart.getElement().setAttribute(BPELConstants.AT_TO_VARIABLE, name);
+ }
+ }
+ }
+ // toparts
+ if(invoke.getToParts() != null) {
+ ToParts toParts = invoke.getToParts();
+ EList<ToPart> list = toParts.getChildren();
+ for (ToPart toPart : list) {
+ if(variable.equals(toPart.getFromVariable())) {
+ toPart.getElement().setAttribute(BPELConstants.AT_FROM_VARIABLE, name);
+ }
+ }
+ }
+ // inputvariable
+ if(variable.equals(invoke.getInputVariable())) {
+ invoke.getElement().setAttribute(BPELConstants.AT_INPUT_VARIABLE, name);
+ }
+ // outputvariable
+ if(variable.equals(invoke.getOutputVariable())) {
+ invoke.getElement().setAttribute(BPELConstants.AT_OUTPUT_VARIABLE, name);
+ }
+ // throw
+ } else if(object instanceof Throw) {
+ Throw _throw = (Throw) object;
+ if(variable.equals(_throw.getFaultVariable())) {
+ _throw.getElement().setAttribute(BPELConstants.AT_FAULT_VARIABLE, name);
+ }
+ // catch
+ } else if (object instanceof Catch) {
+ Catch _catch = (Catch) object;
+ if(variable.equals(_catch.getFaultVariable())) {
+ _catch.getElement().setAttribute(BPELConstants.AT_FAULT_VARIABLE, name);
+ }
+ // validate: has list to reference real variable: nothing to implement
+
+ // onMessage
+ } else if (object instanceof OnMessage) {
+ OnMessage onMessage = (OnMessage) object;
+ if(variable.equals(onMessage)) {
+ onMessage.getElement().setAttribute(BPELConstants.AT_VARIABLE, name);
+ }
+ // onEvent
+ } else if (object instanceof OnEvent) {
+ OnEvent onEvent = (OnEvent) object;
+ if(variable.equals(onEvent.getVariable())) {
+ onEvent.getElement().setAttribute(BPELConstants.AT_VARIABLE, name);
+ }
+ }
+ // forEach nothing to do: defines its own new variable, does not use existing one
+ // --> what if it uses existing one... this is not forbidden by UI
+
+ // initialize variables from other variables?
+ // XPATH, Expressions, etc.?
+ // TODO TEST with local variables. make faster for local variables
+ }
+ }
+
public static void replaceAttribute(WSDLElement element, String attributeName, String attributeValue) {
boolean oldUpdatingDom = isUpdatingDom(element);
@@ -321,11 +503,45 @@
if (isEqual(parseElement.getAttribute(attributeName), attributeValue)) {
return;
}
+
if (attributeValue != null && !attributeValue.equals("")) {
parseElement.setAttribute(attributeName, attributeValue);
} else {
parseElement.removeAttribute(attributeName);
}
+
+ // HACK!!!
+ // This is very hacky, but works and could show the way to another solution
+ if("name".equals(attributeName)) {
+ // link
+ if(element instanceof Link) {
+ updateLinkNameReferences((Link)element, attributeValue);
+ }
+
+ // variable
+ if(element instanceof Variable) {
+ updateVariableNameReferences((Variable)element, attributeValue);
+ }
+
+ // message exchange
+ else if(element instanceof MessageExchange) {
+ updateMessageExchangeNameReferences((MessageExchange)element, attributeValue);
+ }
+
+ // correlation set
+ else if(element instanceof CorrelationSet) {
+ updateCorrelationSetNameReferences((CorrelationSet)element, attributeValue);
+ }
+
+ // partner link
+ else if(element instanceof PartnerLink) {
+ updatePartnerLinkNameReferences((PartnerLink)element, attributeValue);
+ }
+
+ // partner link type: equivalent, but not with BPEL but WSDL
+ // property: correlation set + property alias --> WSDL
+ }
+
} finally {
setUpdatingDom(element, oldUpdatingDom);
}
Modified: trunk/bpel/plugins/org.eclipse.bpel.ui/.classpath
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.ui/.classpath 2009-12-02 07:03:21 UTC (rev 18965)
+++ trunk/bpel/plugins/org.eclipse.bpel.ui/.classpath 2009-12-02 07:41:35 UTC (rev 18966)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry exported="true" kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Deleted: trunk/bpel/plugins/org.eclipse.bpel.ui/.cvsignore
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.ui/.cvsignore 2009-12-02 07:03:21 UTC (rev 18965)
+++ trunk/bpel/plugins/org.eclipse.bpel.ui/.cvsignore 2009-12-02 07:41:35 UTC (rev 18966)
@@ -1 +0,0 @@
-bin
Added: trunk/bpel/plugins/org.eclipse.bpel.ui/.cvsignore
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.ui/.cvsignore (rev 0)
+++ trunk/bpel/plugins/org.eclipse.bpel.ui/.cvsignore 2009-12-02 07:41:35 UTC (rev 18966)
@@ -0,0 +1 @@
+bin
Property changes on: trunk/bpel/plugins/org.eclipse.bpel.ui/.cvsignore
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/bpel/plugins/org.eclipse.bpel.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.ui/META-INF/MANIFEST.MF 2009-12-02 07:03:21 UTC (rev 18965)
+++ trunk/bpel/plugins/org.eclipse.bpel.ui/META-INF/MANIFEST.MF 2009-12-02 07:41:35 UTC (rev 18966)
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: BPEL Editor (Incubation)
Bundle-SymbolicName: org.eclipse.bpel.ui; singleton:=true
-Bundle-Version: 0.4.0.qualifier
+Bundle-Version: 0.5.0
Bundle-Activator: org.eclipse.bpel.ui.BPELUIPlugin
Bundle-Vendor: Eclipse.org
Bundle-Localization: plugin
@@ -15,13 +15,13 @@
org.eclipse.jface.text;bundle-version="[3.4.0,4.0.0)",
org.eclipse.gef;bundle-version="[3.4.0,4.0.0)",
org.eclipse.xsd;bundle-version="[2.4.0,3.0.0)",
- org.eclipse.bpel.common.ui;bundle-version="0.4.0",
+ org.eclipse.bpel.common.ui;bundle-version="0.5.0",
org.eclipse.wst.wsdl;bundle-version="[1.1.200,2.0.0)",
- org.eclipse.bpel.common.ui;bundle-version="0.4.0",
- org.eclipse.bpel.common.model;bundle-version="0.4.0",
- org.eclipse.bpel.model;bundle-version="0.4.0",
+ org.eclipse.bpel.common.ui;bundle-version="0.5.0",
+ org.eclipse.bpel.common.model;bundle-version="0.5.0",
+ org.eclipse.bpel.model;bundle-version="0.5.0",
org.eclipse.wst.xml.core;bundle-version="[1.1.300,2.0.0)",
- org.eclipse.bpel.wsil.model;bundle-version="0.4.0",
+ org.eclipse.bpel.wsil.model;bundle-version="0.5.0",
org.eclipse.wst.sse.ui;bundle-version="[1.1.0,2.0.0)",
org.eclipse.wst.sse.core;bundle-version="[1.1.300,2.0.0)",
javax.wsdl;bundle-version="[1.5.0,1.6.0)",
@@ -66,4 +66,4 @@
org.eclipse.bpel.ui.util.marker,
org.eclipse.bpel.ui.wizards
Bundle-ClassPath: bin
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Modified: trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/BPELMultipageEditorPart.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/BPELMultipageEditorPart.java 2009-12-02 07:03:21 UTC (rev 18965)
+++ trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/BPELMultipageEditorPart.java 2009-12-02 07:41:35 UTC (rev 18966)
@@ -12,7 +12,10 @@
package org.eclipse.bpel.ui;
+import java.io.File;
+import java.text.SimpleDateFormat;
import java.util.ArrayList;
+import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -28,6 +31,7 @@
import org.eclipse.bpel.model.PartnerLink;
import org.eclipse.bpel.model.Process;
import org.eclipse.bpel.model.Variable;
+import org.eclipse.bpel.model.util.BPELUtils;
import org.eclipse.bpel.ui.adapters.AdapterNotification;
import org.eclipse.bpel.ui.editparts.ProcessTrayEditPart;
import org.eclipse.bpel.ui.editparts.util.OutlineTreePartFactory;
@@ -40,6 +44,7 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IMarkerDelta;
+import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.IResourceChangeListener;
@@ -47,7 +52,10 @@
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
import org.eclipse.draw2d.LightweightSystem;
import org.eclipse.draw2d.Viewport;
import org.eclipse.draw2d.parts.ScrollableThumbnail;
@@ -71,6 +79,7 @@
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.viewers.IPostSelectionProvider;
import org.eclipse.jface.viewers.ISelection;
@@ -94,6 +103,7 @@
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.ide.FileStoreEditorInput;
import org.eclipse.ui.ide.IGotoMarker;
import org.eclipse.ui.internal.views.properties.tabbed.view.TabDescriptor;
import org.eclipse.ui.internal.views.properties.tabbed.view.TabbedPropertyViewer;
@@ -115,9 +125,9 @@
import org.w3c.dom.Document;
import org.w3c.dom.Element;
-public class BPELMultipageEditorPart extends MultiPageEditorPart
- implements IEditModelListener,
- IGotoMarker/*, CommandStackListener*/ {
+public class BPELMultipageEditorPart extends MultiPageEditorPart
+implements IEditModelListener,
+IGotoMarker/*, CommandStackListener*/ {
class OutlinePage extends ContentOutlinePage {
private PageBook pageBook;
@@ -142,59 +152,59 @@
getViewer().setEditDomain(getEditDomain());
getViewer().setEditPartFactory(new OutlineTreePartFactory());
- fDesignViewer.registerViewer(getViewer());
+ BPELMultipageEditorPart.this.fDesignViewer.registerViewer(getViewer());
//FIXME should we add the same for src tab?
- ContextMenuProvider provider = new ProcessContextMenuProvider(getDesignEditor(), fDesignViewer.getActionRegistry());
+ ContextMenuProvider provider = new ProcessContextMenuProvider(getDesignEditor(), BPELMultipageEditorPart.this.fDesignViewer.getActionRegistry());
getViewer().setContextMenu(provider);
getSite().registerContextMenu("org.eclipse.bpel.outline.contextmenu", //$NON-NLS-1$
- provider,
- getSite().getSelectionProvider());
- getViewer().setKeyHandler(fDesignViewer.getKeyHandler());
+ provider,
+ getSite().getSelectionProvider());
+ getViewer().setKeyHandler(BPELMultipageEditorPart.this.fDesignViewer.getKeyHandler());
// TODO: Drag and drop support goes here
// getViewer().addDropTargetListener(new BPELTemplateTransferDropTargetListener(getViewer()));
IToolBarManager tbm = getSite().getActionBars().getToolBarManager();
- showOutlineAction = new Action() {
+ this.showOutlineAction = new Action() {
@Override
public void run() {
showPage(ID_OUTLINE);
}
-
- @Override
+
+ @Override
public String getToolTipText() {
- return Messages.OutlinePage_showOutlineView;
- }
+ return Messages.OutlinePage_showOutlineView;
+ }
};
- showOutlineAction.setImageDescriptor(BPELUIPlugin.INSTANCE.getImageDescriptor(IBPELUIConstants.ICON_OUTLINE_16));
- tbm.add(showOutlineAction);
- showOverviewAction = new Action() {
+ this.showOutlineAction.setImageDescriptor(BPELUIPlugin.INSTANCE.getImageDescriptor(IBPELUIConstants.ICON_OUTLINE_16));
+ tbm.add(this.showOutlineAction);
+ this.showOverviewAction = new Action() {
@Override
public void run() {
showPage(ID_OVERVIEW);
}
-
- @Override
+
+ @Override
public String getToolTipText() {
- return Messages.OutlinePage_showOverviewView;
- }
+ return Messages.OutlinePage_showOverviewView;
+ }
};
- showOverviewAction.setImageDescriptor(BPELUIPlugin.INSTANCE.getImageDescriptor(IBPELUIConstants.ICON_OVERVIEW_16));
- tbm.add(showOverviewAction);
+ this.showOverviewAction.setImageDescriptor(BPELUIPlugin.INSTANCE.getImageDescriptor(IBPELUIConstants.ICON_OVERVIEW_16));
+ tbm.add(this.showOverviewAction);
showPage(ID_OUTLINE);
}
@Override
public Control getControl() {
- return pageBook;
+ return this.pageBook;
}
@Override
public void createControl(Composite parent) {
- pageBook = new PageBook(parent, SWT.NONE);
- outline = getViewer().createControl(pageBook);
- overview = new Canvas(pageBook, SWT.NONE);
- pageBook.showPage(outline);
+ this.pageBook = new PageBook(parent, SWT.NONE);
+ this.outline = getViewer().createControl(this.pageBook);
+ this.overview = new Canvas(this.pageBook, SWT.NONE);
+ this.pageBook.showPage(this.outline);
configureOutlineViewer();
// TODO: Add to the adapting selection provider
//getSelectionSynchronizer().addViewer(getViewer());
@@ -203,29 +213,29 @@
}
private void initializeOverview() {
- LightweightSystem lws = new LightweightSystem(overview);
- RootEditPart rep = fDesignViewer.getGraphicalViewer().getRootEditPart();
+ LightweightSystem lws = new LightweightSystem(this.overview);
+ RootEditPart rep = BPELMultipageEditorPart.this.fDesignViewer.getGraphicalViewer().getRootEditPart();
if (rep instanceof GraphicalBPELRootEditPart) {
GraphicalBPELRootEditPart root = (GraphicalBPELRootEditPart)rep;
- thumbnail = new ScrollableThumbnail((Viewport)root.getFigure());
- thumbnail.setSource(root.getLayer(LayerConstants.PRINTABLE_LAYERS));
- lws.setContents(thumbnail);
+ this.thumbnail = new ScrollableThumbnail((Viewport)root.getFigure());
+ this.thumbnail.setSource(root.getLayer(LayerConstants.PRINTABLE_LAYERS));
+ lws.setContents(this.thumbnail);
}
}
private void showPage(int id) {
if (id == ID_OUTLINE) {
- showOutlineAction.setChecked(true);
- showOverviewAction.setChecked(false);
- pageBook.showPage(outline);
- if (thumbnail != null)
- thumbnail.setVisible(false);
+ this.showOutlineAction.setChecked(true);
+ this.showOverviewAction.setChecked(false);
+ this.pageBook.showPage(this.outline);
+ if (this.thumbnail != null)
+ this.thumbnail.setVisible(false);
} else if (id == ID_OVERVIEW) {
initializeOverview();
- showOutlineAction.setChecked(false);
- showOverviewAction.setChecked(true);
- pageBook.showPage(overview);
- thumbnail.setVisible(true);
+ this.showOutlineAction.setChecked(false);
+ this.showOverviewAction.setChecked(true);
+ this.pageBook.showPage(this.overview);
+ this.thumbnail.setVisible(true);
}
}
@@ -233,12 +243,12 @@
public void dispose() {
super.dispose();
}
-
+
@Override
public void init(IPageSite pageSite) {
super.init(pageSite);
- //should ActionRegistry be here too?
- ActionRegistry registry = fDesignViewer.getActionRegistry();
+ //should ActionRegistry be here too?
+ ActionRegistry registry = BPELMultipageEditorPart.this.fDesignViewer.getActionRegistry();
IActionBars bars = pageSite.getActionBars();
String id = ActionFactory.UNDO.getId();
bars.setGlobalActionHandler(id, registry.getAction(id));
@@ -261,37 +271,37 @@
for (Iterator<Object> i = ((IStructuredSelection) selection).iterator(); i.hasNext();) {
Object domNode = i.next();
if (domNode instanceof Element) {
- Object facade = BPELEditorUtil.getInstance().findModelObjectForElement(process, (Element)domNode);
+ Object facade = BPELEditorUtil.getInstance().findModelObjectForElement(BPELMultipageEditorPart.this.process, (Element)domNode);
if (facade != null) {
selections.add(facade);
}
}
}
-
+
if (!selections.isEmpty()) {
StructuredSelection bpelSelection = new StructuredSelection(selections);
- fDesignViewer.getAdaptingSelectionProvider().setSelection(bpelSelection);
+ BPELMultipageEditorPart.this.fDesignViewer.getAdaptingSelectionProvider().setSelection(bpelSelection);
}
}
}
}
}
-
+
protected class DesignViewerSelectionListener implements ISelectionChangedListener {
public void selectionChanged(SelectionChangedEvent event) {
//force selection update if only source page is not active
if (getActivePage() != SOURCE_PAGE_INDEX) {
try {
- ISelection sel = fDesignViewer.getSelection();
+ ISelection sel = BPELMultipageEditorPart.this.fDesignViewer.getSelection();
Object selectedNode = ((IStructuredSelection)sel).getFirstElement();
Element selectedNodeElement = null;
-
+
if (selectedNode instanceof StartNode) {
selectedNodeElement = ((StartNode)selectedNode).getProcess().getElement();
} else if (selectedNode instanceof ExtensibleElement) {
selectedNodeElement = ((ExtensibleElement)selectedNode).getElement();
- }
-
+ }
+
if (selectedNodeElement != null) {
if (selectedNodeElement instanceof IDOMNode && ((IDOMNode)selectedNodeElement).getModel().isModelStateChanging()) {
return;
@@ -305,45 +315,45 @@
}
}
}
-
+
private Process process;
-
+
private DefaultEditDomain editDomain;
-
+
protected ModelListenerAdapter modelListenerAdapter;
-
+
private Resource extensionsResource;
-
+
private ExtensionMap extensionMap;
-
+
protected StructuredTextEditor fTextEditor = null;
protected BPELEditor fDesignViewer = null;
protected int currentPage = -1;
-
+
protected TextEditorSelectionListener textEditorSelectionListener;
protected DesignViewerSelectionListener designViewerSelectionListener;
-
+
// reacts to changes on the BPEL file (e.g. move, rename)
private IFileChangeListener fileChangeListener;
-
+
// refactoring listeners
protected IResourceChangeListener postBuildRefactoringListener;
BPELModelReconcileAdapter bpelModelReconcileAdapter;
-
+
private OutlinePage outlinePage;
protected BPELTabbedPropertySheetPage currentPropertySheetPage;
-
+
protected ActionRegistry actionRegistry;
-
+
private static int DESIGN_PAGE_INDEX = 0;
private static int SOURCE_PAGE_INDEX = 1;
- private Map<Long, EObject>fMarkers2EObject = new HashMap<Long, EObject>();
- private Notification fMarkersStale = new NotificationImpl(
+ private final Map<Long, EObject>fMarkers2EObject = new HashMap<Long, EObject>();
+ private final Notification fMarkersStale = new NotificationImpl(
AdapterNotification.NOTIFICATION_MARKERS_STALE, null, null);
-
+
public BPELMultipageEditorPart() {
super();
setEditDomain(new BPELEditDomain(this));
@@ -360,22 +370,22 @@
/*
* Connect selection from the Design page to the selection provider of
* the Source page so that selection in the Design page will drive
- * selection in the Source page.
+ * selection in the Source page.
*/
- designViewerSelectionListener = new DesignViewerSelectionListener();
- fDesignViewer.getAdaptingSelectionProvider().addSelectionChangedListener(designViewerSelectionListener);
-
+ this.designViewerSelectionListener = new DesignViewerSelectionListener();
+ this.fDesignViewer.getAdaptingSelectionProvider().addSelectionChangedListener(this.designViewerSelectionListener);
+
/*
* Connect selection from the Source page to the selection provider of
* the Design page so that selection in the Source page will drive
- * selection in the Design page.
+ * selection in the Design page.
*/
- textEditorSelectionListener = new TextEditorSelectionListener();
+ this.textEditorSelectionListener = new TextEditorSelectionListener();
ISelectionProvider provider = getTextEditor().getSelectionProvider();
if (provider instanceof IPostSelectionProvider) {
- ((IPostSelectionProvider) provider).addPostSelectionChangedListener(textEditorSelectionListener);
+ ((IPostSelectionProvider) provider).addPostSelectionChangedListener(this.textEditorSelectionListener);
} else {
- provider.addSelectionChangedListener(textEditorSelectionListener);
+ provider.addSelectionChangedListener(this.textEditorSelectionListener);
}
}
@@ -384,32 +394,40 @@
* Creates the design page of the multi-page editor.
*/
protected void createDesignPage() {
- fDesignViewer = new BPELEditor(getEditDomain(), this);
+ this.fDesignViewer = new BPELEditor(getEditDomain(), this);
+ // Bug #209341 - starting patch
+ if( getFileInput() == null ) {
+ MessageDialog.openError(
+ getSite().getShell(),
+ "Error while opening the file",
+ "The file could be opened, no input could be retrieved." );
+ return;
+ }
+ // End of patch
loadModel();
-
try
- {
- addPage(0, fDesignViewer, getEditorInput());
+ {
+ addPage(0, this.fDesignViewer, getEditorInput());
//FIXME I18N
setPageText(0, "Design");
- } catch (PartInitException e) {
- ErrorDialog.openError(getSite().getShell(), "Error creating Design page", null, e.getStatus()); //$NON-NLS-1$
- }
+ } catch (PartInitException e) {
+ ErrorDialog.openError(getSite().getShell(), "Error creating Design page", null, e.getStatus()); //$NON-NLS-1$
+ }
}
/**
* Creates the source page of the multi-page editor.
*/
protected void createSourcePage() throws PartInitException {
- fTextEditor = new StructuredTextEditor();
+ this.fTextEditor = new StructuredTextEditor();
try
- {
- addPage(0, fTextEditor, getEditorInput());
- //FIXME I18N
- setPageText(0, "Source");
- } catch (PartInitException e) {
- ErrorDialog.openError(getSite().getShell(), "Error creating Source page", null, e.getStatus()); //$NON-NLS-1$
- }
+ {
+ addPage(0, this.fTextEditor, getEditorInput());
+ //FIXME I18N
+ setPageText(0, "Source");
+ } catch (PartInitException e) {
+ ErrorDialog.openError(getSite().getShell(), "Error creating Source page", null, e.getStatus()); //$NON-NLS-1$
+ }
}
/**
@@ -421,21 +439,21 @@
// source page must be created before design page
createSourcePage();
createDesignPage();
- firePropertyChange(PROP_TITLE);
+ firePropertyChange(PROP_TITLE);
connectDesignPage();
initializeFileChangeListener();
- initializeRefactoringListener();
+ initializeRefactoringListener();
} catch (PartInitException e) {
//Logger.logException(e);
throw new RuntimeException(e);
- }
-
+ }
+
if (BPELUIPlugin.INSTANCE.getDefaultPage().equals(IBPELUIConstants.SOURCE_PAGE)) {
setActivePage(SOURCE_PAGE_INDEX);
} else {
setActivePage(DESIGN_PAGE_INDEX);
}
-
+
//updateTitle();
}
@@ -445,28 +463,30 @@
/*if (outlinePage != null && outlinePage.getViewer() != null) {
outlinePage.getViewer().setContents(null);
}*/
- if (currentPage == SOURCE_PAGE_INDEX) {
+ if (this.currentPage == SOURCE_PAGE_INDEX) {
BPELUIPlugin.INSTANCE.setDefaultPage(IBPELUIConstants.SOURCE_PAGE);
} else {
BPELUIPlugin.INSTANCE.setDefaultPage(IBPELUIConstants.DESIGN_PAGE);
}
- outlinePage = null;
- process = null;
-
- if (fileChangeListener != null) {
- BPELUIPlugin.INSTANCE.getResourceChangeListener().removeListener(fileChangeListener);
+ this.outlinePage = null;
+ this.process = null;
+
+ if (this.fileChangeListener != null) {
+ BPELUIPlugin.INSTANCE.getResourceChangeListener().removeListener(this.fileChangeListener);
}
- if (postBuildRefactoringListener != null) {
+ if (this.postBuildRefactoringListener != null) {
IWorkspace workspace = ResourcesPlugin.getWorkspace();
- workspace.removeResourceChangeListener(postBuildRefactoringListener);
+ workspace.removeResourceChangeListener(this.postBuildRefactoringListener);
}
- IStructuredModel model = fTextEditor.getModel();
- model.releaseFromEdit();
- fDesignViewer.dispose();
- fTextEditor.dispose();
+ IStructuredModel model = this.fTextEditor.getModel();
+ if (model != null) {
+ model.releaseFromEdit();
+ this.fDesignViewer.dispose();
+ this.fTextEditor.dispose();
+ }
super.dispose();
}
@@ -538,14 +558,14 @@
public void doSave(IProgressMonitor progressMonitor) {
// We use fTextEditor to save, because fDesignViewer.doSave() removes comments on save
// Save bpel only
- fDesignViewer.getCommandFramework().applyCurrentChange();
- fTextEditor.doSave(progressMonitor);
+ this.fDesignViewer.getCommandFramework().applyCurrentChange();
+ this.fTextEditor.doSave(progressMonitor);
// Reset sync stamp and modified flag after save
- fDesignViewer.getEditModelClient().getPrimaryResourceInfo().resetSynchronizeStamp();
- fDesignViewer.getEditModelClient().getPrimaryResourceInfo().getResource().setModified(false);
+ this.fDesignViewer.getEditModelClient().getPrimaryResourceInfo().resetSynchronizeStamp();
+ this.fDesignViewer.getEditModelClient().getPrimaryResourceInfo().getResource().setModified(false);
// Save extensions
- fDesignViewer.doSave(progressMonitor);
- getCommandStack().markSaveLocation();
+ this.fDesignViewer.doSave(progressMonitor);
+ getCommandStack().markSaveLocation();
}
/*
@@ -557,49 +577,49 @@
public void doSaveAs() {
//saveAs is not allowed; do nothing
}
-
+
protected BPELTabbedPropertySheetPage createBPELTabbedPropertySheetPage() {
//FIXME should the BPELTabbedPropertySheetPage has BPELMultiPageEditorPart as the 2nd argument?
return new BPELTabbedPropertySheetPage(new ITabbedPropertySheetPageContributor() {
- public String getContributorId() {
- // same as the palette one
- //return fDesignViewer.getPaletteAdditionsContributorId();
- return IBPELUIConstants.BPEL_EDITOR_ID;
- }
- }, fDesignViewer);
+ public String getContributorId() {
+ // same as the palette one
+ //return fDesignViewer.getPaletteAdditionsContributorId();
+ return IBPELUIConstants.BPEL_EDITOR_ID;
+ }
+ }, this.fDesignViewer);
}
-
+
protected ActionRegistry getActionRegistry() {
- if (actionRegistry == null)
- actionRegistry = new ActionRegistry();
- return actionRegistry;
+ if (this.actionRegistry == null)
+ this.actionRegistry = new ActionRegistry();
+ return this.actionRegistry;
}
-
+
@Override
public Object getAdapter(Class type) {
if (type == Process.class) {
- return process;
+ return this.process;
}
-
+
if (type == BPELEditModelClient.class) {
- return process;
+ return this.process;
}
//FIXME should we kill it?
if (type == ModelListenerAdapter.class) {
- return modelListenerAdapter;
+ return this.modelListenerAdapter;
}
//FIXME should we kill it?
if (type == Resource.class) {
- return extensionsResource;
+ return this.extensionsResource;
}
//FIXME should we kill it?
if (type == ExtensionMap.class) {
- return extensionMap;
+ return this.extensionMap;
}
//FIXME should we kill it?
@@ -608,25 +628,25 @@
}
if (type == IContentOutlinePage.class) {
- if (outlinePage == null) {
- outlinePage = new OutlinePage(new TreeViewer());
+ if (this.outlinePage == null) {
+ this.outlinePage = new OutlinePage(new TreeViewer());
}
- return outlinePage;
+ return this.outlinePage;
}
if (type == IPropertySheetPage.class) {
// We can't cache this object because the properties framework needs a new instance
- // every time it calls this method.
- currentPropertySheetPage = createBPELTabbedPropertySheetPage();
- return currentPropertySheetPage;
+ // every time it calls this method.
+ this.currentPropertySheetPage = createBPELTabbedPropertySheetPage();
+ return this.currentPropertySheetPage;
}
if (type == ActionRegistry.class) {
return getActionRegistry();
}
-
+
return super.getAdapter(type);
- }
+ }
public CommandStack getCommandStack() {
return getEditDomain().getCommandStack();
@@ -640,13 +660,13 @@
return pageIndex;
}
-
+
/**
* Returns the design viewer
* @return the design viewer
*/
protected BPELEditor getDesignEditor() {
- return fDesignViewer;
+ return this.fDesignViewer;
}
/**
@@ -654,15 +674,70 @@
* @return the edit domain
*/
protected DefaultEditDomain getEditDomain() {
- return editDomain;
+ return this.editDomain;
}
+ // Bug #209341 - patch
+ // By Vincent Zurczak - EBM WebSourcing
+ private IFile openFile;
+ private static String filePrefix = new SimpleDateFormat( "yyyyMMF_" ).format( new GregorianCalendar().getTime());
+
+ /**
+ *
+ * @return
+ */
protected IFile getFileInput() {
- return ((IFileEditorInput) getEditorInput()).getFile();
+
+ if( this.openFile == null ) {
+ try {
+ // Case where the file is in the workspace
+ if( getEditorInput() instanceof IFileEditorInput )
+ this.openFile = ((IFileEditorInput) getEditorInput()).getFile();
+
+ // Outside the workspace
+ // Since everything relies on IFiles, we create a temporary file in the workspace
+ // linking to the file outside the workspace
+ else if( getEditorInput() instanceof FileStoreEditorInput ) {
+ File f = new File(((FileStoreEditorInput) getEditorInput()).getURI());
+ IPath path = new Path( f.getAbsolutePath());
+
+ // Create a temporary project
+ IProgressMonitor monitor = new NullProgressMonitor();
+ IProject tempProject = ResourcesPlugin.getWorkspace().getRoot().getProject( ".temp" );
+ if( ! tempProject.exists())
+ tempProject.create( monitor );
+
+ if( ! tempProject.isOpen())
+ tempProject.open( monitor );
+
+ // Remove old temporary files
+ // The file prefix is designed so that natural comparison order is enough
+ for( IResource res : tempProject.members()) {
+ if( res.getName().substring( 0, 7 ).compareTo( filePrefix ) < 0 ) {
+ try {
+ res.delete( false, monitor );
+ } catch( Exception e ) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ // Create a temporary file
+ this.openFile = tempProject.getFile( filePrefix + path.lastSegment());
+ this.openFile.createLink( path, IResource.NONE, monitor );
+ }
+
+ } catch( CoreException e ) {
+ e.printStackTrace();
+ }
+ }
+
+ return this.openFile;
}
+ // End of patch
public Process getProcess() {
- return process;
+ return this.process;
}
/**
@@ -670,42 +745,42 @@
* @return the design viewer
*/
protected StructuredTextEditor getSourceViewer() {
- return fTextEditor;
+ return this.fTextEditor;
}
StructuredTextEditor getTextEditor() {
- return fTextEditor;
+ return this.fTextEditor;
}
-
+
public void gotoMarker(IMarker marker) {
-
+
// One such mechanism is to use the href of the model object
// generated by the validator or whatever ...
-
+
String href = null;
try {
href = (String) marker.getAttribute( "address.model" );
} catch (CoreException ex) {
BPELUIPlugin.log(ex);
- }
-
+ }
+
// lookup by object href in the model.
EObject modelObject = null;
-
+
if (href != null) {
try {
- modelObject = fDesignViewer.getResource().getEObject( href );
+ modelObject = this.fDesignViewer.getResource().getEObject( href );
} catch (Throwable t) {
BPELUIPlugin.log(t);
}
}
-
- gotoText(marker);
-
+
+ gotoText(marker);
+
if (modelObject == null) {
return;
}
-
+
gotoMarker ( marker, modelObject );
}
@@ -721,17 +796,17 @@
charStart = charStart == null ? 0 : charStart;
charEnd = charEnd == null ? charStart : charEnd;
try {
- fTextEditor.setHighlightRange(charStart, charEnd - charStart, true);
+ this.fTextEditor.setHighlightRange(charStart, charEnd - charStart, true);
} catch (Throwable t) {
BPELUIPlugin.log(t);
}
}
-
+
void gotoMarker ( IMarker marker, EObject modelObject ) {
-
+
// TODO: is this bogus now that we have AdaptingSelectionProvider?
-
-
+
+
// The closest parent which has an edit part in the graph view.
//
// The following do not have viewers in the graph view:
@@ -739,60 +814,60 @@
// If it's any of those, then we have to reveal the closest container
// and then select the model object and show the properties.
- GraphicalViewer graphViewer = fDesignViewer.getGraphicalViewer();
+ GraphicalViewer graphViewer = this.fDesignViewer.getGraphicalViewer();
EObject refObj = null;
-
+
EditPart editPart = null;
if ( modelObject instanceof Variable ||
- modelObject instanceof PartnerLink ||
- modelObject instanceof CorrelationSet ||
- modelObject instanceof MessageExchange) {
-
+ modelObject instanceof PartnerLink ||
+ modelObject instanceof CorrelationSet ||
+ modelObject instanceof MessageExchange) {
+
refObj = ModelHelper.getContainingScope(modelObject);
editPart = (EditPart)graphViewer.getEditPartRegistry().get(refObj);
if (editPart != null) {
graphViewer.reveal(editPart);
- }
- fDesignViewer.selectModelObject(modelObject);
-
+ }
+ this.fDesignViewer.selectModelObject(modelObject);
+
} else if (modelObject instanceof Activity) {
-
+
// activity objects are on the graphical viewer
refObj = modelObject;
editPart = (EditPart)graphViewer.getEditPartRegistry().get(refObj);
-
+
if (editPart != null) {
graphViewer.reveal(editPart);
}
-
- fDesignViewer.selectModelObject(modelObject);
-
-
+
+ this.fDesignViewer.selectModelObject(modelObject);
+
+
} else {
-
+
refObj = modelObject;
while (refObj != null && !(refObj instanceof Activity) ) {
refObj = refObj.eContainer();
}
-
+
// select process by default.
if (refObj == null) {
- refObj = ModelHelper.getProcess( modelObject ) ;
+ refObj = BPELUtils.getProcess( modelObject ) ;
}
-
+
modelObject = refObj;
-
+
editPart = (EditPart)graphViewer.getEditPartRegistry().get(modelObject);
-
+
if (editPart != null) {
graphViewer.reveal(editPart);
}
-
- fDesignViewer.selectModelObject(modelObject);
+
+ this.fDesignViewer.selectModelObject(modelObject);
}
-
+
// If possible, try to display the marker in a property section.
- BPELTabbedPropertySheetPage propertySheetPage = currentPropertySheetPage;
+ BPELTabbedPropertySheetPage propertySheetPage = this.currentPropertySheetPage;
if (propertySheetPage == null) {
return;
// if currentPropertySheetPage is null it means that the properties
@@ -802,9 +877,9 @@
// TODO: this doesn't work
//propertySheetPage = createBPELTabbedPropertySheetPage();
}
-
+
TabbedPropertyViewer viewer = propertySheetPage.getTabbedPropertyViewer();
-
+
int j = 0;
while (true) { // while we don't get an exception...
TabDescriptor descriptor = null;
@@ -813,19 +888,19 @@
} catch (IndexOutOfBoundsException iobe) {
break;
}
-
+
if (descriptor == null) {
break; // no more descriptors
}
-
+
TabContents tab = descriptor.createTab();
ISection[] sections = tab.getSections();
for (int i = 0; i < sections.length; i++) {
-
+
if (BPELPropertySection.class.isInstance( sections[i]) == false) {
continue;
}
-
+
BPELPropertySection section = (BPELPropertySection)sections[i];
// HACK: we have to fake the initialization of this section in order to
@@ -834,22 +909,22 @@
section.setInput(this, new StructuredSelection(modelObject));
if (section.isValidMarker (marker) ) {
-
+
// the first section that handles this kind of marker wins
showPropertiesView();
// get real viewer, Tab and ISection objects since we are probably using fake ones
- viewer = currentPropertySheetPage.getTabbedPropertyViewer();
+ viewer = this.currentPropertySheetPage.getTabbedPropertyViewer();
viewer.setSelection(new StructuredSelection(descriptor));
- tab = currentPropertySheetPage.getCurrentTab();
+ tab = this.currentPropertySheetPage.getCurrentTab();
section = (BPELPropertySection)tab.getSectionAtIndex(i);
section.gotoMarker(marker);
return; // ignore other sections and tabs
-
+
}
- }
+ }
}
}
-
+
/*
* (non-Javadoc)
*
@@ -860,15 +935,15 @@
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
try {
super.init(site, input);
-// getCommandStack().addCommandStackListener(this);
+ // getCommandStack().addCommandStackListener(this);
} catch (Exception e) {
e.printStackTrace();
}
setPartName(input.getName());
}
-
+
protected void initializeFileChangeListener() {
- fileChangeListener = new IFileChangeListener() {
+ this.fileChangeListener = new IFileChangeListener() {
public void deleted(IFile file) {
IFile current = ((IFileEditorInput)getEditorInput()).getFile();
if (current.equals(file)) {
@@ -919,16 +994,16 @@
// }
}
};
- BPELUIPlugin.INSTANCE.getResourceChangeListener().addListener(fileChangeListener);
+ BPELUIPlugin.INSTANCE.getResourceChangeListener().addListener(this.fileChangeListener);
}
-
+
/**
* Installs the refactoring listener
*/
protected void initializeRefactoringListener() {
final IWorkspace workspace = ResourcesPlugin.getWorkspace();
- postBuildRefactoringListener = new IResourceChangeListener() {
+ this.postBuildRefactoringListener = new IResourceChangeListener() {
public void resourceChanged(IResourceChangeEvent event) {
IFile newFile = ((FileEditorInput)getEditorInput()).getFile();
final IResourceDelta bpelFileDelta = event.getDelta().findMember(newFile.getFullPath());
@@ -942,7 +1017,7 @@
}
}
};
- workspace.addResourceChangeListener(postBuildRefactoringListener, IResourceChangeEvent.POST_BUILD);
+ workspace.addResourceChangeListener(this.postBuildRefactoringListener, IResourceChangeEvent.POST_BUILD);
}
/*
@@ -957,9 +1032,9 @@
protected void loadModel() {
Document structuredDocument = null;
-
+
try {
- IDocument doc = fTextEditor.getDocumentProvider().getDocument(getEditorInput());
+ IDocument doc = this.fTextEditor.getDocumentProvider().getDocument(getEditorInput());
if (doc instanceof IStructuredDocument) {
IStructuredModel model = StructuredModelManager.getModelManager().getExistingModelForEdit(doc);
if (model == null) {
@@ -971,35 +1046,39 @@
}
} catch (Exception e) {
e.printStackTrace();
- }
-
- HashMap<String, Document> loadOptions = null;
+ }
+
+ HashMap<String, Document> loadOptions = null;
if (structuredDocument != null) {
loadOptions = new HashMap<String, Document> (1);
loadOptions.put("DOMDocument", structuredDocument);
}
-
- //FIXME WSDLEditor has gef command stack; in order to have gef command stack we need to add design page first
- BPELEditModelClient editModelClient = new BPELEditModelClient(this, ((IFileEditorInput) getEditorInput()).getFile(), this, loadOptions);
- fDesignViewer.setEditModelClient(editModelClient);
+
+ //FIXME WSDLEditor has gef command stack; in order to have gef command stack we need to add design page first
+
+ // Bug # 209341 - starting patch
+ // By Vincent Zurczak
+ IFile fileToOpen = getFileInput();
+ BPELEditModelClient editModelClient = new BPELEditModelClient(this, fileToOpen, this, loadOptions);
+ this.fDesignViewer.setEditModelClient(editModelClient);
getEditDomain().setCommandStack(editModelClient.getCommandStack());
Resource bpelResource = editModelClient.getPrimaryResourceInfo().getResource();
- IFile file = getFileInput();
BPELReader reader = new BPELReader();
- reader.read(bpelResource, file, fDesignViewer.getResourceSet());
- process = reader.getProcess();
-
- bpelModelReconcileAdapter = new BPELModelReconcileAdapter (structuredDocument, process, bpelResource, fDesignViewer);
-
- if (getEditDomain() != null) {
- ((BPELEditDomain)getEditDomain()).setProcess(getProcess());
- }
- extensionsResource = reader.getExtensionsResource();
- extensionMap = reader.getExtensionMap();
+ reader.read(bpelResource, fileToOpen, this.fDesignViewer.getResourceSet());
+ // End of patch
- modelListenerAdapter = new ModelListenerAdapter();
- modelListenerAdapter.setExtensionMap(extensionMap);
+ this.process = reader.getProcess();
+ this.bpelModelReconcileAdapter = new BPELModelReconcileAdapter (structuredDocument, this.process, bpelResource, this.fDesignViewer);
+
+ if (getEditDomain() != null) {
+ ((BPELEditDomain)getEditDomain()).setProcess(getProcess());
+ }
+ this.extensionsResource = reader.getExtensionsResource();
+ this.extensionMap = reader.getExtensionMap();
+
+ this.modelListenerAdapter = new ModelListenerAdapter();
+ this.modelListenerAdapter.setExtensionMap(this.extensionMap);
}
public void modelDeleted(ResourceInfo resourceInfo) {
@@ -1007,42 +1086,42 @@
getSite().getPage().closeEditor(this, false);
}
}
-
+
public void modelDirtyStateChanged(ResourceInfo resourceInfo) {
firePropertyChange(PROP_DIRTY);
}
-
+
public void modelLocationChanged(ResourceInfo resourceInfo, IFile movedToFile) {
// TODO!
//updateInputFile(movedToFile.getFullPath());
}
public void modelReloaded(ResourceInfo resourceInfo) {
- Resource bpelResource = fDesignViewer.getEditModelClient().getPrimaryResourceInfo().getResource();
+ Resource bpelResource = this.fDesignViewer.getEditModelClient().getPrimaryResourceInfo().getResource();
IFile file = getFileInput();
BPELReader reader = new BPELReader();
- reader.read(bpelResource, file, fDesignViewer.getResourceSet());
-
- process = reader.getProcess();
- if (getEditDomain() != null) {
- ((BPELEditDomain)getEditDomain()).setProcess(getProcess());
- }
- extensionMap = reader.getExtensionMap();
-
- modelListenerAdapter.setExtensionMap(fDesignViewer.getExtensionMap());
-
- fDesignViewer.getGraphicalViewer().setContents(getProcess());
+ reader.read(bpelResource, file, this.fDesignViewer.getResourceSet());
+ this.process = reader.getProcess();
+ if (getEditDomain() != null) {
+ ((BPELEditDomain)getEditDomain()).setProcess(getProcess());
+ }
+ this.extensionMap = reader.getExtensionMap();
+
+ this.modelListenerAdapter.setExtensionMap(this.fDesignViewer.getExtensionMap());
+
+ this.fDesignViewer.getGraphicalViewer().setContents(getProcess());
+
// The ProcessTrayEditPart tries to remove its selection listener on deactivate.
// In this case, it will fail because the edit part can't find the editor because
// the process no longer belongs to a resource. Help it out and remove the
// listener manually.
- ProcessTrayEditPart processTrayEditPart = (ProcessTrayEditPart)fDesignViewer.getTrayViewer().getContents();
- fDesignViewer.getGraphicalViewer().removeSelectionChangedListener(processTrayEditPart.getSelectionChangedListener());
-
- fDesignViewer.getTrayViewer().setContents(getProcess());
-
+ ProcessTrayEditPart processTrayEditPart = (ProcessTrayEditPart)this.fDesignViewer.getTrayViewer().getContents();
+ this.fDesignViewer.getGraphicalViewer().removeSelectionChangedListener(processTrayEditPart.getSelectionChangedListener());
+
+ this.fDesignViewer.getTrayViewer().setContents(getProcess());
+
//Bugzilla 294501 - When markers are added on the BPEL file, the meta-model
//objects are notified about the marker change. But the display of the markers
//on the diagram fails because of several invalid thread access exceptions.
@@ -1055,28 +1134,28 @@
});
}
-
+
protected void updateMarkersHard () {
-
- for(EObject obj : fMarkers2EObject.values()) {
- obj.eNotify(fMarkersStale);
+
+ for(EObject obj : this.fMarkers2EObject.values()) {
+ obj.eNotify(this.fMarkersStale);
}
-
- fMarkers2EObject.clear();
-
+
+ this.fMarkers2EObject.clear();
+
IMarker[] markers = null;
IFile file = getFileInput();
Resource resource = getProcess().eResource();
-
+
try {
- markers = file.findMarkers(null, true, IResource.DEPTH_ZERO);
+ markers = file.findMarkers(null, true, IResource.DEPTH_ZERO);
} catch (CoreException ex) {
BPELUIPlugin.log(ex);
return;
}
-
+
for (IMarker m : markers) {
-
+
String href = null;
EObject target = null;
try {
@@ -1085,24 +1164,24 @@
continue;
}
target = resource.getEObject(href);
- } catch (CoreException ex) {
+ } catch (CoreException ex) {
continue;
}
-
+
if (target == null) {
continue;
}
-
- fMarkers2EObject.put(m.getId(), target);
- target.eNotify( new NotificationImpl (AdapterNotification.NOTIFICATION_MARKER_ADDED , null, m ));
+
+ this.fMarkers2EObject.put(m.getId(), target);
+ target.eNotify( new NotificationImpl (AdapterNotification.NOTIFICATION_MARKER_ADDED , null, m ));
}
-
+
}
@Override
protected void pageChange(int newPageIndex) {
- currentPage = newPageIndex;
+ this.currentPage = newPageIndex;
super.pageChange(newPageIndex);
}
@@ -1124,7 +1203,7 @@
BPELUIPlugin.log(e);
}
}
-
+
/**
* The editor part name should be the same as the one appearing in the logical view.
*/
@@ -1133,46 +1212,46 @@
}
public void modelMarkersChanged ( ResourceInfo resourceInfo , IMarkerDelta [] markerDelta ) {
-
+
Resource resource = resourceInfo.getResource();
-
+
for ( IMarkerDelta delta : markerDelta ) {
-
+
String href = (String) delta.getAttribute( "address.model" ); //$NON-NLS-1$
if (href == null) {
continue;
}
-
+
EObject target = null;
-
+
switch (delta.getKind()) {
case IResourceDelta.ADDED :
target = resource.getEObject(href);
if (target != null) {
- fMarkers2EObject.put(delta.getId(),target);
+ this.fMarkers2EObject.put(delta.getId(),target);
target.eNotify( new NotificationImpl(AdapterNotification.NOTIFICATION_MARKER_ADDED,null,delta.getMarker() ));
}
break;
case IResourceDelta.CHANGED :
- target = fMarkers2EObject.remove(delta.getId());
+ target = this.fMarkers2EObject.remove(delta.getId());
if (target != null) {
target.eNotify( new NotificationImpl(AdapterNotification.NOTIFICATION_MARKER_CHANGED,delta.getMarker(),null));
}
break;
case IResourceDelta.REMOVED :
- target = fMarkers2EObject.remove(delta.getId());
+ target = this.fMarkers2EObject.remove(delta.getId());
if (target != null) {
target.eNotify( new NotificationImpl(AdapterNotification.NOTIFICATION_MARKER_DELETED,delta.getMarker(),null));
}
- break;
+ break;
}
-
+
}
}
@Override
public boolean isDirty() {
- return fTextEditor.isDirty() || fDesignViewer.isDirty();
+ return this.fTextEditor.isDirty();
}
@Override
Modified: trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/ScrollingBPELGraphicalViewer.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/ScrollingBPELGraphicalViewer.java 2009-12-02 07:03:21 UTC (rev 18965)
+++ trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/ScrollingBPELGraphicalViewer.java 2009-12-02 07:41:35 UTC (rev 18966)
@@ -15,10 +15,10 @@
import java.util.HashMap;
import java.util.List;
+import org.eclipse.bpel.model.util.BPELUtils;
import org.eclipse.bpel.ui.editparts.ProcessEditPart;
import org.eclipse.bpel.ui.util.BPELUtil;
import org.eclipse.bpel.ui.util.IModelVisitor;
-import org.eclipse.bpel.ui.util.ModelHelper;
import org.eclipse.draw2d.FigureCanvas;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.Viewport;
@@ -95,7 +95,7 @@
if (selectionList.size() > 1){
indexVisit = 0;
orderMap = new HashMap<Object, Integer>();
- BPELUtil.visitModelDepthFirst(ModelHelper.getProcess(editpart.getModel()), new numeratorVisitor());
+ BPELUtil.visitModelDepthFirst(BPELUtils.getProcess(editpart.getModel()), new numeratorVisitor());
Comparator cmp = new OrderedSelectionComparator();
Collections.sort(selectionList, cmp);
StructuredSelection newSel = new StructuredSelection(selectionList);
Modified: trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/commands/DeleteChildCommand.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/commands/DeleteChildCommand.java 2009-12-02 07:03:21 UTC (rev 18965)
+++ trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/commands/DeleteChildCommand.java 2009-12-02 07:41:35 UTC (rev 18966)
@@ -24,6 +24,7 @@
import org.eclipse.bpel.model.PartnerLink;
import org.eclipse.bpel.model.Process;
import org.eclipse.bpel.model.partnerlinktype.PartnerLinkType;
+import org.eclipse.bpel.model.util.BPELUtils;
import org.eclipse.bpel.ui.BPELEditor;
import org.eclipse.bpel.ui.Messages;
import org.eclipse.bpel.ui.adapters.IContainer;
@@ -114,7 +115,7 @@
@Override
public Resource[] getResources() {
if (resourcesToModify == null) {
- Process process = ModelHelper.getProcess(fParent);
+ Process process = BPELUtils.getProcess(fParent);
if (process == null)
return EMPTY_RESOURCE_ARRAY;
BPELEditor bpelEditor = ModelHelper.getBPELEditor(process);
@@ -164,7 +165,7 @@
throw new IllegalStateException();
}
- Process process = ModelHelper.getProcess(fParent);
+ Process process = BPELUtils.getProcess(fParent);
if (process == null)
return;
BPELEditor bpelEditor = ModelHelper.getBPELEditor(process);
Modified: trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/commands/RemoveImportCommand.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/commands/RemoveImportCommand.java 2009-12-02 07:03:21 UTC (rev 18965)
+++ trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/commands/RemoveImportCommand.java 2009-12-02 07:41:35 UTC (rev 18966)
@@ -12,6 +12,7 @@
import java.util.List;
+import org.eclipse.bpel.model.util.BPELUtils;
import org.eclipse.bpel.ui.util.ModelHelper;
import org.eclipse.emf.ecore.EObject;
@@ -38,7 +39,7 @@
*/
@Override
protected List getList() {
- return ModelHelper.getProcess( target ).getImports();
+ return BPELUtils.getProcess( target ).getImports();
}
}
Modified: trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/commands/RevalidateLinksCommand.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/commands/RevalidateLinksCommand.java 2009-12-02 07:03:21 UTC (rev 18965)
+++ trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/commands/RevalidateLinksCommand.java 2009-12-02 07:41:35 UTC (rev 18966)
@@ -23,6 +23,7 @@
import org.eclipse.bpel.model.Sources;
import org.eclipse.bpel.model.Target;
import org.eclipse.bpel.model.Targets;
+import org.eclipse.bpel.model.util.BPELUtils;
import org.eclipse.bpel.ui.commands.util.AutoUndoCommand;
import org.eclipse.bpel.ui.util.FlowLinkUtil;
import org.eclipse.bpel.ui.util.ModelHelper;
@@ -47,7 +48,7 @@
this.activities = new ArrayList(activityCollection.size());
this.activities.addAll(activityCollection);
if (!activityCollection.isEmpty()) {
- addModelRoot(ModelHelper.getProcess(activityCollection.iterator().next()));
+ addModelRoot(BPELUtils.getProcess(activityCollection.iterator().next()));
}
}
Modified: trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/BrowseSelectorDialog.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/BrowseSelectorDialog.java 2009-12-02 07:03:21 UTC (rev 18965)
+++ trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/BrowseSelectorDialog.java 2009-12-02 07:41:35 UTC (rev 18966)
@@ -212,7 +212,7 @@
}
// define the prefix
- BPELUtils.setPrefix( ModelHelper.getProcess(modelObject), targetNamespace, dialog.getPrefix());
+ BPELUtils.setPrefix( BPELUtils.getProcess(modelObject), targetNamespace, dialog.getPrefix());
return true;
}
@@ -295,7 +295,7 @@
}
}
- AddImportCommand cmd = new AddImportCommand(ModelHelper
+ AddImportCommand cmd = new AddImportCommand(BPELUtils
.getProcess(modelObject), obj);
if (cmd.canDoExecute() && cmd.wouldCreateDuplicateImport() == false) {
Modified: trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/PartnerLinkSelectorDialog.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/PartnerLinkSelectorDialog.java 2009-12-02 07:03:21 UTC (rev 18965)
+++ trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/PartnerLinkSelectorDialog.java 2009-12-02 07:41:35 UTC (rev 18966)
@@ -26,6 +26,7 @@
import org.eclipse.bpel.model.partnerlinktype.PartnerLinkType;
import org.eclipse.bpel.model.partnerlinktype.PartnerlinktypeFactory;
import org.eclipse.bpel.model.partnerlinktype.Role;
+import org.eclipse.bpel.model.util.BPELUtils;
import org.eclipse.bpel.ui.Messages;
import org.eclipse.bpel.ui.commands.CompoundCommand;
import org.eclipse.bpel.ui.commands.InsertInContainerCommand;
@@ -131,7 +132,7 @@
@Override
protected void handleNewButtonPushed() {
PartnerLink partner = BPELFactory.eINSTANCE.createPartnerLink();
- Process process = ModelHelper.getProcess(modelObject);
+ Process process = BPELUtils.getProcess(modelObject);
String newName = filterText.getText();
newName = BPELUtil.generateUniqueModelName(process, newName, partner);
NameDialog nameDialog = new NameDialog(getShell(), Messages.PartnerLinkSelectorDialog_5, Messages.PartnerLinkSelectorDialog_6,
Modified: trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/PartnerLinkTypeSelectorDialog.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/PartnerLinkTypeSelectorDialog.java 2009-12-02 07:03:21 UTC (rev 18965)
+++ trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/PartnerLinkTypeSelectorDialog.java 2009-12-02 07:41:35 UTC (rev 18966)
@@ -238,7 +238,7 @@
}
// define the prefix
- BPELUtils.setPrefix(ModelHelper.getProcess(modelObject), targetNamespace, dialog.getPrefix());
+ BPELUtils.setPrefix(BPELUtils.getProcess(modelObject), targetNamespace, dialog.getPrefix());
return true;
}
Modified: trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/PropertySelectorDialog.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/PropertySelectorDialog.java 2009-12-02 07:03:21 UTC (rev 18965)
+++ trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/PropertySelectorDialog.java 2009-12-02 07:41:35 UTC (rev 18966)
@@ -16,6 +16,7 @@
import org.eclipse.bpel.model.CorrelationSet;
import org.eclipse.bpel.model.Process;
import org.eclipse.bpel.model.messageproperties.Property;
+import org.eclipse.bpel.model.util.BPELUtils;
import org.eclipse.bpel.ui.BPELEditor;
import org.eclipse.bpel.ui.Messages;
import org.eclipse.bpel.ui.properties.PropertiesLabelProvider;
@@ -80,7 +81,7 @@
* Finds all available properties from this process and the artifacts WSDL.
*/
protected void refreshProperties() {
- Process process = ModelHelper.getProcess(correlationSet);
+ Process process = BPELUtils.getProcess(correlationSet);
Set properties = ModelHelper.getAvailableProperties(process);
// remove properties from the current correlation set
@@ -103,7 +104,7 @@
@Override
protected void handleNewButtonPushed() {
- Process process = ModelHelper.getProcess(correlationSet);
+ Process process = BPELUtils.getProcess(correlationSet);
BPELEditor bpelEditor = ModelHelper.getBPELEditor(process);
String newName = filterText.getText();
EditMessagePropertyDialog dialog = new EditMessagePropertyDialog(getShell(), null, newName, bpelEditor, wf);
Modified: trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/TypeSelectorDialog.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/TypeSelectorDialog.java 2009-12-02 07:03:21 UTC (rev 18965)
+++ trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/TypeSelectorDialog.java 2009-12-02 07:41:35 UTC (rev 18966)
@@ -284,7 +284,7 @@
}
// define the prefix
- BPELUtils.setPrefix( ModelHelper.getProcess(modelObject), targetNamespace, dialog.getPrefix());
+ BPELUtils.setPrefix( BPELUtils.getProcess(modelObject), targetNamespace, dialog.getPrefix());
return true;
}
Modified: trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/VariableSelectorDialog.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/VariableSelectorDialog.java 2009-12-02 07:03:21 UTC (rev 18965)
+++ trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/VariableSelectorDialog.java 2009-12-02 07:41:35 UTC (rev 18966)
@@ -19,6 +19,7 @@
import org.eclipse.bpel.model.BPELFactory;
import org.eclipse.bpel.model.Process;
import org.eclipse.bpel.model.Variable;
+import org.eclipse.bpel.model.util.BPELUtils;
import org.eclipse.bpel.ui.Messages;
import org.eclipse.bpel.ui.commands.CompoundCommand;
import org.eclipse.bpel.ui.commands.InsertInContainerCommand;
@@ -151,7 +152,7 @@
@Override
protected void handleNewButtonPushed() {
Variable variable = BPELFactory.eINSTANCE.createVariable();
- Process process = ModelHelper.getProcess(modelObject);
+ Process process = BPELUtils.getProcess(modelObject);
String newName = filterText.getText();
newName = BPELUtil.generateUniqueModelName(process, newName, variable);
NameDialog nameDialog = new NameDialog(getShell(), Messages.VariableSelectorDialog_New_Variable_4, Messages.VariableSelectorDialog_Variable_Name_5,
Modified: trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/editparts/policies/BPELGraphicalEditPolicy.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/editparts/policies/BPELGraphicalEditPolicy.java 2009-12-02 07:03:21 UTC (rev 18965)
+++ trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/editparts/policies/BPELGraphicalEditPolicy.java 2009-12-02 07:41:35 UTC (rev 18966)
@@ -24,6 +24,7 @@
import org.eclipse.bpel.model.Source;
import org.eclipse.bpel.model.Target;
import org.eclipse.bpel.model.Variable;
+import org.eclipse.bpel.model.util.BPELUtils;
import org.eclipse.bpel.ui.BPELLinkCreationFactory;
import org.eclipse.bpel.ui.BPELUIPlugin;
import org.eclipse.bpel.ui.IBPELUIConstants;
@@ -93,7 +94,7 @@
Target target = BPELFactory.eINSTANCE.createTarget();
link.getSources().add(source);
link.getTargets().add(target);
- Process process = ModelHelper.getProcess(activity);
+ Process process = BPELUtils.getProcess(activity);
AddLinkCommand command = new AddLinkCommand(createSetNameCommand(link, process), process);
command.setLink(link);
command.setSource(activity);
@@ -218,7 +219,7 @@
protected Command getReconnectTargetCommand(ReconnectRequest request) {
Activity activity = getActivity();
Link link = (Link)request.getConnectionEditPart().getModel();
- Process process = ModelHelper.getProcess(activity);
+ Process process = BPELUtils.getProcess(activity);
AddLinkCommand cmd = new AddLinkCommand(createSetNameCommand(link, process), process);
cmd.setLink(link);
@@ -235,7 +236,7 @@
protected Command getReconnectSourceCommand(ReconnectRequest request) {
Activity activity = getActivity();
Link link = (Link)request.getConnectionEditPart().getModel();
- Process process = ModelHelper.getProcess(activity);
+ Process process = BPELUtils.getProcess(activity);
AddLinkCommand cmd = new AddLinkCommand(createSetNameCommand(link, process), process);
cmd.setLink(link);
Modified: trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/FaultCatchNameSection.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/FaultCatchNameSection.java 2009-12-02 07:03:21 UTC (rev 18965)
+++ trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/FaultCatchNameSection.java 2009-12-02 07:41:35 UTC (rev 18966)
@@ -47,6 +47,7 @@
import org.eclipse.bpel.model.While;
import org.eclipse.bpel.model.partnerlinktype.Role;
import org.eclipse.bpel.model.util.BPELConstants;
+import org.eclipse.bpel.model.util.BPELUtils;
import org.eclipse.bpel.ui.IBPELUIConstants;
import org.eclipse.bpel.ui.IHelpContextIds;
import org.eclipse.bpel.ui.Messages;
@@ -835,7 +836,7 @@
faultNameQNames = new Vector<QName>();
if (getInput() == null)
throw new IllegalStateException();
- Process p = ModelHelper.getProcess(getInput());
+ Process p = BPELUtils.getProcess(getInput());
// get FaultNames from activities
getFaultNames(p.getActivity());
Modified: trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/ImportsSection.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/ImportsSection.java 2009-12-02 07:03:21 UTC (rev 18965)
+++ trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/ImportsSection.java 2009-12-02 07:41:35 UTC (rev 18966)
@@ -17,6 +17,7 @@
import org.eclipse.bpel.common.ui.flatui.FlatFormData;
import org.eclipse.bpel.model.Import;
import org.eclipse.bpel.model.Process;
+import org.eclipse.bpel.model.util.BPELUtils;
import org.eclipse.bpel.ui.IBPELUIConstants;
import org.eclipse.bpel.ui.IHelpContextIds;
import org.eclipse.bpel.ui.Messages;
@@ -26,7 +27,6 @@
import org.eclipse.bpel.ui.details.providers.ImportContentProvider;
import org.eclipse.bpel.ui.dialogs.SchemaImportDialog;
import org.eclipse.bpel.ui.util.BPELUtil;
-import org.eclipse.bpel.ui.util.ModelHelper;
import org.eclipse.bpel.ui.util.MultiObjectAdapter;
import org.eclipse.bpel.ui.util.NamespaceUtils;
import org.eclipse.bpel.ui.util.TableCursor;
@@ -79,9 +79,9 @@
}
/**
- * Override the super-class because the input is Process not Import
+ * Bug 290085 - Override the super-class because the input is Process not Import
* If use super-class's directly, when change the import attributes
- * the properties section do not change.
+ * the properties section do not change. Grid Qian
*/
@Override
protected void addAllAdapters() {
@@ -179,8 +179,8 @@
importLabel.setLayoutData(data);
// create table
- importTable = fWidgetFactory.createTable(parent, SWT.FULL_SELECTION
- | SWT.V_SCROLL | SWT.READ_ONLY);
+ importTable = fWidgetFactory.createTable(parent, SWT.FULL_SELECTION | SWT.V_SCROLL
+ | SWT.READ_ONLY);
data = new FlatFormData();
data.left = new FlatFormAttachment(0, IDetailsAreaConstants.HSPACE);
@@ -194,7 +194,7 @@
// set up table
importTable.setLinesVisible(true);
importTable.setHeaderVisible(true);
-
+
tableProvider = new ColumnTableProvider();
tableProvider.add(new LocationColumn());
tableProvider.add(new NamespaceColumn());
@@ -230,7 +230,7 @@
@Override
public String getProperty() {
return "Namespace"; //$NON-NLS-1$
- }
+ }
@Override
public int getInitialWeight() {
@@ -288,15 +288,18 @@
return (s == null) ? "" : s; //$NON-NLS-1$
}
}
+
+
@Override
- protected void basicSetInput(EObject newInput) {
+ protected void basicSetInput(EObject newInput) {
super.basicSetInput(newInput);
-
+
if (getInput() != null) {
importViewer.setInput(getInput());
}
}
+
@Override
protected void createClient(Composite parent) {
@@ -321,29 +324,30 @@
}
}
- void removeImport() {
-
+ void removeImport () {
+
ISelection selection = importViewer.getSelection();
if (selection.isEmpty()) {
- return;
+ return ;
}
IStructuredSelection ssel = null;
- if ((selection instanceof IStructuredSelection) == false) {
+ if ( (selection instanceof IStructuredSelection) == false) {
return;
}
-
- ssel = (IStructuredSelection) selection;
+
+ ssel = (IStructuredSelection) selection;
Object obj = ssel.getFirstElement();
-
- RemoveImportCommand cmd = new RemoveImportCommand(ModelHelper
- .getProcess(getInput()), obj,
+
+ RemoveImportCommand cmd = new RemoveImportCommand (
+ BPELUtils.getProcess( getInput() ),
+ obj,
IBPELUIConstants.CMD_REMOVE_IMPORT);
-
+
if (cmd.canDoExecute()) {
- getCommandFramework().execute(cmd);
+ getCommandFramework().execute( cmd );
}
}
-
+
void browseAndImportWSDL() {
SchemaImportDialog dialog = new SchemaImportDialog(importLabel
@@ -357,7 +361,7 @@
return;
}
- AddImportCommand cmd = new AddImportCommand(ModelHelper
+ AddImportCommand cmd = new AddImportCommand(BPELUtils
.getProcess(getInput()), result[0]);
if (cmd.canDoExecute() && cmd.wouldCreateDuplicateImport() == false) {
getCommandFramework().execute(cmd);
@@ -377,26 +381,31 @@
return;
}
- AddImportCommand cmd = new AddImportCommand(ModelHelper
+ AddImportCommand cmd = new AddImportCommand(BPELUtils
.getProcess(getInput()), result[0]);
if (cmd.canDoExecute() && cmd.wouldCreateDuplicateImport() == false) {
getCommandFramework().execute(cmd);
}
}
+
+
@Override
public void gotoMarker(IMarker marker) {
// TODO Auto-generated method stub
super.gotoMarker(marker);
}
-
+
/**
*
*/
+
@Override
public boolean isValidMarker(IMarker marker) {
return super.isValidMarker(marker);
}
+
+
}
Modified: trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/InvokeImplSection.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/InvokeImplSection.java 2009-12-02 07:03:21 UTC (rev 18965)
+++ trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/InvokeImplSection.java 2009-12-02 07:41:35 UTC (rev 18966)
@@ -30,6 +30,7 @@
import org.eclipse.bpel.model.Variables;
import org.eclipse.bpel.model.partnerlinktype.PartnerLinkType;
import org.eclipse.bpel.model.partnerlinktype.Role;
+import org.eclipse.bpel.model.util.BPELUtils;
import org.eclipse.bpel.ui.BPELUIPlugin;
import org.eclipse.bpel.ui.IHelpContextIds;
import org.eclipse.bpel.ui.Messages;
@@ -311,7 +312,7 @@
return Messages.InvokeImplSection_0;
}
public void run() {
- createPartnerLink ( ModelHelper.getProcess( getInput () ) , null );
+ createPartnerLink ( BPELUtils.getProcess( getInput () ) , null );
}
};
Modified: trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/InvokeVariableSection.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/InvokeVariableSection.java 2009-12-02 07:03:21 UTC (rev 18965)
+++ trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/InvokeVariableSection.java 2009-12-02 07:41:35 UTC (rev 18966)
@@ -30,6 +30,7 @@
import org.eclipse.bpel.model.ToPart;
import org.eclipse.bpel.model.ToParts;
import org.eclipse.bpel.model.Variable;
+import org.eclipse.bpel.model.util.BPELUtils;
import org.eclipse.bpel.ui.IBPELUIConstants;
import org.eclipse.bpel.ui.Messages;
import org.eclipse.bpel.ui.commands.AddFromPartCommand;
@@ -281,7 +282,7 @@
}
public void run() {
- createVariable(ModelHelper.getProcess(getInput()), null,
+ createVariable(BPELUtils.getProcess(getInput()), null,
isInvoke() ? ModelHelper.OUTGOING
: ModelHelper.INCOMING);
}
@@ -445,7 +446,7 @@
}
public void run() {
- createVariable(ModelHelper.getProcess(getInput()), null,
+ createVariable(BPELUtils.getProcess(getInput()), null,
isInvoke() ? ModelHelper.INCOMING
: ModelHelper.OUTGOING);
}
@@ -671,7 +672,7 @@
}
public void run() {
- createVariableForPartMapping(ModelHelper.getProcess(model),
+ createVariableForPartMapping(BPELUtils.getProcess(model),
model, part, isFromParts);
}
Modified: trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/MessageExchangeSection.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/MessageExchangeSection.java 2009-12-02 07:03:21 UTC (rev 18965)
+++ trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/MessageExchangeSection.java 2009-12-02 07:41:35 UTC (rev 18966)
@@ -19,6 +19,7 @@
import org.eclipse.bpel.common.ui.flatui.FlatFormData;
import org.eclipse.bpel.model.BPELFactory;
import org.eclipse.bpel.model.MessageExchange;
+import org.eclipse.bpel.model.util.BPELUtils;
import org.eclipse.bpel.ui.BPELUIPlugin;
import org.eclipse.bpel.ui.IBPELUIConstants;
import org.eclipse.bpel.ui.IHelpContextIds;
@@ -133,7 +134,7 @@
return Messages.MessageExchangeImplSection_Create_Global;
}
public void run() {
- createMessageExchange ( ModelHelper.getProcess( getInput () ) , null );
+ createMessageExchange ( BPELUtils.getProcess( getInput () ) , null );
}
};
Modified: trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/util/ModelHelper.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/util/ModelHelper.java 2009-12-02 07:03:21 UTC (rev 18965)
+++ trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/util/ModelHelper.java 2009-12-02 07:41:35 UTC (rev 18966)
@@ -69,6 +69,7 @@
import org.eclipse.bpel.model.partnerlinktype.PartnerlinktypeFactory;
import org.eclipse.bpel.model.partnerlinktype.PartnerlinktypePackage;
import org.eclipse.bpel.model.partnerlinktype.Role;
+import org.eclipse.bpel.model.util.BPELUtils;
import org.eclipse.bpel.model.util.ImportResolver;
import org.eclipse.bpel.model.util.ImportResolverRegistry;
import org.eclipse.bpel.ui.BPELEditor;
@@ -1201,23 +1202,23 @@
return null;
}
- /**
- * Returns the root process for any model object
- **/
- public static Process getProcess(Object object) {
- if (object instanceof EObject) {
- // check if *this* is already the process object
- if (object instanceof Process)
- return (Process)object;
- EObject cont = ((EObject)object).eContainer();
- while (cont != null) {
- if (cont.eClass() == BPELPackage.eINSTANCE.getProcess())
- return (Process)cont;
- cont = cont.eContainer();
- }
- }
- return null;
- }
+// /**
+// * Returns the root process for any model object
+// **/
+// public static Process getProcess(Object object) {
+// if (object instanceof EObject) {
+// // check if *this* is already the process object
+// if (object instanceof Process)
+// return (Process)object;
+// EObject cont = ((EObject)object).eContainer();
+// while (cont != null) {
+// if (cont.eClass() == BPELPackage.eINSTANCE.getProcess())
+// return (Process)cont;
+// cont = cont.eContainer();
+// }
+// }
+// return null;
+// }
/**
* Checks to see if an object is contained by a specified parent
@@ -1248,8 +1249,10 @@
public static void setLocation(Activity activity, Point pos) {
ActivityExtension extension = (ActivityExtension)getExtension(activity);
- extension.setX(pos.x);
- extension.setY(pos.y);
+ if (extension != null) {
+ extension.setX(pos.x);
+ extension.setY(pos.y);
+ }
}
public static Point getLocation(Activity activity) {
@@ -1425,7 +1428,7 @@
* Given a model object returns whether the process is supposed to be spec-compliant.
*/
public static boolean isSpecCompliant(EObject model) {
- return ((ProcessExtension)getExtension(getProcess(model))).isSpecCompliant();
+ return ((ProcessExtension)getExtension(BPELUtils.getProcess(model))).isSpecCompliant();
}
public static boolean isReferencePartnerLink(PartnerLink partner) {
@@ -1518,7 +1521,7 @@
ArrayList al = new ArrayList(8);
// Try the BPEL imports if any exist.
- Process process = getProcess(context);
+ Process process = BPELUtils.getProcess(context);
if (process == null) {
return al;
}
@@ -1556,7 +1559,7 @@
ArrayList<Definition> al = new ArrayList<Definition>(8);
// Try the BPEL imports if any exist.
- Process process = getProcess( context );
+ Process process = BPELUtils.getProcess( context );
if (process == null) {
return al;
}
@@ -1594,7 +1597,7 @@
*/
public static boolean containsImport (Object modelObject, Import imp) {
- Process process = getProcess(modelObject);
+ Process process = BPELUtils.getProcess(modelObject);
if (process == null) {
return false;
}
Modified: trunk/bpel/plugins/org.eclipse.bpel.wsil.model/META-INF/MANIFEST.MF
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.wsil.model/META-INF/MANIFEST.MF 2009-12-02 07:03:21 UTC (rev 18965)
+++ trunk/bpel/plugins/org.eclipse.bpel.wsil.model/META-INF/MANIFEST.MF 2009-12-02 07:41:35 UTC (rev 18966)
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: WSIL Model (Incubation)
Bundle-SymbolicName: org.eclipse.bpel.wsil.model; singleton:=true
-Bundle-Version: 0.4.0.qualifier
+Bundle-Version: 0.5.0
Bundle-ClassPath: bin
Bundle-Vendor: eclispe.org
Bundle-Localization: plugin
@@ -26,5 +26,5 @@
org.eclipse.bpel.wsil.model.inspection"
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)",
org.eclipse.emf.ecore.xmi;bundle-version="[2.4.0,3.0.0)";visibility:=reexport
-Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Eclipse-LazyStart: true
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
15 years, 3 months
JBoss Tools SVN: r18965 - trunk/vpe/features/org.jboss.tools.xulrunner.feature.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2009-12-02 02:03:21 -0500 (Wed, 02 Dec 2009)
New Revision: 18965
Modified:
trunk/vpe/features/org.jboss.tools.xulrunner.feature/feature.xml
Log:
https://jira.jboss.org/jira/browse/JBIDE-4523 Visual Page Editor doesn't work with Eclipse 3.5 OSX Cocoa
feature update to include cocoa xulrunner plugin
Modified: trunk/vpe/features/org.jboss.tools.xulrunner.feature/feature.xml
===================================================================
--- trunk/vpe/features/org.jboss.tools.xulrunner.feature/feature.xml 2009-12-02 04:45:59 UTC (rev 18964)
+++ trunk/vpe/features/org.jboss.tools.xulrunner.feature/feature.xml 2009-12-02 07:03:21 UTC (rev 18965)
@@ -79,4 +79,13 @@
version="0.0.0"
unpack="false"/>
+ <plugin
+ id="org.mozilla.xulrunner.cocoa.macosx.x86"
+ os="macosx"
+ ws="cocoa"
+ arch="x86"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"/>
+
</feature>
15 years, 3 months
JBoss Tools SVN: r18964 - trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/resource.
by jbosstools-commits@lists.jboss.org
Author: Grid.Qian
Date: 2009-12-01 23:45:59 -0500 (Tue, 01 Dec 2009)
New Revision: 18964
Modified:
trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/resource/BPELResourceSetImpl.java
Log:
JBIDE-5348: Problem with importing remote WSIL/WSDL still exists.
Modified: trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/resource/BPELResourceSetImpl.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/resource/BPELResourceSetImpl.java 2009-12-02 03:08:21 UTC (rev 18963)
+++ trunk/bpel/plugins/org.eclipse.bpel.model/src/org/eclipse/bpel/model/resource/BPELResourceSetImpl.java 2009-12-02 04:45:59 UTC (rev 18964)
@@ -19,71 +19,73 @@
import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.IResourceChangeListener;
import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.URIConverter;
+import org.eclipse.emf.ecore.resource.impl.ResourceFactoryRegistryImpl;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+
/**
* @author Michal Chmielewski (michal.chmielewski(a)oracle.com)
* @date Apr 17, 2007
- *
+ *
*/
+
@SuppressWarnings("nls")
-public class BPELResourceSetImpl extends ResourceSetImpl implements
- IResourceChangeListener {
+public class BPELResourceSetImpl extends ResourceSetImpl implements IResourceChangeListener {
+
public BPELResourceSetImpl() {
super();
// FIX ME: This should not have dependency on running eclipse.
// IWorkspace workspace = ResourcesPlugin.getWorkspace();
- // workspace.addResourceChangeListener(this,
- // IResourceChangeEvent.POST_BUILD);
+ // workspace.addResourceChangeListener(this, IResourceChangeEvent.POST_BUILD);
}
/**
* Used to force loading using the right resource loaders.
*/
static public final String SLIGHTLY_HACKED_KEY = "slightly.hacked.resource.set";
-
+
+
+
/**
* Load the resource from the resource set, assuming that it is the kind
- * indicated by the last argument. The "kind" parameter is the extension
+ * indicated by the last argument. The "kind" parameter is the extension
* without the . of the resource.
*
- * This forces the right resource to be loaded even if the URI of the
- * resource is "wrong".
+ * This forces the right resource to be loaded even if the URI of the resource
+ * is "wrong".
*
- * @param uri
- * the URI of the resource.
- * @param loadOnDemand
- * load on demand
- * @param kind
- * the resource kind. It has to be of the form "*.wsdl", or
- * "*.xsd", or "*.bpel"
- * @return the loaded resource.
+ * @param uri the URI of the resource.
+ * @param loadOnDemand load on demand
+ * @param kind the resource kind. It has to be of the form "*.wsdl", or "*.xsd", or "*.bpel"
+ * @return the loaded resource.
*/
-
+
@SuppressWarnings("nls")
- public Resource getResource(URI uri, boolean loadOnDemand, String kind) {
+ public Resource getResource(URI uri, boolean loadOnDemand, String kind) {
Map<URI, Resource> map = getURIResourceMap();
-
+
if (map != null) {
Resource resource = map.get(uri);
if (resource != null) {
if (loadOnDemand && !resource.isLoaded()) {
demandLoadHelper(resource);
}
-
+
return resource;
}
}
URIConverter theURIConverter = getURIConverter();
URI normalizedURI = theURIConverter.normalize(uri);
-
+
for (Resource resource : getResources()) {
if (theURIConverter.normalize(resource.getURI()).equals(
normalizedURI)) {
@@ -95,17 +97,11 @@
map.put(uri, resource);
}
return resource;
- }
+ }
}
-
+
if (loadOnDemand) {
- Resource resource = null;
- if (!uri.toString().endsWith("?wsdl")) {
- resource = demandCreateResource(uri, kind);
- } else {
- resource = this.createResource(URI.createURI("*.wsdl"));
- resource.setURI(uri);
- }
+ Resource resource = demandCreateResource(uri,kind);
if (resource == null) {
throw new RuntimeException("Cannot create a resource for '"
+ uri + "'; a registered resource factory is needed");
@@ -121,123 +117,171 @@
return null;
}
+
+
+ protected Resource demandCreateResource ( URI uri, String kind ) {
+ return createResource ( uri, kind );
+ }
+
+ /*
+ * Fix for Bug 278205 - Problem with importing remote WSIL/WSDL still exists.
+ * Telesh Alexandr added this method to solve this which is to load remote WSIL/WSDL
+ * by the correct resource loader based on known before loading resouce
+ * extension which is posed as resource content type.
+ */
+ public Resource.Factory.Registry getResourceFactoryRegistry() {
+ if (resourceFactoryRegistry == null) {
- protected Resource demandCreateResource(URI uri, String kind) {
- return createResource(uri, kind);
+ resourceFactoryRegistry = new ResourceFactoryRegistryImpl() {
+ @Override
+ protected Resource.Factory delegatedGetFactory(URI uri, String contentTypeIdentifier) {
+ // patch for "wsil" and "wsdl" resources without extensions
+ final Map<String, Object> extensionToFactoryMap =
+ Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap();
+
+ final Object wsilFactory = extensionToFactoryMap.get("wsil");
+ final Object wsdlFactory = extensionToFactoryMap.get("wsdl");
+
+ final Map<String, Object> contentTypeToFactoryMap =
+ Resource.Factory.Registry.INSTANCE.getContentTypeToFactoryMap();
+
+ if (null != wsilFactory) {
+ contentTypeToFactoryMap.put("wsil", wsilFactory);
+ }
+ if (null != wsdlFactory) {
+ contentTypeToFactoryMap.put("wsdl", wsdlFactory);
+ }
+
+ return convert(getFactory(uri,
+ Resource.Factory.Registry.INSTANCE.getProtocolToFactoryMap(),
+ extensionToFactoryMap, contentTypeToFactoryMap,
+ contentTypeIdentifier, false));
+ }
+
+ @Override
+ protected URIConverter getURIConverter() {
+ // return ResourceSetImpl.this.getURIConverter();
+ return BPELResourceSetImpl.this.getURIConverter();
+ }
+
+ @Override
+ protected Map<?, ?> getContentDescriptionOptions() {
+ return getLoadOptions();
+ }
+ };
+ }
+ return resourceFactoryRegistry;
}
-
+
/**
* Create the resource based on the kind.
- *
* @param uri
* @param kind
* @return the created resource
*/
-
- // TODO: ganymede [ this method apparently is already in the parent resource
- // set ]
+
+ // TODO: ganymede [ this method apparently is already in the parent resource set ]
// we can strike it from this resourceset.
+
+// @SuppressWarnings("nls")
+// public Resource createResource ( URI uri, String kind) {
+//
+// if (kind == null) {
+// return super.createResource(uri);
+// }
+//
+// Resource resource = createResource(URI.createURI("*." + kind));
+// resource.setURI(uri);
+// return resource;
+// }
- // @SuppressWarnings("nls")
- // public Resource createResource ( URI uri, String kind) {
- //
- // if (kind == null) {
- // return super.createResource(uri);
- // }
- //
- // Resource resource = createResource(URI.createURI("*." + kind));
- // resource.setURI(uri);
- // return resource;
- // }
+
+
+
+
/**
* @see org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org.eclipse.core.resources.IResourceChangeEvent)
*/
- public void resourceChanged(IResourceChangeEvent event) {
-
- // System.out.println("IResourceChangeEvent: " + event + "; " +
- // event.getType() );
- IResourceDelta[] deltas = event.getDelta()
- .getAffectedChildren(
- IResourceDelta.CHANGED | IResourceDelta.REMOVED,
- IResource.FILE);
- processDeltas(deltas);
+ public void resourceChanged (IResourceChangeEvent event) {
+
+ // System.out.println("IResourceChangeEvent: " + event + "; " + event.getType() );
+ IResourceDelta[] deltas = event.getDelta().getAffectedChildren( IResourceDelta.CHANGED | IResourceDelta.REMOVED, IResource.FILE );
+ processDeltas ( deltas );
}
-
- void processDeltas(IResourceDelta[] deltas) {
-
- for (IResourceDelta delta : deltas) {
- processDeltas(delta.getAffectedChildren(IResourceDelta.CHANGED
- | IResourceDelta.REMOVED, IResource.FILE));
-
+
+ void processDeltas ( IResourceDelta [] deltas ) {
+
+ for(IResourceDelta delta : deltas) {
+ processDeltas( delta.getAffectedChildren(IResourceDelta.CHANGED | IResourceDelta.REMOVED, IResource.FILE) );
+
IResource resource = delta.getResource();
- if (resource.getType() != IResource.FILE) {
+ if (resource.getType () != IResource.FILE) {
continue;
}
-
- if (delta.getKind() == IResourceDelta.REMOVED) {
- resourceChanged((IFile) resource);
+
+ if (delta.getKind() == IResourceDelta.REMOVED){
+ resourceChanged((IFile)resource);
continue;
}
-
- // * @see IResourceDelta#CONTENT
- // * @see IResourceDelta#DESCRIPTION
- // * @see IResourceDelta#ENCODING
- // * @see IResourceDelta#OPEN
- // * @see IResourceDelta#MOVED_TO
- // * @see IResourceDelta#MOVED_FROM
- // * @see IResourceDelta#TYPE
- // * @see IResourceDelta#SYNC
- // * @see IResourceDelta#MARKERS
- // * @see IResourceDelta#REPLACED
-
- if ((delta.getFlags() & IResourceDelta.CONTENT) == 0) {
+
+// * @see IResourceDelta#CONTENT
+// * @see IResourceDelta#DESCRIPTION
+// * @see IResourceDelta#ENCODING
+// * @see IResourceDelta#OPEN
+// * @see IResourceDelta#MOVED_TO
+// * @see IResourceDelta#MOVED_FROM
+// * @see IResourceDelta#TYPE
+// * @see IResourceDelta#SYNC
+// * @see IResourceDelta#MARKERS
+// * @see IResourceDelta#REPLACED
+
+ if ((delta.getFlags() & IResourceDelta.CONTENT) == 0){
continue;
}
-
+
// TODO: Temporary hack
// Actually we should remove all resources from the resourceSet,
// but for some reasons bpel files can't be removed now
- if ("bpel".equals(((IFile) resource).getFileExtension())) {
+ if ("bpel".equals(((IFile) resource).getFileExtension())){
continue;
}
-
+
resourceChanged((IFile) resource);
- }
+ }
}
-
- public void setLoadOptions(Map<Object, Object> options) {
+
+ public void setLoadOptions (Map<Object, Object> options) {
loadOptions = options;
}
-
+
/**
- * Resource has changed, remove it from the cache or list of loaded
- * resources.
+ * Resource has changed, remove it from the cache or list of loaded resources.
*
* @param file
*/
- public void resourceChanged(IFile file) {
- // System.out.println("ResourceChanged: " + file );
- URI uri = URI.createPlatformResourceURI(file.getFullPath().toString());
- // System.out.println(" ResourceURI: " + uri );
+ public void resourceChanged (IFile file) {
+ // System.out.println("ResourceChanged: " + file );
+ URI uri = URI.createPlatformResourceURI( file.getFullPath().toString() ) ;
+ // System.out.println(" ResourceURI: " + uri );
URIConverter theURIConverter = getURIConverter();
URI normalizedURI = theURIConverter.normalize(uri);
-
+
if (uriResourceMap != null) {
uriResourceMap.remove(uri);
uriResourceMap.remove(normalizedURI);
// System.out.println("Removed from Map: " + map );
}
-
+
List<Resource> resourceList = getResources();
if (resources.size() < 1) {
- return;
+ return ;
}
-
- for (Resource r : new ArrayList<Resource>(resourceList)) {
- if (uri.equals(r.getURI()) || normalizedURI.equals(r.getURI())) {
+
+ for(Resource r : new ArrayList<Resource>(resourceList) ) {
+ if (uri.equals(r.getURI()) || normalizedURI.equals(r.getURI() )) {
resources.remove(r);
- // System.out.println("Removed from List: " + r );
+ // System.out.println("Removed from List: " + r );
}
}
}
15 years, 3 months
JBoss Tools SVN: r18963 - trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs.
by jbosstools-commits@lists.jboss.org
Author: Grid.Qian
Date: 2009-12-01 22:08:21 -0500 (Tue, 01 Dec 2009)
New Revision: 18963
Modified:
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/BrowseSelectorDialog.java
Log:
JBIDE-5347: Accessing Variables w/o Namespace in Variablepicker
Modified: trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/BrowseSelectorDialog.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/BrowseSelectorDialog.java 2009-12-02 02:13:10 UTC (rev 18962)
+++ trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/BrowseSelectorDialog.java 2009-12-02 03:08:21 UTC (rev 18963)
@@ -165,7 +165,7 @@
computeResult();
Object obj[] = getResult();
- if (obj != null && obj.length > 0) {
+ if (obj != null || obj.length > 0) {
if (ensureXSDTypeNamespaceMappings ( obj[0] ) == false) {
return ;
}
@@ -285,9 +285,13 @@
// Do not import schema for schemas
if (obj instanceof XSDSimpleTypeDefinition) {
- if (((XSDSimpleTypeDefinition) obj).getTargetNamespace().equals(
- XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001)) {
- return false;
+
+ String targetNamespace = ((XSDSimpleTypeDefinition) obj).getTargetNamespace();
+ if (targetNamespace != null) {
+ if (((XSDSimpleTypeDefinition) obj).getTargetNamespace().equals(
+ XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001)) {
+ return false;
+ }
}
}
@@ -576,13 +580,11 @@
fFilteredList.setEnabled(true);
fFilteredList.setAllowDuplicates(showDuplicates);
- fFilteredList.setElements( contentProvider.getElements( fProjectObjects ) );
- // add by Grid.Qian
- // update the fTreeViewer because for now the fTreeViewer's input is null
- if (contentProvider.getElements( fProjectObjects ) != null &&
- contentProvider.getElements( fProjectObjects ).length > 0) {
+ fFilteredList.setElements( contentProvider.getElements( fProjectObjects ) );
+
+ if (contentProvider.getElements( fProjectObjects ) != null && contentProvider.getElements( fProjectObjects ).length > 0) {
updateLowerViewWidget(fFilteredList.getSelection());
- }
+ }
}
}
@@ -644,7 +646,7 @@
protected void handleEmptyList() {
fTreeViewer.setInput ( null );
- // added by Grid.Qian
+ // Buzilla 290348 - added by Grid.Qian
// the tree view's input is null, but the selection maybe not 0
// for example the input is a list and we select a element, then
// set the input = null, this time, the selection is not 0
15 years, 3 months
JBoss Tools SVN: r18962 - trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2009-12-01 21:13:10 -0500 (Tue, 01 Dec 2009)
New Revision: 18962
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java
Log:
fix for compilation errors in build because several constants are missing in IDELabel
Modified: trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java 2009-12-02 01:52:46 UTC (rev 18961)
+++ trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java 2009-12-02 02:13:10 UTC (rev 18962)
@@ -36,6 +36,8 @@
public static final String JSP_FILE = "JSP...";
public static final String PROPERTIES = "Properties";
public static final String XHTML_FILE = "XHTML...";
+ public static final String HELP = "Help";
+ public static final String ABOUT_JBOSS_DEVELOPER_STUDIO = "About JBoss Developer Studio";
}
public class Button {
15 years, 3 months
JBoss Tools SVN: r18961 - trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2009-12-01 20:52:46 -0500 (Tue, 01 Dec 2009)
New Revision: 18961
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java
Log:
fix for compilation errors in build because several constants are missing in IDELabel
Modified: trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java 2009-12-01 23:32:31 UTC (rev 18960)
+++ trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java 2009-12-02 01:52:46 UTC (rev 18961)
@@ -30,6 +30,12 @@
public static final String TEXT_EDITOR = "Text Editor";
public static final String EDIT = "Edit";
public static final String SELECT_ALL = "Select All";
+ public static final String CLOSE = "Close";
+ public static final String OPEN = "Open";
+ public static final String RENAME = "Rename";
+ public static final String JSP_FILE = "JSP...";
+ public static final String PROPERTIES = "Properties";
+ public static final String XHTML_FILE = "XHTML...";
}
public class Button {
@@ -38,6 +44,9 @@
public static final String CANCEL = "Cancel";
public static final String FINISH = "Finish";
public static final String OK = "OK";
+ public static final String YES = "Yes";
+ public static final String NO = "No";
+ public static final String CLOSE = "Close";
}
public class Shell {
@@ -45,6 +54,11 @@
public static final String NEW_JAVA_CLASS = "New Java Class";
public static final String NEW_HIBERNATE_MAPPING_FILE = "New Hibernate XML Mapping file (hbm.xml)";
public static final String NEW = "New";
+ public static final String SAVE_RESOURCE = "Save";
+ public static final String RENAME_RESOURCE = "Rename";
+ public static final String NEW_JSP_FILE = "New JSP File";
+ public static final String PROPERTIES = "Properties";
+ public static final String NEW_XHTML_FILE = "New File XHTML";
}
public class EntityGroup {
@@ -120,4 +134,42 @@
public class HBConfigurationWizard {
public static final String FILE_NAME = "File name:";
}
+
+ public static class RenameResourceDialog {
+
+ public static final String NEW_NAME = "Rename Resource";
+
+ }
+
+ public static class WebProjectsTree {
+
+ public static final String WEB_CONTENT = "WebContent";
+ public static final String CONFIGURATION = "Configuration";
+ public static final String WEB_XML = "web.xml";
+ public static final String CONTEXT_PARAMS = "Context Params";
+ public static final String JAVAX_FACES_CONFIG_FILES = "javax.faces.CONFIG_FILES";
+
+ }
+
+ public static class NewJSPFileDialog {
+
+ public static final String NAME = "New File JSP";
+ public static final String TEMPLATE = "Template";
+ public static final String TEMPLATE_JSF_BASE_PAGE = "JSFBasePage";
+
+ }
+
+ public static class PropertiesDialog {
+
+ public static final String PARAM_VALUE = "Param-Value";
+
+ }
+
+ public static final class NewXHTMLFileDialog {
+
+ public static final String NAME = "New XHTML";
+ public static final String TEMPLATE = "Template";
+ public static final String TEMPLATE_FACELET_FORM_XHTML = "FaceletForm.xhtml";
+
+ }
}
15 years, 3 months
JBoss Tools SVN: r18960 - in trunk/jbpm/plugins/org.jbpm.gd.jpdl: src/org/jbpm/gd/common/util and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2009-12-01 18:32:31 -0500 (Tue, 01 Dec 2009)
New Revision: 18960
Added:
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/common/util/Base64Converter.java
Modified:
trunk/jbpm/plugins/org.jbpm.gd.jpdl/plugin.xml
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/DeploymentForm.java
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/ServerDeploymentPage.java
trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/util/ProcessDeployer.java
Log:
GPD-381
Modified: trunk/jbpm/plugins/org.jbpm.gd.jpdl/plugin.xml
===================================================================
--- trunk/jbpm/plugins/org.jbpm.gd.jpdl/plugin.xml 2009-12-01 23:06:15 UTC (rev 18959)
+++ trunk/jbpm/plugins/org.jbpm.gd.jpdl/plugin.xml 2009-12-01 23:32:31 UTC (rev 18960)
@@ -358,7 +358,11 @@
class="org.jbpm.gd.jpdl.prefs.AssignmentTypesPage"
id="org.jbpm.gd.jpdl.prefs.assignmentTypes"
name="Assignment Types"
- category="org.jbpm.gd.jpdl.prefs.jbpm3"/>
+ category="org.jbpm.gd.jpdl.prefs.jbpm3">
+ <enablement>
+ <systemProperty name="MyTestProperty" value="puppy"/>
+ </enablement>
+ </page>
<page
class="org.jbpm.gd.jpdl.prefs.ServerDeploymentPage"
id="org.jbpm.gd.jpdl.prefs.deployment"
Added: trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/common/util/Base64Converter.java
===================================================================
--- trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/common/util/Base64Converter.java (rev 0)
+++ trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/common/util/Base64Converter.java 2009-12-01 23:32:31 UTC (rev 18960)
@@ -0,0 +1,75 @@
+package org.jbpm.gd.common.util;
+
+public class Base64Converter {
+
+ public static final char[] alphabet = {
+ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
+ 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
+ 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
+ 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
+ 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
+ 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
+ 'w', 'x', 'y', 'z', '0', '1', '2', '3',
+ '4', '5', '6', '7', '8', '9', '+', '/' };
+
+ public static String encode(String s) {
+ return encode(s.getBytes());
+ }
+
+ public static String encode(byte[] octetString) {
+ int bits24;
+ int bits6;
+
+ char[] out = new char[((octetString.length - 1) / 3 + 1) * 4];
+
+ int outIndex = 0;
+ int i = 0;
+
+ while ((i + 3) <= octetString.length) {
+ // store the octets
+ bits24 = (octetString[i++] & 0xFF) << 16;
+ bits24 |= (octetString[i++] & 0xFF) << 8;
+ bits24 |= (octetString[i++] & 0xFF) << 0;
+
+ bits6 = (bits24 & 0x00FC0000) >> 18;
+ out[outIndex++] = alphabet[bits6];
+ bits6 = (bits24 & 0x0003F000) >> 12;
+ out[outIndex++] = alphabet[bits6];
+ bits6 = (bits24 & 0x00000FC0) >> 6;
+ out[outIndex++] = alphabet[bits6];
+ bits6 = (bits24 & 0x0000003F);
+ out[outIndex++] = alphabet[bits6];
+ }
+
+ if (octetString.length - i == 2) {
+ // store the octets
+ bits24 = (octetString[i] & 0xFF) << 16;
+ bits24 |= (octetString[i + 1] & 0xFF) << 8;
+
+ bits6 = (bits24 & 0x00FC0000) >> 18;
+ out[outIndex++] = alphabet[bits6];
+ bits6 = (bits24 & 0x0003F000) >> 12;
+ out[outIndex++] = alphabet[bits6];
+ bits6 = (bits24 & 0x00000FC0) >> 6;
+ out[outIndex++] = alphabet[bits6];
+
+ // padding
+ out[outIndex++] = '=';
+ } else if (octetString.length - i == 1) {
+ // store the octets
+ bits24 = (octetString[i] & 0xFF) << 16;
+
+ bits6 = (bits24 & 0x00FC0000) >> 18;
+ out[outIndex++] = alphabet[bits6];
+ bits6 = (bits24 & 0x0003F000) >> 12;
+ out[outIndex++] = alphabet[bits6];
+
+ // padding
+ out[outIndex++] = '=';
+ out[outIndex++] = '=';
+ }
+
+ return new String(out);
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/common/util/Base64Converter.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/DeploymentForm.java
===================================================================
--- trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/DeploymentForm.java 2009-12-01 23:06:15 UTC (rev 18959)
+++ trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/deployment/DeploymentForm.java 2009-12-01 23:32:31 UTC (rev 18960)
@@ -46,11 +46,13 @@
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Tree;
@@ -84,11 +86,14 @@
private Text portText;
private Text deployerText;
private Text locationText;
+ private Text usernameText;
+ private Text passwordText;
private Button deployButton;
private Button saveButton;
private Button locationButton;
private Button testConnectionButton;
private Button saveLocallyButton;
+ private Button useCredentialsButton;
private IncludeInDeploymentTreeViewer includeFilesTreeViewer;
private IncludeInDeploymentTreeViewer includeClassesTreeViewer;
@@ -143,6 +148,11 @@
result.setServerName(nameText.getText());
result.setServerPort(portText.getText());
result.setServerDeployer(deployerText.getText());
+ result.setUseCredentials(useCredentialsButton.getSelection());
+ if (useCredentialsButton.getSelection()) {
+ result.setUsername(usernameText.getText() == null ? "" : usernameText.getText());
+ result.setPassword(passwordText.getText() == null ? "" : passwordText.getText());
+ }
result.setShell(form.getShell());
result.setProcessFolder(processFolder);
result.setFilesAndFolders(getIncludedFiles());
@@ -223,6 +233,8 @@
createServerNameField(serverInfoFormClient);
createServerPortField(serverInfoFormClient);
createServerDeployerField(serverInfoFormClient);
+ createUseCredentialsButton(serverInfoFormClient);
+ createUseCredentialsGroup(serverInfoFormClient);
createTestConnectionButton(serverInfoFormClient);
}
@@ -281,6 +293,51 @@
});
}
+ private void createUserNameField(Composite composite) {
+ Label usernameLabel = toolkit.createLabel(composite, "Username:");
+ usernameLabel.setForeground(toolkit.getColors().getColor(FormColors.TITLE));
+ usernameText = toolkit.createText(composite, "");
+ String usernameString = Plugin.getDefault().getPreferenceStore().getString("user name");
+ usernameText.setText(usernameString == null ? "" : usernameString);
+ usernameText.setEnabled(useCredentialsButton.getSelection());
+ usernameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ }
+
+ private void createPasswordField(Composite composite) {
+ Label passwordLabel = toolkit.createLabel(composite, "Password:");
+ passwordLabel.setForeground(toolkit.getColors().getColor(FormColors.TITLE));
+ passwordText = toolkit.createText(composite, "", SWT.PASSWORD);
+ String passwordString = Plugin.getDefault().getPreferenceStore().getString("password");
+ passwordText.setText(passwordString == null ? "" : passwordString);
+ passwordText.setEnabled(useCredentialsButton.getSelection());
+ passwordText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ }
+
+ private void createUseCredentialsButton(Composite infoFormClient) {
+ useCredentialsButton = toolkit.createButton(infoFormClient, "Use credentials", SWT.CHECK);
+ useCredentialsButton.setForeground(toolkit.getColors().getColor(FormColors.TITLE));
+ useCredentialsButton.setSelection(Plugin.getDefault().getPreferenceStore().getBoolean("use credentials"));
+ GridData gridData = new GridData();
+ gridData.horizontalSpan = 3;
+ useCredentialsButton.setLayoutData(gridData);
+ useCredentialsButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ usernameText.setEnabled(useCredentialsButton.getSelection());
+ passwordText.setEnabled(useCredentialsButton.getSelection());
+ }
+ });
+ }
+
+ private void createUseCredentialsGroup(Composite infoFormClient) {
+ Composite useCredentialsGroup = toolkit.createComposite(infoFormClient, SWT.BORDER);
+ GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
+ gridData.horizontalSpan = 3;
+ useCredentialsGroup.setLayoutData(gridData);
+ useCredentialsGroup.setLayout(new GridLayout(2, false));
+ createUserNameField(useCredentialsGroup);
+ createPasswordField(useCredentialsGroup);
+ }
+
private void createTestConnectionButton(Composite infoFormClient) {
testConnectionButton = toolkit.createButton(infoFormClient, "Test Connection...", SWT.PUSH);
testConnectionButton.addSelectionListener(new SelectionAdapter() {
Modified: trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/ServerDeploymentPage.java
===================================================================
--- trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/ServerDeploymentPage.java 2009-12-01 23:06:15 UTC (rev 18959)
+++ trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/prefs/ServerDeploymentPage.java 2009-12-01 23:32:31 UTC (rev 18960)
@@ -23,10 +23,15 @@
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IWorkbench;
@@ -36,7 +41,8 @@
public class ServerDeploymentPage extends PreferencePage implements IWorkbenchPreferencePage, Constants {
- private Text nameText, portText, deployerText;
+ private Text nameText, portText, deployerText, usernameText, passwordText;
+ private Button useCredentialsCheckbox;
public ServerDeploymentPage() {
super();
@@ -45,14 +51,59 @@
protected Control createContents(Composite parent) {
Composite clientArea = createClientArea(parent);
- createNameField(clientArea);
- createPortField(clientArea);
- createDeployerField(clientArea);
+ createServerNameField(clientArea);
+ createServerPortField(clientArea);
+ createServerDeployerField(clientArea);
+ createServerCredentialsCheckBox(clientArea);
+ createServerCredentialsGroup(clientArea);
return null;
}
- private void createNameField(Composite parent) {
+ private void createServerCredentialsGroup(Composite parent) {
+ Group serverCredentialsGroup = new Group(parent, SWT.BORDER);
+ serverCredentialsGroup.setLayout(new GridLayout(2, false));
+ createUserNameField(serverCredentialsGroup);
+ createUserPasswordField(serverCredentialsGroup);
+ GridData data = new GridData(GridData.FILL_HORIZONTAL);
+ data.horizontalSpan = 2;
+ serverCredentialsGroup.setLayoutData(data);
+ }
+
+ private void createUserNameField(Composite parent) {
Label nameLabel = new Label(parent, SWT.NORMAL);
+ nameLabel.setText("Username:");
+ String username = getPreferenceStore().getString("user name");
+ usernameText = new Text(parent, SWT.BORDER);
+ usernameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ usernameText.setText(useCredentialsCheckbox.getSelection() ? username : "");
+ }
+
+ private void createUserPasswordField(Composite parent) {
+ Label passwordLabel = new Label(parent, SWT.NORMAL);
+ passwordLabel.setText("Password:");
+ String password = getPreferenceStore().getString("password");
+ passwordText = new Text(parent, SWT.PASSWORD | SWT.BORDER);
+ passwordText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ passwordText.setText(useCredentialsCheckbox.getSelection() ? password : "");
+ }
+
+ private void createServerCredentialsCheckBox(Composite parent) {
+ useCredentialsCheckbox = new Button(parent, SWT.CHECK);
+ useCredentialsCheckbox.setText("Use credentials");
+ useCredentialsCheckbox.setSelection(getPreferenceStore().getBoolean("use credentials"));
+ GridData data = new GridData(GridData.FILL_HORIZONTAL);
+ data.horizontalSpan = 2;
+ useCredentialsCheckbox.setLayoutData(data);
+ useCredentialsCheckbox.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ usernameText.setEnabled(useCredentialsCheckbox.getSelection());
+ passwordText.setEnabled(useCredentialsCheckbox.getSelection());
+ }
+ });
+ }
+
+ private void createServerNameField(Composite parent) {
+ Label nameLabel = new Label(parent, SWT.NORMAL);
nameLabel.setText("Server name:");
nameText = new Text(parent, SWT.BORDER);
String serverName = getPreferenceStore().getString("server name");
@@ -60,7 +111,7 @@
nameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
}
- private void createPortField(Composite parent) {
+ private void createServerPortField(Composite parent) {
Label portLabel = new Label(parent, SWT.NORMAL);
portLabel.setText("Server port:");
portText = new Text(parent, SWT.BORDER);
@@ -69,7 +120,7 @@
portText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
}
- private void createDeployerField(Composite parent) {
+ private void createServerDeployerField(Composite parent) {
Label deployerLabel = new Label(parent, SWT.NORMAL);
deployerLabel.setText("Server deployer:");
deployerText = new Text(parent, SWT.BORDER);
@@ -95,6 +146,9 @@
getPreferenceStore().setValue("server name", nameText.getText());
getPreferenceStore().setValue("server port", portText.getText());
getPreferenceStore().setValue("server deployer", deployerText.getText());
+ getPreferenceStore().setValue("use credentials", useCredentialsCheckbox.getSelection());
+ getPreferenceStore().setValue("user name", useCredentialsCheckbox.getSelection() ? usernameText.getText() : "");
+ getPreferenceStore().setValue("password", useCredentialsCheckbox.getSelection() ? passwordText.getText() : "");
return true;
}
@@ -102,9 +156,15 @@
nameText.setText("localhost");
portText.setText("8080");
deployerText.setText("jbpm-console/upload");
+ useCredentialsCheckbox.setSelection(false);
+ usernameText.setText(null);
+ passwordText.setText(null);
getPreferenceStore().setValue("server name", "localhost");
getPreferenceStore().setValue("server port", "8080");
getPreferenceStore().setValue("server deployer", "jbpm-console/upload");
+ getPreferenceStore().setValue("use credentials", false);
+ getPreferenceStore().setValue("user name", "");
+ getPreferenceStore().setValue("password", "");
}
}
Modified: trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/util/ProcessDeployer.java
===================================================================
--- trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/util/ProcessDeployer.java 2009-12-01 23:06:15 UTC (rev 18959)
+++ trunk/jbpm/plugins/org.jbpm.gd.jpdl/src/org/jbpm/gd/jpdl/util/ProcessDeployer.java 2009-12-01 23:32:31 UTC (rev 18960)
@@ -3,6 +3,7 @@
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.File;
+import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FilenameFilter;
import java.io.IOException;
@@ -33,6 +34,7 @@
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Shell;
+import org.jbpm.gd.common.util.Base64Converter;
import org.jbpm.gd.jpdl.Logger;
import org.jbpm.gd.jpdl.Plugin;
@@ -48,6 +50,9 @@
String targetLocation;
List classesAndResources;
List filesAndFolders;
+ boolean useCredentials = false;
+ String username;
+ String password;
public void setShell(Shell shell) {
this.shell = shell;
@@ -81,6 +86,18 @@
this.filesAndFolders = filesAndFolders;
}
+ public void setUseCredentials(boolean useCredentials) {
+ this.useCredentials = useCredentials;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
public boolean deploy() {
try {
showProgressMonitorDialog();
@@ -94,6 +111,18 @@
dialog.open();
return false;
}
+ catch (IOException e) {
+ if (e.getMessage().contains("Server returned HTTP response code: 403 for URL")) {
+ MessageDialog dialog = new MessageDialog(shell, "Not Allowed", null,
+ "The server refused to perform the deployment. Check your credentials.",
+ SWT.ICON_INFORMATION, new String[] { "OK" }, 0);
+ dialog.open();
+ return false;
+ } else {
+ showErrorDialog(e);
+ return false;
+ }
+ }
catch (Exception e) {
// NOTE that Error's are not caught because that might halt the JVM and mask the original Error.
showErrorDialog(e);
@@ -103,7 +132,8 @@
public void pingServer() {
try {
- URL url = new URL("http://" + serverName + ":" + serverPort + serverDeployer);
+ String urlStr = "http://" + serverName + ":" + serverPort + serverDeployer;
+ URL url = new URL(urlStr);
URLConnection urlConnection = url.openConnection();
urlConnection.setDoOutput(true);
InputStream inputStream = urlConnection.getInputStream();
@@ -123,6 +153,12 @@
SWT.ICON_INFORMATION, new String[] { "OK" }, 0);
dialog.open();
}
+ catch (FileNotFoundException e) {
+ MessageDialog dialog = new MessageDialog(shell, "Connection Test", null,
+ "The server can be reached, but the deployer seems unavailable.",
+ SWT.ICON_INFORMATION, new String[] { "OK" }, 0);
+ dialog.open();
+ }
catch (Exception e) {
Logger.logError(e);
ErrorDialog dialog = new ErrorDialog(shell,
@@ -170,6 +206,12 @@
}
deployProcessWithServlet(baos);
return;
+ } catch (IOException e) {
+ if (e.getMessage().contains("Server returned HTTP response code: 403 for URL")) {
+ Logger.logError(
+ "The server refused to execute the deployment. Check your credentials.",
+ e);
+ }
} catch (Exception e) {
Logger
.logError(
@@ -193,8 +235,14 @@
}
private void deployProcessWithServlet(byte[] parBytes) throws Exception {
- URL url = new URL("http://" + serverName + ":" + serverPort + serverDeployer);
+ String urlStr = "http://" + serverName + ":" + serverPort + serverDeployer;
+ URL url = new URL(urlStr);
URLConnection urlConnection = url.openConnection();
+ if (useCredentials) {
+ String userPassword = username + ":" + password;
+ String encoding = Base64Converter.encode(userPassword);
+ urlConnection.setRequestProperty ("Authorization", "Basic" + encoding);
+ }
urlConnection.setDoInput(true);
urlConnection.setDoOutput(true);
urlConnection.setUseCaches(false);
15 years, 3 months