JBoss Tools SVN: r18873 - trunk/common/plugins/org.jboss.tools.common.model/images/file.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-11-27 05:11:01 -0500 (Fri, 27 Nov 2009)
New Revision: 18873
Added:
trunk/common/plugins/org.jboss.tools.common.model/images/file/hibernate-file.gif
Log:
https://jira.jboss.org/jira/browse/JBIDE-3962
Added: trunk/common/plugins/org.jboss.tools.common.model/images/file/hibernate-file.gif
===================================================================
(Binary files differ)
Property changes on: trunk/common/plugins/org.jboss.tools.common.model/images/file/hibernate-file.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
15 years, 1 month
JBoss Tools SVN: r18872 - in trunk/common/plugins: org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/refactoring and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2009-11-27 04:53:46 -0500 (Fri, 27 Nov 2009)
New Revision: 18872
Added:
trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/refactoring/FieldEditorFactory.java
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ElCoreMessages.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/messages.properties
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/refactoring/ELRenameProcessor.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/refactoring/RenameELVariableProcessor.java
trunk/common/plugins/org.jboss.tools.common.el.ui/META-INF/MANIFEST.MF
trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/ElUIMessages.java
trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/messages.properties
trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/refactoring/ELRefactorContributionFactory.java
trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/refactoring/RenameELVariableWizard.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4990
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ElCoreMessages.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ElCoreMessages.java 2009-11-27 08:23:38 UTC (rev 18871)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ElCoreMessages.java 2009-11-27 09:53:46 UTC (rev 18872)
@@ -23,12 +23,11 @@
public static String StringTokenDescription_Name;
public static String WhiteSpaceTokenDescription_Name;
- public static String EL_RENAME_PROCESSOR_LOCATION_NOT_FOUND;
public static String EL_RENAME_PROCESSOR_OUT_OF_SYNC_FILE;
public static String EL_RENAME_PROCESSOR_ERROR_PHANTOM_FILE;
public static String EL_RENAME_PROCESSOR_ERROR_READ_ONLY_FILE;
public static String RENAME_EL_VARIABLE_PROCESSOR_TITLE;
- public static String RENAME_EL_VARIABLE_PROCESSOR_CAN_NOT_FIND_CONTEXT_VARIABLE;
+ public static String RENAME_EL_VARIABLE_PROCESSOR_CAN_NOT_FIND_EL_VARIABLE;
static {
// initialize resource bundle
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/messages.properties
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/messages.properties 2009-11-27 08:23:38 UTC (rev 18871)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/messages.properties 2009-11-27 09:53:46 UTC (rev 18872)
@@ -16,3 +16,9 @@
PrimitiveValueTokenDescription_Name=Primitive
StringTokenDescription_Name=String
WhiteSpaceTokenDescription_Name=Whitespace
+EL_RENAME_PROCESSOR_OUT_OF_SYNC_FILE=Cannot change file. File ''{0}'' is not in sync.
+EL_RENAME_PROCESSOR_ERROR_PHANTOM_FILE=Cannot change phantom file: ''{0}''.
+EL_RENAME_PROCESSOR_ERROR_READ_ONLY_FILE=Cannot change read-only file: ''{0}''.
+RENAME_EL_VARIABLE_PROCESSOR_TITLE=Rename EL Variable
+RENAME_EL_VARIABLE_PROCESSOR_CAN_NOT_FIND_EL_VARIABLE=Can not find EL Variable: ''{0}''.
+
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/refactoring/ELRenameProcessor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/refactoring/ELRenameProcessor.java 2009-11-27 08:23:38 UTC (rev 18871)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/refactoring/ELRenameProcessor.java 2009-11-27 09:53:46 UTC (rev 18872)
@@ -29,6 +29,7 @@
import org.eclipse.text.edits.TextEdit;
import org.jboss.tools.common.el.core.ELCorePlugin;
import org.jboss.tools.common.el.core.ElCoreMessages;
+import org.jboss.tools.common.model.project.ProjectHome;
import org.jboss.tools.common.text.ITextSourceReference;
import org.jboss.tools.common.util.FileUtil;
@@ -59,7 +60,11 @@
private ELSearcher searcher = null;
+ public ELRenameProcessor(IFile file, String oldName){
+ searcher = new ELSearcher(file, oldName);
+ }
+
protected RefactorSearcher getSearcher(){
return searcher;
}
@@ -107,8 +112,8 @@
else
flag = location.getStartPosition() == 0 && location.getLength() == 0;
- if(flag)
- status.addFatalError(Messages.format(ElCoreMessages.EL_RENAME_PROCESSOR_LOCATION_NOT_FOUND, file.getFullPath().toString()));
+// if(flag)
+// status.addFatalError(Messages.format(ElCoreMessages.EL_RENAME_PROCESSOR_LOCATION_NOT_FOUND, file.getFullPath().toString()));
return flag;
}
@@ -239,29 +244,32 @@
return true;
}
-
ArrayList<String> keys = new ArrayList<String>();
@Override
protected IProject[] getProjects() {
- // TODO Auto-generated method stub
- return null;
+ return new IProject[]{baseFile.getProject()};
}
+
@Override
protected IContainer getViewFolder(IProject project) {
- // TODO Auto-generated method stub
+ IPath path = ProjectHome.getFirstWebContentPath(baseFile.getProject());
+
+ if(path != null)
+ return project.getFolder(path.removeFirstSegments(1));
+
return null;
}
+
@Override
protected void match(IFile file, int offset, int length) {
- // TODO Auto-generated method stub
-
+ change(file, offset, length, newName);
}
@Override
protected boolean isFileCorrect(IFile file) {
- return isFileCorrect(file);
+ return ELRenameProcessor.this.isFileCorrect(file);
}
}
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/refactoring/RenameELVariableProcessor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/refactoring/RenameELVariableProcessor.java 2009-11-27 08:23:38 UTC (rev 18871)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/refactoring/RenameELVariableProcessor.java 2009-11-27 09:53:46 UTC (rev 18872)
@@ -34,7 +34,7 @@
* @param file where refactor was called
*/
public RenameELVariableProcessor(IFile file, String oldName) {
- super();
+ super(file, oldName);
this.file = file;
setOldName(oldName);
}
@@ -51,7 +51,7 @@
rootChange = new CompositeChange(ElCoreMessages.RENAME_EL_VARIABLE_PROCESSOR_TITLE);
- //renameELContextVariable(pm, file);
+ renameELVariable(pm, file);
return status;
}
@@ -69,7 +69,7 @@
status = checkELContextVariable();
if(!status)
- result.addFatalError(Messages.format(ElCoreMessages.RENAME_EL_VARIABLE_PROCESSOR_CAN_NOT_FIND_CONTEXT_VARIABLE, getOldName()));
+ result.addFatalError(Messages.format(ElCoreMessages.RENAME_EL_VARIABLE_PROCESSOR_CAN_NOT_FIND_EL_VARIABLE, getOldName()));
return result;
}
@@ -86,7 +86,7 @@
private boolean checkELContextVariable(){
- boolean status = false;
+ boolean status = true;
IProject[] projects = getSearcher().getProjects();
for (IProject project : projects) {
@@ -140,4 +140,8 @@
SharableParticipants sharedParticipants) throws CoreException {
return EMPTY_REF_PARTICIPANT;
}
+
+ private void renameELVariable(IProgressMonitor pm, IFile file){
+ getSearcher().findELReferences();
+ }
}
\ No newline at end of file
Modified: trunk/common/plugins/org.jboss.tools.common.el.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.ui/META-INF/MANIFEST.MF 2009-11-27 08:23:38 UTC (rev 18871)
+++ trunk/common/plugins/org.jboss.tools.common.el.ui/META-INF/MANIFEST.MF 2009-11-27 09:53:46 UTC (rev 18872)
@@ -20,7 +20,8 @@
org.jboss.tools.jst.web.ui;bundle-version="2.0.0",
org.eclipse.jface.text;bundle-version="3.5.0",
org.eclipse.core.expressions;bundle-version="3.4.100",
- org.eclipse.ltk.ui.refactoring;bundle-version="3.4.100"
+ org.eclipse.ltk.ui.refactoring;bundle-version="3.4.100",
+ org.jboss.tools.common.ui;bundle-version="1.0.0"
Bundle-Vendor: %Bundle-Vendor.0
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Import-Package: org.jboss.tools.vpe.resref.core
Modified: trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/ElUIMessages.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/ElUIMessages.java 2009-11-27 08:23:38 UTC (rev 18871)
+++ trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/ElUIMessages.java 2009-11-27 09:53:46 UTC (rev 18872)
@@ -20,4 +20,5 @@
public static String REFACTOR_CONTRIBUTOR_MAIN_MENU;
public static String REFACTOR_CONTRIBUTOR_RENAME_EL_VARIABLE;
public static String EL_REFACTOR_RENAME_HANDLER_ERROR;
+ public static String RENAME_EL_VARIABLE_WIZARD_EL_VARIABLE_NAME;
}
\ No newline at end of file
Modified: trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/messages.properties
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/messages.properties 2009-11-27 08:23:38 UTC (rev 18871)
+++ trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/messages.properties 2009-11-27 09:53:46 UTC (rev 18872)
@@ -8,3 +8,4 @@
RESOURCE_BUNDLES_RENAME_PARTICIPANT_UPDATE_BUNDLE_REFERENCES=Update bundle references in EL
REFACTOR_CONTRIBUTOR_MAIN_MENU=EL Refactor
REFACTOR_CONTRIBUTOR_RENAME_EL_VARIABLE=Rename EL Variable
+RENAME_EL_VARIABLE_WIZARD_EL_VARIABLE_NAME=Seam component name:
Modified: trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/refactoring/ELRefactorContributionFactory.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/refactoring/ELRefactorContributionFactory.java 2009-11-27 08:23:38 UTC (rev 18871)
+++ trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/refactoring/ELRefactorContributionFactory.java 2009-11-27 09:53:46 UTC (rev 18872)
@@ -333,14 +333,14 @@
RenameELVariableProcessor processor = new RenameELVariableProcessor(editorFile, selectedText);
RenameELVariableRefactoring refactoring = new RenameELVariableRefactoring(processor);
- //RenameELVariableWizard wizard = new RenameELVariableWizard(refactoring, editorFile);
-// RefactoringWizardOpenOperation op = new RefactoringWizardOpenOperation(wizard);
-// try {
-// String titleForFailedChecks = ElUIMessages.EL_REFACTOR_RENAME_HANDLER_ERROR;
-// op.run(activeShell, titleForFailedChecks);
-// } catch (final InterruptedException irex) {
-// // operation was canceled
-// }
+ RenameELVariableWizard wizard = new RenameELVariableWizard(refactoring, editorFile);
+ RefactoringWizardOpenOperation op = new RefactoringWizardOpenOperation(wizard);
+ try {
+ String titleForFailedChecks = ElUIMessages.EL_REFACTOR_RENAME_HANDLER_ERROR;
+ op.run(activeShell, titleForFailedChecks);
+ } catch (final InterruptedException irex) {
+ // operation was canceled
+ }
}
class RenameELVariableAction extends Action{
Added: trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/refactoring/FieldEditorFactory.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/refactoring/FieldEditorFactory.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/refactoring/FieldEditorFactory.java 2009-11-27 09:53:46 UTC (rev 18872)
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.common.el.ui.refactoring;
+
+import org.jboss.tools.common.ui.widget.editor.CompositeEditor;
+import org.jboss.tools.common.ui.widget.editor.IFieldEditor;
+import org.jboss.tools.common.ui.widget.editor.LabelFieldEditor;
+import org.jboss.tools.common.ui.widget.editor.TextFieldEditor;
+
+public class FieldEditorFactory {
+ public static IFieldEditor createTextEditor(String name, String label, String defaultValue) {
+ CompositeEditor editor = new CompositeEditor(name,label, defaultValue);
+ editor.addFieldEditors(new IFieldEditor[]{new LabelFieldEditor(name,label),
+ new TextFieldEditor(name,label, defaultValue)});
+ return editor;
+ }
+}
Property changes on: trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/refactoring/FieldEditorFactory.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/refactoring/RenameELVariableWizard.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/refactoring/RenameELVariableWizard.java 2009-11-27 08:23:38 UTC (rev 18871)
+++ trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/refactoring/RenameELVariableWizard.java 2009-11-27 09:53:46 UTC (rev 18872)
@@ -12,32 +12,31 @@
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
-import java.util.Map;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.resources.IFile;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.ltk.core.refactoring.Refactoring;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
import org.eclipse.ltk.ui.refactoring.RefactoringWizard;
import org.eclipse.ltk.ui.refactoring.UserInputWizardPage;
-import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.jboss.tools.common.el.core.refactoring.RenameELVariableProcessor;
-import org.jboss.tools.common.model.ui.attribute.editor.IFieldEditor;
+import org.jboss.tools.common.el.ui.ElUIMessages;
+import org.jboss.tools.common.ui.widget.editor.CompositeEditor;
+import org.jboss.tools.common.ui.widget.editor.IFieldEditor;
/**
* @author Daniel Azarov
*/
public class RenameELVariableWizard extends RefactoringWizard {
- private String componentName;
+ private String variableName;
private IFieldEditor editor;
- public RenameELVariableWizard(Refactoring refactoring) {
+ public RenameELVariableWizard(Refactoring refactoring, IFile editorFile) {
super(refactoring, WIZARD_BASED_USER_INTERFACE);
}
@@ -57,6 +56,7 @@
public RenameELVariableWizardPage(RenameELVariableProcessor processor){
super("");
this.processor = processor;
+ variableName = processor.getOldName();
}
public void createControl(Composite parent) {
@@ -66,15 +66,15 @@
container.setLayout(layout);
layout.numColumns = 2;
-// String defaultName = component.getName();
-// editor = IFieldEditorFactory.INSTANCE.createTextEditor(componentName, SeamUIMessages.SEAM_WIZARD_FACTORY_SEAM_COMPONENT_NAME, defaultName);
-// editor.doFillIntoGrid(container);
-//
-// ((CompositeEditor)editor).addPropertyChangeListener(new PropertyChangeListener(){
-// public void propertyChange(PropertyChangeEvent evt){
-// validatePage();
-// }
-// });
+ String defaultName = variableName;
+ editor = FieldEditorFactory.createTextEditor(variableName, ElUIMessages.RENAME_EL_VARIABLE_WIZARD_EL_VARIABLE_NAME, defaultName);
+ editor.doFillIntoGrid(container);
+
+ ((CompositeEditor)editor).addPropertyChangeListener(new PropertyChangeListener(){
+ public void propertyChange(PropertyChangeEvent evt){
+ validatePage();
+ }
+ });
setControl(container);
setPageComplete(false);
}
15 years, 1 month
JBoss Tools SVN: r18871 - in trunk/smooks/plugins: org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/common and 9 other directories.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2009-11-27 03:23:38 -0500 (Fri, 27 Nov 2009)
New Revision: 18871
Added:
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/core/SmooksSAXXMLHandler.java
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/core/SmooksXMLParserPool.java
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/common/AbstractAnyType.java
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/common/impl/AbstractAnyTypeImpl.java
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/javabean/impl/JavabeanPackageImpl.java
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/javabean12/impl/Javabean12PackageImpl.java
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/smooks/impl/SmooksPackageImpl.java
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/smooks/util/SmooksResourceFactoryImpl.java
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/smooks/util/SmooksResourceImpl.java
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks10/model/smooks/util/SmooksResourceFactoryImpl.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksReaderFormPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/AbstractSmooksFormEditor.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/ProcessTaskAnalyzer.java
Log:
JBIDE-5157
DONE
Added: trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/core/SmooksSAXXMLHandler.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/core/SmooksSAXXMLHandler.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/core/SmooksSAXXMLHandler.java 2009-11-27 08:23:38 UTC (rev 18871)
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * 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.core;
+
+import java.util.Map;
+
+import org.eclipse.emf.ecore.util.FeatureMap;
+import org.eclipse.emf.ecore.xmi.XMLHelper;
+import org.eclipse.emf.ecore.xmi.XMLResource;
+import org.eclipse.emf.ecore.xmi.impl.SAXXMLHandler;
+import org.eclipse.emf.ecore.xml.type.XMLTypePackage;
+import org.jboss.tools.smooks.model.common.AbstractAnyType;
+
+/**
+ * @author Dart
+ *
+ */
+public class SmooksSAXXMLHandler extends SAXXMLHandler {
+
+ public SmooksSAXXMLHandler(XMLResource xmiResource, XMLHelper helper, Map<?, ?> options) {
+ super(xmiResource, helper, options);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.emf.ecore.xmi.impl.XMLHandler#comment(char[], int, int)
+ */
+ @Override
+ public void comment(char[] ch, int start, int length) {
+ String comment = new String(ch, start, length);
+ Object obj = objects.get(objects.size() - 1);
+
+ if (mixedTargets.peek() != null) {
+ if (text != null) {
+ handleMixedText();
+ }
+ handleComment(comment);
+
+ } else {
+ // if (obj != null && obj instanceof AnyType) {
+ // FeatureMap featureMap = ((AnyType) obj).getMixed();
+ // if (featureMap != null) {
+ // try {
+ // featureMap.add(XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__COMMENT,
+ // comment);
+ // } catch (Exception e) {
+ // e.printStackTrace();
+ // }
+ // text = null;
+ // }
+ // }
+ if (obj != null && obj instanceof AbstractAnyType) {
+ int currentSize = ((AbstractAnyType) obj).eContents().size();
+ ((AbstractAnyType) obj).addComment(comment, new Integer(currentSize));
+ }
+ }
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.emf.ecore.xmi.impl.XMLHandler#handleComment(java.lang.String)
+ */
+ @Override
+ protected void handleComment(String comment) {
+ FeatureMap featureMap = mixedTargets.peek();
+ featureMap.add(XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__COMMENT, comment);
+ text = null;
+ }
+
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/core/SmooksSAXXMLHandler.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/core/SmooksXMLParserPool.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/core/SmooksXMLParserPool.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/core/SmooksXMLParserPool.java 2009-11-27 08:23:38 UTC (rev 18871)
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * 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.core;
+
+import java.util.Map;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.eclipse.emf.ecore.xmi.XMLDefaultHandler;
+import org.eclipse.emf.ecore.xmi.XMLHelper;
+import org.eclipse.emf.ecore.xmi.XMLLoad;
+import org.eclipse.emf.ecore.xmi.XMLParserPool;
+import org.eclipse.emf.ecore.xmi.XMLResource;
+import org.xml.sax.SAXException;
+
+/**
+ * @author Dart
+ *
+ */
+public class SmooksXMLParserPool implements XMLParserPool {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.emf.ecore.xmi.XMLParserPool#get(java.util.Map,
+ * java.util.Map, boolean)
+ */
+ public SAXParser get(Map<String, Boolean> features, Map<String, ?> properties, boolean useLexicalHandler)
+ throws ParserConfigurationException, SAXException {
+ SAXParserFactory f = SAXParserFactory.newInstance();
+ return f.newSAXParser();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.emf.ecore.xmi.XMLParserPool#getDefaultHandler(org.eclipse
+ * .emf.ecore.xmi.XMLResource, org.eclipse.emf.ecore.xmi.XMLLoad,
+ * org.eclipse.emf.ecore.xmi.XMLHelper, java.util.Map)
+ */
+ public XMLDefaultHandler getDefaultHandler(XMLResource resource, XMLLoad xmlLoad, XMLHelper helper,
+ Map<?, ?> options) {
+ return new SmooksSAXXMLHandler(resource, helper, options);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.emf.ecore.xmi.XMLParserPool#release(javax.xml.parsers.SAXParser
+ * , java.util.Map, java.util.Map, boolean)
+ */
+ public void release(SAXParser parser, Map<String, Boolean> features, Map<String, ?> properties,
+ boolean useLexicalHandler) {
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.emf.ecore.xmi.XMLParserPool#releaseDefaultHandler(org.eclipse
+ * .emf.ecore.xmi.XMLDefaultHandler, java.util.Map)
+ */
+ public void releaseDefaultHandler(XMLDefaultHandler handler, Map<?, ?> options) {
+
+ }
+
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/core/SmooksXMLParserPool.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/common/AbstractAnyType.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/common/AbstractAnyType.java 2009-11-27 06:43:16 UTC (rev 18870)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/common/AbstractAnyType.java 2009-11-27 08:23:38 UTC (rev 18871)
@@ -6,8 +6,9 @@
*/
package org.jboss.tools.smooks.model.common;
+import java.util.List;
+
import org.eclipse.emf.ecore.EObject;
-
import org.eclipse.emf.ecore.xml.type.AnyType;
/**
@@ -21,6 +22,17 @@
* @generated
*/
public interface AbstractAnyType extends EObject, AnyType {
+
+ public static final Object NULL_OBJECT = new Object();
+
+ Integer getCommentIndex(String comment);
+
+ void setCommentIndex(String comment , Integer index);
+
+ void addComment(String comment , Integer index);
+
+ List<String> getCommentList();
+
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/common/impl/AbstractAnyTypeImpl.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/common/impl/AbstractAnyTypeImpl.java 2009-11-27 06:43:16 UTC (rev 18870)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/common/impl/AbstractAnyTypeImpl.java 2009-11-27 08:23:38 UTC (rev 18871)
@@ -6,6 +6,10 @@
*/
package org.jboss.tools.smooks.model.common.impl;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl;
@@ -14,18 +18,63 @@
import org.jboss.tools.smooks10.model.smooks.util.SmooksModelUtils;
/**
- * <!-- begin-user-doc -->
- * An implementation of the model object '<em><b>Abstract Any Type</b></em>'.
- * <!-- end-user-doc -->
+ * <!-- begin-user-doc --> An implementation of the model object '
+ * <em><b>Abstract Any Type</b></em>'. <!-- end-user-doc -->
* <p>
* </p>
- *
+ *
* @generated
*/
public abstract class AbstractAnyTypeImpl extends AnyTypeImpl implements AbstractAnyType {
+
+ protected List<String> commentsList = new ArrayList<String>();
+
+ protected Map<String, Integer> commentIndexMap = new HashMap<String, Integer>();
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.jboss.tools.smooks.model.common.AbstractAnyType#addComment(java.lang
+ * .String, java.lang.Object)
+ */
+ public void addComment(String comment, Integer index) {
+ commentsList.add(comment);
+ setCommentIndex(comment, index);
+ }
+
/**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
+ * @return the commentsList
+ */
+ public List<String> getCommentList() {
+ return commentsList;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.jboss.tools.smooks.model.common.AbstractAnyType#getObjectAfterComment
+ * (java.lang.String)
+ */
+ public Integer getCommentIndex(String comment) {
+ return commentIndexMap.get(comment);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.jboss.tools.smooks.model.common.AbstractAnyType#setObjectAfterCommecnt
+ * (java.lang.String, java.lang.Object)
+ */
+ public void setCommentIndex(String comment, Integer obj) {
+ commentIndexMap.put(comment, obj);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
* @generated
*/
protected AbstractAnyTypeImpl() {
@@ -33,8 +82,8 @@
}
/**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
* @generated
*/
@Override
@@ -43,8 +92,8 @@
}
/**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
* @generated
*/
public String getCDATA() {
@@ -52,8 +101,8 @@
}
/**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
* @generated
*/
public void setCDATA(String cdata) {
@@ -62,8 +111,8 @@
}
/**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
* @generated
*/
public String getStringValue() {
@@ -71,13 +120,13 @@
}
/**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
* @generated
*/
public void setStringValue(String stringValue) {
SmooksModelUtils.cleanTextToSmooksType(this);
SmooksModelUtils.appendTextToSmooksType(this, stringValue);
}
-
-} //AbstractAnyTypeImpl
+
+} // AbstractAnyTypeImpl
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/javabean/impl/JavabeanPackageImpl.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/javabean/impl/JavabeanPackageImpl.java 2009-11-27 06:43:16 UTC (rev 18870)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/javabean/impl/JavabeanPackageImpl.java 2009-11-27 08:23:38 UTC (rev 18871)
@@ -724,7 +724,7 @@
source,
new String[] {
"name", "bindings_._type",
- "kind", "mixed"
+ "kind", "elementOnly"
});
addAnnotation
(getBindingsType_Group(),
@@ -932,7 +932,7 @@
source,
new String[] {
"name", "value_._type",
- "kind", "mixed"
+ "kind", "elementOnly"
});
addAnnotation
(getValueType_DecodeParam(),
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/javabean12/impl/Javabean12PackageImpl.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/javabean12/impl/Javabean12PackageImpl.java 2009-11-27 06:43:16 UTC (rev 18870)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/javabean12/impl/Javabean12PackageImpl.java 2009-11-27 08:23:38 UTC (rev 18871)
@@ -768,7 +768,7 @@
source,
new String[] {
"name", "bean_._type",
- "kind", "mixed"
+ "kind", "elementOnly"
});
addAnnotation
(getBeanType_Group(),
@@ -1006,7 +1006,7 @@
source,
new String[] {
"name", "value_._type",
- "kind", "mixed"
+ "kind", "elementOnly"
});
addAnnotation
(getValueType_DecodeParam(),
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/smooks/impl/SmooksPackageImpl.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/smooks/impl/SmooksPackageImpl.java 2009-11-27 06:43:16 UTC (rev 18870)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/smooks/impl/SmooksPackageImpl.java 2009-11-27 08:23:38 UTC (rev 18871)
@@ -1950,7 +1950,7 @@
source,
new String[] {
"name", "smooks-resource-list_._type",
- "kind", "mixed"
+ "kind", "elementOnly"
});
addAnnotation
(getSmooksResourceListType_Params(),
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/smooks/util/SmooksResourceFactoryImpl.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/smooks/util/SmooksResourceFactoryImpl.java 2009-11-27 06:43:16 UTC (rev 18870)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/smooks/util/SmooksResourceFactoryImpl.java 2009-11-27 08:23:38 UTC (rev 18871)
@@ -13,6 +13,7 @@
import org.eclipse.emf.ecore.resource.impl.ResourceFactoryImpl;
import org.eclipse.emf.ecore.xmi.XMLResource;
+import org.jboss.tools.smooks.core.SmooksXMLParserPool;
/**
* <!-- begin-user-doc -->
@@ -50,6 +51,7 @@
result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE);
result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_LEXICAL_HANDLER, Boolean.TRUE);
+ result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_PARSER_POOL, new SmooksXMLParserPool());
return result;
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/smooks/util/SmooksResourceImpl.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/smooks/util/SmooksResourceImpl.java 2009-11-27 06:43:16 UTC (rev 18870)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/smooks/util/SmooksResourceImpl.java 2009-11-27 08:23:38 UTC (rev 18871)
@@ -6,27 +6,95 @@
*/
package org.jboss.tools.smooks.model.smooks.util;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.Writer;
+import java.util.Map;
+
+import org.eclipse.core.runtime.Path;
import org.eclipse.emf.common.util.URI;
-
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.xmi.DOMHandler;
import org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl;
+import org.w3c.dom.Document;
/**
- * <!-- begin-user-doc -->
- * The <b>Resource </b> associated with the package.
+ * <!-- begin-user-doc --> The <b>Resource </b> associated with the package.
* <!-- end-user-doc -->
+ *
* @see org.jboss.tools.smooks.model.smooks.util.SmooksResourceFactoryImpl
* @generated
*/
public class SmooksResourceImpl extends XMLResourceImpl {
/**
- * Creates an instance of the resource.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param uri the URI of the new resource.
+ * Creates an instance of the resource. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @param uri
+ * the URI of the new resource.
* @generated
*/
public SmooksResourceImpl(URI uri) {
super(uri);
}
-} //SmooksResourceImpl
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl#doSave(java.io.OutputStream
+ * , java.util.Map)
+ */
+ @Override
+ public void doSave(OutputStream outputStream, Map<?, ?> options) throws IOException {
+ super.doSave(outputStream, options);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl#save(org.w3c.dom.Document,
+ * java.util.Map, org.eclipse.emf.ecore.xmi.DOMHandler)
+ */
+ @Override
+ public Document save(Document doc, Map<?, ?> options, DOMHandler handler) {
+ return super.save(doc, options, handler);
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.emf.ecore.resource.impl.ResourceImpl#save(java.util.Map)
+ */
+ @Override
+ public void save(Map<?, ?> options) throws IOException {
+// IResource resource = getResource(this);
+// if (resource != null && resource.exists() && (resource instanceof IFile)) {
+// ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+// doSave(outputStream, options);
+//
+// try {
+// ((IFile) resource).setContents(new ByteArrayInputStream(outputStream.toByteArray()), true, false, null);
+// } catch (CoreException e) {
+// throw new IOException(e.getMessage());
+// }
+// } else {
+ super.save(options);
+// }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl#doSave(java.io.Writer,
+ * java.util.Map)
+ */
+ @Override
+ public void doSave(Writer writer, Map<?, ?> options) throws IOException {
+ super.doSave(writer, options);
+ }
+
+} // SmooksResourceImpl
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks10/model/smooks/util/SmooksResourceFactoryImpl.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks10/model/smooks/util/SmooksResourceFactoryImpl.java 2009-11-27 06:43:16 UTC (rev 18870)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks10/model/smooks/util/SmooksResourceFactoryImpl.java 2009-11-27 08:23:38 UTC (rev 18871)
@@ -13,6 +13,7 @@
import org.eclipse.emf.ecore.resource.impl.ResourceFactoryImpl;
import org.eclipse.emf.ecore.xmi.XMLResource;
+import org.jboss.tools.smooks.core.SmooksXMLParserPool;
/**
* <!-- begin-user-doc -->
@@ -50,6 +51,7 @@
result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE);
result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_LEXICAL_HANDLER, Boolean.TRUE);
+ result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_PARSER_POOL, new SmooksXMLParserPool());
return result;
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksReaderFormPage.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksReaderFormPage.java 2009-11-27 06:43:16 UTC (rev 18870)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksReaderFormPage.java 2009-11-27 08:23:38 UTC (rev 18871)
@@ -20,6 +20,7 @@
import org.eclipse.core.filesystem.IFileInfo;
import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.Path;
import org.eclipse.draw2d.ColorConstants;
import org.eclipse.emf.common.command.Command;
@@ -136,6 +137,7 @@
public SmooksReaderFormPage(String id, String title) {
super(id, title);
+ IResource resource;
}
@Override
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/AbstractSmooksFormEditor.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/AbstractSmooksFormEditor.java 2009-11-27 06:43:16 UTC (rev 18870)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/AbstractSmooksFormEditor.java 2009-11-27 08:23:38 UTC (rev 18871)
@@ -17,6 +17,7 @@
import java.util.TimerTask;
import org.dom4j.Document;
+import org.dom4j.Element;
import org.dom4j.io.OutputFormat;
import org.dom4j.io.SAXReader;
import org.dom4j.io.XMLWriter;
@@ -66,6 +67,7 @@
import org.jboss.tools.smooks.configuration.validate.SmooksMarkerHelper;
import org.jboss.tools.smooks.configuration.validate.SmooksModelValidator;
import org.jboss.tools.smooks.model.calc.provider.CalcItemProviderAdapterFactory;
+import org.jboss.tools.smooks.model.common.AbstractAnyType;
import org.jboss.tools.smooks.model.common.provider.CommonItemProviderAdapterFactory;
import org.jboss.tools.smooks.model.csv.provider.CsvItemProviderAdapterFactory;
import org.jboss.tools.smooks.model.csv12.provider.Csv12ItemProviderAdapterFactory;
@@ -219,6 +221,8 @@
try {
SAXReader parser = new SAXReader();
Document doc = parser.read(outstream);
+ EObject rootModel = this.getSmooksModel();
+ fillComments(doc, rootModel);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
OutputFormat format = OutputFormat.createPrettyPrint();
writer = new XMLWriter(stream, format);
@@ -234,6 +238,53 @@
return null;
}
+ protected void fillComments(Document document, EObject rootModel) {
+ if (rootModel instanceof DocumentRoot) {
+ EObject rootElementModel = ((DocumentRoot) rootModel).getSmooksResourceList();
+ Element rootElement = document.getRootElement();
+ try {
+ fillComments(rootElementModel, rootElement);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ protected void fillComments(EObject rootElementModel, Element rootElement) {
+ if (rootElementModel instanceof AbstractAnyType) {
+ List<String> comments = ((AbstractAnyType) rootElementModel).getCommentList();
+ for (Iterator<?> iterator = comments.iterator(); iterator.hasNext();) {
+ String string = (String) iterator.next();
+ Integer commentIndex = ((AbstractAnyType) rootElementModel).getCommentIndex(string);
+ List<?> content = rootElement.elements();
+ List<Object> deletedElementList = new ArrayList<Object>();
+ if (commentIndex.intValue() < content.size()) {
+ List<Object> tempelements = new ArrayList<Object>(content);
+ for (int i = commentIndex.intValue(); i < content.size(); i++) {
+ Element deleteObj = (Element) tempelements.get(i);
+ if (rootElement.remove(deleteObj)) {
+ deletedElementList.add(deleteObj);
+ }
+ }
+ }
+ rootElement.addComment(string);
+ for (int j = 0; j < deletedElementList.size(); j++) {
+ Element deleteElement = (Element) deletedElementList.get(j);
+ rootElement.add(deleteElement);
+ }
+ }
+
+ List<EObject> childrenModel = ((AbstractAnyType) rootElementModel).eContents();
+ List<?> elements = rootElement.elements();
+ int length = Math.min(childrenModel.size(), elements.size());
+ for (int index = 0; index < length; index++) {
+ EObject child = childrenModel.get(index);
+ Element childElement = (Element) elements.get(index);
+ fillComments(child, childElement);
+ }
+ }
+ }
+
protected String getFormattedXMLContents(String contents) throws IOException {
InputStream istream = null;
ByteArrayOutputStream stream = null;
@@ -581,6 +632,7 @@
smooksResource = new SmooksResourceFactoryImpl().createResource(URI.createFileURI(filePath));
}
try {
+
smooksResource.load(Collections.emptyMap());
smooksModel = smooksResource.getContents().get(0);
} catch (IOException e) {
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/ProcessTaskAnalyzer.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/ProcessTaskAnalyzer.java 2009-11-27 06:43:16 UTC (rev 18870)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/editors/process/ProcessTaskAnalyzer.java 2009-11-27 08:23:38 UTC (rev 18871)
@@ -28,6 +28,7 @@
public void analyzeTaskNode(ProcessType process, SmooksResourceListType resourceList) {
process.getTask().clear();
+ if(resourceList == null) return;
// Input task node must be in process:
TaskType inputTask = ProcessFactory.eINSTANCE.createTaskType();
inputTask.setId(TaskTypeManager.TASK_ID_INPUT);
15 years, 1 month
JBoss Tools SVN: r18870 - trunk/bpel/tests/org.jboss.tools.bpel.ui.test/src/org/jboss/tools/bpel/ui/test/editor.
by jbosstools-commits@lists.jboss.org
Author: Grid.Qian
Date: 2009-11-27 01:43:16 -0500 (Fri, 27 Nov 2009)
New Revision: 18870
Modified:
trunk/bpel/tests/org.jboss.tools.bpel.ui.test/src/org/jboss/tools/bpel/ui/test/editor/JBossBPELEditorTest.java
Log:
Fix the bpel test failure
Modified: trunk/bpel/tests/org.jboss.tools.bpel.ui.test/src/org/jboss/tools/bpel/ui/test/editor/JBossBPELEditorTest.java
===================================================================
--- trunk/bpel/tests/org.jboss.tools.bpel.ui.test/src/org/jboss/tools/bpel/ui/test/editor/JBossBPELEditorTest.java 2009-11-26 21:38:48 UTC (rev 18869)
+++ trunk/bpel/tests/org.jboss.tools.bpel.ui.test/src/org/jboss/tools/bpel/ui/test/editor/JBossBPELEditorTest.java 2009-11-27 06:43:16 UTC (rev 18870)
@@ -17,6 +17,7 @@
public class JBossBPELEditorTest extends TestCase{
static String bpelFileName = "HelloWorld.bpel";
+ static String folder = "bpelContent";
IProject fproject;
IFile bpelFile;
static String BUNDLE = "org.jboss.tools.bpel.ui.test";
@@ -26,7 +27,7 @@
//create jboss bpel project
fproject = createProject("ODE_Test");
- bpelFile = fproject.getProject().getFile(bpelFileName);
+ bpelFile = fproject.getProject().getFile(folder+"/"+bpelFileName);
assertTrue(bpelFile.exists());
}
public void tearDown() throws Exception {
15 years, 1 month
JBoss Tools SVN: r18869 - in trunk/smooks: plugins/org.jboss.tools.smooks.runtime and 6 other directories.
by jbosstools-commits@lists.jboss.org
Author: tfennelly
Date: 2009-11-26 16:38:48 -0500 (Thu, 26 Nov 2009)
New Revision: 18869
Added:
trunk/smooks/docs/reference/test.txt
trunk/smooks/plugins/org.jboss.tools.smooks.ui/libs/xstream-1.2.2.jar
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLaunchConfigurationDelegate.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLaunchMetadata.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLaunchTabGroup.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLauncher.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksRunTab.java
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.runtime/.classpath
trunk/smooks/plugins/org.jboss.tools.smooks.runtime/META-INF/MANIFEST.MF
trunk/smooks/plugins/org.jboss.tools.smooks.ui/.classpath
trunk/smooks/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF
trunk/smooks/plugins/org.jboss.tools.smooks.ui/build.properties
trunk/smooks/plugins/org.jboss.tools.smooks.ui/plugin.xml
Log:
https://jira.jboss.org/jira/browse/JBIDE-5259
Implement rudimentary Test facility for Smooks Config
Added: trunk/smooks/docs/reference/test.txt
===================================================================
--- trunk/smooks/docs/reference/test.txt (rev 0)
+++ trunk/smooks/docs/reference/test.txt 2009-11-26 21:38:48 UTC (rev 18869)
@@ -0,0 +1 @@
+svn commit test
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.runtime/.classpath
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.runtime/.classpath 2009-11-26 18:16:38 UTC (rev 18868)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.runtime/.classpath 2009-11-26 21:38:48 UTC (rev 18869)
@@ -1,16 +1,16 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry exported="true" kind="lib" path="libs/freemarker-2.3.11.jar"/>
- <classpathentry exported="true" kind="lib" path="libs/opencsv-1.8.jar"/>
- <classpathentry exported="true" kind="lib" path="libs/jackson-core-lgpl-1.0.1.jar"/>
- <classpathentry exported="true" kind="lib" path="libs/milyn-commons-1.2.1.jar"/>
- <classpathentry exported="true" kind="lib" path="libs/milyn-edisax-parser-1.2.1.jar"/>
- <classpathentry exported="true" kind="lib" path="libs/milyn-smooks-core-1.2.1.jar"/>
- <classpathentry exported="true" kind="lib" path="libs/milyn-smooks-csv-1.2.1.jar"/>
- <classpathentry exported="true" kind="lib" path="libs/milyn-smooks-edi-1.2.1.jar"/>
- <classpathentry exported="true" kind="lib" path="libs/milyn-smooks-json-1.2.1.jar"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry exported="true" kind="lib" path="libs/freemarker-2.3.11.jar"/>
+ <classpathentry exported="true" kind="lib" path="libs/opencsv-1.8.jar"/>
+ <classpathentry exported="true" kind="lib" path="libs/jackson-core-lgpl-1.0.1.jar"/>
+ <classpathentry exported="true" kind="lib" path="libs/milyn-commons-1.2.1.jar"/>
+ <classpathentry exported="true" kind="lib" path="libs/milyn-edisax-parser-1.2.1.jar"/>
+ <classpathentry exported="true" kind="lib" path="libs/milyn-smooks-core-1.2.1.jar"/>
+ <classpathentry exported="true" kind="lib" path="libs/milyn-smooks-csv-1.2.1.jar"/>
+ <classpathentry exported="true" kind="lib" path="libs/milyn-smooks-edi-1.2.1.jar"/>
+ <classpathentry exported="true" kind="lib" path="libs/milyn-smooks-json-1.2.1.jar" sourcepath="/Users/tfennelly/milyn/trunk/smooks-cartridges/json/src/main/java"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.runtime/META-INF/MANIFEST.MF
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.runtime/META-INF/MANIFEST.MF 2009-11-26 18:16:38 UTC (rev 18868)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.runtime/META-INF/MANIFEST.MF 2009-11-26 21:38:48 UTC (rev 18869)
@@ -35,4 +35,7 @@
org.milyn.json,
org.milyn.payload,
org.milyn.smooks.edi,
- org.milyn.xml
+ org.milyn.xml,
+ org.milyn.container,
+ org.milyn.delivery,
+ org.milyn.delivery.sax
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/.classpath
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/.classpath 2009-11-26 18:16:38 UTC (rev 18868)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/.classpath 2009-11-26 21:38:48 UTC (rev 18869)
@@ -1,8 +1,10 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry exported="true" kind="lib" path="libs/dom4j-1.6.1.jar"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry exported="true" kind="lib" path="libs/xstream-1.2.2.jar"/>
+ <classpathentry exported="true" kind="lib" path="bin/"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry exported="true" kind="lib" path="libs/dom4j-1.6.1.jar"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF 2009-11-26 18:16:38 UTC (rev 18868)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF 2009-11-26 21:38:48 UTC (rev 18869)
@@ -31,13 +31,20 @@
org.eclipse.ui.views.properties.tabbed,
org.eclipse.wst.xsl.core,
org.eclipse.zest.core,
- org.eclipse.zest.layouts
+ org.eclipse.zest.layouts,
+ org.eclipse.debug.core;bundle-version="3.5.0",
+ org.eclipse.debug.ui;bundle-version="3.5.1",
+ org.eclipse.jdt.debug.ui;bundle-version="3.4.1",
+ org.eclipse.jdt.junit;bundle-version="3.5.1",
+ org.eclipse.ui.console;bundle-version="3.4.0"
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Vendor: %providerName
-Bundle-ClassPath: libs/dom4j-1.6.1.jar,
- .
+Bundle-ClassPath: bin/,
+ libs/dom4j-1.6.1.jar,
+ .,
+ libs/xstream-1.2.2.jar
Export-Package: org.jboss.template,
org.jboss.template.csv,
org.jboss.template.exception,
@@ -52,4 +59,5 @@
org.jboss.tools.smooks.configuration.editors_10,
org.jboss.tools.smooks.edimap.editor,
org.jboss.tools.smooks.editor,
+ org.jboss.tools.smooks.launch,
org.jboss.tools.smooks.graphical.editors
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/build.properties
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/build.properties 2009-11-26 18:16:38 UTC (rev 18868)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/build.properties 2009-11-26 21:38:48 UTC (rev 18869)
@@ -4,7 +4,6 @@
META-INF/,\
.,\
icons/,\
- libs/,\
libs/dom4j-1.6.1.jar,\
about.html,\
about.ini,\
@@ -12,4 +11,6 @@
about.properties,\
jboss_about.png,\
plugin.properties,\
- schema/
+ schema/,\
+ bin/,\
+ libs/xstream-1.2.2.jar
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/libs/xstream-1.2.2.jar
===================================================================
(Binary files differ)
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/libs/xstream-1.2.2.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/plugin.xml
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/plugin.xml 2009-11-26 18:16:38 UTC (rev 18868)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/plugin.xml 2009-11-26 21:38:48 UTC (rev 18869)
@@ -245,4 +245,28 @@
</propertyContributor>
</extension>
+ <extension
+ point="org.eclipse.debug.core.launchConfigurationTypes">
+ <launchConfigurationType
+ name="Smooks Configuration"
+ delegate="org.jboss.tools.smooks.launch.SmooksLaunchConfigurationDelegate"
+ modes="run"
+ id="org.jboss.tools.smooks.ui.smooksLauncher">
+ </launchConfigurationType>
+ </extension>
+ <extension point="org.eclipse.debug.ui.launchConfigurationTypeImages">
+ <launchConfigurationTypeImage
+ icon="icons/smooks-sm.gif"
+ configTypeID="org.jboss.tools.smooks.ui.smooksLauncher"
+ id="org.jboss.tools.smooks.ui.launchConfigurationTypeImage.smooksLauncher">
+ </launchConfigurationTypeImage>
+ </extension>
+ <extension point="org.eclipse.debug.ui.launchConfigurationTabGroups">
+ <launchConfigurationTabGroup
+ type="org.jboss.tools.smooks.ui.smooksLauncher"
+ class="org.jboss.tools.smooks.launch.SmooksLaunchTabGroup"
+ id="org.jboss.tools.smooks.ui.launchConfigurationTabGroup.smooksLauncher">
+ </launchConfigurationTabGroup>
+ </extension>
+
</plugin>
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLaunchConfigurationDelegate.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLaunchConfigurationDelegate.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLaunchConfigurationDelegate.java 2009-11-26 21:38:48 UTC (rev 18869)
@@ -0,0 +1,124 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.tools.smooks.launch;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate;
+import org.eclipse.jdt.launching.ExecutionArguments;
+import org.eclipse.jdt.launching.IVMRunner;
+import org.eclipse.jdt.launching.VMRunnerConfiguration;
+import org.eclipse.osgi.baseadaptor.loader.BaseClassLoader;
+import org.eclipse.osgi.baseadaptor.loader.ClasspathEntry;
+import org.eclipse.osgi.baseadaptor.loader.ClasspathManager;
+import org.osgi.framework.BundleException;
+
+/**
+ * @author <a href="mailto:tom.fennelly@jboss.com">tom.fennelly(a)jboss.com</a>
+ */
+public class SmooksLaunchConfigurationDelegate extends JUnitLaunchConfigurationDelegate {
+
+ public static final String SMOOKS_INPUT = "SmooksInput";
+ public static final String SMOOKS_INPUT_TYPE = "SmooksInputType";
+ public static final String SMOOKS_PROCESS_TYPES = "SmooksProcessTypes";
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.core.model.ILaunchConfigurationDelegate#launch(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String, org.eclipse.debug.core.ILaunch, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public void launch(ILaunchConfiguration launchConfig, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
+ IVMRunner runner= getVMRunner(launchConfig, mode);
+ VMRunnerConfiguration runConfig = buildRunnerConfig(launchConfig);
+
+ // check for cancellation
+ if (monitor.isCanceled()) {
+ return;
+ }
+
+ IResource smooksConfig = SmooksRunTab.getSmooksConfig(launchConfig);
+ if(smooksConfig != null) {
+ String inputType = launchConfig.getAttribute(SMOOKS_INPUT_TYPE, "");
+ String inputPath = launchConfig.getAttribute(SMOOKS_INPUT, "");
+ String nodeTypes = launchConfig.getAttribute(SMOOKS_PROCESS_TYPES, "");
+
+ runConfig.setProgramArguments(new String[] {smooksConfig.getRawLocation().toOSString(), inputType, inputPath, nodeTypes});
+
+ runner.run(runConfig, launch, monitor);
+ }
+ }
+
+ private VMRunnerConfiguration buildRunnerConfig(ILaunchConfiguration launchConfig) throws CoreException {
+ List<String> classpath = new ArrayList<String>(Arrays.asList(getClasspath(launchConfig)));
+
+ // ====================================================================================================================
+ // TODO Total Hack... Fixme: We're using classes here that we shouldn't, as well as adding bundle paths that we
+ // probably shouldn't, but how do I get the SmooksLauncher class on the launcher classpath?
+ // I added the "bin" folder to the bundle classpath as a workaround (with the following code) for getting
+ // the SmooksLauncher class onto the classpath. Need to fix this properly!!!!
+ //
+ ClassLoader classloader = getClass().getClassLoader();
+ if(classloader instanceof BaseClassLoader) {
+ ClasspathManager cpManager = ((BaseClassLoader)classloader).getClasspathManager();
+ ClasspathEntry[] entries = cpManager.getHostClasspathEntries();
+
+ for(ClasspathEntry entry : entries) {
+ File baseFile = entry.getBundleFile().getBaseFile();
+ try {
+ String[] bundleEntries = entry.getBaseData().getClassPath();
+ for(String bundleEntry : bundleEntries) {
+ String path = baseFile.getAbsolutePath() + "/" + bundleEntry;
+ if(!classpath.contains(path)) {
+ classpath.add(path);
+ }
+ }
+ } catch (BundleException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ //
+ // ====================================================================================================================
+
+ VMRunnerConfiguration runConfig= new VMRunnerConfiguration(SmooksLauncher.class.getName(), classpath.toArray(new String[classpath.size()]));
+ String[] envp= getEnvironment(launchConfig);
+ ArrayList<String> vmArguments= new ArrayList<String>();
+ String vmArgs= getVMArguments(launchConfig);
+ ExecutionArguments execArgs= new ExecutionArguments(vmArgs, "");
+ File workingDir = verifyWorkingDirectory(launchConfig);
+
+ vmArguments.addAll(Arrays.asList(execArgs.getVMArgumentsArray()));
+ runConfig.setVMArguments((String[]) vmArguments.toArray(new String[vmArguments.size()]));
+ runConfig.setEnvironment(envp);
+ if(workingDir != null) {
+ runConfig.setWorkingDirectory(workingDir.getAbsolutePath());
+ }
+ runConfig.setVMSpecificAttributesMap(getVMSpecificAttributesMap(launchConfig));
+ runConfig.setBootClassPath(getBootpath(launchConfig));
+
+ return runConfig;
+ }
+}
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLaunchMetadata.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLaunchMetadata.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLaunchMetadata.java 2009-11-26 21:38:48 UTC (rev 18869)
@@ -0,0 +1,196 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.tools.smooks.launch;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Properties;
+import java.util.Set;
+
+import javax.xml.transform.stream.StreamSource;
+
+import org.eclipse.core.resources.IResource;
+import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
+import org.jboss.tools.smooks10.model.smooks.util.SmooksModelUtils;
+import org.milyn.Smooks;
+import org.milyn.SmooksException;
+import org.milyn.container.ExecutionContext;
+import org.milyn.delivery.sax.SAXElement;
+import org.milyn.delivery.sax.SAXVisitAfter;
+import org.milyn.delivery.sax.SAXVisitBefore;
+
+/**
+ * Smooks configuration launch metadata.
+ * <p/>
+ * Verifies the specified config is a Smooks configuration and extracts launch
+ * metadata from the config (input file etc).
+ *
+ * @author <a href="mailto:tom.fennelly@jboss.com">tom.fennelly(a)jboss.com</a>
+ */
+public class SmooksLaunchMetadata {
+
+ public static enum ProcessNodeType {
+ TEMPLATING,
+ JAVA_BINDING
+ }
+
+ private Smooks inputParamExtractor;
+ private boolean isValidSmooksConfig;
+ private File configFile;
+ private String inputType;
+ private File inputFile;
+ private Set<ProcessNodeType> processNodeTypes = new HashSet<ProcessNodeType>();
+
+ public SmooksLaunchMetadata() {
+ inputParamExtractor = new Smooks();
+ inputParamExtractor.addVisitor(new InputParamExtractor(), "/smooks-resource-list/params/param", "http://www.milyn.org/xsd/smooks-1.1.xsd");
+ inputParamExtractor.addVisitor(new ConfigTypeTracker().setNodeType(ProcessNodeType.TEMPLATING), "/smooks-resource-list/freemarker");
+ inputParamExtractor.addVisitor(new ConfigTypeTracker().setNodeType(ProcessNodeType.JAVA_BINDING), "/smooks-resource-list/bean");
+ }
+
+ public boolean isValidSmooksConfig() {
+ return isValidSmooksConfig;
+ }
+
+ public File getConfigFile() {
+ return configFile;
+ }
+
+ public String getInputType() {
+ return inputType;
+ }
+
+ public File getInputFile() {
+ return inputFile;
+ }
+
+ public Set<ProcessNodeType> getNodeTypes() {
+ return processNodeTypes;
+ }
+
+ public String getNodeTypesString() {
+ StringBuilder builder = new StringBuilder();
+ for(ProcessNodeType nodeType : processNodeTypes) {
+ if(builder.length() > 0) {
+ builder.append(',');
+ }
+ builder.append(nodeType.toString());
+ }
+ return builder.toString();
+ }
+
+ public static Set<ProcessNodeType> fromNodeTypeString(String nodeTypeString) {
+ String[] tokens = nodeTypeString.split(",");
+ Set<ProcessNodeType> nodeTypes = new HashSet<ProcessNodeType>();
+
+ for(String token : tokens) {
+ nodeTypes.add(ProcessNodeType.valueOf(token));
+ }
+
+ return nodeTypes;
+ }
+
+ public void setSmooksConfig(IResource smooksConfig) {
+ reset();
+
+ if(smooksConfig != null) {
+ configFile = new File(smooksConfig.getRawLocation().toOSString());
+ if(configFile.exists() && configFile.isFile()) {
+ ExecutionContext execContext = inputParamExtractor.createExecutionContext();
+ Properties inputParams = new Properties();
+
+ try {
+ // Filter the config and capture the input params...
+ execContext.setAttribute(InputParamExtractor.class, inputParams);
+ execContext.setAttribute(SmooksLaunchMetadata.class, this);
+
+ inputParamExtractor.filterSource(execContext, new StreamSource(new FileInputStream(configFile)));
+
+ String inputType = inputParams.getProperty(SmooksModelUtils.INPUT_TYPE);
+ if(inputType != null) {
+ String inputPath = inputParams.getProperty(inputType);
+ if(inputPath != null) {
+ File inputFile = new File(SmooksUIUtils.parseFilePath(inputPath));
+
+ if(inputFile.exists() && inputFile.isFile()) {
+ this.inputType = inputType;
+ this.inputFile = inputFile;
+ isValidSmooksConfig = true;
+ }
+ }
+ }
+ } catch (Exception e) {
+ // Not a valid Smooks config file
+ }
+ }
+ }
+ }
+
+ private void reset() {
+ isValidSmooksConfig = false;
+ configFile = null;
+ inputType = null;
+ inputFile = null;
+ processNodeTypes.clear();
+ }
+
+ private static class InputParamExtractor implements SAXVisitBefore, SAXVisitAfter {
+
+ public void visitBefore(SAXElement paramElement, ExecutionContext execContext) throws SmooksException, IOException {
+ paramElement.accumulateText();
+ }
+
+ public void visitAfter(SAXElement paramElement, ExecutionContext execContext) throws SmooksException, IOException {
+ Properties inputParams = (Properties) execContext.getAttribute(InputParamExtractor.class);
+
+ if(inputParams != null) {
+ String paramName = paramElement.getAttribute("name");
+
+ if(paramName != null) {
+ if(paramName.equals(SmooksModelUtils.INPUT_TYPE)) {
+ inputParams.setProperty(SmooksModelUtils.INPUT_TYPE, paramElement.getTextContent());
+ } else {
+ String paramType = paramElement.getAttribute("type");
+ if(paramType != null && paramType.equals(SmooksModelUtils.INPUT_ACTIVE_TYPE)) {
+ inputParams.setProperty(paramName, paramElement.getTextContent());
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private static class ConfigTypeTracker implements SAXVisitBefore {
+
+ private ProcessNodeType nodeType;
+
+ public ConfigTypeTracker setNodeType(ProcessNodeType nodeType) {
+ this.nodeType = nodeType;
+ return this;
+ }
+
+ public void visitBefore(SAXElement paramElement, ExecutionContext execContext) throws SmooksException, IOException {
+ SmooksLaunchMetadata metadata = (SmooksLaunchMetadata) execContext.getAttribute(SmooksLaunchMetadata.class);
+ metadata.getNodeTypes().add(nodeType);
+ }
+ }
+}
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLaunchTabGroup.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLaunchTabGroup.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLaunchTabGroup.java 2009-11-26 21:38:48 UTC (rev 18869)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.tools.smooks.launch;
+
+import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
+import org.eclipse.debug.ui.CommonTab;
+import org.eclipse.debug.ui.ILaunchConfigurationDialog;
+import org.eclipse.debug.ui.ILaunchConfigurationTab;
+import org.eclipse.jdt.debug.ui.launchConfigurations.JavaArgumentsTab;
+import org.eclipse.jdt.debug.ui.launchConfigurations.JavaClasspathTab;
+import org.eclipse.jdt.debug.ui.launchConfigurations.JavaJRETab;
+
+/**
+ * @author <a href="mailto:tom.fennelly@jboss.com">tom.fennelly(a)jboss.com</a>
+ */
+public class SmooksLaunchTabGroup extends AbstractLaunchConfigurationTabGroup {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#createTabs(org.eclipse.debug.ui.ILaunchConfigurationDialog, java.lang.String)
+ */
+ public void createTabs(ILaunchConfigurationDialog lcDialog, String mode) {
+ ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[] {
+ new SmooksRunTab(),
+ new JavaArgumentsTab(),
+ new JavaJRETab(),
+ new JavaClasspathTab(),
+ new CommonTab()
+ };
+ setTabs(tabs);
+ }
+}
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLauncher.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLauncher.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksLauncher.java 2009-11-26 21:38:48 UTC (rev 18869)
@@ -0,0 +1,99 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.tools.smooks.launch;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.Set;
+import java.util.Map.Entry;
+
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.jboss.tools.smooks.launch.SmooksLaunchMetadata.ProcessNodeType;
+import org.jboss.tools.smooks10.model.smooks.util.SmooksModelUtils;
+import org.milyn.Smooks;
+import org.milyn.payload.JavaResult;
+import org.xml.sax.SAXException;
+
+import com.thoughtworks.xstream.XStream;
+
+/**
+ * Smooks runtime Launcher class.
+ *
+ * @author <a href="mailto:tom.fennelly@jboss.com">tom.fennelly(a)jboss.com</a>
+ */
+public class SmooksLauncher {
+
+ /**
+ * Launcher Main.
+ * @param args Args.
+ */
+ public static void main(String[] args) throws IOException, SAXException {
+ if(args.length != 4) {
+ throw new RuntimeException("Expected 4 Launch arguments: <Smooks Config> <Input Type> <Input Path> <Node Types>");
+ }
+
+ if(args[1].equals(SmooksModelUtils.INPUT_TYPE_JAVA)) {
+ System.out.println("Sorry... we don't support Java Inputs yet.");
+ } else {
+ File smooksConfig = new File(args[0]);
+ File input = new File(args[2]);
+
+ assertFile(smooksConfig, "Smooks");
+ assertFile(input, "Input");
+
+ Smooks smooks = new Smooks(smooksConfig.getAbsolutePath());
+ try {
+ Set<ProcessNodeType> processNodeTypes = SmooksLaunchMetadata.fromNodeTypeString(args[3]);
+ JavaResult javaResult = new JavaResult();
+
+ if(processNodeTypes.contains(ProcessNodeType.TEMPLATING)) {
+ smooks.filterSource(new StreamSource(new FileInputStream(input)), new StreamResult(System.out), javaResult);
+ } else {
+ smooks.filterSource(new StreamSource(new FileInputStream(input)), javaResult);
+ if(processNodeTypes.contains(ProcessNodeType.JAVA_BINDING)) {
+ System.out.println("[Java Bindings (XML Serialized)...]");
+ Set<Entry<String, Object>> bindings = javaResult.getResultMap().entrySet();
+
+ for(Entry<String, Object> binding : bindings) {
+ System.out.println("\n" + binding.getKey() + ":");
+ System.out.println("\n" + (new XStream()).toXML(binding.getValue()));
+ System.out.println("=============================================");
+ }
+ }
+ }
+
+ } finally {
+ smooks.close();
+ }
+ }
+ }
+
+ private static void assertFile(File file, String name) {
+ if(!file.exists()) {
+ throw new RuntimeException("Specified '" + name + "' File '" + file.getAbsolutePath() + "' not found.");
+ }
+ if(file.isDirectory()) {
+ throw new RuntimeException("Specified '" + name + "' File '" + file.getAbsolutePath() + "' is a Directory.");
+ }
+ }
+}
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksRunTab.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksRunTab.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/launch/SmooksRunTab.java 2009-11-26 21:38:48 UTC (rev 18869)
@@ -0,0 +1,431 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+ package org.jboss.tools.smooks.launch;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.window.Window;
+
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.ElementListSelectionDialog;
+import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
+import org.eclipse.ui.model.WorkbenchContentProvider;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+import org.eclipse.ui.part.FileEditorInput;
+
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+
+import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
+
+import org.eclipse.jdt.core.IJavaModel;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+
+import org.eclipse.jdt.internal.junit.ui.JUnitMessages;
+import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
+
+import org.eclipse.jdt.ui.JavaElementLabelProvider;
+import org.jboss.tools.smooks.editor.AbstractSmooksFormEditor;
+
+/**
+ * @author <a href="mailto:tom.fennelly@jboss.com">tom.fennelly(a)jboss.com</a>
+ */
+public class SmooksRunTab extends AbstractLaunchConfigurationTab {
+
+ // Project UI widgets
+ private Text fProjText;
+ private Button fProjButton;
+ private Text fConfigurationText;
+ private Button fSearchButton;
+ private SmooksLaunchMetadata launchMetaData = new SmooksLaunchMetadata();
+
+ private ILaunchConfiguration fLaunchConfiguration;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+ Composite comp = new Composite(parent, SWT.NONE);
+ setControl(comp);
+
+ GridLayout topLayout = new GridLayout();
+ topLayout.numColumns= 3;
+ comp.setLayout(topLayout);
+
+ createFormElements(comp);
+
+ Dialog.applyDialogFont(comp);
+ validatePage();
+ }
+
+ private void createSpacer(Composite comp) {
+ Label label= new Label(comp, SWT.NONE);
+ GridData gd= new GridData();
+ gd.horizontalSpan= 3;
+ label.setLayoutData(gd);
+ }
+
+ private void createFormElements(Composite comp) {
+ GridData gd = new GridData();
+
+ Label fProjLabel = new Label(comp, SWT.NONE);
+ gd.horizontalIndent = 10;
+ fProjLabel.setText("Project:");
+ fProjLabel.setLayoutData(gd);
+
+ fProjText= new Text(comp, SWT.SINGLE | SWT.BORDER);
+ fProjText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ fProjText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent evt) {
+ validatePage();
+ updateLaunchConfigurationDialog();
+ fSearchButton.setEnabled(fProjText.getText().length() > 0);
+ }
+ });
+
+ fProjButton = new Button(comp, SWT.PUSH);
+ fProjButton.setText("Browse");
+ fProjButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent evt) {
+ handleProjectButtonSelected();
+ }
+ });
+ setButtonGridData(fProjButton);
+
+ Label fConfigLabel = new Label(comp, SWT.NONE);
+ gd = new GridData();
+ gd.horizontalIndent = 10;
+ fConfigLabel.setLayoutData(gd);
+ fConfigLabel.setText("Configuration:");
+
+
+ fConfigurationText = new Text(comp, SWT.SINGLE | SWT.BORDER);
+ fConfigurationText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ fConfigurationText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent evt) {
+ handleSmooksConfigChange();
+ validatePage();
+ updateLaunchConfigurationDialog();
+ }
+ });
+
+ fSearchButton = new Button(comp, SWT.PUSH);
+ fSearchButton.setEnabled(fProjText.getText().length() > 0);
+ fSearchButton.setText("Search");
+ fSearchButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent evt) {
+ handleSearchButtonSelected();
+ }
+ });
+ setButtonGridData(fSearchButton);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
+ */
+ public void setDefaults(ILaunchConfigurationWorkingCopy launchConfigWC) {
+ IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+
+ launchConfigWC.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, ""); //$NON-NLS-1$
+ launchConfigWC.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, ""); //$NON-NLS-1$
+ launchConfigWC.setAttribute(SmooksLaunchConfigurationDelegate.SMOOKS_INPUT, ""); //$NON-NLS-1$
+ launchConfigWC.setAttribute(SmooksLaunchConfigurationDelegate.SMOOKS_INPUT_TYPE, ""); //$NON-NLS-1$
+
+ if(activePage != null) {
+ IEditorPart editor = activePage.getActiveEditor();
+
+ if(editor instanceof AbstractSmooksFormEditor) {
+ IEditorInput editorInput = editor.getEditorInput();
+
+ launchConfigWC.rename(editor.getTitle());
+ if(editorInput instanceof FileEditorInput) {
+ FileEditorInput fileEI = (FileEditorInput) editorInput;
+ IFile file = fileEI.getFile();
+
+ launchConfigWC.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, file.getProject().getName()); //$NON-NLS-1$
+ launchConfigWC.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, file.getProjectRelativePath().toString()); //$NON-NLS-1$
+ }
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
+ */
+ public void initializeFrom(ILaunchConfiguration config) {
+ fLaunchConfiguration = config;
+ try {
+ fProjText.setText(config.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, "")); //$NON-NLS-1$
+ fConfigurationText.setText(config.getAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, "")); //$NON-NLS-1$
+ } catch (CoreException ce) {
+ }
+ IResource smooksConfig = getSmooksConfig();
+ if(smooksConfig != null) {
+ launchMetaData.setSmooksConfig(smooksConfig);
+ }
+ validatePage();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
+ */
+ public void performApply(ILaunchConfigurationWorkingCopy launchConfigWC) {
+ launchConfigWC.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, fProjText.getText());
+ launchConfigWC.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, fConfigurationText.getText());
+ if(launchMetaData.isValidSmooksConfig()) {
+ launchConfigWC.setAttribute(SmooksLaunchConfigurationDelegate.SMOOKS_INPUT, launchMetaData.getInputFile().getAbsolutePath()); //$NON-NLS-1$
+ launchConfigWC.setAttribute(SmooksLaunchConfigurationDelegate.SMOOKS_INPUT_TYPE, launchMetaData.getInputType()); //$NON-NLS-1$
+ launchConfigWC.setAttribute(SmooksLaunchConfigurationDelegate.SMOOKS_PROCESS_TYPES, launchMetaData.getNodeTypesString()); //$NON-NLS-1$
+ } else {
+ launchConfigWC.setAttribute(SmooksLaunchConfigurationDelegate.SMOOKS_INPUT, ""); //$NON-NLS-1$
+ launchConfigWC.setAttribute(SmooksLaunchConfigurationDelegate.SMOOKS_INPUT_TYPE, ""); //$NON-NLS-1$
+ launchConfigWC.setAttribute(SmooksLaunchConfigurationDelegate.SMOOKS_PROCESS_TYPES, ""); //$NON-NLS-1$
+ }
+ }
+
+ /*
+ * Show a dialog that lists all main types
+ */
+ private void handleSearchButtonSelected() {
+ ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider());
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ IProject project = root.getProject(fProjText.getText());
+
+ if(assertProjectOK(project)) {
+ dialog.setInput(project);
+ } else {
+ dialog.setInput(root);
+ }
+
+ dialog.setTitle("Select Smooks Configuration File...");
+ if (dialog.open() == Window.CANCEL) {
+ return;
+ }
+
+ Object[] results = dialog.getResult();
+ if ((results == null) || (results.length < 1)) {
+ return;
+ }
+
+ IResource resource = (IResource)results[0];
+ fConfigurationText.setText(resource.getProjectRelativePath().toString());
+ }
+
+ private void handleSmooksConfigChange() {
+ launchMetaData.setSmooksConfig(getSmooksConfig());
+ }
+
+ /*
+ * Show a dialog that lets the user select a project. This in turn provides
+ * context for the main type, allowing the user to key a main type name, or
+ * constraining the search for main types to the specified project.
+ */
+ private void handleProjectButtonSelected() {
+ IJavaProject project = chooseJavaProject();
+ if (project == null) {
+ return;
+ }
+
+ String projectName = project.getElementName();
+ fProjText.setText(projectName);
+ }
+
+ /*
+ * Realize a Java Project selection dialog and return the first selected project,
+ * or null if there was none.
+ */
+ private IJavaProject chooseJavaProject() {
+ IJavaProject[] projects;
+ try {
+ projects= JavaCore.create(getWorkspaceRoot()).getJavaProjects();
+ } catch (JavaModelException e) {
+ projects= new IJavaProject[0];
+ }
+
+ ILabelProvider labelProvider= new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT);
+ ElementListSelectionDialog dialog= new ElementListSelectionDialog(getShell(), labelProvider);
+ dialog.setTitle(JUnitMessages.JUnitLaunchConfigurationTab_projectdialog_title);
+ dialog.setMessage(JUnitMessages.JUnitLaunchConfigurationTab_projectdialog_message);
+ dialog.setElements(projects);
+
+ IJavaProject javaProject = getJavaProject();
+ if (javaProject != null) {
+ dialog.setInitialSelections(new Object[] { javaProject });
+ }
+ if (dialog.open() == Window.OK) {
+ return (IJavaProject) dialog.getFirstResult();
+ }
+ return null;
+ }
+
+ /*
+ * Return the IJavaProject corresponding to the project name in the project name
+ * text field, or null if the text does not match a project name.
+ */
+ private IJavaProject getJavaProject() {
+ String projectName = fProjText.getText().trim();
+ if (projectName.length() < 1) {
+ return null;
+ }
+ return getJavaModel().getJavaProject(projectName);
+ }
+
+ /*
+ * Convenience method to get the workspace root.
+ */
+ private static IWorkspaceRoot getWorkspaceRoot() {
+ return ResourcesPlugin.getWorkspace().getRoot();
+ }
+
+ /*
+ * Convenience method to get access to the java model.
+ */
+ private IJavaModel getJavaModel() {
+ return JavaCore.create(getWorkspaceRoot());
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#isValid(org.eclipse.debug.core.ILaunchConfiguration)
+ */
+ public boolean isValid(ILaunchConfiguration config) {
+ validatePage();
+ return getErrorMessage() == null;
+ }
+
+ private void validatePage() {
+
+ setErrorMessage(null);
+ setMessage(null);
+
+ String projectName= fProjText.getText().trim();
+ if (projectName.length() == 0) {
+ setErrorMessage("Project name not configured.");
+ return;
+ }
+
+ IStatus status= ResourcesPlugin.getWorkspace().validatePath(IPath.SEPARATOR + projectName, IResource.PROJECT);
+ if (!status.isOK() || !Path.ROOT.isValidSegment(projectName)) {
+ setErrorMessage("Invalid project name '" + projectName + "'.");
+ return;
+ }
+
+ IProject project= getWorkspaceRoot().getProject(projectName);
+ if (!project.exists()) {
+ setErrorMessage("Unknown project name '" + projectName + "'.");
+ return;
+ }
+ IJavaProject javaProject= JavaCore.create(project);
+
+ String configName= fConfigurationText.getText().trim();
+ try {
+ if (!project.hasNature(JavaCore.NATURE_ID)) {
+ setErrorMessage("Project '" + projectName + "' is not a Java Project.");
+ return;
+ }
+ if (configName.length() == 0) {
+ setErrorMessage("Smooks Configuration not specified.");
+ return;
+ }
+ } catch (CoreException e) {
+ setErrorMessage("Unexpected Validation Error: " + e.getMessage());
+ }
+
+ if(!launchMetaData.isValidSmooksConfig()) {
+ setErrorMessage("The selected Smooks configuration is not valid. Must be a valid Smooks configuration, with a valid configured input.");
+ }
+ }
+
+ private IResource getSmooksConfig() {
+ String projectName = fProjText.getText();
+ String configName = fConfigurationText.getText();
+
+ return getSmooksConfig(projectName, configName);
+ }
+
+ public static IResource getSmooksConfig(ILaunchConfiguration launchConfig) {
+ try {
+ String projectName = launchConfig.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, ""); //$NON-NLS-1$;
+ String configName = launchConfig.getAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, ""); //$NON-NLS-1$;
+
+ return getSmooksConfig(projectName, configName);
+ } catch (CoreException e) {
+ return null;
+ }
+ }
+
+ private static IResource getSmooksConfig(String projectName, String configName) {
+ if(projectName != null && !projectName.trim().equals("") && configName != null && !configName.trim().equals("")) {
+ IProject project = getWorkspaceRoot().getProject(projectName);
+ if(assertProjectOK(project)) {
+ return project.findMember(configName);
+ }
+ }
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName()
+ */
+ public String getName() {
+ return "Run";
+ }
+
+ private void setButtonGridData(Button button) {
+ GridData gridData= new GridData();
+ button.setLayoutData(gridData);
+ }
+
+ private static boolean assertProjectOK(IProject project) {
+ return (project != null && project.exists() && project.isAccessible() && !project.isHidden());
+ }
+}
+
+
15 years, 1 month
JBoss Tools SVN: r18868 - in trunk/seam/plugins/org.jboss.tools.seam.ui: src/org/jboss/tools/seam/ui/preferences and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2009-11-26 13:16:38 -0500 (Thu, 26 Nov 2009)
New Revision: 18868
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/AddSeamSupportAction.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.properties
trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml
Log:
https://jira.jboss.org/jira/browse/JBIDE-5275
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.properties
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.properties 2009-11-26 17:59:36 UTC (rev 18867)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.properties 2009-11-26 18:16:38 UTC (rev 18868)
@@ -6,6 +6,7 @@
PreferencePage_SeamSettings=Seam Settings
ViewCategory_Seam=Seam
ViewName_SeamComponents=Seam Components
+ConfigureMenu_AddSeamSupport=Add Seam support...
perspective.name=Seam
Bundle-Vendor.0 = JBoss by Red Hat
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml 2009-11-26 17:59:36 UTC (rev 18867)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml 2009-11-26 18:16:38 UTC (rev 18868)
@@ -677,4 +677,35 @@
<xclass id="org.jboss.tools.seam.ui.views.actions.RenameComponentAction"
class="org.jboss.tools.seam.ui.views.actions.RenameComponentAction"/>
</extension>
+
+ <extension
+ point="org.eclipse.ui.popupMenus">
+
+ <objectContribution
+ id="org.jboss.tools.seam.ui.project.configure"
+ objectClass="org.eclipse.core.resources.IProject"
+ adaptable="true">
+ <visibility>
+ <and>
+ <objectState
+ name="projectNature"
+ value="org.eclipse.jdt.core.javanature"/>
+ <not>
+ <objectState
+ name="projectNature"
+ value="org.jboss.tools.seam.core.seamnature"/>
+ </not>
+ </and>
+ </visibility>
+
+ <action
+ id="org.jboss.tools.seam.ui.AddSeamSupport"
+ label="%ConfigureMenu_AddSeamSupport"
+ class="org.jboss.tools.seam.ui.preferences.AddSeamSupportAction"
+ enablesFor="1"
+ menubarPath="org.eclipse.ui.projectConfigure/additions"/>
+
+ </objectContribution>
+ </extension>
+
</plugin>
Added: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/AddSeamSupportAction.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/AddSeamSupportAction.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/AddSeamSupportAction.java 2009-11-26 18:16:38 UTC (rev 18868)
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.ui.preferences;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.preference.PreferenceDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.PreferencesUtil;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class AddSeamSupportAction implements IObjectActionDelegate {
+
+ private ISelection currentSelection;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart)
+ */
+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ */
+ public void run(IAction action) {
+ IProject project = (IProject) ((IStructuredSelection) currentSelection).getFirstElement();
+ PreferenceDialog dialog = PreferencesUtil.createPropertyDialogOn(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), project, SeamSettingsPreferencePage.ID, new String[] {SeamSettingsPreferencePage.ID}, null);
+ dialog.open();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+ */
+ public void selectionChanged(IAction action, ISelection selection) {
+ this.currentSelection = selection;
+ }
+}
\ No newline at end of file
Property changes on: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/AddSeamSupportAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 1 month
JBoss Tools SVN: r18867 - in trunk: jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2009-11-26 12:59:36 -0500 (Thu, 26 Nov 2009)
New Revision: 18867
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/src/org/jboss/tools/jsf/text/ext/richfaces/hyperlink/RichfacesCSSClassHyperlink.java
trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/CSSClassHyperlink.java
Log:
JBIDE-5149: Make OpenOn work for styleClass="|"
The CSS-file search and an start position calculation are fixed
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/src/org/jboss/tools/jsf/text/ext/richfaces/hyperlink/RichfacesCSSClassHyperlink.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/src/org/jboss/tools/jsf/text/ext/richfaces/hyperlink/RichfacesCSSClassHyperlink.java 2009-11-26 17:59:32 UTC (rev 18866)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/src/org/jboss/tools/jsf/text/ext/richfaces/hyperlink/RichfacesCSSClassHyperlink.java 2009-11-26 17:59:36 UTC (rev 18867)
@@ -12,26 +12,15 @@
package org.jboss.tools.jsf.text.ext.richfaces.hyperlink;
import java.text.MessageFormat;
-import java.util.List;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.Region;
-import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
-import org.jboss.tools.common.el.core.resolver.ELContext;
import org.jboss.tools.common.text.ext.hyperlink.xpl.Messages;
import org.jboss.tools.jst.text.ext.hyperlink.CSSClassHyperlink;
-import org.jboss.tools.jst.web.kb.ICSSContainerSupport;
-import org.jboss.tools.jst.web.kb.PageContextFactory;
-import org.jboss.tools.jst.web.kb.PageContextFactory.CSSStyleSheetDescriptor;
-import org.w3c.dom.css.CSSRule;
-import org.w3c.dom.css.CSSRuleList;
/**
*
* @author Victor Rubezhny
*
*/
-@SuppressWarnings("restriction")
public class RichfacesCSSClassHyperlink extends CSSClassHyperlink {
/*
* (non-Javadoc)
Modified: trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/CSSClassHyperlink.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/CSSClassHyperlink.java 2009-11-26 17:59:32 UTC (rev 18866)
+++ trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/CSSClassHyperlink.java 2009-11-26 17:59:36 UTC (rev 18867)
@@ -18,6 +18,7 @@
import java.util.regex.Pattern;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
@@ -75,17 +76,48 @@
for (int r = 0; rules != null && r < rules.getLength(); r++) {
if (isRuleMatch(rules.item(r), getStyleName(region))) {
CSSRule rule = rules.item(r);
- System.out.println();
- showRegion(
- PageContextFactory.getFileFromProject(descr.source, getFile()),
- new Region(((IndexedRegion)rule).getStartOffset(), ((IndexedRegion)rule).getLength()));
- return;
+ IFile file = findFileForCSSStyleSheet(descr.source);
+ if (file != null) {
+ int startOffset = 0;
+ if (descr.sheet.getOwnerNode() != null) {
+ Node node = descr.sheet.getOwnerNode().getFirstChild();
+ if (node instanceof IndexedRegion) {
+ startOffset = ((IndexedRegion)node).getStartOffset();
+ }
+ }
+ showRegion(
+ file,
+ new Region(startOffset + ((IndexedRegion)rule).getStartOffset(), ((IndexedRegion)rule).getLength()));
+ return;
+ }
}
}
}
openFileFailed();
}
+ /*
+ * Finds a file representing the specified stylesheet
+ *
+ * Three kinds of filePath values are tested:
+ * - workspace related full path (Comes for a stylesheet defined in STYLE tag. Actually it is a path to the page where the STYLE tag is used)
+ * - full file path to the CSS-file within the project
+ * - relative file path
+ *
+ * @param filePath
+ * @return
+ */
+ private IFile findFileForCSSStyleSheet(String filePath) {
+ // First try to find a file by WS-related path (because it's the most longest path)
+ IFile file = ResourcesPlugin.getWorkspace().getRoot()
+ .getFileForLocation(
+ ResourcesPlugin.getWorkspace().getRoot().
+ getLocation().append(filePath));
+
+ return file != null ? file : PageContextFactory.getFileFromProject(filePath, getFile());
+
+ }
+
/**
*
* @param cssRule
15 years, 1 month
JBoss Tools SVN: r18866 - trunk/esb/plugins/org.jboss.tools.esb.core/resources/help.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-11-26 12:59:32 -0500 (Thu, 26 Nov 2009)
New Revision: 18866
Modified:
trunk/esb/plugins/org.jboss.tools.esb.core/resources/help/keys-esb.properties
Log:
https://jira.jboss.org/jira/browse/JBIDE-5199
Modified: trunk/esb/plugins/org.jboss.tools.esb.core/resources/help/keys-esb.properties
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.core/resources/help/keys-esb.properties 2009-11-26 17:57:51 UTC (rev 18865)
+++ trunk/esb/plugins/org.jboss.tools.esb.core/resources/help/keys-esb.properties 2009-11-26 17:59:32 UTC (rev 18866)
@@ -450,6 +450,7 @@
ESBPreHeader_Properties.Title=ESB Header
ESBPreImplicitCollection_Properties.Title=ESB Implicit Collection
ESBPreNamespace_Properties.Title=ESB Namespace
+ESBPreRouterNamespace_Properties.Title=ESB Namespace
ESBPreNotificationList_CreateTarget.WindowTitle=Add Target
ESBPreNotificationList_CreateTarget.Title=ESB Target
15 years, 1 month
JBoss Tools SVN: r18865 - trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/form.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-11-26 12:57:51 -0500 (Thu, 26 Nov 2009)
New Revision: 18865
Modified:
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/form/ESBListsFormLayoutData.java
trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/form/ESBXMLFormLayoutData.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5199
Modified: trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/form/ESBListsFormLayoutData.java
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/form/ESBListsFormLayoutData.java 2009-11-26 17:57:01 UTC (rev 18864)
+++ trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/form/ESBListsFormLayoutData.java 2009-11-26 17:57:51 UTC (rev 18865)
@@ -198,4 +198,20 @@
FormLayoutDataUtil.createDefaultFormActionData("CreateActions.AddBPMVar") //$NON-NLS-1$
);
+ static IFormData NAMESPACE_LIST_DEFINITION = new FormData(
+ "Namespace List", //$NON-NLS-1$
+ ModelFormLayoutData.EMPTY_DESCRIPTION,
+ new FormAttributeData[]{new FormAttributeData("namespace uri", 100)},
+ new String[]{ConverterConstants.NAMESPACE_ENTITY},
+ FormLayoutDataUtil.createDefaultFormActionData("CreateActions.AddNamespace") //$NON-NLS-1$
+ );
+
+ static IFormData ROUTER_NAMESPACE_LIST_DEFINITION = new FormData(
+ "Namespace List", //$NON-NLS-1$
+ ModelFormLayoutData.EMPTY_DESCRIPTION,
+ new FormAttributeData[]{new FormAttributeData("prefix", 50), new FormAttributeData("uri", 50)},
+ new String[]{ConverterConstants.ROUTER_NAMESPACE_ENTITY},
+ FormLayoutDataUtil.createDefaultFormActionData("CreateActions.AddNamespace") //$NON-NLS-1$
+ );
+
}
Modified: trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/form/ESBXMLFormLayoutData.java
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/form/ESBXMLFormLayoutData.java 2009-11-26 17:57:01 UTC (rev 18864)
+++ trunk/esb/plugins/org.jboss.tools.esb.ui/src/org/jboss/tools/esb/ui/editor/form/ESBXMLFormLayoutData.java 2009-11-26 17:57:51 UTC (rev 18865)
@@ -90,6 +90,12 @@
if(entity.getChild(ConverterConstants.BPM_VAR_ENTITY) != null) {
list.add(ESBListsFormLayoutData.BPM_VAR_LIST_DEFINITION);
}
+ if(entity.getChild(ConverterConstants.NAMESPACE_ENTITY) != null) {
+ list.add(ESBListsFormLayoutData.NAMESPACE_LIST_DEFINITION);
+ }
+ if(entity.getChild(ConverterConstants.ROUTER_NAMESPACE_ENTITY) != null) {
+ list.add(ESBListsFormLayoutData.ROUTER_NAMESPACE_LIST_DEFINITION);
+ }
//do nothing; when specific children exist use specific forms
} else if(entity.getChild(ENT_ESB_PROPERTY) != null) {
list.add(ESBListsFormLayoutData.ESB_PROPERTY_LIST_DEFINITION);
15 years, 1 month
JBoss Tools SVN: r18864 - in trunk/esb/plugins/org.jboss.tools.esb.core: resources/meta and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-11-26 12:57:01 -0500 (Thu, 26 Nov 2009)
New Revision: 18864
Modified:
trunk/esb/plugins/org.jboss.tools.esb.core/resources/help/keys-esb-attrs.properties
trunk/esb/plugins/org.jboss.tools.esb.core/resources/help/keys-esb-attrs_ja.properties
trunk/esb/plugins/org.jboss.tools.esb.core/resources/help/keys-esb.properties
trunk/esb/plugins/org.jboss.tools.esb.core/resources/meta/esb-actions.meta
trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/SpecificActionLoader.java
trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/converters/ConverterConstants.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5199
Modified: trunk/esb/plugins/org.jboss.tools.esb.core/resources/help/keys-esb-attrs.properties
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.core/resources/help/keys-esb-attrs.properties 2009-11-26 17:02:14 UTC (rev 18863)
+++ trunk/esb/plugins/org.jboss.tools.esb.core/resources/help/keys-esb-attrs.properties 2009-11-26 17:57:01 UTC (rev 18864)
@@ -156,3 +156,5 @@
ESB.unwrap=Unwrap
ESB.auth=Auth
ESB.message_attachment_name=Message Attachment Name
+ESB.cbr_alias=CBR Alias
+ESB.expression=Expression
\ No newline at end of file
Modified: trunk/esb/plugins/org.jboss.tools.esb.core/resources/help/keys-esb-attrs_ja.properties
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.core/resources/help/keys-esb-attrs_ja.properties 2009-11-26 17:02:14 UTC (rev 18863)
+++ trunk/esb/plugins/org.jboss.tools.esb.core/resources/help/keys-esb-attrs_ja.properties 2009-11-26 17:57:01 UTC (rev 18864)
@@ -108,4 +108,4 @@
ESB.xmlns=Xmlns
ESB.xmlns_xsi=Xmlns\:xsi
ESB.xsi_schemaLocation=Xsi\:schemaLocation
-ESB.parameter_reload_secs=Parameter Reload Secs
+ESB.parameter_reload_secs=Parameter Reload Secs
\ No newline at end of file
Modified: trunk/esb/plugins/org.jboss.tools.esb.core/resources/help/keys-esb.properties
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.core/resources/help/keys-esb.properties 2009-11-26 17:02:14 UTC (rev 18863)
+++ trunk/esb/plugins/org.jboss.tools.esb.core/resources/help/keys-esb.properties 2009-11-26 17:57:01 UTC (rev 18864)
@@ -562,6 +562,7 @@
ESBPreActionByteArrayToString101_Properties.Title=Byte Array to String
ESBPreActionCommandInterpreter101_Properties.Title=Command Interpreter
ESBPreActionContentBasedRouter101_Properties.Title=Content Based Router
+ESBPreActionContentBasedRouter120_Properties.Title=Content Based Router
ESBPreActionEJBProcessor120_Properties.Title=EJB Processor
ESBPreActionEMailRouter120_Properties.Title=EMail Router
ESBPreActionEMailWiretap120_Properties.Title=EMail Wiretap
Modified: trunk/esb/plugins/org.jboss.tools.esb.core/resources/meta/esb-actions.meta
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.core/resources/meta/esb-actions.meta 2009-11-26 17:02:14 UTC (rev 18863)
+++ trunk/esb/plugins/org.jboss.tools.esb.core/resources/meta/esb-actions.meta 2009-11-26 17:57:01 UTC (rev 18864)
@@ -430,6 +430,102 @@
<XDependencies/>
</XModelEntity>
<XModelEntity ImplementingClass="%ESB%"
+ PROPERTIES="formFactory=%Default%;formLayout=org.jboss.tools.esb.ui.editor.form.ESBXMLFormLayoutData;children=%EntityOrdered%"
+ XMLSUBPATH="action" name="ESBPreActionContentBasedRouter120">
+ <XChildrenEntities>
+ <XChildEntity name="ESBProperty"/>
+ <XChildEntity name="ESBPreRouteTo"/>
+ <XChildEntity name="ESBPreRouterNamespace"/>
+ </XChildrenEntities>
+ <XEntityRenderer>
+ <ICONS>
+ <ICON info="main.esb.action" type="main"/>
+ </ICONS>
+ </XEntityRenderer>
+ <XModelAttributes>
+ <XModelAttribute default="content based router action"
+ loader="ElementType" name="element type">
+ <Editor name="Uneditable"/>
+ </XModelAttribute>
+ <XModelAttribute PROPERTIES="category=general;id=true;save=always"
+ name="name" xmlname="name"/>
+ <XModelAttribute PROPERTIES="category=general;save=always"
+ default="org.jboss.soa.esb.actions.ContentBasedRouter" name="class" xmlname="class">
+ <Editor name="Uneditable"/>
+ </XModelAttribute>
+ <XModelAttribute PROPERTIES="pre=true;category=general"
+ name="cbr alias" xmlname="cbrAlias">
+ <Constraint loader="ListString">
+ <value/>
+ <value name="Drools"/>
+ <value name="Xpath"/>
+ <value name="Regex"/>
+ </Constraint>
+ <Editor name="ListString"/>
+ </XModelAttribute>
+ <XModelAttribute PROPERTIES="pre=true;category=general"
+ name="rule set" xmlname="ruleSet">
+ <Constraint loader="Tree">
+ <value name="ESBResourceTree"/>
+ <value name="extensions=drl,properties"/>
+ <value name="linkAction=OpenRuleSet"/>
+ </Constraint>
+ <Editor name="TreeChooser"/>
+ </XModelAttribute>
+ <XModelAttribute PROPERTIES="category=general;pre=true;save=always"
+ name="rule language" xmlname="ruleLanguage"/>
+ <XModelAttribute PROPERTIES="pre=true;category=general"
+ default="Default(false)" name="rule reload" xmlname="ruleReload">
+ <Constraint loader="ListString">
+ <value name="Default(false)"/>
+ <value name="true"/>
+ <value name="false"/>
+ </Constraint>
+ <Editor name="ListString"/>
+ </XModelAttribute>
+ <XModelAttribute PROPERTIES="category=general" name="process" xmlname="process">
+ <Constraint loader="ListString">
+ <value name="process"/>
+ <value name="split"/>
+ </Constraint>
+ <Editor name="ListString"/>
+ </XModelAttribute>
+ <XModelAttribute TRIM="no" name="comment" visibility="false" xmlname="#comment">
+ <Editor name="Note"/>
+ </XModelAttribute>
+ </XModelAttributes>
+ <XActionItem kind="list">
+ <XActionItem
+ HandlerClassName="org.jboss.tools.esb.core.model.handlers.OpenESBResourceHandler"
+ ICON="action.empty" PROPERTIES="actionpath=Open;attribute=rule set"
+ displayName="Open Rule Set" kind="action" name="OpenRuleSet"/>
+ <XActionItem kind="list" name="CreateActions">
+ <XActionItem HandlerClassName="%Create%" ICON="action.empty"
+ PROPERTIES="validator.add=true" WizardClassName="%Default%"
+ displayName="Add Route To..." kind="action" name="AddRouteTo">
+ <EntityData EntityName="ESBPreRouteTo">
+ <AttributeData AttributeName="destination name"/>
+ <AttributeData AttributeName="service category" Mandatory="no"/>
+ <AttributeData AttributeName="service name" Mandatory="no"/>
+ </EntityData>
+ </XActionItem>
+ <XActionItem HandlerClassName="%Create%" ICON="action.empty"
+ PROPERTIES="validator.add=true" WizardClassName="%Default%"
+ displayName="Add Namespace..." kind="action" name="AddNamespace">
+ <EntityData EntityName="ESBPreRouterNamespace">
+ <AttributeData AttributeName="prefix"/>
+ <AttributeData AttributeName="uri"/>
+ </EntityData>
+ </XActionItem>
+ </XActionItem>
+ <XActionItemReference entity="ESBProperty" name="CopyActions"/>
+ <XActionItemReference entity="ESBProperty" name="DeleteActions"/>
+ <XActionItemReference entity="ESBProperty" name="Properties"/>
+ <XActionItemReference entity="ESBProperty" name="MoveActions"/>
+ </XActionItem>
+ <XDependencies/>
+ </XModelEntity>
+ <XModelEntity ImplementingClass="%ESB%"
PROPERTIES="formFactory=%Default%;formLayout=org.jboss.tools.esb.ui.editor.form.ESBXMLFormLayoutData"
XMLSUBPATH="action" name="ESBPreActionEJBProcessor120">
<XChildrenEntities>
@@ -2669,6 +2765,7 @@
name="service category" xmlname="service-category"/>
<XModelAttribute PROPERTIES="category=general;id=true;save=always"
name="service name" xmlname="service-name"/>
+ <XModelAttribute PROPERTIES="category=general" name="expression" xmlname="expression"/>
<XModelAttribute TRIM="no" name="comment" visibility="false" xmlname="#comment">
<Editor name="Note"/>
</XModelAttribute>
@@ -2698,6 +2795,50 @@
<XDependencies/>
</XModelEntity>
<XModelEntity ImplementingClass="%ESB%"
+ PROPERTIES="formFactory=%Default%;formLayout=org.jboss.tools.esb.ui.editor.form.ESBXMLFormLayoutData;converter=routernamespace"
+ XMLSUBPATH="namespace" name="ESBPreRouterNamespace">
+ <XChildrenEntities/>
+ <XEntityRenderer>
+ <ICONS>
+ <ICON info="main.esb.property" type="main"/>
+ </ICONS>
+ </XEntityRenderer>
+ <XModelAttributes>
+ <XModelAttribute default="namespace" loader="ElementType" name="element type">
+ <Editor name="Uneditable"/>
+ </XModelAttribute>
+ <XModelAttribute PROPERTIES="category=general;id=true;save=always"
+ name="prefix" xmlname="prefix"/>
+ <XModelAttribute PROPERTIES="category=general" name="uri" xmlname="uri"/>
+ <XModelAttribute TRIM="no" name="comment" visibility="false" xmlname="#comment">
+ <Editor name="Note"/>
+ </XModelAttribute>
+ </XModelAttributes>
+ <XActionItem kind="list">
+ <XActionItem kind="list" name="CreateActions"/>
+ <XActionItem ICON="action.empty" displayName="Create" kind="list" name="EditActions"/>
+ <XActionItem ICON="action.copy" displayName="Copy" kind="list" name="CopyActions">
+ <XActionItem BaseActionName="Copy" HandlerClassName="%Copy%"
+ ICON="action.copy" displayName="Copy" kind="action" name="Copy"/>
+ <XActionItem BaseActionName="Cut" HandlerClassName="%Cut%"
+ ICON="action.cut" displayName="Cut" kind="action" name="Cut"/>
+ </XActionItem>
+ <XActionItem ICON="action.delete" displayName="Delete" kind="list" name="DeleteActions">
+ <XActionItem BaseActionName="Delete" HandlerClassName="%Delete%"
+ ICON="action.delete" displayName="Delete" kind="action" name="Delete"/>
+ </XActionItem>
+ <XActionItem ICON="action.empty" kind="list" name="Properties">
+ <XActionItem HandlerClassName="%Properties%" ICON="action.empty"
+ displayName="Properties..." kind="action" name="Properties"/>
+ </XActionItem>
+ <XActionItem displayName="move" kind="list" name="MoveActions">
+ <XActionItem HIDE="always" HandlerClassName="%Move%"
+ ICON="action.move" displayName="Move" kind="action" name="Move"/>
+ </XActionItem>
+ </XActionItem>
+ <XDependencies/>
+ </XModelEntity>
+ <XModelEntity ImplementingClass="%ESB%"
PROPERTIES="formFactory=%Default%;formLayout=org.jboss.tools.esb.ui.editor.form.ESBXMLFormLayoutData"
XMLSUBPATH="target" name="ESBPreTarget">
<XChildrenEntities>
@@ -3017,7 +3158,7 @@
<XChildEntity name="ESBPreActionGroovyProcessor101"/>
<XChildEntity name="ESBPreActionEJBProcessor120"/>
<XChildEntity name="ESBPreActionAggregator101"/>
- <XChildEntity name="ESBPreActionContentBasedRouter101"/>
+ <XChildEntity name="ESBPreActionContentBasedRouter120"/>
<XChildEntity name="ESBPreActionStaticRouter101"/>
<XChildEntity name="ESBPreActionStaticWiretap101"/>
<XChildEntity name="ESBPreActionSyncServiceInvoker120"/>
@@ -3124,8 +3265,9 @@
<XActionItem HandlerClassName="%Create%" ICON="action.empty"
PROPERTIES="validator.add=true" WizardClassName="%Default%"
displayName="Content Based Router..." kind="action" name="AddContentBasedRouter">
- <EntityData EntityName="ESBPreActionContentBasedRouter101">
+ <EntityData EntityName="ESBPreActionContentBasedRouter120">
<AttributeData AttributeName="name"/>
+ <AttributeData AttributeName="cbr alias" Mandatory="no"/>
<AttributeData AttributeName="process" Mandatory="no"/>
<AttributeData AttributeName="rule set"/>
<AttributeData AttributeName="rule language" Mandatory="no"/>
Modified: trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/SpecificActionLoader.java
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/SpecificActionLoader.java 2009-11-26 17:02:14 UTC (rev 18863)
+++ trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/SpecificActionLoader.java 2009-11-26 17:57:01 UTC (rev 18864)
@@ -62,6 +62,7 @@
propertyConverters.put("implicitcollection", ConverterConstants.IMPLICIT_COLLECTION_CONVERTER);
propertyConverters.put("attributealias", ConverterConstants.ATTRIBUTE_ALIAS_CONVERTER);
propertyConverters.put("converter", ConverterConstants.CONVERTER_CONVERTER);
+ propertyConverters.put("routernamespace", ConverterConstants.ROUTER_NAMESPACES_CONVERTER);
}
public boolean isPreActionEntity(XModelObject object) {
Modified: trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/converters/ConverterConstants.java
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/converters/ConverterConstants.java 2009-11-26 17:02:14 UTC (rev 18863)
+++ trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/converters/ConverterConstants.java 2009-11-26 17:57:01 UTC (rev 18864)
@@ -45,6 +45,10 @@
String NAMESPACES = "namespaces";
IPropertyConverter NAMESPACES_CONVERTER = new BasicListConverter(NAMESPACES, NAMESPACE_ENTITY);
+ String ROUTER_NAMESPACE_ENTITY = "ESBPreRouterNamespace";
+ String ROUTER_NAMESPACES = "namespaces";
+ IPropertyConverter ROUTER_NAMESPACES_CONVERTER = new BasicListConverter(ROUTER_NAMESPACES, ROUTER_NAMESPACE_ENTITY);
+
String FIELD_ALIAS_ENTITY = "ESBPreFieldAlias";
String FIELD_ALIASES = "fieldAliases";
IPropertyConverter FIELD_ALIAS_CONVERTER = new BasicListConverter(FIELD_ALIASES, FIELD_ALIAS_ENTITY);
15 years, 1 month