JBoss Tools SVN: r15517 - in trunk/vpe: plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: yradtsevich
Date: 2009-05-26 12:37:03 -0400 (Tue, 26 May 2009)
New Revision: 15517
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaPreview.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/DocTypeUtil.java
trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/components/other/xmp.xhtml.xml
trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/components/text/pre.html.xml
Log:
issue JBIDE-4345: 3 tests fail in HtmlAllTests (testJBIDE3280, testPre, testXmp)
https://jira.jboss.org/jira/browse/JBIDE-4345
- calls to xulRunnerBroswer.setText(initialHtmlCode) are replaced by calls to setURL(pathToTemporaryInitialHtmlFile)
- JUnit tests are reverted to the initial state with the <BR/> tags
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java 2009-05-26 16:14:07 UTC (rev 15516)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java 2009-05-26 16:37:03 UTC (rev 15517)
@@ -11,6 +11,9 @@
package org.jboss.tools.vpe.editor.mozilla;
import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.Writer;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
@@ -91,7 +94,7 @@
import org.mozilla.interfaces.nsIPlaintextEditor;
public class MozillaEditor extends EditorPart implements IReusableEditor {
- protected static final String INIT_URL = /*"file://" +*/ (new File(VpePlugin.getDefault().getResourcePath("ve"), "init.html")).getAbsolutePath(); //$NON-NLS-1$ //$NON-NLS-2$
+ protected static final File INIT_FILE = new File(VpePlugin.getDefault().getResourcePath("ve"), "init.html"); //$NON-NLS-1$ //$NON-NLS-2$
public static final String CONTENT_AREA_ID = "__content__area__"; //$NON-NLS-1$
/*
@@ -445,9 +448,7 @@
});
- doctype = DocTypeUtil.getDoctype(getEditorInput());
- xulRunnerEditor.setText(doctype
- + DocTypeUtil.getContentInitFile(new File(INIT_URL)));
+ setInitialContent();
// Wait while visual part is loaded
//commented by mareshkau, fix for jbide-3032
// while (!loaded) {
@@ -474,6 +475,49 @@
}
/**
+ * Sets initial content to the {@link xulRunnerEditor}.
+ *
+ * @see #INIT_FILE
+ */
+ protected void setInitialContent() {
+ final String html = DocTypeUtil.prepareInitFile(
+ INIT_FILE, getEditorInput());
+
+ // Workaround of JBIDE-4345.
+ // Due to a bug in org.eclipse.swt.browser.Mozilla we cannot simply
+ // set initial html code as xulRunnerEditor.setText(html).
+ // Instead of it we create a temporary file containing
+ // the html code and set it to the Mozilla browser as URL.
+ File tmp = null;
+ Writer out = null;
+ try {
+ tmp = File.createTempFile(
+ "temp", ".html"); //$NON-NLS-1$//$NON-NLS-2$
+ tmp.deleteOnExit();
+ out = new FileWriter(tmp);
+ out.write(html);
+ } catch (IOException e) {
+ VpePlugin.getPluginLog().logError(e);
+ } finally {
+ try {
+ if (out != null) {
+ out.close();
+ if (tmp != null) {
+ xulRunnerEditor.setURL("file://" //$NON-NLS-1$
+ + tmp.getCanonicalPath());
+ }
+ }
+ } catch (IOException e) {
+ VpePlugin.getPluginLog().logError(e);
+ } finally {
+ if (tmp != null) {
+ tmp.delete();
+ }
+ }
+ }
+ }
+
+ /**
* Logs given {@code exception} and shows error message in
* the {@code parent} composite.
*/
@@ -851,8 +895,7 @@
doctype = DocTypeUtil.getDoctype(getEditorInput());
//coused page to be refreshed
setRefreshPage(true);
- xulRunnerEditor.setText(doctype
- + DocTypeUtil.getContentInitFile(new File(INIT_URL)));
+ setInitialContent();
}
/**
* Initialized design mode in visual refresh
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaPreview.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaPreview.java 2009-05-26 16:14:07 UTC (rev 15516)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaPreview.java 2009-05-26 16:37:03 UTC (rev 15517)
@@ -24,7 +24,6 @@
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.mapping.VpeDomMapping;
import org.jboss.tools.vpe.editor.template.VpeTemplateManager;
-import org.jboss.tools.vpe.editor.util.DocTypeUtil;
import org.jboss.tools.vpe.xulrunner.XulRunnerException;
import org.jboss.tools.vpe.xulrunner.editor.XulRunnerEditor;
@@ -78,9 +77,7 @@
super.onDispose();
}
});
-// getXulRunnerEditor().setURL(INIT_URL);
- getXulRunnerEditor().setText(DocTypeUtil.prepareInitFile(INIT_URL,
- getEditorInput()));
+ setInitialContent();
getXulRunnerEditor().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
} catch (XulRunnerException e) {
showXulRunnerException(parent, e);
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/DocTypeUtil.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/DocTypeUtil.java 2009-05-26 16:14:07 UTC (rev 15516)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/DocTypeUtil.java 2009-05-26 16:37:03 UTC (rev 15517)
@@ -303,12 +303,9 @@
* @param editorInput
* @return
*/
- public static String prepareInitFile(String initFilePath,
+ public static String prepareInitFile(File initFile,
IEditorInput editorInput) {
-
- return getDoctype(editorInput)
- + getContentInitFile(new File(initFilePath));
-
+ return getDoctype(editorInput) + getContentInitFile(initFile);
}
/**
Modified: trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/components/other/xmp.xhtml.xml
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/components/other/xmp.xhtml.xml 2009-05-26 16:14:07 UTC (rev 15516)
+++ trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/components/other/xmp.xhtml.xml 2009-05-26 16:37:03 UTC (rev 15517)
@@ -1,27 +1,48 @@
<tests>
<test id="xmp">
<XMP ID="xmp" STYLE="-moz-user-modify: read-only;" >
-<SPAN>
-while (<>) {
- $org=$_;
- s/\\["']//g;
- s/\/\/[^:].*//;
- s/\/\*.*\*\///g;
- if ($comment == 1) {
- if (s/.*\*\///) {
- $comment = 0;
- }
- else {
- next;
- }
- }
- if (s/\/\*.*//) {
- $comment = 1;
- }
- if (/^\s*#/) {
- next;
- }
- }
+<SPAN><BR _MOZ_DIRTY=""/>
+
+while (<>) {<BR _MOZ_DIRTY=""/>
+
+$org=$_;<BR _MOZ_DIRTY=""/>
+
+s/\\["']//g;<BR _MOZ_DIRTY=""/>
+
+s/\/\/[^:].*//;<BR _MOZ_DIRTY=""/>
+
+s/\/\*.*\*\///g;<BR _MOZ_DIRTY=""/>
+
+if ($comment == 1) {<BR _MOZ_DIRTY=""/>
+
+if (s/.*\*\///) {<BR _MOZ_DIRTY=""/>
+
+$comment = 0;<BR _MOZ_DIRTY=""/>
+
+}<BR _MOZ_DIRTY=""/>
+
+else {<BR _MOZ_DIRTY=""/>
+
+next;<BR _MOZ_DIRTY=""/>
+
+}<BR _MOZ_DIRTY=""/>
+
+}<BR _MOZ_DIRTY=""/>
+
+if (s/\/\*.*//) {<BR _MOZ_DIRTY=""/>
+
+$comment = 1;<BR _MOZ_DIRTY=""/>
+
+}<BR _MOZ_DIRTY=""/>
+
+if (/^\s*#/) {<BR _MOZ_DIRTY=""/>
+
+next;<BR _MOZ_DIRTY=""/>
+
+}<BR _MOZ_DIRTY=""/>
+
+}<BR _MOZ_DIRTY=""/>
+
</SPAN>
</XMP>
</test>
Modified: trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/components/text/pre.html.xml
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/components/text/pre.html.xml 2009-05-26 16:14:07 UTC (rev 15516)
+++ trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/components/text/pre.html.xml 2009-05-26 16:37:03 UTC (rev 15517)
@@ -2,10 +2,16 @@
<test id="pre">
<PRE WIDTH="30" ID="pre" CLASS="preClass"
STYLE="color: red; -moz-user-modify: read-write;">
-<SPAN CLASS="vpe-text">
-string 1
- string 2
-</SPAN>
+ <SPAN CLASS="vpe-text">
+ <BR _MOZ_DIRTY="" />
+
+ string 1
+ <BR _MOZ_DIRTY="" />
+
+ string 2
+ <BR _MOZ_DIRTY="" />
+
+ </SPAN>
</PRE>
</test>
</tests>
\ No newline at end of file
14 years, 11 months
JBoss Tools SVN: r15516 - 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-05-26 12:14:07 -0400 (Tue, 26 May 2009)
New Revision: 15516
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/META-INF/MANIFEST.MF
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2808
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/META-INF/MANIFEST.MF 2009-05-26 16:10:23 UTC (rev 15515)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/META-INF/MANIFEST.MF 2009-05-26 16:14:07 UTC (rev 15516)
@@ -59,7 +59,9 @@
org.eclipse.jst.jsf.core,
org.eclipse.ltk.core.refactoring;bundle-version="3.4.0",
org.eclipse.ltk.ui.refactoring;bundle-version="3.4.0",
- org.jboss.ide.eclipse.as.core;bundle-version="1.0.0"
+ org.jboss.ide.eclipse.as.core;bundle-version="1.0.0",
+ org.jboss.tools.jst.web.kb;bundle-version="1.0.0",
+ org.jboss.tools.jsf;bundle-version="2.0.0"
Eclipse-LazyStart: true
Export-Package: org.jboss.tools.seam.ui,
org.jboss.tools.seam.ui.actions,
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java 2009-05-26 16:10:23 UTC (rev 15515)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java 2009-05-26 16:14:07 UTC (rev 15516)
@@ -57,6 +57,8 @@
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.jsf.project.JSFNature;
+import org.jboss.tools.jst.web.kb.IKbProject;
import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.SeamProjectsSet;
@@ -947,8 +949,10 @@
private void removeSeamSupport() {
try {
- EclipseResourceUtil.removeNatureFromProject(project,
- ISeamProject.NATURE_ID);
+ EclipseResourceUtil.removeNatureFromProject(project, ISeamProject.NATURE_ID);
+ if(!project.hasNature(JSFNature.NATURE_ID)) {
+ EclipseResourceUtil.addNatureToProject(project, IKbProject.NATURE_ID);
+ }
} catch (CoreException e) {
SeamGuiPlugin.getPluginLog().logError(e);
}
@@ -960,6 +964,9 @@
}
try {
EclipseResourceUtil.addNatureToProject(project, ISeamProject.NATURE_ID);
+ if(!project.hasNature(IKbProject.NATURE_ID)) {
+ EclipseResourceUtil.addNatureToProject(project, IKbProject.NATURE_ID);
+ }
} catch (CoreException e) {
SeamGuiPlugin.getPluginLog().logError(e);
}
14 years, 11 months
JBoss Tools SVN: r15515 - in trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console: utils and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2009-05-26 12:10:23 -0400 (Tue, 26 May 2009)
New Revision: 15515
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenMappingAction.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/OpenMappingUtils.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/ProjectUtils.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4364 - "Open Mapping File" should work when there is no project associated with a console configuration
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenMappingAction.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenMappingAction.java 2009-05-26 14:29:18 UTC (rev 15514)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/actions/OpenMappingAction.java 2009-05-26 16:10:23 UTC (rev 15515)
@@ -62,9 +62,9 @@
TreePath[] paths = ((TreeSelection)sel).getPaths();
for (int i = 0; i < paths.length; i++) {
TreePath path = paths[i];
- ConsoleConfiguration consoleConfiguration = (ConsoleConfiguration)(path.getSegment(0));
+ ConsoleConfiguration consoleConfig = (ConsoleConfiguration)(path.getSegment(0));
try {
- run(path, consoleConfiguration);
+ run(path, consoleConfig);
} catch (JavaModelException e) {
HibernateConsolePlugin.getDefault().logErrorMessage(HibernateConsoleMessages.OpenMappingAction_cannot_find_mapping_file, e);
} catch (PartInitException e) {
@@ -77,13 +77,13 @@
/**
* @param path
- * @param consoleConfiguration
+ * @param consoleConfig
* @return
* @throws PartInitException
* @throws JavaModelException
* @throws FileNotFoundException
*/
- public static IEditorPart run(TreePath path, ConsoleConfiguration consoleConfiguration) throws PartInitException, JavaModelException, FileNotFoundException {
+ public static IEditorPart run(TreePath path, ConsoleConfiguration consoleConfig) throws PartInitException, JavaModelException, FileNotFoundException {
boolean isPropertySel = (path.getLastSegment().getClass() == Property.class);
if (isPropertySel) {
Property propertySel = (Property)path.getLastSegment();
@@ -92,39 +92,38 @@
|| (RootClass.class.isAssignableFrom(persClass.getClass())
&& persClass.getClass() != RootClass.class)) {
Property parentProp = (Property)path.getParentPath().getLastSegment();
- return run(propertySel, parentProp, consoleConfiguration);
+ return run(propertySel, parentProp, consoleConfig);
}
}
- return run(path.getLastSegment(), consoleConfiguration);
+ return run(path.getLastSegment(), consoleConfig);
}
/**
* @param selection
- * @param consoleConfiguration
+ * @param consoleConfig
* @throws JavaModelException
* @throws PartInitException
* @throws PresistanceClassNotFoundException
* @throws FileNotFoundException
*/
- public static IEditorPart run(Object selection, ConsoleConfiguration consoleConfiguration) throws PartInitException, JavaModelException, FileNotFoundException {
+ public static IEditorPart run(Object selection, ConsoleConfiguration consoleConfig) throws PartInitException, JavaModelException, FileNotFoundException {
IEditorPart editorPart = null;
- IJavaProject proj = ProjectUtils.findJavaProject(consoleConfiguration);
IFile file = null;
if (selection instanceof Property) {
Property p = (Property)selection;
if (p.getPersistentClass() != null) {
//use PersistentClass to open editor
- file = OpenMappingUtils.searchFileToOpen(consoleConfiguration, proj, p.getPersistentClass());
- //editorPart = openMapping(p.getPersistentClass(), consoleConfiguration);
+ file = OpenMappingUtils.searchFileToOpen(consoleConfig, p.getPersistentClass());
+ //editorPart = openMapping(p.getPersistentClass(), consoleConfig);
}
}
else {
- file = OpenMappingUtils.searchFileToOpen(consoleConfiguration, proj, selection);
- //editorPart = openMapping(selection, consoleConfiguration);
+ file = OpenMappingUtils.searchFileToOpen(consoleConfig, selection);
+ //editorPart = openMapping(selection, consoleConfig);
}
if (file != null) {
editorPart = OpenMappingUtils.openFileInEditor(file);
- updateEditorSelection(proj, editorPart, selection);
+ updateEditorSelection(editorPart, selection);
}
if (editorPart == null) {
//try to find hibernate-annotations
@@ -139,8 +138,10 @@
}
}
if (rootClass != null){
- if (OpenMappingUtils.hasConfigXMLMappingClassAnnotation(consoleConfiguration, rootClass)) {
+ if (OpenMappingUtils.hasConfigXMLMappingClassAnnotation(consoleConfig, rootClass)) {
String fullyQualifiedName = rootClass.getClassName();
+ // TODO: get rid of this - JBIDE-4363
+ IJavaProject proj = ProjectUtils.findJavaProject(consoleConfig);
editorPart = OpenSourceAction.run(selection, proj, fullyQualifiedName);
}
}
@@ -155,24 +156,25 @@
/**
* @param compositeProperty
* @param parentProperty
- * @param consoleConfiguration
+ * @param consoleConfig
* @throws JavaModelException
* @throws PartInitException
* @throws FileNotFoundException
* @throws BadLocationException
*/
- public static IEditorPart run(Property compositeProperty, Property parentProperty, ConsoleConfiguration consoleConfiguration) throws PartInitException, JavaModelException, FileNotFoundException{
+ public static IEditorPart run(Property compositeProperty, Property parentProperty, ConsoleConfiguration consoleConfig) throws PartInitException, JavaModelException, FileNotFoundException{
PersistentClass rootClass = parentProperty.getPersistentClass();
- IJavaProject proj = ProjectUtils.findJavaProject(consoleConfiguration);
- IFile file = OpenMappingUtils.searchFileToOpen(consoleConfiguration, proj, rootClass);
+ IFile file = OpenMappingUtils.searchFileToOpen(consoleConfig, rootClass);
IEditorPart editorPart = null;
if (file != null){
editorPart = OpenMappingUtils.openFileInEditor(file);
- updateEditorSelection(proj, editorPart, compositeProperty, parentProperty);
+ updateEditorSelection(editorPart, compositeProperty, parentProperty);
}
if (editorPart == null && parentProperty.isComposite()) {
- if (OpenMappingUtils.hasConfigXMLMappingClassAnnotation(consoleConfiguration, rootClass)) {
+ if (OpenMappingUtils.hasConfigXMLMappingClassAnnotation(consoleConfig, rootClass)) {
String fullyQualifiedName =((Component)parentProperty.getValue()).getComponentClassName();
+ // TODO: get rid of this - JBIDE-4363
+ IJavaProject proj = ProjectUtils.findJavaProject(consoleConfig);
editorPart = OpenSourceAction.run(compositeProperty, proj, fullyQualifiedName);
}
}
@@ -187,7 +189,7 @@
* @param editorPart
* @param selection
*/
- public static boolean updateEditorSelection(IJavaProject proj, IEditorPart editorPart, Object selection) {
+ public static boolean updateEditorSelection(IEditorPart editorPart, Object selection) {
ITextEditor[] textEditors = OpenMappingUtils.getTextEditors(editorPart);
if (textEditors.length == 0) {
return false;
@@ -202,6 +204,7 @@
if (findAdapter == null) {
return false;
}
+ IJavaProject proj = ProjectUtils.findJavaProject(editorPart);
IRegion selectRegion = OpenMappingUtils.findSelectRegion(proj, findAdapter, selection);
if (selectRegion != null) {
textEditor.selectAndReveal(selectRegion.getOffset(), selectRegion.getLength());
@@ -215,7 +218,7 @@
* @param compositeProperty
* @param parentProperty
*/
- public static boolean updateEditorSelection(IJavaProject proj, IEditorPart editorPart, Property compositeProperty, Property parentProperty) {
+ public static boolean updateEditorSelection(IEditorPart editorPart, Property compositeProperty, Property parentProperty) {
ITextEditor[] textEditors = OpenMappingUtils.getTextEditors(editorPart);
if (textEditors.length == 0) {
return false;
@@ -230,6 +233,7 @@
if (findAdapter == null) {
return false;
}
+ IJavaProject proj = ProjectUtils.findJavaProject(editorPart);
IRegion parentRegion = OpenMappingUtils.findSelectRegion(proj, findAdapter, parentProperty);
if (parentRegion == null) {
return false;
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/OpenMappingUtils.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/OpenMappingUtils.java 2009-05-26 14:29:18 UTC (rev 15514)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/OpenMappingUtils.java 2009-05-26 16:10:23 UTC (rev 15515)
@@ -29,19 +29,10 @@
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.dom.AST;
-import org.eclipse.jdt.core.dom.ASTParser;
-import org.eclipse.jdt.core.dom.ITypeBinding;
-import org.eclipse.jdt.core.dom.Type;
-import org.eclipse.jdt.core.dom.TypeDeclaration;
-import org.eclipse.jdt.internal.core.JarPackageFragmentRoot;
import org.eclipse.jdt.internal.core.PackageFragmentRoot;
-import org.eclipse.jdt.internal.core.SourceType;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.FindReplaceDocumentAdapter;
import org.eclipse.jface.text.IDocument;
@@ -83,6 +74,7 @@
* @author Dmitry Geraskov
* @author Vitali Yemialyanchyk
*/
+@SuppressWarnings("restriction")
public class OpenMappingUtils {
public static final String HIBERNATE_TAG_CLASS = "class"; //$NON-NLS-1$
@@ -137,36 +129,36 @@
}
/**
- * Check has consoleConfiguration config.xml file a mapping class for provided rootClass.
- * @param consoleConfiguration
+ * Check has consoleConfig config.xml file a mapping class for provided rootClass.
+ * @param consoleConfig
* @param rootClass
* @return
*/
- public static boolean hasConfigXMLMappingClassAnnotation(ConsoleConfiguration consoleConfiguration, PersistentClass rootClass) {
- java.io.File configXMLFile = consoleConfiguration.getPreferences().getConfigXMLFile();
+ public static boolean hasConfigXMLMappingClassAnnotation(ConsoleConfiguration consoleConfig, PersistentClass rootClass) {
+ java.io.File configXMLFile = consoleConfig.getPreferences().getConfigXMLFile();
if (configXMLFile == null) {
return true;
}
- EntityResolver entityResolver = consoleConfiguration.getConfiguration().getEntityResolver();
+ EntityResolver entityResolver = consoleConfig.getConfiguration().getEntityResolver();
Document doc = getDocument(configXMLFile, entityResolver);
return getElements(doc, HIBERNATE_TAG_MAPPING, HIBERNATE_TAG_CLASS, getPersistentClassName(rootClass)).hasNext();
}
/**
* Check has this particular element correspondence in the file.
- * @param consoleConfiguration
+ * @param consoleConfig
* @param file
* @param element
* @return
*/
- public static boolean elementInFile(ConsoleConfiguration consoleConfiguration, IFile file, Object element) {
+ public static boolean elementInFile(ConsoleConfiguration consoleConfig, IFile file, Object element) {
boolean res = false;
if (element instanceof RootClass) {
- res = rootClassInFile(consoleConfiguration, file, (RootClass)element);
+ res = rootClassInFile(consoleConfig, file, (RootClass)element);
} else if (element instanceof Subclass) {
- res = subclassInFile(consoleConfiguration, file, (Subclass)element);
+ res = subclassInFile(consoleConfig, file, (Subclass)element);
} else if (element instanceof Table) {
- res = tableInFile(consoleConfiguration, file, (Table)element);
+ res = tableInFile(consoleConfig, file, (Table)element);
}
return res;
}
@@ -180,13 +172,13 @@
/**
* Check has this particular rootClass correspondence in the file.
- * @param consoleConfiguration
+ * @param consoleConfig
* @param file
* @param rootClass
* @return
*/
- public static boolean rootClassInFile(ConsoleConfiguration consoleConfiguration, IFile file, RootClass rootClass) {
- EntityResolver entityResolver = consoleConfiguration.getConfiguration().getEntityResolver();
+ public static boolean rootClassInFile(ConsoleConfiguration consoleConfig, IFile file, RootClass rootClass) {
+ EntityResolver entityResolver = consoleConfig.getConfiguration().getEntityResolver();
Document doc = getDocument(file.getLocation().toFile(), entityResolver);
final String clName = getPersistentClassName(rootClass);
final String clNameUnq = StringHelper.unqualify(clName);
@@ -214,13 +206,13 @@
/**
* Check has this particular subclass correspondence in the file.
- * @param consoleConfiguration
+ * @param consoleConfig
* @param file
* @param subclass
* @return
*/
- public static boolean subclassInFile(ConsoleConfiguration consoleConfiguration, IFile file, Subclass subclass) {
- EntityResolver entityResolver = consoleConfiguration.getConfiguration().getEntityResolver();
+ public static boolean subclassInFile(ConsoleConfiguration consoleConfig, IFile file, Subclass subclass) {
+ EntityResolver entityResolver = consoleConfig.getConfiguration().getEntityResolver();
Document doc = getDocument(file.getLocation().toFile(), entityResolver);
final String clName = getPersistentClassName(subclass);
final String clNameUnq = StringHelper.unqualify(clName);
@@ -237,13 +229,13 @@
/**
* Check has this particular table correspondence in the file.
- * @param consoleConfiguration
+ * @param consoleConfig
* @param file
* @param table
* @return
*/
- public static boolean tableInFile(ConsoleConfiguration consoleConfiguration, IFile file, Table table) {
- EntityResolver entityResolver = consoleConfiguration.getConfiguration().getEntityResolver();
+ public static boolean tableInFile(ConsoleConfiguration consoleConfig, IFile file, Table table) {
+ EntityResolver entityResolver = consoleConfig.getConfiguration().getEntityResolver();
Document doc = getDocument(file.getLocation().toFile(), entityResolver);
Iterator<Element> classes = getElements(doc, HIBERNATE_TAG_CLASS);
boolean res = false;
@@ -272,7 +264,7 @@
classNameAttr = element.attribute(HIBERNATE_TAG_ENTITY_NAME);
}
if (classNameAttr != null) {
- String physicalTableName = consoleConfiguration.getConfiguration().getNamingStrategy().classToTableName(classNameAttr.getValue());
+ String physicalTableName = consoleConfig.getConfiguration().getNamingStrategy().classToTableName(classNameAttr.getValue());
if (table.getName().equals(physicalTableName)) {
res = true;
break;
@@ -386,57 +378,74 @@
}
return doc;
}
+
+ public static PackageFragmentRoot[] getCCPackageFragmentRoots(ConsoleConfiguration consoleConfiguration) {
+ IJavaProject[] projs = ProjectUtils.findJavaProjects(consoleConfiguration);
+ ArrayList<PackageFragmentRoot> res = new ArrayList<PackageFragmentRoot>();
+ try {
+ for (int i = 0; i < projs.length; i++) {
+ IPackageFragmentRoot[] pfrs = projs[i].getAllPackageFragmentRoots();
+ for (int j = 0; j < pfrs.length; j++) {
+ if (pfrs[j].getClass() != PackageFragmentRoot.class) {
+ continue;
+ }
+ res.add((PackageFragmentRoot)pfrs[j]);
+ }
+ }
+ } catch (JavaModelException e) {
+ HibernateConsolePlugin.getDefault().logErrorMessage(HibernateConsoleMessages.OpenFileActionUtils_problems_while_get_project_package_fragment_roots, e);
+ }
+ return res.toArray(new PackageFragmentRoot[0]);
+ }
/**
* Trying to find hibernate console config mapping file,
* which is corresponding to provided element.
*
- * @param consoleConfiguration
- * @param proj
+ * @param consoleConfig
* @param element
* @return
*/
@SuppressWarnings("unchecked")
- public static IFile searchInMappingFiles(ConsoleConfiguration consoleConfiguration, IJavaProject proj, Object element) {
+ public static IFile searchInMappingFiles(ConsoleConfiguration consoleConfig, Object element) {
IFile file = null;
- if (consoleConfiguration == null) {
+ if (consoleConfig == null) {
return file;
}
- java.io.File configXMLFile = consoleConfiguration.getPreferences().getConfigXMLFile();
- EntityResolver entityResolver = consoleConfiguration.getConfiguration().getEntityResolver();
+ java.io.File configXMLFile = consoleConfig.getPreferences().getConfigXMLFile();
+ EntityResolver entityResolver = consoleConfig.getConfiguration().getEntityResolver();
Document doc = getDocument(configXMLFile, entityResolver);
if (doc == null) {
return file;
}
- IPackageFragmentRoot[] packageFragmentRoots = new IPackageFragmentRoot[0];
- try {
- if (proj != null) {
- packageFragmentRoots = proj.getAllPackageFragmentRoots();
- }
- } catch (JavaModelException e) {
- HibernateConsolePlugin.getDefault().logErrorMessage(HibernateConsoleMessages.OpenFileActionUtils_problems_while_get_project_package_fragment_roots, e);
+ //
+ PackageFragmentRoot[] packageFragments = getCCPackageFragmentRoots(consoleConfig);
+ //
+ ArrayList<IPath> paths = new ArrayList<IPath>();
+ for (int i = 0; i < packageFragments.length; i++) {
+ paths.add(packageFragments[i].getPath());
}
- Element sfNode = doc.getRootElement().element(HIBERNATE_TAG_SESSION_FACTORY);
- Iterator<Element> elements = sfNode.elements(HIBERNATE_TAG_MAPPING).iterator();
- while (elements.hasNext() && file == null) {
- Element subelement = elements.next();
- Attribute resourceAttr = subelement.attribute(HIBERNATE_TAG_RESOURCE);
- if (resourceAttr == null) {
- continue;
- }
- for (int i = 0; i < packageFragmentRoots.length; i++) {
- //search in source folders.
- if (packageFragmentRoots[i].getClass() != PackageFragmentRoot.class) {
+ // last chance to find file is the same place as configXMLFile
+ paths.add(Path.fromOSString(configXMLFile.getParent()));
+ //
+ for (int i = 0; i < paths.size() && file == null; i++) {
+ Element sfNode = doc.getRootElement().element(HIBERNATE_TAG_SESSION_FACTORY);
+ Iterator<Element> elements = sfNode.elements(HIBERNATE_TAG_MAPPING).iterator();
+ while (elements.hasNext() && file == null) {
+ Element subelement = elements.next();
+ Attribute resourceAttr = subelement.attribute(HIBERNATE_TAG_RESOURCE);
+ if (resourceAttr == null) {
continue;
}
- IPackageFragmentRoot packageFragmentRoot = packageFragmentRoots[i];
- IPath path = packageFragmentRoot.getPath().append(resourceAttr.getValue());
+ IPath path = paths.get(i).append(resourceAttr.getValue());
file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
- if (file == null) {
- continue;
+ if (file == null || !file.exists()) {
+ file = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(path);
}
- if (file.exists() && elementInFile(consoleConfiguration, file, element)) {
- break;
+ if (file != null && file.exists()) {
+ if (elementInFile(consoleConfig, file, element)) {
+ break;
+ }
}
file = null;
}
@@ -448,16 +457,16 @@
* Trying to find console configuration additional mapping file,
* which is corresponding to provided element.
*
- * @param consoleConfiguration
+ * @param consoleConfig
* @param element
* @return
*/
- public static IFile searchInAdditionalMappingFiles(ConsoleConfiguration consoleConfiguration, Object element) {
+ public static IFile searchInAdditionalMappingFiles(ConsoleConfiguration consoleConfig, Object element) {
IFile file = null;
- if (consoleConfiguration == null) {
+ if (consoleConfig == null) {
return file;
}
- java.io.File[] files = consoleConfiguration.getPreferences().getMappingFiles();
+ java.io.File[] files = consoleConfig.getPreferences().getMappingFiles();
for (int i = 0; i < files.length; i++) {
java.io.File fileTmp = files[i];
if (fileTmp == null) {
@@ -467,7 +476,7 @@
if (file == null) {
continue;
}
- if (file.exists() && elementInFile(consoleConfiguration, file, element)) {
+ if (file.exists() && elementInFile(consoleConfig, file, element)) {
break;
}
file = null;
@@ -479,58 +488,68 @@
* Trying to find hibernate console config ejb3 mapping file,
* which is corresponding to provided element.
*
- * @param consoleConfiguration
- * @param proj
+ * @param consoleConfig
* @param element
* @return
*/
- public static IFile searchInEjb3MappingFiles(ConsoleConfiguration consoleConfiguration, IJavaProject proj, Object element) {
+ @SuppressWarnings("unchecked")
+ public static IFile searchInEjb3MappingFiles(ConsoleConfiguration consoleConfig, Object element) {
IFile file = null;
- if (consoleConfiguration == null || proj == null) {
+ if (consoleConfig == null) {
return file;
}
- final ConsoleConfiguration cc2 = consoleConfiguration;
- List<String> documentPaths = (List<String>)consoleConfiguration.getExecutionContext().execute(new ExecutionContext.Command() {
+ final ConsoleConfiguration cc2 = consoleConfig;
+ List<String> documentPaths = (List<String>)consoleConfig.getExecutionContext().execute(new ExecutionContext.Command() {
public Object execute() {
return OpenMappingUtilsEjb3.enumDocuments(cc2);
}
});
- IPath projPath = proj.getPath();
- IPath projFullPath = proj.getResource().getLocation();
- IPath outPath = Path.EMPTY;
- IPackageFragmentRoot[] packageFragmentRoots = new IPackageFragmentRoot[0];
+ IJavaProject[] projs = ProjectUtils.findJavaProjects(consoleConfig);
+ ArrayList<IPath> pathsSrc = new ArrayList<IPath>();
+ ArrayList<IPath> pathsOut = new ArrayList<IPath>();
+ ArrayList<IPath> pathsFull = new ArrayList<IPath>();
try {
- outPath = proj.getOutputLocation();
- packageFragmentRoots = proj.getPackageFragmentRoots();
+ for (int i = 0; i < projs.length; i++) {
+ IJavaProject proj = projs[i];
+ IPath projPath = proj.getPath();
+ IPath projPathFull = proj.getResource().getLocation();
+ IPath projPathOut = proj.getOutputLocation();
+ projPathOut = projPathOut.makeRelativeTo(projPath);
+ IPackageFragmentRoot[] pfrs = proj.getAllPackageFragmentRoots();
+ for (int j = 0; j < pfrs.length; j++) {
+ // TODO: think about possibility to open resources from jar files
+ if (pfrs[j].getClass() != PackageFragmentRoot.class) {
+ continue;
+ }
+ pathsSrc.add(((PackageFragmentRoot)pfrs[j]).getPath());
+ pathsOut.add(projPathOut);
+ pathsFull.add(projPathFull);
+ }
+ }
} catch (JavaModelException e) {
HibernateConsolePlugin.getDefault().logErrorMessage(HibernateConsoleMessages.OpenFileActionUtils_problems_while_get_project_package_fragment_roots, e);
}
- outPath = outPath.makeRelativeTo(projPath);
- for (int i = 0; i < packageFragmentRoots.length && file == null; i++) {
- if (!(packageFragmentRoots[i] instanceof PackageFragmentRoot)) {
- continue;
- }
- if (packageFragmentRoots[i] instanceof JarPackageFragmentRoot) {
- // TODO: add possibility open resorces from jar files
- continue;
- }
- PackageFragmentRoot packageFragmentRoot = (PackageFragmentRoot)packageFragmentRoots[i];
- IPath packageFragmentRootPath = packageFragmentRoot.getResource().getFullPath();
+ int scanSize = Math.min(pathsSrc.size(), pathsOut.size());
+ scanSize = Math.min(pathsFull.size(), scanSize);
+ for (int i = 0; i < scanSize && file == null; i++) {
+ IPath pathSrc = pathsSrc.get(i);
+ IPath pathOut = pathsOut.get(i);
+ IPath pathFull = pathsFull.get(i);
Iterator<String> it = documentPaths.iterator();
- while (it.hasNext()) {
+ while (it.hasNext() && file == null) {
String docPath = it.next();
IPath path2DocFull = Path.fromOSString(docPath);
- IPath path2Doc = path2DocFull.makeRelativeTo(projFullPath);
- IPath resPath = projPath.append(path2Doc);
- resPath = resPath.makeRelativeTo(projPath);
- resPath = resPath.makeRelativeTo(outPath);
- resPath = packageFragmentRootPath.append(resPath);
+ IPath resPath = path2DocFull.makeRelativeTo(pathFull);
+ resPath = resPath.makeRelativeTo(pathOut);
+ resPath = pathSrc.append(resPath);
file = ResourcesPlugin.getWorkspace().getRoot().getFile(resPath);
- if (file == null) {
- continue;
+ if (file == null || !file.exists()) {
+ file = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(resPath);
}
- if (file.exists() && elementInFile(consoleConfiguration, file, element)) {
- break;
+ if (file != null && file.exists()) {
+ if (elementInFile(consoleConfig, file, element)) {
+ break;
+ }
}
file = null;
}
@@ -542,18 +561,17 @@
* This function is trying to find hibernate console config file,
* which is corresponding to provided element.
*
- * @param consoleConfiguration
- * @param proj
+ * @param consoleConfig
* @param element
* @return
*/
- public static IFile searchFileToOpen(ConsoleConfiguration consoleConfiguration, IJavaProject proj, Object element) {
- IFile file = searchInMappingFiles(consoleConfiguration, proj, element);
+ public static IFile searchFileToOpen(ConsoleConfiguration consoleConfig, Object element) {
+ IFile file = searchInMappingFiles(consoleConfig, element);
if (file == null) {
- file = searchInAdditionalMappingFiles(consoleConfiguration, element);
+ file = searchInAdditionalMappingFiles(consoleConfig, element);
}
if (file == null) {
- file = searchInEjb3MappingFiles(consoleConfiguration, proj, element);
+ file = searchInEjb3MappingFiles(consoleConfig, element);
}
return file;
}
@@ -589,6 +607,7 @@
/**
* Finds a document region, which corresponds of given selection object.
+ * @param proj
* @param findAdapter
* @param selection
* @return a proper document region
@@ -605,6 +624,7 @@
/**
* Finds a document region, which corresponds of given property.
+ * @param proj
* @param findAdapter
* @param property
* @return a proper document region
@@ -670,6 +690,7 @@
/**
* Finds a document region, which corresponds of given persistent class.
+ * @param proj
* @param findAdapter
* @param persistentClass
* @return a proper document region
@@ -695,6 +716,7 @@
/**
* Finds a document region, which corresponds of given persistent class.
+ * @param proj
* @param findAdapter
* @param className
* @return a proper document region
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/ProjectUtils.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/ProjectUtils.java 2009-05-26 14:29:18 UTC (rev 15514)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/utils/ProjectUtils.java 2009-05-26 16:10:23 UTC (rev 15515)
@@ -21,18 +21,27 @@
*/
package org.hibernate.eclipse.console.utils;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
+import org.eclipse.core.internal.resources.File;
+import org.eclipse.core.internal.resources.ICoreConstants;
+import org.eclipse.core.internal.resources.ResourceInfo;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ProjectScope;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
@@ -53,6 +62,7 @@
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IFileEditorInput;
import org.hibernate.console.ConsoleConfiguration;
+import org.hibernate.console.preferences.ConsoleConfigurationPreferences;
import org.hibernate.eclipse.console.HibernateConsoleMessages;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.eclipse.launch.ICodeGenerationLaunchConstants;
@@ -61,6 +71,7 @@
import org.osgi.service.prefs.BackingStoreException;
import org.osgi.service.prefs.Preferences;
+@SuppressWarnings("restriction")
public class ProjectUtils {
private ProjectUtils() {
@@ -169,41 +180,148 @@
return null;
}
- static public IJavaProject findJavaProject(String name) {
- if(StringHelper.isEmpty( name )) {
+
+ /**
+ * Returns a handle to the project resource with the given name
+ * which is a child of workspace.
+ * @param name - java project name
+ * @return a handle to the project resource
+ */
+ public static IProject findProject(String name) {
+ if (StringHelper.isEmpty(name)) {
return null;
}
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- IProject project = null;
- project = root.getProject(name);
+ IProject project = root.getProject(name);
+ return project;
+ }
+
+ /**
+ * Returns the created Java project corresponding to the given name.
+ * @param name - java project name
+ * @return a Java project
+ */
+ public static IJavaProject findJavaProject(String name) {
+ IProject project = findProject(name);
if (project != null) {
return JavaCore.create(project);
- } else {
- return null;
}
+ return null;
}
- public static IJavaProject findJavaProject(ConsoleConfiguration consoleConfiguration) {
- IJavaProject proj = null;
+ /**
+ * Returns a handle to the project resource corresponding to
+ * the given console configuration name.
+ * @param consoleConfiguration
+ * @return a handle to the project resource
+ */
+ public static IProject findProject(ConsoleConfiguration consoleConfiguration) {
+ IProject res = null;
if (consoleConfiguration != null) {
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType launchConfigurationType = launchManager.getLaunchConfigurationType( ICodeGenerationLaunchConstants.CONSOLE_CONFIGURATION_LAUNCH_TYPE_ID );
- ILaunchConfiguration[] launchConfigurations;
try {
- launchConfigurations = launchManager.getLaunchConfigurations( launchConfigurationType );
- for (int i = 0; i < launchConfigurations.length; i++) { // can't believe there is no look up by name API
+ ILaunchConfiguration[] launchConfigurations =
+ launchManager.getLaunchConfigurations( launchConfigurationType );
+ // can't believe there is no look up by name API
+ for (int i = 0; i < launchConfigurations.length && res == null; i++) {
ILaunchConfiguration launchConfiguration = launchConfigurations[i];
- if(launchConfiguration.getName().equals(consoleConfiguration.getName())) {
- proj = ProjectUtils.findJavaProject(launchConfiguration.getAttribute(IConsoleConfigurationLaunchConstants.PROJECT_NAME, "")); //$NON-NLS-1$
+ if (launchConfiguration.getName().equals(consoleConfiguration.getName())) {
+ String projName = launchConfiguration.getAttribute(
+ IConsoleConfigurationLaunchConstants.PROJECT_NAME, ""); //$NON-NLS-1$
+ res = findProject(projName);
}
}
} catch (CoreException e1) {
HibernateConsolePlugin.getDefault().log(e1);
}
}
- return proj;
+ return res;
}
+
+ /**
+ * Returns the created Java project corresponding to
+ * the given console configuration name.
+ * @param consoleConfiguration
+ * @return a Java project
+ */
+ public static IJavaProject findJavaProject(ConsoleConfiguration consoleConfiguration) {
+ IProject project = findProject(consoleConfiguration);
+ if (project != null) {
+ return JavaCore.create(project);
+ }
+ return null;
+ }
+
+ /**
+ * Checks is file, folder or project exist.
+ * @param file
+ * @return true if a resource exist
+ */
+ public static boolean exists(IFile f) {
+ if (!(f instanceof File)) {
+ return false;
+ }
+ File file = (File)f;
+ ResourceInfo info = file.getResourceInfo(false, false);
+ int flags = file.getFlags(info);
+ if (flags != ICoreConstants.NULL_FLAG) {
+ int type = ResourceInfo.getType(flags);
+ if (type == IResource.FILE || type == IResource.FOLDER || type == IResource.PROJECT) {
+ return true;
+ }
+ }
+ return false;
+ }
+ private static boolean updateCollection(ArrayList<IProject> projects, IProject project) {
+ if (project == null) {
+ return false;
+ }
+ for (Iterator<IProject> it = projects.iterator(); it.hasNext();) {
+ if (project.equals(it.next())) {
+ return false;
+ }
+ }
+ projects.add(project);
+ return true;
+ }
+
+ /**
+ * Returns the created Java projects corresponding to
+ * the given console configuration (classpath & console configuration name).
+ * Projects are listed in priority order, sequence is important.
+ *
+ * @param consoleConfiguration
+ * @return a list of Java projects in order
+ */
+ public static IJavaProject[] findJavaProjects(ConsoleConfiguration consoleConfiguration) {
+ ConsoleConfigurationPreferences ccp = consoleConfiguration.getPreferences();
+ URL[] classPathURLs = new URL[0];
+ if (ccp != null) {
+ classPathURLs = ccp.getCustomClassPathURLS();
+ }
+ ArrayList<IProject> projects = new ArrayList<IProject>();
+ IFile file = null;
+ for (int i = 0; i < classPathURLs.length; i++) {
+ IPath path = Path.fromOSString(classPathURLs[i].getFile());
+ file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
+ if (file == null || !exists(file)) {
+ file = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(path);
+ }
+ if (file != null && exists(file)) {
+ updateCollection(projects, file.getProject());
+ }
+ }
+ // insert this in last place
+ updateCollection(projects, findProject(consoleConfiguration));
+ ArrayList<IJavaProject> res = new ArrayList<IJavaProject>();
+ for (Iterator<IProject> it = projects.iterator(); it.hasNext();) {
+ res.add(JavaCore.create(it.next()));
+ }
+ return res.toArray(new IJavaProject[0]);
+ }
+
static public org.eclipse.jdt.core.dom.CompilationUnit getCompilationUnit(
ICompilationUnit source, boolean bindings) {
ASTParser parser = ASTParser.newParser(AST.JLS3);
14 years, 11 months
JBoss Tools SVN: r15514 - trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2009-05-26 10:29:18 -0400 (Tue, 26 May 2009)
New Revision: 15514
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/KbQuery.java
Log:
getParent()/getURI() method comments are modified
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/KbQuery.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/KbQuery.java 2009-05-26 13:52:43 UTC (rev 15513)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/KbQuery.java 2009-05-26 14:29:18 UTC (rev 15514)
@@ -43,7 +43,8 @@
}
/**
- * URI of tag library
+ * Returns URI of tag library for the current tag (type==TAG_NAME or type==ATTRIBUTE_NAME or type==ATTRIBUTE_VALE) or parent tag (type==TEXT)
+ *
* @return
*/
public String getUri() {
@@ -80,8 +81,8 @@
}
/**
- * @return the name of parent tag (type==TAG_NAME) or attribute (type==ATTRIBUTE_NAME or type==ATTRIBUTE_VALE) to set
- */
+ * @return the name of parent tag (type==TAG_NAME or type==ATTRIBUTE_NAME or type==TEXT) or attribute (type==ATTRIBUTE_VALE)
+ */
public String getParent() {
if(type == Type.TAG_NAME) {
return getLastParentTag();
14 years, 11 months
JBoss Tools SVN: r15513 - trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2009-05-26 09:52:43 -0400 (Tue, 26 May 2009)
New Revision: 15513
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE675Test.java
Log:
Magic numbers has been refactored in junit test
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE675Test.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE675Test.java 2009-05-26 13:01:59 UTC (rev 15512)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE675Test.java 2009-05-26 13:52:43 UTC (rev 15513)
@@ -73,10 +73,11 @@
for (int i = 0; i < 20; i++) {
- styledText.setCaretOffset(339);
- IndexedRegion treeNode = ContentAssistUtils.getNodeAt(part
- .getSourceEditor().getTextViewer(), 339);
- Node node = (Node) treeNode;
+ int offset =TestUtil.getLinePositionOffcet(part.getSourceEditor().getTextViewer(), 8, 21);
+ styledText.setCaretOffset(offset);
+ Node node = (Node) ContentAssistUtils.getNodeAt(part
+ .getSourceEditor().getTextViewer(), offset);
+
assertNotNull(node);
VpeController vpeController = TestUtil.getVpeController(part);
14 years, 11 months
JBoss Tools SVN: r15512 - in trunk: vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2009-05-26 09:01:59 -0400 (Tue, 26 May 2009)
New Revision: 15512
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE3030Test.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE675Test.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTest.java
Log:
Fixing errors in junit tests for green build
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE3030Test.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE3030Test.java 2009-05-26 11:43:52 UTC (rev 15511)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE3030Test.java 2009-05-26 13:01:59 UTC (rev 15512)
@@ -31,7 +31,7 @@
*/
public class JBIDE3030Test extends VpeTest {
- private static Set<String> fileNames = new HashSet<String>();;
+ private static Set<String> fileNames = new HashSet<String>();
static {
String jbide3030Path= JsfTestPlugin.getPluginResourcePath()
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE675Test.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE675Test.java 2009-05-26 11:43:52 UTC (rev 15511)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE675Test.java 2009-05-26 13:01:59 UTC (rev 15512)
@@ -304,8 +304,7 @@
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
- part.close(false);
- part.dispose();
+ part.close(false);
return Status.OK_STATUS;
}};
job.setPriority(Job.SHORT);
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTest.java 2009-05-26 11:43:52 UTC (rev 15511)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTest.java 2009-05-26 13:01:59 UTC (rev 15512)
@@ -110,11 +110,11 @@
@Override
protected void tearDown() throws Exception {
- super.tearDown();
-
closeEditors();
Platform.removeLogListener(this);
+
+ super.tearDown();
}
@@ -157,7 +157,7 @@
IWorkbenchPart part = page.getViewReferences()[0].getPart(false);
page.activate(part);
// close
- page.closeAllEditors(false);
+ page.closeAllEditors(false);
}
14 years, 11 months
JBoss Tools SVN: r15511 - trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2009-05-26 07:43:52 -0400 (Tue, 26 May 2009)
New Revision: 15511
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/JspContextImpl.java
Log:
addNameSpace() method is fixed: NullPointerException.
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/JspContextImpl.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/JspContextImpl.java 2009-05-26 08:23:56 UTC (rev 15510)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/JspContextImpl.java 2009-05-26 11:43:52 UTC (rev 15511)
@@ -95,6 +95,10 @@
* @param name space
*/
public void addNameSpace(IRegion region, INameSpace nameSpace) {
+ if (nameSpaces.get(region) == null) {
+ Map<String, INameSpace> nameSpaceMap = new HashMap<String, INameSpace>();
+ nameSpaces.put(region, nameSpaceMap);
+ }
nameSpaces.get(region).put(nameSpace.getPrefix(), nameSpace);
}
}
\ No newline at end of file
14 years, 11 months
JBoss Tools SVN: r15510 - trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test.
by jbosstools-commits@lists.jboss.org
Author: yradtsevich
Date: 2009-05-26 04:23:56 -0400 (Tue, 26 May 2009)
New Revision: 15510
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java
Log:
Test of https://jira.jboss.org/jira/browse/JBIDE-675 has been moved to the end of JsfAllTests, because it breaks all following tests in the suite.
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java 2009-05-26 08:20:10 UTC (rev 15509)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/JsfAllTests.java 2009-05-26 08:23:56 UTC (rev 15510)
@@ -103,7 +103,6 @@
suite.addTestSuite(JBIDE788Test.class);
suite.addTestSuite(JBIDE1105Test.class);
suite.addTestSuite(JBIDE1744Test.class);
- suite.addTestSuite(JBIDE675Test.class);
suite.addTestSuite(JBIDE1460Test.class);
suite.addTestSuite(JBIDE1720Test.class);
suite.addTestSuite(JsfJbide1718Test.class);
@@ -140,6 +139,7 @@
suite.addTestSuite(JBIDE3650Test.class);
suite.addTestSuite(JBIDE3197Test.class);
suite.addTestSuite(JBIDE4373Test.class);
+ suite.addTestSuite(JBIDE675Test.class);
// $JUnit-END$
// added by Max Areshkau
14 years, 11 months
JBoss Tools SVN: r15509 - in trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors: javabean and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2009-05-26 04:20:10 -0400 (Tue, 26 May 2009)
New Revision: 15509
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksStuffPropertyDetailPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/JavabeanValueUICreator.java
Log:
JBIDE-4232
Change the ValueType details panel
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreator.java 2009-05-26 07:44:30 UTC (rev 15508)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreator.java 2009-05-26 08:20:10 UTC (rev 15509)
@@ -429,7 +429,10 @@
List<AttributeFieldEditPart> list = new ArrayList<AttributeFieldEditPart>();
list.add(editPart1);
list.add(editPart2);
-
+ AttributeFieldEditPart dummyEditPart = new AttributeFieldEditPart();
+ dummyEditPart.setAttribute(null);
+ dummyEditPart.setContentControl(container);
+ list.add(dummyEditPart);
return list;
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksStuffPropertyDetailPage.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksStuffPropertyDetailPage.java 2009-05-26 07:44:30 UTC (rev 15508)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/SmooksStuffPropertyDetailPage.java 2009-05-26 08:20:10 UTC (rev 15509)
@@ -125,7 +125,7 @@
for (Iterator<?> iterator = list.iterator(); iterator.hasNext();) {
AttributeFieldEditPart attributeFieldEditPart = (AttributeFieldEditPart) iterator.next();
Object attribute = attributeFieldEditPart.getAttribute();
- if (attribute != null) {
+ if (attribute != null && attributeFieldEditPart != null) {
currentPropertyUIMap.put(attribute, attributeFieldEditPart);
}
}
@@ -137,7 +137,7 @@
EAttribute attribute = (EAttribute) pd.getFeature(getModel());
if (attribute.isRequired()) {
AttributeFieldEditPart editPart = createAttributeUI(detailsComposite, pd, creator);
- if (editPart != null) {
+ if (editPart != null && attribute != null) {
currentPropertyUIMap.put(attribute, editPart);
}
}
@@ -147,7 +147,7 @@
EAttribute attribute = (EAttribute) pd.getFeature(getModel());
if (!attribute.isRequired()) {
AttributeFieldEditPart editPart = createAttributeUI(detailsComposite, pd, creator);
- if (editPart != null) {
+ if (editPart != null && attribute != null) {
currentPropertyUIMap.put(attribute, editPart);
}
}
@@ -159,7 +159,7 @@
for (Iterator<?> iterator = list.iterator(); iterator.hasNext();) {
AttributeFieldEditPart attributeFieldEditPart = (AttributeFieldEditPart) iterator.next();
Object attribute = attributeFieldEditPart.getAttribute();
- if (attribute != null) {
+ if (attribute != null && attributeFieldEditPart != null) {
currentPropertyUIMap.put(attribute, attributeFieldEditPart);
}
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/JavabeanValueUICreator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/JavabeanValueUICreator.java 2009-05-26 07:44:30 UTC (rev 15508)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/JavabeanValueUICreator.java 2009-05-26 08:20:10 UTC (rev 15509)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.smooks.configuration.editors.javabean;
+import java.util.Iterator;
import java.util.List;
import org.eclipse.emf.ecore.EAttribute;
@@ -79,10 +80,18 @@
List<AttributeFieldEditPart> list = createElementSelectionSection("Data", editingdomain, toolkit, parent,
model, formEditor, JavabeanPackage.eINSTANCE.getValueType_Data(), JavabeanPackage.eINSTANCE
.getValueType_DataNS());
- list.add(SmooksUIUtils.createStringFieldEditor(parent, toolkit, getPropertyDescriptor(editingdomain,
+ Composite groupParent = parent;
+ for (Iterator<?> iterator = list.iterator(); iterator.hasNext();) {
+ AttributeFieldEditPart attributeFieldEditPart = (AttributeFieldEditPart) iterator.next();
+ if(attributeFieldEditPart.getAttribute() == null){
+ groupParent = (Composite) attributeFieldEditPart.getContentControl();
+ break;
+ }
+ }
+ list.add(SmooksUIUtils.createStringFieldEditor(groupParent, toolkit, getPropertyDescriptor(editingdomain,
JavabeanPackage.Literals.VALUE_TYPE__DEFAULT, model), model, false, false, null));
- list.add(SmooksUIUtils.createStringFieldEditor(parent, toolkit, getPropertyDescriptor(editingdomain,
+ list.add(SmooksUIUtils.createStringFieldEditor(groupParent, toolkit, getPropertyDescriptor(editingdomain,
JavabeanPackage.Literals.VALUE_TYPE__DECODER, model), model, false, false, null));
return list;
}
14 years, 11 months
JBoss Tools SVN: r15508 - in trunk/smooks: plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/javabean/provider and 10 other directories.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2009-05-26 03:44:30 -0400 (Tue, 26 May 2009)
New Revision: 15508
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.core/plugin.properties
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/javabean/provider/BindingsTypeItemProvider.java
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/javabean/provider/ExpressionTypeItemProvider.java
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/javabean/provider/ValueTypeItemProvider.java
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/javabean/provider/WiringTypeItemProvider.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.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/esbrouter/RouteBeanPropertyUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/freemarker/TemplateUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/JavabeanValueUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ConditionTypeUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/BeanIdRefProposalProvider.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SelectorContentProposalProvider.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xsl/TemplateUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/validate/SelectorValidator.java
trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model11/DBExtractTransformConfigFileTestCase.java
Log:
JBIDE-4232
1.Fix some bugs of the selector validator
2.Relabel the treeviewer
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.core/plugin.properties
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.core/plugin.properties 2009-05-26 07:43:11 UTC (rev 15507)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/plugin.properties 2009-05-26 07:44:30 UTC (rev 15508)
@@ -183,7 +183,7 @@
_UI_BindingsType_type = Bindings
_UI_DecodeParamType_type = Decode Param
_UI_ExpressionType_type = Expression
-_UI_ValueType_type = Value
+_UI_ValueType_type = Value Binding
_UI_WiringType_type = Wiring
_UI_BindingsType_group_feature = Group
_UI_BindingsType_value_feature = Value
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/javabean/provider/BindingsTypeItemProvider.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/javabean/provider/BindingsTypeItemProvider.java 2009-05-26 07:43:11 UTC (rev 15507)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/javabean/provider/BindingsTypeItemProvider.java 2009-05-26 07:44:30 UTC (rev 15508)
@@ -233,10 +233,10 @@
*/
@Override
public String getText(Object object) {
- String label = ((BindingsType)object).getTargetProfile();
+ String label = ((BindingsType)object).getBeanId();
return label == null || label.length() == 0 ?
getString("_UI_BindingsType_type") :
- getString("_UI_BindingsType_type") + " " + label;
+ getString("_UI_BindingsType_type") + " (" + label+")";
}
/**
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/javabean/provider/ExpressionTypeItemProvider.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/javabean/provider/ExpressionTypeItemProvider.java 2009-05-26 07:43:11 UTC (rev 15507)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/javabean/provider/ExpressionTypeItemProvider.java 2009-05-26 07:44:30 UTC (rev 15508)
@@ -200,10 +200,10 @@
*/
@Override
public String getText(Object object) {
- String label = ((ExpressionType)object).getValue();
+ String label = ((ExpressionType)object).getProperty();
return label == null || label.length() == 0 ?
getString("_UI_ExpressionType_type") :
- getString("_UI_ExpressionType_type") + " " + label;
+ getString("_UI_ExpressionType_type") + " (" + label+")";
}
/**
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/javabean/provider/ValueTypeItemProvider.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/javabean/provider/ValueTypeItemProvider.java 2009-05-26 07:43:11 UTC (rev 15507)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/javabean/provider/ValueTypeItemProvider.java 2009-05-26 07:44:30 UTC (rev 15508)
@@ -255,13 +255,10 @@
*/
@Override
public String getText(Object object) {
- String label = ((ValueType)object).getData();
- if(label != null && label.length() > 12){
- label = label.substring(0, 12) + "...";
- }
+ String label = ((ValueType)object).getProperty();
return label == null || label.length() == 0 ?
getString("_UI_ValueType_type") :
- getString("_UI_ValueType_type") + " " + label;
+ getString("_UI_ValueType_type") + " (" + label + ")";
}
/**
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/javabean/provider/WiringTypeItemProvider.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/javabean/provider/WiringTypeItemProvider.java 2009-05-26 07:43:11 UTC (rev 15507)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/javabean/provider/WiringTypeItemProvider.java 2009-05-26 07:44:30 UTC (rev 15508)
@@ -200,10 +200,10 @@
*/
@Override
public String getText(Object object) {
- String label = ((WiringType)object).getBeanIdRef();
+ String label = ((WiringType)object).getProperty();
return label == null || label.length() == 0 ?
getString("_UI_WiringType_type") :
- getString("_UI_WiringType_type") + " " + label;
+ getString("_UI_WiringType_type") + " (" + label+")";
}
/**
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-05-26 07:43:11 UTC (rev 15507)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/model/smooks/impl/SmooksPackageImpl.java 2009-05-26 07:44:30 UTC (rev 15508)
@@ -1417,7 +1417,7 @@
source,
new String[] {
"name", "condition_._type",
- "kind", "simple"
+ "kind", "mixed"
});
addAnnotation
(getConditionType_Value(),
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreator.java 2009-05-26 07:43:11 UTC (rev 15507)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreator.java 2009-05-26 07:44:30 UTC (rev 15508)
@@ -30,15 +30,18 @@
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.forms.IFormColors;
import org.eclipse.ui.forms.events.IHyperlinkListener;
import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.Section;
import org.jboss.tools.smooks.configuration.editors.uitls.FieldAssistDisposer;
import org.jboss.tools.smooks.configuration.editors.uitls.FieldMarkerWrapper;
import org.jboss.tools.smooks.configuration.editors.uitls.IFieldDialog;
@@ -131,8 +134,8 @@
return SmooksUIUtils.getJavaProject(model);
}
- public List<AttributeFieldEditPart> createExtendUIOnBottom(AdapterFactoryEditingDomain editingdomain, FormToolkit toolkit,
- Composite parent, Object model, SmooksMultiFormEditor formEditor) {
+ public List<AttributeFieldEditPart> createExtendUIOnBottom(AdapterFactoryEditingDomain editingdomain,
+ FormToolkit toolkit, Composite parent, Object model, SmooksMultiFormEditor formEditor) {
return Collections.emptyList();
}
@@ -181,7 +184,7 @@
SmooksMultiFormEditor formEditor) {
SmooksGraphicsExtType ext = formEditor.getSmooksGraphicsExt();
if (ext != null) {
- return SmooksUIUtils.createSelectorFieldEditor(toolkit, parent, propertyDescriptor, model, ext,formEditor);
+ return SmooksUIUtils.createSelectorFieldEditor(toolkit, parent, propertyDescriptor, model, ext, formEditor);
}
return null;
}
@@ -253,7 +256,7 @@
final Object cmodel = model;
combo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
- if(combo.getText() == null || combo.getText().length() ==0){
+ if (combo.getText() == null || combo.getText().length() == 0) {
ip.setPropertyValue(cmodel, null);
return;
}
@@ -264,20 +267,24 @@
ip.setPropertyValue(cmodel, combo.getText());
}
});
-
- final FieldAssistDisposer disposer = SmooksUIUtils.addBeanIdRefAssistToCombo(combo, (EObject)model);
-
- combo.addDisposeListener(new DisposeListener(){
- /* (non-Javadoc)
- * @see org.eclipse.swt.events.DisposeListener#widgetDisposed(org.eclipse.swt.events.DisposeEvent)
+ final FieldAssistDisposer disposer = SmooksUIUtils.addBeanIdRefAssistToCombo(combo, (EObject) model);
+
+ combo.addDisposeListener(new DisposeListener() {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.swt.events.DisposeListener#widgetDisposed
+ * (org.eclipse.swt.events.DisposeEvent)
*/
public void widgetDisposed(DisposeEvent e) {
disposer.dispose();
}
-
+
});
-
+
return editPart;
}
}
@@ -295,18 +302,18 @@
return null;
}
-
public boolean ignoreProperty(EAttribute feature) {
return false;
}
-
- public IItemPropertyDescriptor getPropertyDescriptor(AdapterFactoryEditingDomain editingDomain,EAttribute attribute , Object model){
+
+ public IItemPropertyDescriptor getPropertyDescriptor(AdapterFactoryEditingDomain editingDomain,
+ EAttribute attribute, Object model) {
IItemPropertySource itemPropertySource = (IItemPropertySource) editingDomain.getAdapterFactory().adapt(model,
IItemPropertySource.class);
List<IItemPropertyDescriptor> list = itemPropertySource.getPropertyDescriptors(model);
for (Iterator<?> iterator = list.iterator(); iterator.hasNext();) {
IItemPropertyDescriptor itemPropertyDescriptor = (IItemPropertyDescriptor) iterator.next();
- if(itemPropertyDescriptor.getFeature(model) == attribute){
+ if (itemPropertyDescriptor.getFeature(model) == attribute) {
return itemPropertyDescriptor;
}
}
@@ -342,24 +349,50 @@
AdapterFactoryEditingDomain editingdomain, FormToolkit toolkit, Composite parent, Object model,
SmooksMultiFormEditor formEditor, IItemPropertyDescriptor createOnElementFeature,
IItemPropertyDescriptor createOnElementFeatureNS) {
- Section section = toolkit.createSection(parent, Section.TITLE_BAR);
- section.setText(sectionTitle);
+ Group group = new Group(parent, SWT.NONE);
+ // Section section = toolkit.createSection(parent, Section.TITLE_BAR);
+ // section.setText(sectionTitle);
+ if (sectionTitle != null) {
+ sectionTitle = " " + sectionTitle + " ";
+ }
+ group.setText(sectionTitle);
+ // FontData fd = new FontData();
+ // fd.setStyle(SWT.BOLD);
+ // group.setForeground(toolkit.getColors().getForeground());
FillLayout layout = new FillLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
- section.setLayout(layout);
+ // section.setLayout(layout);
+ group.setLayout(layout);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.heightHint = 100;
+// gd.heightHint = 100;
gd.horizontalSpan = 2;
- section.setLayoutData(gd);
+ // section.setLayoutData(gd);
+ group.setLayoutData(gd);
+ group.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ // Composite backComposite = toolkit.createComposite(section);
+ // section.setClient(backComposite);
+ // GridLayout gl = new GridLayout();
+ // gl.marginHeight = 0;
+ // gl.marginWidth = 0;
+ // gl.marginLeft = 1;
+ // gl.marginRight = 1;
+ // gl.marginBottom = 1;
+ // backComposite.setLayout(gl);
+ // backComposite.setBackground(toolkit.getColors().getColor(IFormColors.BORDER));
- Composite container = toolkit.createComposite(section);
+ Composite container = toolkit.createComposite(group);
+ group.setBackground(container.getBackground());
- section.setClient(container);
-
+ Font f = container.getFont();
+ if (f != null) {
+ FontData fd = f.getFontData()[0];
+ if (fd != null)
+ group.setFont(new Font(null, new FontData(fd.getName(), fd.getHeight(), SWT.BOLD)));
+ }
GridLayout glayout = new GridLayout();
glayout.numColumns = 2;
container.setLayout(glayout);
@@ -368,7 +401,7 @@
name += "*";
}
AttributeFieldEditPart editPart1 = SmooksUIUtils.createSelectorFieldEditor(name, toolkit, container,
- createOnElementFeature, model, formEditor.getSmooksGraphicsExt(),formEditor);
+ createOnElementFeature, model, formEditor.getSmooksGraphicsExt(), formEditor);
editPart1.setAttribute(createOnElementFeature.getFeature(model));
String namespace = "Namespace";
@@ -379,20 +412,19 @@
toolkit, createOnElementFeatureNS, model, false, false, false, 0, null, SmooksUIUtils.VALUE_TYPE_VALUE,
null);
editPart2.setAttribute(createOnElementFeatureNS.getFeature(model));
-
-// gd = new GridData(GridData.FILL_HORIZONTAL);
-// gd.horizontalSpan = 2;
-//
-// toolkit.createSeparator(parent, SWT.HORIZONTAL).setLayoutData(gd);
-
+
+ // gd = new GridData(GridData.FILL_HORIZONTAL);
+ // gd.horizontalSpan = 2;
+ //
+ // toolkit.createSeparator(parent, SWT.HORIZONTAL).setLayoutData(gd);
+
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 2;
gd.heightHint = 8;
-
+
Composite ccc = toolkit.createComposite(parent);
ccc.setLayoutData(gd);
-// ccc.setBackground(new Color(null,128,128,128));
-
+ // ccc.setBackground(new Color(null,128,128,128));
List<AttributeFieldEditPart> list = new ArrayList<AttributeFieldEditPart>();
list.add(editPart1);
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/esbrouter/RouteBeanPropertyUICreator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/esbrouter/RouteBeanPropertyUICreator.java 2009-05-26 07:43:11 UTC (rev 15507)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/esbrouter/RouteBeanPropertyUICreator.java 2009-05-26 07:44:30 UTC (rev 15508)
@@ -15,12 +15,16 @@
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.ui.forms.IFormColors;
import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.Section;
import org.jboss.tools.smooks.configuration.editors.AttributeFieldEditPart;
import org.jboss.tools.smooks.configuration.editors.PropertyUICreator;
import org.jboss.tools.smooks.configuration.editors.SmooksMultiFormEditor;
@@ -116,18 +120,30 @@
public List<AttributeFieldEditPart> createExtendUIOnBottom(AdapterFactoryEditingDomain editingdomain,
FormToolkit toolkit, Composite parent, Object model, SmooksMultiFormEditor formEditor) {
List<AttributeFieldEditPart> list = new ArrayList<AttributeFieldEditPart>();
- Section section = toolkit.createSection(parent, Section.TITLE_BAR);
+ Group group =new Group(parent,SWT.NONE);
+// Section section = toolkit.createSection(parent, Section.TITLE_BAR);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 2;
- section.setText("Route To Serivce");
- section.setLayoutData(gd);
+// section.setText("Route To Serivce");
+ group.setText("Route To Serivce");
+// section.setLayoutData(gd);
+ group.setLayoutData(gd);
FillLayout fl = new FillLayout();
fl.marginHeight = 0;
fl.marginWidth = 0;
- section.setLayout(fl);
- Composite composite = toolkit.createComposite(section);
- section.setClient(composite);
+// section.setLayout(fl);
+ group.setLayout(fl);
+
+ Composite composite = toolkit.createComposite(group);
+// section.setClient(composite);
+ group.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ Font f = composite.getFont();
+ if (f != null) {
+ FontData fd = f.getFontData()[0];
+ if (fd != null)
+ group.setFont(new Font(null, new FontData(fd.getName(), fd.getHeight(), SWT.BOLD)));
+ }
GridLayout gl = new GridLayout();
gl.numColumns = 2;
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/freemarker/TemplateUICreator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/freemarker/TemplateUICreator.java 2009-05-26 07:43:11 UTC (rev 15507)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/freemarker/TemplateUICreator.java 2009-05-26 07:44:30 UTC (rev 15508)
@@ -10,7 +10,7 @@
******************************************************************************/
package org.jboss.tools.smooks.configuration.editors.freemarker;
-import java.util.Collections;
+import java.util.ArrayList;
import java.util.List;
import org.eclipse.emf.ecore.EAttribute;
@@ -40,32 +40,39 @@
* org.eclipse.emf.edit.provider.IItemPropertyDescriptor, java.lang.Object,
* org.eclipse.emf.ecore.EAttribute)
*/
- public AttributeFieldEditPart createPropertyUI(FormToolkit toolkit, Composite parent, IItemPropertyDescriptor propertyDescriptor, Object model,
- EAttribute feature, SmooksMultiFormEditor formEditor) {
+ public AttributeFieldEditPart createPropertyUI(FormToolkit toolkit, Composite parent,
+ IItemPropertyDescriptor propertyDescriptor, Object model, EAttribute feature,
+ SmooksMultiFormEditor formEditor) {
if (feature == FreemarkerPackage.eINSTANCE.getTemplate_Value()) {
}
- if (feature == FreemarkerPackage.eINSTANCE.getTemplate_Encoding()) {
- }
-
return super.createPropertyUI(toolkit, parent, propertyDescriptor, model, feature, formEditor);
}
@Override
- public List<AttributeFieldEditPart> createExtendUIOnBottom(AdapterFactoryEditingDomain editingdomain, FormToolkit toolkit, Composite parent, Object model,
- SmooksMultiFormEditor formEditor) {
- OpenEditorEditInnerContentsAction openCDATAEditorAction = new OpenEditorEditInnerContentsAction(editingdomain,(AnyType) model, SmooksUIUtils.VALUE_TYPE_CDATA, "flt");
-// OpenEditorEditInnerContentsAction openCommentEditorAction = new OpenEditorEditInnerContentsAction(editingdomain,(AnyType) model, SmooksUIUtils.VALUE_TYPE_COMMENT, "flt");
+ public List<AttributeFieldEditPart> createExtendUIOnBottom(AdapterFactoryEditingDomain editingdomain,
+ FormToolkit toolkit, Composite parent, Object model, SmooksMultiFormEditor formEditor) {
+ List<AttributeFieldEditPart> list = new ArrayList<AttributeFieldEditPart>();
+ OpenEditorEditInnerContentsAction openCDATAEditorAction = new OpenEditorEditInnerContentsAction(editingdomain,
+ (AnyType) model, SmooksUIUtils.VALUE_TYPE_CDATA, "flt");
+ // OpenEditorEditInnerContentsAction openCommentEditorAction = new
+ // OpenEditorEditInnerContentsAction(editingdomain,(AnyType) model,
+ // SmooksUIUtils.VALUE_TYPE_COMMENT, "flt");
- AttributeFieldEditPart cdatatext = SmooksUIUtils.createCDATAFieldEditor("Inline Template", editingdomain, toolkit, parent, model, openCDATAEditorAction);
-// AttributeFieldEditPart commenttext = SmooksUIUtils.createCommentFieldEditor("Template Contents(Comment)", editingdomain, toolkit, parent, model, openCommentEditorAction);
-
- openCDATAEditorAction.setRelateText((Text)cdatatext.getContentControl());
-// openCommentEditorAction.setRelateText((Text)commenttext.getContentControl());
-
- SmooksUIUtils.createFileSelectionTextFieldEditor("External Template File", parent, editingdomain, toolkit, null, model, SmooksUIUtils.VALUE_TYPE_TEXT,
- null, null);
+ AttributeFieldEditPart cdatatext = SmooksUIUtils.createCDATAFieldEditor("Inline Template", editingdomain,
+ toolkit, parent, model, openCDATAEditorAction, true);
+ list.add(cdatatext);
+ // AttributeFieldEditPart commenttext =
+ // SmooksUIUtils.createCommentFieldEditor("Template Contents(Comment)",
+ // editingdomain, toolkit, parent, model, openCommentEditorAction);
- return Collections.emptyList();
+ openCDATAEditorAction.setRelateText((Text) cdatatext.getContentControl());
+ // openCommentEditorAction.setRelateText((Text)commenttext.getContentControl());
+
+ list.add(SmooksUIUtils.createFileSelectionTextFieldEditor("External Template File", parent, editingdomain,
+ toolkit, null, model, SmooksUIUtils.VALUE_TYPE_TEXT, null, null));
+ list.add(SmooksUIUtils.createStringFieldEditor(parent, toolkit, getPropertyDescriptor(editingdomain,
+ FreemarkerPackage.eINSTANCE.getTemplate_Encoding(), model), model, false, false, null));
+ return list;
}
@Override
@@ -73,6 +80,10 @@
if (feature == FreemarkerPackage.eINSTANCE.getTemplate_Value()) {
return true;
}
+ if (feature == FreemarkerPackage.eINSTANCE.getTemplate_Encoding()) {
+ return true;
+ }
+
return super.ignoreProperty(feature);
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/JavabeanValueUICreator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/JavabeanValueUICreator.java 2009-05-26 07:43:11 UTC (rev 15507)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/javabean/JavabeanValueUICreator.java 2009-05-26 07:44:30 UTC (rev 15508)
@@ -19,6 +19,7 @@
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.jboss.tools.smooks.configuration.editors.AttributeFieldEditPart;
import org.jboss.tools.smooks.configuration.editors.SmooksMultiFormEditor;
+import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
import org.jboss.tools.smooks.model.javabean.JavabeanPackage;
/**
@@ -73,10 +74,17 @@
* org.jboss.tools.smooks.configuration.editors.SmooksMultiFormEditor)
*/
@Override
- public List<AttributeFieldEditPart> createExtendUIOnTop(AdapterFactoryEditingDomain editingdomain, FormToolkit toolkit,
- Composite parent, Object model, SmooksMultiFormEditor formEditor) {
- return createElementSelectionSection("Data", editingdomain, toolkit, parent, model, formEditor,
- JavabeanPackage.eINSTANCE.getValueType_Data(), JavabeanPackage.eINSTANCE.getValueType_DataNS());
+ public List<AttributeFieldEditPart> createExtendUIOnBottom(AdapterFactoryEditingDomain editingdomain,
+ FormToolkit toolkit, Composite parent, Object model, SmooksMultiFormEditor formEditor) {
+ List<AttributeFieldEditPart> list = createElementSelectionSection("Data", editingdomain, toolkit, parent,
+ model, formEditor, JavabeanPackage.eINSTANCE.getValueType_Data(), JavabeanPackage.eINSTANCE
+ .getValueType_DataNS());
+ list.add(SmooksUIUtils.createStringFieldEditor(parent, toolkit, getPropertyDescriptor(editingdomain,
+ JavabeanPackage.Literals.VALUE_TYPE__DEFAULT, model), model, false, false, null));
+
+ list.add(SmooksUIUtils.createStringFieldEditor(parent, toolkit, getPropertyDescriptor(editingdomain,
+ JavabeanPackage.Literals.VALUE_TYPE__DECODER, model), model, false, false, null));
+ return list;
}
/*
@@ -94,6 +102,12 @@
if (feature == JavabeanPackage.eINSTANCE.getValueType_DataNS()) {
return true;
}
+ if (feature == JavabeanPackage.eINSTANCE.getValueType_Decoder()) {
+ return true;
+ }
+ if (feature == JavabeanPackage.eINSTANCE.getValueType_Default()) {
+ return true;
+ }
return super.ignoreProperty(feature);
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ConditionTypeUICreator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ConditionTypeUICreator.java 2009-05-26 07:43:11 UTC (rev 15507)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/smooks/ConditionTypeUICreator.java 2009-05-26 07:44:30 UTC (rev 15508)
@@ -10,8 +10,12 @@
******************************************************************************/
package org.jboss.tools.smooks.configuration.editors.smooks;
+import java.util.ArrayList;
+import java.util.List;
+
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.forms.widgets.FormToolkit;
@@ -36,11 +40,12 @@
* org.eclipse.emf.ecore.EAttribute)
*/
public AttributeFieldEditPart createPropertyUI(FormToolkit toolkit, Composite parent,
- IItemPropertyDescriptor propertyDescriptor, Object model, EAttribute feature,SmooksMultiFormEditor formEditor) {
+ IItemPropertyDescriptor propertyDescriptor, Object model, EAttribute feature,
+ SmooksMultiFormEditor formEditor) {
if (feature == SmooksPackage.eINSTANCE.getConditionType_Value()) {
}
if (feature == SmooksPackage.eINSTANCE.getConditionType_Evaluator()) {
- return SmooksUIUtils.createJavaTypeSearchFieldEditor(parent, toolkit, propertyDescriptor, (EObject)model);
+ return SmooksUIUtils.createJavaTypeSearchFieldEditor(parent, toolkit, propertyDescriptor, (EObject) model);
}
if (feature == SmooksPackage.eINSTANCE.getConditionType_Id()) {
}
@@ -50,4 +55,39 @@
return super.createPropertyUI(toolkit, parent, propertyDescriptor, model, feature, formEditor);
}
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.jboss.tools.smooks.configuration.editors.PropertyUICreator#
+ * createExtendUIOnBottom
+ * (org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain,
+ * org.eclipse.ui.forms.widgets.FormToolkit,
+ * org.eclipse.swt.widgets.Composite, java.lang.Object,
+ * org.jboss.tools.smooks.configuration.editors.SmooksMultiFormEditor)
+ */
+ @Override
+ public List<AttributeFieldEditPart> createExtendUIOnBottom(AdapterFactoryEditingDomain editingdomain,
+ FormToolkit toolkit, Composite parent, Object model, SmooksMultiFormEditor formEditor) {
+ List<AttributeFieldEditPart> list = new ArrayList<AttributeFieldEditPart>();
+ AttributeFieldEditPart cdatatext = SmooksUIUtils.createCDATAFieldEditor("Condition Value", editingdomain,
+ toolkit, parent, model, null,true);
+ list.add(cdatatext);
+ return list;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.jboss.tools.smooks.configuration.editors.PropertyUICreator#ignoreProperty
+ * (org.eclipse.emf.ecore.EAttribute)
+ */
+ @Override
+ public boolean ignoreProperty(EAttribute feature) {
+ if (feature == SmooksPackage.eINSTANCE.getConditionType_Value()) {
+ return true;
+ }
+ return super.ignoreProperty(feature);
+ }
+
}
\ No newline at end of file
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/BeanIdRefProposalProvider.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/BeanIdRefProposalProvider.java 2009-05-26 07:43:11 UTC (rev 15507)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/BeanIdRefProposalProvider.java 2009-05-26 07:44:30 UTC (rev 15508)
@@ -49,7 +49,7 @@
return proposalList.toArray(new IContentProposal[]{});
}
- return null;
+ return new IContentProposal[]{};
}
protected SmooksResourceListType getSmooksResourceList(EObject model) {
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SelectorContentProposalProvider.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SelectorContentProposalProvider.java 2009-05-26 07:43:11 UTC (rev 15507)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SelectorContentProposalProvider.java 2009-05-26 07:44:30 UTC (rev 15508)
@@ -42,7 +42,7 @@
public IContentProposal[] getProposals(String contents, int position) {
List<Object> list = SelectoreSelectionDialog.generateInputData(extType);
if(list == null || list.isEmpty()){
- return null;
+ return new IContentProposal[]{};
}
List<IContentProposal> contentList = new ArrayList<IContentProposal>();
List<IXMLStructuredObject> models = new ArrayList<IXMLStructuredObject>();
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java 2009-05-26 07:43:11 UTC (rev 15507)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/uitls/SmooksUIUtils.java 2009-05-26 07:44:30 UTC (rev 15508)
@@ -148,7 +148,7 @@
'F', 'g', 'G', 'h', 'H', 'i', 'I', 'j', 'J', 'k', 'K', 'l', 'L', 'm', 'M', 'n', 'N', 'o', 'O', 'p', 'P',
'q', 'Q', 'r', 'R', 's', 'S', 't', 'T', 'u', 'U', 'v', 'V', 'w', 'W', 'x', 'X', 'y', 'Y' };
- public static final String[] SELECTOR_SPERATORS = new String[]{" " , "/"};
+ public static final String[] SELECTOR_SPERATORS = new String[] { " ", "/" };
public static List<String> getBeanIdList(SmooksResourceListType resourceList) {
List<AbstractResourceConfig> rlist = resourceList.getAbstractResourceConfig();
@@ -395,6 +395,15 @@
EditingDomain editingdomain, FormToolkit toolkit, final IItemPropertyDescriptor itemPropertyDescriptor,
Object model, boolean multiText, boolean linkLabel, boolean openFile, int height,
IHyperlinkListener listener, int valueType, OpenEditorEditInnerContentsAction openEditorAction) {
+ return createStringFieldEditor(label, parent, editingdomain, toolkit, itemPropertyDescriptor, model, multiText,
+ linkLabel, openFile, height, listener, valueType, openEditorAction, false);
+ }
+
+ public static AttributeFieldEditPart createStringFieldEditor(String label, final Composite parent,
+ EditingDomain editingdomain, FormToolkit toolkit, final IItemPropertyDescriptor itemPropertyDescriptor,
+ Object model, boolean multiText, boolean linkLabel, boolean openFile, int height,
+ IHyperlinkListener listener, int valueType, OpenEditorEditInnerContentsAction openEditorAction,
+ boolean expandEditor) {
AttributeFieldEditPart fieldEditPart = new AttributeFieldEditPart();
GridData gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
Section section = null;
@@ -416,6 +425,7 @@
space.setLayoutData(gd);
section = toolkit.createSection(parent, Section.TITLE_BAR | Section.TWISTIE);
+ section.setExpanded(expandEditor);
FillLayout layout = new FillLayout();
section.setLayout(layout);
section.setText(label);
@@ -554,9 +564,9 @@
}
if (editValue != null && valueIsSet) {
valueText.setText(editValue);
- if (editValue.length() > 0 && section != null) {
- section.setExpanded(true);
- }
+// if (editValue.length() > 0 && section != null) {
+// section.setExpanded(true);
+// }
}
if (valueType == VALUE_TYPE_TEXT && model instanceof AnyType && fEditingDomain != null) {
valueText.addModifyListener(new ModifyListener() {
@@ -710,6 +720,13 @@
return createStringFieldEditor(label, parent, editingdomain, toolkit, null, model, true, true, false, 300,
null, VALUE_TYPE_CDATA, action);
}
+
+ public static AttributeFieldEditPart createCDATAFieldEditor(String label,
+ AdapterFactoryEditingDomain editingdomain, FormToolkit toolkit, Composite parent, Object model,
+ OpenEditorEditInnerContentsAction action,boolean expanedEditor) {
+ return createStringFieldEditor(label, parent, editingdomain, toolkit, null, model, true, true, false, 300,
+ null, VALUE_TYPE_CDATA, action,expanedEditor);
+ }
public static AttributeFieldEditPart createCommentFieldEditor(String label,
AdapterFactoryEditingDomain editingdomain, FormToolkit toolkit, Composite parent, Object model,
@@ -717,6 +734,13 @@
return createStringFieldEditor(label, parent, editingdomain, toolkit, null, model, true, true, false, 300,
null, VALUE_TYPE_COMMENT, action);
}
+
+ public static AttributeFieldEditPart createCommentFieldEditor(String label,
+ AdapterFactoryEditingDomain editingdomain, FormToolkit toolkit, Composite parent, Object model,
+ OpenEditorEditInnerContentsAction action,boolean expandEditor) {
+ return createStringFieldEditor(label, parent, editingdomain, toolkit, null, model, true, true, false, 300,
+ null, VALUE_TYPE_COMMENT, action,expandEditor);
+ }
public static AttributeFieldEditPart createJavaTypeSearchFieldEditor(Composite parent, FormToolkit toolkit,
final IItemPropertyDescriptor propertyDescriptor, final EObject model) {
@@ -748,7 +772,7 @@
layout.marginRight = 0;
layout.horizontalSpacing = 0;
tcom.setLayout(layout);
-
+
EAttribute attribute = (EAttribute) propertyDescriptor.getFeature(model);
FieldMarkerComposite notificationComposite = new FieldMarkerComposite(tcom, SWT.NONE);
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xsl/TemplateUICreator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xsl/TemplateUICreator.java 2009-05-26 07:43:11 UTC (rev 15507)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/xsl/TemplateUICreator.java 2009-05-26 07:44:30 UTC (rev 15508)
@@ -10,7 +10,7 @@
******************************************************************************/
package org.jboss.tools.smooks.configuration.editors.xsl;
-import java.util.Collections;
+import java.util.ArrayList;
import java.util.List;
import org.eclipse.emf.ecore.EAttribute;
@@ -41,8 +41,9 @@
* org.eclipse.emf.edit.provider.IItemPropertyDescriptor, java.lang.Object,
* org.eclipse.emf.ecore.EAttribute)
*/
- public AttributeFieldEditPart createPropertyUI(FormToolkit toolkit, Composite parent, IItemPropertyDescriptor propertyDescriptor, Object model,
- EAttribute feature, SmooksMultiFormEditor formEditor) {
+ public AttributeFieldEditPart createPropertyUI(FormToolkit toolkit, Composite parent,
+ IItemPropertyDescriptor propertyDescriptor, Object model, EAttribute feature,
+ SmooksMultiFormEditor formEditor) {
if (feature == XslPackage.eINSTANCE.getTemplate_Value()) {
}
if (feature == XslPackage.eINSTANCE.getTemplate_Encoding()) {
@@ -63,22 +64,34 @@
if (feature == XslPackage.eINSTANCE.getTemplate_Value()) {
return true;
}
+ if (feature == XslPackage.eINSTANCE.getTemplate_Encoding()) {
+ return true;
+ }
return super.ignoreProperty(feature);
}
@Override
- public List<AttributeFieldEditPart> createExtendUIOnBottom(AdapterFactoryEditingDomain editingdomain, FormToolkit toolkit, Composite parent, Object model,
- SmooksMultiFormEditor formEditor) {
- OpenEditorEditInnerContentsAction openCdataEditorAction = new OpenEditorEditInnerContentsAction(editingdomain,(AnyType) model, SmooksUIUtils.VALUE_TYPE_CDATA, "xsl");
-// OpenEditorEditInnerContentsAction openCommentEditorAction = new OpenEditorEditInnerContentsAction(editingdomain,(AnyType) model, SmooksUIUtils.VALUE_TYPE_COMMENT, "xsl");
- AttributeFieldEditPart text1 = SmooksUIUtils.createCDATAFieldEditor("Inline Template", editingdomain, toolkit, parent, model, openCdataEditorAction);
-// AttributeFieldEditPart text2 = SmooksUIUtils.createCommentFieldEditor("Template Contents (Comment)", editingdomain, toolkit, parent, model, openCommentEditorAction);
- openCdataEditorAction.setRelateText((Text)text1.getContentControl());
-// openCommentEditorAction.setRelateText((Text)text2.getContentControl());
- SmooksUIUtils.createFileSelectionTextFieldEditor("External Template File", parent, editingdomain, toolkit, null, model, SmooksUIUtils.VALUE_TYPE_TEXT,
- null, null);
-
- return Collections.emptyList();
+ public List<AttributeFieldEditPart> createExtendUIOnBottom(AdapterFactoryEditingDomain editingdomain,
+ FormToolkit toolkit, Composite parent, Object model, SmooksMultiFormEditor formEditor) {
+ List<AttributeFieldEditPart> list = new ArrayList<AttributeFieldEditPart>();
+ OpenEditorEditInnerContentsAction openCdataEditorAction = new OpenEditorEditInnerContentsAction(editingdomain,
+ (AnyType) model, SmooksUIUtils.VALUE_TYPE_CDATA, "xsl");
+ // OpenEditorEditInnerContentsAction openCommentEditorAction = new
+ // OpenEditorEditInnerContentsAction(editingdomain,(AnyType) model,
+ // SmooksUIUtils.VALUE_TYPE_COMMENT, "xsl");
+ AttributeFieldEditPart text1 = SmooksUIUtils.createCDATAFieldEditor("Inline Template", editingdomain, toolkit,
+ parent, model, openCdataEditorAction,true);
+ // AttributeFieldEditPart text2 =
+ // SmooksUIUtils.createCommentFieldEditor("Template Contents (Comment)",
+ // editingdomain, toolkit, parent, model, openCommentEditorAction);
+ openCdataEditorAction.setRelateText((Text) text1.getContentControl());
+ // openCommentEditorAction.setRelateText((Text)text2.getContentControl());
+ list.add(SmooksUIUtils.createFileSelectionTextFieldEditor("External Template File", parent, editingdomain,
+ toolkit, null, model, SmooksUIUtils.VALUE_TYPE_TEXT, null, null));
+ list.add(text1);
+ list.add(SmooksUIUtils.createStringFieldEditor(parent, toolkit, getPropertyDescriptor(editingdomain,
+ XslPackage.eINSTANCE.getTemplate_Encoding(), model), model, false, false, null));
+ return list;
}
}
\ No newline at end of file
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/validate/SelectorValidator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/validate/SelectorValidator.java 2009-05-26 07:43:11 UTC (rev 15507)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/validate/SelectorValidator.java 2009-05-26 07:44:30 UTC (rev 15508)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.smooks.configuration.validate;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
@@ -17,17 +18,13 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.Path;
import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.edit.domain.EditingDomain;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.part.FileEditorInput;
import org.jboss.tools.smooks.configuration.editors.IXMLStructuredObject;
import org.jboss.tools.smooks.configuration.editors.SelectoreSelectionDialog;
-import org.jboss.tools.smooks.configuration.editors.SmooksMultiFormEditor;
import org.jboss.tools.smooks.configuration.editors.groovy.GroovyUICreator;
import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
import org.jboss.tools.smooks.model.calc.CalcPackage;
@@ -78,8 +75,10 @@
public List<Diagnostic> validate(Collection<?> selectedObjects, EditingDomain editingDomain) {
list.clear();
Resource resource = editingDomain.getResourceSet().getResources().get(0);
+ if (resource.getContents().isEmpty()) {
+ return super.validate(selectedObjects, editingDomain);
+ }
Object obj = resource.getContents().get(0);
- final SmooksGraphicsExtType[] extTypes = new SmooksGraphicsExtType[1];
if (obj instanceof DocumentRoot) {
SmooksResourceListType listType = ((DocumentRoot) obj).getSmooksResourceList();
IResource r = SmooksUIUtils.getResource(listType);
@@ -88,30 +87,15 @@
file = (IFile) r;
}
final IFile ff = file;
- Display.getDefault().syncExec(new Runnable() {
+ String extName = ff.getName() + ".ext";
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Runnable#run()
- */
- public void run() {
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window == null) {
- return;
- }
- SmooksMultiFormEditor editor = (SmooksMultiFormEditor) window.getActivePage().findEditor(
- new FileEditorInput((IFile) ff));
- if (editor == null)
- return;
-
- SmooksGraphicsExtType extType = editor.getSmooksGraphicsExt();
- extTypes[0] = extType;
- }
-
- });
+ IFile extFile = ff.getParent().getFile(new Path(extName));
+ try {
+ extType = SmooksUIUtils.loadSmooksGraphicsExt(extFile);
+ } catch (IOException e) {
+ // ignore
+ }
}
- extType = extTypes[0];
if (extType != null) {
List<Object> l = SelectoreSelectionDialog.generateInputData(extType);
if (l != null) {
@@ -132,24 +116,37 @@
protected Diagnostic validateModel(Object model, EditingDomain editingDomain) {
EAttribute feature = getAttribute(model);
String path = getPath(model);
-// if(feature != null && path == null){
-// return newWaringDiagnostic("Selector '" +path+ "' isn't available", model, feature);
-// }
+ if (path == null) {
+ return null;
+ }
+ // if(feature != null && path == null){
+ // return newWaringDiagnostic("Selector '" +path+ "' isn't available",
+ // model, feature);
+ // }
+ String sperator = "/";
+ if (path.indexOf('/') == -1) {
+ sperator = " ";
+ }
if (feature != null && path != null) {
Object node = null;
for (Iterator<?> iterator = list.iterator(); iterator.hasNext();) {
Object obj = (Object) iterator.next();
if (obj instanceof IXMLStructuredObject) {
- if (node == null){
- node = SmooksUIUtils.localXMLNodeWithPath(path, (IXMLStructuredObject) obj,"/" , false);
+ if (node == null) {
+ try {
+ node = SmooksUIUtils
+ .localXMLNodeWithPath(path, (IXMLStructuredObject) obj, sperator, false);
+ } catch (Throwable e) {
+ // ignore
+ }
}
- if(node != null){
+ if (node != null) {
return null;
}
}
}
- if(node == null){
- return newWaringDiagnostic("Selector '" +path+ "' isn't available", model, feature);
+ if (node == null) {
+ return newWaringDiagnostic("Selector '" + path + "' isn't available", model, feature);
}
}
return super.validateModel(model, editingDomain);
@@ -162,91 +159,90 @@
if (model instanceof Counter) {
return CalcPackage.Literals.COUNTER__COUNT_ON_ELEMENT;
}
- if(model instanceof Direct){
+ if (model instanceof Direct) {
return DatasourcePackage.Literals.DIRECT__BIND_ON_ELEMENT;
}
- if(model instanceof RouteBean){
+ if (model instanceof RouteBean) {
return EsbroutingPackage.Literals.ROUTE_BEAN__ROUTE_ON_ELEMENT;
}
- if(model instanceof OutputStream){
+ if (model instanceof OutputStream) {
return FileRoutingPackage.Literals.OUTPUT_STREAM__OPEN_ON_ELEMENT;
}
- if(model instanceof Freemarker){
+ if (model instanceof Freemarker) {
return FreemarkerPackage.Literals.FREEMARKER__APPLY_ON_ELEMENT;
}
- if(model instanceof Xsl){
+ if (model instanceof Xsl) {
return XslPackage.Literals.XSL__APPLY_ON_ELEMENT;
}
- if(model instanceof GroovyUICreator){
+ if (model instanceof GroovyUICreator) {
return GroovyPackage.Literals.GROOVY__EXECUTE_ON_ELEMENT;
}
- if(model instanceof JmsRouter){
+ if (model instanceof JmsRouter) {
return JmsroutingPackage.Literals.JMS_ROUTER__ROUTE_ON_ELEMENT;
}
-
- if(model instanceof ResourceConfigType){
- return SmooksPackage.Literals.RESOURCE_CONFIG_TYPE__SELECTOR;
+
+ if (model instanceof ResourceConfigType) {
+ return SmooksPackage.Literals.RESOURCE_CONFIG_TYPE__SELECTOR;
}
-
- if(model instanceof SmooksResourceListType){
+
+ if (model instanceof SmooksResourceListType) {
return SmooksPackage.Literals.SMOOKS_RESOURCE_LIST_TYPE__DEFAULT_SELECTOR;
}
-
- if(model instanceof WiringType){
+
+ if (model instanceof WiringType) {
return JavabeanPackage.Literals.WIRING_TYPE__WIRE_ON_ELEMENT;
}
- if(model instanceof ExpressionType){
+ if (model instanceof ExpressionType) {
return JavabeanPackage.Literals.EXPRESSION_TYPE__EXEC_ON_ELEMENT;
}
- if(model instanceof ValueType){
+ if (model instanceof ValueType) {
return JavabeanPackage.Literals.VALUE_TYPE__DATA;
}
return null;
}
private String getPath(Object model) {
- if(model instanceof ExpressionType){
- return ((ExpressionType)model).getExecOnElement();
+ if (model instanceof ExpressionType) {
+ return ((ExpressionType) model).getExecOnElement();
}
- if(model instanceof ValueType){
- return ((ValueType)model).getData();
+ if (model instanceof ValueType) {
+ return ((ValueType) model).getData();
}
- if(model instanceof WiringType){
- return ((WiringType)model).getWireOnElement();
+ if (model instanceof WiringType) {
+ return ((WiringType) model).getWireOnElement();
}
- if(model instanceof SmooksResourceListType){
- return ((SmooksResourceListType)model).getDefaultSelector();
+ if (model instanceof SmooksResourceListType) {
+ return ((SmooksResourceListType) model).getDefaultSelector();
}
- if(model instanceof ResourceConfigType)
- {
- return ((ResourceConfigType)model).getSelector();
+ if (model instanceof ResourceConfigType) {
+ return ((ResourceConfigType) model).getSelector();
}
- if(model instanceof JmsRouter){
- return ((JmsRouter)model).getRouteOnElement();
+ if (model instanceof JmsRouter) {
+ return ((JmsRouter) model).getRouteOnElement();
}
- if(model instanceof GroovyUICreator){
- return ((Groovy)model).getExecuteOnElement();
+ if (model instanceof GroovyUICreator) {
+ return ((Groovy) model).getExecuteOnElement();
}
- if(model instanceof Xsl){
- return ((Xsl)model).getApplyOnElement();
+ if (model instanceof Xsl) {
+ return ((Xsl) model).getApplyOnElement();
}
if (model instanceof Counter) {
- return ((Counter)model).getCountOnElement();
+ return ((Counter) model).getCountOnElement();
}
if (model instanceof BindingsType) {
return ((BindingsType) model).getCreateOnElement();
}
- if(model instanceof Direct){
- return ((Direct)model).getBindOnElement();
+ if (model instanceof Direct) {
+ return ((Direct) model).getBindOnElement();
}
- if(model instanceof RouteBean){
- return ((RouteBean)model).getRouteOnElement();
+ if (model instanceof RouteBean) {
+ return ((RouteBean) model).getRouteOnElement();
}
- if(model instanceof OutputStream){
- return ((OutputStream)model).getOpenOnElement();
+ if (model instanceof OutputStream) {
+ return ((OutputStream) model).getOpenOnElement();
}
- if(model instanceof Freemarker){
- return ((Freemarker)model).getApplyOnElement();
+ if (model instanceof Freemarker) {
+ return ((Freemarker) model).getApplyOnElement();
}
return null;
}
Modified: trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model11/DBExtractTransformConfigFileTestCase.java
===================================================================
--- trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model11/DBExtractTransformConfigFileTestCase.java 2009-05-26 07:43:11 UTC (rev 15507)
+++ trunk/smooks/tests/org.jboss.tools.smooks.test/src/org/jboss/tools/smooks/test/model11/DBExtractTransformConfigFileTestCase.java 2009-05-26 07:44:30 UTC (rev 15508)
@@ -78,14 +78,14 @@
Assert.assertEquals("DBExtractTransformLoadDS", executor.getDatasource());
Assert.assertEquals(false, executor.isExecuteBefore());
Assert.assertEquals("INSERT INTO ORDERS VALUES(${order.orderNum}, ${order.customerUname}, ${order.status}, ${order.net}, ${order.total}, ${message.date})", executor.getStatement().trim());
- Assert.assertEquals("orderExistsRS.isEmpty()", executor.getCondition().getValue());
+ Assert.assertEquals("orderExistsRS.isEmpty()", executor.getCondition().getStringValue());
}
if(executorCount == 2){
Assert.assertEquals("order-item", executor.getExecuteOnElement());
Assert.assertEquals("DBExtractTransformLoadDS", executor.getDatasource());
Assert.assertEquals(false, executor.isExecuteBefore());
Assert.assertEquals("INSERT INTO ORDERITEMS VALUES (${order.orderNum}, ${orderItem.quantity}, ${orderItem.productId}, ${orderItem.title}, ${orderItem.price})", executor.getStatement().trim());
- Assert.assertEquals("orderExistsRS.isEmpty()", executor.getCondition().getValue());
+ Assert.assertEquals("orderExistsRS.isEmpty()", executor.getCondition().getStringValue());
}
executorCount ++;
}
14 years, 11 months