JBoss Tools SVN: r17120 - in trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui: widget/editor and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2009-08-18 04:39:50 -0400 (Tue, 18 Aug 2009)
New Revision: 17120
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.properties
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SeamRuntimeListFieldEditor.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4657 - Fixed
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.java 2009-08-18 08:26:17 UTC (rev 17119)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.java 2009-08-18 08:39:50 UTC (rev 17120)
@@ -44,6 +44,8 @@
public static String SEAM_SETTINGS_PREFERENCE_PAGE_SEAM_RUNTIME_IS_NOT_SELECTED;
public static String SEAM_SETTINGS_PREFERENCE_PAGE_SEAM_RUNTIME_DOES_NOT_EXIST;
+
+ public static String SEAM_SETTINGS_PREFERENCE_PAGE_WRONG_SEAM_VERSION;
public static String SEAM_SETTINGS_PREFERENCE_PAGE_EJB_PROJECT_DOES_NOT_EXIST;
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.properties
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.properties 2009-08-18 08:26:17 UTC (rev 17119)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.properties 2009-08-18 08:39:50 UTC (rev 17120)
@@ -92,6 +92,7 @@
SEAM_SETTINGS_PREFERENCE_PAGE_SEAM_RUNTIME_IS_NOT_SELECTED=Seam runtime is not selected
SEAM_PREFERENCE_PAGE_SEAM_RUNTIMES=Seam Runtimes
SEAM_SETTINGS_PREFERENCE_PAGE_SEAM_RUNTIME_DOES_NOT_EXIST=Runtime "{0}" does not exist.
+SEAM_SETTINGS_PREFERENCE_PAGE_WRONG_SEAM_VERSION=Seam runtime version "{0}" is incompatible with installed Seam Facet ({1}). Please set Seam Facet version to {0}. See Project->Properties->Project Facets.
SEAM_SETTINGS_PREFERENCE_PAGE_EJB_PROJECT_DOES_NOT_EXIST=Seam EJB project "{0}" does not exist.
SEAM_SETTINGS_PREFERENCE_PAGE_VIEW_FOLDER_DOES_NOT_EXIST=View Folder "{0}" does not exist.
SEAM_SETTINGS_PREFERENCE_PAGE_MODEL_SOURCE_FOLDER_DOES_NOT_EXIST=Model source folder "{0}" does not exist.
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java 2009-08-18 08:26:17 UTC (rev 17119)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java 2009-08-18 08:39:50 UTC (rev 17120)
@@ -554,7 +554,8 @@
return;
} else {
String value = getValue(ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME);
- if(SeamRuntimeManager.getInstance().findRuntimeByName(value) == null) {
+ SeamRuntime seamRuntime = SeamRuntimeManager.getInstance().findRuntimeByName(value);
+ if(seamRuntime == null) {
setErrorMessage(NLS.bind(SeamPreferencesMessages.SEAM_SETTINGS_PREFERENCE_PAGE_SEAM_RUNTIME_DOES_NOT_EXIST, new String[]{value}));
setValid(false);
return;
@@ -572,6 +573,12 @@
setValid(true);
}
}
+ SeamVersion installedVersion = getInstalledSeamVersion();
+ if(installedVersion!=null && seamRuntime.getVersion()!=installedVersion) {
+ setMessage(NLS.bind(SeamPreferencesMessages.SEAM_SETTINGS_PREFERENCE_PAGE_WRONG_SEAM_VERSION, new String[]{seamRuntime.getVersion().toString(), installedVersion.toString()}), IMessageProvider.WARNING);
+ warning = true;
+ setValid(true);
+ }
}
validateProjectName(SeamPreferencesMessages.SEAM_SETTINGS_PREFERENCE_PAGE_MAIN_SEAM_PROJECT_DOES_NOT_EXIST, SeamPreferencesMessages.SEAM_SETTINGS_PREFERENCE_PAGE_MAIN_SEAM_PROJECT_IS_EMPTY, IParameter.SEAM_PROJECT_NAME, false);
@@ -973,6 +980,11 @@
}
private SeamVersion[] getSeamVersions() {
+ // Let's allow user to select any available seam version regardless of installed seam facet. But we should warn user if he selects different versions of facet and seam runtime.
+ return SeamVersion.ALL_VERSIONS;
+ }
+
+ private SeamVersion getInstalledSeamVersion() {
if(warSeamProject != null) {
try {
IFacetedProject facetedProject = ProjectFacetsManager.create(warSeamProject.getProject());
@@ -982,24 +994,24 @@
if(version!=null) {
SeamVersion seamVersion = SeamVersion.findByString(version.getVersionString());
if(seamVersion!=null) {
- return new SeamVersion[]{seamVersion};
+ return seamVersion;
}
}
}
} catch (CoreException e) {
SeamGuiPlugin.getPluginLog().logError(e);
}
- String jarLocation = getJBossSeamJarLocation();
- if(jarLocation != null) {
- String folder = new File(jarLocation).getParent();
- String vs = SeamUtil.getSeamVersionFromManifest(folder);
- SeamVersion v = SeamVersion.findMatchingVersion(vs);
- if(v != null) {
- return new SeamVersion[]{v};
- }
- }
+// String jarLocation = getJBossSeamJarLocation();
+// if(jarLocation != null) {
+// String folder = new File(jarLocation).getParent();
+// String vs = SeamUtil.getSeamVersionFromManifest(folder);
+// SeamVersion v = SeamVersion.findMatchingVersion(vs);
+// if(v != null) {
+// return v;
+// }
+// }
}
- return SeamVersion.ALL_VERSIONS;
+ return null;
}
private String getJBossSeamJarLocation() {
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SeamRuntimeListFieldEditor.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SeamRuntimeListFieldEditor.java 2009-08-18 08:26:17 UTC (rev 17119)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SeamRuntimeListFieldEditor.java 2009-08-18 08:39:50 UTC (rev 17120)
@@ -631,10 +631,17 @@
setPageComplete(true);
return;
} else if(!SeamUtil.areSeamVersionsMatched(version.getValueAsString(), seamVersion)) {
- setErrorMessage(NLS.bind(SeamUIMessages.SEAM_RUNTIME_LIST_FIELD_EDITOR_THE_SELECTED_SEAM_APPEARS_TO_BE_OF_INCOMATIBLE_VERSION,
- seamVersion));
- setPageComplete(false);
- return;
+ String trimmedVersion = SeamUtil.trimSeamVersion(version.getValueAsString(), 1);
+ String trimmedSeamVersion = SeamUtil.trimSeamVersion(seamVersion, 1);
+ if(SeamUtil.areSeamVersionsMatched(trimmedVersion, trimmedSeamVersion)) {
+ setMessage(NLS.bind(SeamUIMessages.SEAM_RUNTIME_LIST_FIELD_EDITOR_THE_SELECTED_SEAM_APPEARS_TO_BE_OF_INCOMATIBLE_VERSION,
+ seamVersion), IMessageProvider.WARNING);
+ } else {
+ setErrorMessage(NLS.bind(SeamUIMessages.SEAM_RUNTIME_LIST_FIELD_EDITOR_THE_SELECTED_SEAM_APPEARS_TO_BE_OF_INCOMATIBLE_VERSION,
+ seamVersion));
+ setPageComplete(false);
+ return;
+ }
} else {
setMessage(null);
}
16 years, 4 months
JBoss Tools SVN: r17119 - in trunk/smooks/plugins: org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/csv12 and 11 other directories.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2009-08-18 04:26:17 -0400 (Tue, 18 Aug 2009)
New Revision: 17119
Added:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json12/
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json12/Json12DataConfiguraitonWizardPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json12/Json12DataPathWizardPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json12/Json12DataWizard.java
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/csv/CsvPackage.java
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/csv12/Csv12Package.java
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/json12/Json12Package.java
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks10/model/smooks/util/SmooksModelUtils.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/csv/CSVDataParser.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv12/CSV12DataConfigurationWizardPage.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/edi/EDIDataWizard.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json/JsonDataWizard.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/JsonInputDataParser.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/edimap/editor/EDIMapFormPage.java
Log:
JBIDE-4774
Creat new JSON 1.2 reader
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/csv/CsvPackage.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/csv/CsvPackage.java 2009-08-18 07:03:12 UTC (rev 17118)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/csv/CsvPackage.java 2009-08-18 08:26:17 UTC (rev 17119)
@@ -54,7 +54,7 @@
* <!-- end-user-doc -->
* @generated
*/
- String eNS_PREFIX = "cvs";
+ String eNS_PREFIX = "csv";
/**
* The singleton instance of the package.
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/csv12/Csv12Package.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/csv12/Csv12Package.java 2009-08-18 07:03:12 UTC (rev 17118)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/csv12/Csv12Package.java 2009-08-18 08:26:17 UTC (rev 17119)
@@ -55,7 +55,7 @@
* <!-- end-user-doc -->
* @generated
*/
- String eNS_PREFIX = "csv";
+ String eNS_PREFIX = "csv12";
/**
* The singleton instance of the package.
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/json12/Json12Package.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/json12/Json12Package.java 2009-08-18 07:03:12 UTC (rev 17118)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/json12/Json12Package.java 2009-08-18 08:26:17 UTC (rev 17119)
@@ -56,7 +56,7 @@
* <!-- end-user-doc -->
* @generated
*/
- String eNS_PREFIX = "json";
+ String eNS_PREFIX = "json12";
/**
* The singleton instance of the package.
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks10/model/smooks/util/SmooksModelUtils.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks10/model/smooks/util/SmooksModelUtils.java 2009-08-18 07:03:12 UTC (rev 17118)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks10/model/smooks/util/SmooksModelUtils.java 2009-08-18 08:26:17 UTC (rev 17119)
@@ -51,7 +51,7 @@
public static final String INPUT_TYPE_JAVA = "java";
- public static final String INPUT_TYPE_JSON = "json";
+ public static final String INPUT_TYPE_JSON_1_1 = "json";
public static final String INPUT_TYPE_CSV_1_1 = "csv";
@@ -75,8 +75,12 @@
public static final String BINDINGS = "bindings";
- public static final String INPUT_TYPE_EDI = "EDI";
+ public static final String INPUT_TYPE_EDI_1_1 = "EDI";
+ public static final String INPUT_TYPE_EDI_1_2 = "EDI_1_2";
+
+ public static final String INPUT_TYPE_JSON_1_2 = "json_1_2";
+
public static EStructuralFeature ATTRIBUTE_PROPERTY = ExtendedMetaData.INSTANCE.demandFeature(null, "property",
false);
@@ -504,8 +508,9 @@
public static String getInputPath(InputType input) {
List<org.jboss.tools.smooks.model.graphics.ext.ParamType> list = input.getParam();
if (INPUT_TYPE_JAVA.equals(input.getType()) || INPUT_TYPE_XML.equals(input.getType())
- || INPUT_TYPE_XSD.equals(input.getType()) || INPUT_TYPE_JSON.equals(input.getType())
- || INPUT_TYPE_CSV_1_1.equals(input.getType()) || INPUT_TYPE_EDI.equals(input.getType())
+ || INPUT_TYPE_XSD.equals(input.getType()) || INPUT_TYPE_JSON_1_1.equals(input.getType())
+ || INPUT_TYPE_JSON_1_2.equals(input.getType()) || INPUT_TYPE_CSV_1_1.equals(input.getType())
+ || INPUT_TYPE_EDI_1_1.equals(input.getType()) || INPUT_TYPE_EDI_1_2.equals(input.getType())
|| INPUT_TYPE_CSV_1_2.equals(input.getType())) {
for (Iterator<?> iterator = list.iterator(); iterator.hasNext();) {
org.jboss.tools.smooks.model.graphics.ext.ParamType paramType = (org.jboss.tools.smooks.model.graphics.ext.ParamType) iterator
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 2009-08-18 07:03:12 UTC (rev 17118)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SelectorCreationDialog.java 2009-08-18 08:26:17 UTC (rev 17119)
@@ -255,7 +255,8 @@
String path = SmooksModelUtils.getInputPath(inputType);
if (type != null && path != null) {
path = path.trim();
- if (SmooksModelUtils.INPUT_TYPE_EDI.equals(type)) {
+ if (SmooksModelUtils.INPUT_TYPE_EDI_1_1.equals(type)
+ || SmooksModelUtils.INPUT_TYPE_EDI_1_2.equals(type)) {
EDIDataParser parser = new EDIDataParser();
try {
TagList tl = parser.parseEDIFile(path, inputType, smooksResourceListType);
@@ -278,7 +279,8 @@
t.printStackTrace();
}
}
- if (SmooksModelUtils.INPUT_TYPE_JSON.equals(type)) {
+ if (SmooksModelUtils.INPUT_TYPE_JSON_1_1.equals(type)
+ || SmooksModelUtils.INPUT_TYPE_JSON_1_2.equals(type)) {
try {
JsonInputDataParser parser = new JsonInputDataParser();
IXMLStructuredObject tagList = parser.parseJsonFile(SmooksUIUtils.parseFilePath(path),
Modified: 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/csv/CSVDataParser.java 2009-08-18 07:03:12 UTC (rev 17118)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv/CSVDataParser.java 2009-08-18 08:26:17 UTC (rev 17119)
@@ -15,6 +15,7 @@
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;
@@ -223,6 +224,9 @@
if (recordName != null) {
readerConfigurator.setRecordElementName(recordName);
}
+
+ readerConfigurator.setEncoding(Charset.forName(encoding));
+// readerConfigurator.setIndent(indent)
smooks.setReaderConfig(readerConfigurator);
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv12/CSV12DataConfigurationWizardPage.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv12/CSV12DataConfigurationWizardPage.java 2009-08-18 07:03:12 UTC (rev 17118)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv12/CSV12DataConfigurationWizardPage.java 2009-08-18 08:26:17 UTC (rev 17119)
@@ -35,6 +35,7 @@
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Item;
@@ -89,6 +90,8 @@
private List<FieldString> fieldsList = new ArrayList<FieldString>();
private Text rootNameText;
private Text recordNameText;
+ private Combo indentText;
+ protected String indent;
public CSV12DataConfigurationWizardPage(String pageName, String title, ImageDescriptor titleImage) {
super(pageName, title, titleImage);
@@ -179,6 +182,14 @@
skiplineLabel.setText("Skip Lines");
skipLinesText = new Text(configComposite, SWT.BORDER);
skipLinesText.setLayoutData(gd);
+
+ Label indentLabel = new Label(configComposite, SWT.NONE);
+ indentLabel.setText("Indent");
+ indentText = new Combo(configComposite, SWT.BORDER | SWT.READ_ONLY);
+ indentText.add("");
+ indentText.add("TRUE");
+ indentText.add("FALSE");
+ indentText.setLayoutData(gd);
Label encodingLabel = new Label(configComposite, SWT.NONE);
encodingLabel.setText("Encoding");
@@ -397,7 +408,15 @@
changePageStatus();
}
});
+
+ indentText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ indent = indentText.getText();
+ changePageStatus();
+ }
+ });
+
this.createCSVReaderButton.addSelectionListener(new SelectionListener() {
/*
@@ -558,6 +577,14 @@
}
}
+ public String getIndent() {
+ return indent;
+ }
+
+ public void setIndent(String indent) {
+ this.indent = indent;
+ }
+
/**
* @return the separator
*/
@@ -680,6 +707,8 @@
}
private void initValue() {
+ indent = null;
+
useAvailabelReader = false;
filePath = null;
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 2009-08-18 07:03:12 UTC (rev 17118)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv12/CSV12InputDataWizard.java 2009-08-18 08:26:17 UTC (rev 17119)
@@ -9,6 +9,7 @@
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;
@@ -21,9 +22,11 @@
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;
import org.jboss.tools.smooks.model.csv12.CSV12Reader;
import org.jboss.tools.smooks.model.csv12.Csv12Factory;
+import org.jboss.tools.smooks.model.csv12.Csv12Package;
import org.jboss.tools.smooks.model.smooks.DocumentRoot;
import org.jboss.tools.smooks.model.smooks.SmooksPackage;
import org.jboss.tools.smooks.model.smooks.SmooksResourceListType;
@@ -105,6 +108,12 @@
if(recordName != null){
reader.setRecordElementName(recordName);
}
+
+ String indent = configPage.getIndent();
+ if (indent != null && indent.length() != 0) {
+ boolean indentValue = Boolean.valueOf(indent).booleanValue();
+ reader.setIndent(indentValue);
+ }
String fields = null;
List<FieldString> fieldList = configPage.getFieldsList();
@@ -120,9 +129,9 @@
}
}
reader.setFields(fields);
-
- Command command = AddCommand.create(editingDomain, resourceList, SmooksPackage.eINSTANCE
- .getSmooksResourceListType_AbstractReader(), reader);
+ Command command = AddCommand.create(editingDomain, resourceList,
+ SmooksPackage.Literals.SMOOKS_RESOURCE_LIST_TYPE__ABSTRACT_READER_GROUP, FeatureMapUtil
+ .createEntry(Csv12Package.Literals.CSV12_DOCUMENT_ROOT__READER, reader));
editingDomain.getCommandStack().execute(command);
}
@@ -229,6 +238,11 @@
if (skiplines != null && skiplines.length() != 0) {
pro.put(CSVDataParser.SKIPLINES, skiplines);
}
+
+ String indent = configPage.getIndent();
+ if (indent != null && indent.length() != 0) {
+ pro.setProperty(JsonInputDataParser.INDENT, indent);
+ }
}
}
Modified: 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/edi/EDIDataWizard.java 2009-08-18 07:03:12 UTC (rev 17118)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edi/EDIDataWizard.java 2009-08-18 08:26:17 UTC (rev 17119)
@@ -97,7 +97,7 @@
* IStructuredDataSelectionWizard#getInputDataTypeID()
*/
public String getInputDataTypeID() {
- return SmooksModelUtils.INPUT_TYPE_EDI;
+ return SmooksModelUtils.INPUT_TYPE_EDI_1_1;
}
/*
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json/JsonDataWizard.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json/JsonDataWizard.java 2009-08-18 07:03:12 UTC (rev 17118)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json/JsonDataWizard.java 2009-08-18 08:26:17 UTC (rev 17119)
@@ -172,7 +172,7 @@
*/
public String getInputDataTypeID() {
// TODO Auto-generated method stub
- return SmooksModelUtils.INPUT_TYPE_JSON;
+ return SmooksModelUtils.INPUT_TYPE_JSON_1_1;
}
/*
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json12/Json12DataConfiguraitonWizardPage.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json12/Json12DataConfiguraitonWizardPage.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json12/Json12DataConfiguraitonWizardPage.java 2009-08-18 08:26:17 UTC (rev 17119)
@@ -0,0 +1,761 @@
+/*******************************************************************************
+ * 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.json12;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.CellEditor;
+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.TextCellEditor;
+import org.eclipse.jface.viewers.Viewer;
+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.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Item;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.Text;
+import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
+import org.jboss.tools.smooks.model.json12.Json12Reader;
+import org.jboss.tools.smooks.model.json12.impl.Json12ReaderImpl;
+import org.jboss.tools.smooks.model.smooks.SmooksResourceListType;
+
+/**
+ * @author Dart (dpeng(a)redhat.com)
+ *
+ */
+public class Json12DataConfiguraitonWizardPage extends WizardPage {
+
+ private String rootName = null;
+
+ private String arrayElementName = "element";
+
+ private String keyWhitspaceReplacement = "-";
+
+ private String keyPrefixOnNumeric;
+
+ private String illegalElementNameCharReplacement;
+
+ private String nullValueReplacement = "";
+
+ private String encoding = "UTF-8";
+
+ private Text rootNameText;
+
+ private Text arrayElementNameText;
+
+ private Text keyWhitspaceReplacementText;
+
+ private Text keyPrefixOnNumericText;
+
+ private Text illegalElementNameCharReplacementText;
+
+ private Text nullValueReplacementText;
+
+ private Text encodingText;
+
+ private TableViewer keyMapViewer;
+
+ private ArrayList<KeyValueModel> keyValueList;
+
+ private Button addButton;
+
+ private Button removeButton;
+
+ private Button createJsonReaderButton;
+
+ protected boolean createJsonReader = true;
+
+ private Button newReaderConfigButton;
+
+ private Button useAvailableReaderConfigButton;
+
+ private SmooksResourceListType resourceList;
+
+ private boolean hasReader = false;
+
+ private boolean useAvailabelReader = false;
+
+ private Composite configComposite;
+
+ private Composite keyMapComposite;
+
+ private Combo indentText;
+
+ private String indent = null;
+
+ private void initValue() {
+
+ indent = null;
+
+ hasReader = false;
+ if (SmooksUIUtils.hasReaderAlready(Json12ReaderImpl.class, resourceList)
+ || SmooksUIUtils.hasReaderAlready(Json12Reader.class, resourceList)) {
+ hasReader = true;
+ }
+
+ useAvailabelReader = false;
+
+ rootName = null;
+
+ createJsonReader = true;
+
+ arrayElementName = "element";
+
+ keyWhitspaceReplacement = "-";
+
+ keyPrefixOnNumeric = null;
+
+ illegalElementNameCharReplacement = null;
+ nullValueReplacement = "";
+ encoding = "UTF-8";
+ if (keyValueList != null) {
+ keyValueList.clear();
+ } else {
+ keyValueList = new ArrayList<KeyValueModel>();
+ }
+
+ if (hasReader) {
+ useAvailabelReader = true;
+ createJsonReader = false;
+ }
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets
+ * .Composite)
+ */
+ public void createControl(Composite parent) {
+ initValue();
+ Composite mainComposite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ mainComposite.setLayout(layout);
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ gd.grabExcessHorizontalSpace = true;
+ gd.grabExcessVerticalSpace = true;
+ mainComposite.setLayoutData(gd);
+
+ Composite radioButtonComposite = new Composite(mainComposite, SWT.NONE);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 2;
+ radioButtonComposite.setLayoutData(gd);
+
+ GridLayout rgl = new GridLayout();
+ rgl.numColumns = 2;
+ rgl.marginHeight = 0;
+ rgl.marginWidth = 0;
+ radioButtonComposite.setLayout(rgl);
+
+ Composite spaceComposite = new Composite(mainComposite, SWT.NONE);
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 2;
+ gd.heightHint = 20;
+ spaceComposite.setLayoutData(gd);
+
+ newReaderConfigButton = new Button(radioButtonComposite, SWT.RADIO);
+ newReaderConfigButton.setText("Create new JSON reader configurations");
+ newReaderConfigButton.setSelection(true);
+
+ useAvailableReaderConfigButton = new Button(radioButtonComposite, SWT.RADIO);
+ useAvailableReaderConfigButton.setText("Use available JSON reader configurations");
+
+ configComposite = new Composite(mainComposite, SWT.NONE);
+ gd = new GridData(GridData.FILL_BOTH);
+ gd.horizontalSpan = 2;
+ configComposite.setLayoutData(gd);
+
+ GridLayout cgl = new GridLayout();
+ cgl.marginHeight = 0;
+ cgl.marginWidth = 0;
+ cgl.numColumns = 2;
+ configComposite.setLayout(cgl);
+
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ Label rootnameLabel = new Label(configComposite, SWT.NONE);
+ rootnameLabel.setText("Root Element Name");
+ rootNameText = new Text(configComposite, SWT.BORDER);
+ rootNameText.setLayoutData(gd);
+
+ Label arrayElementNameLabel = new Label(configComposite, SWT.NONE);
+ arrayElementNameLabel.setText("Array Element Name");
+ arrayElementNameText = new Text(configComposite, SWT.BORDER);
+ arrayElementNameText.setLayoutData(gd);
+ arrayElementNameText.setText(arrayElementName);
+
+ Label keyWhitspaceReplacementLabel = new Label(configComposite, SWT.NONE);
+ keyWhitspaceReplacementLabel.setText("Space Replacement");
+ keyWhitspaceReplacementText = new Text(configComposite, SWT.BORDER);
+ keyWhitspaceReplacementText.setLayoutData(gd);
+ if (keyWhitspaceReplacement == null) {
+ keyWhitspaceReplacement = "";
+ }
+ keyWhitspaceReplacementText.setText(keyWhitspaceReplacement);
+
+ Label keyPrefixOnNumeric = new Label(configComposite, SWT.NONE);
+ keyPrefixOnNumeric.setText("Prefix On Numeric");
+ keyPrefixOnNumericText = new Text(configComposite, SWT.BORDER);
+ keyPrefixOnNumericText.setLayoutData(gd);
+
+ Label illegalElementNameCharReplacementLabel = new Label(configComposite, SWT.NONE);
+ illegalElementNameCharReplacementLabel.setText("IllegalChar Replacement");
+ illegalElementNameCharReplacementText = new Text(configComposite, SWT.BORDER);
+ illegalElementNameCharReplacementText.setLayoutData(gd);
+
+ Label nullValueReplacementlabel = new Label(configComposite, SWT.NONE);
+ nullValueReplacementlabel.setText("NullValue Replacement");
+ nullValueReplacementText = new Text(configComposite, SWT.BORDER);
+ nullValueReplacementText.setLayoutData(gd);
+ nullValueReplacementText.setText(nullValueReplacement);
+
+ Label encodingLabel = new Label(configComposite, SWT.NONE);
+ encodingLabel.setText("Encoding");
+ encodingText = new Text(configComposite, SWT.BORDER);
+ encodingText.setLayoutData(gd);
+ encodingText.setText(encoding);
+
+ Label indentLabel = new Label(configComposite, SWT.NONE);
+ indentLabel.setText("Indent");
+ indentText = new Combo(configComposite, SWT.BORDER | SWT.READ_ONLY);
+ indentText.add("");
+ indentText.add("TRUE");
+ indentText.add("FALSE");
+ indentText.setLayoutData(gd);
+
+ Label keyMapLabel = new Label(configComposite, SWT.NONE);
+ keyMapLabel.setText("Key Map:");
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 2;
+ keyMapLabel.setLayoutData(gd);
+
+ gd = new GridData(GridData.FILL_BOTH);
+ gd.horizontalSpan = 2;
+
+ keyMapComposite = new Composite(configComposite, SWT.NONE);
+ keyMapComposite.setLayoutData(gd);
+
+ GridLayout kgl = new GridLayout();
+ kgl.numColumns = 2;
+ keyMapComposite.setLayout(kgl);
+
+ gd = new GridData(GridData.FILL_BOTH);
+
+ keyMapViewer = new TableViewer(keyMapComposite, SWT.BORDER | SWT.MULTI);
+ keyMapViewer.getControl().setLayoutData(gd);
+ keyMapViewer.getTable().setHeaderVisible(true);
+ keyMapViewer.getTable().setLinesVisible(true);
+ keyMapViewer.setContentProvider(new KeyMapContentProvider());
+ keyMapViewer.setLabelProvider(new KeyMapLabelProvider());
+
+ CellEditor keyCellEditor = new TextCellEditor(keyMapViewer.getTable(), SWT.BORDER);
+
+ CellEditor valueCellEditor = new TextCellEditor(keyMapViewer.getTable(), SWT.BORDER);
+
+ keyMapViewer.setCellEditors(new CellEditor[] { keyCellEditor, valueCellEditor });
+
+ keyMapViewer.setColumnProperties(new String[] { "key", "value" });
+
+ keyMapViewer.setCellModifier(new ICellModifier() {
+
+ public void modify(Object element, String property, Object value) {
+ Object el = null;
+ if (element instanceof Item) {
+ el = ((Item) element).getData();
+ }
+ if (el == null)
+ return;
+ if (el instanceof KeyValueModel && value instanceof String) {
+ if (property.equals("key")) {
+ ((KeyValueModel) el).setKey(value.toString());
+ }
+ if (property.equals("value")) {
+ ((KeyValueModel) el).setValue(value.toString());
+ }
+ keyMapViewer.refresh(el);
+ }
+ }
+
+ public Object getValue(Object element, String property) {
+ // Object el = null;
+ // if(element instanceof Item){
+ // el = ((Item)element).getData();
+ // }
+ // if(el == null) return null;
+ if (element instanceof KeyValueModel) {
+ if (property.equals("key")) {
+ return ((KeyValueModel) element).getKey();
+ }
+ if (property.equals("value")) {
+ return ((KeyValueModel) element).getValue();
+ }
+ }
+
+ return null;
+ }
+
+ public boolean canModify(Object element, String property) {
+ // Object el = null;
+ // if(element instanceof Item){
+ // el = ((Item)element).getData();
+ // }
+ // if(el == null) return false;
+ if (element instanceof KeyValueModel) {
+ if (property.equals("key") || property.equals("value")) {
+ return true;
+ }
+ }
+ return false;
+ }
+ });
+
+ TableColumn keyColumn = new TableColumn(keyMapViewer.getTable(), SWT.BORDER);
+ keyColumn.setWidth(150);
+ keyColumn.setText("Key");
+
+ TableColumn replaceColumn = new TableColumn(keyMapViewer.getTable(), SWT.BORDER);
+ replaceColumn.setWidth(150);
+ replaceColumn.setText("Replace");
+
+ keyMapViewer.setInput(keyValueList);
+
+ Composite buttonComposite = new Composite(keyMapComposite, SWT.NONE);
+ gd = new GridData(GridData.FILL_VERTICAL);
+ buttonComposite.setLayoutData(gd);
+
+ GridLayout bgl = new GridLayout();
+ buttonComposite.setLayout(bgl);
+
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+
+ addButton = new Button(buttonComposite, SWT.NONE);
+ addButton.setLayoutData(gd);
+ addButton.setText("Add");
+
+ removeButton = new Button(buttonComposite, SWT.NONE);
+ removeButton.setLayoutData(gd);
+ removeButton.setText("Remove");
+
+ createJsonReaderButton = new Button(configComposite, SWT.CHECK);
+ createJsonReaderButton.setText("Create a JSON Reader");
+
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 2;
+ createJsonReaderButton.setLayoutData(gd);
+ createJsonReaderButton.setSelection(createJsonReader);
+
+ if (hasReader) {
+ createJsonReaderButton.setEnabled(false);
+ newReaderConfigButton.setSelection(false);
+ useAvailableReaderConfigButton.setSelection(true);
+ setConfigCompositeStates(false);
+ // configComposite.setEnabled(false);
+ }
+ hookControls();
+ changePageStatus();
+ this.setControl(mainComposite);
+ }
+
+ private void setConfigCompositeStates(boolean enabled) {
+ configComposite.setEnabled(enabled);
+ Control[] controls = configComposite.getChildren();
+ for (int i = 0; i < controls.length; i++) {
+ Control c = controls[i];
+ if (c == createJsonReaderButton) {
+ if (hasReader) {
+ c.setEnabled(false);
+ continue;
+ }
+ }
+ if (c == keyMapComposite) {
+ Control[] cs = ((Composite) c).getChildren();
+ for (int j = 0; j < cs.length; j++) {
+ Control cc = cs[j];
+ cc.setEnabled(enabled);
+ }
+ }
+ c.setEnabled(enabled);
+ }
+ }
+
+ private void hookControls() {
+
+ newReaderConfigButton.addSelectionListener(new SelectionListener() {
+
+ public void widgetSelected(SelectionEvent e) {
+ if (newReaderConfigButton.getSelection()) {
+ useAvailabelReader = false;
+ changePageStatus();
+ setConfigCompositeStates(true);
+ }
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+ });
+
+ useAvailableReaderConfigButton.addSelectionListener(new SelectionListener() {
+
+ public void widgetSelected(SelectionEvent e) {
+ if (useAvailableReaderConfigButton.getSelection()) {
+ useAvailabelReader = true;
+ changePageStatus();
+ setConfigCompositeStates(false);
+ }
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+
+ }
+ });
+
+ indentText.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ indent = indentText.getText();
+ changePageStatus();
+ }
+ });
+
+ addButton.addSelectionListener(new SelectionListener() {
+
+ public void widgetSelected(SelectionEvent e) {
+ keyValueList.add(new KeyValueModel("key", "value"));
+ keyMapViewer.refresh();
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+
+ removeButton.addSelectionListener(new SelectionListener() {
+
+ public void widgetSelected(SelectionEvent e) {
+ IStructuredSelection selection = (IStructuredSelection) keyMapViewer.getSelection();
+ List<?> selections = selection.toList();
+ for (Iterator<?> iterator = selections.iterator(); iterator.hasNext();) {
+ Object object = (Object) iterator.next();
+ keyValueList.remove(object);
+ }
+ keyMapViewer.refresh();
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+ });
+
+ createJsonReaderButton.addSelectionListener(new SelectionListener() {
+
+ public void widgetSelected(SelectionEvent e) {
+ createJsonReader = createJsonReaderButton.getSelection();
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+
+ }
+ });
+
+ encodingText.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ encoding = encodingText.getText();
+ changePageStatus();
+ }
+ });
+
+ nullValueReplacementText.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ nullValueReplacement = nullValueReplacementText.getText();
+ changePageStatus();
+ }
+ });
+
+ illegalElementNameCharReplacementText.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ illegalElementNameCharReplacement = illegalElementNameCharReplacementText.getText();
+ changePageStatus();
+ }
+ });
+
+ keyPrefixOnNumericText.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ keyPrefixOnNumeric = keyPrefixOnNumericText.getText();
+ changePageStatus();
+ }
+ });
+
+ keyWhitspaceReplacementText.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ keyWhitspaceReplacement = keyWhitspaceReplacementText.getText();
+ changePageStatus();
+ }
+ });
+
+ arrayElementNameText.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ arrayElementName = arrayElementNameText.getText();
+ changePageStatus();
+ }
+ });
+
+ rootNameText.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ rootName = rootNameText.getText();
+ changePageStatus();
+ }
+ });
+ }
+
+ private void changePageStatus() {
+ String error = null;
+ if (useAvailabelReader) {
+ setErrorMessage(null);
+ setPageComplete(true);
+ return;
+ }
+ rootName = rootNameText.getText();
+ if (rootName == null || rootName.length() == 0) {
+ error = "Root Name can't be null";
+ }
+
+ arrayElementName = arrayElementNameText.getText();
+ if (arrayElementName == null || arrayElementName.length() == 0) {
+ error = "Array Element Name can't be null";
+ }
+
+ // if (keyWhitspaceReplacement == null
+ // || keyWhitspaceReplacement.length() == 0) {
+ // error = "Space replacement string can't be null";
+ // }
+
+ encoding = encodingText.getText();
+ if (encoding == null || encoding.length() == 0) {
+ error = "Encoding can't be null";
+ }
+
+ setErrorMessage(error);
+ setPageComplete(error == null);
+ }
+
+ public Json12DataConfiguraitonWizardPage(String pageName, String title, ImageDescriptor titleImage) {
+ super(pageName, title, titleImage);
+ }
+
+ public Json12DataConfiguraitonWizardPage(String pageName) {
+ super(pageName);
+ this.setTitle("JSON Reader configurations (version 1.2)");
+ this.setDescription("Set the configurations for parsing JSON file.");
+ }
+
+ public String getRootName() {
+ return rootName;
+ }
+
+ public void setRootName(String rootName) {
+ this.rootName = rootName;
+ }
+
+ public String getArrayElementName() {
+ return arrayElementName;
+ }
+
+ public void setArrayElementName(String arrayElementName) {
+ this.arrayElementName = arrayElementName;
+ }
+
+ public String getKeyWhitspaceReplacement() {
+ return keyWhitspaceReplacement;
+ }
+
+ public void setKeyWhitspaceReplacement(String keyWhitspaceReplacement) {
+ this.keyWhitspaceReplacement = keyWhitspaceReplacement;
+ }
+
+ public String getKeyPrefixOnNumeric() {
+ return keyPrefixOnNumeric;
+ }
+
+ public void setKeyPrefixOnNumeric(String keyPrefixOnNumeric) {
+ this.keyPrefixOnNumeric = keyPrefixOnNumeric;
+ }
+
+ public String getIllegalElementNameCharReplacement() {
+ return illegalElementNameCharReplacement;
+ }
+
+ public void setIllegalElementNameCharReplacement(String illegalElementNameCharReplacement) {
+ this.illegalElementNameCharReplacement = illegalElementNameCharReplacement;
+ }
+
+ public String getNullValueReplacement() {
+ return nullValueReplacement;
+ }
+
+ public void setNullValueReplacement(String nullValueReplacement) {
+ this.nullValueReplacement = nullValueReplacement;
+ }
+
+ // public Map<String, String> getKeyMap() {
+ // return keyMap;
+ // }
+ //
+ // public void setKeyMap(Map<String, String> keyMap) {
+ // this.keyMap = keyMap;
+ // }
+
+ public String getEncoding() {
+ return encoding;
+ }
+
+ public boolean isUseAvailabelReader() {
+ return useAvailabelReader;
+ }
+
+ public void setUseAvailabelReader(boolean useAvailabelReader) {
+ this.useAvailabelReader = useAvailabelReader;
+ }
+
+
+
+ public String getIndent() {
+ return indent;
+ }
+
+ public void setIndent(String indent) {
+ this.indent = indent;
+ }
+
+ public SmooksResourceListType getSmooksResourceList() {
+ return resourceList;
+ }
+
+ public void setSmooksResourceList(SmooksResourceListType resourceList) {
+ this.resourceList = resourceList;
+ }
+
+ public void setEncoding(String encoding) {
+ this.encoding = encoding;
+ }
+
+ public ArrayList<KeyValueModel> getKeyValueList() {
+ return keyValueList;
+ }
+
+ public void setKeyValueList(ArrayList<KeyValueModel> keyValueList) {
+ this.keyValueList = keyValueList;
+ }
+
+ public boolean isCreateJsonReader() {
+ return createJsonReader;
+ }
+
+ public void setCreateJsonReader(boolean createJsonReader) {
+ this.createJsonReader = createJsonReader;
+ }
+
+ private class KeyMapLabelProvider extends LabelProvider implements ITableLabelProvider {
+
+ public Image getColumnImage(Object element, int columnIndex) {
+ return null;
+ }
+
+ public String getColumnText(Object element, int columnIndex) {
+ if (element instanceof KeyValueModel) {
+ switch (columnIndex) {
+ case 0:
+ return ((KeyValueModel) element).getKey();
+ case 1:
+ return ((KeyValueModel) element).getValue();
+ }
+ }
+ return getText(element);
+ }
+
+ }
+
+ private class KeyMapContentProvider implements IStructuredContentProvider {
+
+ public Object[] getElements(Object inputElement) {
+ if (inputElement instanceof List<?>) {
+ return ((List<?>) inputElement).toArray();
+ }
+ // TODO Auto-generated method stub
+ return new Object[] {};
+ }
+
+ public void dispose() {
+
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ // TODO Auto-generated method stub
+
+ }
+
+ }
+
+ public class KeyValueModel {
+ private String key;
+ private String value;
+
+ public KeyValueModel(String key, String value) {
+ this.key = key;
+ this.value = value;
+ }
+
+ public String getKey() {
+ return key;
+ }
+
+ public void setKey(String key) {
+ this.key = key;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+ }
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json12/Json12DataConfiguraitonWizardPage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json12/Json12DataPathWizardPage.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json12/Json12DataPathWizardPage.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json12/Json12DataPathWizardPage.java 2009-08-18 08:26:17 UTC (rev 17119)
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * 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.json12;
+
+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 Json12DataPathWizardPage extends AbstractFileSelectionWizardPage {
+
+ public Json12DataPathWizardPage(String pageName, boolean multiSelect, Object[] initSelections,
+ List<ViewerFilter> filters) {
+ super(pageName, multiSelect, initSelections, filters);
+ }
+
+ public Json12DataPathWizardPage(String pageName, String[] fileExtensionNames) {
+ super(pageName, fileExtensionNames);
+ this.setTitle("JSON file selection");
+ this.setDescription("Select a JSON data file");
+ }
+
+
+
+ /* (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/json12/Json12DataPathWizardPage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json12/Json12DataWizard.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json12/Json12DataWizard.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json12/Json12DataWizard.java 2009-08-18 08:26:17 UTC (rev 17119)
@@ -0,0 +1,308 @@
+/*******************************************************************************
+ * 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.json12;
+
+import java.util.Iterator;
+import java.util.List;
+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.json12.Json12DataConfiguraitonWizardPage.KeyValueModel;
+import org.jboss.tools.smooks.configuration.editors.uitls.JsonInputDataParser;
+import org.jboss.tools.smooks.configuration.editors.wizard.IStructuredDataSelectionWizard;
+import org.jboss.tools.smooks.model.json12.Json12Factory;
+import org.jboss.tools.smooks.model.json12.Json12Package;
+import org.jboss.tools.smooks.model.json12.Json12Reader;
+import org.jboss.tools.smooks.model.json12.Key;
+import org.jboss.tools.smooks.model.json12.KeyMap;
+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;
+
+/**
+ * @author Dart (dpeng(a)redhat.com)
+ *
+ */
+public class Json12DataWizard extends Wizard implements IStructuredDataSelectionWizard, INewWizard {
+
+ private Json12DataPathWizardPage pathPage = null;
+
+ private Json12DataConfiguraitonWizardPage configPage = null;
+
+ private SmooksResourceListType resourceList;
+
+ private EditingDomain editingDomain;
+
+ public Json12DataWizard() {
+ super();
+ this.setWindowTitle("JSON Input Data Wizard (version 1.2)");
+ }
+
+ public boolean canFinish() {
+ if (configPage != null && pathPage != null) {
+ if (configPage.isPageComplete() && pathPage.isPageComplete())
+ return true;
+ }
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.wizard.Wizard#addPages()
+ */
+ @Override
+ public void addPages() {
+ super.addPages();
+ if (pathPage == null) {
+ pathPage = new Json12DataPathWizardPage("Json Input Data Selection ", new String[] {});
+
+ }
+ if (configPage == null) {
+ configPage = new Json12DataConfiguraitonWizardPage("Json data configuration page");
+ configPage.setSmooksResourceList(resourceList);
+ }
+ this.addPage(pathPage);
+ this.addPage(configPage);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.wizard.Wizard#performFinish()
+ */
+ @Override
+ public boolean performFinish() {
+ if (editingDomain == null || resourceList == null) {
+ return true;
+ }
+ if (configPage != null && configPage.isCreateJsonReader()) {
+ List<KeyValueModel> keyMapList = configPage.getKeyValueList();
+
+ Json12Reader reader = Json12Factory.eINSTANCE.createJson12Reader();
+ if (keyMapList != null && !keyMapList.isEmpty()) {
+ KeyMap map = Json12Factory.eINSTANCE.createKeyMap();
+ for (Iterator<?> iterator = keyMapList.iterator(); iterator.hasNext();) {
+ KeyValueModel keyValueModel = (KeyValueModel) iterator.next();
+ String key = keyValueModel.getKey();
+ String value = keyValueModel.getValue();
+ Key k = Json12Factory.eINSTANCE.createKey();
+ k.setFrom(key);
+ k.setTo(value);
+ map.getKey().add(k);
+ }
+ reader.setKeyMap(map);
+ }
+
+ String aen = configPage.getArrayElementName();
+ if (aen != null && aen.length() != 0) {
+ reader.setArrayElementName(aen);
+ }
+
+ String rn = configPage.getRootName();
+ if (rn != null && rn.length() != 0) {
+ reader.setRootName(rn);
+ }
+
+ String encoding = configPage.getEncoding();
+ if (encoding != null && encoding.length() != 0) {
+ reader.setEncoding(encoding);
+ }
+
+ String sr = configPage.getKeyWhitspaceReplacement();
+ if (sr != null && sr.length() != 0) {
+ reader.setKeyWhitspaceReplacement(sr);
+ }
+
+ String pon = configPage.getKeyPrefixOnNumeric();
+ if (pon != null && pon.length() != 0) {
+ reader.setKeyPrefixOnNumeric(pon);
+ }
+
+ String nvr = configPage.getNullValueReplacement();
+ if (nvr != null && nvr.length() != 0) {
+ reader.setNullValueReplacement(nvr);
+ }
+
+ String ier = configPage.getIllegalElementNameCharReplacement();
+ if (ier != null && ier.length() != 0) {
+ reader.setIllegalElementNameCharReplacement(ier);
+ }
+ String indent = configPage.getIndent();
+ if (indent != null && indent.length() != 0) {
+ boolean indentValue = Boolean.valueOf(indent).booleanValue();
+ reader.setIndent(indentValue);
+ }
+
+ Command command = AddCommand.create(editingDomain, resourceList,
+ SmooksPackage.Literals.SMOOKS_RESOURCE_LIST_TYPE__ABSTRACT_READER_GROUP, FeatureMapUtil
+ .createEntry(Json12Package.Literals.JSON12_DOCUMENT_ROOT__READER, reader));
+ editingDomain.getCommandStack().execute(command);
+ }
+ return true;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench,
+ * org.eclipse.jface.viewers.IStructuredSelection)
+ */
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.jboss.tools.smooks.configuration.editors.wizard.
+ * IStructuredDataSelectionWizard#getInputDataTypeID()
+ */
+ public String getInputDataTypeID() {
+ // TODO Auto-generated method stub
+ return SmooksModelUtils.INPUT_TYPE_JSON_1_2;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.jboss.tools.smooks.configuration.editors.wizard.
+ * IStructuredDataSelectionWizard#getProperties()
+ */
+ public Properties getProperties() {
+ Properties properties = new Properties();
+ fillProperties(properties);
+ return properties;
+ }
+
+ private void fillProperties(Properties p) {
+ if (configPage != null) {
+
+ boolean createJsonReader = configPage.isCreateJsonReader();
+ boolean useJsonReader = configPage.isUseAvailabelReader();
+ if (createJsonReader || useJsonReader) {
+ p.setProperty(JsonInputDataParser.LINK_JSON_READER, "true");
+ return;
+ }
+
+ List<KeyValueModel> keyMapList = configPage.getKeyValueList();
+ for (Iterator<?> iterator = keyMapList.iterator(); iterator.hasNext();) {
+ KeyValueModel keyValueModel = (KeyValueModel) iterator.next();
+ String key = keyValueModel.getKey();
+ String value = keyValueModel.getValue();
+ p.setProperty(JsonInputDataParser.KEY + key, value);
+ }
+
+ String aen = configPage.getArrayElementName();
+ if (aen != null && aen.length() != 0) {
+ p.setProperty(JsonInputDataParser.ARRAY_ELEMENT_NAME, aen);
+ }
+
+ String rn = configPage.getRootName();
+ if (rn != null && rn.length() != 0) {
+ p.setProperty(JsonInputDataParser.ROOT_NAME, rn);
+ }
+
+ String encoding = configPage.getEncoding();
+ if (encoding != null && encoding.length() != 0) {
+ p.setProperty(JsonInputDataParser.ENCODING2, encoding);
+ }
+
+ String sr = configPage.getKeyWhitspaceReplacement();
+ if (sr != null && sr.length() != 0) {
+ p.setProperty(JsonInputDataParser.SPACE_REPLACE, sr);
+ }
+
+ String pon = configPage.getKeyPrefixOnNumeric();
+ if (pon != null && pon.length() != 0) {
+ p.setProperty(JsonInputDataParser.PREFIX_ON_NUMERIC, pon);
+ }
+
+ String nvr = configPage.getNullValueReplacement();
+ if (nvr != null && nvr.length() != 0) {
+ p.setProperty(JsonInputDataParser.NULL_REPLACE, nvr);
+ }
+
+ String ier = configPage.getIllegalElementNameCharReplacement();
+ if (ier != null && ier.length() != 0) {
+ p.setProperty(JsonInputDataParser.ILLEGAL_REPLACE, ier);
+ }
+
+ String indent = configPage.getIndent();
+ if (indent != null && indent.length() != 0) {
+ p.setProperty(JsonInputDataParser.INDENT, indent);
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.jboss.tools.smooks.configuration.editors.wizard.
+ * IStructuredDataSelectionWizard#getReturnData()
+ */
+ public Object getReturnData() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.jboss.tools.smooks.configuration.editors.wizard.
+ * IStructuredDataSelectionWizard#getStructuredDataSourcePath()
+ */
+ public String getStructuredDataSourcePath() {
+ if (pathPage != null) {
+ return pathPage.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 (configPage != null) {
+ configPage.setSmooksResourceList(resourceList);
+ }
+ }
+
+ public void complate(SmooksMultiFormEditor formEditor) {
+
+ }
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json12/Json12DataWizard.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/JsonInputDataParser.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/JsonInputDataParser.java 2009-08-18 07:03:12 UTC (rev 17118)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/JsonInputDataParser.java 2009-08-18 08:26:17 UTC (rev 17119)
@@ -7,8 +7,8 @@
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
-import java.io.StringWriter;
import java.lang.reflect.InvocationTargetException;
+import java.nio.charset.Charset;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -18,7 +18,6 @@
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.dom.DOMResult;
import javax.xml.transform.stream.StreamSource;
import org.dom4j.DocumentException;
@@ -30,15 +29,15 @@
import org.jboss.tools.smooks.model.json.JsonReader;
import org.jboss.tools.smooks.model.json.Key;
import org.jboss.tools.smooks.model.json.KeyMap;
+import org.jboss.tools.smooks.model.json12.Json12Package;
+import org.jboss.tools.smooks.model.json12.Json12Reader;
import org.jboss.tools.smooks.model.smooks.AbstractReader;
import org.jboss.tools.smooks.model.smooks.SmooksResourceListType;
+import org.jboss.tools.smooks10.model.smooks.util.SmooksModelUtils;
import org.milyn.Smooks;
-import org.milyn.SmooksUtil;
import org.milyn.cdr.Parameter;
-import org.milyn.cdr.SmooksResourceConfiguration;
-import org.milyn.json.JSONReader;
-import org.milyn.xml.XmlUtil;
-import org.w3c.dom.Document;
+import org.milyn.json.JSONReaderConfigurator;
+import org.milyn.payload.StringResult;
import org.w3c.dom.Element;
/**
@@ -54,10 +53,11 @@
public static final String SPACE_REPLACE = "spaceReplace";
public static final String PREFIX_ON_NUMERIC = "prefixOnNumeric";
public static final String ILLEGAL_REPLACE = "illegalReplace";
+ public static final String INDENT = "indent";
public static final String ARRAY_ELEMENT_NAME = "arrayElementName";
public static final String ROOT_NAME = "rootName";
- public IXMLStructuredObject parseJsonFile(InputStream inputStream, JsonReader reader)
+ public IXMLStructuredObject parseJsonFile(InputStream inputStream, Object readerObj)
throws ParserConfigurationException, DocumentException {
String rootName = null;
String arrayElementName = null;
@@ -66,26 +66,55 @@
String illegalElementNameCharReplacement = null;
String nullValueReplacement = null;
String encoding = null;
+ String indent = null;
Map<String, String> keyMap = new HashMap<String, String>();
- if (reader == null)
+ if (readerObj == null)
return null;
- rootName = reader.getRootName();
- arrayElementName = reader.getArrayElementName();
- keyPrefixOnNumeric = reader.getKeyPrefixOnNumeric();
- keyWhitspaceReplacement = reader.getKeyWhitspaceReplacement();
- illegalElementNameCharReplacement = reader.getIllegalElementNameCharReplacement();
- nullValueReplacement = reader.getNullValueReplacement();
- encoding = reader.getEncoding();
- KeyMap km = reader.getKeyMap();
- if (km != null) {
- List<Key> keyList = km.getKey();
- for (Iterator<?> iterator = keyList.iterator(); iterator.hasNext();) {
- Key key = (Key) iterator.next();
- keyMap.put(key.getFrom(), key.getTo());
+ if (readerObj instanceof JsonReader) {
+ JsonReader reader = (JsonReader) readerObj;
+ rootName = reader.getRootName();
+ arrayElementName = reader.getArrayElementName();
+ keyPrefixOnNumeric = reader.getKeyPrefixOnNumeric();
+ keyWhitspaceReplacement = reader.getKeyWhitspaceReplacement();
+ illegalElementNameCharReplacement = reader.getIllegalElementNameCharReplacement();
+ nullValueReplacement = reader.getNullValueReplacement();
+ encoding = reader.getEncoding();
+ KeyMap km = reader.getKeyMap();
+ if (km != null) {
+ List<Key> keyList = km.getKey();
+ for (Iterator<?> iterator = keyList.iterator(); iterator.hasNext();) {
+ Key key = (Key) iterator.next();
+ keyMap.put(key.getFrom(), key.getTo());
+ }
}
}
+
+ if (readerObj instanceof Json12Reader) {
+ Json12Reader reader = (Json12Reader) readerObj;
+ rootName = reader.getRootName();
+ arrayElementName = reader.getArrayElementName();
+ keyPrefixOnNumeric = reader.getKeyPrefixOnNumeric();
+ keyWhitspaceReplacement = reader.getKeyWhitspaceReplacement();
+ illegalElementNameCharReplacement = reader.getIllegalElementNameCharReplacement();
+ nullValueReplacement = reader.getNullValueReplacement();
+ encoding = reader.getEncoding();
+ boolean isSet = reader.eIsSet(Json12Package.Literals.JSON12_READER__INDENT);
+ if (isSet) {
+ indent = String.valueOf(reader.isIndent());
+ }
+ org.jboss.tools.smooks.model.json12.KeyMap km = reader.getKeyMap();
+ if (km != null) {
+ List<?> keyList = km.getKey();
+ for (Iterator<?> iterator = keyList.iterator(); iterator.hasNext();) {
+ org.jboss.tools.smooks.model.json12.Key key = (org.jboss.tools.smooks.model.json12.Key) iterator
+ .next();
+ keyMap.put(key.getFrom(), key.getTo());
+ }
+ }
+ }
+
return this.parseJsonFile(inputStream, rootName, arrayElementName, keyWhitspaceReplacement, keyPrefixOnNumeric,
- illegalElementNameCharReplacement, nullValueReplacement, keyMap, encoding);
+ illegalElementNameCharReplacement, nullValueReplacement, keyMap, indent, encoding);
}
public IXMLStructuredObject parseJsonFile(InputStream stream, InputType inputType,
@@ -99,6 +128,10 @@
String illegalElementNameCharReplacement = null;
String nullValueReplacement = null;
String encoding = null;
+ String indent = null;
+
+ String type = inputType.getType();
+
Map<String, String> keyMap = new HashMap<String, String>();
for (Iterator<?> iterator = paramList.iterator(); iterator.hasNext();) {
@@ -110,12 +143,22 @@
int index = -1;
for (Iterator<?> iterator2 = readers.iterator(); iterator2.hasNext();) {
AbstractReader abstractReader = (AbstractReader) iterator2.next();
- if (abstractReader instanceof JsonReader) {
- count++;
- if (index == -1) {
- index = readers.indexOf(abstractReader);
+ if (SmooksModelUtils.INPUT_TYPE_JSON_1_1.equals(type)) {
+ if (abstractReader instanceof JsonReader) {
+ count++;
+ if (index == -1) {
+ index = readers.indexOf(abstractReader);
+ }
}
}
+ if (SmooksModelUtils.INPUT_TYPE_JSON_1_2.equals(type)) {
+ if (abstractReader instanceof Json12Reader) {
+ count++;
+ if (index == -1) {
+ index = readers.indexOf(abstractReader);
+ }
+ }
+ }
}
if (count > 1) {
@@ -123,7 +166,7 @@
// RuntimeException("The smooks config file should have only one JSON reader");
}
if (index != -1) {
- return parseJsonFile(stream, (JsonReader) readers.get(index));
+ return parseJsonFile(stream, readers.get(index));
}
}
@@ -154,10 +197,14 @@
if (paramType.getName().equals(NULL_REPLACE)) {
nullValueReplacement = paramType.getValue();
}
+
+ if (paramType.getName().equals(INDENT)) {
+ indent = paramType.getValue();
+ }
}
return this.parseJsonFile(stream, rootName, arrayElementName, keyWhitspaceReplacement, keyPrefixOnNumeric,
- illegalElementNameCharReplacement, nullValueReplacement, keyMap, encoding);
+ illegalElementNameCharReplacement, nullValueReplacement, keyMap, indent, encoding);
}
public IXMLStructuredObject parseJsonFile(String filePath, InputType inputType, SmooksResourceListType resourceList)
@@ -168,62 +215,64 @@
public IXMLStructuredObject parseJsonFile(String filePath, String rootName, String arrayElementName,
String keyWhitspaceReplacement, String keyPrefixOnNumeric, String illegalElementNameCharReplacement,
- String nullValueReplacement, Map<String, String> keyMap, String encoding) throws FileNotFoundException,
- ParserConfigurationException, DocumentException, InvocationTargetException {
+ String nullValueReplacement, Map<String, String> keyMap, String indent, String encoding)
+ throws FileNotFoundException, ParserConfigurationException, DocumentException, InvocationTargetException {
return this.parseJsonFile(new FileInputStream(SmooksUIUtils.parseFilePath(filePath)), rootName,
arrayElementName, keyWhitspaceReplacement, keyPrefixOnNumeric, illegalElementNameCharReplacement,
- nullValueReplacement, keyMap, encoding);
+ nullValueReplacement, keyMap, indent, encoding);
}
public IXMLStructuredObject parseJsonFile(InputStream inputStream, String rootName, String arrayElementName,
String keyWhitspaceReplacement, String keyPrefixOnNumeric, String illegalElementNameCharReplacement,
- String nullValueReplacement, Map<String, String> keyMap, String encoding)
+ String nullValueReplacement, Map<String, String> keyMap, String indent, String encoding)
throws ParserConfigurationException, DocumentException {
Smooks smooks = new Smooks();
- SmooksResourceConfiguration readerConfig = new SmooksResourceConfiguration("org.xml.sax.driver",
- JSONReader.class.getName());
-
- readerConfig.setParameter(ROOT_NAME, rootName);
- readerConfig.setParameter(ARRAY_ELEMENT_NAME, arrayElementName);
+ JSONReaderConfigurator readerConfig = new JSONReaderConfigurator();
+ if (arrayElementName != null) {
+ readerConfig.setArrayElementName(arrayElementName);
+ }
+ if (rootName != null) {
+ readerConfig.setRootName(rootName);
+ }
if (keyWhitspaceReplacement != null) {
- readerConfig.setParameter("keyWhitspaceReplacement", keyWhitspaceReplacement);
+ readerConfig.setKeyWhitspaceReplacement(keyWhitspaceReplacement);
}
if (keyPrefixOnNumeric != null) {
- readerConfig.setParameter("keyPrefixOnNumeric", keyPrefixOnNumeric);
+ readerConfig.setKeyPrefixOnNumeric(keyPrefixOnNumeric);
}
if (illegalElementNameCharReplacement != null) {
- readerConfig.setParameter("illegalElementNameCharReplacement", illegalElementNameCharReplacement);
+ readerConfig.setIllegalElementNameCharReplacement(illegalElementNameCharReplacement);
}
if (nullValueReplacement != null) {
- readerConfig.setParameter("nullValueReplacement", nullValueReplacement);
+ readerConfig.setNullValueReplacement(nullValueReplacement);
}
if (keyMap != null) {
- readerConfig.setParameter(keyMapToParameter(keyMap));
+ readerConfig.setKeyMap(keyMap);
}
- readerConfig.setParameter(ENCODING2, encoding);
+ readerConfig.setEncoding(Charset.forName(encoding));
- SmooksUtil.registerResource(readerConfig, smooks);
+ if (indent != null) {
+ // readerConfig.set
+ }
+ // readerConfig.setParameter(ENCODING2, encoding);
+
+ smooks.setReaderConfig(readerConfig);
+
// Use a DOM result to capture the message model for the supplied CSV
// message...
- DOMResult domResult = new DOMResult();
+ StringResult result = new StringResult();
// Filter the message through Smooks and capture the result as a DOM in
// the domResult instance...
- smooks.filter(new StreamSource(inputStream), domResult);
+ smooks.filterSource(new StreamSource(inputStream), result);
- // Get the Document object from the domResult. This is the message
- // model!!!...
- Document model = (Document) domResult.getNode();
- StringWriter modelWriter = new StringWriter();
- XmlUtil.serialize(model, true, modelWriter);
-
XMLObjectAnalyzer analyzer = new XMLObjectAnalyzer();
- ByteArrayInputStream byteinputStream = new ByteArrayInputStream(modelWriter.toString().getBytes());
+ ByteArrayInputStream byteinputStream = new ByteArrayInputStream(result.getResult().getBytes());
TagList tagList = analyzer.analyze(byteinputStream, null);
try {
@@ -231,10 +280,6 @@
byteinputStream.close();
byteinputStream = null;
}
- if (modelWriter != null) {
- modelWriter.close();
- modelWriter = null;
- }
if (smooks != null) {
smooks.close();
smooks = null;
@@ -243,10 +288,10 @@
inputStream.close();
inputStream = null;
}
- model = null;
+ result = null;
} catch (Throwable t) {
// ignore
-// t.printStackTrace();
+ // t.printStackTrace();
}
return tagList;
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 2009-08-18 07:03:12 UTC (rev 17118)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/wizard/ViewerInitorStore.java 2009-08-18 08:26:17 UTC (rev 17119)
@@ -24,6 +24,7 @@
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.json.JsonDataWizard;
+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;
import org.jboss.tools.smooks.configuration.editors.xml.XMLStructuredDataWizard;
@@ -145,7 +146,7 @@
String name = "Json 1.1";
String description = "Select Json data file as the input data.";
String iconPath = null;
- String typeID = SmooksModelUtils.INPUT_TYPE_JSON;
+ String typeID = SmooksModelUtils.INPUT_TYPE_JSON_1_1;
jsonViewerInitor.setName(name);
jsonViewerInitor.setDescription(description);
@@ -156,7 +157,25 @@
jsonViewerInitor.setStructuredDataLoadWizard(new JsonDataWizard());
// jsonViewerInitor.setWizardIconPath(GraphicsConstants.IMAGE_JAVA_FILE);
map.put(typeID, jsonViewerInitor);
+
+ // for json 1.2
+ BaseViewerInitor json12ViewerInitor = new BaseViewerInitor();
+ name = "Json 1.2";
+ description = "Select Json data file as the input data.(version 1.2)";
+ iconPath = null;
+ typeID = SmooksModelUtils.INPUT_TYPE_JSON_1_2;
+ json12ViewerInitor.setName(name);
+ json12ViewerInitor.setDescription(description);
+ json12ViewerInitor.setWizardIconPath(iconPath);
+ json12ViewerInitor.setTypeID(typeID);
+ json12ViewerInitor.setLabelProvider(new XMLStructuredDataLabelProvider());
+ json12ViewerInitor.setTreeContentProvider(new XMLStructuredDataContentProvider());
+ json12ViewerInitor.setStructuredDataLoadWizard(new Json12DataWizard());
+ json12ViewerInitor.setWizardIconPath(GraphicsConstants.IMAGE_JAVA_FILE);
+ map.put(typeID, json12ViewerInitor);
+
+
// for java
BaseViewerInitor javabeanViewerInitor = new BaseViewerInitor();
name = "Java";
@@ -247,7 +266,7 @@
name = "EDI 1.1";
description = "Select EDI data file as the input data.";
iconPath = null;
- typeID = SmooksModelUtils.INPUT_TYPE_EDI;
+ typeID = SmooksModelUtils.INPUT_TYPE_EDI_1_1;
ediViewerInitor.setName(name);
ediViewerInitor.setDescription(description);
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/edimap/editor/EDIMapFormPage.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/edimap/editor/EDIMapFormPage.java 2009-08-18 07:03:12 UTC (rev 17118)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/edimap/editor/EDIMapFormPage.java 2009-08-18 08:26:17 UTC (rev 17119)
@@ -434,7 +434,7 @@
List<InputType> inputList = ext.getInput();
for (Iterator<?> iterator = inputList.iterator(); iterator.hasNext();) {
InputType inputType = (InputType) iterator.next();
- if (SmooksModelUtils.INPUT_TYPE_EDI.equals(inputType.getType())) {
+ if (SmooksModelUtils.INPUT_TYPE_EDI_1_1.equals(inputType.getType())) {
List<ParamType> paramList = inputType.getParam();
for (Iterator<?> iterator2 = paramList.iterator(); iterator2.hasNext();) {
ParamType paramType = (ParamType) iterator2.next();
@@ -454,7 +454,7 @@
List<InputType> inputList = ext.getInput();
for (Iterator<?> iterator = inputList.iterator(); iterator.hasNext();) {
InputType inputType = (InputType) iterator.next();
- if (SmooksModelUtils.INPUT_TYPE_EDI.equals(inputType.getType())) {
+ if (SmooksModelUtils.INPUT_TYPE_EDI_1_1.equals(inputType.getType())) {
List<ParamType> paramList = inputType.getParam();
for (Iterator<?> iterator2 = paramList.iterator(); iterator2.hasNext();) {
ParamType paramType = (ParamType) iterator2.next();
@@ -758,7 +758,7 @@
List<InputType> list = ext.getInput();
for (Iterator<?> iterator = list.iterator(); iterator.hasNext();) {
InputType inputType = (InputType) iterator.next();
- if (SmooksModelUtils.INPUT_TYPE_EDI.equals(inputType.getType())) {
+ if (SmooksModelUtils.INPUT_TYPE_EDI_1_1.equals(inputType.getType())) {
inputType1[0] = inputType;
break;
}
@@ -774,7 +774,7 @@
* @see java.lang.Runnable#run()
*/
public void run() {
- String type = SmooksModelUtils.INPUT_TYPE_EDI;
+ String type = SmooksModelUtils.INPUT_TYPE_EDI_1_1;
SmooksGraphicsExtType extType = modelProvider.getSmooksGraphicsExt();
InputType input = inputType1[0];
if (input == null) {
@@ -1301,7 +1301,7 @@
List<InputType> list = ext.getInput();
for (Iterator<?> iterator = list.iterator(); iterator.hasNext();) {
InputType inputType = (InputType) iterator.next();
- if (SmooksModelUtils.INPUT_TYPE_EDI.equals(inputType.getType())) {
+ if (SmooksModelUtils.INPUT_TYPE_EDI_1_1.equals(inputType.getType())) {
inputType1[0] = inputType;
break;
}
@@ -1315,7 +1315,7 @@
*/
public void run() {
SmooksUIUtils.recordInputDataInfomation(inputType1[0], modelProvider.getSmooksGraphicsExt(),
- SmooksModelUtils.INPUT_TYPE_EDI, ediFilePath, null);
+ SmooksModelUtils.INPUT_TYPE_EDI_1_1, ediFilePath, null);
}
});
16 years, 4 months
JBoss Tools SVN: r17118 - in trunk/bpel/docs/reference: en and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: Grid.Qian
Date: 2009-08-18 03:03:12 -0400 (Tue, 18 Aug 2009)
New Revision: 17118
Added:
trunk/bpel/docs/reference/en/master.xml
trunk/bpel/docs/reference/pom.xml
Log:
add the docs for bpel
Added: trunk/bpel/docs/reference/en/master.xml
===================================================================
--- trunk/bpel/docs/reference/en/master.xml (rev 0)
+++ trunk/bpel/docs/reference/en/master.xml 2009-08-18 07:03:12 UTC (rev 17118)
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3CR3//EN"
+"http://www.docbook.org/xml/4.3/docbookx.dtd"
+
+[<!ENTITY overview SYSTEM "modules/overview.xml">
+<!ENTITY install SYSTEM "modules/install.xml">
+<!ENTITY detail SYSTEM "modules/detail.xml">
+<!ENTITY deploy SYSTEM "modules/deploy.xml">
+]>
+
+<book>
+
+ <bookinfo>
+ <title>JBoss BPEL User Guide</title>
+
+ <corpauthor>
+ <inlinemediaobject>
+ <imageobject role="fo">
+ <imagedata format="PNG" fileref="images/jbosstools_logo.png" />
+ </imageobject>
+ <imageobject role="html">
+ <imagedata/>
+ </imageobject>
+ </inlinemediaobject>
+ </corpauthor>
+ <author><firstname>Denny</firstname><surname>Xu</surname><email>dxu(a)redhat.com</email></author>
+ <author><firstname>Grid</firstname><surname>Qian</surname><email>fqian(a)redhat.com</email></author>
+ <pubdate>August 2009</pubdate>
+ <copyright>
+ <year>2009</year>
+ <holder>JBoss by Red Hat</holder>
+ </copyright>
+ <releaseinfo>
+ Version: 1.0.0
+ </releaseinfo>
+<abstract>
+ <title/>
+ <para>
+ <ulink url="http://download.jboss.org/jbosstools/nightly-docs/en/bpel_ref_guide/pdf/B...">PDF version</ulink>
+ </para>
+</abstract>
+
+
+ </bookinfo>
+
+ <toc/>
+ &overview;
+ &install;
+ &detail;
+ &deploy;
+</book>
Added: trunk/bpel/docs/reference/pom.xml
===================================================================
--- trunk/bpel/docs/reference/pom.xml (rev 0)
+++ trunk/bpel/docs/reference/pom.xml 2009-08-18 07:03:12 UTC (rev 17118)
@@ -0,0 +1,170 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.jboss.tools</groupId>
+ <artifactId>bpel-ref-guide-${translation}</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>jdocbook</packaging>
+ <name>BPEL_Reference_Guide</name>
+
+ <profiles>
+ <profile>
+ <id>release</id>
+ <properties>
+ <master>master_output.xml</master>
+ <xsl-single>classpath:/xslt/org/jboss/tools/xhtml-single-release.xsl</xsl-single>
+ <xsl-chunked>classpath:/xslt/org/jboss/tools/xhtml-release.xsl</xsl-chunked>
+ <xsl-pdf>classpath:/xslt/org/jboss/tools/pdf.xsl</xsl-pdf>
+ </properties>
+ </profile>
+ <profile>
+ <id>releaseTest</id>
+ <properties>
+ <master>master_output.xml</master>
+ <xsl-single>classpath:/xslt/org/jboss/tools/xhtml-single-release-nomarker.xsl</xsl-single>
+ <xsl-chunked>classpath:/xslt/org/jboss/tools/xhtml-release-nomarker.xsl</xsl-chunked>
+ <xsl-pdf>classpath:/xslt/org/jboss/tools/pdf.xsl</xsl-pdf>
+ </properties>
+ </profile>
+ <profile>
+ <id>releaseJBDS</id>
+ <properties>
+ <master>master_output.xml</master>
+ <xsl-single>classpath:/xslt/com/jboss/tools/xhtml-single-release-nomarker.xsl</xsl-single>
+ <xsl-chunked>classpath:/xslt/com/jboss/tools/xhtml-release-nomarker.xsl</xsl-chunked>
+ <xsl-pdf>classpath:/xslt/com/jboss/tools/pdf.xsl</xsl-pdf>
+ <cssdir>../../../documentation/jbosstools-jdocbook-style/src/main/com/css/</cssdir>
+ </properties>
+ </profile>
+ <profile>
+ <id>diffmk</id>
+ <properties>
+ <master>master_output.xml</master>
+ <xsl-single>classpath:/xslt/org/jboss/tools/xhtml-single-diff.xsl</xsl-single>
+ <xsl-chunked>classpath:/xslt/org/jboss/tools/xhtml-diff.xsl</xsl-chunked>
+ <xsl-pdf>classpath:/xslt/org/jboss/tools/pdf-diff.xsl</xsl-pdf>
+ </properties>
+ </profile>
+ </profiles>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jdocbook-plugin</artifactId>
+ <version>2.1.0-200803311251UTC-MPJDOCBOOK-8</version>
+
+ <extensions>true</extensions>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.tools</groupId>
+ <artifactId>jbosstools-docbook-xslt</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>com.jboss</groupId>
+ <artifactId>jbossent-docbook-xslt</artifactId>
+ <version>1.0.0</version>
+ </dependency>
+ <dependency>
+ <groupId>com.jboss</groupId>
+ <artifactId>jbossent-jdocbook-style</artifactId>
+ <version>1.0.0</version>
+ <type>jdocbook-style</type>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossorg-docbook-xslt</artifactId>
+ <version>1.1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jbossorg-jdocbook-style</artifactId>
+ <version>1.1.0</version>
+ <type>jdocbook-style</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.xmlgraphics</groupId>
+ <artifactId>fop</artifactId>
+ <version>0.95</version>
+ </dependency>
+ </dependencies>
+
+ <configuration>
+ <sourceDocumentName>${master}</sourceDocumentName>
+ <sourceDirectory>${pom.basedir}/en</sourceDirectory>
+ <imageResource>
+ <directory>${pom.basedir}/en</directory>
+ <includes>
+ <include>images/**/*</include>
+ </includes>
+ </imageResource>
+ <cssResource>
+ <directory>${pom.basedir}/${cssdir}</directory>
+ </cssResource>
+
+ <formats>
+ <format>
+ <formatName>pdf</formatName>
+ <stylesheetResource>${xsl-pdf}</stylesheetResource>
+ <finalName>${pom.name}.pdf</finalName>
+ </format>
+ <format>
+ <formatName>html</formatName>
+ <stylesheetResource>${xsl-chunked}</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ <format>
+ <formatName>html_single</formatName>
+ <stylesheetResource>${xsl-single}</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ <format>
+ <formatName>eclipse</formatName>
+ <stylesheetResource>classpath:/xslt/org/jboss/eclipse.xsl</stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ </formats>
+
+ <options>
+ <xincludeSupported>true</xincludeSupported>
+ <xmlTransformerType>saxon</xmlTransformerType>
+ <!-- needed for uri-resolvers; can be ommitted if using 'current' uri scheme -->
+ <!-- could also locate the docbook dependency and inspect its version... -->
+ <docbookVersion>1.72.0</docbookVersion>
+ </options>
+
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
+
+ <distributionManagement>
+ <repository>
+ <!-- Copy the dist to the local checkout of the JBoss maven2 repo ${maven.repository.root} -->
+ <!-- It is anticipated that ${maven.repository.root} be set in user's settings.xml -->
+ <!-- todo : replace this with direct svn access once the svnkit providers are available -->
+ <id>repository.jboss.org</id>
+ <url>file://${maven.repository.root}</url>
+ </repository>
+ <snapshotRepository>
+ <id>snapshots.jboss.org</id>
+ <name>JBoss Snapshot Repository</name>
+ <url>dav:https://snapshots.jboss.org/maven2</url>
+ </snapshotRepository>
+ </distributionManagement>
+
+ <properties>
+ <xsl-single>classpath:/xslt/org/jboss/tools/xhtml-single.xsl</xsl-single>
+ <xsl-chunked>classpath:/xslt/org/jboss/tools/xhtml.xsl</xsl-chunked>
+ <xsl-pdf>classpath:/xslt/org/jboss/tools/pdf.xsl</xsl-pdf>
+ <cssdir>../../../documentation/jbosstools-jdocbook-style/src/main/org/css/</cssdir>
+ <master>master.xml</master>
+ <translation>en-US</translation>
+ </properties>
+
+</project>
16 years, 4 months
JBoss Tools SVN: r17115 - trunk/bpel.
by jbosstools-commits@lists.jboss.org
Author: Grid.Qian
Date: 2009-08-18 02:45:50 -0400 (Tue, 18 Aug 2009)
New Revision: 17115
Added:
trunk/bpel/docs/
Log:
16 years, 4 months
JBoss Tools SVN: r17114 - trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/pages.
by jbosstools-commits@lists.jboss.org
Author: dennyxu
Date: 2009-08-17 23:33:52 -0400 (Mon, 17 Aug 2009)
New Revision: 17114
Modified:
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/pages/JBossESBRuntimeContainerPage.java
Log:
JBIDE-4331: Exception when adding ESB library to class path
Modified: trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/pages/JBossESBRuntimeContainerPage.java
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/pages/JBossESBRuntimeContainerPage.java 2009-08-17 23:55:17 UTC (rev 17113)
+++ trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/pages/JBossESBRuntimeContainerPage.java 2009-08-18 03:33:52 UTC (rev 17114)
@@ -165,6 +165,9 @@
Object element) {
if(element instanceof IRuntime){
IPath location = ((IRuntime)element).getLocation();
+
+ if(location == null) return false;
+
return JBossRuntimeManager.isValidESBServer(location.toOSString(), "");
}
return true;
16 years, 4 months
JBoss Tools SVN: r17113 - in trunk/as/plugins: org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers and 5 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2009-08-17 19:55:17 -0400 (Mon, 17 Aug 2009)
New Revision: 17113
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/DeploymentPreferenceLoader.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ModuleDeploymentPage.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/PackagesPublisher.java
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/WTPZippedPublisher.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublishUtil.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/SingleFilePublisher.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/ServerListener.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/xpl/PublishCopyUtil.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/IJBossToolingConstants.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploySection.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml
Log:
JBIDE-4374 - can still use a bit of cleanup though, perhaps in UI
Modified: trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/PackagesPublisher.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/PackagesPublisher.java 2009-08-17 17:02:20 UTC (rev 17112)
+++ trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/PackagesPublisher.java 2009-08-17 23:55:17 UTC (rev 17113)
@@ -35,6 +35,7 @@
import org.jboss.ide.eclipse.archives.webtools.modules.PackageModuleFactory.ExtendedModuleFile;
import org.jboss.ide.eclipse.archives.webtools.modules.PackageModuleFactory.IExtendedModuleResource;
import org.jboss.ide.eclipse.archives.webtools.modules.PackageModuleFactory.PackagedModuleDelegate;
+import org.jboss.ide.eclipse.as.core.publishers.PublishUtil;
import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
import org.jboss.ide.eclipse.as.core.server.IJBossServerPublisher;
import org.jboss.ide.eclipse.as.core.util.FileUtil;
@@ -106,9 +107,11 @@
// remove all of the deployed items
if( pack != null ) {
IPath sourcePath = pack.getArchiveFilePath();
- IPath destPath = new Path(server.getDeployFolder()).append(sourcePath.lastSegment());
+ IModule[] tree = new IModule[] { module };
+ IPath destPath = PublishUtil.getDeployPath(tree, server);
+ IPath destPath2 = destPath.append(sourcePath.lastSegment());
// remove the entire file or folder
- FileUtil.safeDelete(destPath.toFile(), listener);
+ FileUtil.safeDelete(destPath2.toFile(), listener);
}
}
@@ -117,7 +120,8 @@
protected void publishModule(IModule module, boolean incremental, IProgressMonitor monitor) {
IArchive pack = getPackage(module);
IPath sourcePath = pack.getArchiveFilePath();
- IPath destPathRoot = new Path(server.getDeployFolder());
+ IModule[] tree = new IModule[] { module };
+ IPath destPathRoot = PublishUtil.getDeployPath(tree, server);
// if destination is deploy directory... no need to re-copy!
if( destPathRoot.toOSString().equals(PathUtils.getGlobalLocation(pack).toOSString())) {
Modified: trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/WTPZippedPublisher.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/WTPZippedPublisher.java 2009-08-17 17:02:20 UTC (rev 17112)
+++ trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/WTPZippedPublisher.java 2009-08-17 23:55:17 UTC (rev 17113)
@@ -30,6 +30,7 @@
import org.jboss.ide.eclipse.as.core.server.IJBossServerPublisher;
import org.jboss.ide.eclipse.as.core.server.internal.DeployableServerBehavior;
import org.jboss.ide.eclipse.as.core.util.FileUtil;
+import org.jboss.ide.eclipse.as.core.util.ServerConverter;
import org.jboss.ide.eclipse.as.core.util.FileUtil.IFileUtilListener;
import de.schlichtherle.io.ArchiveDetector;
@@ -157,8 +158,8 @@
}
protected IStatus[] removeModule(IServer server, IModule[] module) {
- String depFolder = getDeployableServer(server).getDeployFolder();
- IPath deployPath = getDeployPath(module, depFolder);
+ IDeployableServer ds = ServerConverter.getDeployableServer(server);
+ IPath deployPath = getDeployPath(module, ds);
final ArrayList<IStatus> status = new ArrayList<IStatus>();
IFileUtilListener listener = new IFileUtilListener() {
public void fileCopied(File source, File dest, boolean result,Exception e) {}
@@ -181,9 +182,9 @@
protected IStatus[] fullPublish(IServer server, IModule[] module) {
ArrayList<IStatus> results = new ArrayList<IStatus>();
+ IDeployableServer ds = ServerConverter.getDeployableServer(server);
try {
- String depFolder = getDeployableServer(server).getDeployFolder();
- IPath path = getDeployPath(module, depFolder);
+ IPath path = getDeployPath(module, ds);
// Get rid of the old
FileUtil.safeDelete(path.toFile(), null);
@@ -203,8 +204,8 @@
}
protected IStatus[] publishChanges(IServer server, IModule[] module) {
- String depFolder = getDeployableServer(server).getDeployFolder();
- IPath path = getDeployPath(module, depFolder);
+ IDeployableServer ds = ServerConverter.getDeployableServer(server);
+ IPath path = getDeployPath(module, ds);
de.schlichtherle.io.File root = TrueZipUtil.getFile(path, TrueZipUtil.getJarArchiveDetector());
IModuleResourceDelta[] deltas = ((Server)server).getPublishedResourceDelta(module);
return publishChanges(server, deltas, root);
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java 2009-08-17 17:02:20 UTC (rev 17112)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java 2009-08-17 23:55:17 UTC (rev 17113)
@@ -109,7 +109,8 @@
protected IStatus fullPublish(IModule[] moduleTree, IModule module, IProgressMonitor monitor) throws CoreException {
- IPath deployPath = getDeployPath(moduleTree, server.getDeployFolder());
+ IPath deployPath = getDeployPath(moduleTree, server);
+ IPath tempDeployPath = getTempDeployFolder(moduleTree, server);
IModuleResource[] members = getResources(module);
ArrayList<IStatus> list = new ArrayList<IStatus>();
@@ -117,8 +118,10 @@
if( !(new Path(module.getName()).segmentCount() > 1 ))
list.addAll(Arrays.asList(localSafeDelete(deployPath)));
- if( !deployPackaged(moduleTree) && !isBinaryObject(moduleTree))
- list.addAll(Arrays.asList(new PublishCopyUtil(server.getServer()).publishFull(members, deployPath, monitor)));
+ if( !deployPackaged(moduleTree) && !isBinaryObject(moduleTree)) {
+ PublishCopyUtil util = new PublishCopyUtil(server.getServer(), deployPath, tempDeployPath);
+ list.addAll(Arrays.asList(util.publishFull(members, deployPath, monitor)));
+ }
else if( isBinaryObject(moduleTree))
list.addAll(Arrays.asList(copyBinaryModule(moduleTree)));
else
@@ -152,9 +155,11 @@
protected IStatus incrementalPublish(IModule[] moduleTree, IModule module, IProgressMonitor monitor) throws CoreException {
IStatus[] results = new IStatus[] {};
- IPath deployPath = getDeployPath(moduleTree, server.getDeployFolder());
+ IPath deployPath = getDeployPath(moduleTree, server);
+ IPath tempDeployPath = getTempDeployFolder(moduleTree, server);
if( !deployPackaged(moduleTree) && !isBinaryObject(moduleTree))
- results = new PublishCopyUtil(server.getServer()).publishDelta(delta, deployPath, monitor);
+ results = new PublishCopyUtil(server.getServer(), deployPath, tempDeployPath)
+ .publishDelta(delta, deployPath, monitor);
else if( delta.length > 0 ) {
if( isBinaryObject(moduleTree))
results = copyBinaryModule(moduleTree);
@@ -176,7 +181,7 @@
protected IStatus unpublish(IDeployableServer jbServer, IModule[] module,
IProgressMonitor monitor) throws CoreException {
IModule mod = module[module.length-1];
- IStatus[] errors = localSafeDelete(getDeployPath(module, server.getDeployFolder()));
+ IStatus[] errors = localSafeDelete(getDeployPath(module, server));
if( errors.length > 0 ) {
publishState = IServer.PUBLISH_STATE_FULL;
MultiStatus ms = new MultiStatus(JBossServerCorePlugin.PLUGIN_ID, IEventCodes.JST_PUB_REMOVE_FAIL,
@@ -195,7 +200,7 @@
protected IStatus[] copyBinaryModule(IModule[] moduleTree) {
try {
- IPath deployPath = getDeployPath(moduleTree, server.getDeployFolder());
+ IPath deployPath = getDeployPath(moduleTree, server);
FileUtilListener listener = new FileUtilListener();
IModuleResource[] members = getResources(moduleTree);
File source = (File)members[0].getAdapter(File.class);
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublishUtil.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublishUtil.java 2009-08-17 17:02:20 UTC (rev 17112)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublishUtil.java 2009-08-17 23:55:17 UTC (rev 17113)
@@ -22,7 +22,13 @@
import org.eclipse.wst.server.core.model.IModuleResource;
import org.eclipse.wst.server.core.model.IModuleResourceDelta;
import org.eclipse.wst.server.core.model.ModuleDelegate;
+import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
import org.jboss.ide.eclipse.as.core.server.IJBossServerConstants;
+import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader;
+import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
+import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader.DeploymentModulePrefs;
+import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader.DeploymentPreferences;
+import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader.DeploymentTypePrefs;
public class PublishUtil {
public static int countChanges(IModuleResourceDelta[] deltas) {
@@ -59,7 +65,51 @@
return count;
}
- public static IPath getDeployPath(IModule[] moduleTree, String deployFolder) {
+ private static String getDeployRootFolder(IModule[] moduleTree,
+ IDeployableServer server, String defaultFolder, String moduleProperty) {
+ String folder = defaultFolder;
+ DeploymentPreferences prefs = DeploymentPreferenceLoader.loadPreferences(server.getServer());
+ DeploymentTypePrefs typePrefs = prefs.getOrCreatePreferences("local"); //$NON-NLS-1$
+ DeploymentModulePrefs modPrefs = typePrefs.getModulePrefs(moduleTree[0]);
+ if( modPrefs != null ) {
+ String loc = modPrefs.getProperty(moduleProperty);
+ if( loc != null && !loc.equals("") ) { //$NON-NLS-1$
+ if( !new Path(loc).isAbsolute()) {
+ folder = server.getServer().getRuntime().getLocation().append(loc).toString();
+ } else {
+ folder = loc;
+ }
+ // TODO translate for variables?
+ }
+ }
+ return folder;
+ }
+
+ public static IPath getDeployPath(IModule[] moduleTree, IDeployableServer server) {
+ String folder = getDeployRootFolder(
+ moduleTree, server,
+ server.getDeployFolder(),
+ IJBossToolingConstants.LOCAL_DEPLOYMENT_LOC);
+ return getDeployPath(moduleTree, folder);
+ }
+
+ public static IPath getDeployRootFolder(IModule[] moduleTree, IDeployableServer server) {
+ String folder = getDeployRootFolder(
+ moduleTree, server,
+ server.getDeployFolder(),
+ IJBossToolingConstants.LOCAL_DEPLOYMENT_LOC);
+ return new Path(folder);
+ }
+
+ public static IPath getTempDeployFolder(IModule[] moduleTree, IDeployableServer server) {
+ String folder = getDeployRootFolder(
+ moduleTree, server,
+ server.getTempDeployFolder(),
+ IJBossToolingConstants.LOCAL_DEPLOYMENT_TEMP_LOC);
+ return new Path(folder);
+ }
+
+ private static IPath getDeployPath(IModule[] moduleTree, String deployFolder) {
IPath root = new Path( deployFolder );
String type, modName, name, uri, suffixedName;
for( int i = 0; i < moduleTree.length; i++ ) {
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/SingleFilePublisher.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/SingleFilePublisher.java 2009-08-17 17:02:20 UTC (rev 17112)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/SingleFilePublisher.java 2009-08-17 23:55:17 UTC (rev 17113)
@@ -78,10 +78,11 @@
SingleDeployableModuleDelegate delegate = (SingleDeployableModuleDelegate)module.loadAdapter(SingleDeployableModuleDelegate.class, new NullProgressMonitor());
if( delegate != null ) {
IPath sourcePath = delegate.getGlobalSourcePath();
- IPath destFolder = new Path(server.getDeployFolder());
- IPath tempDestFolder = new Path(server.getTempDeployFolder());
+
+ IPath destFolder = PublishUtil.getDeployPath(new IModule[]{module}, server).removeLastSegments(1);;
+ IPath tempDestFolder = PublishUtil.getTempDeployFolder(new IModule[]{module}, server).removeLastSegments(1);;
+ File destFile = destFolder.append(sourcePath.lastSegment()).toFile();
File tempDestFile = tempDestFolder.append(sourcePath.lastSegment()).toFile();
- File destFile = destFolder.append(sourcePath.lastSegment()).toFile();
if( destFile.exists())
destFile.delete();
FileUtilListener l = new FileUtilListener();
@@ -115,7 +116,7 @@
SingleDeployableModuleDelegate delegate = (SingleDeployableModuleDelegate)module.loadAdapter(SingleDeployableModuleDelegate.class, new NullProgressMonitor());
if( delegate != null ) {
IPath sourcePath = delegate.getGlobalSourcePath();
- IPath destFolder = new Path(server.getDeployFolder());
+ IPath destFolder = PublishUtil.getDeployPath(new IModule[]{module}, server).removeLastSegments(1);
FileUtilListener l = new FileUtilListener();
File destFile = destFolder.append(sourcePath.lastSegment()).toFile();
FileUtil.safeDelete(destFile, l);
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/ServerListener.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/ServerListener.java 2009-08-17 17:02:20 UTC (rev 17112)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/ServerListener.java 2009-08-17 23:55:17 UTC (rev 17113)
@@ -11,16 +11,17 @@
package org.jboss.ide.eclipse.as.core.server.internal;
import java.io.File;
+import java.util.ArrayList;
import javax.management.MBeanServerConnection;
import javax.management.ObjectName;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
+import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IRuntime;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.ServerEvent;
@@ -29,6 +30,7 @@
import org.jboss.ide.eclipse.as.core.extensions.events.IEventCodes;
import org.jboss.ide.eclipse.as.core.extensions.events.ServerLogger;
import org.jboss.ide.eclipse.as.core.extensions.jmx.JBossServerConnectionProvider;
+import org.jboss.ide.eclipse.as.core.publishers.PublishUtil;
import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
import org.jboss.ide.eclipse.as.core.server.IJBossServerConstants;
import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
@@ -121,9 +123,29 @@
protected void ensureDeployLocationAdded(IServer server, MBeanServerConnection connection) throws Exception {
IDeployableServer ds = ServerConverter.getDeployableServer(server);
- String deployFolder = ds.getDeployFolder();
- String asURL = new File(deployFolder).toURL().toString();
- ObjectName name = new ObjectName(IJBossRuntimeConstants.DEPLOYMENT_SCANNER_MBEAN_NAME);
- connection.invoke(name, IJBossRuntimeConstants.addURL, new Object[] { asURL }, new String[] {String.class.getName()});
+
+ ArrayList<String> folders = new ArrayList<String>();
+ folders.add(ds.getDeployFolder());
+
+ IModule[] modules2 = org.eclipse.wst.server.core.ServerUtil.getModules(server.getServerType().getRuntimeType().getModuleTypes());
+ if (modules2 != null) {
+ int size = modules2.length;
+ for (int i = 0; i < size; i++) {
+ IModule[] module = new IModule[] { modules2[i] };
+ IStatus status = server.canModifyModules(module, null, null);
+ if (status != null && status.getSeverity() != IStatus.ERROR) {
+ String tempFolder = PublishUtil.getDeployRootFolder(module, ds).toString();
+ if( !folders.contains(tempFolder))
+ folders.add(tempFolder);
+ }
+ }
+ }
+
+ String[] folders2 = (String[]) folders.toArray(new String[folders.size()]);
+ for( int i = 0; i < folders2.length; i++ ) {
+ String asURL = new File(folders2[i]).toURL().toString();
+ ObjectName name = new ObjectName(IJBossRuntimeConstants.DEPLOYMENT_SCANNER_MBEAN_NAME);
+ connection.invoke(name, IJBossRuntimeConstants.addURL, new Object[] { asURL }, new String[] {String.class.getName()});
+ }
}
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/xpl/PublishCopyUtil.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/xpl/PublishCopyUtil.java 2009-08-17 17:02:20 UTC (rev 17112)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/xpl/PublishCopyUtil.java 2009-08-17 23:55:17 UTC (rev 17113)
@@ -76,8 +76,19 @@
* PublishUtil cannot be created. Use static methods.
*/
private IServer server;
- public PublishCopyUtil(IServer server) {
+ private IPath rootDeploy;
+ private IPath rootTmpDeploy;
+
+ /**
+ *
+ * @param server The server we're publishing to
+ * @param deploy The deploy path where they're intended to go
+ * @param tmpDeploy The temporary location on the same partition
+ */
+ public PublishCopyUtil(IServer server, IPath deploy, IPath tmpDeploy) {
this.server = server;
+ this.rootDeploy = deploy;
+ this.rootTmpDeploy = tmpDeploy;
}
/**
@@ -193,12 +204,24 @@
* Smart copy the given module resources to the given path.
*
* @param resources an array of module resources
+ * @param monitor a progress monitor, or <code>null</code> if progress
+ * reporting and cancellation are not desired
+ * @return a possibly-empty array of error and warning status
+ */
+ public IStatus[] publishSmart(IModuleResource[] resources, IProgressMonitor monitor) {
+ return publishSmart(resources, rootDeploy, monitor);
+ }
+
+ /**
+ * Smart copy the given module resources to the given path.
+ *
+ * @param resources an array of module resources
* @param path an external path to copy to
* @param monitor a progress monitor, or <code>null</code> if progress
* reporting and cancellation are not desired
* @return a possibly-empty array of error and warning status
*/
- public IStatus[] publishSmart(IModuleResource[] resources, IPath path, IProgressMonitor monitor) {
+ private IStatus[] publishSmart(IModuleResource[] resources, IPath path, IProgressMonitor monitor) {
if (resources == null)
return EMPTY_STATUS;
@@ -772,11 +795,17 @@
}
protected File getTempFolder() {
- if( server == null ) return tempDir;
- String path = ServerConverter.getDeployableServer(server).getTempDeployFolder();
- File f = new File(path);
+ File f = null;
+ if( rootTmpDeploy != null ) {
+ f = rootTmpDeploy.toFile();
+ } else if( server != null ){
+ String path = ServerConverter.getDeployableServer(server).getTempDeployFolder();
+ f = new File(path);
+ } else {
+ return tempDir;
+ }
if( !f.exists() )
f.mkdirs();
- return new File(path);
+ return f;
}
}
\ No newline at end of file
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/DeploymentPreferenceLoader.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/DeploymentPreferenceLoader.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/DeploymentPreferenceLoader.java 2009-08-17 23:55:17 UTC (rev 17113)
@@ -0,0 +1,142 @@
+package org.jboss.ide.eclipse.as.core.util;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+import org.jboss.tools.jmx.core.IMemento;
+import org.jboss.tools.jmx.core.util.XMLMemento;
+
+public class DeploymentPreferenceLoader {
+ public static DeploymentPreferences loadPreferences(IServer server) {
+ File f = getFile(server);
+ return new DeploymentPreferences(f);
+ }
+
+ public static void savePreferences(IServer server, DeploymentPreferences prefs) throws IOException {
+ File f = getFile(server);
+ prefs.getMemento().saveToFile(f.getAbsolutePath());
+ }
+
+ protected static File getFile(IServer server) {
+ IPath loc = ServerUtil.getServerStateLocation(server);
+ return loc.append("deploymentPreferences.xml").toFile(); //$NON-NLS-1$
+ }
+
+ public static class DeploymentPreferences {
+ private HashMap<String, DeploymentTypePrefs> children;
+ private XMLMemento memento;
+ public DeploymentPreferences(File f) {
+ children = new HashMap<String, DeploymentTypePrefs>();
+ if( f.exists()) {
+ try {
+ FileInputStream is = new FileInputStream(f);
+ memento = XMLMemento.createReadRoot(is);
+ String[] deploymentTypes = memento.getChildNames();
+ for( int i = 0; i < deploymentTypes.length; i++ )
+ children.put(deploymentTypes[i],
+ new DeploymentTypePrefs(deploymentTypes[i],
+ memento.getChild(deploymentTypes[i])));
+ } catch( FileNotFoundException fnfe) {}
+ } else {
+ memento = XMLMemento.createWriteRoot("deployment"); //$NON-NLS-1$
+ }
+ }
+
+ public DeploymentTypePrefs getPreferences(String deploymentType) {
+ return children.get(deploymentType);
+ }
+
+ public DeploymentTypePrefs getOrCreatePreferences(String deploymentType) {
+ if( children.get(deploymentType) == null ) {
+ children.put(deploymentType,
+ new DeploymentTypePrefs(deploymentType,
+ memento.createChild(deploymentType)));
+ }
+ return children.get(deploymentType);
+ }
+
+ public String[] getDeploymentTypes() {
+ Set<String> s = children.keySet();
+ return (String[]) s.toArray(new String[s.size()]);
+ }
+
+ protected XMLMemento getMemento() {
+ return memento;
+ }
+ }
+
+ public static class DeploymentTypePrefs {
+ private String type;
+ private HashMap<String, DeploymentModulePrefs> children;
+ private IMemento memento;
+ public DeploymentTypePrefs(String type, IMemento memento) {
+ this.type = type;
+ this.memento = memento;
+ this.children = new HashMap<String, DeploymentModulePrefs>();
+ IMemento[] mementos = memento.getChildren("module"); //$NON-NLS-1$
+ for( int i = 0; i < mementos.length; i++ ) {
+ String id = mementos[i].getString("id"); //$NON-NLS-1$
+ this.children.put(id, new DeploymentModulePrefs(id, mementos[i]));
+ }
+ // TODO properties?
+ }
+
+ public DeploymentModulePrefs getModulePrefs(IModule module) {
+ return children.get(module.getId());
+ }
+ public DeploymentModulePrefs getOrCreateModulePrefs(IModule module) {
+ if( children.get(module.getId()) == null ) {
+ IMemento childMemento = memento.createChild("module"); //$NON-NLS-1$
+ childMemento.putString("id", module.getId()); //$NON-NLS-1$
+ children.put(module.getId(),
+ new DeploymentModulePrefs(module.getId(),
+ childMemento));
+ }
+ return children.get(module.getId());
+ }
+ }
+ public static class DeploymentModulePrefs {
+ private String id;
+ private IMemento memento;
+ private HashMap<String, String> properties;
+ public DeploymentModulePrefs(String id, IMemento memento) {
+ this.id = id;
+ this.memento = memento;
+ properties = new HashMap<String, String>();
+ IMemento[] children = memento.getChildren("property"); //$NON-NLS-1$
+ String key, val;
+ for( int i = 0; i < children.length; i++ ) {
+ key = children[i].getString("key"); //$NON-NLS-1$
+ val = children[i].getString("value"); //$NON-NLS-1$
+ properties.put(key,val);
+ }
+ }
+
+ public String getProperty(String key) {
+ return properties.get(key);
+ }
+
+ public void setProperty(String key, String val) {
+ properties.put(key, val);
+ IMemento[] children = memento.getChildren("property"); //$NON-NLS-1$
+ for( int i = 0; i < children.length; i++ ) {
+ if( key.equals(children[i].getString("key"))) { //$NON-NLS-1$
+ children[i].putString("key", key); //$NON-NLS-1$
+ children[i].putString("value", val);//$NON-NLS-1$
+ return;
+ }
+ }
+ // not found
+ IMemento child = memento.createChild("property"); //$NON-NLS-1$
+ child.putString("key", key);//$NON-NLS-1$
+ child.putString("value", val);//$NON-NLS-1$
+ }
+ }
+}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/IJBossToolingConstants.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/IJBossToolingConstants.java 2009-08-17 17:02:20 UTC (rev 17112)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/IJBossToolingConstants.java 2009-08-17 23:55:17 UTC (rev 17113)
@@ -72,4 +72,9 @@
public static final int JNDI_DEFAULT_PORT = 1099;
public static final int JBOSS_WEB_DEFAULT_PORT = 8080;
+
+ public static final String LOCAL_DEPLOYMENT_NAME = "name"; //$NON-NLS-1$
+ public static final String LOCAL_DEPLOYMENT_LOC = "location"; //$NON-NLS-1$
+ public static final String LOCAL_DEPLOYMENT_TEMP_LOC = "tempLocation"; //$NON-NLS-1$
+
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploySection.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploySection.java 2009-08-17 17:02:20 UTC (rev 17112)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploySection.java 2009-08-17 23:55:17 UTC (rev 17113)
@@ -394,9 +394,11 @@
oldDir = deployText.getText();
oldTemp = tempDeployText.getText();
- String type;
+ String type = null;
+ String oldType = oldSelection == customRadio ? IDeployableServer.DEPLOY_CUSTOM :
+ oldSelection == serverRadio ? IDeployableServer.DEPLOY_SERVER :
+ IDeployableServer.DEPLOY_METADATA;
-
if( newSelection == metadataRadio ) {
newDir = JBossServerCorePlugin.getServerStateLocation(id)
.append(IJBossServerConstants.DEPLOY).makeAbsolute().toString();
@@ -409,16 +411,18 @@
IRuntime rt = DeploySection.this.server.getRuntime();
if( rt != null ) {
IJBossServerRuntime jbsrt = (IJBossServerRuntime)rt.loadAdapter(IJBossServerRuntime.class, new NullProgressMonitor());
- String config = jbsrt.getJBossConfiguration();
- newDir = new Path(IJBossServerConstants.SERVER)
- .append(config)
- .append(IJBossServerConstants.DEPLOY).makeRelative().toString();
- newTemp = new Path(IJBossServerConstants.SERVER).append(config)
- .append(IJBossServerConstants.TMP)
- .append(IJBossServerConstants.JBOSSTOOLS_TMP).makeRelative().toString();
- new File(newTemp).mkdirs();
+ if( jbsrt != null ) {
+ String config = jbsrt.getJBossConfiguration();
+ newDir = new Path(IJBossServerConstants.SERVER)
+ .append(config)
+ .append(IJBossServerConstants.DEPLOY).makeRelative().toString();
+ newTemp = new Path(IJBossServerConstants.SERVER).append(config)
+ .append(IJBossServerConstants.TMP)
+ .append(IJBossServerConstants.JBOSSTOOLS_TMP).makeRelative().toString();
+ new File(newTemp).mkdirs();
+ type = IDeployableServer.DEPLOY_SERVER;
+ }
}
- type = IDeployableServer.DEPLOY_SERVER;
} else {
newDir = lastCustomDeploy;
newTemp = lastCustomTemp;
@@ -436,6 +440,7 @@
newSelection.addSelectionListener(radioListener);
}
+ type = type == null ? oldType : type;
newDir = newDir == null ? oldDir : newDir;
newTemp = newTemp == null ? oldTemp : newTemp;
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ModuleDeploymentPage.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ModuleDeploymentPage.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ModuleDeploymentPage.java 2009-08-17 23:55:17 UTC (rev 17113)
@@ -0,0 +1,298 @@
+package org.jboss.ide.eclipse.as.ui.editor;
+
+import java.io.IOException;
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ICellModifier;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.TreeColumn;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.ui.editor.IServerEditorPartInput;
+import org.eclipse.wst.server.ui.editor.ServerEditorPart;
+import org.eclipse.wst.server.ui.internal.command.ServerCommand;
+import org.eclipse.wst.server.ui.internal.editor.ServerEditorPartInput;
+import org.eclipse.wst.server.ui.internal.editor.ServerResourceCommandManager;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
+import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader;
+import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
+import org.jboss.ide.eclipse.as.core.util.ServerUtil;
+import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader.DeploymentModulePrefs;
+import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader.DeploymentPreferences;
+
+public class ModuleDeploymentPage extends ServerEditorPart {
+ private ServerResourceCommandManager commandManager;
+ private ArrayList<IModule> possibleChildren;
+
+ public void init(IEditorSite site, IEditorInput input) {
+ super.init(site, input);
+ ArrayList<IModule> possibleChildren = new ArrayList<IModule>();
+ IModule[] modules2 = org.eclipse.wst.server.core.ServerUtil.getModules(server.getServerType().getRuntimeType().getModuleTypes());
+ if (modules2 != null) {
+ int size = modules2.length;
+ for (int i = 0; i < size; i++) {
+ IModule module = modules2[i];
+ IStatus status = server.canModifyModules(new IModule[] { module }, null, null);
+ if (status != null && status.getSeverity() != IStatus.ERROR)
+ possibleChildren.add(module);
+ }
+ }
+ this.possibleChildren = possibleChildren;
+ if (input instanceof IServerEditorPartInput) {
+ IServerEditorPartInput sepi = (IServerEditorPartInput) input;
+ server = sepi.getServer();
+ commandManager = ((ServerEditorPartInput) sepi).getServerCommandManager();
+ readOnly = sepi.isServerReadOnly();
+ }
+
+ }
+
+ public void createPartControl(Composite parent) {
+ createLocalControl(parent);
+ }
+
+ private TreeViewer viewer;
+ private DeploymentPreferences preferences;
+ private static final String LOCAL_COLUMN_NAME = IJBossToolingConstants.LOCAL_DEPLOYMENT_NAME;
+ private static final String LOCAL_COLUMN_LOC = IJBossToolingConstants.LOCAL_DEPLOYMENT_LOC;
+ private static final String LOCAL_COLUMN_TEMP_LOC = IJBossToolingConstants.LOCAL_DEPLOYMENT_TEMP_LOC;
+
+ protected void createLocalControl(Composite parent) {
+ preferences = DeploymentPreferenceLoader.loadPreferences(server.getOriginal());
+ FormToolkit toolkit = getFormToolkit(parent.getDisplay());
+
+ ScrolledForm form = toolkit.createScrolledForm(parent);
+ toolkit.decorateFormHeading(form.getForm());
+ form.setText("Module Deployment");
+ //form.setImage(null);
+ GridLayout layout = new GridLayout();
+ layout.marginTop = 6;
+ layout.marginLeft = 6;
+ form.getBody().setLayout(layout);
+
+ Composite random = toolkit.createComposite(form.getBody(), SWT.NONE);
+ random.setLayout(new FillLayout());
+ GridData randomData = new GridData(GridData.FILL_BOTH);
+ random.setLayoutData(randomData);
+ Composite root = toolkit.createComposite(random, SWT.NONE);
+ root.setLayout(new FormLayout());
+
+ viewer = new TreeViewer(root, SWT.BORDER);
+ viewer.getTree().setHeaderVisible(true);
+ viewer.getTree().setLinesVisible(true);
+ TreeColumn moduleColumn = new TreeColumn(viewer.getTree(), SWT.NONE);
+ TreeColumn publishLocColumn = new TreeColumn(viewer.getTree(), SWT.NONE);
+ TreeColumn publishTempLocColumn = new TreeColumn(viewer.getTree(), SWT.NONE);
+ moduleColumn.setText("Module");
+ publishLocColumn.setText("Publish Location");
+ publishTempLocColumn.setText("Publish Temporary Location");
+
+ moduleColumn.setWidth(200);
+ publishLocColumn.setWidth(200);
+ publishTempLocColumn.setWidth(200);
+
+
+ FormData treeData = new FormData();
+ treeData.top = new FormAttachment(0, 100);
+ treeData.bottom = new FormAttachment(100, -100);
+ treeData.left = new FormAttachment(0,5);
+ treeData.right = new FormAttachment(100,-5);
+ viewer.getTree().setLayoutData(treeData);
+ viewer.setContentProvider(new ModulePageContentProvider());
+
+ viewer.setLabelProvider( new ModulePageLabelProvider());
+ viewer.setColumnProperties(new String[] {
+ LOCAL_COLUMN_NAME,
+ LOCAL_COLUMN_LOC, LOCAL_COLUMN_TEMP_LOC
+ });
+ viewer.setInput("");
+ CellEditor[] editors = new CellEditor[] {
+ new TextCellEditor(viewer.getTree()),
+ new TextCellEditor(viewer.getTree()),
+ new TextCellEditor(viewer.getTree())
+ };
+ viewer.setCellModifier(new LocalDeploymentCellModifier());
+ viewer.setCellEditors(editors);
+ }
+
+ private class LocalDeploymentCellModifier implements ICellModifier {
+ public boolean canModify(Object element, String property) {
+ return true;
+ }
+ public Object getValue(Object element, String property) {
+ DeploymentModulePrefs p = preferences.getPreferences("local").getModulePrefs((IModule)element);
+ if( property == LOCAL_COLUMN_LOC) {
+ String ret = p.getProperty(LOCAL_COLUMN_LOC);
+ return ret == null ? "" : ret;
+ }
+ if( property == LOCAL_COLUMN_TEMP_LOC) {
+ String ret = p.getProperty(LOCAL_COLUMN_TEMP_LOC);
+ return ret == null ? "" : ret;
+ }
+
+ return "";
+ }
+ public void modify(Object element, String property, Object value) {
+
+ IModule module = (IModule) ((TreeItem)element).getData();
+ DeploymentModulePrefs p = preferences.getPreferences("local").getModulePrefs(module);
+ if( property == LOCAL_COLUMN_LOC) {
+ firePropertyChangeCommand(p, LOCAL_COLUMN_LOC, (String)value);
+ } else
+ if( property == LOCAL_COLUMN_TEMP_LOC) {
+ firePropertyChangeCommand(p, LOCAL_COLUMN_TEMP_LOC, (String)value);
+ }
+ }
+ }
+
+ protected void firePropertyChangeCommand(DeploymentModulePrefs p, String key, String val) {
+ commandManager.execute(new ChangePropertyCommand(p,key,val));
+ }
+
+ private String makeGlobal(String path) {
+ return ServerUtil.makeGlobal(getRuntime(), new Path(path)).toString();
+ }
+
+ private String makeRelative(String path) {
+ if (getRuntime() == null) {
+ return path;
+ }
+ return ServerUtil.makeRelative(getRuntime(), new Path(path)).toString();
+ }
+
+ private IJBossServerRuntime getRuntime() {
+ IRuntime r = server.getRuntime();
+ IJBossServerRuntime ajbsrt = null;
+ if (r != null) {
+ ajbsrt = (IJBossServerRuntime) r
+ .loadAdapter(IJBossServerRuntime.class,
+ new NullProgressMonitor());
+ }
+ return ajbsrt;
+ }
+
+
+ private class ChangePropertyCommand extends ServerCommand {
+ private DeploymentModulePrefs p;
+ private String key;
+ private String oldVal;
+ private String newVal;
+ public ChangePropertyCommand(DeploymentModulePrefs p, String key, String val) {
+ super(ModuleDeploymentPage.this.server, "command text");
+ this.p = p;
+ this.key = key;
+ this.newVal = val;
+ this.oldVal = p.getProperty(key);
+ }
+ public void execute() {
+ p.setProperty(key, newVal);
+ viewer.refresh();
+ }
+ public void undo() {
+ p.setProperty(key, oldVal);
+ viewer.refresh();
+ }
+ }
+
+ private class ModulePageContentProvider implements ITreeContentProvider {
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+ public void dispose() {
+ }
+ public Object[] getElements(Object inputElement) {
+ return (IModule[]) possibleChildren.toArray(new IModule[possibleChildren.size()]);
+ }
+ public boolean hasChildren(Object element) {
+ return false;
+ }
+ public Object getParent(Object element) {
+ return null;
+ }
+ public Object[] getChildren(Object parentElement) {
+ return null;
+ }
+ }
+
+ private class ModulePageLabelProvider implements ITableLabelProvider {
+ public Image getColumnImage(Object element, int columnIndex) {
+ return null;
+ }
+ public String getColumnText(Object element, int columnIndex) {
+ if( element instanceof IModule ) {
+ IModule m = (IModule)element;
+ if( columnIndex == 0 )
+ return m.getName();
+ if( columnIndex == 1 ) {
+ DeploymentModulePrefs modPref = preferences.getOrCreatePreferences("local").getOrCreateModulePrefs(m);
+ String result = modPref.getProperty(LOCAL_COLUMN_LOC);
+ if( result != null)
+ return result;
+ modPref.setProperty(LOCAL_COLUMN_LOC, defaultLocation());
+ return defaultLocation();
+ }
+ if( columnIndex == 2 ) {
+ DeploymentModulePrefs modPref = preferences.getOrCreatePreferences("local").getOrCreateModulePrefs(m);
+ String result = modPref.getProperty(LOCAL_COLUMN_TEMP_LOC);
+ if( result != null )
+ return result;
+ modPref.setProperty(LOCAL_COLUMN_TEMP_LOC, defaultTempLocation());
+ return defaultTempLocation();
+ }
+ }
+ return element.toString();
+ }
+ public void addListener(ILabelProviderListener listener) {
+ }
+ public void dispose() {
+ }
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+ public void removeListener(ILabelProviderListener listener) {
+ }
+ }
+
+ protected String defaultLocation() {
+ //return "server/${jboss_config}/deploy";
+ return "";
+ }
+ protected String defaultTempLocation() {
+ //return "server/${jboss_config}/tmp/jbosstoolsTemp";
+ return "";
+ }
+
+ public void setFocus() {
+ }
+
+ public void doSave(IProgressMonitor monitor) {
+ try {
+ DeploymentPreferenceLoader.savePreferences(server.getOriginal(), preferences);
+ } catch( IOException ioe ) {
+ // TODO eh?
+ }
+ }
+}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml 2009-08-17 17:02:20 UTC (rev 17112)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/plugin.xml 2009-08-17 23:55:17 UTC (rev 17113)
@@ -140,6 +140,16 @@
name="Publish Events"
typeId="org.jboss.ide.eclipse.as.core.publishers.Events.MajorType"/>
</extension>
+ <extension
+ point="org.eclipse.wst.server.ui.editorPages">
+ <page
+ class="org.jboss.ide.eclipse.as.ui.editor.ModuleDeploymentPage"
+ id="org.jboss.ide.eclipse.as.ui.editor.deploymentPage"
+ name="Module Deployment"
+ typeIds="org.jboss.ide.eclipse.as.systemCopyServer, org.jboss.ide.eclipse.as.32,org.jboss.ide.eclipse.as.40,org.jboss.ide.eclipse.as.42,org.jboss.ide.eclipse.as.50,org.jboss.ide.eclipse.as.51,org.jboss.ide.eclipse.as.eap.43,org.jboss.ide.eclipse.as.eap.50">
+ </page>
+ </extension>
+
<extension
point="org.eclipse.wst.server.ui.editorPageSections">
<section
16 years, 4 months
JBoss Tools SVN: r17112 - in trunk: jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2009-08-17 13:02:20 -0400 (Mon, 17 Aug 2009)
New Revision: 17112
Modified:
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/ClassHyperlink.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE4509Test.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4638
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/ClassHyperlink.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/ClassHyperlink.java 2009-08-17 15:46:26 UTC (rev 17111)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/ClassHyperlink.java 2009-08-17 17:02:20 UTC (rev 17112)
@@ -33,6 +33,10 @@
import org.eclipse.jdt.core.search.SearchParticipant;
import org.eclipse.jdt.core.search.SearchPattern;
import org.eclipse.jdt.core.search.SearchRequestor;
+import org.eclipse.jdt.internal.core.JarEntryFile;
+import org.eclipse.jdt.internal.core.JarEntryResource;
+import org.eclipse.jdt.internal.core.JarPackageFragmentRoot;
+import org.eclipse.jdt.internal.ui.javaeditor.JarEntryEditorInput;
import org.eclipse.jdt.ui.JavaUI;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
@@ -132,7 +136,7 @@
return null;
}
- private IJavaElement searchForClass(String className) {
+ private IJavaElement searchForClass(final String className) {
IFile documentFile = getFile();
try {
@@ -142,7 +146,21 @@
IWorkbenchPage workbenchPage = ExtensionsPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
IEditorPart activeEditorPart = workbenchPage.getActiveEditor();
IEditorInput editorInput = activeEditorPart.getEditorInput();
- if (editorInput instanceof IStorageEditorInput) {
+ //added by Maksim Areshkau, fix for https://jira.jboss.org/jira/browse/JBIDE-4638
+ //in this code we looking for java resource if editor has been opened in resource which packed into jar file
+ if (editorInput instanceof JarEntryEditorInput) {
+ JarEntryEditorInput jarEntryEditorInput = (JarEntryEditorInput) editorInput;
+ JarEntryResource jarEntryFile = (JarEntryResource) jarEntryEditorInput.getStorage();
+ Object parent = jarEntryFile.getParent();
+ while( parent instanceof JarEntryResource) {
+ parent = ((JarEntryResource)parent).getParent();
+ }
+ if( (parent instanceof JarPackageFragmentRoot) &&
+ (((JarPackageFragmentRoot)parent).getParent() instanceof IJavaProject)) {
+ return searchForClass(((IJavaProject) ((JarPackageFragmentRoot)parent).getParent()), className);
+ }
+
+ } else if (editorInput instanceof IStorageEditorInput) {
IStorageEditorInput moeInput = (IStorageEditorInput)editorInput;
IPath p = moeInput.getStorage().getFullPath();
String s0 = p.segment(0);
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE4509Test.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE4509Test.java 2009-08-17 15:46:26 UTC (rev 17111)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE4509Test.java 2009-08-17 17:02:20 UTC (rev 17112)
@@ -62,22 +62,15 @@
//test openon for taglib from in file
public void testOpenOnForTaglibInJarFile() throws Throwable {
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(
- JsfAllTests.IMPORT_JBIDE3247_PROJECT_NAME);
- IJavaProject javaProject = JavaCore.create(project);
-
- IFile jarArchive = (IFile) project.findMember("WebContent/WEB-INF/lib/mareshkau.jar"); //$NON-NLS-1$
-
- IPackageFragmentRoot root = javaProject.getPackageFragmentRoot(jarArchive);
-
- JarPackageFragmentRoot jarRoot = (JarPackageFragmentRoot) root;
- JarEntryFile fileInJar = new JarEntryFile("META-INF/mareshkau.taglib.xml"); //$NON-NLS-1$s
- fileInJar.setParent(jarRoot);
- JarEntryEditorInput jarEditorInput = new JarEntryEditorInput(fileInJar);
- JBIDE4509Test.checkOpenOnInEditor(jarEditorInput, getEditorId(fileInJar.getName()),12, 25,
- "components/paginator.xhtml"); //$NON-NLS-1$
+ checkOpenOnFromJarFile("WebContent/WEB-INF/lib/mareshkau.jar", //$NON-NLS-1$
+ "META-INF/mareshkau.taglib.xml", 12, 25, "components/paginator.xhtml"); //$NON-NLS-1$ //$NON-NLS-2$
}
+ public void testOpenOnForJavaElementFromDeclarationInJar() throws Throwable {
+ checkOpenOnFromJarFile("WebContent/WEB-INF/lib/jsf-facelets.jar", "META-INF/jsf-ui.taglib.xml", //$NON-NLS-1$ //$NON-NLS-2$
+ 25, 33, "UILibrary.class"); //$NON-NLS-1$
+ }
+
//test for <function-class>
public void testJBIDE4638OpenOnForFunctionClass() throws Throwable{
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(
@@ -102,8 +95,48 @@
IFile file = (IFile) project.findMember("WebContent/tags/facelets.taglib.xml"); //$NON-NLS-1$
IEditorInput editorInput = new FileEditorInput(file);
JBIDE4509Test.checkOpenOnInEditor(editorInput, getEditorId(file.getName()), 22, 23, "IfHandler.java"); //$NON-NLS-1$
- }
-
+ }
+ /**
+ * Function for checking openOn functionality in jar file;
+ *
+ * @param jarFilePath
+ * @param jarEntryPath
+ * @param line
+ * @param position
+ * @param expectedResult
+ * @throws Throwable
+ *
+ * @author mareshkau
+ */
+ private static final void checkOpenOnFromJarFile(final String jarFilePath,final String jarEntryPath,
+ final int line, final int position,final String expectedResult) throws Throwable {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(
+ JsfAllTests.IMPORT_JBIDE3247_PROJECT_NAME);
+ IJavaProject javaProject = JavaCore.create(project);
+
+ IFile jarArchive = (IFile) project.findMember(jarFilePath); //$NON-NLS-1$
+
+ IPackageFragmentRoot root = javaProject.getPackageFragmentRoot(jarArchive);
+
+ JarPackageFragmentRoot jarRoot = (JarPackageFragmentRoot) root;
+ JarEntryFile fileInJar = new JarEntryFile(jarEntryPath); //$NON-NLS-1$s
+ fileInJar.setParent(jarRoot);
+ JarEntryEditorInput jarEditorInput = new JarEntryEditorInput(fileInJar);
+ JBIDE4509Test.checkOpenOnInEditor(jarEditorInput, getEditorId(fileInJar.getName()),line, position,
+ expectedResult);
+ }
+ /**
+ * Function for checking openOn functionality
+ *
+ * @param editorInput
+ * @param editorId
+ * @param lineNumber
+ * @param lineOffset
+ * @param openedOnFileName
+ * @throws Throwable
+ *
+ * @author mareshkau
+ */
private static final void checkOpenOnInEditor(IEditorInput editorInput,String editorId,int lineNumber, int lineOffset, String openedOnFileName) throws Throwable {
MultiPageEditorPart editorPart = (MultiPageEditorPart) PlatformUI
.getWorkbench().getActiveWorkbenchWindow().getActivePage()
16 years, 4 months
JBoss Tools SVN: r17111 - trunk/jsf/docs/jsf_tools_ref_guide/en/images/jsf_support.
by jbosstools-commits@lists.jboss.org
Author: chukhutsina
Date: 2009-08-17 11:46:26 -0400 (Mon, 17 Aug 2009)
New Revision: 17111
Modified:
trunk/jsf/docs/jsf_tools_ref_guide/en/images/jsf_support/jsf_support_4.png
trunk/jsf/docs/jsf_tools_ref_guide/en/images/jsf_support/jsf_support_5.png
trunk/jsf/docs/jsf_tools_ref_guide/en/images/jsf_support/jsf_support_6.png
trunk/jsf/docs/jsf_tools_ref_guide/en/images/jsf_support/jsf_support_9.png
Log:
<html><head><meta name="qrichtext" content="1" /></head><body style="font-size:9pt;font-family:Sans Serif">
<p>https://jira.jboss.org/jira/browse/JBDS-720 -Screens in JSF Tools Reference Guide were updated.</p>
</body></html>
Modified: trunk/jsf/docs/jsf_tools_ref_guide/en/images/jsf_support/jsf_support_4.png
===================================================================
(Binary files differ)
Modified: trunk/jsf/docs/jsf_tools_ref_guide/en/images/jsf_support/jsf_support_5.png
===================================================================
(Binary files differ)
Modified: trunk/jsf/docs/jsf_tools_ref_guide/en/images/jsf_support/jsf_support_6.png
===================================================================
(Binary files differ)
Modified: trunk/jsf/docs/jsf_tools_ref_guide/en/images/jsf_support/jsf_support_9.png
===================================================================
(Binary files differ)
16 years, 4 months