Author: DartPeng
Date: 2009-10-23 02:55:50 -0400 (Fri, 23 Oct 2009)
New Revision: 18248
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksReaderFormPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIReader12DataWizard.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json12/Json12DataWizard.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/AbstractFileSelectionWizardPage.java
trunk/smooks/tests/org.jboss.tools.smooks.core.test/src/org/jboss/tools/smooks/test/ediparser/EDIParserTest.java
Log:
JBIDE-5074
Done
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksReaderFormPage.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksReaderFormPage.java 2009-10-23
02:06:18 UTC (rev 18247)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksReaderFormPage.java 2009-10-23
06:55:50 UTC (rev 18248)
@@ -54,6 +54,7 @@
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;
@@ -83,7 +84,9 @@
import org.eclipse.ui.forms.widgets.Section;
import org.eclipse.ui.ide.IDE;
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.configuration.validate.ISmooksModelValidateListener;
import org.jboss.tools.smooks.editor.ISmooksModelProvider;
import org.jboss.tools.smooks.editor.ISourceSynchronizeListener;
@@ -537,7 +540,7 @@
deactiveAllInputFile(compoundCommand);
if (!compoundCommand.isEmpty()) {
getEditingDomain().getCommandStack().execute(compoundCommand);
- if(reader != null && reader instanceof EObject){
+ if (reader != null && reader instanceof EObject) {
createReaderPanel(((EObject) reader));
}
}
@@ -820,8 +823,8 @@
IJavaProject javaProject = JavaCore.create(file.getProject());
if (javaProject != null) {
try {
- if(filePath.endsWith("[]")){
- filePath = filePath.substring(0,filePath.length() - 2);
+ if (filePath.endsWith("[]")) {
+ filePath = filePath.substring(0, filePath.length() - 2);
}
IJavaElement result = javaProject.findType(filePath);
if (result != null)
@@ -950,19 +953,40 @@
}
protected void showInputDataWizard() {
- StructuredDataSelectionWizard wizard = new StructuredDataSelectionWizard();
- wizard.setInput(getEditorInput());
- wizard.setSite(getEditorSite());
- wizard.setForcePreviousAndNextButtons(true);
- StructuredDataSelectionWizardDailog dialog = new StructuredDataSelectionWizardDailog(
- getEditorSite().getShell(), wizard, getSmooksGraphicsExtType());
- if (dialog.show() == Dialog.OK) {
- SmooksGraphicsExtType extType = getSmooksGraphicsExtType();
- String type = dialog.getType();
- String path = dialog.getPath();
- Properties pros = dialog.getProperties();
- SmooksUIUtils.recordInputDataInfomation(getEditingDomain(), null, extType, type, path,
pros);
+
+ SmooksGraphicsExtType extType = getSmooksGraphicsExtType();
+ String inputType = extType.getInputType();
+ List<InputType> inputTypes = null;
+ if (inputType == null || SmooksModelUtils.INPUT_TYPE_CUSTOME.equals(inputType) ||
inputType.trim().equals("")) {
+ StructuredDataSelectionWizard wizard = new StructuredDataSelectionWizard();
+ wizard.setInput(getEditorInput());
+ wizard.setSite(getEditorSite());
+ wizard.setForcePreviousAndNextButtons(true);
+ StructuredDataSelectionWizardDailog dialog = new
StructuredDataSelectionWizardDailog(getEditorSite()
+ .getShell(), wizard, getSmooksGraphicsExtType());
+
+ if (dialog.show() == Dialog.OK) {
+ String type = dialog.getType();
+ String path = dialog.getPath();
+ Properties pros = dialog.getProperties();
+ inputTypes = SmooksUIUtils.recordInputDataInfomation(getEditingDomain(), null,
extType, type, path, pros);
+ }
+ } 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(), null,
extType, inputType, path, pros);
+ }
}
+
+ if(inputTypes != null && !inputTypes.isEmpty()){
+ deactiveAllInputFile(null);
+ setInputDataActiveStatus(true, inputTypes.get(0), null);
+ }
}
private void refreshInputModelView() {
@@ -974,8 +998,8 @@
}
public void inputTypeChanged(SmooksGraphicsExtType extType) {
- if (inputDataViewer != null)
- inputDataViewer.refresh();
+// if (inputDataViewer != null)
+// inputDataViewer.refresh();
refreshInputModelView();
}
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIReader12DataWizard.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIReader12DataWizard.java 2009-10-23
02:06:18 UTC (rev 18247)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIReader12DataWizard.java 2009-10-23
06:55:50 UTC (rev 18248)
@@ -35,6 +35,7 @@
import org.jboss.tools.smooks10.model.smooks.util.SmooksModelUtils;
/**
+ * @deprecated
* @author Dart
*
*/
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json12/Json12DataWizard.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json12/Json12DataWizard.java 2009-10-23
02:06:18 UTC (rev 18247)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json12/Json12DataWizard.java 2009-10-23
06:55:50 UTC (rev 18248)
@@ -40,6 +40,7 @@
import org.jboss.tools.smooks10.model.smooks.util.SmooksModelUtils;
/**
+ * @deprecated
* @author Dart (dpeng(a)redhat.com)
*
*/
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java 2009-10-23
02:06:18 UTC (rev 18247)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java 2009-10-23
06:55:50 UTC (rev 18248)
@@ -889,9 +889,10 @@
});
}
-// boolean valueIsSet = true;
+ // boolean valueIsSet = true;
if (model != null && model instanceof EObject && itemPropertyDescriptor
!= null) {
-// valueIsSet = ((EObject) model).eIsSet((EAttribute)
itemPropertyDescriptor.getFeature(model));
+ // valueIsSet = ((EObject) model).eIsSet((EAttribute)
+ // itemPropertyDescriptor.getFeature(model));
}
if (editValue != null) {
valueText.setText(editValue);
@@ -1215,8 +1216,8 @@
if (fresource.getProject().hasNature(JavaCore.NATURE_ID)) {
IJavaProject javaProject = JavaCore.create(fresource.getProject());
String typeName = searchComposite.getText().getText();
- if(typeName.endsWith("[]")){
- typeName = typeName.substring(0,typeName.length() - 2);
+ if (typeName.endsWith("[]")) {
+ typeName = typeName.substring(0, typeName.length() - 2);
}
IJavaElement result = javaProject.findType(typeName);
if (result != null)
@@ -1412,8 +1413,8 @@
}
public static SmooksResourceListType getSmooks11ResourceListType(EObject model) {
- if(model instanceof org.jboss.tools.smooks.model.smooks.DocumentRoot){
- return
((org.jboss.tools.smooks.model.smooks.DocumentRoot)model).getSmooksResourceList();
+ if (model instanceof org.jboss.tools.smooks.model.smooks.DocumentRoot) {
+ return ((org.jboss.tools.smooks.model.smooks.DocumentRoot)
model).getSmooksResourceList();
}
if (model instanceof SmooksResourceListType)
return (SmooksResourceListType) model;
@@ -2439,8 +2440,9 @@
return false;
}
- public static void recordInputDataInfomation(EditingDomain domain, InputType input,
SmooksGraphicsExtType extType,
+ public static List<InputType> recordInputDataInfomation(EditingDomain domain,
InputType input, SmooksGraphicsExtType extType,
String type, String path, Properties properties) {
+ List<InputType> inputTypeList = new ArrayList<InputType>();
if (type != null && path != null && extType != null && domain
!= null) {
String[] values = path.split(";");
if (values == null || values.length == 0) {
@@ -2475,7 +2477,10 @@
input.getParam().addAll(params);
Command command = AddCommand.create(domain, extType,
GraphPackage.Literals.SMOOKS_GRAPHICS_EXT_TYPE__INPUT, input);
- domain.getCommandStack().execute(command);
+ if (command.canExecute()) {
+ domain.getCommandStack().execute(command);
+ inputTypeList.add(input);
+ }
// extType.getInput().add(input);
}
// try {
@@ -2489,6 +2494,8 @@
// SmooksConfigurationActivator.getDefault().log(e);
// }
}
+
+ return inputTypeList;
}
public static void expandGraphTree(List<?> expandNodes, TreeNodeEditPart
rootEditPart) {
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/AbstractFileSelectionWizardPage.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/AbstractFileSelectionWizardPage.java 2009-10-23
02:06:18 UTC (rev 18247)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/AbstractFileSelectionWizardPage.java 2009-10-23
06:55:50 UTC (rev 18248)
@@ -191,6 +191,10 @@
hookBrowseButtonSelectionAdapter();
hookFileTextModifyListener();
this.setControl(mainComposite);
+
+ changeWizardPageStatus();
+ // don't show the error message when first open the dialog
+ this.setErrorMessage(null);
}
protected void hookFileTextModifyListener() {
@@ -361,7 +365,7 @@
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = GridData.END;
fileSystemBrowseButton.setLayoutData(gd);
- changeWizardPageStatus();
+
return xsdComposite;
}
Modified:
trunk/smooks/tests/org.jboss.tools.smooks.core.test/src/org/jboss/tools/smooks/test/ediparser/EDIParserTest.java
===================================================================
---
trunk/smooks/tests/org.jboss.tools.smooks.core.test/src/org/jboss/tools/smooks/test/ediparser/EDIParserTest.java 2009-10-23
02:06:18 UTC (rev 18247)
+++
trunk/smooks/tests/org.jboss.tools.smooks.core.test/src/org/jboss/tools/smooks/test/ediparser/EDIParserTest.java 2009-10-23
06:55:50 UTC (rev 18248)
@@ -28,6 +28,7 @@
import org.jboss.tools.smooks.model.smooks.SmooksResourceListType;
import org.jboss.tools.smooks.model.smooks.util.SmooksResourceFactoryImpl;
import org.jboss.tools.smooks.test.model11.BaseTestCase;
+import org.jboss.tools.smooks10.model.smooks.util.SmooksModelUtils;
/**
* @author Dart (dpeng(a)redhat.com)
@@ -36,27 +37,24 @@
public class EDIParserTest extends BaseTestCase {
public void testEDIParser() throws IOException, DocumentException,
ParserConfigurationException {
-
+
Resource smooksResource = new SmooksResourceFactoryImpl().createResource(null);
-
-
-
smooksResource.load(EDIParserTest.class.getResourceAsStream("smooks-config.xml"),
null);
SmooksResourceListType resourceList =
((org.jboss.tools.smooks.model.smooks.DocumentRoot) smooksResource
.getContents().get(0)).getSmooksResourceList();
assertNotNull(resourceList);
-
+
SmooksGraphicsExtType extType = getSmooksGraphExtType(resourceList);
-
+
assertNotNull(extType);
InputType inputType = null;
List<?> ilist = extType.getInput();
for (Iterator<?> iterator = ilist.iterator(); iterator.hasNext();) {
Object object = (Object) iterator.next();
if (object instanceof InputType) {
- if ("EDI".equalsIgnoreCase(((InputType) object).getType())) {
+ if (SmooksModelUtils.INPUT_TYPE_EDI_1_1.equalsIgnoreCase(((InputType)
object).getType())) {
inputType = (InputType) object;
break;
}
@@ -65,7 +63,8 @@
assertNotNull(inputType);
EDIDataParser parser = new EDIDataParser();
- TagList tagList =
parser.parseEDIFile(EDIParserTest.class.getResourceAsStream("input-message.edi"),
inputType,resourceList);
+ TagList tagList =
parser.parseEDIFile(EDIParserTest.class.getResourceAsStream("input-message.edi"),
inputType,
+ resourceList);
assertNotNull(tagList);
List<String> namesList = new ArrayList<String>();
namesList.add("Orderaaa");
@@ -74,7 +73,8 @@
for (Iterator<?> iterator = ilist.iterator(); iterator.hasNext();) {
Object object = (Object) iterator.next();
if (object instanceof InputType) {
- if ("EDI".equalsIgnoreCase(((InputType) object).getType()) &&
object != inputType) {
+ if (SmooksModelUtils.INPUT_TYPE_EDI_1_1.equalsIgnoreCase(((InputType)
object).getType())
+ && object != inputType) {
inputType = (InputType) object;
break;
}