Author: tfennelly
Date: 2010-08-19 07:16:52 -0400 (Thu, 19 Aug 2010)
New Revision: 24292
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ecore.model/src/org/jboss/tools/smooks/model/ISmooksModelProvider.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/AbstractFileSelectionWizardPage.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/FileSelectionListener.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/FileSelectionPageComponent.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/Messages.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/messages.properties
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputModelFactory.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputTaskPanelContributor.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputTaskPanelContributorFactory.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/contributors/SampleDataConfigurationContributorFactory.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/contributors/SimpleMessageContributorFactory.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/contributors/XSDConfigurationContributorFactory.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/model/
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/model/AbstractInputModelFactory.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/model/JavaInputModelFactory.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/model/XMLInputModelFactory.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/model/XSDInputModelFactory.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/AbstractStructuredDataWizard.java
Removed:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputParameter.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputReaderConfigurationContributor.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputType.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/contributors/SimpleMessageContributor.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/AbstractFileSelectionWizardPage.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/AbstractStructuredDdataWizard.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/ISmooksModelProvider.java
Modified:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ecore.model/META-INF/MANIFEST.MF
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ecore.model/src/org/jboss/tools/smooks/model/SmooksModel.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.templating/src/org/jboss/tools/smooks/templating/model/xml/XSDModelBuilder.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/ExtentionInputLabelProvider.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SelectorCreationDialog.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksReaderFormPage.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputSourceType.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/Messages.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/messages.properties
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XMLObjectAnalyzer.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XMLStructuredDataWizard.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XMLStructuredDataWizardPage.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XMLTemplateCreationWizardPage.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XSDStructuredDataWizard.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/dbm/editor/SmooksConfigurationFormPage.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/AbstractSmooksFormEditor.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/AbstractProcessGraphAction.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/AddNextTaskNodeAction.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/AddTaskNodeAction.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/DeleteTaskNodeAction.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksProcessGraphicalEditor.java
Log:
https://jira.jboss.org/browse/JBIDE-6867
Clean up input task panel code + input source management
https://jira.jboss.org/browse/JBIDE-6802
Re-add XML Schema (XSD) input support
Modified:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ecore.model/META-INF/MANIFEST.MF
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ecore.model/META-INF/MANIFEST.MF 2010-08-19
10:56:56 UTC (rev 24291)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ecore.model/META-INF/MANIFEST.MF 2010-08-19
11:16:52 UTC (rev 24292)
@@ -9,7 +9,8 @@
Bundle-Vendor: %providerName
Require-Bundle: org.eclipse.core.runtime,
org.jboss.tools.smooks.runtime,
- org.eclipse.emf.ecore
+ org.eclipse.emf.ecore,
+ org.eclipse.emf.edit
Export-Package: org.jboss.tools.smooks.model,
org.jboss.tools.smooks.model.core,
org.jboss.tools.smooks.model.javabean
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ecore.model/src/org/jboss/tools/smooks/model/ISmooksModelProvider.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ecore.model/src/org/jboss/tools/smooks/model/ISmooksModelProvider.java
(rev 0)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ecore.model/src/org/jboss/tools/smooks/model/ISmooksModelProvider.java 2010-08-19
11:16:52 UTC (rev 24292)
@@ -0,0 +1,17 @@
+/**
+ *
+ */
+package org.jboss.tools.smooks.model;
+
+import org.eclipse.emf.edit.domain.IEditingDomainProvider;
+import org.milyn.javabean.dynamic.Model;
+
+/**
+ * @author Dart
+ *
+ */
+public interface ISmooksModelProvider extends IEditingDomainProvider{
+ Model<SmooksModel> getSmooksModel();
+
+ String getInputType();
+}
Property changes on:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ecore.model/src/org/jboss/tools/smooks/model/ISmooksModelProvider.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ecore.model/src/org/jboss/tools/smooks/model/SmooksModel.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ecore.model/src/org/jboss/tools/smooks/model/SmooksModel.java 2010-08-19
10:56:56 UTC (rev 24291)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ecore.model/src/org/jboss/tools/smooks/model/SmooksModel.java 2010-08-19
11:16:52 UTC (rev 24292)
@@ -39,6 +39,8 @@
private GlobalParams params;
private List<IComponent> components = new ArrayList<IComponent>();
+ private ISmooksModelProvider modelProvider;
+
public GlobalParams getParams() {
return params;
}
@@ -54,4 +56,12 @@
public void setComponents(List<IComponent> components) {
this.components = components;
}
+
+ public void setModelProvider(ISmooksModelProvider modelProvider) {
+ this.modelProvider = modelProvider;
+ }
+
+ public ISmooksModelProvider getModelProvider() {
+ return modelProvider;
+ }
}
Modified:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.templating/src/org/jboss/tools/smooks/templating/model/xml/XSDModelBuilder.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.templating/src/org/jboss/tools/smooks/templating/model/xml/XSDModelBuilder.java 2010-08-19
10:56:56 UTC (rev 24291)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.templating/src/org/jboss/tools/smooks/templating/model/xml/XSDModelBuilder.java 2010-08-19
11:16:52 UTC (rev 24292)
@@ -70,7 +70,7 @@
}
public Set<String> getRootElementNames() {
- return Collections.unmodifiableSet(elements.keySet());
+ return new LinkedHashSet<String>(elements.keySet());
}
public void setRootElementName(String rootElementName) {
Modified:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/ExtentionInputLabelProvider.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/ExtentionInputLabelProvider.java 2010-08-19
10:56:56 UTC (rev 24291)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/ExtentionInputLabelProvider.java 2010-08-19
11:16:52 UTC (rev 24292)
@@ -10,16 +10,12 @@
******************************************************************************/
package org.jboss.tools.smooks.configuration.editors;
-import java.util.Iterator;
-import java.util.List;
-
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;
import org.jboss.tools.smooks.configuration.SmooksConfigurationActivator;
import org.jboss.tools.smooks.configuration.SmooksModelUtils;
-import org.jboss.tools.smooks.configuration.editors.input.InputParameter;
-import org.jboss.tools.smooks.configuration.editors.input.InputType;
+import org.jboss.tools.smooks.model.core.IParam;
/**
* @author Dart (dpeng(a)redhat.com)
@@ -36,8 +32,8 @@
* .Object, int)
*/
public Image getColumnImage(Object element, int columnIndex) {
- if (element instanceof InputType) {
- String type = ((InputType) element).getType();
+ if (element instanceof IParam) {
+ String type = ((IParam) element).getType();
switch (columnIndex) {
case 0:
if (SmooksModelUtils.INPUT_TYPE_JAVA.equals(type)) {
@@ -67,29 +63,14 @@
* .Object, int)
*/
public String getColumnText(Object element, int columnIndex) {
- if (element instanceof InputType) {
- String value = ((InputType) element).getPath();
- if (value == null)
- value = ""; //$NON-NLS-1$
- String extValue = ""; //$NON-NLS-1$
- List<InputParameter> paramers = ((InputType) element).getParameters();
- for (Iterator<?> iterator = paramers.iterator(); iterator.hasNext();) {
- InputParameter paramType = (InputParameter) iterator.next();
-// if ("path".equalsIgnoreCase(paramType.getName())) {
-// continue;
-// }
- extValue += paramType.getName() + "=" + paramType.getValue() +
","; //$NON-NLS-1$ //$NON-NLS-2$
- }
- if (extValue.length() != 0) {
- extValue = extValue.substring(0, extValue.length() - 1);
- }
+ if (element instanceof IParam) {
+ IParam inputTypeParam = (IParam) element;
+
switch (columnIndex) {
case 0:
- return ((InputType) element).getType();
+ return inputTypeParam.getValue();
case 1:
- return value;
- case 2:
- return extValue;
+ return ""; //$NON-NLS-1$
}
}
return ""; //$NON-NLS-1$
Modified:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SelectorCreationDialog.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SelectorCreationDialog.java 2010-08-19
10:56:56 UTC (rev 24291)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SelectorCreationDialog.java 2010-08-19
11:16:52 UTC (rev 24292)
@@ -12,7 +12,6 @@
import java.util.ArrayList;
import java.util.Collections;
-import java.util.Iterator;
import java.util.List;
import org.eclipse.jdt.core.IJavaProject;
@@ -44,8 +43,9 @@
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Hyperlink;
import org.jboss.tools.smooks.configuration.SmooksModelUtils;
-import org.jboss.tools.smooks.configuration.editors.input.InputParameter;
-import org.jboss.tools.smooks.configuration.editors.input.InputType;
+import org.jboss.tools.smooks.configuration.editors.input.InputModelFactory;
+import org.jboss.tools.smooks.configuration.editors.input.InputSourceType;
+import
org.jboss.tools.smooks.configuration.editors.input.InvalidInputSourceTypeException;
import org.jboss.tools.smooks.configuration.editors.java.JavaBeanModel;
import org.jboss.tools.smooks.configuration.editors.java.JavaBeanModelFactory;
import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
@@ -54,9 +54,13 @@
import org.jboss.tools.smooks.configuration.editors.xml.TagList;
import org.jboss.tools.smooks.configuration.editors.xml.XMLObjectAnalyzer;
import org.jboss.tools.smooks.configuration.editors.xml.XSDObjectAnalyzer;
-import org.jboss.tools.smooks.editor.ISmooksModelProvider;
+import org.jboss.tools.smooks.model.ISmooksModelProvider;
import org.jboss.tools.smooks.model.SmooksModel;
+import org.jboss.tools.smooks.model.core.GlobalParams;
+import org.jboss.tools.smooks.model.core.IParam;
+import org.jboss.tools.smooks.templating.model.ModelBuilderException;
import org.milyn.javabean.dynamic.Model;
+import org.w3c.dom.Document;
/**
* @author Dart (dpeng(a)redhat.com)
@@ -251,119 +255,41 @@
});
}
- public static List<Object> generateInputData(SmooksModel smooksResourceListType ,
IJavaProject project) {
+ public static List<Object> generateInputData(SmooksModel smooksConfigModel ,
IJavaProject project) {
currentException = null;
List<Object> list = new ArrayList<Object>();
- if (smooksResourceListType != null) {
-// IJavaProject project = SmooksUIUtils.getJavaProject(smooksResourceListType.get);
- try {
- List<InputType> inputLists =
SmooksUIUtils.getInputTypeList(smooksResourceListType);
- for (Iterator<?> iterator = inputLists.iterator(); iterator.hasNext();) {
- InputType inputType = (InputType) iterator.next();
- if (!inputType.isActived())
- continue;
- String type = inputType.getType();
- String path = inputType.getPath();
- if (type != null && path != null) {
- path = path.trim();
-// if (SmooksModelUtils.INPUT_TYPE_EDI_1_1.equals(type)
-// || SmooksModelUtils.INPUT_TYPE_EDI_1_2.equals(type)) {
-// EDIDataParser parser = new EDIDataParser();
-// try {
-// TagList tl = parser.parseEDIFile(path, smooksResourceListType);
-// if (tl != null) {
-// list.addAll(((TagList) tl).getChildren());
-// }
-// } catch (Throwable t) {
-// currentException = t;
-// }
-// }
-// if (SmooksModelUtils.INPUT_TYPE_CSV.equals(type)
-// || SmooksModelUtils.INPUT_TYPE_CSV_1_2.equals(type)) {
-// CSVDataParser parser = new CSVDataParser();
-// try {
-// TagList tl = parser.parseCSV(path, smooksResourceListType);
-// if (tl != null) {
-// list.addAll(((TagList) tl).getChildren());
-// }
-// } catch (Throwable t) {
-// currentException = t;
-// }
-// }
-// if (SmooksModelUtils.INPUT_TYPE_JSON_1_1.equals(type)
-// || SmooksModelUtils.INPUT_TYPE_JSON_1_2.equals(type)) {
-// try {
-// JsonInputDataParser parser = new JsonInputDataParser();
-// IXMLStructuredObject tagList =
parser.parseJsonFile(SmooksUIUtils.parseFilePath(path),
-// smooksResourceListType);
-// if (tagList instanceof TagList) {
-// list.addAll(((TagList) tagList).getChildren());
-// } else {
-// list.add(tagList);
-// }
-// } catch (Throwable tt) {
-// currentException = tt;
-// }
-// }
- if (SmooksModelUtils.INPUT_TYPE_JAVA.equals(type)) {
- try {
- Class<?> clazz = SmooksUIUtils.loadClass(path, project);
- JavaBeanModel model = JavaBeanModelFactory.getJavaBeanModelWithLazyLoad(clazz);
- if (model != null) {
+
+ if (smooksConfigModel != null) {
+ GlobalParams globalParams = smooksConfigModel.getParams();
+ IParam inputType = globalParams.getParam(SmooksModelUtils.INPUT_TYPE);
+
+ if(inputType != null) {
+ InputSourceType inputTypeEnum;
+ try {
+ inputTypeEnum = InputSourceType.fromTypeName(inputType.getValue());
+ InputModelFactory modelFactory = inputTypeEnum.getInputModelFactory();
+
+ if(modelFactory != null) {
+ Document modelDoc = modelFactory.getModel(smooksConfigModel, project);
+
+ if(modelDoc != null) {
+ AbstractXMLObject model = new XMLObjectAnalyzer().analyze(modelDoc, null ,
null);
+
+ if (model != null) {
+ if (model instanceof TagList) {
+ list.addAll(((TagList) model).getChildren());
+ } else {
list.add(model);
}
- } catch (Throwable t) {
- currentException = t;
}
}
- if (SmooksModelUtils.INPUT_TYPE_XSD.equals(type)) {
- try {
- path = SmooksUIUtils.parseFilePath(path);
- String rootElementName = null;
- List<InputParameter> paramers = inputType.getParameters();
- for (Iterator<?> iterator2 = paramers.iterator(); iterator2.hasNext();) {
- InputParameter paramType = (InputParameter) iterator2.next();
- String pn = paramType.getName();
- if ("rootElement".equals(pn)) { //$NON-NLS-1$
- rootElementName = paramType.getValue();
- break;
- }
- }
- if (rootElementName != null) {
- rootElementName = rootElementName.trim();
- list.add(new XSDObjectAnalyzer().loadElement(path, rootElementName));
- }
- } catch (Throwable tt) {
- currentException = tt;
- }
- }
- if (SmooksModelUtils.INPUT_TYPE_XML.equals(type)) {
- try {
- path = SmooksUIUtils.parseFilePath(path);
-
- // XMLObjectAnalyzer analyzer = new
- // XMLObjectAnalyzer();
- // TagList doc = analyzer.analyze(path, null);
-
- AbstractXMLObject model = new XMLObjectAnalyzer().analyze(path, null , null);
- if (model != null) {
- if (model instanceof TagList) {
- list.addAll(((TagList) model).getChildren());
- } else {
- list.add(model);
- }
- }
- } catch (Throwable e) {
- currentException = e;
- }
- }
}
+ } catch (Exception e) {
+ currentException = e;
}
- } catch (Exception e) {
- currentException = e;
- // SmooksConfigurationActivator.getDefault().log(e);
}
}
+
return list;
}
Modified:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksReaderFormPage.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksReaderFormPage.java 2010-08-19
10:56:56 UTC (rev 24291)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksReaderFormPage.java 2010-08-19
11:16:52 UTC (rev 24292)
@@ -10,56 +10,35 @@
******************************************************************************/
package org.jboss.tools.smooks.configuration.editors;
-
-
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.EventObject;
import java.util.Iterator;
import java.util.List;
-import java.util.Properties;
-import org.eclipse.core.filesystem.EFS;
-import org.eclipse.core.filesystem.IFileInfo;
-import org.eclipse.core.filesystem.IFileStore;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.draw2d.ColorConstants;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.command.CommandStack;
import org.eclipse.emf.common.command.CommandStackListener;
import org.eclipse.emf.common.command.CommandWrapper;
import org.eclipse.emf.common.command.CompoundCommand;
-import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.edit.command.AddCommand;
import org.eclipse.emf.edit.command.DeleteCommand;
import org.eclipse.emf.edit.command.RemoveCommand;
import org.eclipse.emf.edit.command.SetCommand;
import org.eclipse.emf.edit.domain.EditingDomain;
-import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.ICheckStateListener;
-import org.eclipse.jface.viewers.ICheckStateProvider;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITableColorProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.wizard.WizardDialog;
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.graphics.Color;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -67,14 +46,9 @@
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.editor.FormEditor;
import org.eclipse.ui.forms.editor.FormPage;
@@ -85,17 +59,14 @@
import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.ui.forms.widgets.ScrolledPageBook;
import org.eclipse.ui.forms.widgets.Section;
-import org.eclipse.ui.ide.IDE;
import org.jboss.tools.smooks.configuration.SmooksModelUtils;
import org.jboss.tools.smooks.configuration.editors.input.InputSourceType;
-import org.jboss.tools.smooks.configuration.editors.input.InputType;
+import org.jboss.tools.smooks.configuration.editors.input.InputTaskPanelContributor;
+import
org.jboss.tools.smooks.configuration.editors.input.InputTaskPanelContributorFactory;
import
org.jboss.tools.smooks.configuration.editors.input.InvalidInputSourceTypeException;
import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
-import
org.jboss.tools.smooks.configuration.editors.wizard.IStructuredDataSelectionWizard;
-import
org.jboss.tools.smooks.configuration.editors.wizard.StructuredDataSelectionWizard;
-import org.jboss.tools.smooks.configuration.editors.wizard.ViewerInitorStore;
-import org.jboss.tools.smooks.editor.ISmooksModelProvider;
import org.jboss.tools.smooks.editor.ISourceSynchronizeListener;
+import org.jboss.tools.smooks.model.ISmooksModelProvider;
import org.jboss.tools.smooks.model.SmooksModel;
import org.jboss.tools.smooks.model.core.ICoreFactory;
import org.jboss.tools.smooks.model.core.ICorePackage;
@@ -149,15 +120,11 @@
});
}
- private CheckboxTableViewer inputDataViewer;
private TreeViewer inputModelViewer;
private Combo readerCombo;
private Composite readerConfigComposite;
-// private ModelPanelCreator modelPanelCreator;
- protected boolean lockCheck = false;
- private Button removeInputDataButton;
- private Button addInputDataButton;
private ScrolledPageBook scrolledPageBook;
+ private InputTaskPanelContributor sourceTypeConfigurationContributor;
public SmooksReaderFormPage(FormEditor editor, String id, String title) {
super(editor, id, title);
@@ -189,9 +156,7 @@
final ScrolledForm form = managedForm.getForm();
FormToolkit toolkit = managedForm.getToolkit();
form.setText(""); //$NON-NLS-1$
- // toolkit.decorateFormHeading(form.getForm());
- // // create master details UI
- // createMasterDetailBlock(managedForm);
+
Composite leftComposite = toolkit.createComposite(form.getBody());
GridData gd = new GridData(GridData.FILL_BOTH);
gd.widthHint = 300;
@@ -212,9 +177,8 @@
rightComposite.setLayout(rgl);
createReaderSection(toolkit, leftComposite);
- createInputDataSection(toolkit, rightComposite);
- createReaderConfigSection(toolkit, leftComposite);
createInputModelViewerSection(toolkit, rightComposite);
+ createReaderConfigSection(toolkit, leftComposite);
handleReaderCombo(readerCombo);
@@ -224,21 +188,8 @@
gridLayout.horizontalSpacing = 20;
gridLayout.makeColumnsEqualWidth = true;
form.getBody().setLayout(gridLayout);
-
- refreshInputDataButtons();
}
- private void refreshInputDataButtons() {
- this.addInputDataButton.setEnabled(true);
- this.removeInputDataButton.setEnabled(true);
-
- String inputType = getSmooksModelProvider().getInputType();
- if (inputType == null || inputType.trim().equals("")) { //$NON-NLS-1$
- this.addInputDataButton.setEnabled(false);
- this.removeInputDataButton.setEnabled(false);
- }
- }
-
private void createInputModelViewerSection(FormToolkit toolkit, Composite parent) {
Section section = toolkit.createSection(parent, Section.TITLE_BAR | Section.TWISTIE |
Section.EXPANDED);
GridData gd = new GridData(GridData.FILL_BOTH);
@@ -257,17 +208,10 @@
Hyperlink refreshLink = toolkit.createHyperlink(mainContainer,
Messages.SmooksReaderFormPage_RefreshLinkLabel,
SWT.NONE);
refreshLink.addHyperlinkListener(new IHyperlinkListener() {
-
public void linkExited(HyperlinkEvent e) {
- // TODO Auto-generated method stub
-
}
-
public void linkEntered(HyperlinkEvent e) {
- // TODO Auto-generated method stub
-
}
-
public void linkActivated(HyperlinkEvent e) {
refreshInputModelView();
}
@@ -289,18 +233,15 @@
public void doubleClick(DoubleClickEvent event) {
}
});
- inputModelViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- // currentSelection = ((IStructuredSelection)
- // event.getSelection()).getFirstElement();
- }
- });
refreshInputModelView();
}
private void refreshInputModelView() {
+ inputModelViewer.setInput(new ArrayList<Object>());
+ inputModelViewer.refresh();
+
if (this.getManagedForm() != null) {
this.getManagedForm().getMessageManager().removeAllMessages();
}
@@ -352,13 +293,14 @@
section.setClient(scrolledPageBook);
readerConfigComposite = scrolledPageBook.createPage(scrolledPageBook);
- scrolledPageBook.showPage(scrolledPageBook);
- GridLayout gl = new GridLayout();
- gl.numColumns = 2;
- readerConfigComposite.setLayout(gl);
-
initReaderConfigSection();
+
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ readerConfigComposite.setLayout(layout);
+ readerConfigComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ scrolledPageBook.showPage(scrolledPageBook);
}
private void initReaderConfigSection() {
@@ -374,9 +316,11 @@
private void addInputConfigControls() {
disposeCompositeControls(readerConfigComposite, null);
- getCurrentInputType().getConfigurationContributor().addInputConfigControls(this,
readerConfigComposite);
+ InputTaskPanelContributorFactory taskPanelContributorFactory =
getCurrentInputType().getTaskPanelContributorFactory();
+ sourceTypeConfigurationContributor =
taskPanelContributorFactory.newInstance(getManagedForm().getToolkit(), this,
getSmooksModel());
+ sourceTypeConfigurationContributor.setInputSourceConfigComposite(readerConfigComposite);
+ sourceTypeConfigurationContributor.addInputSourceTypeConfigControls();
- readerConfigComposite.layout();
scrolledPageBook.reflow(false);
}
@@ -408,251 +352,16 @@
} catch (InvalidInputSourceTypeException e) {
return InputSourceType.NONE;
}
- }
+ }
- protected void createInputDataSection(FormToolkit toolkit, Composite parent) {
- Section section = toolkit.createSection(parent, Section.TITLE_BAR | Section.DESCRIPTION
| Section.TWISTIE
- | Section.EXPANDED);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- section.setLayoutData(gd);
- section.setText(Messages.SmooksReaderFormPage_InputDataSectionTitle);
- section.setDescription(Messages.SmooksReaderFormPage_InputDataSectionDes);
- FillLayout flayout = new FillLayout();
- section.setLayout(flayout);
-
- Composite mainComposite = toolkit.createComposite(section, SWT.NONE);
- GridLayout gl = new GridLayout();
- gl.numColumns = 2;
- mainComposite.setLayout(gl);
- section.setClient(mainComposite);
-
- Composite tableComposite = toolkit.createComposite(mainComposite, SWT.NONE);
- FillLayout fillLayout = new FillLayout();
- fillLayout.marginHeight = 1;
- fillLayout.marginWidth = 1;
- gd = new GridData(GridData.FILL_BOTH);
- gd.heightHint = 70;
- tableComposite.setLayoutData(gd);
- tableComposite.setBackground(GraphicsConstants.BORDER_CORLOR);
- tableComposite.setLayout(fillLayout);
-
- inputDataViewer = CheckboxTableViewer.newCheckList(tableComposite, SWT.MULTI |
SWT.FULL_SELECTION);
- // inputDataViewer.set
- inputDataViewer.setCheckStateProvider(new ICheckStateProvider() {
-
- public boolean isGrayed(Object element) {
- return !isValidInputType((InputType) element);
- }
-
- public boolean isChecked(Object element) {
- if (element instanceof InputType) {
- return ((InputType) element).isActived();
- }
- return false;
- }
- });
- inputDataViewer.addCheckStateListener(new ICheckStateListener() {
-
- public void checkStateChanged(CheckStateChangedEvent event) {
- if (lockCheck)
- return;
- boolean checked = event.getChecked();
- InputType inputType = (InputType) event.getElement();
- if (!isValidInputType(inputType)) {
- lockCheck = true;
- inputDataViewer.setChecked(inputType, false);
- lockCheck = false;
- return;
- }
- CompoundCommand compoundCommand = new CompoundCommand();
- if (checked) {
- IParam param = SmooksUIUtils.getInputTypeAssociatedParamType(inputType,
- getSmooksConfigResourceList());
- if (param != null) {
- inputType.setActived(checked);
- String value = SmooksModelUtils.INPUT_ACTIVE_TYPE;
- Command c = SetCommand.create(getEditingDomain(), param,
- ICorePackage.Literals.PARAM__TYPE, value);
- if (c.canExecute())
- compoundCommand.append(c);
- }
-
- Object[] checkedObjects = inputDataViewer.getCheckedElements();
- for (int i = 0; i < checkedObjects.length; i++) {
- InputType type = (InputType) checkedObjects[i];
- if (type == inputType) {
- continue;
- }
- type.setActived(!checked);
- IParam param1 = SmooksUIUtils.getInputTypeAssociatedParamType(type,
- getSmooksConfigResourceList());
- if (param1 != null) {
- String value1 = SmooksModelUtils.INPUT_DEACTIVE_TYPE;
- Command c1 = SetCommand.create(getEditingDomain(), param1,
- ICorePackage.Literals.PARAM__TYPE, value1);
- compoundCommand.append(c1);
- }
-
- lockCheck = true;
- inputDataViewer.setChecked(type, false);
- lockCheck = false;
- }
-
- } else {
- IParam param = SmooksUIUtils.getInputTypeAssociatedParamType(inputType,
- getSmooksConfigResourceList());
- if (param != null) {
- String value = SmooksModelUtils.INPUT_DEACTIVE_TYPE;
- Command c = SetCommand.create(getEditingDomain(), param,
- ICorePackage.Literals.PARAM__TYPE, value);
- compoundCommand.append(c);
- }
- }
- try {
- getEditingDomain().getCommandStack().execute(compoundCommand);
- } catch (Exception e) {
- // e.printStackTrace();
- }
-
- // refreshInputModelView();
- }
- });
- inputDataViewer.addDoubleClickListener(new IDoubleClickListener() {
-
- public void doubleClick(DoubleClickEvent event) {
- IStructuredSelection selection = (IStructuredSelection) event.getSelection();
- Object element = selection.getFirstElement();
- if (element instanceof InputType) {
- String type = ((InputType) element).getType();
- String filePath = ((InputType) element).getPath();
- if (type != null && filePath != null) {
- if (SmooksModelUtils.INPUT_TYPE_JAVA.equals(type)) {
- IFile file = ((IFileEditorInput) getEditorInput()).getFile();
- IJavaProject javaProject = JavaCore.create(file.getProject());
- if (javaProject != null) {
- try {
- if (filePath.endsWith("[]")) { //$NON-NLS-1$
- filePath = filePath.substring(0, filePath.length() - 2);
- }
- IJavaElement result = javaProject.findType(filePath);
- if (result != null)
- JavaUI.openInEditor(result);
- else {
- MessageDialog.openError(getSite().getWorkbenchWindow().getShell(),
- Messages.SmooksReaderFormPage_CantFindTypeErrorTitle,
- "Can't find type \"" + filePath + "\" in
\"" //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
- + javaProject.getProject().getName() + "\" project.");
//$NON-NLS-1$
- }
- } catch (Exception e) {
-
- }
- }
- } else {
- try {
- filePath = SmooksUIUtils.parseFilePath(filePath);
- if (filePath != null) {
- IFileStore fileStore = EFS.getLocalFileSystem().getStore(new Path(filePath));
- IFileInfo fetchInfo = fileStore.fetchInfo();
- if (!fetchInfo.isDirectory() && fetchInfo.exists()) {
- IWorkbenchWindow window = getSite().getWorkbenchWindow();
- IWorkbenchPage page = window.getActivePage();
- try {
- IDE.openEditorOnFileStore(page, fileStore);
- } catch (PartInitException e) {
- MessageDialog.open(MessageDialog.ERROR, window.getShell(),
- Messages.SmooksReaderFormPage_OpenFileErrorTitle,
- "Can't open the file : '" + filePath + "'",
SWT.SHEET); //$NON-NLS-1$ //$NON-NLS-2$
- }
- } else {
- }
- }
- } catch (Exception e) {
- MessageDialog.open(MessageDialog.ERROR,
getSite().getWorkbenchWindow().getShell(),
- Messages.SmooksReaderFormPage_OpenFileErrorTitle,
- "Can't open the file : '" + filePath + "'",
SWT.SHEET); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
- }
- }
- }
- }
- }
- });
- TableColumn header = new TableColumn(inputDataViewer.getTable(), SWT.NONE);
- header.setText(Messages.SmooksReaderFormPage_TypeColumnText);
- header.setWidth(100);
- TableColumn pathColumn = new TableColumn(inputDataViewer.getTable(), SWT.NONE);
- pathColumn.setText(Messages.SmooksReaderFormPage_PathColumnText);
- pathColumn.setWidth(300);
-
- // TableColumn extColumn = new TableColumn(inputDataViewer.getTable(),
- // SWT.NONE);
- // extColumn.setText("Extension Paramers");
- // extColumn.setWidth(400);
- inputDataViewer.setContentProvider(new ExtentionInputContentProvider());
- inputDataViewer.setLabelProvider(new InputDataViewerLabelProvider());
- inputDataViewer.getTable().setHeaderVisible(true);
- inputDataViewer.getTable().setLinesVisible(true);
- ISmooksModelProvider provider = getSmooksModelProvider();
- if (provider != null) {
- inputDataViewer.setInput(SmooksUIUtils.getInputTypeList(getSmooksConfigResourceList().getModelRoot()));
- }
- Composite buttonComposite = toolkit.createComposite(mainComposite, SWT.NONE);
- gd = new GridData(GridData.FILL_VERTICAL);
- buttonComposite.setLayoutData(gd);
- GridLayout l = new GridLayout();
- buttonComposite.setLayout(l);
-
- addInputDataButton = toolkit.createButton(buttonComposite,
Messages.SmooksReaderFormPage_AddButtonLabel,
- SWT.FLAT);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- addInputDataButton.setLayoutData(gd);
- addInputDataButton.addSelectionListener(new SelectionAdapter() {
-
- public void widgetSelected(SelectionEvent e) {
- showInputDataWizard();
- }
-
- });
-
- removeInputDataButton = toolkit.createButton(buttonComposite,
Messages.SmooksReaderFormPage_DeleteButtonLabel,
- SWT.FLAT);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- removeInputDataButton.setLayoutData(gd);
- removeInputDataButton.addSelectionListener(new SelectionAdapter() {
-
- public void widgetSelected(SelectionEvent e) {
- IStructuredSelection selection = (IStructuredSelection)
inputDataViewer.getSelection();
- if (selection != null) {
- List<?> inputs = selection.toList();
- ISmooksModelProvider smooksModelProvider = getSmooksModelProvider();
- for (Iterator<?> iterator = inputs.iterator(); iterator.hasNext();) {
- InputType input = (InputType) iterator.next();
- SmooksUIUtils.removeInputType(input, smooksModelProvider);
- }
- if (!inputs.isEmpty()) {
- List<?> viewerInput = (List<?>) inputDataViewer.getInput();
- viewerInput.removeAll(inputs);
- // inputTypeChanged();
- if (inputDataViewer != null) {
- inputDataViewer.refresh();
- }
- }
- }
- }
- });
- }
-
-
protected boolean handleInputParamChange(Command command) {
Collection<?> affectedObjects = command.getAffectedObjects();
boolean refreshInputModel = false;
- for (Iterator<?> iterator2 = affectedObjects.iterator(); iterator2.hasNext();) {
- Object object = (Object) iterator2.next();
-// if (object instanceof AbstractReader) {
-// refreshInputModel = true;
-// break;
-// }
- if (object instanceof IParam) {
- if (SmooksUIUtils.isInputParamType((IParam) object)) {
+
+ for (Object affectedObject : affectedObjects) {
+
+ if (affectedObject instanceof IParam) {
+ if (InputSourceType.isValidName(((IParam)affectedObject).getName())) {
refreshInputModel = true;
break;
}
@@ -665,14 +374,9 @@
deletedObjs = ((RemoveCommand) command).getCollection();
}
if (deletedObjs != null) {
- for (Iterator<?> iterator = deletedObjs.iterator(); iterator.hasNext();) {
- Object object2 = (Object) iterator.next();
-// if (object2 instanceof AbstractReader) {
-// refreshInputModel = true;
-// break;
-// }
- if (object2 instanceof IParam) {
- if (SmooksUIUtils.isInputParamType((IParam) object2)) {
+ for (Object deletedObject : deletedObjs) {
+ if (deletedObject instanceof IParam) {
+ if (InputSourceType.isValidName(((IParam)deletedObject).getName())) {
refreshInputModel = true;
break;
}
@@ -694,26 +398,10 @@
return getSmooksModelProvider().getEditingDomain();
}
- protected Model<SmooksModel> getSmooksConfigResourceList() {
+ protected Model<SmooksModel> getSmooksModel() {
return getSmooksModelProvider().getSmooksModel();
}
- protected boolean isValidInputType(InputType element) {
- if (element == null) {
- // not specified is OK...
- return true;
- }
-
- String type = element.getType();
- int selectionIndex = readerCombo.getSelectionIndex();
-
- try {
- return InputSourceType.isValidIndexNamePair(selectionIndex, type);
- } catch (InvalidInputSourceTypeException e) {
- return false;
- }
- }
-
private void createReaderSection(FormToolkit toolkit, Composite parent) {
Section section = toolkit.createSection(parent, Section.TITLE_BAR | Section.TWISTIE |
Section.EXPANDED);
@@ -817,16 +505,16 @@
CompoundCommand compoundCommand = new CompoundCommand();
- IGlobalParams params = getSmooksConfigResourceList().getModelRoot().getParams();
+ IGlobalParams params = getSmooksModel().getModelRoot().getParams();
if (params == null) {
params = ICoreFactory.eINSTANCE.createGlobalParams();
- Command addparamsCommand = SetCommand.create(getEditingDomain(),
getSmooksConfigResourceList().getModelRoot(),
+ Command addparamsCommand = SetCommand.create(getEditingDomain(),
getSmooksModel().getModelRoot(),
ICorePackage.Literals.PARAMS, params);
if (addparamsCommand.canExecute())
compoundCommand.append(addparamsCommand);
}
- IParam param =
SmooksUIUtils.getInputTypeParam(getSmooksConfigResourceList().getModelRoot());
+ IParam param = SmooksUIUtils.getInputTypeParam(getSmooksModel().getModelRoot());
if (param == null) {
// add new one
param = ICoreFactory.eINSTANCE.createParam();
@@ -857,20 +545,15 @@
addInputConfigControls();
- deactiveAllInputFile(compoundCommand);
if (!compoundCommand.isEmpty() && compoundCommand.canExecute()) {
getEditingDomain().getCommandStack().execute(compoundCommand);
}
- if (inputDataViewer != null) {
- inputDataViewer.refresh();
- }
refreshInputModelView();
- refreshInputDataButtons();
}
private Command createRemoveReaderCommand() {
- Model<SmooksModel> rlist = getSmooksConfigResourceList();
+ Model<SmooksModel> rlist = getSmooksModel();
// List<AbstractReader> readerList = rlist.getAbstractReader();
CompoundCommand compoundCommand = new CompoundCommand();
// for (Iterator<?> iterator = readerList.iterator(); iterator.hasNext();) {
@@ -889,118 +572,8 @@
// }
return compoundCommand;
}
-
- protected void showInputDataWizard() {
- CompoundCommand compoundCommand = new CompoundCommand();
- // SmooksGraphicsExtType extType = getSmooksGraphicsExtType();
- String inputType = getSmooksModelProvider().getInputType();
- List<InputType> inputTypes = null;
- Model<SmooksModel> smooksModel = getSmooksConfigResourceList();
- SmooksModel rootModel = smooksModel.getModelRoot();
- if (inputType == null || SmooksModelUtils.INPUT_TYPE_CUSTOME.equals(inputType) ||
inputType.trim().equals("")) { //$NON-NLS-1$
- StructuredDataSelectionWizard wizard = new StructuredDataSelectionWizard();
- wizard.setInput(getEditorInput());
- wizard.setSite(getEditorSite());
- wizard.setForcePreviousAndNextButtons(true);
- StructuredDataSelectionWizardDailog dialog = new
StructuredDataSelectionWizardDailog(getEditorSite()
- .getShell(), wizard);
- if (dialog.show() == Dialog.OK) {
- String type = dialog.getType();
- String path = dialog.getPath();
- Properties pros = dialog.getProperties();
- inputTypes =
SmooksUIUtils.recordInputDataInfomation(getEditingDomain(),rootModel.getParams() , type,
path, pros, compoundCommand);
- }
- } else {
- IStructuredDataSelectionWizard wizard =
ViewerInitorStore.getInstance().getStructuredDataCreationWizard(
- inputType);
- WizardDialog dialog = new WizardDialog(getEditorSite().getShell(), wizard);
- wizard.init(getEditorSite(), getEditorInput());
- if (dialog.open() == Dialog.OK) {
- String path = wizard.getStructuredDataSourcePath();
- Properties pros = wizard.getProperties();
- inputTypes = SmooksUIUtils.recordInputDataInfomation(getEditingDomain(),
rootModel.getParams(), inputType, path, pros, compoundCommand);
- }
- }
-
- if (inputTypes != null && !inputTypes.isEmpty()) {
- InputType addedInputType = inputTypes.get(0);
- Object obj = this.inputDataViewer.getInput();
- if (obj != null && obj instanceof List) {
- ((List) obj).add(addedInputType);
- }
-
- deactiveAllInputFile(compoundCommand);
- if (inputType.equals(SmooksModelUtils.INPUT_TYPE_CUSTOME)) {
- // don't active the input file
- } else {
- addedInputType.setActived(true);
- IParam param = addedInputType.getRelatedParameter();
- if (param != null) {
- String value = SmooksModelUtils.INPUT_ACTIVE_TYPE;
- Command c = SetCommand.create(this.getEditingDomain(), param,
- ICorePackage.Literals.PARAM__TYPE, value);
- if (c.canExecute()) {
- compoundCommand.append(c);
- }
- }
- }
- if (!compoundCommand.isEmpty()) {
- getSmooksModelProvider().getEditingDomain().getCommandStack().execute(compoundCommand);
- }
- if (inputDataViewer != null)
- inputDataViewer.refresh();
- }
- }
-
- private void deactiveAllInputFile(CompoundCommand command) {
- Object viewerInput = this.inputDataViewer.getInput();
- if (viewerInput != null && viewerInput instanceof List<?>) {
- List<InputType> inputList = (List) viewerInput;
- for (Iterator<?> iterator = inputList.iterator(); iterator.hasNext();) {
- InputType inputType = (InputType) iterator.next();
- setInputDataActiveStatus(false, inputType, command);
- }
- }
- }
-
- private void setInputDataActiveStatus(boolean active, InputType inputType, final
CompoundCommand command) {
- inputType.setActived(active);
- IParam param = SmooksUIUtils.getInputTypeAssociatedParamType(inputType,
getSmooksConfigResourceList());
- if (param != null) {
- String value = SmooksModelUtils.INPUT_ACTIVE_TYPE;
- if (!active) {
- value = SmooksModelUtils.INPUT_DEACTIVE_TYPE;
- }
- Command c = SetCommand.create(this.getEditingDomain(), param,
ICorePackage.Literals.PARAM__TYPE,
- value);
- if (command != null) {
- command.append(c);
- } else {
- getEditingDomain().getCommandStack().execute(c);
- }
- }
- }
-
-
public void sourceChange(Object model) {
}
-
- private class InputDataViewerLabelProvider extends ExtentionInputLabelProvider
implements ITableColorProvider {
-
- public Color getBackground(Object element, int columnIndex) {
- if (!isValidInputType((InputType) element)) {
- // return ColorConstants.darkGray;
- }
- return null;
- }
-
- public Color getForeground(Object element, int columnIndex) {
- if (!isValidInputType((InputType) element)) {
- return ColorConstants.lightGray;
- }
- return null;
- }
- }
}
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/AbstractFileSelectionWizardPage.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/AbstractFileSelectionWizardPage.java
(rev 0)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/AbstractFileSelectionWizardPage.java 2010-08-19
11:16:52 UTC (rev 24292)
@@ -0,0 +1,102 @@
+/**
+ *
+ */
+package org.jboss.tools.smooks.configuration.editors.file;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.jboss.tools.smooks.configuration.editors.xml.Messages;
+
+/**
+ *
+ * @author Dart Peng Date : 2008-8-13
+ */
+public abstract class AbstractFileSelectionWizardPage extends WizardPage {
+
+ protected FileSelectionPageComponent fileSelectionPageComponent;
+
+ protected IStructuredSelection selection;
+ protected Object returnObject = null;
+ protected Object[] initSelections;
+ protected List<ViewerFilter> filters = new ArrayList<ViewerFilter>();
+ protected boolean multiSelect = false;
+ protected boolean reasourceLoaded = false;
+
+ protected String[] fileExtensionNames;
+
+ public AbstractFileSelectionWizardPage(String pageName, boolean multiSelect, Object[]
initSelections, List<ViewerFilter> filters,String[] fileExtensionNames) {
+ super(pageName);
+ fileSelectionPageComponent = new FileSelectionPageComponent(getShell(), multiSelect,
initSelections, filters, fileExtensionNames);
+ }
+
+ public AbstractFileSelectionWizardPage(String pageName, boolean multiSelect, Object[]
initSelections, List<ViewerFilter> filters) {
+ super(pageName);
+ fileSelectionPageComponent = new FileSelectionPageComponent(getShell(), multiSelect,
initSelections, filters);
+ }
+
+ public AbstractFileSelectionWizardPage(String pageName, String[] fileExtensionNames) {
+ super(pageName);
+ fileSelectionPageComponent = new FileSelectionPageComponent(getShell(),
fileExtensionNames);
+ }
+
+ public void createControl(Composite parent) {
+ Composite mainComposite = new Composite(parent, SWT.NONE);
+
+ fileSelectionPageComponent.createControl(mainComposite);
+
+ this.setControl(mainComposite);
+
+ changeWizardPageStatus();
+ // don't show the error message when first open the dialog
+ this.setErrorMessage(null);
+ parent.getShell().setText(Messages.AbstractFileSelectionWizardPage_WizardTitle);
+
+ fileSelectionPageComponent.addFileSelectionListener(new FileSelectionListener() {
+ public void fileSelected(String fileName) {
+ changeWizardPageStatus();
+ }
+ });
+ }
+
+ protected void changeWizardPageStatus() {
+ String text = getFilePath();
+ String error = null;
+
+ if (text == null || "".equals(text)) { //$NON-NLS-1$
+ error = "File name cannot be null"; //$NON-NLS-1$
+ }
+
+ this.setErrorMessage(error);
+ this.setPageComplete(error == null);
+ }
+
+ public String getFilePath() {
+ return fileSelectionPageComponent.getFilePath();
+ }
+
+ public void setSelection(IStructuredSelection selection) {
+ this.selection = selection;
+ }
+
+ public Object[] getInitSelections() {
+ return initSelections;
+ }
+
+ public void setInitSelections(Object[] initSelections) {
+ this.initSelections = initSelections;
+ }
+
+ public Object getReturnValue() {
+ return null;
+ }
+
+ public void setFileExtensionNames(String[] fileExtensionNames) {
+ fileSelectionPageComponent.setFileExtensionNames(fileExtensionNames);
+ }
+}
Property changes on:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/AbstractFileSelectionWizardPage.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/FileSelectionListener.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/FileSelectionListener.java
(rev 0)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/FileSelectionListener.java 2010-08-19
11:16:52 UTC (rev 24292)
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.configuration.editors.file;
+
+/**
+ * File Selected listener.
+ *
+ * @author <a
href="mailto:tom.fennelly@gmail.com">tom.fennelly@gmail.com</a>
+ */
+public interface FileSelectionListener {
+
+ /**
+ * File Selected event.
+ * @param fileName The file name of the selected file.
+ */
+ void fileSelected(String fileName);
+}
Property changes on:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/FileSelectionListener.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/FileSelectionPageComponent.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/FileSelectionPageComponent.java
(rev 0)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/FileSelectionPageComponent.java 2010-08-19
11:16:52 UTC (rev 24292)
@@ -0,0 +1,345 @@
+/**
+ *
+ */
+package org.jboss.tools.smooks.configuration.editors.file;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.common.ui.dialogs.WorkspaceResourceDialog;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.FocusListener;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+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.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.jboss.tools.smooks.configuration.editors.IFilePathProcessor;
+import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
+
+/**
+ *
+ *
+ * @author Dart Peng Date : 2008-8-13
+ */
+public class FileSelectionPageComponent {
+
+ private String label = "File : "; //$NON-NLS-1$
+ protected Text filePathWidget;
+ private String filePath;
+ protected Composite fileTextComposite;
+ protected CheckboxTableViewer tableViewer = null;
+ protected Button fileSystemBrowseButton;
+ protected boolean reasourceLoaded = false;
+ protected Button workspaceBrowseButton;
+ private List<FileSelectionListener> fileSelectionListeners = new
ArrayList<FileSelectionListener>();
+ protected Object[] initSelections;
+ protected List<ViewerFilter> filters = new ArrayList<ViewerFilter>();
+ protected boolean multiSelect = false;
+ private IFilePathProcessor filePathProcessor = null;
+ protected String[] fileExtensionNames;
+ private Shell shell;
+
+ public FileSelectionPageComponent(Shell shell, boolean multiSelect, Object[]
initSelections, List<ViewerFilter> filters,String[] fileExtensionNames) {
+ this(shell, false, initSelections, Collections.EMPTY_LIST);
+ this.fileExtensionNames = fileExtensionNames;
+ createFileExtensionNameFilter();
+ }
+
+ public FileSelectionPageComponent(Shell shell, boolean multiSelect, Object[]
initSelections, List<ViewerFilter> filters) {
+ this.shell = shell;
+ this.initSelections = initSelections;
+ if (filters != null) {
+ this.filters.addAll(filters);
+ }
+ this.multiSelect = multiSelect;
+ }
+
+ public FileSelectionPageComponent(Shell shell, String[] fileExtensionNames) {
+ this.shell = shell;
+ this.fileExtensionNames = fileExtensionNames;
+ createFileExtensionNameFilter();
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ public void addFileSelectionListener(FileSelectionListener listener) {
+ fileSelectionListeners.add(listener);
+ }
+
+ public void removeFileSelectionListener(FileSelectionListener listener) {
+ fileSelectionListeners.remove(listener);
+ }
+
+ private void notifyFileSelectionListeners() {
+ filePath = filePathWidget.getText();
+ for(FileSelectionListener listener : fileSelectionListeners) {
+ listener.fileSelected(filePath);
+ }
+ }
+
+ /**
+ * @return the fileExtensionNames
+ */
+ public String[] getFileExtensionNames() {
+ return fileExtensionNames;
+ }
+
+ /**
+ * @param fileExtensionNames the fileExtensionNames to set
+ */
+ public void setFileExtensionNames(String[] fileExtensionNames) {
+ this.fileExtensionNames = fileExtensionNames;
+ }
+
+ public void createFileExtensionNameFilter(){
+ if (this.fileExtensionNames != null && this.fileExtensionNames.length != 0) {
+ ViewerFilter extensionNameFilter = new ViewerFilter() {
+ @Override
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ if (element instanceof IFile && fileExtensionNames != null) {
+ String extName = ((IFile) element).getFileExtension();
+ for (int i = 0; i < fileExtensionNames.length; i++) {
+ String name = fileExtensionNames[i];
+ if (name.equalsIgnoreCase(extName)) {
+ return true;
+ }
+ }
+ return false;
+ }
+ return true;
+ }
+ };
+ this.filters.add(extensionNameFilter);
+ }
+ }
+
+ public IFilePathProcessor getFilePathProcessor() {
+ return filePathProcessor;
+ }
+
+ public void setFilePathProcessor(IFilePathProcessor filePathProcessor) {
+ this.filePathProcessor = filePathProcessor;
+ }
+
+ public void createControl(Composite mainComposite) {
+ GridLayout layout = new GridLayout();
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+
+ layout.numColumns = 1;
+ mainComposite.setLayout(layout);
+ mainComposite.setLayoutData(gd);
+
+ createFileSelectionComposite(mainComposite);
+
+ // register the listener for controls
+ hookFileTextModifyListener();
+ hookBrowseButtonSelectionAdapter();
+ }
+
+ private void hookFileTextModifyListener() {
+ filePathWidget.addFocusListener(new FocusListener() {
+ public void focusGained(FocusEvent arg0) {
+ }
+ public void focusLost(FocusEvent arg0) {
+ notifyFileSelectionListeners();
+ }});
+ filePathWidget.addKeyListener(new KeyListener() {
+ public void keyReleased(KeyEvent event) {
+ }
+ public void keyPressed(KeyEvent event) {
+ if(event.character == '\r') {
+ notifyFileSelectionListeners();
+ }
+ }
+ });
+ }
+
+ private void hookBrowseButtonSelectionAdapter() {
+ SelectionAdapter browseButtonSelectionAdapter = new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ Text relationT = null;
+ if (e.getSource() == fileSystemBrowseButton) {
+ relationT = filePathWidget;
+ }
+ openFileSelection(relationT);
+ }
+ };
+ SelectionAdapter wbrowseButtonSelectionAdapter = new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ Text relationT = null;
+ if (e.getSource() == workspaceBrowseButton) {
+ relationT = filePathWidget;
+ }
+ openWorkSpaceSelection(relationT);
+ }
+
+ };
+
+ workspaceBrowseButton.addSelectionListener(wbrowseButtonSelectionAdapter);
+ // xmlFileSystemBrowseButton
+ // .addSelectionListener(browseButtonSelectionAdapter);
+ fileSystemBrowseButton.addSelectionListener(browseButtonSelectionAdapter);
+ }
+
+ protected String processFileSystemFilePath(String path) {
+ if (filePathProcessor != null) {
+ String s = filePathProcessor.processFileSystemPath(path);
+ if (s != null) {
+ return s;
+ }
+ }
+ path = SmooksUIUtils.FILE_PRIX + path;
+ return path;
+ }
+
+ protected String processWorkSpaceFilePath(IFile file) {
+ if (filePathProcessor != null) {
+ String s = filePathProcessor.processWorkBenchPath(file);
+ if (s != null) {
+ return s;
+ }
+ }
+ String s = file.getFullPath().toPortableString();
+ s = SmooksUIUtils.WORKSPACE_PRIX + s;
+ return s;
+ }
+
+ public Text createFilePathText(Composite parent) {
+ fileTextComposite = new Composite(parent, SWT.NONE);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.grabExcessHorizontalSpace = true;
+ fileTextComposite.setLayoutData(gd);
+ GridLayout xsdtgl = new GridLayout();
+ xsdtgl.marginWidth = 0;
+ xsdtgl.marginHeight = 0;
+ xsdtgl.numColumns = 1;
+ fileTextComposite.setLayout(xsdtgl);
+
+ Text fileText = new Text(fileTextComposite, SWT.BORDER);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ fileText.setLayoutData(gd);
+ gd.grabExcessHorizontalSpace = true;
+
+ return fileText;
+ }
+
+ protected Composite createFileSelectionComposite(Composite parent) {
+ Composite xsdComposite = new Composite(parent, SWT.NONE);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ xsdComposite.setLayoutData(gd);
+ GridLayout xsdLayout = new GridLayout();
+ xsdLayout.numColumns = 2;
+ xsdLayout.marginWidth = 0;
+ xsdComposite.setLayout(xsdLayout);
+ Label nfileLanel = new Label(xsdComposite, SWT.NONE);
+ nfileLanel.setText(label);
+
+ filePathWidget = createFilePathText(xsdComposite);
+
+ Composite browseButtonComposite = new Composite(xsdComposite, SWT.NONE);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 2;
+ browseButtonComposite.setLayoutData(gd);
+
+ GridLayout bg = new GridLayout();
+ bg.numColumns = 2;
+ bg.marginHeight = 0;
+ bg.marginWidth = 0;
+ bg.makeColumnsEqualWidth = false;
+ browseButtonComposite.setLayout(bg);
+
+ fileSystemBrowseButton = new Button(browseButtonComposite, SWT.NONE);
+ fileSystemBrowseButton.setText(Messages.FileSelectionPageComponent_Browse_FileSys_Button);
+
+ workspaceBrowseButton = new Button(browseButtonComposite, SWT.NONE);
+ workspaceBrowseButton.setText(Messages.FileSelectionPageComponent_Browse_Workspace_Button);
+ gd = new GridData();
+ gd.horizontalAlignment = GridData.END;
+ workspaceBrowseButton.setLayoutData(gd);
+
+ gd = new GridData();
+ gd.grabExcessHorizontalSpace = true;
+ gd.horizontalAlignment = GridData.END;
+ fileSystemBrowseButton.setLayoutData(gd);
+
+ return xsdComposite;
+ }
+
+ protected void setCompositeChildrenEnabled(Composite composite, boolean enabled) {
+ Control[] children = composite.getChildren();
+ for (int i = 0; i < children.length; i++) {
+ Control child = children[i];
+ if (child instanceof Text) {
+ child.setEnabled(enabled);
+ }
+ if (child instanceof Button) {
+ child.setEnabled(enabled);
+ }
+ if (child instanceof Composite) {
+ setCompositeChildrenEnabled((Composite) child, enabled);
+ }
+ }
+ }
+
+ private void openFileSelection(Text relationText) {
+ FileDialog dialog = new FileDialog(shell);
+ if (fileExtensionNames != null) {
+ String s = ""; //$NON-NLS-1$
+ for (int i = 0; i < fileExtensionNames.length; i++) {
+ String exname = fileExtensionNames[i];
+ s += "*." + exname + ";"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ if (s.length() != 0) {
+ s = s.substring(0, s.length() - 1);
+ dialog.setFilterExtensions(new String[]{s,"*.*"}); //$NON-NLS-1$
+ }
+ }
+ String path = dialog.open();
+ if (path != null) {
+ path = processFileSystemFilePath(path);
+ relationText.setText(path);
+ notifyFileSelectionListeners();
+ }
+ }
+
+ private void openWorkSpaceSelection(Text relationT) {
+ IFile[] files = WorkspaceResourceDialog.openFileSelection(shell,
+ "Select Files", "", false, initSelections, filters);
//$NON-NLS-1$ //$NON-NLS-2$
+ // dialog.setInitialSelections(selectedResources);
+ if (files.length > 0) {
+ IFile file = files[0];
+ String s = processWorkSpaceFilePath(file);
+ relationT.setText(s);
+ notifyFileSelectionListeners();
+ }
+ }
+
+ public String getFilePath() {
+ return filePath;
+ }
+
+ public void setFilePath(String filePath) {
+ if(!filePathWidget.isDisposed()) {
+ filePathWidget.setText(filePath);
+ }
+ }
+}
Property changes on:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/FileSelectionPageComponent.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/Messages.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/Messages.java
(rev 0)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/Messages.java 2010-08-19
11:16:52 UTC (rev 24292)
@@ -0,0 +1,17 @@
+package org.jboss.tools.smooks.configuration.editors.file;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+
+ public static String FileSelectionPageComponent_Browse_FileSys_Button;
+ public static String FileSelectionPageComponent_Browse_Workspace_Button;
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(Messages.class.getPackage().getName() + ".messages",
Messages.class); //$NON-NLS-1$
+ }
+
+ private Messages() {
+ }
+}
Property changes on:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/Messages.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/messages.properties
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/messages.properties
(rev 0)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/file/messages.properties 2010-08-19
11:16:52 UTC (rev 24292)
@@ -0,0 +1,2 @@
+FileSelectionPageComponent_Browse_FileSys_Button=Browse File System...
+FileSelectionPageComponent_Browse_Workspace_Button=Browse Workspace...
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputModelFactory.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputModelFactory.java
(rev 0)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputModelFactory.java 2010-08-19
11:16:52 UTC (rev 24292)
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.configuration.editors.input;
+
+import org.eclipse.jdt.core.IJavaProject;
+import org.jboss.tools.smooks.model.SmooksModel;
+import org.jboss.tools.smooks.templating.model.ModelBuilderException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * Input Source Model Factory.
+ * @author <a
href="mailto:tom.fennelly@gmail.com">tom.fennelly@gmail.com</a>
+ */
+public interface InputModelFactory {
+
+ /**
+ * Get the input message model for the specified {@link SmooksModel} instance.
+ * @param smooksConfigModel The Smooks model instance.
+ * @param project The Eclipse project.
+ * @return The model.
+ * @throws ModelBuilderException Error building model.
+ */
+ Document getModel(SmooksModel smooksConfigModel, IJavaProject project) throws
ModelBuilderException;
+}
Property changes on:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputModelFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputParameter.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputParameter.java 2010-08-19
10:56:56 UTC (rev 24291)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputParameter.java 2010-08-19
11:16:52 UTC (rev 24292)
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * 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.configuration.editors.input;
-
-/**
- * @author Dart
- *
- */
-public class InputParameter {
- private String name;
-
- private String value;
-
- /**
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * @param name the name to set
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * @return the value
- */
- public String getValue() {
- return value;
- }
-
- /**
- * @param value the value to set
- */
- public void setValue(String value) {
- this.value = value;
- }
-
-
-}
Deleted:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputReaderConfigurationContributor.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputReaderConfigurationContributor.java 2010-08-19
10:56:56 UTC (rev 24291)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputReaderConfigurationContributor.java 2010-08-19
11:16:52 UTC (rev 24292)
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.configuration.editors.input;
-
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.forms.editor.FormPage;
-
-/**
- *
- * @author <a
href="mailto:tom.fennelly@gmail.com">tom.fennelly@gmail.com</a>
- */
-public interface InputReaderConfigurationContributor {
-
- /**
- * Add the input configuration controls to the Input Configuration area
- * of the input task panel.
- * @param formPage The composite parent {@link FormPage}.
- * @param configComposite The task panel Composite.
- */
- void addInputConfigControls(FormPage formPage, Composite configComposite);
-}
Modified:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputSourceType.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputSourceType.java 2010-08-19
10:56:56 UTC (rev 24291)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputSourceType.java 2010-08-19
11:16:52 UTC (rev 24292)
@@ -10,7 +10,12 @@
******************************************************************************/
package org.jboss.tools.smooks.configuration.editors.input;
-import
org.jboss.tools.smooks.configuration.editors.input.contributors.SimpleMessageContributor;
+import
org.jboss.tools.smooks.configuration.editors.input.contributors.SampleDataConfigurationContributorFactory;
+import
org.jboss.tools.smooks.configuration.editors.input.contributors.SimpleMessageContributorFactory;
+import
org.jboss.tools.smooks.configuration.editors.input.contributors.XSDConfigurationContributorFactory;
+import org.jboss.tools.smooks.configuration.editors.input.model.JavaInputModelFactory;
+import org.jboss.tools.smooks.configuration.editors.input.model.XMLInputModelFactory;
+import org.jboss.tools.smooks.configuration.editors.input.model.XSDInputModelFactory;
/**
* Smooks filter input Source type.
@@ -20,27 +25,34 @@
public enum InputSourceType {
// NOTE: If a new type is added, be sure and update the fromTypeIndex/fromTypeName
static methods !!!
- NONE(0, new
SimpleMessageContributor(Messages.InputSourceType_Warning_Specify_Input_Type)),
- XML(1, new
SimpleMessageContributor(Messages.InputSourceType_Warning_Specify_Sample_Data)),
- XSD(2, new
SimpleMessageContributor(Messages.InputSourceType_Warning_Specify_Sample_Data)),
- JAVA(3, new
SimpleMessageContributor(Messages.InputSourceType_Warning_Specify_Sample_Data));
+ NONE(0, new
SimpleMessageContributorFactory(Messages.InputSourceType_Warning_Specify_Input_Type),
null),
+ XML(1, new SampleDataConfigurationContributorFactory(), new XMLInputModelFactory()),
+ XSD(2, new XSDConfigurationContributorFactory(), new XSDInputModelFactory()),
+ JAVA(3, new
SimpleMessageContributorFactory(Messages.InputSourceType_Warning_Specify_Sample_Data), new
JavaInputModelFactory());
private int typeIndex;
- private InputReaderConfigurationContributor configurationContributor;
+ private InputTaskPanelContributorFactory taskPanelContributorFactory;
+ private InputModelFactory inputModelFactory;
- InputSourceType(int typeIndex, InputReaderConfigurationContributor
configurationContributor) {
+ InputSourceType(int typeIndex, InputTaskPanelContributorFactory
configurationContributorFactory, InputModelFactory inputModelFactory) {
this.typeIndex = typeIndex;
- this.configurationContributor = configurationContributor;
+ this.taskPanelContributorFactory = configurationContributorFactory;
+ this.inputModelFactory = inputModelFactory;
+ configurationContributorFactory.setInputSourceType(this);
}
public int getTypeIndex() {
return typeIndex;
}
- public InputReaderConfigurationContributor getConfigurationContributor() {
- return configurationContributor;
+ public InputTaskPanelContributorFactory getTaskPanelContributorFactory() {
+ return taskPanelContributorFactory;
}
+ public InputModelFactory getInputModelFactory() {
+ return inputModelFactory;
+ }
+
public boolean isType(int typeIndex) {
return (this.typeIndex == typeIndex);
}
@@ -65,7 +77,7 @@
return InputSourceType.NONE;
}
- throw new InvalidInputSourceTypeException("");
+ throw new
InvalidInputSourceTypeException(Messages.InputSourceType_Unknown_Input_Type_Index + "
" + typeIndex);
}
public static InputSourceType fromTypeName(String typeName) throws
InvalidInputSourceTypeException {
@@ -80,9 +92,18 @@
return InputSourceType.NONE;
}
- throw new InvalidInputSourceTypeException("");
+ throw new
InvalidInputSourceTypeException(Messages.InputSourceType_Unknown_Input_Type_Name + "
" + typeName);
}
+ public static boolean isValidName(String typeName) {
+ try {
+ fromTypeName(typeName);
+ return true;
+ } catch (InvalidInputSourceTypeException e) {
+ return false;
+ }
+ }
+
public static boolean isValidIndexNamePair(int typeIndex, String typeName) throws
InvalidInputSourceTypeException {
return (fromTypeIndex(typeIndex) == fromTypeName(typeName));
}
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputTaskPanelContributor.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputTaskPanelContributor.java
(rev 0)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputTaskPanelContributor.java 2010-08-19
11:16:52 UTC (rev 24292)
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.configuration.editors.input;
+
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * Input task panel contributor.
+ *
+ * @author <a
href="mailto:tom.fennelly@gmail.com">tom.fennelly@gmail.com</a>
+ */
+public interface InputTaskPanelContributor {
+
+ /**
+ * Set the Input Type Source configuration Composite on the contributor instance.
+ * @param inputSourceConfigComposite Input Source Type configuration Composite.
+ */
+ void setInputSourceConfigComposite(Composite inputSourceConfigComposite);
+
+ /**
+ * Add the input configuration controls to the Input Configuration area
+ * of the input task panel.
+ */
+ void addInputSourceTypeConfigControls();
+}
Property changes on:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputTaskPanelContributor.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputTaskPanelContributorFactory.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputTaskPanelContributorFactory.java
(rev 0)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputTaskPanelContributorFactory.java 2010-08-19
11:16:52 UTC (rev 24292)
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.configuration.editors.input;
+
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.part.EditorPart;
+import org.jboss.tools.smooks.model.SmooksModel;
+import org.milyn.javabean.dynamic.Model;
+
+/**
+ * Input task panel contributor Factory.
+ *
+ * @author <a
href="mailto:tom.fennelly@gmail.com">tom.fennelly@gmail.com</a>
+ */
+public interface InputTaskPanelContributorFactory {
+
+ /**
+ * Set the {@link InputSourceType} associated with the factory instance.
+ * @param inputSourceType The {@link InputSourceType} associated with the factory
instance.
+ */
+ void setInputSourceType(InputSourceType inputSourceType);
+
+ /**
+ * Create a new contributor instance.
+ * @param toolkit The associate Form Toolkit instance.
+ * @param editorPart Editor part.
+ * @param configModel The Smooks configuration model.
+ * @return The contributor instance.
+ */
+ InputTaskPanelContributor newInstance(FormToolkit toolkit, EditorPart editorPart,
Model<SmooksModel> configModel);
+}
Property changes on:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputTaskPanelContributorFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputType.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputType.java 2010-08-19
10:56:56 UTC (rev 24291)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/InputType.java 2010-08-19
11:16:52 UTC (rev 24292)
@@ -1,90 +0,0 @@
-package org.jboss.tools.smooks.configuration.editors.input;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jboss.tools.smooks.model.core.IParam;
-
-public class InputType {
- private String path;
- private String type;
- private boolean actived = false;
-
- private IParam relatedParameter = null;
-
- private List<InputParameter> parameters = null;
-
- /**
- * @return the parameters
- */
- public List<InputParameter> getParameters() {
- if (parameters == null) {
- parameters = new ArrayList<InputParameter>();
- }
- return parameters;
- }
-
-
- /**
- * @return the relatedParameter
- */
- public IParam getRelatedParameter() {
- return relatedParameter;
- }
-
-
- /**
- * @param relatedParameter the relatedParameter to set
- */
- public void setRelatedParameter(IParam relatedParameter) {
- this.relatedParameter = relatedParameter;
- }
-
-
-
- /**
- * @return the path
- */
- public String getPath() {
- return path;
- }
-
- /**
- * @param path
- * the path to set
- */
- public void setPath(String path) {
- this.path = path;
- }
-
- /**
- * @return the type
- */
- public String getType() {
- return type;
- }
-
- /**
- * @param type
- * the type to set
- */
- public void setType(String type) {
- this.type = type;
- }
-
- /**
- * @return the actived
- */
- public boolean isActived() {
- return actived;
- }
-
- /**
- * @param actived
- * the actived to set
- */
- public void setActived(boolean actived) {
- this.actived = actived;
- }
-
-}
Modified:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/Messages.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/Messages.java 2010-08-19
10:56:56 UTC (rev 24291)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/Messages.java 2010-08-19
11:16:52 UTC (rev 24292)
@@ -6,6 +6,10 @@
public static String InputSourceType_Warning_Specify_Input_Type;
public static String InputSourceType_Warning_Specify_Sample_Data;
+ public static String InputSourceType_Unknown_Input_Type_Name;
+ public static String InputSourceType_Unknown_Input_Type_Index;
+ public static String XSDConfigurationContributor_XML_Schema_File;
+ public static String XSDConfigurationContributor_Root_Element_Name;
static {
// initialize resource bundle
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/contributors/SampleDataConfigurationContributorFactory.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/contributors/SampleDataConfigurationContributorFactory.java
(rev 0)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/contributors/SampleDataConfigurationContributorFactory.java 2010-08-19
11:16:52 UTC (rev 24292)
@@ -0,0 +1,434 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.configuration.editors.input.contributors;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileInfo;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.edit.command.RemoveCommand;
+import org.eclipse.emf.edit.command.SetCommand;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.ICheckStateProvider;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITableColorProvider;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.ide.IDE;
+import org.eclipse.ui.part.EditorPart;
+import org.jboss.tools.smooks.configuration.SmooksModelUtils;
+import org.jboss.tools.smooks.configuration.editors.ExtentionInputContentProvider;
+import org.jboss.tools.smooks.configuration.editors.ExtentionInputLabelProvider;
+import org.jboss.tools.smooks.configuration.editors.Messages;
+import org.jboss.tools.smooks.configuration.editors.input.InputSourceType;
+import org.jboss.tools.smooks.configuration.editors.input.InputTaskPanelContributor;
+import
org.jboss.tools.smooks.configuration.editors.input.InputTaskPanelContributorFactory;
+import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
+import
org.jboss.tools.smooks.configuration.editors.wizard.IStructuredDataSelectionWizard;
+import org.jboss.tools.smooks.configuration.editors.wizard.ViewerInitorStore;
+import org.jboss.tools.smooks.model.ISmooksModelProvider;
+import org.jboss.tools.smooks.model.SmooksModel;
+import org.jboss.tools.smooks.model.core.GlobalParams;
+import org.jboss.tools.smooks.model.core.ICorePackage;
+import org.jboss.tools.smooks.model.core.IParam;
+import org.milyn.javabean.dynamic.Model;
+
+/**
+ * Simple contributor used to add a message to the configuration composite.
+ *
+ * @author <a
href="mailto:tom.fennelly@gmail.com">tom.fennelly@gmail.com</a>
+ */
+public class SampleDataConfigurationContributorFactory implements
InputTaskPanelContributorFactory {
+
+ private InputSourceType inputSourceType;
+
+ public void setInputSourceType(InputSourceType inputSourceType) {
+ this.inputSourceType = inputSourceType;
+ }
+
+ public InputTaskPanelContributor newInstance(FormToolkit toolkit, EditorPart editorPart,
Model<SmooksModel> configModel) {
+ return new PanelContributor(toolkit, editorPart, configModel);
+ }
+
+ private class PanelContributor implements InputTaskPanelContributor {
+
+ private EditorPart editorPart;
+ private Model<SmooksModel> configModel;
+ private ISmooksModelProvider modelProvider;
+ private EditingDomain editingDomain;
+ private Composite inputSourceConfigComposite;
+ private CheckboxTableViewer inputDataViewer;
+ private boolean lockCheck;
+
+ public Button addInputDataButton;
+ private Button removeInputDataButton;
+
+ public PanelContributor(FormToolkit toolkit, EditorPart editorPart,
Model<SmooksModel> configModel) {
+ this.editorPart = editorPart;
+ this.configModel = configModel;
+ this.modelProvider = configModel.getModelRoot().getModelProvider();
+ this.editingDomain = modelProvider.getEditingDomain();
+ }
+
+ public void setInputSourceConfigComposite(Composite inputSourceConfigComposite) {
+ this.inputSourceConfigComposite = inputSourceConfigComposite;
+ }
+
+ public void addInputSourceTypeConfigControls() {
+ Composite mainComposite = new Composite(inputSourceConfigComposite, SWT.NONE);
+ GridLayout gl = new GridLayout();
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+
+ gl.numColumns = 2;
+ mainComposite.setLayout(gl);
+ mainComposite.setLayoutData(gd);
+
+ Composite tableComposite = new Composite(mainComposite, SWT.BORDER);
+ FillLayout fillLayout = new FillLayout();
+ fillLayout.marginHeight = 1;
+ fillLayout.marginWidth = 1;
+ gd = new GridData(GridData.FILL_BOTH);
+ gd.heightHint = 100;
+ tableComposite.setLayoutData(gd);
+ tableComposite.setLayout(fillLayout);
+
+ inputDataViewer = CheckboxTableViewer.newCheckList(tableComposite, SWT.MULTI |
SWT.FULL_SELECTION);
+ inputDataViewer.setCheckStateProvider(new ICheckStateProvider() {
+
+ public boolean isGrayed(Object element) {
+ return !isValidInputType((IParam) element);
+ }
+
+ public boolean isChecked(Object element) {
+ if (element instanceof IParam) {
+ return SmooksModelUtils.INPUT_ACTIVE_TYPE.equals(((IParam)element).getType());
+ }
+ return false;
+ }
+ });
+ inputDataViewer.addCheckStateListener(new ICheckStateListener() {
+
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ if (lockCheck)
+ return;
+ IParam param = (IParam) event.getElement();
+ if (!isValidInputType(param)) {
+ lockCheck = true;
+ inputDataViewer.setChecked(param, false);
+ lockCheck = false;
+ return;
+ }
+ CompoundCommand compoundCommand = new CompoundCommand();
+ if (event.getChecked()) {
+
+ Object[] checkedObjects = inputDataViewer.getCheckedElements();
+ for(Object checkedObject : checkedObjects) {
+ if (checkedObject != param) {
+ IParam checkedParam = (IParam) checkedObject;
+ setParamType(checkedParam, SmooksModelUtils.INPUT_DEACTIVE_TYPE,
compoundCommand);
+ lockCheck = true;
+ inputDataViewer.setChecked(checkedParam, false);
+ lockCheck = false;
+ }
+ }
+ if (param != null) {
+ setParamType(param, SmooksModelUtils.INPUT_ACTIVE_TYPE, compoundCommand);
+ }
+ } else {
+ if (param != null) {
+ setParamType(param, SmooksModelUtils.INPUT_DEACTIVE_TYPE, compoundCommand);
+ }
+ }
+ editingDomain.getCommandStack().execute(compoundCommand);
+ }
+ });
+ inputDataViewer.addDoubleClickListener(new IDoubleClickListener() {
+
+ public void doubleClick(DoubleClickEvent event) {
+ IStructuredSelection selection = (IStructuredSelection) event.getSelection();
+ Object element = selection.getFirstElement();
+ if (element instanceof IParam) {
+ IParam param = (IParam) element;
+ String type = param.getType();
+ String filePath = param.getValue();
+ if (type != null && filePath != null) {
+ if (SmooksModelUtils.INPUT_TYPE_JAVA.equals(type)) {
+ IFile file = ((IFileEditorInput) editorPart.getEditorInput()).getFile();
+ IJavaProject javaProject = JavaCore.create(file.getProject());
+ if (javaProject != null) {
+ try {
+ if (filePath.endsWith("[]")) { //$NON-NLS-1$
+ filePath = filePath.substring(0, filePath.length() - 2);
+ }
+ IJavaElement result = javaProject.findType(filePath);
+ if (result != null)
+ JavaUI.openInEditor(result);
+ else {
+ MessageDialog.openError(editorPart.getEditorSite().getShell(),
+ Messages.SmooksReaderFormPage_CantFindTypeErrorTitle,
+ "Can't find type \"" + filePath + "\" in
\"" //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
+ + javaProject.getProject().getName() + "\" project.");
//$NON-NLS-1$
+ }
+ } catch (Exception e) {
+
+ }
+ }
+ } else {
+ try {
+ filePath = SmooksUIUtils.parseFilePath(filePath);
+ if (filePath != null) {
+ IFileStore fileStore = EFS.getLocalFileSystem().getStore(new Path(filePath));
+ IFileInfo fetchInfo = fileStore.fetchInfo();
+ if (!fetchInfo.isDirectory() && fetchInfo.exists()) {
+ IWorkbenchWindow window = editorPart.getEditorSite().getWorkbenchWindow();
+ IWorkbenchPage page = window.getActivePage();
+ try {
+ IDE.openEditorOnFileStore(page, fileStore);
+ } catch (PartInitException e) {
+ MessageDialog.open(MessageDialog.ERROR, window.getShell(),
+ Messages.SmooksReaderFormPage_OpenFileErrorTitle,
+ "Can't open the file : '" + filePath + "'",
SWT.SHEET); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ } else {
+ }
+ }
+ } catch (Exception e) {
+ MessageDialog.open(MessageDialog.ERROR,
editorPart.getEditorSite().getWorkbenchWindow().getShell(),
+ Messages.SmooksReaderFormPage_OpenFileErrorTitle,
+ "Can't open the file : '" + filePath + "'",
SWT.SHEET); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
+ }
+ }
+ }
+ }
+ }
+ });
+
+ TableColumn pathColumn = new TableColumn(inputDataViewer.getTable(), SWT.NONE);
+ pathColumn.setText(Messages.SmooksReaderFormPage_PathColumnText);
+ pathColumn.setWidth(600);
+
+ inputDataViewer.setContentProvider(new ExtentionInputContentProvider());
+ inputDataViewer.setLabelProvider(new InputDataViewerLabelProvider());
+ inputDataViewer.getTable().setHeaderVisible(true);
+ inputDataViewer.getTable().setLinesVisible(true);
+ if (modelProvider != null) {
+ inputDataViewer.setInput(getInputs());
+ }
+
+ Composite buttonComposite = new Composite(mainComposite, SWT.NONE);
+ gd = new GridData(GridData.FILL_VERTICAL);
+ buttonComposite.setLayoutData(gd);
+ GridLayout l = new GridLayout();
+ buttonComposite.setLayout(l);
+
+ addInputDataButton = new Button(buttonComposite, SWT.NONE);
+ addInputDataButton.setText(Messages.SmooksReaderFormPage_AddButtonLabel);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ addInputDataButton.setLayoutData(gd);
+ addInputDataButton.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent e) {
+ showInputDataWizard();
+ }
+
+ });
+
+ removeInputDataButton = new Button(buttonComposite, SWT.NONE);
+ removeInputDataButton.setText(Messages.SmooksReaderFormPage_DeleteButtonLabel);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ removeInputDataButton.setLayoutData(gd);
+ removeInputDataButton.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent e) {
+ IStructuredSelection selection = (IStructuredSelection)
inputDataViewer.getSelection();
+ if (selection != null) {
+ List<IParam> inputs = selection.toList();
+ CompoundCommand compoundCommand = new CompoundCommand();
+
+ for (IParam input : inputs) {
+ removeParam(input, compoundCommand);
+ }
+
+ if(!compoundCommand.isEmpty()) {
+ compoundCommand.execute();
+ }
+
+ if (!inputs.isEmpty()) {
+ List<?> viewerInput = (List<?>) inputDataViewer.getInput();
+ viewerInput.removeAll(inputs);
+ // inputTypeChanged();
+ if (inputDataViewer != null) {
+ inputDataViewer.refresh();
+ }
+ }
+ }
+ }
+ });
+
+ refreshInputDataButtons();
+
+ inputSourceConfigComposite.setBackgroundMode(SWT.TRANSPARENT);
+ inputSourceConfigComposite.layout();
+ }
+
+ private void setParamType(IParam param, String typeValue, CompoundCommand
compoundCommand) {
+ Command c = SetCommand.create(editingDomain, param, ICorePackage.Literals.PARAM__TYPE,
typeValue);
+ if (c.canExecute()) {
+ compoundCommand.append(c);
+ }
+ }
+
+ private void removeParam(IParam param, CompoundCommand compoundCommand) {
+ List<IParam> removingList = new ArrayList<IParam>();
+
+ removingList.add(param);
+
+ Command removeCommand = RemoveCommand.create(editingDomain, removingList);
+ if (removeCommand.canExecute()) {
+ compoundCommand.append(removeCommand);
+ }
+ }
+
+ protected void showInputDataWizard() {
+ String inputType = modelProvider.getInputType();
+ SmooksModel rootModel = configModel.getModelRoot();
+
+ IStructuredDataSelectionWizard wizard =
ViewerInitorStore.getInstance().getStructuredDataCreationWizard(inputType);
+ WizardDialog dialog = new WizardDialog(editorPart.getEditorSite().getShell(),
wizard);
+ wizard.init(editorPart.getEditorSite(), editorPart.getEditorInput());
+
+ if (dialog.open() == Dialog.OK) {
+ String path = wizard.getStructuredDataSourcePath();
+ Properties pros = wizard.getProperties();
+
+ CompoundCommand compoundCommand = new CompoundCommand();
+ IParam addedInputType = SmooksUIUtils.recordInputDataInfomation(editingDomain,
rootModel.getParams(), inputType, path, pros, compoundCommand);
+
+ if (addedInputType != null) {
+ Object obj = this.inputDataViewer.getInput();
+
+ if (obj != null && obj instanceof List) {
+ ((List) obj).add(addedInputType);
+ }
+
+ deactivateAllInputs(compoundCommand);
+
+ if (inputType.equals(SmooksModelUtils.INPUT_TYPE_CUSTOME)) {
+ // don't active the input file
+ } else {
+ setParamType(addedInputType, SmooksModelUtils.INPUT_ACTIVE_TYPE, compoundCommand);
+ }
+
+ if (!compoundCommand.isEmpty()) {
+ editingDomain.getCommandStack().execute(compoundCommand);
+ }
+
+ if (inputDataViewer != null) {
+ inputDataViewer.refresh();
+ }
+ }
+ }
+ }
+
+ private void deactivateAllInputs(CompoundCommand command) {
+ Object viewerInput = this.inputDataViewer.getInput();
+ if (viewerInput != null && viewerInput instanceof List<?>) {
+ List<IParam> inputList = (List<IParam>) viewerInput;
+ for (IParam inputType : inputList ) {
+ setParamType(inputType, SmooksModelUtils.INPUT_ACTIVE_TYPE, command);
+ }
+ }
+ }
+
+ private List<IParam> getInputs() {
+ List<IParam> inputs = new ArrayList<IParam>();
+ GlobalParams globalParams = configModel.getModelRoot().getParams();
+
+ for(IParam param : globalParams.getParams()) {
+ if(inputSourceType.isType(param.getName())) {
+ inputs.add(param);
+ }
+ }
+
+ return inputs;
+ }
+
+ private void refreshInputDataButtons() {
+ this.addInputDataButton.setEnabled(true);
+ this.removeInputDataButton.setEnabled(true);
+
+ String inputType = modelProvider.getInputType();
+ if (inputType == null || inputType.trim().equals("")) { //$NON-NLS-1$
+ this.addInputDataButton.setEnabled(false);
+ this.removeInputDataButton.setEnabled(false);
+ }
+ }
+
+ protected boolean isValidInputType(IParam inputParam) {
+ if (inputParam == null) {
+ // not specified is OK...
+ return true;
+ }
+
+ return inputSourceType.isType(inputParam.getName());
+ }
+
+ private class InputDataViewerLabelProvider extends ExtentionInputLabelProvider
implements ITableColorProvider {
+
+ public Color getBackground(Object element, int columnIndex) {
+ if (!isValidInputType((IParam) element)) {
+ // return ColorConstants.darkGray;
+ }
+ return null;
+ }
+
+ public Color getForeground(Object element, int columnIndex) {
+ if (!isValidInputType((IParam) element)) {
+ return ColorConstants.lightGray;
+ }
+ return null;
+ }
+ }
+ }
+}
Property changes on:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/contributors/SampleDataConfigurationContributorFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/contributors/SimpleMessageContributor.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/contributors/SimpleMessageContributor.java 2010-08-19
10:56:56 UTC (rev 24291)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/contributors/SimpleMessageContributor.java 2010-08-19
11:16:52 UTC (rev 24292)
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.configuration.editors.input.contributors;
-
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.forms.editor.FormPage;
-import
org.jboss.tools.smooks.configuration.editors.input.InputReaderConfigurationContributor;
-
-/**
- * Simple contributor used to add a "No type selected" warning message to the
composite.
- *
- * @author <a
href="mailto:tom.fennelly@gmail.com">tom.fennelly@gmail.com</a>
- */
-public class SimpleMessageContributor implements InputReaderConfigurationContributor {
-
- private String message;
-
- public SimpleMessageContributor(String message) {
- this.message = message;
- }
-
- public void addInputConfigControls(FormPage formPage, Composite configComposite) {
- Label formText = formPage.getManagedForm().getToolkit().createLabel(configComposite,
""); //$NON-NLS-1$
- GridData gd = new GridData(GridData.FILL_BOTH);
-
- gd.heightHint = 50;
- gd.horizontalSpan = 2;
- formText.setLayoutData(gd);
- formText.setText(message);
- }
-}
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/contributors/SimpleMessageContributorFactory.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/contributors/SimpleMessageContributorFactory.java
(rev 0)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/contributors/SimpleMessageContributorFactory.java 2010-08-19
11:16:52 UTC (rev 24292)
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.configuration.editors.input.contributors;
+
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.part.EditorPart;
+import org.jboss.tools.smooks.configuration.editors.input.InputSourceType;
+import org.jboss.tools.smooks.configuration.editors.input.InputTaskPanelContributor;
+import
org.jboss.tools.smooks.configuration.editors.input.InputTaskPanelContributorFactory;
+import org.jboss.tools.smooks.model.SmooksModel;
+import org.milyn.javabean.dynamic.Model;
+
+/**
+ * Simple contributor used to add a message to the configuration composite.
+ *
+ * @author <a
href="mailto:tom.fennelly@gmail.com">tom.fennelly@gmail.com</a>
+ */
+public class SimpleMessageContributorFactory implements InputTaskPanelContributorFactory
{
+
+ private String message;
+
+ public SimpleMessageContributorFactory(String message) {
+ this.message = message;
+ }
+
+ public void setInputSourceType(InputSourceType inputSourceType) {
+ }
+
+ public InputTaskPanelContributor newInstance(FormToolkit toolkit, EditorPart editorPart,
Model<SmooksModel> configModel) {
+ return new PanelContributor(toolkit);
+ }
+
+ private class PanelContributor implements InputTaskPanelContributor {
+
+ private FormToolkit toolkit;
+ private Composite inputSourceConfigComposite;
+
+ public PanelContributor(FormToolkit toolkit) {
+ this.toolkit = toolkit;
+ }
+
+ public void setInputSourceConfigComposite(Composite inputSourceConfigComposite) {
+ this.inputSourceConfigComposite = inputSourceConfigComposite;
+ }
+
+ public void addInputSourceTypeConfigControls() {
+ Label formText = toolkit.createLabel(inputSourceConfigComposite, "");
//$NON-NLS-1$
+ GridData gd = new GridData(GridData.FILL_BOTH);
+
+ gd.heightHint = 50;
+ gd.horizontalSpan = 2;
+ formText.setLayoutData(gd);
+ formText.setText(message);
+
+ inputSourceConfigComposite.layout();
+ }
+ }
+}
Property changes on:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/contributors/SimpleMessageContributorFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/contributors/XSDConfigurationContributorFactory.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/contributors/XSDConfigurationContributorFactory.java
(rev 0)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/contributors/XSDConfigurationContributorFactory.java 2010-08-19
11:16:52 UTC (rev 24292)
@@ -0,0 +1,227 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.configuration.editors.input.contributors;
+
+import java.io.IOException;
+import java.util.Set;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.edit.command.SetCommand;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.swt.SWT;
+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.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.part.EditorPart;
+import org.jboss.tools.smooks.configuration.SmooksModelUtils;
+import org.jboss.tools.smooks.configuration.editors.file.FileSelectionListener;
+import org.jboss.tools.smooks.configuration.editors.file.FileSelectionPageComponent;
+import org.jboss.tools.smooks.configuration.editors.input.InputSourceType;
+import org.jboss.tools.smooks.configuration.editors.input.InputTaskPanelContributor;
+import
org.jboss.tools.smooks.configuration.editors.input.InputTaskPanelContributorFactory;
+import org.jboss.tools.smooks.configuration.editors.input.Messages;
+import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
+import org.jboss.tools.smooks.model.SmooksModel;
+import org.jboss.tools.smooks.model.core.ICorePackage;
+import org.jboss.tools.smooks.model.core.IParam;
+import org.jboss.tools.smooks.templating.model.ModelBuilderException;
+import org.jboss.tools.smooks.templating.model.xml.XSDModelBuilder;
+import org.milyn.javabean.dynamic.Model;
+
+/**
+ * XSD configuration contributor factory.
+ * @author <a
href="mailto:tom.fennelly@gmail.com">tom.fennelly@gmail.com</a>
+ */
+public class XSDConfigurationContributorFactory implements
InputTaskPanelContributorFactory {
+
+ public InputTaskPanelContributor newInstance(FormToolkit toolkit, EditorPart editorPart,
Model<SmooksModel> configModel) {
+ return new PanelContributor(toolkit, editorPart, configModel);
+ }
+
+ public void setInputSourceType(InputSourceType inputSourceType) {
+ }
+
+ private class PanelContributor implements InputTaskPanelContributor {
+
+ private EditorPart editorPart;
+ private SmooksModel modelRoot;
+ private EditingDomain editingDomain;
+ private Composite inputSourceConfigComposite;
+ private FileSelectionPageComponent pageSelectionComponent;
+ private Combo rootElementsDropDown;
+ private Composite xsdRootElementSelectionSection;
+
+ public PanelContributor(FormToolkit toolkit, EditorPart editorPart,
Model<SmooksModel> configModel) {
+ this.editorPart = editorPart;
+ this.modelRoot = configModel.getModelRoot();
+ this.editingDomain = modelRoot.getModelProvider().getEditingDomain();
+ }
+
+ public void setInputSourceConfigComposite(Composite inputSourceConfigComposite) {
+ this.inputSourceConfigComposite = inputSourceConfigComposite;
+ }
+
+ public void addInputSourceTypeConfigControls() {
+ Composite xsdFileSelectionSection = new Composite(inputSourceConfigComposite,
SWT.NONE);
+
+ pageSelectionComponent = new
FileSelectionPageComponent(editorPart.getEditorSite().getShell(), new String[]
{"xsd"});
+ pageSelectionComponent.setLabel(Messages.XSDConfigurationContributor_XML_Schema_File);
+ pageSelectionComponent.createControl(xsdFileSelectionSection);
+ pageSelectionComponent.addFileSelectionListener(new FileSelectionListener() {
+ public void fileSelected(String fileName) {
+ CompoundCommand compoundCommand = new CompoundCommand();
+
+ IParam xsdInputParam = setInputTypeInfo(compoundCommand);
+ populateRootElementsDropDown(xsdInputParam, compoundCommand);
+
+ if(!compoundCommand.isEmpty()) {
+ editingDomain.getCommandStack().execute(compoundCommand);
+ }
+ }
+ });
+ xsdFileSelectionSection.layout();
+
+ xsdRootElementSelectionSection = new Composite(inputSourceConfigComposite, SWT.NONE);
+ createRootElementDropDown(xsdRootElementSelectionSection);
+
+ xsdRootElementSelectionSection.layout();
+ xsdRootElementSelectionSection.setVisible(false);
+
+ IParam xsdFileParam = getXSDParam();
+ if(xsdFileParam != null) {
+ String[] xsdPathTokens = xsdFileParam.getValue().split(";"); //$NON-NLS-1$
+
+ pageSelectionComponent.setFilePath(xsdPathTokens[0]);
+ if(xsdPathTokens.length == 2) {
+ populateRootElementsDropDown(xsdPathTokens[0], xsdPathTokens[1]);
+ }
+ }
+
+ inputSourceConfigComposite.setBackgroundMode(SWT.TRANSPARENT);
+ inputSourceConfigComposite.layout();
+ }
+
+ protected IParam setInputTypeInfo(CompoundCommand compoundCommand) {
+ String xsdFile = pageSelectionComponent.getFilePath();
+ IParam xsdInputParam = getXSDParam();
+
+ if(xsdInputParam == null) {
+ xsdInputParam = SmooksUIUtils.recordInputDataInfomation(editingDomain,
modelRoot.getParams(), SmooksModelUtils.INPUT_TYPE_XSD, xsdFile, null, compoundCommand);
+ } else {
+ setParamValue(xsdInputParam, xsdFile, compoundCommand);
+ }
+
+ return xsdInputParam;
+ }
+
+ private void setParamValue(IParam param, String xsdFile, CompoundCommand
compoundCommand) {
+ Command command = SetCommand.create(editingDomain, param,
ICorePackage.Literals.PARAM__VALUE, xsdFile);
+ if (command.canExecute()) {
+ if(compoundCommand == null) {
+ editingDomain.getCommandStack().execute(command);
+ } else {
+ compoundCommand.append(command);
+ }
+ }
+ }
+
+ private void createRootElementDropDown(Composite xsdRootElementSelectionSection) {
+ GridLayout layout = new GridLayout();
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL |
GridData.VERTICAL_ALIGN_BEGINNING);
+
+ layout.numColumns = 2;
+ xsdRootElementSelectionSection.setLayout(layout);
+ xsdRootElementSelectionSection.setLayoutData(gd);
+
+ gd = new GridData(GridData.BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING);
+ Label rootElementsLabel = new Label(xsdRootElementSelectionSection, SWT.NONE);
+ rootElementsLabel.setLayoutData(gd);
+ rootElementsLabel.setText(Messages.XSDConfigurationContributor_Root_Element_Name);
+
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ rootElementsDropDown = new Combo(xsdRootElementSelectionSection, SWT.DROP_DOWN |
SWT.READ_ONLY | SWT.RESIZE);
+ rootElementsDropDown.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent event) {
+ setRootElement(rootElementsDropDown.getItem(rootElementsDropDown.getSelectionIndex()));
+ }
+ public void widgetDefaultSelected(SelectionEvent event) {
+ }
+ });
+ rootElementsDropDown.setLayoutData(gd);
+ }
+
+ protected void setRootElement(String rootElementName) {
+ IParam xsdParam = getXSDParam();
+
+ if(xsdParam != null) {
+ String[] paramTokens = xsdParam.getValue().split(";"); //$NON-NLS-1$
+ setParamValue(xsdParam, paramTokens[0] + ";" + rootElementName, null);
//$NON-NLS-1$
+ }
+ }
+
+ private IParam getXSDParam() {
+ return modelRoot.getParams().getParam(SmooksModelUtils.INPUT_TYPE_XSD);
+ }
+
+ private void populateRootElementsDropDown(IParam xsdInputParam, CompoundCommand
compoundCommand) {
+ rootElementsDropDown.removeAll();
+ xsdRootElementSelectionSection.setVisible(false);
+
+ String xsdFile = pageSelectionComponent.getFilePath();
+ if(xsdFile != null && xsdFile.trim().length() > 0) {
+ populateRootElementsDropDown(xsdFile, null);
+
+ String rootElementName = rootElementsDropDown.getText();
+ setParamValue(xsdInputParam, xsdFile + ";" + rootElementName,
compoundCommand);
+ }
+ }
+
+ private void populateRootElementsDropDown(String xsdFile, String selectedRootElement)
{
+ URI xsdURI = toURI(xsdFile);
+
+ if(xsdURI != null) {
+ try {
+ XSDModelBuilder xsdModelBuilder = new XSDModelBuilder(xsdURI);
+ Set<String> rootElementNames = xsdModelBuilder.getRootElementNames();
+
+ if(!rootElementNames.isEmpty()) {
+ for(String rootElementName : rootElementNames) {
+ rootElementsDropDown.add(rootElementName);
+ if(rootElementName.equals(selectedRootElement)) {
+ rootElementsDropDown.select(rootElementsDropDown.indexOf(rootElementName));
+ }
+ }
+ if(selectedRootElement == null) {
+ rootElementsDropDown.select(0);
+ }
+ }
+
+ xsdRootElementSelectionSection.setVisible(true);
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (ModelBuilderException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ private URI toURI(String xsdFile) {
+ return URI.createFileURI(SmooksUIUtils.parseFilePath(xsdFile));
+ }
+ }
+}
Property changes on:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/contributors/XSDConfigurationContributorFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/messages.properties
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/messages.properties 2010-08-19
10:56:56 UTC (rev 24291)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/messages.properties 2010-08-19
11:16:52 UTC (rev 24292)
@@ -1,2 +1,6 @@
InputSourceType_Warning_Specify_Input_Type=Input type should be specified.
-InputSourceType_Warning_Specify_Sample_Data=Specify sample data in the Input Data
section.
\ No newline at end of file
+InputSourceType_Warning_Specify_Sample_Data=Specify sample data in the Input Data
section.
+InputSourceType_Unknown_Input_Type_Name=Unknown Input Type Name:
+InputSourceType_Unknown_Input_Type_Index=Unknown Input Type Index:
+XSDConfigurationContributor_XML_Schema_File=XML Schema File:
+XSDConfigurationContributor_Root_Element_Name=Root Element Name:
\ No newline at end of file
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/model/AbstractInputModelFactory.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/model/AbstractInputModelFactory.java
(rev 0)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/model/AbstractInputModelFactory.java 2010-08-19
11:16:52 UTC (rev 24292)
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.configuration.editors.input.model;
+
+import org.jboss.tools.smooks.configuration.SmooksModelUtils;
+import org.jboss.tools.smooks.configuration.editors.input.InputModelFactory;
+import org.jboss.tools.smooks.model.SmooksModel;
+import org.jboss.tools.smooks.model.core.GlobalParams;
+import org.jboss.tools.smooks.model.core.IParam;
+
+/**
+ * Abstract {@link InputModelFactory}.
+ *
+ * @author <a
href="mailto:tom.fennelly@gmail.com">tom.fennelly@gmail.com</a>
+ */
+abstract class AbstractInputModelFactory implements InputModelFactory {
+
+ protected IParam getInputSourceParam(String inputType, SmooksModel smooksConfigModel) {
+ GlobalParams globalParams = smooksConfigModel.getParams();
+ IParam inputSource = globalParams.getParam(inputType,
SmooksModelUtils.INPUT_ACTIVE_TYPE);
+
+ if(inputSource == null) {
+ inputSource = globalParams.getParam(inputType);
+ }
+
+ return inputSource;
+ }
+}
Property changes on:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/model/AbstractInputModelFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/model/JavaInputModelFactory.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/model/JavaInputModelFactory.java
(rev 0)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/model/JavaInputModelFactory.java 2010-08-19
11:16:52 UTC (rev 24292)
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.configuration.editors.input.model;
+
+import org.eclipse.jdt.core.IJavaProject;
+import org.jboss.tools.smooks.configuration.SmooksModelUtils;
+import org.jboss.tools.smooks.model.SmooksModel;
+import org.jboss.tools.smooks.model.core.IParam;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * Java Source Input Model Factory.
+ *
+ * @author <a
href="mailto:tom.fennelly@gmail.com">tom.fennelly@gmail.com</a>
+ */
+public class JavaInputModelFactory extends AbstractInputModelFactory {
+
+ public Document getModel(SmooksModel smooksConfigModel, IJavaProject project) {
+ IParam inputSourceParam = getInputSourceParam(SmooksModelUtils.INPUT_TYPE_JAVA,
smooksConfigModel);
+
+
+
+ return null;
+ }
+
+}
Property changes on:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/model/JavaInputModelFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/model/XMLInputModelFactory.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/model/XMLInputModelFactory.java
(rev 0)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/model/XMLInputModelFactory.java 2010-08-19
11:16:52 UTC (rev 24292)
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.configuration.editors.input.model;
+
+import java.io.File;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.eclipse.jdt.core.IJavaProject;
+import org.jboss.tools.smooks.configuration.SmooksModelUtils;
+import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
+import org.jboss.tools.smooks.model.SmooksModel;
+import org.jboss.tools.smooks.model.core.IParam;
+import org.jboss.tools.smooks.templating.model.ModelBuilderException;
+import org.w3c.dom.Document;
+
+/**
+ * XML (Sample) Input Model Factory.
+ *
+ * @author <a
href="mailto:tom.fennelly@gmail.com">tom.fennelly@gmail.com</a>
+ */
+public class XMLInputModelFactory extends AbstractInputModelFactory {
+
+ private static final DocumentBuilderFactory docBuilderFactory =
DocumentBuilderFactory.newInstance();
+
+ static {
+ docBuilderFactory.setNamespaceAware(true);
+ }
+
+ public Document getModel(SmooksModel smooksConfigModel, IJavaProject project) throws
ModelBuilderException {
+ IParam inputSourceParam = getInputSourceParam(SmooksModelUtils.INPUT_TYPE_XML,
smooksConfigModel);
+
+ if(inputSourceParam != null) {
+ String inputSourceFileName =
SmooksUIUtils.parseFilePath(inputSourceParam.getValue());
+ File inputSourceFile = new File(inputSourceFileName);
+
+ if(!inputSourceFile.isFile()) {
+ throw new ModelBuilderException("XML Model Input file '" +
inputSourceFile.getAbsolutePath() + "' is not available on local file
system."); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ try {
+ DocumentBuilder documentBuilder = docBuilderFactory.newDocumentBuilder();
+ return documentBuilder.parse(inputSourceFile);
+ } catch (Exception e) {
+ throw new ModelBuilderException("Error building XML Model for Input '"
+ inputSourceFileName + "'.", e); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ return null;
+ }
+}
Property changes on:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/model/XMLInputModelFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/model/XSDInputModelFactory.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/model/XSDInputModelFactory.java
(rev 0)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/model/XSDInputModelFactory.java 2010-08-19
11:16:52 UTC (rev 24292)
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.configuration.editors.input.model;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.jdt.core.IJavaProject;
+import org.jboss.tools.smooks.configuration.SmooksModelUtils;
+import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
+import org.jboss.tools.smooks.model.SmooksModel;
+import org.jboss.tools.smooks.model.core.IParam;
+import org.jboss.tools.smooks.templating.model.ModelBuilderException;
+import org.jboss.tools.smooks.templating.model.xml.XSDModelBuilder;
+import org.w3c.dom.Document;
+
+/**
+ * XML Schema Input Model Factory.
+ *
+ * @author <a
href="mailto:tom.fennelly@gmail.com">tom.fennelly@gmail.com</a>
+ */
+public class XSDInputModelFactory extends AbstractInputModelFactory {
+
+ public Document getModel(SmooksModel smooksConfigModel, IJavaProject project) throws
ModelBuilderException {
+ IParam inputSourceParam = getInputSourceParam(SmooksModelUtils.INPUT_TYPE_XSD,
smooksConfigModel);
+
+ if(inputSourceParam != null) {
+ String xsdInputSource = inputSourceParam.getValue();
+ String[] xsdInputSourceTokens = xsdInputSource.split(";");
+
+ if(xsdInputSourceTokens.length != 2) {
+ throw new ModelBuilderException("Invalid XML Schema Model Input file
configuration '" + xsdInputSource + "'. Must contain 2 semi-colon
separated tokens '<file-path>;<root-element-name>'.");
//$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ String inputSourceFileName = SmooksUIUtils.parseFilePath(xsdInputSourceTokens[0]);
+ File inputSourceFile = new File(inputSourceFileName);
+ if(!inputSourceFile.isFile()) {
+ throw new ModelBuilderException("XML Schema Model Input file '" +
inputSourceFile.getAbsolutePath() + "' is not available on local file
system."); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ try {
+ XSDModelBuilder schemaModelBuilder = new
XSDModelBuilder(URI.createFileURI(inputSourceFileName));
+ schemaModelBuilder.setRootElementName(xsdInputSourceTokens[1]);
+ return schemaModelBuilder.buildModel();
+ } catch (IOException e) {
+ throw new ModelBuilderException("Error reading XML Schema Model Input file
'" + inputSourceFile.getAbsolutePath() + "'.", e); //$NON-NLS-1$
//$NON-NLS-2$
+ }
+ }
+
+ return null;
+ }
+
+}
Property changes on:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/input/model/XSDInputModelFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java 2010-08-19
10:56:56 UTC (rev 24291)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java 2010-08-19
11:16:52 UTC (rev 24292)
@@ -27,12 +27,10 @@
import org.eclipse.core.runtime.Status;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.command.CompoundCommand;
-import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.edit.command.AddCommand;
-import org.eclipse.emf.edit.command.RemoveCommand;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
@@ -43,15 +41,13 @@
import org.jboss.tools.smooks.configuration.SmooksConfigurationActivator;
import org.jboss.tools.smooks.configuration.SmooksModelUtils;
import org.jboss.tools.smooks.configuration.editors.IXMLStructuredObject;
-import org.jboss.tools.smooks.configuration.editors.input.InputParameter;
-import org.jboss.tools.smooks.configuration.editors.input.InputType;
-import org.jboss.tools.smooks.editor.ISmooksModelProvider;
+import org.jboss.tools.smooks.configuration.editors.input.InputSourceType;
+import org.jboss.tools.smooks.model.ISmooksModelProvider;
import org.jboss.tools.smooks.model.SmooksModel;
import org.jboss.tools.smooks.model.core.GlobalParams;
import org.jboss.tools.smooks.model.core.ICoreFactory;
import org.jboss.tools.smooks.model.core.ICorePackage;
import org.jboss.tools.smooks.model.core.IParam;
-import org.milyn.javabean.dynamic.Model;
/**
*
@@ -81,8 +77,7 @@
public static final String[] SELECTOR_SPERATORS = new String[] { " ",
"/" }; //$NON-NLS-1$ //$NON-NLS-2$
- public static String parseFilePath(String path)
- throws InvocationTargetException {
+ public static String parseFilePath(String path) {
if (path == null)
return null;
if (new File(path).exists()) {
@@ -102,12 +97,10 @@
if (file.exists()) {
path = file.getLocation().toOSString();
} else {
- throw new InvocationTargetException(new Exception(
- "File : " + path + " isn't exsit")); //$NON-NLS-1$
//$NON-NLS-2$
+ throw new IllegalArgumentException("File : " + path + " isn't
exsit"); //$NON-NLS-1$ //$NON-NLS-2$
}
} else {
- throw new InvocationTargetException(new Exception(
- "This path is un-support" + path + ".")); //$NON-NLS-1$
//$NON-NLS-2$
+ throw new IllegalArgumentException("This path is un-support" + path +
"."); //$NON-NLS-1$ //$NON-NLS-2$
}
}
return path;
@@ -131,16 +124,6 @@
return createErrorStatus(throwable, "Error"); //$NON-NLS-1$
}
- public static IParam getInputTypeAssociatedParamType(InputType inputType,
- Model<SmooksModel> resourceList) {
- SmooksModel rootModel = resourceList.getModelRoot();
- GlobalParams params = rootModel.getParams();
- if (params != null) {
- return params.getParam(inputType.getType(), inputType.getPath());
- }
- return null;
- }
-
public static IParam getInputTypeParam(SmooksModel resourceList) {
GlobalParams params = resourceList.getParams();
if (params != null) {
@@ -149,97 +132,48 @@
return null;
}
- public static List<InputType> recordInputDataInfomation(
+ public static IParam recordInputDataInfomation(
EditingDomain domain, GlobalParams paramsType, String type,
String path, Properties properties, CompoundCommand compoundCommand) {
- List<InputType> inputTypeList = new ArrayList<InputType>();
+
if (type != null && path != null && domain != null) {
String[] values = path.split(";"); //$NON-NLS-1$
- if (values == null || values.length == 0) {
- values = new String[] { path };
- }
- for (int i = 0; i < values.length; i++) {
- String value = values[i];
- value = value.trim();
- if (value.length() == 0)
- continue;
- IParam inputParam = ICoreFactory.eINSTANCE.createParam();
- InputType input = new InputType();
- input.setPath(path);
- input.setType(type);
- input.setActived(false);
+
+ if (values != null && values.length > 0) {
+ String value = values[0].trim();
+
+ if (value.length() > 0) {
+ IParam inputParam = ICoreFactory.eINSTANCE.createParam();
+ inputParam.setName(type);
+ inputParam.setValue(path);
+
+ List<IParam> params = generateExtParams(type, path, properties);
+ params.add(inputParam);
- inputParam.setName(type);
- inputParam.setValue(path);
- input.setRelatedParameter(inputParam);
- List<IParam> params = generateExtParams(type, path, properties);
- for (Iterator<?> iterator = params.iterator(); iterator
- .hasNext();) {
- IParam paramType2 = (IParam) iterator.next();
- InputParameter p = new InputParameter();
- p.setName(getInputParameterName(input.getType(),
- paramType2.getName()));
- p.setValue(paramType2.getValue());
- input.getParameters().add(p);
- // input.setRelatedParameter(paramType2);
- }
- params.add(inputParam);
- Command command = null;
- try {
- command = AddCommand.create(domain, paramsType,
- ICorePackage.Literals.PARAMS__PARAMS, params);
- } catch (Throwable t) {
- t.printStackTrace();
- }
- if (command.canExecute()) {
- if (compoundCommand != null) {
- compoundCommand.append(command);
- } else {
- domain.getCommandStack().execute(command);
+ Command command = null;
+ try {
+ command = AddCommand.create(domain, paramsType,
ICorePackage.Literals.PARAMS__PARAMS, params);
+ } catch (Throwable t) {
+ t.printStackTrace();
}
- input.setRelatedParameter(inputParam);
- inputTypeList.add(input);
+ if (command.canExecute()) {
+ if (compoundCommand != null) {
+ compoundCommand.append(command);
+ } else {
+ domain.getCommandStack().execute(command);
+ }
+ }
+
+ return inputParam;
}
}
}
- return inputTypeList;
+
+ return null;
}
- public static void removeInputType(InputType inputType,
+ public static void removeInputType(IParam inputToRemove,
ISmooksModelProvider smooksModelProvider) {
- SmooksModel resourceList = smooksModelProvider.getSmooksModel()
- .getModelRoot();
- if (resourceList != null) {
- GlobalParams params = resourceList.getParams();
- if (params != null) {
- List<IParam> paramList = params.getParams();
- List<IParam> removingList = new ArrayList<IParam>();
- for (Iterator<?> iterator = paramList.iterator(); iterator
- .hasNext();) {
- IParam paramType = (IParam) iterator.next();
- String name = paramType.getName();
- String value = paramType.getValue();
- if (inputType.getType().equals(name)
- && inputType.getPath().equals(value)) {
- // find the associated param
- removingList.add(paramType);
- continue;
- }
- if (isInputAssociatedParameter(paramType, inputType)) {
- removingList.add(paramType);
- }
- }
- if (!removingList.isEmpty()) {
- Command removeCommand = RemoveCommand.create(
- smooksModelProvider.getEditingDomain(),
- removingList);
- if (removeCommand.canExecute()) {
- smooksModelProvider.getEditingDomain()
- .getCommandStack().execute(removeCommand);
- }
- }
- }
- }
}
public static IJavaProject getJavaProject(EObject model) {
@@ -340,54 +274,17 @@
return type + "." + name; //$NON-NLS-1$
}
- public static List<InputType> recordInputDataInfomation(
- EditingDomain domain, GlobalParams paramsType, String type,
- String path, Properties properties) {
- return recordInputDataInfomation(domain, paramsType, type, path,
- properties, null);
- }
-
- public static List<InputType> getInputTypeList(SmooksModel resourceList) {
- List<InputType> inputList = new
ArrayList<org.jboss.tools.smooks.configuration.editors.input.InputType>();
- GlobalParams params = resourceList.getParams();
- if (params != null) {
- List<IParam> paramList = params.getParams();
- for (Iterator<?> iterator = paramList.iterator(); iterator
- .hasNext();) {
- IParam paramType = (IParam) iterator.next();
- String type = paramType.getType();
- if (isInputParamType(paramType)) {
- org.jboss.tools.smooks.configuration.editors.input.InputType input = new
org.jboss.tools.smooks.configuration.editors.input.InputType();
- input.setType(paramType.getName());
- input.setActived(SmooksModelUtils.INPUT_ACTIVE_TYPE
- .equals(type));
- String path = paramType.getValue();
- if (path != null) {
- path = path.trim();
- }
- input.setPath(path);
- inputList.add(input);
- }
+ public static List<IParam> getInputTypeList(SmooksModel resourceList) {
+ List<IParam> inputs = new ArrayList<IParam>();
+ GlobalParams globalParams = resourceList.getParams();
+
+ for(IParam param : globalParams.getParams()) {
+ if(InputSourceType.isValidName(param.getName())) {
+ inputs.add(param);
}
-
- for (Iterator<?> iterator = inputList.iterator(); iterator
- .hasNext();) {
- org.jboss.tools.smooks.configuration.editors.input.InputType input =
(org.jboss.tools.smooks.configuration.editors.input.InputType) iterator
- .next();
- for (Iterator<?> iterator2 = paramList.iterator(); iterator2
- .hasNext();) {
- IParam paramType = (IParam) iterator2.next();
- if (isInputAssociatedParameter(paramType, input)) {
- InputParameter p = new InputParameter();
- p.setName(getInputParameterName(input.getType(),
- paramType.getName()));
- p.setValue(paramType.getValue());
- input.getParameters().add(p);
- }
- }
- }
}
- return inputList;
+
+ return inputs;
}
public static boolean isInputParamType(IParam param) {
@@ -399,16 +296,6 @@
return false;
}
- public static boolean isInputAssociatedParameter(IParam param,
- org.jboss.tools.smooks.configuration.editors.input.InputType input) {
- String type = input.getType();
- String pn = param.getName();
- if (pn != null && pn.startsWith(type) && !pn.equals(type)) {
- return true;
- }
- return false;
- }
-
private static void expandSelectorViewer(IXMLStructuredObject model,
TreeViewer viewer, List<String> expandedModel, int level) {
if (level >= SELECTOR_EXPAND_MAX_LEVEL)
Deleted:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/AbstractFileSelectionWizardPage.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/AbstractFileSelectionWizardPage.java 2010-08-19
10:56:56 UTC (rev 24291)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/AbstractFileSelectionWizardPage.java 2010-08-19
11:16:52 UTC (rev 24292)
@@ -1,501 +0,0 @@
-/**
- *
- */
-package org.jboss.tools.smooks.configuration.editors.xml;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.emf.common.ui.dialogs.WorkspaceResourceDialog;
-import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-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.FileDialog;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.jboss.tools.smooks.configuration.editors.IFilePathProcessor;
-import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
-
-/**
- *
- * @author Dart Peng Date : 2008-8-13
- */
-public abstract class AbstractFileSelectionWizardPage extends WizardPage implements
SelectionListener {
- protected IStructuredSelection selection;
- protected Object returnObject = null;
- protected Text fileText;
- protected Composite fileTextComposite;
- protected CheckboxTableViewer tableViewer = null;
- protected Button fileSystemBrowseButton;
- protected boolean reasourceLoaded = false;
- protected Button workspaceBrowseButton;
- private String filePath = null;
- protected Object[] initSelections;
- protected List<ViewerFilter> filters = new ArrayList<ViewerFilter>();
- protected boolean multiSelect = false;
-
- private IFilePathProcessor filePathProcessor = null;
-
- protected String[] fileExtensionNames;
-
- public AbstractFileSelectionWizardPage(String pageName, boolean multiSelect, Object[]
initSelections,
- List<ViewerFilter> filters,String[] fileExtensionNames) {
- this(pageName, false, initSelections, Collections.EMPTY_LIST);
- this.fileExtensionNames = fileExtensionNames;
- createFileExtensionNameFilter();
- }
-
- /**
- * @return the fileExtensionNames
- */
- public String[] getFileExtensionNames() {
- return fileExtensionNames;
- }
-
-
-
- /**
- * @param fileExtensionNames the fileExtensionNames to set
- */
- public void setFileExtensionNames(String[] fileExtensionNames) {
- this.fileExtensionNames = fileExtensionNames;
- }
-
-
-
- public void createFileExtensionNameFilter(){
- if (this.fileExtensionNames != null && this.fileExtensionNames.length != 0) {
- ViewerFilter extensionNameFilter = new ViewerFilter() {
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse
- * .jface.viewers.Viewer, java.lang.Object, java.lang.Object)
- */
- @Override
- public boolean select(Viewer viewer, Object parentElement, Object element) {
- if (element instanceof IFile &&
AbstractFileSelectionWizardPage.this.fileExtensionNames != null) {
- String extName = ((IFile) element).getFileExtension();
- for (int i = 0; i <
AbstractFileSelectionWizardPage.this.fileExtensionNames.length; i++) {
- String name = AbstractFileSelectionWizardPage.this.fileExtensionNames[i];
- if (name.equalsIgnoreCase(extName)) {
- return true;
- }
- }
- return false;
- }
- return true;
- }
- };
- this.filters.add(extensionNameFilter);
- }
- }
-
- public AbstractFileSelectionWizardPage(String pageName, boolean multiSelect, Object[]
initSelections,
- List<ViewerFilter> filters) {
- super(pageName);
- this.initSelections = initSelections;
- if (filters != null) {
- this.filters.addAll(filters);
- }
- this.multiSelect = multiSelect;
- }
-
- public AbstractFileSelectionWizardPage(String pageName, String[] fileExtensionNames) {
- this(pageName, false, null, Collections.EMPTY_LIST);
- this.fileExtensionNames = fileExtensionNames;
- createFileExtensionNameFilter();
- }
-
- public Object getReturnValue() {
- try {
- String path = getFilePath();
- if (path == null)
- return null;
- path = SmooksUIUtils.parseFilePath(path);
- returnObject = this.loadedTheObject(path);
- } catch (Exception e) {
- SmooksUIUtils.showErrorDialog(getShell(), SmooksUIUtils.createErrorStatus(e));
- }
- return returnObject;
- }
-
- public String getFilePath() {
- return filePath;
- }
-
- public IFilePathProcessor getFilePathProcessor() {
- return filePathProcessor;
- }
-
- public void setFilePathProcessor(IFilePathProcessor filePathProcessor) {
- this.filePathProcessor = filePathProcessor;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets
- * .Composite)
- */
- public void createControl(Composite parent) {
- Composite mainComposite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- mainComposite.setLayout(layout);
-
- GridData gd = new GridData(GridData.FILL_BOTH);
- gd.grabExcessHorizontalSpace = true;
- gd.grabExcessVerticalSpace = true;
- mainComposite.setLayoutData(gd);
-
- // xmlButton = new Button(mainComposite, SWT.RADIO);
- // xmlButton.setText("Select a XML file");
- //
- // Composite xmlComposite = this
- // .createXMLFileSelectionComposite(mainComposite);
- //
- // Label sp = new Label(mainComposite, SWT.HORIZONTAL | SWT.SEPARATOR);
- // gd = new GridData(GridData.FILL_HORIZONTAL);
- // sp.setLayoutData(gd);
- //
- // xsdButton = new Button(mainComposite, SWT.RADIO);
- // xsdButton.setText("Select a XSD file");
-
- createFileSelectionComposite(mainComposite);
-
- // init the panel status (XSD file selection composite is disabled)
- // xsdButton.setSelection(true);
- //
- // setCompositeChildrenEnabled(xmlComposite, false);
-
- // registe the listener for controls
- hookBrowseButtonSelectionAdapter();
- hookFileTextModifyListener();
- this.setControl(mainComposite);
-
- changeWizardPageStatus();
- // don't show the error message when first open the dialog
- this.setErrorMessage(null);
- parent.getShell().setText(Messages.AbstractFileSelectionWizardPage_WizardTitle);
- }
-
- protected void hookFileTextModifyListener() {
- final ModifyListener modifyListener = new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- filePath = fileText.getText();
- changeWizardPageStatus();
- }
- };
- // xmlFileText.addModifyListener(modifyListener);
- fileText.addModifyListener(modifyListener);
- }
-
- protected void hookRadioButtonSelectionAdapter() {
- // xsdButton.addSelectionListener(this);
- }
-
- protected void hookBrowseButtonSelectionAdapter() {
- SelectionAdapter browseButtonSelectionAdapter = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- Text relationT = null;
- if (e.getSource() == fileSystemBrowseButton) {
- relationT = fileText;
- }
- openFileSelection(relationT);
- }
- };
- SelectionAdapter wbrowseButtonSelectionAdapter = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- Text relationT = null;
- if (e.getSource() == workspaceBrowseButton) {
- relationT = fileText;
- }
- openWorkSpaceSelection(relationT);
- }
-
- };
-
- workspaceBrowseButton.addSelectionListener(wbrowseButtonSelectionAdapter);
- // xmlFileSystemBrowseButton
- // .addSelectionListener(browseButtonSelectionAdapter);
- fileSystemBrowseButton.addSelectionListener(browseButtonSelectionAdapter);
- }
-
- protected void openWorkSpaceSelection(Text relationT) {
- IFile[] files = WorkspaceResourceDialog.openFileSelection(getShell(),
- "Select Files", "", false, initSelections, filters);
//$NON-NLS-1$ //$NON-NLS-2$
- // dialog.setInitialSelections(selectedResources);
- if (files.length > 0) {
- IFile file = files[0];
- String s = processWorkSpaceFilePath(file);
- relationT.setText(s);
- }
- }
-
- protected String processFileSystemFilePath(String path) {
- if (filePathProcessor != null) {
- String s = filePathProcessor.processFileSystemPath(path);
- if (s != null) {
- return s;
- }
- }
- path = SmooksUIUtils.FILE_PRIX + path;
- return path;
- }
-
- protected String processWorkSpaceFilePath(IFile file) {
- if (filePathProcessor != null) {
- String s = filePathProcessor.processWorkBenchPath(file);
- if (s != null) {
- return s;
- }
- }
- String s = file.getFullPath().toPortableString();
- s = SmooksUIUtils.WORKSPACE_PRIX + s;
- return s;
- }
-
- protected Text createFilePathText(Composite parent) {
- fileTextComposite = new Composite(parent, SWT.NONE);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.grabExcessHorizontalSpace = true;
- fileTextComposite.setLayoutData(gd);
- GridLayout xsdtgl = new GridLayout();
- xsdtgl.marginWidth = 0;
- xsdtgl.marginHeight = 0;
- xsdtgl.numColumns = 1;
- fileTextComposite.setLayout(xsdtgl);
-
- Text fileText = new Text(fileTextComposite, SWT.BORDER);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- fileText.setLayoutData(gd);
- gd.grabExcessHorizontalSpace = true;
-
- return fileText;
- }
-
- protected Composite createFileSelectionComposite(Composite parent) {
- Composite xsdComposite = new Composite(parent, SWT.NONE);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- xsdComposite.setLayoutData(gd);
- GridLayout xsdLayout = new GridLayout();
- xsdLayout.numColumns = 2;
- xsdLayout.marginWidth = 0;
- xsdComposite.setLayout(xsdLayout);
- createExtensionGUIFirst(xsdComposite);
- Label nfileLanel = new Label(xsdComposite, SWT.NONE);
- nfileLanel.setText("File : "); //$NON-NLS-1$
- // fileTextComposite = new Composite(xsdComposite, SWT.NONE);
- // gd = new GridData(GridData.FILL_HORIZONTAL);
- // gd.grabExcessHorizontalSpace = true;
- // fileTextComposite.setLayoutData(gd);
- // GridLayout xsdtgl = new GridLayout();
- // xsdtgl.marginWidth = 0;
- // xsdtgl.marginHeight = 0;
- // xsdtgl.numColumns = 1;
- // fileTextComposite.setLayout(xsdtgl);
- //
- // fileText = new Text(fileTextComposite, SWT.BORDER);
- // gd = new GridData(GridData.FILL_HORIZONTAL);
- // fileText.setLayoutData(gd);
- // gd.grabExcessHorizontalSpace = true;
-
- fileText = createFilePathText(xsdComposite);
-
- // final Button loadXSDButton = new Button(fileTextComposite, SWT.NONE);
- // loadXSDButton.setText("Load");
- // loadXSDButton.addSelectionListener(new SelectionAdapter() {
- //
- // @Override
- // public void widgetSelected(SelectionEvent e) {
- // super.widgetSelected(e);
- // reasourceLoaded = false;
- // try {
- // returnObject = loadedTheObject(fileText.getText());
- // reasourceLoaded = true;
- // } catch (Throwable e2) {
- // // ignore
- // e2.printStackTrace();
- // }
- // changeWizardPageStatus();
- // }
- //
- // });
-
- Composite browseButtonComposite = new Composite(xsdComposite, SWT.NONE);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 2;
- browseButtonComposite.setLayoutData(gd);
-
- GridLayout bg = new GridLayout();
- bg.numColumns = 2;
- bg.marginHeight = 0;
- bg.marginWidth = 0;
- bg.makeColumnsEqualWidth = false;
- browseButtonComposite.setLayout(bg);
-
- fileSystemBrowseButton = new Button(browseButtonComposite, SWT.NONE);
- fileSystemBrowseButton.setText("Browse File System"); //$NON-NLS-1$
-
- workspaceBrowseButton = new Button(browseButtonComposite, SWT.NONE);
- workspaceBrowseButton.setText("Browse WorkSpace"); //$NON-NLS-1$
- gd = new GridData();
- gd.horizontalAlignment = GridData.END;
- workspaceBrowseButton.setLayoutData(gd);
-
- gd = new GridData();
- gd.grabExcessHorizontalSpace = true;
- gd.horizontalAlignment = GridData.END;
- fileSystemBrowseButton.setLayoutData(gd);
-
- return xsdComposite;
- }
-
- protected void createExtensionGUIFirst(Composite parent) {
- // do nothing
- }
-
- abstract protected Object loadedTheObject(String path) throws Exception;
-
- protected void initTableViewer() {
- // tableViewer.addCheckStateListener(new ICheckStateListener() {
- // boolean flag = true;
- //
- // public void checkStateChanged(CheckStateChangedEvent event) {
- // if (flag) {
- // Object checkObject = event.getElement();
- // boolean check = event.getChecked();
- // flag = false;
- // tableViewer.setAllChecked(false);
- // tableViewer.setChecked(checkObject, check);
- // flag = true;
- // changeWizardPageStatus();
- // }
- // }
- // });
- // tableViewer.setContentProvider(new
- // XSDStructuredModelContentProvider());
- // tableViewer.setLabelProvider(new XSDStructuredModelLabelProvider());
- }
-
- protected void setCompositeChildrenEnabled(Composite composite, boolean enabled) {
- Control[] children = composite.getChildren();
- for (int i = 0; i < children.length; i++) {
- Control child = children[i];
- if (child instanceof Text) {
- child.setEnabled(enabled);
- }
- if (child instanceof Button) {
- child.setEnabled(enabled);
- }
- if (child instanceof Composite) {
- setCompositeChildrenEnabled((Composite) child, enabled);
- }
- }
- }
-
- protected void openFileSelection(Text relationText) {
- FileDialog dialog = new FileDialog(this.getShell());
- if (fileExtensionNames != null) {
- String s = ""; //$NON-NLS-1$
- for (int i = 0; i < fileExtensionNames.length; i++) {
- String exname = fileExtensionNames[i];
- s += "*." + exname + ";"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- if (s.length() != 0) {
- s = s.substring(0, s.length() - 1);
- dialog.setFilterExtensions(new String[]{s,"*.*"}); //$NON-NLS-1$
- }
- }
- String path = dialog.open();
- if (path != null) {
- path = processFileSystemFilePath(path);
- relationText.setText(path);
- }
- }
-
- protected void changeWizardPageStatus() {
- String text = this.fileText.getText();
- String error = null;
- if (text == null || "".equals(text)) //$NON-NLS-1$
- error = "File name cannot be null"; //$NON-NLS-1$
-
- // File tempFile = new File(text);
- // if(!tempFile.exists()){
- // error = "Can't find the file , please select another one.";
- // }
-
- // if (!reasourceLoaded) {
- // error = "Resource must be loaded";
- // }
- this.setErrorMessage(error);
- this.setPageComplete(error == null);
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
-
- public void widgetSelected(SelectionEvent e) {
- changeWizardPageStatus();
- }
-
- public CheckboxTableViewer getTableViewer() {
- return tableViewer;
- }
-
- public void setTableViewer(CheckboxTableViewer tableViewer) {
- this.tableViewer = tableViewer;
- }
-
- public IStructuredSelection getSelection() {
- return selection;
- }
-
- public void setSelection(IStructuredSelection selection) {
- this.selection = selection;
- }
-
- public Object[] getInitSelections() {
- return initSelections;
- }
-
- public void setInitSelections(Object[] initSelections) {
- this.initSelections = initSelections;
- }
-
- public List<ViewerFilter> getFilters() {
- return filters;
- }
-
- public void setFilters(List<ViewerFilter> filters) {
- this.filters = filters;
- }
-
- public boolean isMultiSelect() {
- return multiSelect;
- }
-
- public void setMultiSelect(boolean multiSelect) {
- this.multiSelect = multiSelect;
- }
-
-}
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/AbstractStructuredDataWizard.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/AbstractStructuredDataWizard.java
(rev 0)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/AbstractStructuredDataWizard.java 2010-08-19
11:16:52 UTC (rev 24292)
@@ -0,0 +1,89 @@
+/**
+ *
+ */
+package org.jboss.tools.smooks.configuration.editors.xml;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.IWizardNode;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+import
org.jboss.tools.smooks.configuration.editors.file.AbstractFileSelectionWizardPage;
+import
org.jboss.tools.smooks.configuration.editors.wizard.IStructuredDataSelectionWizard;
+
+/**
+ * @author Dart
+ *
+ */
+public abstract class AbstractStructuredDataWizard extends Wizard implements
IStructuredDataSelectionWizard,
+ INewWizard {
+ protected IWorkbench workbench;
+
+ protected IStructuredSelection selection;
+
+ protected AbstractFileSelectionWizardPage page = null;
+ protected Object xsdElement = null;
+ protected IWizardNode strucutredDataCreationWizardNode;
+
+ private IContainer folder = null;
+
+ public AbstractStructuredDataWizard() {
+ // TODO Auto-generated constructor stub
+ }
+
+ @Override
+ public void addPages() {
+ if (page == null) {
+ page = createAbstractFileSelectionWizardPage();
+ page.setSelection(this.selection);
+ if (folder != null) {
+ page.setInitSelections(new Object[] { folder });
+ }
+ }
+ this.addPage(page);
+ }
+
+ abstract protected AbstractFileSelectionWizardPage
createAbstractFileSelectionWizardPage();
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.wizard.Wizard#performFinish()
+ */
+ @Override
+ public boolean performFinish() {
+ xsdElement = this.page.getReturnValue();
+ return true;
+ }
+
+ public Object getReturnData() {
+ return xsdElement;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.jboss.tools.smooks.ui.IStructuredDataCreationWizard#
+ * getStructuredDataSourcePath()
+ */
+ public String getStructuredDataSourcePath() {
+ return page.getFilePath();
+ }
+
+ public void init(IEditorSite site, IEditorInput input) {
+ this.folder = ((IFileEditorInput) input).getFile().getParent();
+ if (page != null && folder != null) {
+ page.setInitSelections(new Object[] { folder });
+ }
+ }
+
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ this.workbench = workbench;
+ this.selection = selection;
+ }
+
+}
Property changes on:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/AbstractStructuredDataWizard.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/AbstractStructuredDdataWizard.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/AbstractStructuredDdataWizard.java 2010-08-19
10:56:56 UTC (rev 24291)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/AbstractStructuredDdataWizard.java 2010-08-19
11:16:52 UTC (rev 24292)
@@ -1,88 +0,0 @@
-/**
- *
- */
-package org.jboss.tools.smooks.configuration.editors.xml;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.IWizardNode;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.IWorkbench;
-import
org.jboss.tools.smooks.configuration.editors.wizard.IStructuredDataSelectionWizard;
-
-/**
- * @author Dart
- *
- */
-public abstract class AbstractStructuredDdataWizard extends Wizard implements
IStructuredDataSelectionWizard,
- INewWizard {
- protected IWorkbench workbench;
-
- protected IStructuredSelection selection;
-
- protected AbstractFileSelectionWizardPage page = null;
- protected Object xsdElement = null;
- protected IWizardNode strucutredDataCreationWizardNode;
-
- private IContainer folder = null;
-
- public AbstractStructuredDdataWizard() {
- // TODO Auto-generated constructor stub
- }
-
- @Override
- public void addPages() {
- if (page == null) {
- page = createAbstractFileSelectionWizardPage();
- page.setSelection(this.selection);
- if (folder != null) {
- page.setInitSelections(new Object[] { folder });
- }
- }
- this.addPage(page);
- }
-
- abstract protected AbstractFileSelectionWizardPage
createAbstractFileSelectionWizardPage();
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.wizard.Wizard#performFinish()
- */
- @Override
- public boolean performFinish() {
- xsdElement = this.page.getReturnValue();
- return true;
- }
-
- public Object getReturnData() {
- return xsdElement;
- }
-
- /*
- * (non-Javadoc)
- *
- * @seeorg.jboss.tools.smooks.ui.IStructuredDataCreationWizard#
- * getStructuredDataSourcePath()
- */
- public String getStructuredDataSourcePath() {
- return page.getFilePath();
- }
-
- public void init(IEditorSite site, IEditorInput input) {
- this.folder = ((IFileEditorInput) input).getFile().getParent();
- if (page != null && folder != null) {
- page.setInitSelections(new Object[] { folder });
- }
- }
-
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- this.workbench = workbench;
- this.selection = selection;
- }
-
-}
Modified:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XMLObjectAnalyzer.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XMLObjectAnalyzer.java 2010-08-19
10:56:56 UTC (rev 24291)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XMLObjectAnalyzer.java 2010-08-19
11:16:52 UTC (rev 24292)
@@ -49,7 +49,7 @@
return null;
Element rootElement = doc.getDocumentElement();
TagList dco = new TagList();
- dco.setName("Docuement"); //$NON-NLS-1$
+ dco.setName("Document"); //$NON-NLS-1$
dco.addRootTag(parseElement(rootElement, null, ignoreNodeNames, tagObjectClass));
return dco;
}
Modified:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XMLStructuredDataWizard.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XMLStructuredDataWizard.java 2010-08-19
10:56:56 UTC (rev 24291)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XMLStructuredDataWizard.java 2010-08-19
11:16:52 UTC (rev 24292)
@@ -14,12 +14,13 @@
import org.jboss.tools.smooks.configuration.SmooksModelUtils;
import org.jboss.tools.smooks.configuration.editors.SmooksMultiFormEditor;
+import
org.jboss.tools.smooks.configuration.editors.file.AbstractFileSelectionWizardPage;
/**
* @author Dart Peng
* @Date Aug 18, 2008
*/
-public class XMLStructuredDataWizard extends AbstractStructuredDdataWizard {
+public class XMLStructuredDataWizard extends AbstractStructuredDataWizard {
Properties properties = new Properties();
Modified:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XMLStructuredDataWizardPage.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XMLStructuredDataWizardPage.java 2010-08-19
10:56:56 UTC (rev 24291)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XMLStructuredDataWizardPage.java 2010-08-19
11:16:52 UTC (rev 24292)
@@ -3,6 +3,8 @@
*/
package org.jboss.tools.smooks.configuration.editors.xml;
+import
org.jboss.tools.smooks.configuration.editors.file.AbstractFileSelectionWizardPage;
+
/**
* @author Dart Peng Date : 2008-8-16
*/
@@ -26,7 +28,6 @@
* org.jboss.tools.smooks.xml.ui.AbstractFileSelectionWizardPage#loadedTheObject
* (java.lang.String)
*/
- @Override
protected Object loadedTheObject(String path) throws Exception {
return null;
// XMLObjectAnalyzer analyzer = new XMLObjectAnalyzer();
Modified:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XMLTemplateCreationWizardPage.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XMLTemplateCreationWizardPage.java 2010-08-19
10:56:56 UTC (rev 24291)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XMLTemplateCreationWizardPage.java 2010-08-19
11:16:52 UTC (rev 24292)
@@ -38,6 +38,7 @@
import org.eclipse.swt.widgets.Text;
import org.eclipse.xsd.XSDElementDeclaration;
import org.jboss.tools.smooks.configuration.SmooksModelUtils;
+import
org.jboss.tools.smooks.configuration.editors.file.AbstractFileSelectionWizardPage;
import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
import org.jboss.tools.smooks.templating.model.ModelBuilderException;
import org.jboss.tools.smooks.templating.model.xml.XSDModelBuilder;
@@ -77,7 +78,6 @@
* @seeorg.jboss.tools.smooks.configuration.editors.xml.
* AbstractFileSelectionWizardPage#loadedTheObject(java.lang.String)
*/
- @Override
protected Object loadedTheObject(String path) throws Exception {
// TODO Auto-generated method stub
return null;
@@ -144,78 +144,79 @@
* AbstractFileSelectionWizardPage
* #createFilePathText(org.eclipse.swt.widgets.Composite)
*/
- @Override
+// @Override
protected Text createFilePathText(Composite parent) {
- fileTextComposite = new Composite(parent, SWT.NONE);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.grabExcessHorizontalSpace = true;
- fileTextComposite.setLayoutData(gd);
- GridLayout xsdtgl = new GridLayout();
- xsdtgl.marginWidth = 0;
- xsdtgl.marginHeight = 0;
- xsdtgl.numColumns = 2;
- fileTextComposite.setLayout(xsdtgl);
-
- final Text fileText = new Text(fileTextComposite, SWT.BORDER);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- fileText.setLayoutData(gd);
- fileText.addModifyListener(new ModifyListener() {
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.
- * swt.events.ModifyEvent)
- */
- public void modifyText(ModifyEvent e) {
- reasourceLoaded = false;
- if (tableViewer != null) {
- tableViewer.setInput(Collections.emptyList());
- }
- }
-
- });
- gd.grabExcessHorizontalSpace = true;
-
- loadXSDButton = new Button(fileTextComposite, SWT.NONE);
- loadXSDButton.setText(Messages.XMLTemplateCreationWizardPage_Button_Load);
- loadXSDButton.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- super.widgetSelected(e);
- parsingError = null;
- reasourceLoaded = false;
- if (fileText.getText() == null || fileText.getText().length() == 0) {
- changeWizardPageStatus();
- return;
- }
-
- List<String> list;
- try {
- list = loadElement(fileText.getText());
- if (list == null || list.isEmpty()) {
- setErrorMessage(Messages.XMLTemplateCreationWizardPage_XSDParsingError1);
- } else {
- tableViewer.setInput(list);
- reasourceLoaded = true;
- }
- } catch (InvocationTargetException e1) {
- parsingError = e1.getTargetException();
- while(parsingError instanceof InvocationTargetException){
- parsingError = ((InvocationTargetException)parsingError).getTargetException();
- }
- } catch (IOException e1) {
- parsingError = e1;
- } catch (ModelBuilderException e1) {
- parsingError = e1;
- }
- changeWizardPageStatus();
- }
-
- });
- return fileText;
+// fileTextComposite = new Composite(parent, SWT.NONE);
+// GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+// gd.grabExcessHorizontalSpace = true;
+// fileTextComposite.setLayoutData(gd);
+// GridLayout xsdtgl = new GridLayout();
+// xsdtgl.marginWidth = 0;
+// xsdtgl.marginHeight = 0;
+// xsdtgl.numColumns = 2;
+// fileTextComposite.setLayout(xsdtgl);
+//
+// final Text fileText = new Text(fileTextComposite, SWT.BORDER);
+// gd = new GridData(GridData.FILL_HORIZONTAL);
+// fileText.setLayoutData(gd);
+// fileText.addModifyListener(new ModifyListener() {
+//
+// /*
+// * (non-Javadoc)
+// *
+// * @see
+// * org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.
+// * swt.events.ModifyEvent)
+// */
+// public void modifyText(ModifyEvent e) {
+// reasourceLoaded = false;
+// if (tableViewer != null) {
+// tableViewer.setInput(Collections.emptyList());
+// }
+// }
+//
+// });
+// gd.grabExcessHorizontalSpace = true;
+//
+// loadXSDButton = new Button(fileTextComposite, SWT.NONE);
+// loadXSDButton.setText(Messages.XMLTemplateCreationWizardPage_Button_Load);
+// loadXSDButton.addSelectionListener(new SelectionAdapter() {
+//
+// @Override
+// public void widgetSelected(SelectionEvent e) {
+// super.widgetSelected(e);
+// parsingError = null;
+// reasourceLoaded = false;
+// if (fileText.getText() == null || fileText.getText().length() == 0) {
+// changeWizardPageStatus();
+// return;
+// }
+//
+// List<String> list;
+// try {
+// list = loadElement(fileText.getText());
+// if (list == null || list.isEmpty()) {
+// setErrorMessage(Messages.XMLTemplateCreationWizardPage_XSDParsingError1);
+// } else {
+// tableViewer.setInput(list);
+// reasourceLoaded = true;
+// }
+// } catch (InvocationTargetException e1) {
+// parsingError = e1.getTargetException();
+// while(parsingError instanceof InvocationTargetException){
+// parsingError = ((InvocationTargetException)parsingError).getTargetException();
+// }
+// } catch (IOException e1) {
+// parsingError = e1;
+// } catch (ModelBuilderException e1) {
+// parsingError = e1;
+// }
+// changeWizardPageStatus();
+// }
+//
+// });
+// return fileText;
+ return null;
}
private List<String> loadElement(String path) throws InvocationTargetException,
IOException, ModelBuilderException {
Modified:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XSDStructuredDataWizard.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XSDStructuredDataWizard.java 2010-08-19
10:56:56 UTC (rev 24291)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XSDStructuredDataWizard.java 2010-08-19
11:16:52 UTC (rev 24292)
@@ -14,12 +14,13 @@
import org.jboss.tools.smooks.configuration.SmooksModelUtils;
import org.jboss.tools.smooks.configuration.editors.SmooksMultiFormEditor;
+import
org.jboss.tools.smooks.configuration.editors.file.AbstractFileSelectionWizardPage;
/**
* @author Dart (dpeng(a)redhat.com)
*
*/
-public class XSDStructuredDataWizard extends AbstractStructuredDdataWizard {
+public class XSDStructuredDataWizard extends AbstractStructuredDataWizard {
public XSDStructuredDataWizard() {
Modified:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/dbm/editor/SmooksConfigurationFormPage.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/dbm/editor/SmooksConfigurationFormPage.java 2010-08-19
10:56:56 UTC (rev 24291)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/dbm/editor/SmooksConfigurationFormPage.java 2010-08-19
11:16:52 UTC (rev 24292)
@@ -34,10 +34,10 @@
import org.eclipse.ui.forms.widgets.Section;
import org.jboss.tools.smooks.configuration.SmooksConstants;
import org.jboss.tools.smooks.configuration.editors.Messages;
-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.ISmooksModelProvider;
import org.jboss.tools.smooks.model.core.GlobalParams;
import org.jboss.tools.smooks.model.core.ICorePackage;
import org.jboss.tools.smooks.model.core.IParam;
Modified:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/AbstractSmooksFormEditor.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/AbstractSmooksFormEditor.java 2010-08-19
10:56:56 UTC (rev 24291)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/AbstractSmooksFormEditor.java 2010-08-19
11:16:52 UTC (rev 24292)
@@ -58,6 +58,7 @@
import org.jboss.tools.smooks.configuration.editors.SmooksXMLEditor;
import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
import org.jboss.tools.smooks.graphical.editors.ISmooksEditorInitListener;
+import org.jboss.tools.smooks.model.ISmooksModelProvider;
import org.jboss.tools.smooks.model.SmooksEditorModelBuilder;
import org.jboss.tools.smooks.model.SmooksModel;
import org.jboss.tools.smooks.model.core.IParam;
@@ -233,8 +234,8 @@
// create EMF resource
if (file != null) {
try {
- smooksModel = smooksEditorModelBuilder.readModel(file
- .getContents());
+ smooksModel = smooksEditorModelBuilder.readModel(file.getContents());
+ smooksModel.getModelRoot().setModelProvider(this);
} catch (Exception e) {
initSmooksModelException = e;
}
@@ -479,6 +480,7 @@
try {
stream = new ByteArrayInputStream(conents.getBytes());
this.smooksModel = smooksEditorModelBuilder.readModel(stream);
+ smooksModel.getModelRoot().setModelProvider(this);
} catch (Exception e) {
smooksModel = null;
exception = e;
Deleted:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/ISmooksModelProvider.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/ISmooksModelProvider.java 2010-08-19
10:56:56 UTC (rev 24291)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/ISmooksModelProvider.java 2010-08-19
11:16:52 UTC (rev 24292)
@@ -1,18 +0,0 @@
-/**
- *
- */
-package org.jboss.tools.smooks.editor;
-
-import org.eclipse.emf.edit.domain.IEditingDomainProvider;
-import org.jboss.tools.smooks.model.SmooksModel;
-import org.milyn.javabean.dynamic.Model;
-
-/**
- * @author Dart
- *
- */
-public interface ISmooksModelProvider extends IEditingDomainProvider{
- Model<SmooksModel> getSmooksModel();
-
- String getInputType();
-}
Modified:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/AbstractProcessGraphAction.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/AbstractProcessGraphAction.java 2010-08-19
10:56:56 UTC (rev 24291)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/AbstractProcessGraphAction.java 2010-08-19
11:16:52 UTC (rev 24292)
@@ -20,8 +20,8 @@
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.ui.IEditorPart;
-import org.jboss.tools.smooks.editor.ISmooksModelProvider;
import org.jboss.tools.smooks.graphical.editors.process.TaskType;
+import org.jboss.tools.smooks.model.ISmooksModelProvider;
/**
* @author Dart
Modified:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/AddNextTaskNodeAction.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/AddNextTaskNodeAction.java 2010-08-19
10:56:56 UTC (rev 24291)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/AddNextTaskNodeAction.java 2010-08-19
11:16:52 UTC (rev 24292)
@@ -12,10 +12,10 @@
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.ui.IEditorPart;
-import org.jboss.tools.smooks.editor.ISmooksModelProvider;
import org.jboss.tools.smooks.graphical.editors.TaskTypeManager;
import org.jboss.tools.smooks.graphical.editors.process.ProcessFactory;
import org.jboss.tools.smooks.graphical.editors.process.TaskType;
+import org.jboss.tools.smooks.model.ISmooksModelProvider;
import org.jboss.tools.smooks.model.SmooksModel;
import org.milyn.javabean.dynamic.Model;
Modified:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/AddTaskNodeAction.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/AddTaskNodeAction.java 2010-08-19
10:56:56 UTC (rev 24291)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/AddTaskNodeAction.java 2010-08-19
11:16:52 UTC (rev 24292)
@@ -1,9 +1,9 @@
package org.jboss.tools.smooks.graphical.actions;
import org.eclipse.ui.IEditorPart;
-import org.jboss.tools.smooks.editor.ISmooksModelProvider;
import org.jboss.tools.smooks.graphical.editors.TaskTypeManager;
import org.jboss.tools.smooks.graphical.editors.process.TaskType;
+import org.jboss.tools.smooks.model.ISmooksModelProvider;
public class AddTaskNodeAction extends AbstractProcessGraphAction {
Modified:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/DeleteTaskNodeAction.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/DeleteTaskNodeAction.java 2010-08-19
10:56:56 UTC (rev 24291)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/DeleteTaskNodeAction.java 2010-08-19
11:16:52 UTC (rev 24292)
@@ -17,11 +17,11 @@
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;
-import org.jboss.tools.smooks.editor.ISmooksModelProvider;
import org.jboss.tools.smooks.graphical.editors.TaskTypeManager;
import org.jboss.tools.smooks.graphical.editors.process.IProcessProvider;
import org.jboss.tools.smooks.graphical.editors.process.ProcessType;
import org.jboss.tools.smooks.graphical.editors.process.TaskType;
+import org.jboss.tools.smooks.model.ISmooksModelProvider;
/**
* @author Dart
Modified:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksProcessGraphicalEditor.java
===================================================================
---
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksProcessGraphicalEditor.java 2010-08-19
10:56:56 UTC (rev 24291)
+++
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksProcessGraphicalEditor.java 2010-08-19
11:16:52 UTC (rev 24292)
@@ -73,7 +73,6 @@
import org.jboss.tools.smooks.configuration.editors.SmooksReaderFormPage;
import org.jboss.tools.smooks.configuration.validate.ISmooksModelValidateListener;
import org.jboss.tools.smooks.editor.AbstractSmooksFormEditor;
-import org.jboss.tools.smooks.editor.ISmooksModelProvider;
import org.jboss.tools.smooks.graphical.actions.AbstractProcessGraphAction;
import org.jboss.tools.smooks.graphical.actions.AddNextTaskNodeAction;
import org.jboss.tools.smooks.graphical.actions.DeleteTaskNodeAction;
@@ -86,6 +85,7 @@
import org.jboss.tools.smooks.graphical.editors.process.TaskNodeFigure;
import org.jboss.tools.smooks.graphical.editors.process.TaskType;
import org.jboss.tools.smooks.graphical.editors.process.TemplateAppyTaskNode;
+import org.jboss.tools.smooks.model.ISmooksModelProvider;
/**
* @author Dart