JBoss Tools SVN: r21824 - trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2.
by jbosstools-commits@lists.jboss.org
Author: yzhishko
Date: 2010-04-30 07:12:59 -0400 (Fri, 30 Apr 2010)
New Revision: 21824
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/JSF2SourceValidator.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5930 - fixed committing problems.
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/JSF2SourceValidator.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/JSF2SourceValidator.java 2010-04-30 09:01:26 UTC (rev 21823)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/JSF2SourceValidator.java 2010-04-30 11:12:59 UTC (rev 21824)
@@ -82,6 +82,7 @@
if (model instanceof IDOMModel) {
this.document = ((IDOMModel) model).getDocument();
}
+ model.releaseFromRead();
}
}
14 years, 8 months
JBoss Tools SVN: r21823 - trunk/smooks/plugins/org.jboss.tools.smooks.ui/META-INF.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2010-04-30 05:01:26 -0400 (Fri, 30 Apr 2010)
New Revision: 21823
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF
Log:
JBIDE-5983
remove unused codes
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF 2010-04-30 08:55:28 UTC (rev 21822)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF 2010-04-30 09:01:26 UTC (rev 21823)
@@ -45,9 +45,9 @@
Bundle-ClassPath: .
Export-Package: org.jboss.tools.smooks.configuration,
org.jboss.tools.smooks.configuration.editors,
- org.jboss.tools.smooks.configuration.editors.csv,
- org.jboss.tools.smooks.configuration.editors.edi,
- org.jboss.tools.smooks.configuration.editors.javabean,
+ org.jboss.tools.smooks.configuration.editors.csv12,
+ org.jboss.tools.smooks.configuration.editors.edireader12,
+ org.jboss.tools.smooks.configuration.editors.javabean12,
org.jboss.tools.smooks.configuration.editors.uitls,
org.jboss.tools.smooks.configuration.editors.xml,
org.jboss.tools.smooks.edimap.editor,
14 years, 8 months
JBoss Tools SVN: r21822 - in trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks: configuration/editors and 12 other directories.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2010-04-30 04:55:28 -0400 (Fri, 30 Apr 2010)
New Revision: 21822
Added:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv12/CSVDataParser.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIDataParser.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIDataPathWizardPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIDataWizard.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIMappingDataPathWizardPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/IJavaBeanSelectionListener.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaBeanConfigWizardPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaBeanList.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaBeanModel.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaBeanModelFactory.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaBeanModelLoadComposite.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaBeanSelectionWizardPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaBeanTableLabelProvider.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaMethodsSelectionDialog.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaPropertiesSelectionDialog.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavabeanContentProvider.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavabeanStrucutredDataWizard.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavabeanlabelProvider.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/PropertiesAndSetterMethodSearchFieldEditorCreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/ValueWiringBindingSelectionDialog.java
Removed:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv/
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edi/
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIReader12DataPathWizardPage.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/javabean/
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json/
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/temp/
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XSLModelAnalyzer.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XSLTagObject.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors_10/
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/actions/xsltemplate/
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreatorManager.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SelectorCreationDialog.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv12/CSV12InputDataWizard.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv12/Messages.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv12/messages.properties
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/Messages.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/messages.properties
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaBean12PropertyUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/Javabean12ExpressionUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavabeanValueBinding12UICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavabeanWiringBiding12UICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/Messages.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/messages.properties
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/JavaPropertiesProposalProvider.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/uitls/XMLStructuredModelProposal.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/wizard/ViewerInitorStore.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/ConnectionModelFactoryImpl.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksGraphicalEditorMenuContextProvider.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksGraphicalEditorPart.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksJavaMappingGraphicalEditor.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/commands/CreateJavaBeanModelCommand.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/model/InputDataTreeNodeModel.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/model/freemarker/FreemarkerContentProvider.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/wizards/JavaBeanCreationWizard.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/wizards/JavaBeanCreationWizardPage.java
Log:
JBIDE-5983
remove unused codes
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreatorManager.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreatorManager.java 2010-04-30 08:50:50 UTC (rev 21821)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreatorManager.java 2010-04-30 08:55:28 UTC (rev 21822)
@@ -16,15 +16,6 @@
import org.jboss.tools.smooks.configuration.editors.csv12.Csv12ReaderBindingPropertyUICreator;
import org.jboss.tools.smooks.configuration.editors.csv12.Csv12ReaderMapBindingPropertyUICreator;
import org.jboss.tools.smooks.configuration.editors.csv12.Csv12ReaderUICreator;
-import org.jboss.tools.smooks.configuration.editors.edi.ComponentUICreator;
-import org.jboss.tools.smooks.configuration.editors.edi.DelimitersUICreator;
-import org.jboss.tools.smooks.configuration.editors.edi.DescriptionUICreator;
-import org.jboss.tools.smooks.configuration.editors.edi.EdiMapUICreator;
-import org.jboss.tools.smooks.configuration.editors.edi.FieldUICreator;
-import org.jboss.tools.smooks.configuration.editors.edi.MappingNodeUICreator;
-import org.jboss.tools.smooks.configuration.editors.edi.SegmentUICreator;
-import org.jboss.tools.smooks.configuration.editors.edi.SegmentsUICreator;
-import org.jboss.tools.smooks.configuration.editors.edi.SubComponentUICreator;
import org.jboss.tools.smooks.configuration.editors.edireader12.EDIReader12UICreator;
import org.jboss.tools.smooks.configuration.editors.freemarker.FreemarkerUICreator;
import org.jboss.tools.smooks.configuration.editors.freemarker.InlineUICreator;
@@ -59,15 +50,6 @@
import org.jboss.tools.smooks.model.freemarker.impl.UseImpl;
import org.jboss.tools.smooks.model.javabean12.impl.BeanTypeImpl;
import org.jboss.tools.smooks.model.json12.impl.Json12ReaderImpl;
-import org.jboss.tools.smooks.model.medi.impl.ComponentImpl;
-import org.jboss.tools.smooks.model.medi.impl.DelimitersImpl;
-import org.jboss.tools.smooks.model.medi.impl.DescriptionImpl;
-import org.jboss.tools.smooks.model.medi.impl.EdiMapImpl;
-import org.jboss.tools.smooks.model.medi.impl.FieldImpl;
-import org.jboss.tools.smooks.model.medi.impl.MappingNodeImpl;
-import org.jboss.tools.smooks.model.medi.impl.SegmentImpl;
-import org.jboss.tools.smooks.model.medi.impl.SegmentsImpl;
-import org.jboss.tools.smooks.model.medi.impl.SubComponentImpl;
import org.jboss.tools.smooks.model.smooks.impl.ConditionTypeImpl;
import org.jboss.tools.smooks.model.smooks.impl.ConditionsTypeImpl;
import org.jboss.tools.smooks.model.smooks.impl.FeaturesTypeImpl;
@@ -139,17 +121,6 @@
new org.jboss.tools.smooks.configuration.editors.freemarker.TemplateUICreator());
map.put(UseImpl.class, new UseUICreator());
- // for medi
- map.put(ComponentImpl.class, new ComponentUICreator());
- map.put(DelimitersImpl.class, new DelimitersUICreator());
- map.put(DescriptionImpl.class, new DescriptionUICreator());
- map.put(EdiMapImpl.class, new EdiMapUICreator());
- map.put(FieldImpl.class, new FieldUICreator());
- map.put(MappingNodeImpl.class, new MappingNodeUICreator());
- map.put(SegmentImpl.class, new SegmentUICreator());
- map.put(SegmentsImpl.class, new SegmentsUICreator());
- map.put(SubComponentImpl.class, new SubComponentUICreator());
-
// for JSON 1.2
map.put(Json12ReaderImpl.class, new Json12ReaderUICreator());
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SelectorCreationDialog.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SelectorCreationDialog.java 2010-04-30 08:50:50 UTC (rev 21821)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SelectorCreationDialog.java 2010-04-30 08:55:28 UTC (rev 21822)
@@ -43,12 +43,12 @@
import org.eclipse.ui.forms.events.IHyperlinkListener;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Hyperlink;
-import org.jboss.tools.smooks.configuration.editors.csv.CSVDataParser;
-import org.jboss.tools.smooks.configuration.editors.edi.EDIDataParser;
+import org.jboss.tools.smooks.configuration.editors.csv12.CSVDataParser;
+import org.jboss.tools.smooks.configuration.editors.edireader12.EDIDataParser;
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.javabean.JavaBeanModel;
-import org.jboss.tools.smooks.configuration.editors.javabean.JavaBeanModelFactory;
+import org.jboss.tools.smooks.configuration.editors.javabean12.JavaBeanModel;
+import org.jboss.tools.smooks.configuration.editors.javabean12.JavaBeanModelFactory;
import org.jboss.tools.smooks.configuration.editors.uitls.JsonInputDataParser;
import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
import org.jboss.tools.smooks.configuration.editors.wizard.StructuredDataSelectionWizard;
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv12/CSV12InputDataWizard.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv12/CSV12InputDataWizard.java 2010-04-30 08:50:50 UTC (rev 21821)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv12/CSV12InputDataWizard.java 2010-04-30 08:55:28 UTC (rev 21822)
@@ -21,7 +21,6 @@
import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;
import org.jboss.tools.smooks.configuration.editors.SmooksMultiFormEditor;
-import org.jboss.tools.smooks.configuration.editors.csv.CSVDataParser;
import org.jboss.tools.smooks.configuration.editors.csv12.CSV12DataConfigurationWizardPage.FieldString;
import org.jboss.tools.smooks.configuration.editors.uitls.JsonInputDataParser;
import org.jboss.tools.smooks.configuration.editors.wizard.IStructuredDataSelectionWizard;
Copied: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv12/CSVDataParser.java (from rev 21295, trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv/CSVDataParser.java)
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv12/CSVDataParser.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv12/CSVDataParser.java 2010-04-30 08:55:28 UTC (rev 21822)
@@ -0,0 +1,196 @@
+/*******************************************************************************
+ * 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.csv12;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.lang.reflect.InvocationTargetException;
+import java.nio.charset.Charset;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
+import org.jboss.tools.smooks.configuration.editors.xml.TagList;
+import org.jboss.tools.smooks.configuration.editors.xml.XMLObjectAnalyzer;
+import org.jboss.tools.smooks.model.csv12.CSV12Reader;
+import org.jboss.tools.smooks.model.smooks.AbstractReader;
+import org.jboss.tools.smooks.model.smooks.SmooksResourceListType;
+import org.milyn.Smooks;
+import org.milyn.csv.CSVReaderConfigurator;
+import org.w3c.dom.Document;
+
+/**
+ * @author Dart (dpeng(a)redhat.com)
+ *
+ */
+public class CSVDataParser {
+
+ public static final String LINK_CSV_READER = "linkCSVReader"; //$NON-NLS-1$
+
+ public static final String SEPARATOR = "separator"; //$NON-NLS-1$
+
+ public static final String QUOTECHAR = "quoteChar"; //$NON-NLS-1$
+
+ public static final String SKIPLINES = "skiplines"; //$NON-NLS-1$
+
+ public static final String ENCODING = "encoding"; //$NON-NLS-1$
+
+ public static final String FIELDS = "fields"; //$NON-NLS-1$
+
+ public static final String ROOT_ELEMENT_NAME = "rootElementName"; //$NON-NLS-1$
+
+ public static final String RECORD_NAME = "recordName"; //$NON-NLS-1$
+
+ public TagList parseCSV(String filePath, SmooksResourceListType resourceList)
+ throws FileNotFoundException, InvocationTargetException, ParserConfigurationException {
+ return parseCSV(new FileInputStream(SmooksUIUtils.parseFilePath(filePath)), resourceList);
+ }
+
+ public TagList parseCSV(InputStream inputStream, Object readerObj) throws ParserConfigurationException {
+ String fields = null;
+ String separator = null;
+ String quoteChar = null;
+ String skiplines = null;
+ String encoding = null;
+ String rootName = null;
+ String recordName = null;
+ if (readerObj == null)
+ return null;
+
+// if (readerObj instanceof CsvReader) {
+// CsvReader reader = (CsvReader) readerObj;
+// fields = reader.getFields();
+// separator = reader.getSeparator();
+// skiplines = reader.getSkipLines().toString();
+// quoteChar = reader.getQuote();
+// encoding = reader.getEncoding();
+// }
+ if (readerObj instanceof CSV12Reader) {
+ CSV12Reader reader = (CSV12Reader) readerObj;
+ fields = reader.getFields();
+ separator = reader.getSeparator();
+ skiplines = reader.getSkipLines().toString();
+ quoteChar = reader.getQuote();
+ encoding = reader.getEncoding();
+ rootName = reader.getRootElementName();
+ recordName = reader.getRecordElementName();
+ }
+ return this.parseCSV(inputStream, fields, rootName, recordName, separator, quoteChar, skiplines, encoding);
+ }
+
+ public TagList parseCSV(InputStream stream, SmooksResourceListType resourceList)
+ throws ParserConfigurationException {
+ List<AbstractReader> readers = resourceList.getAbstractReader();
+ int count = 0;
+ int index = -1;
+ for (Iterator<?> iterator2 = readers.iterator(); iterator2.hasNext();) {
+ AbstractReader abstractReader = (AbstractReader) iterator2.next();
+ if ( abstractReader instanceof CSV12Reader) {
+ count++;
+ if (index == -1) {
+ index = readers.indexOf(abstractReader);
+ }
+ }
+
+ }
+
+ if (count > 1) {
+ // throw new
+ // RuntimeException("The smooks config file should have only one JSON reader");
+ }
+ if (index != -1) {
+ return parseCSV(stream, readers.get(index));
+ // return parseJsonFile(stream, (JsonReader)
+ // readers.get(index));
+ }
+ return null;
+ }
+
+ public TagList parseCSV(String filePath, String fields, String rootName, String recordName, String separator,
+ String quoteChar, String skiplines, String encoding) throws FileNotFoundException {
+ return parseCSV(new FileInputStream(filePath), fields, rootName, recordName, separator, quoteChar, skiplines,
+ encoding);
+ }
+
+ public TagList parseCSV(InputStream stream, String fields, String rootName, String recordName, String separator,
+ String quoteChar, String skiplines, String encoding) {
+
+ Smooks smooks = new Smooks();
+
+ // SmooksResourceConfiguration readerConfig = new
+ // SmooksResourceConfiguration("org.xml.sax.driver",
+ // CSVReader.class.getName());
+// if ((quoteChar == null) || (encoding == null) || (fields == null)) {
+// return null;
+// }
+// if (quoteChar == null)
+// quoteChar = "\""; //$NON-NLS-1$
+// if (skiplines == null)
+// skiplines = "0"; //$NON-NLS-1$
+// if (encoding == null)
+// encoding = "UTF-8"; //$NON-NLS-1$
+
+ CSVReaderConfigurator readerConfigurator = new CSVReaderConfigurator(fields);
+ if (separator != null && separator.length() >= 1) {
+ readerConfigurator.setSeparatorChar(separator.toCharArray()[0]);
+ }
+ if (quoteChar != null && quoteChar.length() >= 1) {
+ readerConfigurator.setQuoteChar(quoteChar.toCharArray()[0]);
+ }
+ if (skiplines != null) {
+ try {
+ readerConfigurator.setSkipLineCount(Integer.parseInt(skiplines));
+ } catch (Throwable t) {
+
+ }
+ }
+ if (rootName != null) {
+ readerConfigurator.setRootElementName(rootName);
+ }
+ if (recordName != null) {
+ readerConfigurator.setRecordElementName(recordName);
+ }
+
+ readerConfigurator.setEncoding(Charset.forName(encoding));
+ // readerConfigurator.setIndent(indent)
+
+ smooks.setReaderConfig(readerConfigurator);
+
+ DOMResult result = new DOMResult();
+ smooks.filterSource(new StreamSource(stream), result);
+
+ Document document = (Document) result.getNode();
+
+ XMLObjectAnalyzer analyzer = new XMLObjectAnalyzer();
+ TagList tagList = analyzer.analyze(document, null , null);
+
+ try {
+ if (smooks != null) {
+ smooks.close();
+ smooks = null;
+ }
+ if (stream != null) {
+ stream.close();
+ stream = null;
+ }
+ result = null;
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+
+ return tagList;
+ }
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv12/CSVDataParser.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv12/Messages.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv12/Messages.java 2010-04-30 08:50:50 UTC (rev 21821)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv12/Messages.java 2010-04-30 08:55:28 UTC (rev 21822)
@@ -12,10 +12,18 @@
public static String CSV12InputDataWizard_1;
public static String CSV12InputDataWizard_ExtensionName;
public static String Csv12ReaderUICreator_0;
-// public static String Csv12ReaderUICreator_1;
-// public static String Csv12ReaderUICreator_7;
-// public static String Csv12ReaderUICreator_8;
-// public static String Csv12ReaderUICreator_9;
+
+ public static String CSVDataPathWizardPage_CantFindFileErrorMessage;
+ public static String CSVDataPathWizardPage_ErrorPathErrorMessage;
+ public static String CSVDataPathWizardPage_WizardDes;
+ public static String CSVDataPathWizardPage_WizardTitle;
+ public static String CSVInputDataWizard_ExtensionName;
+ public static String CSVInputDataWizard_WizardPageText;
+ public static String CSVInputDataWizard_WizardTitle;
+ public static String CsvReaderUICreator_AddButtonLabel;
+ public static String CsvReaderUICreator_FieldsLabel;
+ public static String CsvReaderUICreator_RemoveButtonLabel;
+
public static String Csv12ReaderUICreator_Fields;
public static String Csv12ReaderUICreator_ListBinding;
public static String Csv12ReaderUICreator_ListMapBinding;
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv12/messages.properties
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv12/messages.properties 2010-04-30 08:50:50 UTC (rev 21821)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv12/messages.properties 2010-04-30 08:55:28 UTC (rev 21822)
@@ -6,10 +6,19 @@
CSV12InputDataWizard_1=CSV Path Page
CSV12InputDataWizard_ExtensionName=csv
Csv12ReaderUICreator_0=Features
-#Csv12ReaderUICreator_1=Fields
-#Csv12ReaderUICreator_7=Add Field
-#Csv12ReaderUICreator_8=Remove
-#Csv12ReaderUICreator_9=field
+
+CSVDataPathWizardPage_CantFindFileErrorMessage=Can't find the file :
+CSVDataPathWizardPage_ErrorPathErrorMessage=Error file path
+CSVDataPathWizardPage_WizardDes=Select a CSV data file
+CSVDataPathWizardPage_WizardTitle=CSV file selection
+CSVInputDataWizard_ExtensionName=csv
+CSVInputDataWizard_WizardPageText=CSV Path Page
+CSVInputDataWizard_WizardTitle=CSV Input Data Wizard
+CsvReaderUICreator_AddButtonLabel=Add Field
+CsvReaderUICreator_FieldsLabel=Fields
+CsvReaderUICreator_RemoveButtonLabel=Remove
+
+
Csv12ReaderUICreator_Fields=Fields
Csv12ReaderUICreator_ListBinding=List Binding
Csv12ReaderUICreator_ListMapBinding=List MapBinding
Copied: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIDataParser.java (from rev 21818, trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edi/EDIDataParser.java)
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIDataParser.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIDataParser.java 2010-04-30 08:55:28 UTC (rev 21822)
@@ -0,0 +1,255 @@
+/*******************************************************************************
+ * 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.edireader12;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.InvocationTargetException;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.ecore.EObject;
+import org.jboss.tools.smooks.configuration.editors.edireader12.Messages;
+import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
+import org.jboss.tools.smooks.configuration.editors.xml.TagList;
+import org.jboss.tools.smooks.configuration.editors.xml.XMLObjectAnalyzer;
+import org.jboss.tools.smooks.model.edi12.EDI12Reader;
+import org.jboss.tools.smooks.model.smooks.AbstractReader;
+import org.jboss.tools.smooks.model.smooks.SmooksResourceListType;
+import org.milyn.Smooks;
+import org.milyn.smooks.edi.EDIReaderConfigurator;
+import org.osgi.framework.Bundle;
+import org.w3c.dom.Document;
+
+/**
+ * @author Dart
+ *
+ */
+public class EDIDataParser {
+ public static final String USE_AVAILABEL_READER = "use_availableReader"; //$NON-NLS-1$
+
+ public static final String ENCODING = "encoding"; //$NON-NLS-1$
+
+ public static final Object MAPPING_MODEL = "mappingModelFile"; //$NON-NLS-1$
+
+ public static final Object VALIDATE = "validate"; //$NON-NLS-1$
+
+ public TagList parseEDIFile(InputStream stream, SmooksResourceListType resourceList, IProject project)
+ throws IOException {
+ List<AbstractReader> readers = resourceList.getAbstractReader();
+ int count = 0;
+ int index = -1;
+ for (Iterator<?> iterator2 = readers.iterator(); iterator2.hasNext();) {
+ AbstractReader abstractReader = (AbstractReader) iterator2.next();
+ // if (abstractReader instanceof EDIReader) {
+ // count++;
+ // if (index == -1) {
+ // index = readers.indexOf(abstractReader);
+ // }
+ // }
+ if (abstractReader instanceof EDI12Reader) {
+ count++;
+ if (index == -1) {
+ index = readers.indexOf(abstractReader);
+ }
+ }
+ }
+
+ if (count > 1) {
+ // throw new
+ // RuntimeException("The smooks config file should have only one JSON reader");
+ }
+ if (index != -1) {
+ return parseEDIFile(stream, (EObject) readers.get(index), project);
+ }
+ return null;
+ }
+
+ public TagList parseEDIFile(InputStream stream, SmooksResourceListType resourceList) throws IOException {
+ // String encoding = null;
+ // String mappingModel = null;
+ // String validate = null;
+ // String type = inputType.getType();
+ List<AbstractReader> readers = resourceList.getAbstractReader();
+ int count = 0;
+ int index = -1;
+ for (Iterator<?> iterator2 = readers.iterator(); iterator2.hasNext();) {
+ AbstractReader abstractReader = (AbstractReader) iterator2.next();
+ if (abstractReader instanceof EDI12Reader) {
+ count++;
+ if (index == -1) {
+ index = readers.indexOf(abstractReader);
+ }
+ }
+ }
+
+ if (count > 1) {
+ // throw new
+ // RuntimeException("The smooks config file should have only one JSON reader");
+ }
+ if (index != -1) {
+ return parseEDIFile(stream, (EObject) readers.get(index));
+ }
+ return null;
+ // return parseEDIFile(stream, mappingModel, encoding,validate,
+ // resourceList);
+ }
+
+ public TagList parseEDIFile(InputStream ediInputStream, EObject readerObj, IProject project) throws IOException {
+ String encoding = null;
+ String mappingModel = null;
+ String validate = null;
+ // if (readerObj instanceof EDIReader) {
+ // EDIReader reader = (EDIReader) readerObj;
+ // encoding = reader.getEncoding();
+ // mappingModel = reader.getMappingModel();
+ // }
+ if (readerObj instanceof EDI12Reader) {
+ EDI12Reader reader = (EDI12Reader) readerObj;
+ encoding = reader.getEncoding();
+ mappingModel = reader.getMappingModel();
+ }
+ return parseEDIFile(ediInputStream, mappingModel, encoding, validate, project);
+ }
+
+ public TagList parseEDIFile(InputStream ediInputStream, EObject readerObj) throws IOException {
+
+ String encoding = null;
+ String mappingModel = null;
+ // if (readerObj instanceof EDIReader) {
+ // EDIReader reader = (EDIReader) readerObj;
+ // encoding = reader.getEncoding();
+ // mappingModel = reader.getMappingModel();
+ // }
+ if (readerObj instanceof EDI12Reader) {
+ EDI12Reader reader = (EDI12Reader) readerObj;
+ encoding = reader.getEncoding();
+ mappingModel = reader.getMappingModel();
+ }
+ return parseEDIFile(ediInputStream, mappingModel, encoding, null, (EObject) readerObj);
+ }
+
+ public TagList parseEDIFile(InputStream ediInputStream, String mappingModel, String ediFileEncoding,
+ String validate, EObject emodel) throws IOException {
+ IResource resource = SmooksUIUtils.getResource(emodel);
+ IProject project = null;
+ if (resource != null) {
+ project = resource.getProject();
+ }
+ return parseEDIFile(ediInputStream, mappingModel, ediFileEncoding, validate, project);
+ }
+
+ public TagList parseEDIFile(InputStream ediInputStream, String mappingModel, String ediFileEncoding,
+ String validate, IProject project) throws IOException {
+ Smooks smooks = new Smooks();
+
+ // SmooksResourceConfiguration readerConfig = new
+ // SmooksResourceConfiguration("org.xml.sax.driver",
+ // SmooksEDIReader.class.getName());
+
+ if (mappingModel == null) {
+ throw new RuntimeException(Messages.EDIDataParser_Exception_EDI_Mapping_Cannot_Be_Empty);
+ }
+ // If the MappingModel is absolute file path :
+ File f = new File(mappingModel);
+ String modelPath = mappingModel;
+ if (f.exists()) {
+ modelPath = f.toURI().toString();
+ } else {
+ // If the MappingModel isn't the absolute file path , find the file
+ // via Project
+ IFile tf = SmooksUIUtils.getFile(mappingModel, project);
+ if (tf != null) {
+ modelPath = tf.getLocation().toFile().toURI().toString();
+ } else {
+ // If we can't find the File , it means that this codes was
+ // running under the test platform , so the configuration file
+ // is in the smooks.core.test project.
+ // the MappingModel path is the "classpath" format , so I can
+ // get the "smooks.core.test" bundle and find the file via
+ // MappingModel.
+
+ /* this codes are for the plug-in unit tests */
+ Bundle bundle = Platform.getBundle("org.jboss.tools.smooks.core.test"); //$NON-NLS-1$
+ if (bundle != null) {
+ URL ur = bundle.getEntry("/src" + mappingModel); //$NON-NLS-1$
+ if (ur != null) {
+ try {
+ ur = FileLocator.resolve(ur);
+ modelPath = ur.toURI().toString();
+ } catch (URISyntaxException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ }
+ EDIReaderConfigurator readerConfig = new EDIReaderConfigurator(modelPath);
+ if (ediFileEncoding == null || ediFileEncoding.trim().length() == 0) {
+ ediFileEncoding = "UTF-8"; //$NON-NLS-1$
+ }
+ // readerConfig.
+ // readerConfig.setParameter("encoding", ediFileEncoding);
+
+ smooks.setReaderConfig(readerConfig);
+ // SmooksUtil.registerResource(readerConfig, smooks);
+
+ // Use a DOM result to capture the message model for the supplied
+ // CSV
+ // message...
+
+ // Filter the message through Smooks and capture the result as a DOM
+ // in
+ // the domResult instance...
+ // FileInputStream stream
+ DOMResult result = new DOMResult();
+ smooks.filterSource(new StreamSource(ediInputStream), result);
+ Document resultXMLContent = (Document) result.getNode();
+ XMLObjectAnalyzer analyzer = new XMLObjectAnalyzer();
+ TagList tagList = analyzer.analyze(resultXMLContent, null , null);
+
+ try {
+ if (smooks != null) {
+ smooks.close();
+ smooks = null;
+ }
+ if (ediInputStream != null) {
+ ediInputStream.close();
+ ediInputStream = null;
+ }
+ result = null;
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+
+ return tagList;
+ }
+
+ public TagList parseEDIFile(String path, SmooksResourceListType smooksResourceListType)
+ throws InvocationTargetException, FileNotFoundException, IOException {
+ String filePath = SmooksUIUtils.parseFilePath(path);
+
+ return parseEDIFile(new FileInputStream(filePath), smooksResourceListType);
+ }
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIDataParser.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIDataPathWizardPage.java (from rev 21818, trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edi/EDIDataPathWizardPage.java)
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIDataPathWizardPage.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIDataPathWizardPage.java 2010-04-30 08:55:28 UTC (rev 21822)
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * 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.edireader12;
+
+import java.util.List;
+
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.jboss.tools.smooks.configuration.editors.edireader12.Messages;
+import org.jboss.tools.smooks.configuration.editors.xml.AbstractFileSelectionWizardPage;
+
+/**
+ * @author Dart (dpeng(a)redhat.com)
+ *
+ */
+public class EDIDataPathWizardPage extends AbstractFileSelectionWizardPage {
+
+ public EDIDataPathWizardPage(String pageName, boolean multiSelect, Object[] initSelections,
+ List<ViewerFilter> filters) {
+ super(pageName, multiSelect, initSelections, filters);
+ }
+
+ public EDIDataPathWizardPage(String pageName, String[] fileExtensionNames) {
+ super(pageName, fileExtensionNames);
+ this.setTitle(Messages.EDIDataPathWizardPage_Page_Title_EDI_File_Select);
+ this.setDescription(Messages.EDIDataPathWizardPage_Page_Description_EDI_File_Select);
+ }
+
+
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.smooks.configuration.editors.xml.AbstractFileSelectionWizardPage#loadedTheObject(java.lang.String)
+ */
+ @Override
+ protected Object loadedTheObject(String path) throws Exception {
+ return null;
+ }
+
+ @Override
+ protected void changeWizardPageStatus() {
+ super.changeWizardPageStatus();
+ }
+
+ @Override
+ public boolean canFlipToNextPage() {
+ return super.canFlipToNextPage();
+// String filePath = this.getFilePath();
+// try {
+// filePath = SmooksUIUtils.parseFilePath(filePath);
+// if(filePath == null) return false;
+// return new File(filePath).exists();
+// } catch (InvocationTargetException e) {
+// return false;
+// }
+ }
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIDataPathWizardPage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIDataWizard.java (from rev 21818, trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edi/EDIDataWizard.java)
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIDataWizard.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIDataWizard.java 2010-04-30 08:55:28 UTC (rev 21822)
@@ -0,0 +1,201 @@
+/*******************************************************************************
+ * 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.edireader12;
+
+import java.util.Properties;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+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.SmooksMultiFormEditor;
+import org.jboss.tools.smooks.configuration.editors.edireader12.EDIDataParser;
+import org.jboss.tools.smooks.configuration.editors.edireader12.EDIMappingDataPathWizardPage;
+import org.jboss.tools.smooks.configuration.editors.edireader12.Messages;
+import org.jboss.tools.smooks.configuration.editors.wizard.IStructuredDataSelectionWizard;
+import org.jboss.tools.smooks.model.smooks.DocumentRoot;
+import org.jboss.tools.smooks.model.smooks.SmooksResourceListType;
+import org.jboss.tools.smooks10.model.smooks.util.SmooksModelUtils;
+
+/**
+ * @author Dart
+ *
+ */
+public class EDIDataWizard extends Wizard implements IStructuredDataSelectionWizard, INewWizard {
+
+ private EDIMappingDataPathWizardPage mappingFilePage;
+
+ private EDIDataPathWizardPage ediFilePage;
+
+ private SmooksResourceListType resourceList;
+
+ private EditingDomain editingDomain;
+
+ private IContainer folder = null;
+
+
+
+ public EDIDataWizard() {
+ super();
+ this.setWindowTitle(Messages.EDIDataWizard_WizardTitle);
+ }
+
+ @Override
+ public void addPages() {
+ ediFilePage = new EDIDataPathWizardPage(Messages.EDIDataWizard_0, new String[] { Messages.EDIDataWizard_2 }); //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-1$ //$NON-NLS-1$ //$NON-NLS-1$
+ this.addPage(ediFilePage);
+ if (folder != null) {
+ ediFilePage.setInitSelections(new Object[] { folder });
+ }
+
+ // mappingFilePage = new EDIMappingDataPathWizardPage("EDI Config Page",
+ // null);
+ // this.addPage(mappingFilePage);
+ super.addPages();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.wizard.Wizard#performFinish()
+ */
+ @Override
+ public boolean performFinish() {
+ if (mappingFilePage != null) {
+ if (mappingFilePage.isUseAvaliableReader()) {
+ return true;
+ }
+ if (mappingFilePage.isCreateNewReader()) {
+ String encoding = mappingFilePage.getEncoding();
+ String path = mappingFilePage.getFilePath();
+// EDIReader reader = EdiFactory.eINSTANCE.createEDIReader();
+// reader.setEncoding(encoding);
+// reader.setMappingModel(path);
+// Command command = AddCommand.create(editingDomain, resourceList,
+// SmooksPackage.Literals.SMOOKS_RESOURCE_LIST_TYPE__ABSTRACT_READER_GROUP, FeatureMapUtil
+// .createEntry(EdiPackage.Literals.EDI_DOCUMENT_ROOT__READER, reader));
+// editingDomain.getCommandStack().execute(command);
+ }
+ }
+ return true;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.jboss.tools.smooks.configuration.editors.wizard.
+ * IStructuredDataSelectionWizard
+ * #complate(org.jboss.tools.smooks.configuration
+ * .editors.SmooksMultiFormEditor)
+ */
+ public void complate(SmooksMultiFormEditor formEditor) {
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.jboss.tools.smooks.configuration.editors.wizard.
+ * IStructuredDataSelectionWizard#getInputDataTypeID()
+ */
+ public String getInputDataTypeID() {
+ return SmooksModelUtils.INPUT_TYPE_EDI_1_1;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.jboss.tools.smooks.configuration.editors.wizard.
+ * IStructuredDataSelectionWizard#getProperties()
+ */
+ public Properties getProperties() {
+ Properties pros = new Properties();
+ if (mappingFilePage != null) {
+ if (mappingFilePage.isUseAvaliableReader() || mappingFilePage.isCreateNewReader()) {
+ pros.put(EDIDataParser.USE_AVAILABEL_READER, "true"); //$NON-NLS-1$
+ return pros;
+ }
+
+ String encoding = mappingFilePage.getEncoding();
+ pros.put(EDIDataParser.ENCODING, encoding);
+ String path = mappingFilePage.getFilePath();
+ pros.put(EDIDataParser.MAPPING_MODEL, path);
+ }
+ return pros;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.jboss.tools.smooks.configuration.editors.wizard.
+ * IStructuredDataSelectionWizard#getReturnData()
+ */
+ public Object getReturnData() {
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.jboss.tools.smooks.configuration.editors.wizard.
+ * IStructuredDataSelectionWizard#getStructuredDataSourcePath()
+ */
+ public String getStructuredDataSourcePath() {
+ if (ediFilePage.getFilePath() != null) {
+ return ediFilePage.getFilePath();
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.jboss.tools.smooks.configuration.editors.wizard.
+ * IStructuredDataSelectionWizard#init(org.eclipse.ui.IEditorSite,
+ * org.eclipse.ui.IEditorInput)
+ */
+ public void init(IEditorSite site, IEditorInput input) {
+ IEditorPart editorPart = site.getWorkbenchWindow().getActivePage().findEditor(input);
+ if (editorPart != null && editorPart instanceof SmooksMultiFormEditor) {
+ SmooksMultiFormEditor formEditor = (SmooksMultiFormEditor) editorPart;
+ Object smooksModel = formEditor.getSmooksModel();
+ if (smooksModel instanceof DocumentRoot) {
+ resourceList = ((DocumentRoot) smooksModel).getSmooksResourceList();
+ }
+ editingDomain = formEditor.getEditingDomain();
+ }
+ folder = ((IFileEditorInput) input).getFile().getParent();
+ if (ediFilePage != null && folder != null) {
+ ediFilePage.setInitSelections(new Object[] { folder });
+ }
+ if (this.mappingFilePage != null) {
+ mappingFilePage.setSmooksResourceList(resourceList);
+ }
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench,
+ * org.eclipse.jface.viewers.IStructuredSelection)
+ */
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+
+ }
+
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIDataWizard.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIMappingDataPathWizardPage.java (from rev 21819, trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edi/EDIMappingDataPathWizardPage.java)
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIMappingDataPathWizardPage.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIMappingDataPathWizardPage.java 2010-04-30 08:55:28 UTC (rev 21822)
@@ -0,0 +1,267 @@
+/*******************************************************************************
+ * 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.edireader12;
+
+import java.util.List;
+
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+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.Label;
+import org.eclipse.swt.widgets.Text;
+import org.jboss.tools.smooks.configuration.editors.ClassPathFileProcessor;
+import org.jboss.tools.smooks.configuration.editors.edireader12.Messages;
+import org.jboss.tools.smooks.configuration.editors.xml.AbstractFileSelectionWizardPage;
+import org.jboss.tools.smooks.model.smooks.SmooksResourceListType;
+
+/**
+ * @author Dart (dpeng(a)redhat.com)
+ *
+ */
+public class EDIMappingDataPathWizardPage extends AbstractFileSelectionWizardPage {
+
+ private boolean hasReader = false;
+
+ private boolean createNewReader = true;
+
+ private String mappingFile = null;
+
+ private Composite fileComposite = null;
+
+ private String encoding = "UTF-8"; //$NON-NLS-1$
+
+ private Button createNewReaderButton;
+
+ private boolean useAvaliableReader = false;
+
+ private SmooksResourceListType resourceList;
+
+ public EDIMappingDataPathWizardPage(String pageName, boolean multiSelect, Object[] initSelections,
+ List<ViewerFilter> filters) {
+ super(pageName, multiSelect, initSelections, filters);
+ this.setTitle(Messages.EDIMappingDataPathWizardPage_EDI_Wizard_Title);
+ this.setDescription(Messages.EDIMappingDataPathWizardPage_EDI_Wizard_Description);
+ this.setFilePathProcessor(new ClassPathFileProcessor());
+ }
+
+ public EDIMappingDataPathWizardPage(String pageName, String[] fileExtensionNames) {
+ super(pageName, fileExtensionNames);
+ this.setTitle(Messages.EDIMappingDataPathWizardPage_EDI_Wizard_Title);
+ this.setDescription(Messages.EDIMappingDataPathWizardPage_EDI_Wizard_Description);
+ this.setFilePathProcessor(new ClassPathFileProcessor());
+ }
+
+ public String getEncoding() {
+ return encoding;
+ }
+
+ public boolean isUseAvaliableReader() {
+ return useAvaliableReader;
+ }
+
+ public SmooksResourceListType getSmooksResourceList() {
+ return resourceList;
+ }
+
+ public void setSmooksResourceList(SmooksResourceListType resourceList) {
+ this.resourceList = resourceList;
+ }
+
+ private void initData() {
+ encoding = "UTF-8"; //$NON-NLS-1$
+ hasReader = false;
+ useAvaliableReader = false;
+ createNewReader = true;
+// if (SmooksUIUtils.hasReaderAlready(EDIReader.class, resourceList)
+// || SmooksUIUtils.hasReaderAlready(EDIReaderImpl.class, resourceList)) {
+// hasReader = true;
+// }
+
+ mappingFile = null;
+
+ if (hasReader) {
+ useAvaliableReader = true;
+ createNewReader = false;
+ }
+ }
+
+ public boolean isHasReader() {
+ return hasReader;
+ }
+
+ public boolean isCreateNewReader() {
+ return createNewReader;
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ initData();
+ super.createControl(parent);
+ }
+
+ public String getMappingFile() {
+ return mappingFile;
+ }
+
+ @Override
+ protected void createExtensionGUIFirst(Composite parent) {
+ Label encodingLabel = new Label(parent, SWT.NONE);
+ encodingLabel.setText(Messages.EDIMappingDataPathWizardPage_Label_Encoding);
+ final Text encodingText = new Text(parent, SWT.BORDER);
+ encodingText.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ mappingFile = encodingText.getText();
+ }
+ });
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ encodingText.setLayoutData(gd);
+ }
+
+ @Override
+ protected Composite createFileSelectionComposite(Composite parent) {
+ Composite chooseComposite = new Composite(parent, SWT.NONE);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ chooseComposite.setLayoutData(gd);
+
+ GridLayout gl = new GridLayout();
+ gl.numColumns = 2;
+ chooseComposite.setLayout(gl);
+
+ Button newReaderButton = new Button(chooseComposite, SWT.RADIO);
+ newReaderButton.setText(Messages.EDIMappingDataPathWizardPage_Button_Create_Readers);
+
+ final Button useReaderButton = new Button(chooseComposite, SWT.RADIO);
+ useReaderButton.setText(Messages.EDIMappingDataPathWizardPage_Button_Use_Existing_Reader);
+
+ fileComposite = super.createFileSelectionComposite(parent);
+
+ createNewReaderButton = new Button(fileComposite, SWT.CHECK);
+ createNewReaderButton.setText(Messages.EDIMappingDataPathWizardPage_Button_Create_New_Reader);
+ createNewReaderButton.setSelection(true);
+
+ if (hasReader) {
+ createNewReaderButton.setSelection(false);
+ createNewReaderButton.setEnabled(false);
+
+ useReaderButton.setSelection(true);
+ this.setConfigCompositeStates(false);
+ } else {
+ newReaderButton.setSelection(true);
+ createNewReaderButton.setSelection(true);
+ }
+
+ createNewReaderButton.addSelectionListener(new SelectionListener() {
+
+ public void widgetSelected(SelectionEvent e) {
+ createNewReader = createNewReaderButton.getSelection();
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+ });
+
+ newReaderButton.addSelectionListener(new SelectionListener() {
+
+ public void widgetSelected(SelectionEvent e) {
+ useAvaliableReader = useReaderButton.getSelection();
+ setConfigCompositeStates(true);
+ changeWizardPageStatus();
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+
+ }
+ });
+ useReaderButton.addSelectionListener(new SelectionListener() {
+
+ public void widgetSelected(SelectionEvent e) {
+ useAvaliableReader = useReaderButton.getSelection();
+ setConfigCompositeStates(false);
+ changeWizardPageStatus();
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+
+ }
+ });
+ gd = new GridData();
+ gd.horizontalSpan = 2;
+ createNewReaderButton.setLayoutData(gd);
+ return fileComposite;
+ }
+
+ private void setConfigCompositeStates(boolean enabled) {
+ fileComposite.setEnabled(enabled);
+ Control[] controls = fileComposite.getChildren();
+ for (int i = 0; i < controls.length; i++) {
+ Control c = controls[i];
+ if (c == createNewReaderButton) {
+ if (hasReader) {
+ c.setEnabled(false);
+ continue;
+ }
+ }
+ if (c == fileTextComposite) {
+ Control[] cs = ((Composite) c).getChildren();
+ for (int j = 0; j < cs.length; j++) {
+ Control cc = cs[j];
+ cc.setEnabled(enabled);
+ }
+ }
+ c.setEnabled(enabled);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.jboss.tools.smooks.configuration.editors.xml.
+ * AbstractFileSelectionWizardPage#loadedTheObject(java.lang.String)
+ */
+ @Override
+ protected Object loadedTheObject(String path) throws Exception {
+ return null;
+ }
+
+ @Override
+ protected void changeWizardPageStatus() {
+ if (!useAvaliableReader) {
+ super.changeWizardPageStatus();
+ } else {
+ setErrorMessage(null);
+ setPageComplete(true);
+ }
+ }
+
+ @Override
+ public boolean canFlipToNextPage() {
+ return super.canFlipToNextPage();
+ // String filePath = this.getFilePath();
+ // try {
+ // filePath = SmooksUIUtils.parseFilePath(filePath);
+ // if(filePath == null) return false;
+ // return new File(filePath).exists();
+ // } catch (InvocationTargetException e) {
+ // return false;
+ // }
+ }
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIMappingDataPathWizardPage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIReader12DataPathWizardPage.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIReader12DataPathWizardPage.java 2010-04-30 08:50:50 UTC (rev 21821)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIReader12DataPathWizardPage.java 2010-04-30 08:55:28 UTC (rev 21822)
@@ -1,62 +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.edireader12;
-
-import java.util.List;
-
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.jboss.tools.smooks.configuration.editors.xml.AbstractFileSelectionWizardPage;
-
-/**
- * @author Dart (dpeng(a)redhat.com)
- *
- */
-public class EDIReader12DataPathWizardPage extends AbstractFileSelectionWizardPage {
-
- public EDIReader12DataPathWizardPage(String pageName, boolean multiSelect, Object[] initSelections,
- List<ViewerFilter> filters) {
- super(pageName, multiSelect, initSelections, filters);
- }
-
- public EDIReader12DataPathWizardPage(String pageName, String[] fileExtensionNames) {
- super(pageName, fileExtensionNames);
- this.setTitle(Messages.EDIReader12DataPathWizardPage_Page_Title_EDI_File_Select);
- this.setDescription(Messages.EDIReader12DataPathWizardPage_Page_Description_EDI_File_Select);
- }
-
-
-
- /* (non-Javadoc)
- * @see org.jboss.tools.smooks.configuration.editors.xml.AbstractFileSelectionWizardPage#loadedTheObject(java.lang.String)
- */
- @Override
- protected Object loadedTheObject(String path) throws Exception {
- return null;
- }
-
- @Override
- protected void changeWizardPageStatus() {
- super.changeWizardPageStatus();
- }
-
- @Override
- public boolean canFlipToNextPage() {
- return super.canFlipToNextPage();
-// String filePath = this.getFilePath();
-// try {
-// filePath = SmooksUIUtils.parseFilePath(filePath);
-// if(filePath == null) return false;
-// return new File(filePath).exists();
-// } catch (InvocationTargetException e) {
-// return false;
-// }
- }
-}
Deleted: 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 2010-04-30 08:50:50 UTC (rev 21821)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIReader12DataWizard.java 2010-04-30 08:55:28 UTC (rev 21822)
@@ -1,197 +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.edireader12;
-
-import java.util.Properties;
-
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.ecore.util.FeatureMapUtil;
-import org.eclipse.emf.edit.command.AddCommand;
-import org.eclipse.emf.edit.domain.EditingDomain;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.IWorkbench;
-import org.jboss.tools.smooks.configuration.editors.SmooksMultiFormEditor;
-import org.jboss.tools.smooks.configuration.editors.edi.EDIDataParser;
-import org.jboss.tools.smooks.configuration.editors.wizard.IStructuredDataSelectionWizard;
-import org.jboss.tools.smooks.model.edi12.EDI12Reader;
-import org.jboss.tools.smooks.model.edi12.Edi12Factory;
-import org.jboss.tools.smooks.model.edi12.Edi12Package;
-import org.jboss.tools.smooks.model.smooks.DocumentRoot;
-import org.jboss.tools.smooks.model.smooks.SmooksPackage;
-import org.jboss.tools.smooks.model.smooks.SmooksResourceListType;
-import org.jboss.tools.smooks10.model.smooks.util.SmooksModelUtils;
-
-/**
- * @deprecated
- * @author Dart
- *
- */
-public class EDIReader12DataWizard extends Wizard implements IStructuredDataSelectionWizard, INewWizard {
-
- private EDIReader12MappingDataPathWizardPage mappingFilePage;
-
- private EDIReader12DataPathWizardPage ediFilePage;
-
- private SmooksResourceListType resourceList;
-
- private EditingDomain editingDomain;
-
- @Override
- public void addPages() {
- ediFilePage = new EDIReader12DataPathWizardPage(Messages.EDIReader12DataWizard_Page_Title_EDI_Data_Page, new String[] {});
- this.addPage(ediFilePage);
-
- mappingFilePage = new EDIReader12MappingDataPathWizardPage(Messages.EDIReader12DataWizard_Page_Title_EDI_Config_Page, null);
- this.addPage(mappingFilePage);
- super.addPages();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.wizard.Wizard#performFinish()
- */
- @Override
- public boolean performFinish() {
- if (mappingFilePage.isUseAvaliableReader()) {
- return true;
- }
- if (mappingFilePage.isCreateNewReader()) {
- String encoding = mappingFilePage.getEncoding();
- String path = mappingFilePage.getFilePath();
- String validate = mappingFilePage.getValidate();
- EDI12Reader reader = Edi12Factory.eINSTANCE.createEDI12Reader();
- reader.setEncoding(encoding);
- reader.setMappingModel(path);
- if (validate != null && validate.length() != 0) {
- reader.setValidate(Boolean.valueOf(validate));
- }
- Command command = AddCommand.create(editingDomain, resourceList,
- SmooksPackage.Literals.SMOOKS_RESOURCE_LIST_TYPE__ABSTRACT_READER_GROUP, FeatureMapUtil
- .createEntry(Edi12Package.Literals.EDI12_DOCUMENT_ROOT__READER, reader));
- editingDomain.getCommandStack().execute(command);
- }
- return true;
- }
-
- /*
- * (non-Javadoc)
- *
- * @seeorg.jboss.tools.smooks.configuration.editors.wizard.
- * IStructuredDataSelectionWizard
- * #complate(org.jboss.tools.smooks.configuration
- * .editors.SmooksMultiFormEditor)
- */
- public void complate(SmooksMultiFormEditor formEditor) {
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @seeorg.jboss.tools.smooks.configuration.editors.wizard.
- * IStructuredDataSelectionWizard#getInputDataTypeID()
- */
- public String getInputDataTypeID() {
- return SmooksModelUtils.INPUT_TYPE_EDI_1_2;
- }
-
- /*
- * (non-Javadoc)
- *
- * @seeorg.jboss.tools.smooks.configuration.editors.wizard.
- * IStructuredDataSelectionWizard#getProperties()
- */
- public Properties getProperties() {
- Properties pros = new Properties();
- if (mappingFilePage.isUseAvaliableReader() || mappingFilePage.isCreateNewReader()) {
- pros.put(EDIDataParser.USE_AVAILABEL_READER, "true"); //$NON-NLS-1$
- return pros;
- }
- String encoding = mappingFilePage.getEncoding();
- if (encoding != null && encoding.length() != 0) {
- pros.put(EDIDataParser.ENCODING, encoding);
- }
-
- String path = mappingFilePage.getFilePath();
- if(path != null && path.length() != 0){
- pros.put(EDIDataParser.MAPPING_MODEL, path);
- }
-
- String validate = mappingFilePage.getValidate();
- if(validate != null && validate.length() != 0){
- pros.put(EDIDataParser.VALIDATE, validate);
- }
- return pros;
- }
-
- /*
- * (non-Javadoc)
- *
- * @seeorg.jboss.tools.smooks.configuration.editors.wizard.
- * IStructuredDataSelectionWizard#getReturnData()
- */
- public Object getReturnData() {
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @seeorg.jboss.tools.smooks.configuration.editors.wizard.
- * IStructuredDataSelectionWizard#getStructuredDataSourcePath()
- */
- public String getStructuredDataSourcePath() {
- if (ediFilePage.getFilePath() != null) {
- return ediFilePage.getFilePath();
- }
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @seeorg.jboss.tools.smooks.configuration.editors.wizard.
- * IStructuredDataSelectionWizard#init(org.eclipse.ui.IEditorSite,
- * org.eclipse.ui.IEditorInput)
- */
- public void init(IEditorSite site, IEditorInput input) {
- IEditorPart editorPart = site.getWorkbenchWindow().getActivePage().findEditor(input);
- if (editorPart != null && editorPart instanceof SmooksMultiFormEditor) {
- SmooksMultiFormEditor formEditor = (SmooksMultiFormEditor) editorPart;
- Object smooksModel = formEditor.getSmooksModel();
- if (smooksModel instanceof DocumentRoot) {
- resourceList = ((DocumentRoot) smooksModel).getSmooksResourceList();
- }
- editingDomain = formEditor.getEditingDomain();
- }
- if (this.mappingFilePage != null) {
- mappingFilePage.setSmooksResourceList(resourceList);
- }
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench,
- * org.eclipse.jface.viewers.IStructuredSelection)
- */
- public void init(IWorkbench workbench, IStructuredSelection selection) {
-
- }
-
-}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/Messages.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/Messages.java 2010-04-30 08:50:50 UTC (rev 21821)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/Messages.java 2010-04-30 08:55:28 UTC (rev 21822)
@@ -17,6 +17,21 @@
public static String EDIReader12MappingDataPathWizardPage_Page_Description_EDI_Mapping_File;
public static String EDIReader12MappingDataPathWizardPage_Page_Title_EDI_12_Mapping_File;
public static String EDIReader12MappingDataPathWizardPage_Page_Title_EDI_Mapping_File;
+
+ public static String EDIDataParser_Exception_EDI_Mapping_Cannot_Be_Empty;
+ public static String EDIDataPathWizardPage_Page_Description_EDI_File_Select;
+ public static String EDIDataPathWizardPage_Page_Title_EDI_File_Select;
+ public static String EDIDataWizard_0;
+ public static String EDIDataWizard_2;
+ public static String EDIDataWizard_WizardTitle;
+ public static String EDIMappingDataPathWizardPage_Button_Create_New_Reader;
+ public static String EDIMappingDataPathWizardPage_Button_Create_Readers;
+ public static String EDIMappingDataPathWizardPage_Button_Use_Existing_Reader;
+ public static String EDIMappingDataPathWizardPage_EDI_Wizard_Description;
+ public static String EDIMappingDataPathWizardPage_EDI_Wizard_Title;
+ public static String EDIMappingDataPathWizardPage_Label_Encoding;
+
+
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/messages.properties
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/messages.properties 2010-04-30 08:50:50 UTC (rev 21821)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/messages.properties 2010-04-30 08:55:28 UTC (rev 21822)
@@ -11,3 +11,17 @@
EDIReader12MappingDataPathWizardPage_Page_Description_EDI_Mapping_File=Select a EDI mapping config file
EDIReader12MappingDataPathWizardPage_Page_Title_EDI_12_Mapping_File=EDI Mapping file configuration (version 1.2)
EDIReader12MappingDataPathWizardPage_Page_Title_EDI_Mapping_File=EDI Mapping file configuration (version 1.2)
+
+
+EDIDataParser_Exception_EDI_Mapping_Cannot_Be_Empty=EDI Mapping file can't be empty
+EDIDataPathWizardPage_Page_Description_EDI_File_Select=Select a EDI data file
+EDIDataPathWizardPage_Page_Title_EDI_File_Select=EDI file selection
+EDIDataWizard_0=EDI Data Page
+EDIDataWizard_2=edi
+EDIDataWizard_WizardTitle=EDI File Selection
+EDIMappingDataPathWizardPage_Button_Create_New_Reader=Create New EDI Reader
+EDIMappingDataPathWizardPage_Button_Create_Readers=Create new EDI reader configurations
+EDIMappingDataPathWizardPage_Button_Use_Existing_Reader=Use available EDI reader configurations
+EDIMappingDataPathWizardPage_EDI_Wizard_Description=Select a EDI mapping config file
+EDIMappingDataPathWizardPage_EDI_Wizard_Title=EDI Mapping file configuration
+EDIMappingDataPathWizardPage_Label_Encoding=Encoding:
Copied: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/IJavaBeanSelectionListener.java (from rev 21295, trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/IJavaBeanSelectionListener.java)
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/IJavaBeanSelectionListener.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/IJavaBeanSelectionListener.java 2010-04-30 08:55:28 UTC (rev 21822)
@@ -0,0 +1,12 @@
+/**
+ *
+ */
+package org.jboss.tools.smooks.configuration.editors.javabean12;
+
+/**
+ * @author Dart
+ *
+ */
+public interface IJavaBeanSelectionListener {
+ public void exceptionOccur(Exception e);
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/IJavaBeanSelectionListener.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaBean12PropertyUICreator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaBean12PropertyUICreator.java 2010-04-30 08:50:50 UTC (rev 21821)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaBean12PropertyUICreator.java 2010-04-30 08:55:28 UTC (rev 21822)
@@ -37,9 +37,6 @@
import org.eclipse.ui.forms.widgets.Hyperlink;
import org.jboss.tools.smooks.configuration.editors.AttributeFieldEditPart;
import org.jboss.tools.smooks.configuration.editors.PropertyUICreator;
-import org.jboss.tools.smooks.configuration.editors.javabean.JavaBeanModel;
-import org.jboss.tools.smooks.configuration.editors.javabean.JavaBeanModelFactory;
-import org.jboss.tools.smooks.configuration.editors.javabean.ValueWiringBindingSelectionDialog;
import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
import org.jboss.tools.smooks.editor.ISmooksModelProvider;
import org.jboss.tools.smooks.model.javabean12.BeanType;
Copied: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaBeanConfigWizardPage.java (from rev 21295, trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/JavaBeanConfigWizardPage.java)
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaBeanConfigWizardPage.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaBeanConfigWizardPage.java 2010-04-30 08:55:28 UTC (rev 21822)
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.javabean12;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * @author Dart Peng
+ * @deprecated
+ * @CreateTime Jul 21, 2008
+ */
+public class JavaBeanConfigWizardPage extends WizardPage implements
+ SelectionListener ,IJavaBeanSelectionListener {
+
+ TreeViewer treeViewer;
+
+ Text classText = null;
+
+ Button classBrowseButton = null;
+
+ IJavaProject project = null;
+
+ private JavaBeanModelLoadComposite javaPropertySelectComposite;
+
+
+ public List<JavaBeanModel> getJavaBeanModelList() {
+ if(javaPropertySelectComposite == null) return Collections.emptyList();
+ return javaPropertySelectComposite.getJavabeanList();
+ }
+
+ public JavaBeanConfigWizardPage(IJavaProject selection) {
+ super("beansearchwizardpage"); //$NON-NLS-1$
+ this.project = selection;
+ setPageComplete(true);
+ setTitle("Select Javabean"); //$NON-NLS-1$
+ setDescription("Select Javabean model"); //$NON-NLS-1$
+ }
+
+ protected void initilize() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.ecSclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt
+ * .widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+ initilize();
+ try {
+ javaPropertySelectComposite = new JavaBeanModelLoadComposite(
+ parent, SWT.NONE, getContainer(), project);
+ javaPropertySelectComposite.addJavaBeanSelectionListener(this);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ this.setControl(javaPropertySelectComposite);
+ this.updatePage();
+ }
+
+ protected void updatePage() {
+ String error = null;
+ if (project == null) {
+ error = "Must select java project"; //$NON-NLS-1$
+ }
+ setPageComplete(error == null);
+ this.setErrorMessage(error);
+ }
+
+// public JavaBeanConfigWizardPage(String pageName, String title,
+// ImageDescriptor titleImage) {
+// super(pageName, title, titleImage);
+// }
+
+ public JavaBeanConfigWizardPage(String pageName) {
+ super(pageName);
+ }
+
+ public void widgetDefaultSelected(SelectionEvent arg0) {
+ widgetSelected(arg0);
+ }
+
+ public void widgetSelected(SelectionEvent arg0) {
+
+ }
+
+ public void exceptionOccur(Exception e) {
+ String error = null;
+ if(e != null) error = e.toString();
+ this.setErrorMessage(error);
+ }
+
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaBeanConfigWizardPage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaBeanList.java (from rev 21295, trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/JavaBeanList.java)
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaBeanList.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaBeanList.java 2010-04-30 08:55:28 UTC (rev 21822)
@@ -0,0 +1,117 @@
+/**
+ *
+ */
+package org.jboss.tools.smooks.configuration.editors.javabean12;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.jboss.tools.smooks.configuration.editors.IXMLStructuredObject;
+
+
+/**
+ * @author Dart
+ *
+ */
+public class JavaBeanList extends JavaBeanModel implements IXMLStructuredObject{
+
+
+ private List<IXMLStructuredObject> children = null;
+
+ public List<IXMLStructuredObject> getChildren() {
+ if(children == null){
+ children = new ArrayList<IXMLStructuredObject>();
+ }
+ return children;
+ }
+
+ public JavaBeanList(){
+ super(null);
+ }
+
+ @Override
+ public boolean isPrimitive() {
+ return false;
+ }
+
+ public String getJavaBeanName(JavaBeanModel javaBean){
+ List<?> children = getChildren();
+ int sameNameBean = 0;
+ for (Iterator<?> iterator = children.iterator(); iterator.hasNext();) {
+ JavaBeanModel child = (JavaBeanModel) iterator.next();
+ if(child.getBeanClass().getName().equals(javaBean.getBeanClass().getName())){
+ sameNameBean++;
+ }
+ }
+ if(sameNameBean > 0){
+ String name = javaBean.getName() + String.valueOf(sameNameBean);
+ while(hasSameNameBean(name,javaBean.getBeanClass())){
+ sameNameBean++;
+ name = javaBean.getName() + String.valueOf(sameNameBean);
+ }
+ return name;
+ }
+ return javaBean.getName();
+ }
+
+ private boolean hasSameNameBean(String name , Class<?> clazz){
+ for (Iterator<?> iterator = children.iterator(); iterator.hasNext();) {
+ JavaBeanModel child = (JavaBeanModel) iterator.next();
+ if(child.getBeanClass().getName().equals(clazz.getName())){
+ if(name.equals(child.getName())){
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+
+ public void addJavaBean(JavaBeanModel javaBean){
+ if(javaBean == null) return;
+ String name = javaBean.getName();
+ String n1 = getJavaBeanName(javaBean);
+ if(!name.equals(n1)){
+ javaBean.setName(n1);
+ }
+ javaBean.setParent(this);
+ this.getChildren().add(javaBean);
+ }
+
+ public void removeJavaBean(JavaBeanModel javaBean){
+ this.getChildren().remove(javaBean);
+ javaBean.setParent(null);
+ }
+
+ @Override
+ public List<?> getProperties() {
+ return Collections.EMPTY_LIST;
+ }
+
+ public Object getID() {
+ return this;
+ }
+
+ public String getNodeName() {
+ return null;
+ }
+
+ public JavaBeanModel getParent() {
+ return null;
+ }
+
+ public boolean isAttribute() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean isRootNode() {
+ return true;
+ }
+
+
+
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaBeanList.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaBeanModel.java (from rev 21295, trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/JavaBeanModel.java)
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaBeanModel.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaBeanModel.java 2010-04-30 08:55:28 UTC (rev 21822)
@@ -0,0 +1,608 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.javabean12;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.Method;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.lang.reflect.WildcardType;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import org.jboss.tools.smooks.configuration.editors.IXMLStructuredObject;
+import org.jboss.tools.smooks.configuration.editors.uitls.JavaPropertyUtils;
+
+/**
+ * @author Dart Peng
+ *
+ */
+public class JavaBeanModel implements IXMLStructuredObject, Cloneable {
+
+ private boolean flat = false;
+
+ private boolean expaned = false;
+
+ private Properties extendProperties = new Properties();
+
+ protected PropertyChangeSupport support = new PropertyChangeSupport(this);
+
+ private String beanClassString = null;
+
+ public void setBeanClassString(String beanClassString) {
+ this.beanClassString = beanClassString;
+ }
+
+ private Object waring = null;
+
+ private Object error = null;
+
+ private String name = ""; //$NON-NLS-1$
+
+ private Class typeRef = null;
+
+ private boolean many = false;
+
+ private boolean collection = false;
+
+ private boolean isPrimitive = false;
+
+ private boolean hasGenericType = false;
+
+ private Class<? extends Object> beanClass = null;
+
+ private JavaBeanModel parent = null;
+
+ public Class getBeanClass() {
+ return beanClass;
+ }
+
+ private Class parentClass = null;
+
+ // private boolean isRoot = false;
+
+ private boolean isRootClassModel = false;
+
+ /**
+ * @return the isRootClassModel
+ */
+ public boolean isRootClassModel() {
+ return isRootClassModel || getParent() == null;
+ }
+
+ public boolean isFlat() {
+ return flat;
+ }
+
+ public void setFlat(boolean flat) {
+ this.flat = flat;
+ }
+
+ /**
+ * @param isRootClassModel
+ * the isRootClassModel to set
+ */
+ public void setRootClassModel(boolean isRootClassModel) {
+ this.isRootClassModel = isRootClassModel;
+ }
+
+ public void addNodePropetyChangeListener(PropertyChangeListener listener) {
+ PropertyChangeListener[] array = support.getPropertyChangeListeners();
+ for (int i = 0; i < array.length; i++) {
+ if (listener == array[i])
+ return;
+ }
+ support.addPropertyChangeListener(listener);
+ }
+
+ public void removeNodePropetyChangeListener(PropertyChangeListener listener) {
+ support.removePropertyChangeListener(listener);
+ }
+
+ public void cleanAllNodePropertyChangeListeners() {
+ PropertyChangeListener[] ps = support.getPropertyChangeListeners();
+ for (int i = 0; i < ps.length; i++) {
+ PropertyChangeListener p = ps[i];
+ support.removePropertyChangeListener(p);
+ }
+ }
+
+ // /**
+ // * @return the isRoot
+ // */
+ // public boolean isRoot() {
+ // return isRoot;
+ // }
+
+ public String getBeanClassString() {
+ if (beanClassString != null && beanClassString.length() != 0) {
+ return this.beanClassString;
+ }
+ Class clazz = this.getBeanClass();
+ if (clazz == null)
+ return "<null>"; //$NON-NLS-1$
+
+ if (clazz.isArray()) {
+ String s = clazz.getComponentType().getName();
+ return s + "[]"; //$NON-NLS-1$
+ }
+// if(this.isList()){
+// String cs = "<"+System.currentTimeMillis()+">";
+// Class componentClazz = this.getComponentClass();
+// if(componentClazz != null){
+// cs = "<" + componentClazz.getName() +">";
+// }
+// return clazz.getName() + cs;
+// }
+
+ return clazz.getName();
+ }
+
+ public String getBeanClassStringWithList() {
+ String s = getBeanClassString();
+ if (this.isList()) {
+ Class genericType = getGenericType();
+ if (genericType != null)
+ s += "<" + genericType.getName() + ">"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ return s;
+ }
+
+ /**
+ * @param isRoot
+ * the isRoot to set
+ */
+ // public void setRoot(boolean isRoot) {ois
+ private boolean isList = false;
+
+ private Class componentClass = null;
+
+ private boolean lazyLoadProperties = true;
+
+ public boolean isList() {
+ if (beanClass == null)
+ return false;
+ if (Collection.class.isAssignableFrom(beanClass)) {
+ if (this.propertyDescriptor != null) {
+ Method rmethod = propertyDescriptor.getReadMethod();
+ if (rmethod != null) {
+ Type returnType = rmethod.getGenericReturnType();
+ if (returnType instanceof ParameterizedType) {
+ Type gtype = ((ParameterizedType) returnType).getActualTypeArguments()[0];
+ if(gtype instanceof Class){
+ Class beanType = (Class) gtype;
+ componentClass = beanType;
+ setGenericType(true);
+ }
+ if(gtype instanceof WildcardType){
+ Type[] upperBounds = ((WildcardType)gtype).getUpperBounds();
+ Type[] lowerBounds = ((WildcardType)gtype).getLowerBounds();
+ if(upperBounds.length != 0){
+ componentClass = (Class<?>) upperBounds[0];
+ setGenericType(true);
+ }
+ if(lowerBounds.length != 0){
+ componentClass = (Class<?>) lowerBounds[0];
+ setGenericType(true);
+ }
+ }
+ }
+ }
+ }
+ setList(true);
+ }
+ return isList;
+ }
+
+ public void setList(boolean isList) {
+ this.isList = isList;
+ }
+
+ private PropertyDescriptor propertyDescriptor;
+
+ public PropertyDescriptor getPropertyDescriptor() {
+ return propertyDescriptor;
+ }
+
+ public void setPropertyDescriptor(PropertyDescriptor propertyDescriptor) {
+ this.propertyDescriptor = propertyDescriptor;
+ }
+
+ JavaBeanModel(Class beanClass, String beanName, PropertyDescriptor propertyDescriptor, Class parentClass,
+ boolean lazyLoadProperties) {
+ this.lazyLoadProperties = lazyLoadProperties;
+ this.beanClass = toConcreteImpl(beanClass);
+ this.name = beanName;
+ if (beanClass == null)
+ return;
+ if (this.name == null) {
+ this.name = beanClass.getSimpleName();
+ }
+ if (propertyDescriptor == null)
+ setRootClassModel(true);
+ this.propertyDescriptor = propertyDescriptor;
+ Class beanType = beanClass;
+ if (beanClass.isArray()) {
+ beanType = beanClass.getComponentType();
+ setMany(true);
+ componentClass = beanType;
+ }
+
+ if (Collection.class.isAssignableFrom(beanClass)) {
+ if (this.propertyDescriptor != null) {
+ Method rmethod = propertyDescriptor.getReadMethod();
+ if (rmethod != null) {
+ Type returnType = rmethod.getGenericReturnType();
+ if (returnType instanceof ParameterizedType) {
+ Type gtype = ((ParameterizedType) returnType).getActualTypeArguments()[0];
+ if (gtype instanceof Class) {
+ beanType = (Class) gtype;
+ componentClass = beanType;
+ }
+ }
+ }
+ }
+ setList(true);
+ }
+
+ if (beanType.isPrimitive() || JavaBeanModelFactory.isPrimitiveObject(beanType)) {
+ this.parentClass = parentClass;
+ if (!isArray() && !isList())
+ setPrimitive(true);
+ return;
+ }
+ this.parentClass = parentClass;
+
+ if (!lazyLoadProperties)
+ this.getProperties();
+ }
+
+ JavaBeanModel(Class beanClass, String beanName, PropertyDescriptor propertyDescriptor) {
+ this(beanClass, beanName, propertyDescriptor, null, true);
+ }
+
+ public JavaBeanModel(Class beanClass) {
+ this(beanClass, null, null, null, true);
+ }
+
+ public JavaBeanModel(Class beanClass, String name) {
+ this(beanClass, name, null, null, true);
+ }
+
+ JavaBeanModel(Class<?> beanClass, boolean lazyLoadProperties) {
+ this(beanClass, null, null, null, lazyLoadProperties);
+ }
+
+ private Class<? extends Object> toConcreteImpl(Class declaredType) {
+
+ // Intentionally not doing an isAssignableFrom test... want to know is it the
+ // the exact class...
+ if(declaredType == List.class) {
+ return ArrayList.class;
+ } else if(declaredType == Set.class) {
+ return LinkedHashSet.class;
+ } else if(declaredType == Collection.class) {
+ return ArrayList.class;
+ } else if(declaredType == Map.class) {
+ return LinkedHashMap.class;
+ }
+
+ return declaredType;
+ }
+
+ public boolean isPrimitive() {
+ Class<?> beanType = getBeanClass();
+ if (beanType == null)
+ return false;
+ if (beanType.isPrimitive() || JavaBeanModelFactory.isPrimitiveObject(beanType)) {
+ if (!isArray() && !isList())
+ setPrimitive(true);
+ }
+ return isPrimitive;
+ }
+
+ public void setPrimitive(boolean isPrimitive) {
+ this.isPrimitive = isPrimitive;
+ }
+
+ public boolean isArray() {
+ if (beanClass == null)
+ return false;
+ if (beanClass.isArray()) {
+ Class beanType = beanClass.getComponentType();
+ setMany(true);
+ componentClass = beanType;
+ setGenericType(true);
+ }
+ return many;
+ }
+
+ public Class getGenericType() {
+ return componentClass;
+ }
+
+ public void setMany(boolean many) {
+ this.many = many;
+ }
+
+ // public boolean isCollection() {
+ // return collection;
+ // }
+ //
+ // public void setCollection(boolean collection) {
+ // this.collection = collection;
+ // }
+
+ // public Class getTypeRef() {
+ // return typeRef;
+ // }
+ //
+ // public void setTypeRef(Class typeRef) {
+ // this.typeRef = typeRef;
+ // }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void addProperty(JavaBeanModel property) {
+ if (properties != null) {
+ properties.add(property);
+ property.setParent(this);
+ }
+ }
+
+ protected void createArrayChildren(Class<Object> clazz, String name, PropertyDescriptor pd,
+ Class<? extends Object> parentClass, boolean lazyLoad) {
+ JavaBeanModel proxyModel = newChildJavaBean(clazz, name, pd, parentClass, lazyLoad);
+ addProperty(proxyModel);
+ }
+
+ protected void createListChildren(Class<Object> clazz, String name, PropertyDescriptor pd,
+ Class<? extends Object> parentClass, boolean lazyLoad) {
+ JavaBeanModel proxyModel = newChildJavaBean(clazz, name, pd, parentClass, lazyLoad);
+ addProperty(proxyModel);
+ }
+
+ private List properties;
+
+
+ /**
+ * @return the expaned
+ */
+ public boolean isExpaned() {
+ return expaned;
+ }
+
+ public List getProperties() {
+ expaned = true;
+ JavaBeanModel parent = this.getParent();
+ if (parent != null) {
+ if (parent.isFlat())
+ return Collections.emptyList();
+ }
+ if (properties == null) {
+ properties = new ArrayList();
+ if (isPrimitive())
+ return properties;
+
+ Class beanType = beanClass;
+ if (isArray() || isList()) {
+ if (componentClass != null) {
+ createArrayChildren(componentClass, componentClass.getSimpleName(), null, beanClass,
+ this.lazyLoadProperties);
+ beanType = componentClass;
+ } else {
+ createListChildren(Object.class, "object", null, beanClass, this.lazyLoadProperties); //$NON-NLS-1$
+ beanType = componentClass;
+ }
+ return properties;
+ }
+ if (beanType == null)
+ return Collections.EMPTY_LIST;
+ PropertyDescriptor[] pds = JavaPropertyUtils.getPropertyDescriptor(beanType);
+ for (int i = 0; i < pds.length; i++) {
+ PropertyDescriptor pd = pds[i];
+ if ("class".equals(pd.getName())) //$NON-NLS-1$
+ continue;
+ if (pd.getPropertyType() == null)
+ continue;
+ if (Collection.class.isAssignableFrom(pd.getPropertyType())) {
+ Method rmethod = pd.getReadMethod();
+ if (rmethod != null) {
+ Type returnType = rmethod.getGenericReturnType();
+ if (returnType instanceof ParameterizedType) {
+ Type[] types = ((ParameterizedType) returnType).getActualTypeArguments();
+ if (types == null || types.length == 0) {
+ continue;
+ }
+ } else {
+ continue;
+ }
+ }
+ }
+ JavaBeanModel jbm = newChildJavaBean(pd.getPropertyType(), pd.getName(), pd, beanClass,
+ this.lazyLoadProperties);
+ addProperty(jbm);
+ }
+ }
+ return properties;
+ }
+
+ protected JavaBeanModel newChildJavaBean(Class clazz, String name, PropertyDescriptor pd,
+ Class parentClass, boolean lazyLoading) {
+ return new JavaBeanModel(clazz, name, pd, parentClass, lazyLoading);
+ }
+
+ public void setProperties(List properties) {
+ this.properties = properties;
+ }
+
+ public boolean propertiesHasBeenLoaded() {
+ return properties != null;
+ }
+
+ /**
+ * @return the parent
+ */
+ public JavaBeanModel getParent() {
+ return parent;
+ }
+
+ /**
+ * @param parent
+ * the parent to set
+ */
+ public void setParent(JavaBeanModel parent) {
+ this.parent = parent;
+ }
+
+ public Object getWarning() {
+ return waring;
+ }
+
+ public void setWarning(Object waring) {
+ this.waring = waring;
+ }
+
+ public Object getError() {
+ return error;
+ }
+
+ public void setError(Object error) {
+ this.error = error;
+ }
+
+ public JavaBeanModel getRootParent() {
+ JavaBeanModel parent = this.getParent();
+ if (parent == null)
+ return this;
+ JavaBeanModel temp = parent;
+ while (temp != null) {
+ parent = temp;
+ temp = temp.getParent();
+ }
+ return parent;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ StringBuffer buffer = new StringBuffer("JavaName : " + name); //$NON-NLS-1$
+ if (beanClass != null)
+ buffer.append("BeanClass : " + this.beanClass.getName()); //$NON-NLS-1$
+ if (this.properties != null) {
+ buffer.append("\n"); //$NON-NLS-1$
+ for (Iterator<?> iterator = properties.iterator(); iterator.hasNext();) {
+ JavaBeanModel child = (JavaBeanModel) iterator.next();
+ buffer.append("\t"); //$NON-NLS-1$
+ buffer.append(child.toString());
+ buffer.append("\n"); //$NON-NLS-1$
+ }
+ }
+ return buffer.toString();
+ }
+
+ public String getSelectorString() {
+ if (parent == null) {
+ return getBeanClassString();
+ }
+ if (parent.getClass() == JavaBeanList.class) {
+ return getBeanClassString();
+ }
+
+ if (parent.isArray() || parent.isList()) {
+ return getBeanClassString();
+ }
+ return getName();
+
+ }
+
+ public boolean hasGenericType() {
+ return hasGenericType;
+ }
+
+ public void setGenericType(boolean hasGenericType) {
+ this.hasGenericType = hasGenericType;
+ }
+
+ public boolean isAttribute() {
+ return false;
+ }
+
+ public List<IXMLStructuredObject> getChildren() {
+ List ps = getProperties();
+ if (ps != null) {
+ return ps;
+ }
+ return null;
+ }
+
+ public Object getID() {
+ Class<?> clazz = getBeanClass();
+ if(Collection.class.isAssignableFrom(clazz)){
+ return getBeanClassString() + getName();
+ }
+ return getBeanClass();
+ }
+
+ public String getNodeName() {
+ return getSelectorString();
+ }
+
+ public boolean isRootNode() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public void setComponentClass(Class clazz) {
+ componentClass = clazz;
+ }
+
+ public Class getComponentClass() {
+ return componentClass;
+ }
+
+ public void addExtendProperty(String name, String value) {
+ extendProperties.setProperty(name, value);
+ }
+
+ public String getExtendProperty(String name) {
+ return extendProperties.getProperty(name);
+ }
+
+ public Object clone() {
+ if (isList()) {
+ JavaBeanModel model = JavaBeanModelFactory.getJavaBeanModelWithLazyLoad(ArrayList.class);
+ model.setComponentClass(componentClass);
+ return model;
+ }
+ return JavaBeanModelFactory.getJavaBeanModelWithLazyLoad(this.getBeanClass());
+ }
+
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaBeanModel.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaBeanModelFactory.java (from rev 21295, trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/JavaBeanModelFactory.java)
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaBeanModelFactory.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaBeanModelFactory.java 2010-04-30 08:55:28 UTC (rev 21822)
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.javabean12;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Dart Peng
+ *
+ */
+public class JavaBeanModelFactory {
+
+ private static final List<Object> PRIMITIVE_CLASSES = new ArrayList<Object>();
+ static {
+ PRIMITIVE_CLASSES.add(Integer.class);
+ PRIMITIVE_CLASSES.add(Double.class);
+ PRIMITIVE_CLASSES.add(Float.class);
+ PRIMITIVE_CLASSES.add(String.class);
+ PRIMITIVE_CLASSES.add(Long.class);
+ PRIMITIVE_CLASSES.add(java.util.Date.class);
+ PRIMITIVE_CLASSES.add(Character.class);
+ PRIMITIVE_CLASSES.add(BigInteger.class);
+ PRIMITIVE_CLASSES.add(BigDecimal.class);
+ PRIMITIVE_CLASSES.add(Boolean.class);
+ PRIMITIVE_CLASSES.add(Byte.class);
+ PRIMITIVE_CLASSES.add(java.util.Calendar.class);
+ }
+
+ /**
+ * @param beanClass
+ * @param modelName
+ * @return
+ */
+ public synchronized static JavaBeanModel getJavaBeanModelWithLazyLoad(Class<?> beanClass) {
+ JavaBeanModel m = new JavaBeanModel(beanClass, true);
+ m.setRootClassModel(true);
+ return m;
+ }
+
+ /**
+ * @deprecated
+ * @param beanClass
+ * @return
+ */
+ public synchronized static JavaBeanModel getJavaBeanModel(Class<?> beanClass) {
+ JavaBeanModel m = new JavaBeanModel(beanClass, false);
+ m.setRootClassModel(true);
+ return m;
+ }
+
+ public static boolean isPrimitiveObject(Class<?> clazz) {
+ if(clazz.isEnum()) return true;
+ return (PRIMITIVE_CLASSES.indexOf(clazz) != -1);
+ }
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaBeanModelFactory.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaBeanModelLoadComposite.java (from rev 21295, trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/JavaBeanModelLoadComposite.java)
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaBeanModelLoadComposite.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaBeanModelLoadComposite.java 2010-04-30 08:55:28 UTC (rev 21822)
@@ -0,0 +1,431 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.javabean12;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.search.IJavaSearchScope;
+import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
+import org.eclipse.jdt.internal.ui.search.JavaSearchScopeFactory;
+import org.eclipse.jdt.ui.IJavaElementSearchConstants;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jface.operation.IRunnableContext;
+import org.eclipse.jface.viewers.ICellModifier;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerCell;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+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.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.dialogs.SelectionDialog;
+import org.jboss.tools.smooks.configuration.SmooksConfigurationActivator;
+import org.jboss.tools.smooks.configuration.editors.GraphicsConstants;
+import org.jboss.tools.smooks.configuration.editors.uitls.ProjectClassLoader;
+
+/**
+ * @author Dart Peng
+ *
+ * @CreateTime Jul 22, 2008
+ */
+public class JavaBeanModelLoadComposite extends Composite implements SelectionListener {
+
+ private List<JavaBeanModel> javabeanList = new ArrayList<JavaBeanModel>();
+ protected Text classText;
+// private Button classBrowseButton;
+ protected String classFullName;
+ protected boolean loadAtomic;
+ protected IJavaProject javaProject;
+ protected IRunnableContext runnableContext;
+ protected JavaBeanModel currentRootJavaBeanModel = null;
+ protected JavaBeanModel returnJavaBeanModel = null;
+
+ private List<IJavaBeanSelectionListener> selectionListenerList = new ArrayList<IJavaBeanSelectionListener>();
+
+ protected ProjectClassLoader loader = null;
+ private TableViewer listViewer;
+
+ public JavaBeanModelLoadComposite(Composite parent, int style, IRunnableContext runnableContext,
+ IJavaProject project, boolean loadJavapropertiesAtomic) throws Exception {
+ super(parent, style);
+ loadAtomic = loadJavapropertiesAtomic;
+ this.runnableContext = runnableContext;
+ if (this.runnableContext == null) {
+ this.runnableContext = SmooksConfigurationActivator.getDefault().getWorkbench()
+ .getActiveWorkbenchWindow();
+ // this.runnableContext = new
+ // ProgressMonitorDialog(parent.getShell());
+ if (this.runnableContext == null)
+ throw new Exception("Init error"); //$NON-NLS-1$
+ }
+
+ if (project != null) {
+ javaProject = project;
+ loader = new ProjectClassLoader(javaProject);
+ }
+
+ createCompositeContent();
+ }
+
+ public JavaBeanModelLoadComposite(Composite parent, int style, IRunnableContext runnableContext,
+ IJavaProject project) throws Exception {
+ this(parent, style, runnableContext, project, true);
+ }
+
+ public List<JavaBeanModel> getJavabeanList() {
+ return javabeanList;
+ }
+
+ public void addJavaBeanSelectionListener(IJavaBeanSelectionListener listener) {
+ this.selectionListenerList.add(listener);
+ }
+
+ public void removeJavaBeanSelectionListener(IJavaBeanSelectionListener listener) {
+ this.selectionListenerList.remove(listener);
+ }
+
+ public void setJavabeanList(List<JavaBeanModel> javabeanList) {
+ this.javabeanList = javabeanList;
+ }
+
+ protected Control createCompositeContent() {
+ Composite parent = this;
+ parent.setLayout(new FillLayout());
+ Composite com = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ com.setLayout(layout);
+
+ Label classLabel = new Label(com, SWT.NULL);
+ classLabel.setText("Class : "); //$NON-NLS-1$
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 2;
+ classLabel.setLayoutData(gd);
+
+ Composite listViewerComposite = new Composite(com, SWT.NONE);
+ GridLayout listLayout = new GridLayout();
+ listLayout.numColumns = 2;
+ listViewerComposite.setLayout(listLayout);
+ gd = new GridData(GridData.FILL_BOTH);
+ gd.horizontalSpan = 2;
+ listViewerComposite.setLayoutData(gd);
+
+ listViewer = new TableViewer(listViewerComposite, SWT.BORDER |SWT.FULL_SELECTION);
+ TableColumn nameColumn = new TableColumn(listViewer.getTable(), SWT.NONE);
+ nameColumn.setText("Class"); //$NON-NLS-1$
+ TableColumn isArrayColumn = new TableColumn(listViewer.getTable(), SWT.NONE);
+ isArrayColumn.setText("Is Array"); //$NON-NLS-1$
+// TableColumn isListColumn = new TableColumn(listViewer.getTable(), SWT.NONE);
+// isListColumn.setText("List");
+
+ nameColumn.setWidth(400);
+ isArrayColumn.setWidth(60);
+// isListColumn.setWidth(60);
+
+ listViewer.getTable().setHeaderVisible(true);
+
+ gd = new GridData(GridData.FILL_BOTH);
+ listViewer.getTable().addMouseListener(new ColumnSelectionListener());
+ listViewer.getControl().setLayoutData(gd);
+ listViewer.setContentProvider(new IStructuredContentProvider() {
+
+ public Object[] getElements(Object inputElement) {
+ if (inputElement instanceof List) {
+ return ((List<?>) inputElement).toArray();
+ }
+ return new Object[] {};
+ }
+
+ public void dispose() {
+
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+
+ }
+
+ });
+ listViewer.setLabelProvider(new BeanViewerLabelProvider());
+ listViewer.setInput(javabeanList);
+
+ Composite buttonArea = new Composite(listViewerComposite, SWT.NONE);
+ gd = new GridData(GridData.FILL_VERTICAL);
+ buttonArea.setLayoutData(gd);
+
+ GridLayout buttonAreaLayout = new GridLayout();
+ buttonArea.setLayout(buttonAreaLayout);
+
+ Button addButton = new Button(buttonArea, SWT.NONE);
+ addButton.setText("Add"); //$NON-NLS-1$
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ addButton.setLayoutData(gd);
+ addButton.addSelectionListener(this);
+
+ Button removeButton = new Button(buttonArea, SWT.NONE);
+ removeButton.setText("Remove"); //$NON-NLS-1$
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ removeButton.setLayoutData(gd);
+ removeButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ IStructuredSelection selection = (IStructuredSelection) listViewer.getSelection();
+ if (selection.isEmpty())
+ return;
+ javabeanList.removeAll(selection.toList());
+ listViewer.refresh();
+ }
+
+ });
+ return com;
+ }
+
+ public ProjectClassLoader getProjectClassLoader() {
+ if (loader == null) {
+ try {
+ loader = new ProjectClassLoader(javaProject);
+ } catch (Exception e) {
+ }
+ }
+ return loader;
+ }
+
+ public void widgetDefaultSelected(SelectionEvent arg0) {
+ this.widgetSelected(arg0);
+
+ }
+
+ public void widgetSelected(SelectionEvent arg0) {
+
+ IJavaSearchScope scope = null;
+ if (javaProject == null) {
+ scope = JavaSearchScopeFactory.getInstance().createWorkspaceScope(true);
+ } else {
+ String[] requiredProjects = null;
+ try {
+ requiredProjects = javaProject.getRequiredProjectNames();
+ } catch (Exception e) {
+ }
+ if (requiredProjects == null) {
+ requiredProjects = new String[] { javaProject.getElementName() };
+ } else {
+ String[] temp = new String[requiredProjects.length + 1];
+ temp[0] = javaProject.getElementName();
+ System.arraycopy(requiredProjects, 0, temp, 1, requiredProjects.length);
+ requiredProjects = temp;
+ }
+ scope = JavaSearchScopeFactory.getInstance().createJavaProjectSearchScope(requiredProjects, true);
+ }
+ SelectionDialog dialog;
+ Throwable exception = null;
+ try {
+ dialog = JavaUI.createTypeDialog(this.getShell(), runnableContext, scope,
+ IJavaElementSearchConstants.CONSIDER_CLASSES_AND_INTERFACES, false);
+ dialog.setMessage("Search Java Class"); //$NON-NLS-1$
+ dialog.setTitle("Search"); //$NON-NLS-1$
+
+ if (dialog.open() == Window.OK) {
+ Object[] results = dialog.getResult();
+ if (results.length > 0) {
+ Object result = results[0];
+ String packageFullName = JavaModelUtil.getTypeContainerName((IType) result);
+ String className = null;
+ if (packageFullName == null || packageFullName.length() <= 0) {
+ className = ((IType) result).getElementName();
+ } else {
+ className = packageFullName + "." //$NON-NLS-1$
+ + ((IType) result).getElementName();
+ }
+ if (className != null) {
+ ClassLoader l = this.getProjectClassLoader();
+ if (l != null) {
+ Class clazz = l.loadClass(className);
+ if (clazz != null) {
+ JavaBeanModel model = JavaBeanModelFactory
+ .getJavaBeanModelWithLazyLoad(clazz);
+ javabeanList.add(model);
+ listViewer.refresh();
+ }
+ }
+
+ }
+ }
+ }
+ } catch (Throwable e) {
+ exception = e;
+ }
+
+ for (Iterator<IJavaBeanSelectionListener> iterator = this.selectionListenerList.iterator(); iterator
+ .hasNext();) {
+ IJavaBeanSelectionListener l = (IJavaBeanSelectionListener) iterator.next();
+ if (exception != null) {
+ l.exceptionOccur(new Exception(exception));
+ } else {
+ l.exceptionOccur(null);
+ }
+ }
+
+ }
+
+ private class BeanViewerCellModifyer implements ICellModifier {
+
+ public boolean canModify(Object element, String property) {
+ if (property.equals("name")) //$NON-NLS-1$
+ return false;
+ return true;
+ }
+
+ public Object getValue(Object element, String property) {
+ if (element instanceof JavaBeanModel) {
+ if (property.equals("array")) { //$NON-NLS-1$
+ return ((JavaBeanModel) element).isArray();
+ }
+ if (property.equals("list")) { //$NON-NLS-1$
+ return ((JavaBeanModel) element).isList();
+ }
+ }
+ return Boolean.TRUE;
+ }
+
+ public void modify(Object element, String property, Object value) {
+
+ }
+
+ }
+
+ private class BeanViewerLabelProvider extends LabelProvider implements ITableLabelProvider {
+
+ public Image getColumnImage(Object element, int columnIndex) {
+
+ if (element instanceof JavaBeanModel) {
+ boolean isArray = "array".equals(((JavaBeanModel) element).getExtendProperty("many")); //$NON-NLS-1$ //$NON-NLS-2$
+ boolean isList = "list".equals(((JavaBeanModel) element).getExtendProperty("many")); //$NON-NLS-1$ //$NON-NLS-2$
+ switch (columnIndex) {
+ case 0:
+ if (isArray) {
+ return SmooksConfigurationActivator.getDefault().getImageRegistry().get(
+ GraphicsConstants.IMAGE_JAVA_ARRAY);
+ }
+ if (isList) {
+ return SmooksConfigurationActivator.getDefault().getImageRegistry().get(
+ GraphicsConstants.IMAGE_JAVA_COLLECTION);
+ }
+ return SmooksConfigurationActivator.getDefault().getImageRegistry().get(
+ GraphicsConstants.IMAGE_JAVA_OBJECT);
+ case 1:
+ if (isArray) {
+ return SmooksConfigurationActivator.getDefault().getImageRegistry().get(
+ GraphicsConstants.IMAGE_CHECKBOX_CHECK);
+ } else {
+ return SmooksConfigurationActivator.getDefault().getImageRegistry().get(
+ GraphicsConstants.IMAGE_CHECKBOX_UNCHECK);
+ }
+ case 2:
+ if (isList) {
+ return SmooksConfigurationActivator.getDefault().getImageRegistry().get(
+ GraphicsConstants.IMAGE_CHECKBOX_CHECK);
+ } else {
+ return SmooksConfigurationActivator.getDefault().getImageRegistry().get(
+ GraphicsConstants.IMAGE_CHECKBOX_UNCHECK);
+ }
+ }
+ }
+ return null;
+ }
+
+ public String getColumnText(Object element, int columnIndex) {
+ if (element instanceof JavaBeanModel) {
+ switch (columnIndex) {
+ case 0:
+ return ((JavaBeanModel) element).getBeanClassString();
+ case 1:
+ return null;
+ case 2:
+ return null;
+ }
+ }
+ return null;
+ }
+
+ }
+
+ public class ColumnSelectionListener implements MouseListener {
+
+ public void widgetSelected(SelectionEvent e) {
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+
+ }
+
+ public void mouseDoubleClick(MouseEvent e) {
+
+ }
+
+ public void mouseDown(MouseEvent e) {
+ if (!(e.button == 1))
+ return;
+ ViewerCell cell = listViewer.getCell(new Point(e.x, e.y));
+ if (cell != null) {
+ Object element = cell.getElement();
+ if (element instanceof JavaBeanModel) {
+ if (cell.getColumnIndex() == 1) {
+ String many = ((JavaBeanModel) element).getExtendProperty("many"); //$NON-NLS-1$
+ if ("array".equals(many)) { //$NON-NLS-1$
+ ((JavaBeanModel) element).addExtendProperty("many", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ } else {
+ ((JavaBeanModel) element).addExtendProperty("many", "array"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ if (cell.getColumnIndex() == 2) {
+ String many = ((JavaBeanModel) element).getExtendProperty("many"); //$NON-NLS-1$
+ if ("list".equals(many)) { //$NON-NLS-1$
+ ((JavaBeanModel) element).addExtendProperty("many", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ } else {
+ ((JavaBeanModel) element).addExtendProperty("many", "list"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ try {
+ listViewer.refresh(element);
+ } catch (Exception e1) {
+ }
+ }
+ }
+ }
+
+ public void mouseUp(MouseEvent e) {
+
+ }
+ }
+
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaBeanModelLoadComposite.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaBeanSelectionWizardPage.java (from rev 21295, trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/JavaBeanSelectionWizardPage.java)
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaBeanSelectionWizardPage.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaBeanSelectionWizardPage.java 2010-04-30 08:55:28 UTC (rev 21822)
@@ -0,0 +1,428 @@
+/*******************************************************************************
+ * 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.javabean12;
+
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jface.resource.ImageDescriptor;
+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.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.Label;
+import org.eclipse.swt.widgets.Text;
+import org.jboss.tools.smooks.configuration.editors.javabean12.Messages;
+import org.jboss.tools.smooks.configuration.editors.uitls.JavaTypeFieldDialog;
+import org.jboss.tools.smooks.configuration.editors.uitls.ProjectClassLoader;
+
+/**
+ * @author Dart
+ *
+ */
+public class JavaBeanSelectionWizardPage extends WizardPage {
+
+ private String beanID = null;
+
+ private String beanClass = null;
+
+ private IJavaProject project;
+
+ private String collectionClass = null;
+
+ private boolean isArray = false;
+
+ private boolean isCollection = false;
+
+ private JavaBeanModel javaBeanModel = null;
+
+ private Button arrayButton;
+
+ private Button collectionClassBrowseButton;
+
+ private Text colllectionClassText;
+
+ public JavaBeanSelectionWizardPage(String pageName, String title, ImageDescriptor titleImage, IJavaProject project) {
+ super(pageName, title, titleImage);
+ this.project = project;
+ this.setTitle(Messages.JavaBeanSelectionWizardPage_WizardTitle);
+ this.setDescription(Messages.JavaBeanSelectionWizardPage_WizardDes);
+ }
+
+ public JavaBeanSelectionWizardPage(String pageName, IJavaProject project) {
+ super(pageName);
+ this.project = project;
+ this.setTitle(Messages.JavaBeanSelectionWizardPage_WizardTitle);
+ this.setDescription(Messages.JavaBeanSelectionWizardPage_WizardDes);
+ }
+
+ public List<JavaBeanModel> getJavaBeanModelList() {
+ if (getJavaBeanModel() != null) {
+ List<JavaBeanModel> list = new ArrayList<JavaBeanModel>();
+ list.add(javaBeanModel);
+ return list;
+ }
+ return Collections.emptyList();
+ }
+
+ /**
+ * @return the javaBeanModel
+ */
+ public JavaBeanModel getJavaBeanModel() {
+ return javaBeanModel;
+ }
+
+ /*
+ * (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);
+ GridData gd = new GridData(GridData.FILL_BOTH);
+
+ GridLayout gl = new GridLayout();
+ gl.numColumns = 2;
+ mainComposite.setLayout(gl);
+ mainComposite.setLayoutData(gd);
+
+ // createBeanIDControls(mainComposite);
+
+ createBeanClassControls(mainComposite);
+
+ createBeanTypeControls(mainComposite);
+
+ Label seperator = new Label(mainComposite, SWT.HORIZONTAL | SWT.SEPARATOR);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 2;
+ gd.heightHint = 18;
+ seperator.setLayoutData(gd);
+
+ setControl(mainComposite);
+
+ this.setPageComplete(false);
+
+ }
+
+ private void createBeanTypeControls(Composite mainComposite) {
+
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+
+ Label beanTypeLabel = new Label(mainComposite, SWT.NONE);
+ beanTypeLabel.setText(Messages.JavaBeanSelectionWizardPage_BeanTypeLabel);
+
+ Composite composite = new Composite(mainComposite, SWT.NONE);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ composite.setLayoutData(gd);
+
+ GridLayout gl = new GridLayout();
+ gl.numColumns = 2;
+ gl.marginHeight = 0;
+ gl.marginWidth = 0;
+ gl.makeColumnsEqualWidth = false;
+ composite.setLayout(gl);
+
+ arrayButton = new Button(composite, SWT.CHECK);
+ arrayButton.setText(Messages.JavaBeanSelectionWizardPage_ArrayCheckBoxLabel);
+
+ final Button collectionButton = new Button(composite, SWT.CHECK);
+ collectionButton.setText(Messages.JavaBeanSelectionWizardPage_CollectionLabel);
+
+ Label beanClassLabel = new Label(mainComposite, SWT.NONE);
+ beanClassLabel.setText(Messages.JavaBeanSelectionWizardPage_CollectionClassLabel);
+
+ Composite beanClassComposite = new Composite(mainComposite, SWT.NONE);
+ GridLayout gl1 = new GridLayout();
+ gl1.numColumns = 2;
+ gl1.marginHeight = 0;
+ gl1.marginWidth = 0;
+
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 2;
+ beanClassComposite.setLayoutData(gd);
+
+ beanClassComposite.setLayout(gl);
+
+ colllectionClassText = new Text(beanClassComposite, SWT.BORDER);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ colllectionClassText.setLayoutData(gd);
+ colllectionClassText.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ Text t = (Text) e.getSource();
+ collectionClass = t.getText();
+ refreshJavaBeanModel();
+ updateWizardPageStatus();
+ }
+
+ });
+ colllectionClassText.setEnabled(false);
+
+ beanClassComposite.setLayoutData(gd);
+
+ collectionClassBrowseButton = new Button(beanClassComposite, SWT.NONE);
+ collectionClassBrowseButton.setText(Messages.JavaBeanSelectionWizardPage_BrowseButtonLabel);
+ collectionClassBrowseButton.addSelectionListener(new SelectionAdapter() {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse
+ * .swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ String classString = JavaTypeFieldDialog.openJavaTypeDialog(getShell(), project);
+ colllectionClassText.setText(classString);
+ }
+
+ });
+ collectionClassBrowseButton.setEnabled(false);
+
+ arrayButton.addSelectionListener(new SelectionAdapter() {
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse
+ * .swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ Button button = (Button) e.getSource();
+ if (button.getSelection()) {
+ isArray = true;
+ collectionButton.setSelection(false);
+ isCollection = false;
+ collectionClassBrowseButton.setEnabled(false);
+ colllectionClassText.setEnabled(false);
+ } else {
+ isArray = false;
+ }
+ refreshJavaBeanModel();
+ updateWizardPageStatus();
+ }
+ });
+
+ collectionButton.addSelectionListener(new SelectionAdapter() {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse
+ * .swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ Button button = (Button) e.getSource();
+ if (button.getSelection()) {
+ isCollection = true;
+ arrayButton.setSelection(false);
+ isArray = false;
+ collectionClassBrowseButton.setEnabled(true);
+ colllectionClassText.setEnabled(true);
+ } else {
+ isCollection = false;
+ collectionClassBrowseButton.setEnabled(false);
+ colllectionClassText.setEnabled(false);
+ }
+ updateWizardPageStatus();
+ }
+
+ });
+ collectionButton.setVisible(false);
+ beanClassComposite.setVisible(false);
+ beanClassLabel.setVisible(false);
+ }
+
+ protected void refreshJavaBeanModel() {
+ if (beanClass == null || "".equals(beanClass.trim())) { //$NON-NLS-1$
+ } else {
+ try {
+ ProjectClassLoader loader = new ProjectClassLoader(project);
+ javaBeanModel = null;
+ isCollection = isCollectionClass(beanClass);
+ isCollection = false;
+ if (isCollection) {
+ if (collectionClass != null) {
+ Class<?> clazz = loader.loadClass(beanClass);
+ Class<?> cclazz = loader.loadClass(collectionClass);
+ javaBeanModel = JavaBeanModelFactory.getJavaBeanModelWithLazyLoad(clazz);
+ javaBeanModel.setComponentClass(cclazz);
+ } else {
+ }
+ } else {
+ Class<?> clazz = loader.loadClass(beanClass);
+ if (isArray) {
+ Object arrayInstance = Array.newInstance(clazz, 0);
+ clazz = arrayInstance.getClass();
+ }
+ javaBeanModel = JavaBeanModelFactory.getJavaBeanModelWithLazyLoad(clazz);
+ }
+ if (javaBeanModel != null) {
+ if (beanID != null) {
+ javaBeanModel.setName(beanID);
+ }
+ } else {
+ }
+ } catch (JavaModelException e1) {
+ } catch (ClassNotFoundException e1) {
+ }
+ }
+ }
+
+ private void createBeanClassControls(Composite mainComposite) {
+ Label beanClassLabel = new Label(mainComposite, SWT.NONE);
+ beanClassLabel.setText(Messages.JavaBeanSelectionWizardPage_BeanClassLabel);
+
+ Composite beanClassComposite = new Composite(mainComposite, SWT.NONE);
+ GridLayout gl = new GridLayout();
+ gl.numColumns = 2;
+ gl.marginHeight = 0;
+ gl.marginWidth = 0;
+
+ beanClassComposite.setLayout(gl);
+
+ final Text beanClassText = new Text(beanClassComposite, SWT.BORDER);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ beanClassText.setLayoutData(gd);
+ beanClassText.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ Text t = (Text) e.getSource();
+ arrayButton.setEnabled(true);
+ beanClass = t.getText();
+ if (beanClass != null) {
+ beanClass = beanClass.trim();
+ }
+ isCollection = isCollectionClass(beanClass);
+// if (isCollection) {
+// isArray = false;
+// arrayButton.setSelection(false);
+// arrayButton.setEnabled(false);
+// collectionClassBrowseButton.setEnabled(true);
+// colllectionClassText.setEnabled(true);
+// } else {
+// collectionClassBrowseButton.setEnabled(false);
+// colllectionClassText.setEnabled(false);
+// colllectionClassText.setText("");
+// }
+ refreshJavaBeanModel();
+ updateWizardPageStatus();
+ }
+ });
+
+ beanClassComposite.setLayoutData(gd);
+
+ Button javaTypeBrowseButton = new Button(beanClassComposite, SWT.NONE);
+ javaTypeBrowseButton.setText(Messages.JavaBeanSelectionWizardPage_BrowseButtonLabel);
+ javaTypeBrowseButton.addSelectionListener(new SelectionAdapter() {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse
+ * .swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ String classString = JavaTypeFieldDialog.openJavaTypeDialog(getShell(), project);
+ beanClassText.setText(classString);
+ }
+
+ });
+ }
+
+ private boolean isCollectionClass(String classString) {
+ if (project != null) {
+ try {
+ ProjectClassLoader loader = new ProjectClassLoader(project);
+ Class<?> clazz = loader.loadClass(classString);
+ if (Collection.class.isAssignableFrom(clazz)) {
+ return true;
+ }
+ } catch (Throwable t) {
+
+ }
+ }
+ return false;
+ }
+
+ // private void createBeanIDControls(Composite mainComposite) {
+ // Label beanIDLabel = new Label(mainComposite, SWT.NONE);
+ // beanIDLabel.setText("Bean ID :");
+ //
+ // Text beanIDText = new Text(mainComposite, SWT.BORDER);
+ // GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ // beanIDText.setLayoutData(gd);
+ // beanIDText.addModifyListener(new ModifyListener() {
+ //
+ // public void modifyText(ModifyEvent e) {
+ // Text t = (Text) e.getSource();
+ // beanID = t.getText();
+ // updateWizardPageStatus();
+ // }
+ //
+ // });
+ // }
+
+ protected void updateWizardPageStatus() {
+ String error = null;
+ if (beanClass == null || "".equals(beanClass.trim())) { //$NON-NLS-1$
+ error = Messages.JavaBeanSelectionWizardPage_BeanClassEmptyErrorMessage;
+ } else {
+ try {
+ beanClass = beanClass.trim();
+ ProjectClassLoader loader = new ProjectClassLoader(project);
+ loader.loadClass(beanClass);
+ } catch (JavaModelException e) {
+ e.printStackTrace();
+ } catch (ClassNotFoundException e) {
+ error = Messages.JavaBeanSelectionWizardPage_CantFindClass1 + beanClass + Messages.JavaBeanSelectionWizardPage_QuoteChar; //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-1$ //$NON-NLS-1$ //$NON-NLS-1$ //$NON-NLS-1$
+ }
+ }
+
+ if (isCollection) {
+ if (collectionClass == null || "".equals(collectionClass.trim())) { //$NON-NLS-1$
+ error = Messages.JavaBeanSelectionWizardPage_CollectionComponentClassEmptyErrorMessage;
+ } else {
+ try {
+ ProjectClassLoader loader = new ProjectClassLoader(project);
+ loader.loadClass(collectionClass);
+ } catch (JavaModelException e) {
+ e.printStackTrace();
+ } catch (ClassNotFoundException e) {
+ error = Messages.JavaBeanSelectionWizardPage_CantFindClass1 + beanClass;
+ }
+ }
+ }
+
+ this.setErrorMessage(error);
+ this.setPageComplete(error == null);
+ }
+
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaBeanSelectionWizardPage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaBeanTableLabelProvider.java (from rev 21295, trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/JavaBeanTableLabelProvider.java)
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaBeanTableLabelProvider.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaBeanTableLabelProvider.java 2010-04-30 08:55:28 UTC (rev 21822)
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * 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.javabean12;
+
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @author Dart (dpeng(a)redhat.com)
+ *
+ */
+public class JavaBeanTableLabelProvider extends JavabeanlabelProvider implements ITableLabelProvider {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang
+ * .Object, int)
+ */
+ public Image getColumnImage(Object element, int columnIndex) {
+ if (element instanceof JavaBeanModel) {
+ switch (columnIndex) {
+ case 0:
+ return getImage(element);
+ }
+ }
+ return getImage(element);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang
+ * .Object, int)
+ */
+ public String getColumnText(Object element, int columnIndex) {
+ if (element instanceof JavaBeanModel) {
+ JavaBeanModel beanModel = (JavaBeanModel) element;
+ switch (columnIndex) {
+ case 0:
+ return beanModel.getName();
+ case 1:
+ return beanModel.getBeanClassString();
+ }
+ }
+ return getText(element);
+ }
+
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaBeanTableLabelProvider.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaMethodsSelectionDialog.java (from rev 21295, trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/JavaMethodsSelectionDialog.java)
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaMethodsSelectionDialog.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaMethodsSelectionDialog.java 2010-04-30 08:55:28 UTC (rev 21822)
@@ -0,0 +1,213 @@
+/*******************************************************************************
+ * 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.javabean12;
+
+import java.lang.reflect.Method;
+
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.window.IShellProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.jboss.tools.smooks.configuration.SmooksConfigurationActivator;
+import org.jboss.tools.smooks.configuration.editors.GraphicsConstants;
+import org.jboss.tools.smooks.configuration.editors.javabean12.Messages;
+import org.jboss.tools.smooks.configuration.editors.uitls.IFieldDialog;
+import org.jboss.tools.smooks.configuration.editors.uitls.IModelProcsser;
+import org.jboss.tools.smooks.configuration.editors.uitls.JavaPropertyUtils;
+
+/**
+ * @author Dart (dpeng(a)redhat.com)
+ * <p>
+ * Apr 9, 2009
+ */
+public class JavaMethodsSelectionDialog implements IFieldDialog {
+
+ private IJavaProject resource;
+
+ private Class<?> clazz;
+
+ public JavaMethodsSelectionDialog(IJavaProject resource, Class<?> clazz) {
+ super();
+ this.resource = resource;
+ this.clazz = clazz;
+ }
+
+ public Object open(Shell shell) {
+ if (resource != null && clazz != null) {
+ MethodSelectionDialog dialog = new MethodSelectionDialog(shell, resource, clazz);
+ if (dialog.open() == Dialog.OK) {
+ Method pd = (Method) dialog.getCurrentSelection();
+ if(pd == null){
+ return null;
+ }
+ return pd.getName();
+ }else{
+ return null;
+ }
+ }
+ MessageDialog.openInformation(shell, Messages.JavaMethodsSelectionDialog_ErrorDialogTitle,
+ Messages.JavaMethodsSelectionDialog_ErrorMessage);
+ return null;
+ }
+
+ private class MethodSelectionDialog extends Dialog {
+
+ private TableViewer viewer;
+
+ private Class<?> clazz;
+
+ private Object currentSelection;
+
+
+
+ public MethodSelectionDialog(IShellProvider parentShell) {
+ super(parentShell);
+ }
+
+ public MethodSelectionDialog(Shell parentShell, IJavaProject project, Class<?> clazz) {
+ super(parentShell);
+ this.clazz = clazz;
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ Composite composite = (Composite) super.createDialogArea(parent);
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ gd.heightHint = 400;
+ gd.widthHint = 400;
+ composite.setLayoutData(gd);
+ FillLayout fl = new FillLayout();
+ fl.marginHeight = 10;
+ fl.marginWidth = 10;
+ composite.setLayout(fl);
+ viewer = new TableViewer(composite, SWT.BORDER|SWT.FULL_SELECTION);
+ Table table = viewer.getTable();
+ TableColumn nameColumn = new TableColumn(table, SWT.NONE);
+ nameColumn.setWidth(100);
+ nameColumn.setText(Messages.JavaMethodsSelectionDialog_MethodNameColumnText);
+ TableColumn typeColumn = new TableColumn(table, SWT.NONE);
+ typeColumn.setWidth(200);
+ typeColumn.setText(Messages.JavaMethodsSelectionDialog_MethodParamsColumnText);
+ table.setHeaderVisible(true);
+ viewer.setContentProvider(new MethodContentProvider());
+ viewer.setLabelProvider(new MethodLabelProvider());
+ Method[] settMethods = JavaPropertyUtils.getSetterMethods(clazz);
+ viewer.setInput(settMethods);
+ viewer.addDoubleClickListener(new IDoubleClickListener(){
+
+ public void doubleClick(DoubleClickEvent event) {
+ okPressed();
+ }
+
+ });
+ viewer.addSelectionChangedListener(new ISelectionChangedListener() {
+
+ public void selectionChanged(SelectionChangedEvent event) {
+ currentSelection = ((IStructuredSelection) event.getSelection()).getFirstElement();
+ }
+
+ });
+ getShell().setText(clazz.getSimpleName() + Messages.JavaMethodsSelectionDialog_SetterDialogTitle);
+ return composite;
+ }
+
+ public Object getCurrentSelection() {
+ return currentSelection;
+ }
+
+ public void setCurrentSelection(Object currentSelection) {
+ this.currentSelection = currentSelection;
+ }
+ }
+
+ private class MethodContentProvider implements IStructuredContentProvider {
+
+ public Object[] getElements(Object inputElement) {
+ if (inputElement.getClass().isArray()) {
+ return (Object[]) inputElement;
+ }
+ return new Object[] {};
+ }
+
+ public void dispose() {
+
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+
+ }
+
+ }
+
+ private class MethodLabelProvider extends LabelProvider implements ITableLabelProvider {
+ public Image getColumnImage(Object element, int columnIndex) {
+ if (columnIndex == 0) {
+ return SmooksConfigurationActivator.getDefault().getImageRegistry().get(
+ GraphicsConstants.JAVA_PROPERTY_ICON);
+ }
+ return null;
+ }
+
+ public String getColumnText(Object element, int columnIndex) {
+ if (element instanceof Method) {
+ Method p = (Method) element;
+ switch (columnIndex) {
+ case 0:
+ return p.getName();
+ case 1:
+ Class<?>[] pts = p.getParameterTypes();
+ String paramtersName = ""; //$NON-NLS-1$
+ for (int i = 0; i < pts.length; i++,paramtersName+=",") { //$NON-NLS-1$
+ String name = pts[i].getName();
+ if(pts[i].isArray()){
+ name = pts[i].getComponentType().getName() + "[]"; //$NON-NLS-1$
+ }
+ paramtersName += name;
+ }
+ if(paramtersName.endsWith(",")){ //$NON-NLS-1$
+ paramtersName = paramtersName.substring(0,paramtersName.length() - 1);
+ }
+ return paramtersName;
+ }
+ }
+ return getText(element);
+ }
+ }
+
+ public IModelProcsser getModelProcesser() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void setModelProcesser(IModelProcsser processer) {
+ // TODO Auto-generated method stub
+
+ }
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaMethodsSelectionDialog.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaPropertiesSelectionDialog.java (from rev 21295, trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/JavaPropertiesSelectionDialog.java)
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaPropertiesSelectionDialog.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaPropertiesSelectionDialog.java 2010-04-30 08:55:28 UTC (rev 21822)
@@ -0,0 +1,213 @@
+/*******************************************************************************
+ * 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.javabean12;
+
+import java.lang.reflect.Array;
+
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.window.IShellProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.jboss.tools.smooks.configuration.SmooksConfigurationActivator;
+import org.jboss.tools.smooks.configuration.editors.GraphicsConstants;
+import org.jboss.tools.smooks.configuration.editors.javabean12.Messages;
+import org.jboss.tools.smooks.configuration.editors.uitls.IFieldDialog;
+import org.jboss.tools.smooks.configuration.editors.uitls.IModelProcsser;
+import org.jboss.tools.smooks.configuration.editors.uitls.ProjectClassLoader;
+import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
+
+/**
+ * @author Dart (dpeng(a)redhat.com)
+ * <p>
+ * Apr 9, 2009
+ */
+public class JavaPropertiesSelectionDialog implements IFieldDialog {
+
+ private IJavaProject project;
+
+ private String className;
+
+ public JavaPropertiesSelectionDialog(IJavaProject resource, String className) {
+ super();
+ this.project = resource;
+ this.className = className;
+ }
+
+ public Object open(Shell shell) {
+ String errorMessage = ""; //$NON-NLS-1$
+ if (project == null) {
+ errorMessage = Messages.JavaPropertiesSelectionDialog_ProjectisJavaProjectErrorMessage;
+ }
+ try {
+ if (project != null && className != null) {
+ Class<?> clazz = SmooksUIUtils.loadClass(className, project);
+ if (clazz != null) {
+ JavaBeanModel beanModel = JavaBeanModelFactory.getJavaBeanModelWithLazyLoad(clazz);
+ PropertySelectionDialog dialog = new PropertySelectionDialog(shell, project, beanModel);
+ if (dialog.open() == Dialog.OK) {
+ JavaBeanModel pd = (JavaBeanModel) dialog.getCurrentSelection();
+ if (pd == null) {
+ return null;
+ }
+ return pd.getName();
+ } else {
+ return null;
+ }
+ }
+ }
+ } catch (JavaModelException e) {
+ errorMessage = ""; //$NON-NLS-1$
+ } catch (ClassNotFoundException e) {
+ errorMessage = "'" + className + "' can't be found."; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ MessageDialog.openInformation(shell, Messages.JavaPropertiesSelectionDialog_CantOpenDialogTitle,
+ Messages.JavaPropertiesSelectionDialog_CantOpenDialogErrorMessage1 + className + "'.\n" + errorMessage); //$NON-NLS-1$
+ return null;
+ }
+
+ private class PropertySelectionDialog extends Dialog {
+
+ private TableViewer viewer;
+
+ private Object currentSelection;
+
+ private JavaBeanModel beanModel = null;
+
+ public PropertySelectionDialog(IShellProvider parentShell) {
+ super(parentShell);
+ }
+
+ public PropertySelectionDialog(Shell parentShell, IJavaProject project, JavaBeanModel beanModel) {
+ super(parentShell);
+ this.beanModel = beanModel;
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ Composite composite = (Composite) super.createDialogArea(parent);
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ gd.heightHint = 400;
+ gd.widthHint = 400;
+ composite.setLayoutData(gd);
+ FillLayout fl = new FillLayout();
+ fl.marginHeight = 10;
+ fl.marginWidth = 10;
+ composite.setLayout(fl);
+ viewer = new TableViewer(composite, SWT.BORDER | SWT.FULL_SELECTION);
+ Table table = viewer.getTable();
+ TableColumn nameColumn = new TableColumn(table, SWT.NONE);
+ nameColumn.setWidth(100);
+ nameColumn.setText(Messages.JavaPropertiesSelectionDialog_NameColumnText);
+ TableColumn typeColumn = new TableColumn(table, SWT.NONE);
+ typeColumn.setWidth(200);
+ typeColumn.setText(Messages.JavaPropertiesSelectionDialog_TypeColumnText);
+ table.setHeaderVisible(true);
+ viewer.setContentProvider(new PropertyDescriptorContentProvider());
+ viewer.setLabelProvider(new PropertyDescriptorLabelProvider());
+ viewer.setInput(beanModel);
+ viewer.addDoubleClickListener(new IDoubleClickListener() {
+ public void doubleClick(DoubleClickEvent event) {
+ okPressed();
+ }
+ });
+ viewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ currentSelection = ((IStructuredSelection) event.getSelection()).getFirstElement();
+ }
+ });
+ getShell().setText(beanModel.getName() + Messages.JavaPropertiesSelectionDialog_DialogTitle);
+ return composite;
+ }
+
+ public Object getCurrentSelection() {
+ return currentSelection;
+ }
+
+ public void setCurrentSelection(Object currentSelection) {
+ this.currentSelection = currentSelection;
+ }
+ }
+
+ private class PropertyDescriptorContentProvider implements IStructuredContentProvider {
+
+ public Object[] getElements(Object inputElement) {
+ if (inputElement instanceof JavaBeanModel) {
+ return ((JavaBeanModel) inputElement).getChildren().toArray();
+ }
+ if (inputElement.getClass().isArray()) {
+ return (Object[]) inputElement;
+ }
+ return new Object[] {};
+ }
+
+ public void dispose() {
+
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+
+ }
+
+ }
+
+ private class PropertyDescriptorLabelProvider extends LabelProvider implements ITableLabelProvider {
+ public Image getColumnImage(Object element, int columnIndex) {
+ if (columnIndex == 0) {
+ return SmooksConfigurationActivator.getDefault().getImageRegistry().get(
+ GraphicsConstants.JAVA_PROPERTY_ICON);
+ }
+ return null;
+ }
+
+ public String getColumnText(Object element, int columnIndex) {
+ if (element instanceof JavaBeanModel) {
+ JavaBeanModel p = (JavaBeanModel) element;
+ switch (columnIndex) {
+ case 0:
+ return p.getName();
+ case 1:
+ return p.getBeanClassString();
+ }
+ }
+ return getText(element);
+ }
+ }
+
+ public IModelProcsser getModelProcesser() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void setModelProcesser(IModelProcsser processer) {
+ // TODO Auto-generated method stub
+
+ }
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavaPropertiesSelectionDialog.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/Javabean12ExpressionUICreator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/Javabean12ExpressionUICreator.java 2010-04-30 08:50:50 UTC (rev 21821)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/Javabean12ExpressionUICreator.java 2010-04-30 08:55:28 UTC (rev 21822)
@@ -26,7 +26,6 @@
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.jboss.tools.smooks.configuration.editors.AttributeFieldEditPart;
import org.jboss.tools.smooks.configuration.editors.IPropertyUICreator;
-import org.jboss.tools.smooks.configuration.editors.javabean.PropertiesAndSetterMethodSearchFieldEditorCreator;
import org.jboss.tools.smooks.configuration.editors.uitls.FieldAssistDisposer;
import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
import org.jboss.tools.smooks.editor.ISmooksModelProvider;
Copied: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavabeanContentProvider.java (from rev 21295, trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/JavabeanContentProvider.java)
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavabeanContentProvider.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavabeanContentProvider.java 2010-04-30 08:55:28 UTC (rev 21822)
@@ -0,0 +1,57 @@
+package org.jboss.tools.smooks.configuration.editors.javabean12;
+
+import java.util.Collection;
+
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.jboss.tools.smooks.configuration.editors.IXMLStructuredObject;
+/**
+ *
+ * @author Dart Peng
+ *
+ */
+public class JavabeanContentProvider implements ITreeContentProvider,
+ IStructuredContentProvider {
+
+ public Object[] getChildren(Object arg0) {
+ if (arg0 instanceof IXMLStructuredObject) {
+ return ((IXMLStructuredObject) arg0).getChildren().toArray();
+ }
+ return new Object[] {};
+ }
+
+ public Object getParent(Object arg0) {
+ if(arg0 instanceof JavaBeanModel){
+ return ((JavaBeanModel)arg0).getParent();
+ }
+ return null;
+ }
+
+ public boolean hasChildren(Object bean) {
+ if (bean instanceof JavaBeanModel) {
+ return !((JavaBeanModel) bean).isPrimitive();
+ }
+ return false;
+ }
+
+ public Object[] getElements(Object arg0) {
+ if (arg0 instanceof JavaBeanList) {
+ return ((JavaBeanList) arg0).getChildren().toArray();
+ }
+
+ if (arg0 instanceof Collection<?>) {
+ return ((Collection<?>) arg0).toArray();
+ }
+ return new Object[]{};
+ }
+
+ public void dispose() {
+
+ }
+
+ public void inputChanged(Viewer arg0, Object arg1, Object arg2) {
+
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavabeanContentProvider.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavabeanStrucutredDataWizard.java (from rev 21295, trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/JavabeanStrucutredDataWizard.java)
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavabeanStrucutredDataWizard.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavabeanStrucutredDataWizard.java 2010-04-30 08:55:28 UTC (rev 21822)
@@ -0,0 +1,201 @@
+/*******************************************************************************
+ * 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.javabean12;
+
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jface.viewers.IStructuredSelection;
+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.SmooksMultiFormEditor;
+import org.jboss.tools.smooks.configuration.editors.javabean12.Messages;
+import org.jboss.tools.smooks.configuration.editors.wizard.IStructuredDataSelectionWizard;
+import org.jboss.tools.smooks10.model.smooks.util.SmooksModelUtils;
+
+/**
+ * @author Dart Peng
+ * @Date Aug 5, 2008
+ */
+public class JavabeanStrucutredDataWizard extends Wizard implements
+ IStructuredDataSelectionWizard, INewWizard {
+ JavaBeanSelectionWizardPage page = null;
+ IJavaProject project = null;
+
+
+ public JavabeanStrucutredDataWizard() {
+ super();
+ this.setWindowTitle(Messages.JavabeanStrucutredDataWizard_WizardTitle);
+ }
+
+ public IJavaProject getProject() {
+ return project;
+ }
+
+ public void setProject(IJavaProject project) {
+ this.project = project;
+ }
+
+ Object result = null;
+ Properties properties = new Properties();
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.wizard.Wizard#addPages()
+ */
+ @Override
+ public void addPages() {
+ super.addPages();
+ if (page == null) {
+ page = new JavaBeanSelectionWizardPage("javaclass",project); //$NON-NLS-1$
+ this.addPage(page);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.wizard.Wizard#performFinish()
+ */
+ @Override
+ public boolean performFinish() {
+ result = page.getJavaBeanModelList();
+ return true;
+ }
+
+ public JavaBeanList getJavaBeanList() {
+ JavaBeanList list = new JavaBeanList();
+ if (result != null && result instanceof List<?>) {
+ for (Iterator<?> iterator = ((List<?>) result).iterator(); iterator
+ .hasNext();) {
+ JavaBeanModel javabean = (JavaBeanModel) iterator.next();
+ boolean isArray = "array".equals(javabean //$NON-NLS-1$
+ .getExtendProperty("many")); //$NON-NLS-1$
+ boolean isList = "list".equals(javabean //$NON-NLS-1$
+ .getExtendProperty("many")); //$NON-NLS-1$
+ if (isArray) {
+ Object arrayInstance = Array.newInstance(javabean
+ .getBeanClass(), 0);
+ JavaBeanModel model = JavaBeanModelFactory
+ .getJavaBeanModelWithLazyLoad(arrayInstance
+ .getClass());
+ list.addJavaBean(model);
+ continue;
+ }
+ if(isList){
+ JavaBeanModel model = JavaBeanModelFactory
+ .getJavaBeanModelWithLazyLoad(ArrayList.class);
+ model.setComponentClass(javabean.getBeanClass());
+ list.addJavaBean(model);
+ continue;
+ }
+ list.addJavaBean(javabean);
+ }
+ }
+ if (list.getChildren().size() <= 0) {
+ return null;
+ }
+ return list;
+ }
+
+ public Object getResult() {
+ return result;
+ }
+
+ public Object getReturnData() {
+ return getJavaBeanList();
+ }
+
+ public void init(IEditorSite site, IEditorInput input) {
+ if (input != null && input instanceof IFileEditorInput) {
+ IFileEditorInput fi = (IFileEditorInput) input;
+ IProject project = fi.getFile().getProject();
+ if (project instanceof IJavaProject) {
+ this.project = (IJavaProject) project;
+ } else {
+ this.project = JavaCore.create(project);
+ }
+ }
+ }
+
+ public String getInputDataTypeID() {
+ return SmooksModelUtils.INPUT_TYPE_JAVA;
+ }
+
+ public Properties getProperties() {
+ return this.properties;
+ }
+
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ if (selection != null) {
+ Object obj = selection.getFirstElement();
+ if (obj instanceof IJavaProject) {
+ this.project = (IJavaProject) obj;
+ }
+ if (obj instanceof IResource) {
+ IProject project = ((IResource) obj).getProject();
+ this.project = JavaCore.create(project);
+ }
+
+ if (project == null) {
+ if (obj instanceof IAdaptable) {
+ IResource relateResource = (IResource) ((IAdaptable) obj)
+ .getAdapter(IResource.class);
+ IProject project = relateResource.getProject();
+ this.project = JavaCore.create(project);
+ }
+ }
+ }
+ }
+
+ public String getStructuredDataSourcePath() {
+ List<JavaBeanModel> list = page.getJavaBeanModelList();
+ StringBuffer buffer = new StringBuffer();
+ for (Iterator<JavaBeanModel> iterator = list.iterator(); iterator
+ .hasNext(); buffer.append(";")) { //$NON-NLS-1$
+ JavaBeanModel javaBeanModel = (JavaBeanModel) iterator.next();
+ Class<?> clazz = javaBeanModel.getBeanClass();
+ if (clazz != null) {
+ boolean isArray = clazz.isArray();
+// boolean isList = "list".equals(javaBeanModel
+// .getExtendProperty("many"));
+ String cname = clazz.getName();
+ if(isArray){
+ cname = clazz.getComponentType().getName();
+ cname = cname+ "[]"; //$NON-NLS-1$
+ }
+ buffer.append(cname);
+ }
+ }
+ if(buffer.toString().endsWith(";")){ //$NON-NLS-1$
+ return buffer.substring(0, buffer.length() - 1);
+ }
+ return buffer.toString();
+ }
+
+ public void complate(SmooksMultiFormEditor formEditor) {
+ // TODO Auto-generated method stub
+
+ }
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavabeanStrucutredDataWizard.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavabeanValueBinding12UICreator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavabeanValueBinding12UICreator.java 2010-04-30 08:50:50 UTC (rev 21821)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavabeanValueBinding12UICreator.java 2010-04-30 08:55:28 UTC (rev 21822)
@@ -20,7 +20,6 @@
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.jboss.tools.smooks.configuration.editors.AttributeFieldEditPart;
-import org.jboss.tools.smooks.configuration.editors.javabean.PropertiesAndSetterMethodSearchFieldEditorCreator;
import org.jboss.tools.smooks.editor.ISmooksModelProvider;
import org.jboss.tools.smooks.model.javabean12.BeanType;
import org.jboss.tools.smooks.model.javabean12.Javabean12Package;
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavabeanWiringBiding12UICreator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavabeanWiringBiding12UICreator.java 2010-04-30 08:50:50 UTC (rev 21821)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavabeanWiringBiding12UICreator.java 2010-04-30 08:55:28 UTC (rev 21822)
@@ -21,7 +21,6 @@
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.jboss.tools.smooks.configuration.editors.AttributeFieldEditPart;
-import org.jboss.tools.smooks.configuration.editors.javabean.PropertiesAndSetterMethodSearchFieldEditorCreator;
import org.jboss.tools.smooks.editor.ISmooksModelProvider;
import org.jboss.tools.smooks.model.javabean12.BeanType;
import org.jboss.tools.smooks.model.javabean12.Javabean12Package;
Copied: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavabeanlabelProvider.java (from rev 21295, trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/JavabeanlabelProvider.java)
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavabeanlabelProvider.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavabeanlabelProvider.java 2010-04-30 08:55:28 UTC (rev 21822)
@@ -0,0 +1,84 @@
+package org.jboss.tools.smooks.configuration.editors.javabean12;
+
+import java.util.Collection;
+
+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.editors.GraphicsConstants;
+
+public class JavabeanlabelProvider extends LabelProvider {
+
+ public Image getJavaObjectImage() {
+ return SmooksConfigurationActivator.getDefault().getImageRegistry().get(
+ GraphicsConstants.IMAGE_JAVA_OBJECT);
+ }
+
+ public Image getJavaAttributeImage() {
+ return SmooksConfigurationActivator.getDefault().getImageRegistry().get(
+ GraphicsConstants.IMAGE_JAVA_ATTRIBUTE);
+ }
+
+ public String getText(Object element) {
+ if (element instanceof JavaBeanModel) {
+ String name = ((JavaBeanModel) element).getName();
+ if (name == null)
+ name = "<nonamed>"; //$NON-NLS-1$
+
+ Object error = ((JavaBeanModel) element).getError();
+ if (error != null) {
+ name = name + " " + "<" + error.toString() + ">"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ return name;
+ }
+
+ Class<?> typeRef = ((JavaBeanModel) element).getBeanClass();
+ String typeStr = ""; //$NON-NLS-1$
+ if (typeRef != null) {
+ if (typeRef.isArray()) {
+ typeRef = typeRef.getComponentType();
+ typeStr = typeRef.getName() + "[]"; //$NON-NLS-1$
+ } else {
+ typeStr = typeRef.getName();
+ }
+ }
+ if (!typeStr.equals("")) { //$NON-NLS-1$
+ name = name + " " + typeStr; //$NON-NLS-1$
+ }
+
+ return name;
+ }
+ return ""; //$NON-NLS-1$
+ }
+
+ @Override
+ public Image getImage(Object element) {
+ if (element instanceof JavaBeanModel) {
+ Object error = ((JavaBeanModel) element).getError();
+ if (error != null) {
+ return SmooksConfigurationActivator.getDefault().getImageRegistry().get(
+ GraphicsConstants.IMAGE_ERROR);
+ }
+ if (((JavaBeanModel) element).isPrimitive()) {
+ return this.getJavaAttributeImage();
+ } else {
+ Class<?> typeRef = ((JavaBeanModel) element).getBeanClass();
+ if (typeRef != null) {
+ if (typeRef.isArray()) {
+ return SmooksConfigurationActivator.getDefault().getImageRegistry().get(
+ GraphicsConstants.IMAGE_JAVA_ARRAY);
+ }
+ if (Collection.class.isAssignableFrom(typeRef)) {
+ return SmooksConfigurationActivator.getDefault().getImageRegistry().get(
+ GraphicsConstants.IMAGE_JAVA_COLLECTION);
+ }
+ if (typeRef.isInterface()) {
+ return SmooksConfigurationActivator.getDefault().getImageRegistry().get(
+ GraphicsConstants.IMAGE_JAVA_INTERFACE);
+ }
+ }
+ return this.getJavaObjectImage();
+ }
+ }
+ return super.getImage(element);
+ }
+}
\ No newline at end of file
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/JavabeanlabelProvider.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/Messages.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/Messages.java 2010-04-30 08:50:50 UTC (rev 21821)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/Messages.java 2010-04-30 08:55:28 UTC (rev 21822)
@@ -12,6 +12,36 @@
public static String JavaBean12PropertyUICreator_ErrorDialogTitle;
public static String JavabeanValueBinding12UICreator_DataGroupText;
public static String JavabeanWiringBiding12UICreator_WiringOnGroupText;
+
+ public static String JavaBeanSelectionWizardPage_ArrayCheckBoxLabel;
+ public static String JavaBeanSelectionWizardPage_BeanClassEmptyErrorMessage;
+ public static String JavaBeanSelectionWizardPage_BeanClassLabel;
+ public static String JavaBeanSelectionWizardPage_BeanTypeLabel;
+ public static String JavaBeanSelectionWizardPage_BrowseButtonLabel;
+ public static String JavaBeanSelectionWizardPage_CantFindClass1;
+ public static String JavaBeanSelectionWizardPage_CollectionClassLabel;
+ public static String JavaBeanSelectionWizardPage_CollectionComponentClassEmptyErrorMessage;
+ public static String JavaBeanSelectionWizardPage_CollectionLabel;
+ public static String JavaBeanSelectionWizardPage_QuoteChar;
+ public static String JavaBeanSelectionWizardPage_WizardDes;
+ public static String JavaBeanSelectionWizardPage_WizardTitle;
+ public static String JavabeanStrucutredDataWizard_WizardTitle;
+ public static String JavaMethodsSelectionDialog_ErrorDialogTitle;
+ public static String JavaMethodsSelectionDialog_ErrorMessage;
+ public static String JavaMethodsSelectionDialog_MethodNameColumnText;
+ public static String JavaMethodsSelectionDialog_MethodParamsColumnText;
+ public static String JavaMethodsSelectionDialog_SetterDialogTitle;
+ public static String JavaPropertiesSelectionDialog_CantOpenDialogErrorMessage1;
+ public static String JavaPropertiesSelectionDialog_CantOpenDialogTitle;
+ public static String JavaPropertiesSelectionDialog_DialogTitle;
+ public static String JavaPropertiesSelectionDialog_NameColumnText;
+ public static String JavaPropertiesSelectionDialog_ProjectisJavaProjectErrorMessage;
+ public static String JavaPropertiesSelectionDialog_TypeColumnText;
+ public static String PropertiesAndSetterMethodSearchFieldEditorCreator_BrowseButtonLabel;
+ public static String ValueWiringBindingSelectionDialog_AddBindingLabel;
+ public static String ValueWiringBindingSelectionDialog_DeselectAllLink;
+ public static String ValueWiringBindingSelectionDialog_SelectAllLink;
+ public static String ValueWiringBindingSelectionDialog_SelectJavaLabel;
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
Copied: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/PropertiesAndSetterMethodSearchFieldEditorCreator.java (from rev 21295, trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/PropertiesAndSetterMethodSearchFieldEditorCreator.java)
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/PropertiesAndSetterMethodSearchFieldEditorCreator.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/PropertiesAndSetterMethodSearchFieldEditorCreator.java 2010-04-30 08:55:28 UTC (rev 21822)
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * 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.javabean12;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.jboss.tools.smooks.configuration.editors.AttributeFieldEditPart;
+import org.jboss.tools.smooks.configuration.editors.PropertyUICreator;
+import org.jboss.tools.smooks.configuration.editors.javabean12.Messages;
+import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
+import org.jboss.tools.smooks.editor.ISmooksModelProvider;
+
+//import org.jboss.tools.smooks.model.javabean.BindingsType;
+
+/**
+ * @author Dart Peng (dpeng(a)redhat.com) Date Apr 9, 2009
+ */
+public class PropertiesAndSetterMethodSearchFieldEditorCreator extends PropertyUICreator {
+
+ @Override
+ public AttributeFieldEditPart createPropertyUI(FormToolkit toolkit, Composite parent,
+ IItemPropertyDescriptor propertyDescriptor, Object model, EAttribute feature,
+ ISmooksModelProvider formEditor, IEditorPart part) {
+ if (canCreatePropertiesSearchFieldEditor(feature)) {
+ return createPropertiesSearchFieldEditor(toolkit, parent, propertyDescriptor, model);
+ }
+ if (canCreateMethodsSearchFieldEditor(feature)) {
+ return createMethodsSearchFieldEditor(toolkit, parent, propertyDescriptor, model);
+ }
+ return super.createPropertyUI(toolkit, parent, propertyDescriptor, model, feature, formEditor, part);
+ }
+
+ protected boolean canCreatePropertiesSearchFieldEditor(EAttribute feature) {
+ return false;
+ }
+
+ protected boolean canCreateMethodsSearchFieldEditor(EAttribute feature) {
+ return false;
+ }
+
+ protected String getPropertiesSearchButtonName() {
+ return Messages.PropertiesAndSetterMethodSearchFieldEditorCreator_BrowseButtonLabel;
+ }
+
+ protected String getMethodsSearchButtonName() {
+ return Messages.PropertiesAndSetterMethodSearchFieldEditorCreator_BrowseButtonLabel;
+ }
+
+ protected AttributeFieldEditPart createPropertiesSearchFieldEditor(FormToolkit toolkit, Composite parent,
+ IItemPropertyDescriptor propertyDescriptor, Object model) {
+ if (model instanceof EObject) {
+ EObject container = ((EObject) model).eContainer();
+ String classString = getClassString(model);
+ if (classString != null) {
+ AttributeFieldEditPart editPart = SmooksUIUtils.createJavaPropertySearchFieldEditor(classString, container, parent, toolkit,
+ propertyDescriptor, getPropertiesSearchButtonName(), (EObject) model);
+ Composite composite = (Composite) editPart.getContentControl();
+ Control[] children = composite.getChildren();
+ for (int i = 0; i < children.length; i++) {
+ Control child = children[i];
+ if(child instanceof Button){
+ child.setEnabled(false);
+ }
+ }
+ editPart.getContentControl().setEnabled(false);
+ return editPart;
+ }
+ }
+ return null;
+ }
+
+ protected String getClassString(Object model) {
+ return null;
+ }
+
+ protected AttributeFieldEditPart createMethodsSearchFieldEditor(FormToolkit toolkit, Composite parent,
+ IItemPropertyDescriptor propertyDescriptor, Object model) {
+ if (model instanceof EObject) {
+ EObject container = ((EObject) model).eContainer();
+ String classString = getClassString(model);
+ if (classString != null) {
+ AttributeFieldEditPart editPart = SmooksUIUtils.createJavaMethodSearchFieldEditor(classString, container, parent, toolkit,
+ propertyDescriptor, getMethodsSearchButtonName(), (EObject) model);
+ Composite composite = (Composite) editPart.getContentControl();
+ Control[] children = composite.getChildren();
+ for (int i = 0; i < children.length; i++) {
+ Control child = children[i];
+ if(child instanceof Button){
+ child.setEnabled(false);
+ }
+ }
+ editPart.getContentControl().setEnabled(false);
+ return editPart;
+ }
+ }
+ return null;
+ }
+
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/PropertiesAndSetterMethodSearchFieldEditorCreator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/ValueWiringBindingSelectionDialog.java (from rev 21295, trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/ValueWiringBindingSelectionDialog.java)
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/ValueWiringBindingSelectionDialog.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/ValueWiringBindingSelectionDialog.java 2010-04-30 08:55:28 UTC (rev 21822)
@@ -0,0 +1,251 @@
+/*******************************************************************************
+ * 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.javabean12;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.jface.window.IShellProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.forms.events.HyperlinkEvent;
+import org.eclipse.ui.forms.events.IHyperlinkListener;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Hyperlink;
+import org.jboss.tools.smooks.configuration.editors.javabean12.Messages;
+
+/**
+ * @author Dart (dpeng(a)redhat.com)
+ *
+ */
+public class ValueWiringBindingSelectionDialog extends Dialog {
+
+ private JavaBeanModel beanModel;
+
+ private String[] ignoreProperties = null;
+
+ private CheckboxTableViewer viewer = null;
+
+ private Object[] checkedObject = null;
+
+ private FormToolkit toolkit;
+
+ public ValueWiringBindingSelectionDialog(IShellProvider parentShell, JavaBeanModel beanModel,
+ String[] ignoreProperties) {
+ super(parentShell);
+ this.beanModel = beanModel;
+ this.ignoreProperties = ignoreProperties;
+ }
+
+ public ValueWiringBindingSelectionDialog(Shell parentShell, JavaBeanModel beanModel, String[] ignoreProperties) {
+ super(parentShell);
+ this.beanModel = beanModel;
+ this.ignoreProperties = ignoreProperties;
+ }
+
+ protected Control createDialogArea(Composite parent) {
+ Composite composite = (Composite) super.createDialogArea(parent);
+
+
+
+ GridData gd = new GridData(GridData.FILL_BOTH);
+
+ Label label = new Label(composite, SWT.NONE);
+ label.setLayoutData(gd);
+ label.setText(Messages.ValueWiringBindingSelectionDialog_SelectJavaLabel);
+
+ viewer = CheckboxTableViewer.newCheckList(composite, SWT.BORDER);
+
+ gd = new GridData(GridData.FILL_BOTH);
+ gd.heightHint = 300;
+ gd.widthHint = 300;
+
+ viewer.getControl().setLayoutData(gd);
+ // TableColumn nameColumn = new TableColumn(viewer.getTable(),SWT.NONE);
+ // viewer.getTable().setHeaderVisible(true);
+ // viewer.getTable().setLinesVisible(true);
+ // nameColumn.setWidth(150);
+ // nameColumn.setText("Name");
+ // TableColumn typeColumn = new TableColumn(viewer.getTable(),SWT.NONE);
+ // typeColumn.setWidth(150);
+ // typeColumn.setText("Type");
+ // TableColumn nameColumn = new TableColumn(viewer.getTable(),SWT.NONE);
+ viewer.setContentProvider(new JavabeanContentProvider());
+ viewer.setLabelProvider(new JavaBeanTableLabelProvider());
+ List<JavaBeanModel> list = new ArrayList<JavaBeanModel>();
+ for (Iterator<?> iterator = beanModel.getChildren().iterator(); iterator.hasNext();) {
+ Object child = (Object) iterator.next();
+ if (child instanceof JavaBeanModel && !ignoreProperty((JavaBeanModel) child)) {
+ list.add((JavaBeanModel) child);
+ }
+ }
+ viewer.setInput(list);
+ viewer.setSorter(new ViewerSorter() {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.viewers.ViewerComparator#category(java.lang
+ * .Object)
+ */
+ @Override
+ public int category(Object element) {
+ if (element instanceof JavaBeanModel) {
+ if (((JavaBeanModel) element).isPrimitive()) {
+ return 1;
+ } else {
+ return 2;
+ }
+ }
+ return super.category(element);
+ }
+
+ });
+
+ Composite linkComposite = new Composite(composite,SWT.NONE);
+ GridLayout gl = new GridLayout();
+ gl.numColumns = 2;
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ linkComposite.setLayoutData(gd);
+
+ linkComposite.setLayout(gl);
+
+ toolkit = new FormToolkit(parent.getDisplay());
+ Hyperlink allselectlink = toolkit.createHyperlink(linkComposite, Messages.ValueWiringBindingSelectionDialog_SelectAllLink, SWT.NONE);
+ allselectlink.setBackground(linkComposite.getBackground());
+ allselectlink.addHyperlinkListener(new IHyperlinkListener() {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.forms.events.IHyperlinkListener#linkActivated(
+ * org.eclipse.ui.forms.events.HyperlinkEvent)
+ */
+ public void linkActivated(HyperlinkEvent e) {
+ viewer.setAllChecked(true);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.forms.events.IHyperlinkListener#linkEntered(org
+ * .eclipse.ui.forms.events.HyperlinkEvent)
+ */
+ public void linkEntered(HyperlinkEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.forms.events.IHyperlinkListener#linkExited(org
+ * .eclipse.ui.forms.events.HyperlinkEvent)
+ */
+ public void linkExited(HyperlinkEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+
+ });
+
+ Hyperlink allunselectlink = toolkit.createHyperlink(linkComposite, Messages.ValueWiringBindingSelectionDialog_DeselectAllLink, SWT.NONE);
+ allunselectlink.setBackground(linkComposite.getBackground());
+ allunselectlink.addHyperlinkListener(new IHyperlinkListener() {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.forms.events.IHyperlinkListener#linkActivated(
+ * org.eclipse.ui.forms.events.HyperlinkEvent)
+ */
+ public void linkActivated(HyperlinkEvent e) {
+ viewer.setAllChecked(false);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.forms.events.IHyperlinkListener#linkEntered(org
+ * .eclipse.ui.forms.events.HyperlinkEvent)
+ */
+ public void linkEntered(HyperlinkEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.forms.events.IHyperlinkListener#linkExited(org
+ * .eclipse.ui.forms.events.HyperlinkEvent)
+ */
+ public void linkExited(HyperlinkEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+
+ });
+ getShell().setText(Messages.ValueWiringBindingSelectionDialog_AddBindingLabel);
+ return composite;
+ }
+
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.Dialog#close()
+ */
+ @Override
+ public boolean close() {
+ checkedObject = viewer.getCheckedElements();
+ if(toolkit != null){
+ toolkit.dispose();
+ }
+ return super.close();
+ }
+
+
+
+ /**
+ * @return the checkedObject
+ */
+ public Object[] getCheckedObject() {
+ return checkedObject;
+ }
+
+ private boolean ignoreProperty(JavaBeanModel model) {
+ if (ignoreProperties == null) {
+ return false;
+ }
+ for (int i = 0; i < ignoreProperties.length; i++) {
+ if (model.getName().equals(ignoreProperties[i])) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/ValueWiringBindingSelectionDialog.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/messages.properties
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/messages.properties 2010-04-30 08:50:50 UTC (rev 21821)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean12/messages.properties 2010-04-30 08:55:28 UTC (rev 21822)
@@ -6,3 +6,33 @@
JavaBean12PropertyUICreator_ErrorDialogTitle=Error
JavabeanValueBinding12UICreator_DataGroupText=Data
JavabeanWiringBiding12UICreator_WiringOnGroupText=Wrie On Element
+
+JavaBeanSelectionWizardPage_ArrayCheckBoxLabel=Array
+JavaBeanSelectionWizardPage_BeanClassEmptyErrorMessage=Bean Class is empty
+JavaBeanSelectionWizardPage_BeanClassLabel=Java Class \:
+JavaBeanSelectionWizardPage_BeanTypeLabel=Bean Type :
+JavaBeanSelectionWizardPage_BrowseButtonLabel=Browse...
+JavaBeanSelectionWizardPage_CantFindClass1=Can't find the class "
+JavaBeanSelectionWizardPage_CollectionClassLabel=Collection Class :
+JavaBeanSelectionWizardPage_CollectionComponentClassEmptyErrorMessage=Colletion component class is empty
+JavaBeanSelectionWizardPage_CollectionLabel=Collection
+JavaBeanSelectionWizardPage_QuoteChar="
+JavaBeanSelectionWizardPage_WizardDes=Specify the incoming Java Class sample for this configuration.
+JavaBeanSelectionWizardPage_WizardTitle=Input Java Class
+JavabeanStrucutredDataWizard_WizardTitle=Java Class Model Wizard
+JavaMethodsSelectionDialog_ErrorDialogTitle=Can't open dialog
+JavaMethodsSelectionDialog_ErrorMessage=Can't open java methods selection dialog.Please check the 'class' value of Java Object.
+JavaMethodsSelectionDialog_MethodNameColumnText=Method Name
+JavaMethodsSelectionDialog_MethodParamsColumnText=Paramters Type
+JavaMethodsSelectionDialog_SetterDialogTitle='s Setter Methods
+JavaPropertiesSelectionDialog_CantOpenDialogErrorMessage1=Can't get properties of '
+JavaPropertiesSelectionDialog_CantOpenDialogTitle=Can't open dialog
+JavaPropertiesSelectionDialog_DialogTitle='s Properties
+JavaPropertiesSelectionDialog_NameColumnText=Name
+JavaPropertiesSelectionDialog_ProjectisJavaProjectErrorMessage=Please make sure the project is the 'Java Project'
+JavaPropertiesSelectionDialog_TypeColumnText=Type
+PropertiesAndSetterMethodSearchFieldEditorCreator_BrowseButtonLabel=Browse
+ValueWiringBindingSelectionDialog_AddBindingLabel=Add Binding
+ValueWiringBindingSelectionDialog_DeselectAllLink=Deselect All
+ValueWiringBindingSelectionDialog_SelectAllLink=Select All
+ValueWiringBindingSelectionDialog_SelectJavaLabel=Choose Java bean property
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/JavaPropertiesProposalProvider.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/JavaPropertiesProposalProvider.java 2010-04-30 08:50:50 UTC (rev 21821)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/JavaPropertiesProposalProvider.java 2010-04-30 08:55:28 UTC (rev 21822)
@@ -21,8 +21,8 @@
import org.eclipse.jface.fieldassist.IContentProposal;
import org.eclipse.jface.fieldassist.IContentProposalProvider;
import org.jboss.tools.smooks.configuration.editors.IXMLStructuredObject;
-import org.jboss.tools.smooks.configuration.editors.javabean.JavaBeanModel;
-import org.jboss.tools.smooks.configuration.editors.javabean.JavaBeanModelFactory;
+import org.jboss.tools.smooks.configuration.editors.javabean12.JavaBeanModel;
+import org.jboss.tools.smooks.configuration.editors.javabean12.JavaBeanModelFactory;
/**
* @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 2010-04-30 08:50:50 UTC (rev 21821)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java 2010-04-30 08:55:28 UTC (rev 21822)
@@ -139,9 +139,9 @@
import org.jboss.tools.smooks.configuration.editors.SelectorCreationDialog;
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.javabean.JavaBeanModel;
-import org.jboss.tools.smooks.configuration.editors.javabean.JavaMethodsSelectionDialog;
-import org.jboss.tools.smooks.configuration.editors.javabean.JavaPropertiesSelectionDialog;
+import org.jboss.tools.smooks.configuration.editors.javabean12.JavaBeanModel;
+import org.jboss.tools.smooks.configuration.editors.javabean12.JavaMethodsSelectionDialog;
+import org.jboss.tools.smooks.configuration.editors.javabean12.JavaPropertiesSelectionDialog;
import org.jboss.tools.smooks.contentassist.TypeContentProposalListener;
import org.jboss.tools.smooks.contentassist.TypeContentProposalProvider;
import org.jboss.tools.smooks.contentassist.TypeProposalLabelProvider;
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/XMLStructuredModelProposal.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/XMLStructuredModelProposal.java 2010-04-30 08:50:50 UTC (rev 21821)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/XMLStructuredModelProposal.java 2010-04-30 08:55:28 UTC (rev 21822)
@@ -12,7 +12,7 @@
import org.eclipse.jface.fieldassist.IContentProposal;
import org.jboss.tools.smooks.configuration.editors.IXMLStructuredObject;
-import org.jboss.tools.smooks.configuration.editors.javabean.JavaBeanModel;
+import org.jboss.tools.smooks.configuration.editors.javabean12.JavaBeanModel;
/**
* @author Dart (dpeng(a)redhat.com)
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/wizard/ViewerInitorStore.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/wizard/ViewerInitorStore.java 2010-04-30 08:50:50 UTC (rev 21821)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/wizard/ViewerInitorStore.java 2010-04-30 08:55:28 UTC (rev 21822)
@@ -18,11 +18,10 @@
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.jboss.tools.smooks.configuration.editors.GraphicsConstants;
import org.jboss.tools.smooks.configuration.editors.csv12.CSV12InputDataWizard;
-import org.jboss.tools.smooks.configuration.editors.edi.EDIDataWizard;
-import org.jboss.tools.smooks.configuration.editors.edireader12.EDIReader12DataWizard;
-import org.jboss.tools.smooks.configuration.editors.javabean.JavabeanContentProvider;
-import org.jboss.tools.smooks.configuration.editors.javabean.JavabeanStrucutredDataWizard;
-import org.jboss.tools.smooks.configuration.editors.javabean.JavabeanlabelProvider;
+import org.jboss.tools.smooks.configuration.editors.edireader12.EDIDataWizard;
+import org.jboss.tools.smooks.configuration.editors.javabean12.JavabeanContentProvider;
+import org.jboss.tools.smooks.configuration.editors.javabean12.JavabeanStrucutredDataWizard;
+import org.jboss.tools.smooks.configuration.editors.javabean12.JavabeanlabelProvider;
import org.jboss.tools.smooks.configuration.editors.json12.Json12DataWizard;
import org.jboss.tools.smooks.configuration.editors.xml.XMLStructuredDataContentProvider;
import org.jboss.tools.smooks.configuration.editors.xml.XMLStructuredDataLabelProvider;
@@ -280,24 +279,6 @@
ediViewerInitor.setStructuredDataLoadWizard(new EDIDataWizard());
// jsonViewerInitor.setWizardIconPath(GraphicsConstants.IMAGE_JAVA_FILE);
map.put(typeID, ediViewerInitor);
-
- // for EDI 1.2
- BaseViewerInitor edi12ViewerInitor = new BaseViewerInitor();
- name = "EDI 1.2"; //$NON-NLS-1$
- description = "Select EDI data file as the input data. (version 1.2)"; //$NON-NLS-1$
- iconPath = null;
- typeID = SmooksModelUtils.INPUT_TYPE_EDI_1_2;
-
- edi12ViewerInitor.setName(name);
- edi12ViewerInitor.setDescription(description);
- edi12ViewerInitor.setWizardIconPath(iconPath);
- edi12ViewerInitor.setTypeID(typeID);
- edi12ViewerInitor.setLabelProvider(new XMLStructuredDataLabelProvider());
- edi12ViewerInitor.setTreeContentProvider(new XMLStructuredDataContentProvider());
- edi12ViewerInitor.setStructuredDataLoadWizard(new EDIReader12DataWizard());
- // jsonViewerInitor.setWizardIconPath(GraphicsConstants.IMAGE_JAVA_FILE);
- // map.put(typeID, edi12ViewerInitor);
-
return map;
}
}
Deleted: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XSLModelAnalyzer.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XSLModelAnalyzer.java 2010-04-30 08:50:50 UTC (rev 21821)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XSLModelAnalyzer.java 2010-04-30 08:55:28 UTC (rev 21822)
@@ -1,179 +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.xml;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.xml.parsers.DocumentBuilder;
-
-import org.apache.xerces.util.DOMEntityResolverWrapper;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- * @author Dart
- *
- */
-public class XSLModelAnalyzer {
-
- public static final String XSL_NAME_SPACE = "http://www.w3.org/1999/XSL/Transform"; //$NON-NLS-1$
-
- public static boolean isXSLElement(Element element) {
- if (element == null)
- return false;
- String nameSpace = element.getNamespaceURI();
- return isXSLNameSpaceURI(nameSpace);
- }
-
- public static boolean isXSLTagObject(AbstractXMLObject node) {
- if (node == null)
- return false;
- String nameSpace = node.getNamespaceURI();
- return isXSLNameSpaceURI(nameSpace);
- }
-
- public static boolean isXSLNameSpaceURI(String uri) {
- if (uri != null) {
- uri = uri.trim();
- if (XSL_NAME_SPACE.equals(uri)) {
- return true;
- }
- if("http://www.w3.org/TR/WD-xsl".equals(uri)){ //$NON-NLS-1$
- return true;
- }
- }
- return false;
- }
-//
-// public TagObject parse(IFile file) throws CoreException {
-// return parse(file.getContents());
-// }
-//
-// public TagObject parse(String filePath) throws FileNotFoundException {
-// File file = new File(filePath);
-// return parse(new FileInputStream(file));
-// }
-//
-// public TagObject parse(InputStream inputStream, String[] ignoreXSLElementnames) {
-// DocumentBuilder builder = XMLUtils.getDOMBuilder();
-// Document document = builder.parse(inputStream);//.read(inputStream);
-// Element rootElement = document.getDocumentElement();
-// Namespace namespace = rootElement.getNamespaceForURI("http://milyn.codehaus.org/Smooks"); //$NON-NLS-1$
-// TagObject tag = (TagObject) parseElement(rootElement, ignoreXSLElementnames, namespace);
-// return tag;
-// }
-//
-// public TagObject parse(InputStream inputStream) throws DocumentException {
-// return parse(inputStream, new String[] { "output", "value-of" }); //$NON-NLS-1$ //$NON-NLS-2$
-// }
-//
-// private boolean isIgnoreXSLTag(Element element, String[] ignoreXSLElementNames) {
-// if (isXSLElement(element) && ignoreXSLElementNames != null) {
-// for (int i = 0; i < ignoreXSLElementNames.length; i++) {
-// String name = ignoreXSLElementNames[i];
-// String en = element.getName();
-// if (en != null) {
-// en = en.trim();
-// }
-// if (name.equalsIgnoreCase(en)) {
-// return true;
-// }
-// }
-// }
-// return false;
-// }
-//
-// private TagObject createTagObject(Element element, boolean createAttributes, Namespace namespace) {
-// XSLTagObject tag = new XSLTagObject();
-// tag.setNameSpacePrefix(element.getNamespacePrefix());
-// tag.setName(element.getName());
-// tag.setNamespaceURI(element.getNamespaceURI());
-// tag.setReferenceElement(element);
-// if (namespace != null) {
-// tag.setSmooksPrix(namespace.getPrefix());
-// }
-// List<?> attributes = element.attributes();
-// if (createAttributes) {
-// for (Iterator<?> iterator = attributes.iterator(); iterator.hasNext();) {
-// Attribute attribute = (Attribute) iterator.next();
-// TagPropertyObject pro = new TagPropertyObject();
-// pro.setName(attribute.getName());
-// pro.setNamespaceURI(attribute.getNamespaceURI());
-// pro.setNameSpacePrefix(attribute.getNamespacePrefix());
-// pro.setValue(attribute.getValue());
-// pro.setReferenceAttibute(attribute);
-// ((TagObject) tag).addProperty(pro);
-// }
-// }
-//
-// return tag;
-// }
-//
-// private AbstractXMLObject parseElement(Element rootElement, String[] ignoreXSLElementNames) {
-// if (rootElement != null) {
-// AbstractXMLObject tag = null;
-// if (isIgnoreXSLTag(rootElement, ignoreXSLElementNames)) {
-// tag = new TagList();
-// } else {
-// tag = createTagObject(rootElement, true, namespace);
-// }
-//
-// List<?> childrenElements = rootElement.elements();
-// for (Iterator<?> iterator = childrenElements.iterator(); iterator.hasNext();) {
-// Element element = (Element) iterator.next();
-// TagObject xt = null;
-// if (isIgnoreXSLTag(element, ignoreXSLElementNames)) {
-// xt = createTagObject(element, true, namespace);
-// }
-// AbstractXMLObject t = parseElement(element, ignoreXSLElementNames, namespace);
-// if (t != null) {
-// if (tag instanceof TagList) {
-// if (t instanceof XSLTagObject) {
-// ((TagList) tag).addRootTag((TagObject) t);
-// ((XSLTagObject) tag).addRelatedIgnoreXSLTagObject(xt);
-// }
-// if (t instanceof TagList) {
-// List<TagObject> tagObjectList = ((TagList) t).getRootTagList();
-// for (Iterator<?> iterator2 = tagObjectList.iterator(); iterator2.hasNext();) {
-// TagObject tagObject = (TagObject) iterator2.next();
-// ((TagList) tag).addRootTag(tagObject);
-// }
-// }
-// }
-// if (tag instanceof XSLTagObject) {
-// ((XSLTagObject) tag).addRelatedIgnoreXSLTagObject(xt);
-// if (t instanceof TagObject) {
-// ((TagObject) tag).addChildTag((TagObject) t);
-// }
-// if (t instanceof TagList) {
-// List<TagObject> tagObjectList = ((TagList) t).getRootTagList();
-// for (Iterator<?> iterator2 = tagObjectList.iterator(); iterator2.hasNext();) {
-// TagObject tagObject = (TagObject) iterator2.next();
-// ((TagObject) tag).addChildTag(tagObject);
-// }
-// }
-// }
-// }
-// }
-//
-// return tag;
-// }
-//
-// return null;
-// }
-}
Deleted: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XSLTagObject.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XSLTagObject.java 2010-04-30 08:50:50 UTC (rev 21821)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xml/XSLTagObject.java 2010-04-30 08:55:28 UTC (rev 21822)
@@ -1,205 +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.xml;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.w3c.dom.Attr;
-import org.w3c.dom.Element;
-
-/**
- * @author Dart
- *
- */
-public class XSLTagObject extends TagObject {
-
- private List<TagObject> relatedIgnoreXSLTagObjects = new ArrayList<TagObject>();
-
- private String smooksPrix = null;
-
- /**
- * @return the smooksPrix
- */
- public String getSmooksPrix() {
- return smooksPrix;
- }
-
- /**
- * @param smooksPrix
- * the smooksPrix to set
- */
- public void setSmooksPrix(String smooksPrix) {
- this.smooksPrix = smooksPrix;
- }
-
- public void addRelatedIgnoreXSLTagObject(TagObject tag) {
- if (tag == null)
- return;
- relatedIgnoreXSLTagObjects.add(tag);
- }
-
- public void removeRelatedIgnoreXSLTagObject(TagObject tag) {
- relatedIgnoreXSLTagObjects.remove(tag);
- }
-
- /**
- * @return the relatedIgnoreXSLTagObjects
- */
- public List<TagObject> getRelatedIgnoreXSLTagObjects() {
- return relatedIgnoreXSLTagObjects;
- }
-
- public String getSelectValue() {
- List<TagPropertyObject> properties = this.getProperties();
- for (Iterator<?> iterator = properties.iterator(); iterator.hasNext();) {
- TagPropertyObject tagPropertyObject = (TagPropertyObject) iterator.next();
- if (tagPropertyObject.getName().equalsIgnoreCase("select")) { //$NON-NLS-1$
- return tagPropertyObject.getValue();
- }
- }
- return null;
- }
-
- public void removeSelectProperty() {
- TagPropertyObject tagPropertyObject = null;
- List<TagPropertyObject> properties = this.getProperties();
- for (Iterator<?> iterator = properties.iterator(); iterator.hasNext();) {
- TagPropertyObject tagPropertyObject1 = (TagPropertyObject) iterator.next();
- if (tagPropertyObject1.getName().equalsIgnoreCase("select")) { //$NON-NLS-1$
- tagPropertyObject = tagPropertyObject1;
- break;
- }
- }
- if (tagPropertyObject != null) {
- Element parentElement = this.getReferenceElement();
- Attr att = tagPropertyObject.getReferenceAttibute();
- parentElement.removeAttributeNode(att);
- this.removeProperty(tagPropertyObject);
- }
- }
-
- public void removeMatchProperty() {
- TagPropertyObject tagPropertyObject = null;
- List<TagPropertyObject> properties = this.getProperties();
- for (Iterator<?> iterator = properties.iterator(); iterator.hasNext();) {
- TagPropertyObject tagPropertyObject1 = (TagPropertyObject) iterator.next();
- if (tagPropertyObject1.getName().equalsIgnoreCase("match")) { //$NON-NLS-1$
- tagPropertyObject = tagPropertyObject1;
- break;
- }
- }
- if (tagPropertyObject != null) {
- Element parentElement = this.getReferenceElement();
- Attr att = tagPropertyObject.getReferenceAttibute();
- parentElement.removeAttributeNode(att);
- this.removeProperty(tagPropertyObject);
- }
- }
-
- public void setSelectValue(String value) {
- if (value == null) {
- removeSelectProperty();
- return;
- }
- TagPropertyObject tagPropertyObject = null;
- List<TagPropertyObject> properties = this.getProperties();
- for (Iterator<?> iterator = properties.iterator(); iterator.hasNext();) {
- TagPropertyObject tagPropertyObject1 = (TagPropertyObject) iterator.next();
- if (tagPropertyObject1.getName().equalsIgnoreCase("select")) { //$NON-NLS-1$
- tagPropertyObject = tagPropertyObject1;
- break;
- }
- }
- if (tagPropertyObject == null) {
- tagPropertyObject = new TagPropertyObject();
- Element parentElement = this.getReferenceElement();
- Attr attribute = parentElement.getOwnerDocument().createAttribute("select");//.createAttribute(parentElement, new QName("select"), value); //$NON-NLS-1$
- attribute.setNodeValue(value);
- tagPropertyObject.setReferenceAttibute(attribute);
- parentElement.appendChild(attribute);
- this.addProperty(tagPropertyObject);
-
- }
- tagPropertyObject.setValue(value);
- }
-
- public void setMatchValue(String value) {
- TagPropertyObject tagPropertyObject = null;
- List<TagPropertyObject> properties = this.getProperties();
- for (Iterator<?> iterator = properties.iterator(); iterator.hasNext();) {
- TagPropertyObject tagPropertyObject1 = (TagPropertyObject) iterator.next();
- if (tagPropertyObject1.getName().equalsIgnoreCase("match")) { //$NON-NLS-1$
- tagPropertyObject = tagPropertyObject1;
- break;
- }
- }
- if (tagPropertyObject == null) {
- tagPropertyObject = new TagPropertyObject();
- Element parentElement = this.getReferenceElement();
- Attr attribute = parentElement.getOwnerDocument().createAttribute("match");//.createAttribute(parentElement, new QName("select"), value); //$NON-NLS-1$
- attribute.setNodeValue(value);
- parentElement.appendChild(attribute);
- tagPropertyObject.setReferenceAttibute(attribute);
- this.addProperty(tagPropertyObject);
- }
- tagPropertyObject.setValue(value);
- }
-
- public boolean isChoiceElement() {
- return "choose".equalsIgnoreCase(this.getName()) && isXSLTag(); //$NON-NLS-1$
- }
-
- public boolean isIfElement() {
- return "if".equalsIgnoreCase(this.getName()) && isXSLTag(); //$NON-NLS-1$
- }
-
- public boolean isSortElement() {
- return "sort".equalsIgnoreCase(this.getName()) && isXSLTag(); //$NON-NLS-1$
- }
-
- public boolean isForeachElement() {
- return "for-each".equalsIgnoreCase(this.getName()) && isXSLTag(); //$NON-NLS-1$
- }
-
- public boolean isValueOfElement() {
- return "value-of".equalsIgnoreCase(this.getName()) && isXSLTag(); //$NON-NLS-1$
- }
-
- public boolean isTemplateElement() {
- return "template".equalsIgnoreCase(this.getName()) && isXSLTag(); //$NON-NLS-1$
- }
-
- public boolean isApplyTemplatesElement() {
- return "apply-templates".equalsIgnoreCase(this.getName()) && isXSLTag(); //$NON-NLS-1$
- }
-
- public String getMatchValue() {
- List<TagPropertyObject> properties = this.getProperties();
- for (Iterator<?> iterator = properties.iterator(); iterator.hasNext();) {
- TagPropertyObject tagPropertyObject = (TagPropertyObject) iterator.next();
- if (tagPropertyObject.getName().equalsIgnoreCase("match")) { //$NON-NLS-1$
- return tagPropertyObject.getValue();
- }
- }
- return null;
- }
-
- public boolean isXSLTag() {
- return XSLModelAnalyzer.isXSLTagObject(this);
- }
-
- public boolean isStyleSheetElement() {
- return "stylesheet".equalsIgnoreCase(this.getName()) && isXSLTag(); //$NON-NLS-1$
- }
-
-}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/ConnectionModelFactoryImpl.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/ConnectionModelFactoryImpl.java 2010-04-30 08:50:50 UTC (rev 21821)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/ConnectionModelFactoryImpl.java 2010-04-30 08:55:28 UTC (rev 21822)
@@ -20,9 +20,7 @@
import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
import org.jboss.tools.smooks.configuration.editors.IXMLStructuredObject;
import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
-import org.jboss.tools.smooks.configuration.editors.xml.TagObject;
import org.jboss.tools.smooks.configuration.editors.xml.TagPropertyObject;
-import org.jboss.tools.smooks.configuration.editors.xml.XSLTagObject;
import org.jboss.tools.smooks.gef.common.RootModel;
import org.jboss.tools.smooks.gef.model.AbstractSmooksGraphicalModel;
import org.jboss.tools.smooks.gef.tree.model.BeanReferenceConnection;
@@ -258,41 +256,7 @@
AbstractSmooksGraphicalModel model) {
List<TreeNodeConnection> connections = new ArrayList<TreeNodeConnection>();
Object data = model.getData();
- if (data instanceof XSLTagObject) {
- List<TagObject> list = ((XSLTagObject) data).getRelatedIgnoreXSLTagObjects();
- for (Iterator<?> iterator = list.iterator(); iterator.hasNext();) {
- XSLTagObject tagObject = (XSLTagObject) iterator.next();
- String select = null;
- if (tagObject.isValueOfElement()) {
- select = tagObject.getSelectValue();
- }
- if (select != null) {
- select = select.trim();
- select = processSelectString(select, tagObject.getSmooksPrix());
- fillSelectorConnection(inputDataList, root, model, select, connections);
- }
- }
- if (((XSLTagObject) data).isTemplateElement()) {
- String select = ((XSLTagObject) data).getMatchValue();
- if (select != null) {
- select = select.trim();
- select = processSelectString(select, ((XSLTagObject) data).getSmooksPrix());
- fillSelectorConnection(inputDataList, root, model, select, connections);
- }
- }
-
- if (((XSLTagObject) data).isSortElement() || ((XSLTagObject) data).isForeachElement()) {
- String select = ((XSLTagObject) data).getSelectValue();
- if (select != null) {
- select = select.trim();
- select = processSelectString(select, ((XSLTagObject) data).getSmooksPrix());
- fillSelectorConnection(inputDataList, root, model, select, connections);
- }
- }
-
- }
-
if (data instanceof TagPropertyObject) {
TagPropertyObject tagPropertyObject = (TagPropertyObject) data;
String value = tagPropertyObject.getValue();
@@ -307,18 +271,6 @@
return connections;
}
- public boolean hasXSLConnection(AbstractSmooksGraphicalModel model) {
- Object data = model.getData();
- if (data instanceof XSLTagObject) {
- return true;
- }
- if (data instanceof TagPropertyObject) {
- if (((TagPropertyObject) data).getParent() instanceof XSLTagObject)
- return true;
- }
- return false;
- }
-
public Collection<TreeNodeConnection> createConnection(List<Object> inputDataList, EObject rootModel,
RootModel root, AbstractSmooksGraphicalModel model) {
Collection<TreeNodeConnection> allconnections = new ArrayList<TreeNodeConnection>();
@@ -340,6 +292,6 @@
}
public boolean hasConnection(AbstractSmooksGraphicalModel model) {
- return hasBeanIDConnection(model) || hasSelectorConnection(model) || hasXSLConnection(model);
+ return hasBeanIDConnection(model) || hasSelectorConnection(model);
}
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksGraphicalEditorMenuContextProvider.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksGraphicalEditorMenuContextProvider.java 2010-04-30 08:50:50 UTC (rev 21821)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksGraphicalEditorMenuContextProvider.java 2010-04-30 08:55:28 UTC (rev 21822)
@@ -21,8 +21,6 @@
import org.jboss.tools.smooks.gef.common.SmooksGraphicalMenuContextProvider;
import org.jboss.tools.smooks.graphical.actions.AddSmooksModelAction;
import org.jboss.tools.smooks.graphical.actions.AutoLayoutAction;
-import org.jboss.tools.smooks.graphical.actions.xsltemplate.AddAttributeAction;
-import org.jboss.tools.smooks.graphical.actions.xsltemplate.AddElementAction;
/**
* @author Dart
@@ -41,25 +39,24 @@
menu.appendToGroup(GROUP_CUSTOME, addChildActionMenu);
Iterator<?> iterator = getActionRegistry().getActions();
+// while (iterator.hasNext()) {
+// Object obj = iterator.next();
+// if (obj instanceof AddSmooksModelAction) {
+// if (((IAction) obj).isEnabled()
+// && (obj instanceof AddElementAction || obj instanceof AddAttributeAction)) {
+// addChildActionMenu.add((IAction) obj);
+// }
+// }
+// }
+// iterator = getActionRegistry().getActions();
while (iterator.hasNext()) {
Object obj = iterator.next();
if (obj instanceof AddSmooksModelAction) {
- if (((IAction) obj).isEnabled()
- && (obj instanceof AddElementAction || obj instanceof AddAttributeAction)) {
+ if (((IAction) obj).isEnabled()){// && !(obj instanceof AddElementAction || obj instanceof AddAttributeAction)) {
addChildActionMenu.add((IAction) obj);
}
}
}
- iterator = getActionRegistry().getActions();
- while (iterator.hasNext()) {
- Object obj = iterator.next();
- if (obj instanceof AddSmooksModelAction) {
- if (((IAction) obj).isEnabled()
- && !(obj instanceof AddElementAction || obj instanceof AddAttributeAction)) {
- addChildActionMenu.add((IAction) obj);
- }
- }
- }
IAction action = getActionRegistry().getAction(AutoLayoutAction.ID);
if (action != null) {
menu.appendToGroup(GEFActionConstants.GROUP_VIEW, action);
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksGraphicalEditorPart.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksGraphicalEditorPart.java 2010-04-30 08:50:50 UTC (rev 21821)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksGraphicalEditorPart.java 2010-04-30 08:55:28 UTC (rev 21822)
@@ -76,9 +76,9 @@
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.jboss.tools.smooks.configuration.editors.IXMLStructuredObject;
import org.jboss.tools.smooks.configuration.editors.SelectorCreationDialog;
-import org.jboss.tools.smooks.configuration.editors.javabean.JavaBeanModel;
-import org.jboss.tools.smooks.configuration.editors.javabean.JavabeanContentProvider;
-import org.jboss.tools.smooks.configuration.editors.javabean.JavabeanlabelProvider;
+import org.jboss.tools.smooks.configuration.editors.javabean12.JavaBeanModel;
+import org.jboss.tools.smooks.configuration.editors.javabean12.JavabeanContentProvider;
+import org.jboss.tools.smooks.configuration.editors.javabean12.JavabeanlabelProvider;
import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
import org.jboss.tools.smooks.configuration.editors.xml.XMLStructuredDataContentProvider;
import org.jboss.tools.smooks.configuration.editors.xml.XMLStructuredDataLabelProvider;
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksJavaMappingGraphicalEditor.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksJavaMappingGraphicalEditor.java 2010-04-30 08:50:50 UTC (rev 21821)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/SmooksJavaMappingGraphicalEditor.java 2010-04-30 08:55:28 UTC (rev 21822)
@@ -203,19 +203,6 @@
private class JavaMappingConnectionModelFactory extends ConnectionModelFactoryImpl {
- /*
- * (non-Javadoc)
- *
- * @see
- * org.jboss.tools.smooks.graphical.editors.ConnectionModelFactoryImpl
- * #hasXSLConnection
- * (org.jboss.tools.smooks.gef.model.AbstractSmooksGraphicalModel)
- */
- @Override
- public boolean hasXSLConnection(AbstractSmooksGraphicalModel model) {
- return false;
- }
-
}
private class JavaMappingGraphicalModelFactory extends GraphicalModelFactoryImpl {
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/commands/CreateJavaBeanModelCommand.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/commands/CreateJavaBeanModelCommand.java 2010-04-30 08:50:50 UTC (rev 21821)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/commands/CreateJavaBeanModelCommand.java 2010-04-30 08:55:28 UTC (rev 21822)
@@ -25,7 +25,7 @@
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.ui.IEditorPart;
-import org.jboss.tools.smooks.configuration.editors.javabean.JavaBeanModel;
+import org.jboss.tools.smooks.configuration.editors.javabean12.JavaBeanModel;
import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
import org.jboss.tools.smooks.editor.ISmooksModelProvider;
import org.jboss.tools.smooks.gef.tree.command.GEFAdapterCommand;
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/model/InputDataTreeNodeModel.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/model/InputDataTreeNodeModel.java 2010-04-30 08:50:50 UTC (rev 21821)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/model/InputDataTreeNodeModel.java 2010-04-30 08:55:28 UTC (rev 21822)
@@ -16,8 +16,6 @@
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
import org.jboss.tools.smooks.configuration.editors.xml.TagPropertyObject;
-import org.jboss.tools.smooks.configuration.editors.xml.XSLModelAnalyzer;
-import org.jboss.tools.smooks.configuration.editors.xml.XSLTagObject;
import org.jboss.tools.smooks.gef.model.AbstractSmooksGraphicalModel;
import org.jboss.tools.smooks.gef.tree.model.TreeNodeModel;
@@ -78,16 +76,6 @@
return true;
}
}
- if (data instanceof XSLTagObject) {
- if (XSLModelAnalyzer.isXSLTagObject((XSLTagObject) data)) {
- if (((XSLTagObject) data).isForeachElement() || ((XSLTagObject) data).isTemplateElement()
- || ((XSLTagObject) data).isSortElement()) {
- return true;
- }
- } else {
- return true;
- }
- }
if (data instanceof TagPropertyObject) {
return true;
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/model/freemarker/FreemarkerContentProvider.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/model/freemarker/FreemarkerContentProvider.java 2010-04-30 08:50:50 UTC (rev 21821)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/model/freemarker/FreemarkerContentProvider.java 2010-04-30 08:55:28 UTC (rev 21822)
@@ -14,18 +14,13 @@
import java.util.List;
import java.util.Map;
-import org.eclipse.emf.edit.command.AddCommand;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;
-import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
-import org.jboss.tools.smooks.configuration.editors.xml.AbstractXMLObject;
import org.jboss.tools.smooks.configuration.editors.xml.XMLStructuredDataContentProvider;
-import org.jboss.tools.smooks.configuration.editors.xml.XSLModelAnalyzer;
import org.jboss.tools.smooks.model.freemarker.Freemarker;
import org.jboss.tools.smooks.model.freemarker.Template;
import org.jboss.tools.smooks.model.smooks.ParamType;
import org.jboss.tools.smooks.model.smooks.SmooksFactory;
-import org.jboss.tools.smooks10.model.smooks.util.SmooksModelConstants;
import org.jboss.tools.smooks10.model.smooks.util.SmooksModelUtils;
/**
@@ -68,53 +63,11 @@
ParamType param = SmooksFactory.eINSTANCE.createParamType();
param.setName("name"); //$NON-NLS-1$
- param.setStringValue("aaa"); //$NON-NLS-1$
+ param.setStringValue("value"); //$NON-NLS-1$
-
- System.out.println(comments);
-// if (obj == null) {
-// String filePath = SmooksModelUtils.getAnyTypeText(template);
-// if(filePath != null) filePath = filePath.trim();
-// if (filePath != null && !"".equals(filePath)) {
-// IFile file = SmooksUIUtils.getFile(filePath, SmooksUIUtils.getResource(template).getProject());
-// if (file != null && XSLCore.isXSLFile(file)) {
-// XSLModelAnalyzer analyzer = new XSLModelAnalyzer();
-// try {
-// obj = analyzer.parse(file.getContents());
-// } catch (DocumentException e) {
-// // TODO Auto-generated catch block
-// e.printStackTrace();
-// } catch (CoreException e) {
-// // TODO Auto-generated catch block
-// e.printStackTrace();
-// }
-// }
-// }else{
-// String contents = SmooksModelUtils.getAnyTypeCDATA(template);
-// if(contents != null){
-// XSLModelAnalyzer analyzer = new XSLModelAnalyzer();
-// try {
-// obj = analyzer.parse(new ByteArrayInputStream(contents.getBytes()));
-// } catch (DocumentException e) {
-// // TODO Auto-generated catch block
-// e.printStackTrace();
-// }
-// }
-// }
-// }
-//
-// if (obj != null) {
-// buffer.put(template, obj);
-// return new Object[] { obj };
-// }
}
return new Object[] {};
}
-
- if(parentElement instanceof AbstractXMLObject && XSLModelAnalyzer.isXSLTagObject((AbstractXMLObject)parentElement)){
- return ((AbstractXMLObject)parentElement).getXMLNodeChildren().toArray();
- }
-
return xmlObjectContentProvider.getChildren(parentElement);
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/wizards/JavaBeanCreationWizard.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/wizards/JavaBeanCreationWizard.java 2010-04-30 08:50:50 UTC (rev 21821)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/wizards/JavaBeanCreationWizard.java 2010-04-30 08:55:28 UTC (rev 21822)
@@ -16,7 +16,7 @@
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jdt.core.IJavaProject;
-import org.jboss.tools.smooks.configuration.editors.javabean.JavaBeanModel;
+import org.jboss.tools.smooks.configuration.editors.javabean12.JavaBeanModel;
import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
import org.jboss.tools.smooks.editor.ISmooksModelProvider;
import org.jboss.tools.smooks.model.javabean12.BeanType;
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/wizards/JavaBeanCreationWizardPage.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/wizards/JavaBeanCreationWizardPage.java 2010-04-30 08:50:50 UTC (rev 21821)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/wizards/JavaBeanCreationWizardPage.java 2010-04-30 08:55:28 UTC (rev 21822)
@@ -42,10 +42,10 @@
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.TreeItem;
-import org.jboss.tools.smooks.configuration.editors.javabean.JavaBeanModel;
-import org.jboss.tools.smooks.configuration.editors.javabean.JavaBeanModelFactory;
-import org.jboss.tools.smooks.configuration.editors.javabean.JavabeanContentProvider;
-import org.jboss.tools.smooks.configuration.editors.javabean.JavabeanlabelProvider;
+import org.jboss.tools.smooks.configuration.editors.javabean12.JavaBeanModel;
+import org.jboss.tools.smooks.configuration.editors.javabean12.JavaBeanModelFactory;
+import org.jboss.tools.smooks.configuration.editors.javabean12.JavabeanContentProvider;
+import org.jboss.tools.smooks.configuration.editors.javabean12.JavabeanlabelProvider;
import org.jboss.tools.smooks.configuration.editors.uitls.JavaTypeFieldDialog;
import org.jboss.tools.smooks.configuration.editors.uitls.ProjectClassLoader;
14 years, 8 months
JBoss Tools SVN: r21821 - in trunk/jst/tests/org.jboss.tools.ui.bot.ext: src/org/jboss/tools/ui/bot/ext and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: lzoubek(a)redhat.com
Date: 2010-04-30 04:50:50 -0400 (Fri, 30 Apr 2010)
New Revision: 21821
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/resources/SWTBotTest-default.properties
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/RequirementAwareSuite.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/TestConfigurator.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/ClearWorkspace.java
Log:
SWTBot extensions : do not run any test class, when configuration is incorrect
Modified: trunk/jst/tests/org.jboss.tools.ui.bot.ext/resources/SWTBotTest-default.properties
===================================================================
--- trunk/jst/tests/org.jboss.tools.ui.bot.ext/resources/SWTBotTest-default.properties 2010-04-30 08:29:42 UTC (rev 21820)
+++ trunk/jst/tests/org.jboss.tools.ui.bot.ext/resources/SWTBotTest-default.properties 2010-04-30 08:50:50 UTC (rev 21821)
@@ -1,4 +1,5 @@
# SWTBotTest properties
+# all defined paths should exist
JAVA_HOME_15=/usr/java/jdk-1.5.0_12/jre
JAVA_HOME_16=/opt/sun-jdk-1.6.0.19/jre
# EAP|JBOSS_AS,<server version>,<jre version to run with>|default,<server home>
Modified: trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/RequirementAwareSuite.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/RequirementAwareSuite.java 2010-04-30 08:29:42 UTC (rev 21820)
+++ trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/RequirementAwareSuite.java 2010-04-30 08:50:50 UTC (rev 21821)
@@ -40,7 +40,7 @@
// adding ability to create screen shot (taken from SWTBotJunit4ClassRunner)
RunListener failureSpy = new ScreenshotCaptureListener();
notifier.removeListener(failureSpy);
- notifier.addListener(failureSpy);
+ notifier.addListener(failureSpy);
try {
super.run(notifier);
}
@@ -57,7 +57,7 @@
r.fulfill();
}
} catch (Exception e) {
- log.error("Fulfilling failed", e);
+ log.error("Fulfilling failed", e);
}
return super.withBeforeClasses(statement);
@@ -73,11 +73,15 @@
List<RequirementBase> reqs = TestConfigurator
.getClassRequirements(klass);
if (reqs != null) {
+ if (!TestConfigurator.checkConfig()) {
+ log.info("Skipping class '" + klass.getCanonicalName()+"' - incorrect configuration");
+ return null;
+ }
log.info("Returning runner for test class "
+ klass.getCanonicalName());
- return new ReqAwareClassRunner(klass, reqs);
+ return new ReqAwareClassRunner(klass, reqs);
}
- log.info("Skipping test class " + klass.getCanonicalName());
+ log.info("Skipping class '" + klass.getCanonicalName() + "' - annotations do not met configuration");
return null;
}
Modified: trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/TestConfigurator.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/TestConfigurator.java 2010-04-30 08:29:42 UTC (rev 21820)
+++ trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/TestConfigurator.java 2010-04-30 08:50:50 UTC (rev 21821)
@@ -9,6 +9,8 @@
import java.util.Comparator;
import java.util.List;
import java.util.Properties;
+
+import org.apache.log4j.Logger;
import org.jboss.tools.ui.bot.ext.Activator;
import org.jboss.tools.ui.bot.ext.SWTTestExt;
import org.jboss.tools.ui.bot.ext.config.Annotations.SWTBotTestRequires;
@@ -18,7 +20,8 @@
import org.jboss.tools.ui.bot.ext.config.requirement.RequirementBase;
public class TestConfigurator {
-
+ private static final Logger log = Logger
+ .getLogger(TestConfigurator.class);
public class Keys {
public static final String SERVER = "SERVER";
public static final String SEAM = "SEAM";
@@ -41,9 +44,14 @@
// try to load from file first
String propFile = System.getProperty(SWTBOT_TEST_PROPERTIES_FILE,
null);
- if (propFile != null && new File(propFile).exists()) {
+ if (propFile != null) {
try {
+ if (new File(propFile).exists()) {
+ log.info("Loading exeternaly provided configuration file '"+propFile+"'");
swtTestProperties.load(new FileInputStream(propFile));
+ } else {
+ throw new IOException(SWTBOT_TEST_PROPERTIES_FILE+" "+propFile+" does not exist!");
+ }
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -53,6 +61,7 @@
}
} else {
try {
+ log.info("Loading default configuration");
swtTestProperties.load(new FileInputStream(SWTTestExt.util
.getResourceFile(Activator.PLUGIN_ID,
"/SWTBotTest-default.properties")));
@@ -74,7 +83,29 @@
e.printStackTrace();
}
}
-
+/**
+ * check config values if they seem to be valid (existing dirs)
+ * @throws FileNotFoundException
+ */
+ public static boolean checkConfig() {
+ try {
+ checkDirExists(getProperty(Keys.JAVA_HOME_15));
+ checkDirExists(getProperty(Keys.JAVA_HOME_16));
+ checkDirExists(seam.seamHome);
+ checkDirExists(server.runtimeHome);
+ return true;
+ }
+ catch (Exception ex) {
+ log.error(ex.getMessage()+ " incorrect configuration, set your custom properties file via 'swtbot.test.properties.file' java property");
+ return false;
+ }
+
+ }
+ private static void checkDirExists(String dir) throws FileNotFoundException {
+ if (!new File(dir).exists() || !new File(dir).isDirectory()) {
+ throw new FileNotFoundException("File '"+dir+"' does not exist or is not directory");
+ }
+ }
/**
* returns null when given Server annotation does not match global test
* configuration (e.g. Test wants Server type EAP but we are running on
Modified: trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/ClearWorkspace.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/ClearWorkspace.java 2010-04-30 08:29:42 UTC (rev 21820)
+++ trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/ClearWorkspace.java 2010-04-30 08:50:50 UTC (rev 21821)
@@ -10,7 +10,7 @@
@Override
public boolean checkFulfilled() {
try {
- return SWTTestExt.bot.shells().length>=2 && SWTTestExt.bot.editors().isEmpty() && !SWTTestExt.configuredState.isWelcomeViewVisible();
+ return SWTTestExt.bot.shells().length==2 && SWTTestExt.bot.editors().isEmpty() && !SWTTestExt.configuredState.isWelcomeViewVisible();
}
catch (Exception ex) {
log.error("Cannot determine, if all editors and shells are closed", ex);
14 years, 8 months
JBoss Tools SVN: r21820 - in trunk/smooks/tests/org.jboss.tools.smooks.core.test/src/org/jboss/tools/smooks/test: ediparser and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2010-04-30 04:29:42 -0400 (Fri, 30 Apr 2010)
New Revision: 21820
Modified:
trunk/smooks/tests/org.jboss.tools.smooks.core.test/src/org/jboss/tools/smooks/test/csvparser/CsvParserTest.java
trunk/smooks/tests/org.jboss.tools.smooks.core.test/src/org/jboss/tools/smooks/test/ediparser/EDIParserTest.java
Log:
JBIDE-5983
remove unused codes
Modified: trunk/smooks/tests/org.jboss.tools.smooks.core.test/src/org/jboss/tools/smooks/test/csvparser/CsvParserTest.java
===================================================================
--- trunk/smooks/tests/org.jboss.tools.smooks.core.test/src/org/jboss/tools/smooks/test/csvparser/CsvParserTest.java 2010-04-30 08:14:42 UTC (rev 21819)
+++ trunk/smooks/tests/org.jboss.tools.smooks.core.test/src/org/jboss/tools/smooks/test/csvparser/CsvParserTest.java 2010-04-30 08:29:42 UTC (rev 21820)
@@ -16,7 +16,7 @@
import org.eclipse.emf.ecore.resource.Resource;
import org.jboss.tools.smooks.configuration.editors.IXMLStructuredObject;
-import org.jboss.tools.smooks.configuration.editors.csv.CSVDataParser;
+import org.jboss.tools.smooks.configuration.editors.csv12.CSVDataParser;
import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
import org.jboss.tools.smooks.configuration.editors.xml.TagList;
import org.jboss.tools.smooks.model.smooks.SmooksResourceListType;
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 2010-04-30 08:14:42 UTC (rev 21819)
+++ trunk/smooks/tests/org.jboss.tools.smooks.core.test/src/org/jboss/tools/smooks/test/ediparser/EDIParserTest.java 2010-04-30 08:29:42 UTC (rev 21820)
@@ -19,7 +19,7 @@
import org.eclipse.emf.ecore.resource.Resource;
import org.jboss.tools.smooks.configuration.editors.IXMLStructuredObject;
-import org.jboss.tools.smooks.configuration.editors.edi.EDIDataParser;
+import org.jboss.tools.smooks.configuration.editors.edireader12.EDIDataParser;
import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
import org.jboss.tools.smooks.configuration.editors.xml.TagList;
import org.jboss.tools.smooks.model.smooks.SmooksResourceListType;
14 years, 8 months
JBoss Tools SVN: r21819 - trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2010-04-30 04:14:42 -0400 (Fri, 30 Apr 2010)
New Revision: 21819
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ExpressionHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPExprHyperlinkPartitioner.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-6179
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ExpressionHyperlink.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ExpressionHyperlink.java 2010-04-30 07:00:07 UTC (rev 21818)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/ExpressionHyperlink.java 2010-04-30 08:14:42 UTC (rev 21819)
@@ -40,7 +40,7 @@
ELInvocationExpression invocationExpression = JSPExprHyperlinkPartitioner.getInvocationExpression(eStructure.reference, eStructure.expression, offset);
if(invocationExpression != null){
for(ELResolver resolver : context.getElResolvers()){
- ELResolution resolution = resolver.resolve(context, invocationExpression, invocationExpression.getStartPosition());
+ ELResolution resolution = resolver.resolve(context, invocationExpression, offset);
if(resolution==null) {
return null;
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPExprHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPExprHyperlinkPartitioner.java 2010-04-30 07:00:07 UTC (rev 21818)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPExprHyperlinkPartitioner.java 2010-04-30 08:14:42 UTC (rev 21819)
@@ -11,6 +11,7 @@
package org.jboss.tools.jsf.text.ext.hyperlink;
import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.jboss.tools.common.el.core.ELReference;
import org.jboss.tools.common.el.core.model.ELExpression;
@@ -26,6 +27,7 @@
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkPartitionRecognizer;
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
+import org.jboss.tools.jsf.text.ext.JSFExtensionsPlugin;
import org.jboss.tools.jst.text.ext.hyperlink.jsp.JSPRootHyperlinkPartitioner;
import org.jboss.tools.jst.web.kb.PageContextFactory;
@@ -36,10 +38,18 @@
public class JSPExprHyperlinkPartitioner extends AbstractHyperlinkPartitioner implements IHyperlinkPartitionRecognizer, IExclusiblePartitionerRecognition {
public static final String JSP_EXPRESSION_PARTITION = "org.jboss.tools.common.text.ext.jsp.JSP_EXPRESSION"; //$NON-NLS-1$
public static final String EXPRESSION_PARTITION = "org.jboss.tools.common.text.ext.jsp.EXPRESSION"; //$NON-NLS-1$
+ public static final String DOT_EXPRESSION_PARTITION = "org.jboss.tools.common.text.ext.jsp.DOT_EXPRESSION"; //$NON-NLS-1$
+ private static final String DOT = ".";
+
private boolean jspExpression = false;
+
+ private boolean dotExpression = false;
protected String getPartitionType() {
+ if(dotExpression)
+ return DOT_EXPRESSION_PARTITION;
+
if(jspExpression)
return EXPRESSION_PARTITION;
else
@@ -78,12 +88,14 @@
if(eStructure != null){
ELInvocationExpression invocationExpression = getInvocationExpression(eStructure.reference, eStructure.expression, offset);
if(invocationExpression != null){
- jspExpression = decide(context, eStructure.expression, invocationExpression, offset-eStructure.reference.getStartPosition());
+ jspExpression = decide(context, eStructure.expression, invocationExpression, offset-eStructure.reference.getStartPosition(), offset);
if(jspExpression){
IHyperlinkRegion region = new HyperlinkRegion(invocationExpression.getStartPosition(), invocationExpression.getLength(), null, null, null);
return region;
}
}
+ dotExpression = checkDot(document, offset, context, eStructure.expression, invocationExpression, offset-eStructure.reference.getStartPosition(), offset);
+
IHyperlinkRegion region = new HyperlinkRegion(eStructure.expression.getStartPosition(), eStructure.expression.getLength(), null, null, null);
return region;
}
@@ -127,14 +139,14 @@
return null;
}
- public boolean decide(ELContext context, ELExpression expression, ELInvocationExpression invocationExpression, int offset){
+ public boolean decide(ELContext context, ELExpression expression, ELInvocationExpression invocationExpression, int offset, int globalOffset){
for(ELResolver resolver : context.getElResolvers()){
- ELResolution resolution = resolver.resolve(context, invocationExpression, invocationExpression.getStartPosition());
+ ELResolution resolution = resolver.resolve(context, invocationExpression, globalOffset);
if(resolution==null) {
return false;
}
ELSegment segment = resolution.findSegmentByOffset(offset);
- if(segment != null){
+ if(segment != null && segment.isResolved()){
if(segment instanceof JavaMemberELSegment){
JavaMemberELSegment javaSegment = (JavaMemberELSegment)segment;
if(javaSegment.getJavaElement() != null){
@@ -146,6 +158,21 @@
return false;
}
+ public boolean checkDot(IDocument document, int superOffset, ELContext context, ELExpression expression, ELInvocationExpression invocationExpression, int offset, int globalOffset){
+ try{
+ String text = document.get(superOffset, 1);
+ if(DOT.equals(text)){
+ if(decide(context, expression, invocationExpression, offset+1, globalOffset))
+ return true;
+ else if(decide(context, expression, invocationExpression, offset-1, globalOffset))
+ return true;
+ }
+ }catch(BadLocationException ex){
+ JSFExtensionsPlugin.log(ex);
+ }
+ return false;
+ }
+
/**
* @see com.ibm.sse.editor.extensions.hyperlink.IHyperlinkPartitionRecognizer#recognize(org.eclipse.jface.text.IDocument, com.ibm.sse.editor.extensions.hyperlink.IHyperlinkRegion)
*/
14 years, 8 months
JBoss Tools SVN: r21818 - in trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks: edit/smooks and 5 other directories.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2010-04-30 03:00:07 -0400 (Fri, 30 Apr 2010)
New Revision: 21818
Removed:
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/edit/groovy/provider/
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/edit/smooks/provider/
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/calc/
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/csv/impl/
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/csv/provider/
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/csv/util/
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/datasource/
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/dbrouting/
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/edi/impl/
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/edi/provider/
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/edi/util/
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/esbrouting/
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/fileRouting/
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/graphics/
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/groovy/
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/iorouting/
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/javabean/impl/
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/javabean/provider/
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/javabean/util/
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/jmsrouting/
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/jmsrouting12/
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/json/impl/
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/json/provider/
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/json/util/
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/persistence12/
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/rules10/
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/validation10/
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/xsl/
Log:
JBIDE-5983
remove unused codes
14 years, 8 months
JBoss Tools SVN: r21817 - branches/modular_build/build.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2010-04-29 18:17:59 -0400 (Thu, 29 Apr 2010)
New Revision: 21817
Modified:
branches/modular_build/build/build.xml
Log:
move deployment into new target, deploy.only
Modified: branches/modular_build/build/build.xml
===================================================================
--- branches/modular_build/build/build.xml 2010-04-29 21:34:09 UTC (rev 21816)
+++ branches/modular_build/build/build.xml 2010-04-29 22:17:59 UTC (rev 21817)
@@ -60,7 +60,7 @@
</target>
<target name="run"
- depends="init, get.bootstrap.scripts, get.sources, get.components.to.build, run.build, collect.all.test.results, deploy"
+ depends="init, get.bootstrap.scripts, get.sources, get.components.to.build, run.build, collect.all.test.results"
/>
<!-- override for local build -->
@@ -523,7 +523,7 @@
This account is restricted by rssh.
Allowed commands: scp sftp rsync
-->
- <target name="deploy" if="isInHudson">
+ <target name="deploy" if="isInHudson" depends="init, get.bootstrap.scripts">
<!-- default destinations -->
<property name="DESTINATION.jbosstools" value="tools@filemgmt.jboss.org:/downloads_htdocs/tools/repository" />
<property name="DESTINATION.jbds" value="/qa/services/http/binaries/RHDS/repository" />
14 years, 8 months
JBoss Tools SVN: r21816 - branches/modular_build/build.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2010-04-29 17:34:09 -0400 (Thu, 29 Apr 2010)
New Revision: 21816
Modified:
branches/modular_build/build/build.xml
Log:
so that we don't need to look at build.cfg, dump list of COMPONENTS.to.build into log
Modified: branches/modular_build/build/build.xml
===================================================================
--- branches/modular_build/build/build.xml 2010-04-29 21:30:34 UTC (rev 21815)
+++ branches/modular_build/build/build.xml 2010-04-29 21:34:09 UTC (rev 21816)
@@ -315,6 +315,11 @@
</echo>
<property name="no.tests.run" value="true" />
</then>
+ <else>
+ <echo>The following components' sources have changed and will be built:
+ COMPONENTS.to.build = ${COMPONENTS.to.build}
+</echo>
+ </else>
</if>
</target>
14 years, 8 months
JBoss Tools SVN: r21815 - branches/modular_build/build.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2010-04-29 17:30:34 -0400 (Thu, 29 Apr 2010)
New Revision: 21815
Modified:
branches/modular_build/build/build.xml
Log:
enable deployment; filter out tests that pass from log; wrap mvn w/ Xvfb so tests do not stall on Linux
Modified: branches/modular_build/build/build.xml
===================================================================
--- branches/modular_build/build/build.xml 2010-04-29 19:43:48 UTC (rev 21814)
+++ branches/modular_build/build/build.xml 2010-04-29 21:30:34 UTC (rev 21815)
@@ -48,6 +48,8 @@
cd /home/nboldt/workspace36/jbosstools-modular_build; \
ant -DCOMPONENTS=tests,common,jmx -DMAVEN_FLAGS="osgi-test:test -B -fn"
+Note: if tests stall on Linux, install Xvfb and this script will use that to run Maven.
+
Here is the order in which components must be built:
</echo>
<for param="COMPONENT" list="${COMPONENTS}" delimiter=";">
@@ -58,7 +60,7 @@
</target>
<target name="run"
- depends="init, get.bootstrap.scripts, get.sources, get.components.to.build, run.build, collect.all.test.results"
+ depends="init, get.bootstrap.scripts, get.sources, get.components.to.build, run.build, collect.all.test.results, deploy"
/>
<!-- override for local build -->
@@ -327,10 +329,42 @@
<ant antfile="genpom.xml" target="run" dir="${WORKINGDIR}">
<property name="COMPONENT" value="@{COMPONENT}" />
</ant>
- <echo level="verbose">Exe: ${COMMON_TOOLS}/apache-maven-${maven.version}/bin/mvn</echo>
+
+ <!-- Use Xvfb wrapper for maven when invoking UI tests -->
+ <var name="mvnExe" value="mvn" />
+ <if>
+ <available file="/usr/bin/Xvfb" type="file" />
+ <then>
+ <if>
+ <not>
+ <available file="${COMMON_TOOLS}/apache-maven-${maven.version}/bin/mvnWithXvfb"
+ type="file"
+ />
+ </not>
+ <then>
+ <echo file="${COMMON_TOOLS}/apache-maven-${maven.version}/bin/mvnWithXvfb">#!/bin/bash
+if [[ -f /tmp/.X3-lock ]]; then
+ kill -9 `cat /tmp/.X3-lock`
+ rm -fr /tmp/.X3-lock
+fi
+/usr/bin/Xvfb :3 -ac 2>&1 1>/dev/null &
+DISPLAY=:3 /opt/maven3/bin/mvn $*
+kill -9 `cat /tmp/.X3-lock`
+rm -fr /tmp/.X3-lock
+</echo>
+ <chmod perm="755"
+ file="${COMMON_TOOLS}/apache-maven-${maven.version}/bin/mvnWithXvfb"
+ />
+ </then>
+ </if>
+ <var name="mvnExe" value="mvnWithXvfb" />
+ </then>
+ </if>
+
+ <echo level="verbose">Exe: ${COMMON_TOOLS}/apache-maven-${maven.version}/bin/${mvnExe}</echo>
<echo level="verbose">Pom: ${WORKINGDIR}/(a){COMPONENT}/pom.xml</echo>
<!-- 3 hr timeout = 10800000ms -->
- <exec executable="${COMMON_TOOLS}/apache-maven-${maven.version}/bin/mvn"
+ <exec executable="${COMMON_TOOLS}/apache-maven-${maven.version}/bin/${mvnExe}"
dir="${WORKINGDIR}/@{COMPONENT}"
failifexecutionfails="true"
failonerror="true"
@@ -374,6 +408,9 @@
</target>
<target name="collect.all.test.results" unless="no.tests.run">
+ <var name="test.results.all" value="" />
+ <var name="test.results.errors.failures.skipped" value="" />
+
<!-- Parse this: <testsuite errors="0" skipped="0" tests="10" time="0.042" failures="0" name="org.jboss.tools.jmx.ui.JMXUIAllTests"> -->
<for param="testresultfile" delimiter=",
">
@@ -414,8 +451,27 @@
</sequential>
</for>
- <echo level="info">${testsuite.name} ran ${testsuite.tests} tests in ${testsuite.time}s${testsuite.skipped}${testsuite.errors}${testsuite.failures}
-</echo>
+ <if>
+ <or>
+ <not>
+ <equals arg1="${testsuite.skipped}" arg2="" />
+ </not>
+ <not>
+ <equals arg1="${testsuite.errors}" arg2="" />
+ </not>
+ <not>
+ <equals arg1="${testsuite.failures}" arg2="" />
+ </not>
+ </or>
+ <then>
+ <var name="test.results.errors.failures.skipped"
+ value="${test.results.errors.failures.skipped}${testsuite.name} ran ${testsuite.tests} tests in ${testsuite.time}s${testsuite.skipped}${testsuite.errors}${testsuite.failures}${line.separator}"
+ />
+ </then>
+ </if>
+ <var name="test.results.all"
+ value="${test.results.all}${testsuite.name} ran ${testsuite.tests} tests in ${testsuite.time}s${testsuite.skipped}${testsuite.errors}${testsuite.failures}${line.separator}"
+ />
<var name="testsuite.name" unset="true" />
<var name="testsuite.tests" unset="true" />
<var name="testsuite.time" unset="true" />
@@ -424,6 +480,30 @@
<var name="testsuite.failures" unset="true" />
</sequential>
</for>
+ <echo level="verbose">-------------------------------------------------------
+ A L L T E S T R E S U L T S
+-------------------------------------------------------
+${test.results.all}
+-------------------------------------------------------
+
+</echo>
+ <if>
+ <and>
+ <isset property="test.results.errors.failures.skipped" />
+ <not>
+ <equals arg1="${test.results.errors.failures.skipped}" arg2="" />
+ </not>
+ </and>
+ <then>
+ <echo level="error">-------------------------------------------------------
+ T E S T R E S U L T S
+-------------------------------------------------------
+${test.results.errors.failures.skipped}
+-------------------------------------------------------
+
+</echo>
+ </then>
+ </if>
</target>
@@ -433,99 +513,57 @@
</target>
- <target name="deploy">
- <!-- TODO enable publishing to download.jboss.org or porkchop.jboss.com -->
- <property name="DESTINATION.jbosstools" value="filemgmt.jboss.org/downloads_htdocs/tools/repository/" />
- <property name="DESTINATION.jbds" value="/qa/services/http/binaries/RHDS/repository/" />
+ <!-- TODO: figure out why this fails with error:
+ insecure -e option not allowed.
+ This account is restricted by rssh.
+ Allowed commands: scp sftp rsync
+ -->
+ <target name="deploy" if="isInHudson">
+ <!-- default destinations -->
+ <property name="DESTINATION.jbosstools" value="tools@filemgmt.jboss.org:/downloads_htdocs/tools/repository" />
+ <property name="DESTINATION.jbds" value="/qa/services/http/binaries/RHDS/repository" />
- <echo level="debug">Promote build in ${sourceZipsDirActual} ...</echo>
- <for param="aDir" list="${sourceZipsDirActual}" delimiter=",
-">
- <sequential>
- <!-- rsync or copy build dir @{aDir} into ${targetZipsDir}/ -->
- <if>
- <available file="/usr/bin/rsync" type="file" />
- <then>
- <var name="rsyncCmd"
- value="/usr/bin/rsync -a${synchMethodParam} --exclude=eclipse/ @{aDir} ${targetZipsDir}/"
- />
- <echo message="${rsyncCmd}" />
- <exec executable="bash">
- <arg line=" -c "${rsyncCmd}"" />
- </exec>
- <var name="rsyncCmd" unset="true" />
- </then>
- <else>
- <propertyregex override="true"
- property="aBuildDir"
- defaultvalue="@{aDir}"
- input="@{aDir}"
- regexp=".+/([^/]+)"
- replace="\1"
- />
- <echo>Copy ${aBuildDir} into ${targetZipsDir}/</echo>
- <mkdir dir="${targetZipsDir}/${aBuildDir}" />
- <copy todir="${targetZipsDir}/${aBuildDir}"
- includeemptydirs="true"
- preservelastmodified="true"
- failonerror="true"
- >
- <fileset dir="@{aDir}" excludes="eclipse/" />
- </copy>
- </else>
- </if>
+ <!-- values for this deployment -->
+ <property name="deployDir" value="${DESTINATION.jbosstools}/SNAPSHOT" />
+ <property name="sourceDir" value="${WORKINGDIR}" />
+ <property name="synchMethodParam" value=" --delete" />
- <!-- unpack update zip(s) -->
- <if>
- <and>
- <isset property="targetUpdateDir" />
- <not>
- <equals arg1="${targetUpdateDir}" arg2="" />
- </not>
- </and>
- <then>
- <for param="anUpdateZip">
- <path>
- <fileset dir="@{aDir}" includes="*-Update-*.zip" />
- </path>
- <sequential>
- <unzip dest="${targetUpdateDir}/"
- src="@{anUpdateZip}"
- overwrite="${unzipMethodParam}"
- />
- <for param="subdir">
- <path>
- <dirset dir="${targetUpdateDir}/" />
- </path>
- <sequential>
- <copy file="staticDropFiles/index.php" todir="@{subdir}" />
- </sequential>
- </for>
- </sequential>
- </for>
- </then>
- </if>
- </sequential>
- </for>
- <!--
- <get usetimestamp="true"
- dest="${COMMON_TOOLS}/maven-ant-tasks-2.1.0.jar"
- src="${MAVEN_MIRROR}/maven-ant-tasks-2.1.0.jar"
- />
- <taskdef resource="org/apache/maven/artifact/ant/antlib.xml">
- <classpath>
- <pathelement location="${COMMON_TOOLS}/maven-ant-tasks-2.1.0.jar" />
- </classpath>
- </taskdef>
- <install-provider artifactId="wagon-ssh" version="1.0-beta-2"/>
- <deploy>
-
- <remoteRepository url="scp://${DESTINATION}">
- <authentication username="tools" privateKey="${user.home}/.ssh/id_rsa" />
- </remoteRepository>
- <pom refid="mypom" />
- </deploy>
- -->
+ <echo level="debug">Promote build in ${sourceDir} ...</echo>
+ <!-- rsync or scp build dir ${sourceDir} into ${deployDir}/ -->
+ <if>
+ <available file="/usr/bin/rsync" type="file" />
+ <then>
+ <var name="deployCmd"
+ value="/usr/bin/rsync -arz --delete --include=*/*/*/target/ --include=*.xml --include=svn.info*.txt --include=build.cfg --exclude=eclipse/ ${sourceDir} ${deployDir}/"
+ />
+ </then>
+ <elseif>
+ <available file="/usr/bin/scp" type="file" />
+ <then>
+ <var name="deployCmd" value="/usr/bin/scp -r ${sourceDir} ${deployDir}/" />
+ </then>
+ </elseif>
+ <else>
+ <fail>ERROR!
+Cannot deploy - please install scp or rsync on this server and try again.
+</fail>
+ </else>
+ </if>
+ <if>
+ <available file="${sourceDir}" type="dir" />
+ <then>
+ <echo message="${deployCmd}" />
+ <exec executable="bash">
+ <arg line=" -c "${deployCmd}"" />
+ </exec>
+ </then>
+ <else>
+ <fail>ERROR!
+Cannot deploy - sourceDir not found in
+ ${sourceDir}
+</fail>
+ </else>
+ </if>
</target>
<!-- ************************************ TESTS ************************************ -->
@@ -552,7 +590,6 @@
<target name="test.all">
<antcall target="test.get.sources.build.all" />
<antcall target="test.get.sources" />
- <antcall target="test.deploy" />
</target>
<target name="test.get.sources.build.all"
@@ -714,10 +751,11 @@
<echo level="info">----------------------------------</echo>
</target>
- <!-- TODO: fixme -->
- <target name="test.deploy" depends="init, test.expected.values">
+ <!-- TODO: fixme: manual test; lacks something we can assert... maybe that deployDir exists? -->
+ <target name="test.deploy" depends="init">
<antcall target="deploy">
- <param name="targetZipsDir" value="tools@filemgmt.jboss.org:/downloads_htdocs/tools/repository/" />
+ <param name="deployDir" value="tools@filemgmt.jboss.org:/downloads_htdocs/tools/repository/SNAPSHOT" />
+ <param name="sourceDir" value="${WORKINGDIR}/surefire-reports" />
</antcall>
</target>
14 years, 8 months