JBoss Tools SVN: r23275 - trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/factory.
by jbosstools-commits@lists.jboss.org
Author: bfitzpat
Date: 2010-07-07 09:39:36 -0400 (Wed, 07 Jul 2010)
New Revision: 23275
Modified:
trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/factory/AdapterFactory.java
Log:
[JBIDE-6472] Fix for issue with adapter factory throwing NPEs
Modified: trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/factory/AdapterFactory.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/factory/AdapterFactory.java 2010-07-07 12:58:34 UTC (rev 23274)
+++ trunk/bpel/plugins/org.eclipse.bpel.validator/src/org/eclipse/bpel/validator/factory/AdapterFactory.java 2010-07-07 13:39:36 UTC (rev 23275)
@@ -526,10 +526,13 @@
IFile getFileFromURI (URI uri) {
- if (uri.isFile()) {
- return getFileFromDeviceURI(uri);
+ if (uri != null) {
+ if (uri.isFile()) {
+ return getFileFromDeviceURI(uri);
+ }
+ return getFileFromPlatformURI(uri);
}
- return getFileFromPlatformURI(uri);
+ return null;
}
IFile getFileFromDeviceURI(URI uri) {
15 years, 9 months
JBoss Tools SVN: r23274 - trunk/jsf/plugins/org.jboss.tools.jsf.vpe.facelets/src/org/jboss/tools/jsf/vpe/facelets/template.
by jbosstools-commits@lists.jboss.org
Author: dvinnichek
Date: 2010-07-07 08:58:34 -0400 (Wed, 07 Jul 2010)
New Revision: 23274
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.facelets/src/org/jboss/tools/jsf/vpe/facelets/template/VpeDefineTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.facelets/src/org/jboss/tools/jsf/vpe/facelets/template/VpeInsertTemplate.java
Log:
fix templates for facelets according to JBIDE-6542
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.facelets/src/org/jboss/tools/jsf/vpe/facelets/template/VpeDefineTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.facelets/src/org/jboss/tools/jsf/vpe/facelets/template/VpeDefineTemplate.java 2010-07-07 12:55:44 UTC (rev 23273)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.facelets/src/org/jboss/tools/jsf/vpe/facelets/template/VpeDefineTemplate.java 2010-07-07 12:58:34 UTC (rev 23274)
@@ -62,10 +62,10 @@
private VpeCreationData createStub(Element sourceElement, nsIDOMDocument visualDocument) {
nsIDOMElement container = visualDocument.createElement(HTML.TAG_DIV);
container.setAttribute(HTML.ATTR_STYLE, "border: 1px solid gray"); //$NON-NLS-1$
-
- String name = sourceElement.getAttribute(Facelets.ATTR_NAME);
+
final String message;
- if (name != null) {
+ if (sourceElement.hasAttribute(Facelets.ATTR_NAME)) {
+ String name = sourceElement.getAttribute(Facelets.ATTR_NAME);
message = NLS.bind(Messages.UNKNOWN_NAME, name);
} else {
message = Messages.NAME_NOT_SPECIFIED;
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.facelets/src/org/jboss/tools/jsf/vpe/facelets/template/VpeInsertTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.facelets/src/org/jboss/tools/jsf/vpe/facelets/template/VpeInsertTemplate.java 2010-07-07 12:55:44 UTC (rev 23273)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.facelets/src/org/jboss/tools/jsf/vpe/facelets/template/VpeInsertTemplate.java 2010-07-07 12:58:34 UTC (rev 23274)
@@ -20,6 +20,7 @@
import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
+import org.jboss.tools.vpe.editor.util.Constants;
import org.jboss.tools.vpe.editor.util.HTML;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
@@ -38,20 +39,19 @@
protected void init(Element templateElement) {
children = true;
modify = false;
- this.defineElementName = templateElement.getAttribute(DEFINE_ELEMENT_NAME_PARAM)!=null?templateElement.getAttribute(DEFINE_ELEMENT_NAME_PARAM):Facelets.TAG_DEFINE;
+ this.defineElementName = templateElement.hasAttribute(DEFINE_ELEMENT_NAME_PARAM) ?
+ templateElement.getAttribute(DEFINE_ELEMENT_NAME_PARAM) : Facelets.TAG_DEFINE;
initTemplateSections(templateElement, false, true, false, false, false);
}
public VpeCreationData create(VpePageContext pageContext, Node sourceNode, nsIDOMDocument visualDocument) {
VpeVisualDomBuilder visualBuilder = pageContext.getVisualBuilder();
VpeIncludeInfo includeInfo = visualBuilder.getCurrentIncludeInfo();
+ Element sourceElement = (Element)sourceNode;
if (includeInfo != null && includeInfo.getElement() != null) {
- String name = ((Element)sourceNode).getAttribute(Facelets.ATTR_NAME);
- if (name != null) {
- name = name.trim();
- if (name.length() <= 0) name = null;
- }
- if (name != null) {
+ String name = sourceElement.hasAttribute(Facelets.ATTR_NAME) ?
+ sourceElement.getAttribute(Facelets.ATTR_NAME).trim() : Constants.EMPTY;
+ if (name.length() > 0) {
Element defineElement = findDefineElement(includeInfo.getElement(), name);
if (defineElement != null) {
VpeCreationData creationData = createInsert(defineElement, visualDocument);
@@ -72,7 +72,7 @@
return creationData;
}
}
- VpeCreationData creationData = createStub((Element)sourceNode, visualDocument);
+ VpeCreationData creationData = createStub(sourceElement, visualDocument);
creationData.setData(null);
return creationData;
}
15 years, 9 months
JBoss Tools SVN: r23273 - trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config.
by jbosstools-commits@lists.jboss.org
Author: lzoubek(a)redhat.com
Date: 2010-07-07 08:55:44 -0400 (Wed, 07 Jul 2010)
New Revision: 23273
Modified:
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/TestConfiguration.java
trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/TestConfigurator.java
Log:
SWTBot ext: fixed NPE when loading test config
Modified: trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/TestConfiguration.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/TestConfiguration.java 2010-07-07 12:53:56 UTC (rev 23272)
+++ trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/TestConfiguration.java 2010-07-07 12:55:44 UTC (rev 23273)
@@ -32,7 +32,7 @@
public TestConfiguration(String propName, String propFile) throws Exception {
this.propName = propName;
this.propFile = propFile;
- if (propFile != null) {
+ if (!"".equals(propFile)) {
if (new File(propFile).exists()) {
log.info("Loading configuration file '" + propFile + "'");
swtTestProperties.load(new FileInputStream(propFile));
Modified: trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/TestConfigurator.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/TestConfigurator.java 2010-07-07 12:53:56 UTC (rev 23272)
+++ trunk/jst/tests/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/TestConfigurator.java 2010-07-07 12:55:44 UTC (rev 23273)
@@ -58,8 +58,22 @@
throw new IOException(SWTBOT_TEST_PROPERTIES_MULTI_FILE + " "
+ propMultiFile + " does not exist!");
}
- } else {
- multiProperties.put(SWTBOT_TEST_PROPERTIES_FILE, propFile);
+ }
+ else if (propFile!=null) {
+ if (new File(propFile).exists()) {
+ log
+ .info("Loading exeternaly configuration file '"
+ + propFile + "'");
+ multiProperties.put(SWTBOT_TEST_PROPERTIES_FILE, propFile);
+ }
+ else {
+ throw new IOException(SWTBOT_TEST_PROPERTIES_FILE + " "
+ + propFile + " does not exist!");
+ }
+ }
+ else {
+ log.info("No configuration property passed, using default");
+ multiProperties.put(SWTBOT_TEST_PROPERTIES_FILE, "");
}
15 years, 9 months
JBoss Tools SVN: r23272 - in trunk/hibernatetools: plugins/org.hibernate.eclipse/src/org/hibernate/console and 12 other directories.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2010-07-07 08:53:56 -0400 (Wed, 07 Jul 2010)
New Revision: 23272
Added:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/icons/images/ant_codegen_export.gif
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/codegen/
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/codegen/ExportAntCodeGenWizard.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/codegen/ExportAntCodeGenWizardPage.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenXMLFactory.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationXMLFactory.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/specimen/
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/specimen/AntCodeGenReveng_test1.xml
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/specimen/AntCodeGenReveng_test2.xml
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/specimen/AntCodeGen_test1.xml
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/specimen/AntCodeGen_test2.xml
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/CodeGenXMLFactoryTest.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/launchcfg/
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/launchcfg/TestConsoleConfigurationPreferences.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/launchcfg/TestLaunchConfig.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/launchcfg/TestWorkingCopy.java
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/plugin.properties
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/plugin.xml
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.properties
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterDefinition.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterFactory.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ExporterAttributes.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/.classpath
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/eclipse/HibernatePlugin.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsoleConfigurationTest.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/QueryParametersTest.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/RefactoringTest.java
Log:
https://jira.jboss.org/browse/JBIDE-6518 - initial implementation Ant codegen export
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse/.classpath
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse/.classpath 2010-07-07 08:43:22 UTC (rev 23271)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse/.classpath 2010-07-07 12:53:56 UTC (rev 23272)
@@ -6,7 +6,7 @@
<classpathentry exported="true" kind="lib" path="lib/hibernate/asm.jar"/>
<classpathentry exported="true" kind="lib" path="lib/hibernate/asm-attrs.jar"/>
<classpathentry exported="true" kind="lib" path="lib/hibernate/dom4j-1.6.1.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/hibernate/hibernate3.jar" sourcepath="C:/Temp/_hibernate/hibernate-core-3.3.2.GA-sources.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/hibernate/hibernate3.jar"/>
<classpathentry exported="true" kind="lib" path="lib/hibernate/jboss-cache.jar"/>
<classpathentry exported="true" kind="lib" path="lib/hibernate/jboss-common.jar"/>
<classpathentry exported="true" kind="lib" path="lib/hibernate/jboss-jmx.jar"/>
@@ -21,13 +21,13 @@
<classpathentry exported="true" kind="lib" path="lib/annotations/hibernate-annotations.jar"/>
<classpathentry exported="true" kind="lib" path="lib/hibernate/jgroups-2.2.8.jar"/>
<classpathentry exported="true" kind="lib" path="lib/hibernate/antlr-2.7.6.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/annotations/hibernate-entitymanager.jar" sourcepath="C:/Temp/_hibernate/hibernate-entitymanager-3.4.0.GA-sources.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/annotations/hibernate-entitymanager.jar"/>
<classpathentry exported="true" kind="lib" path="lib/hibernate/javassist.jar"/>
<classpathentry exported="true" kind="lib" path="lib/annotations/hibernate-validator.jar"/>
<classpathentry exported="true" kind="lib" path="lib/hibernate/log4j-1.2.15.jar"/>
<classpathentry exported="true" kind="lib" path="lib/hibernate/hibernate-jmx.jar"/>
<classpathentry exported="true" kind="lib" path="lib/hibernate/commons-collections-3.1.jar"/>
- <classpathentry exported="true" kind="lib" path="lib/hibernate/slf4j-api-1.5.8.jar" sourcepath="D:/Temp/_hibernate/slf4j-api-1.5.8-sources.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/hibernate/slf4j-api-1.5.8.jar"/>
<classpathentry exported="true" kind="lib" path="lib/hibernate/cglib-2.2.jar"/>
<classpathentry exported="true" kind="lib" path="lib/annotations/hibernate-commons-annotations.jar"/>
<classpathentry exported="true" kind="lib" path="lib/annotations/ejb3-persistence.jar"/>
Added: trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationXMLFactory.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationXMLFactory.java (rev 0)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationXMLFactory.java 2010-07-07 12:53:56 UTC (rev 23272)
@@ -0,0 +1,143 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.hibernate.console;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Properties;
+
+import org.dom4j.Document;
+import org.dom4j.DocumentFactory;
+import org.dom4j.Element;
+import org.dom4j.io.OutputFormat;
+import org.dom4j.io.XMLWriter;
+import org.hibernate.console.preferences.ConsoleConfigurationPreferences;
+import org.hibernate.console.preferences.ConsoleConfigurationPreferences.ConfigurationMode;
+import org.hibernate.util.StringHelper;
+
+/**
+ * XML document part creation factory,
+ * responsible for creation Hibernate Configuration part for
+ * Hibernate Tools core Ant code generation.
+ *
+ * @author Vitali Yemialyanchyk
+ */
+public class ConfigurationXMLFactory {
+ protected ConsoleConfigurationPreferences prefs;
+ protected Properties additional;
+
+ public ConfigurationXMLFactory(ConsoleConfigurationPreferences prefs, Properties additional) {
+ this.prefs = prefs;
+ this.additional = additional;
+ }
+
+ public ConsoleConfigurationPreferences getPreferences() {
+ return prefs;
+ }
+
+ public Document createXML(boolean includeMappings) {
+ Document res = DocumentFactory.getInstance().createDocument();
+ Element root = createRoot(includeMappings);
+ res.setRootElement(root);
+ return res;
+ }
+
+ public Element createRoot(boolean includeMappings) {
+ Properties properties = prefs.getProperties();
+ Element root = createRoot(properties, includeMappings);
+ return root;
+ }
+
+ protected Element createRoot(Properties properties, boolean includeMappings) {
+ String rootName = null;
+ Boolean jdbcConfig = Boolean.valueOf(additional.getProperty("isRevEng", "false")); //$NON-NLS-1$ //$NON-NLS-2$
+ if (jdbcConfig) {
+ rootName = "jdbcconfiguration"; //$NON-NLS-1$
+ } else if (prefs.getConfigurationMode().equals(ConfigurationMode.ANNOTATIONS)) {
+ rootName = "annotationconfiguration"; //$NON-NLS-1$
+ } else if (prefs.getConfigurationMode().equals(ConfigurationMode.JPA)) {
+ rootName = "jpaconfiguration"; //$NON-NLS-1$
+ } else if (prefs.getConfigurationMode().equals(ConfigurationMode.CORE)) {
+ rootName = "configuration"; //$NON-NLS-1$
+ } else {
+ rootName = "undef"; //$NON-NLS-1$
+ }
+ Element root = DocumentFactory.getInstance().createElement(rootName);
+ final String configurationFile = getPreferences().getConfigXMLFile() == null ? null :
+ getPreferences().getConfigXMLFile().toString();
+ if (!StringHelper.isEmpty(configurationFile)) {
+ root.addAttribute("configurationFile", configurationFile); //$NON-NLS-1$
+ }
+ final String propertyFile = getPreferences().getPropertyFile() == null ? null :
+ getPreferences().getPropertyFile().toString();
+ if (!StringHelper.isEmpty(propertyFile)) {
+ root.addAttribute("propertyFile", propertyFile); //$NON-NLS-1$
+ }
+ final String entityResolver = getPreferences().getEntityResolverName();
+ if (!StringHelper.isEmpty(entityResolver)) {
+ root.addAttribute("entityResolver", entityResolver); //$NON-NLS-1$
+ }
+ final String persistenceUnit = getPreferences().getPersistenceUnitName();
+ if (!StringHelper.isEmpty(persistenceUnit)) {
+ root.addAttribute("persistenceUnit", persistenceUnit); //$NON-NLS-1$
+ }
+ final String detectManyToMany = additional.getProperty("detectManyToMany", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ if (!StringHelper.isEmpty(detectManyToMany)) {
+ root.addAttribute("detectManyToMany", detectManyToMany); //$NON-NLS-1$
+ }
+ final String detectOneToOne = additional.getProperty("detectOneToOne", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ if (!StringHelper.isEmpty(detectOneToOne)) {
+ root.addAttribute("detectOneToOne", detectOneToOne); //$NON-NLS-1$
+ }
+ final String detectOptimisticLock = additional.getProperty("detectOptimisticLock", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ if (!StringHelper.isEmpty(detectOptimisticLock)) {
+ root.addAttribute("detectOptimisticLock", detectOptimisticLock); //$NON-NLS-1$
+ }
+ final String packageName = additional.getProperty("packageName", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ if (!StringHelper.isEmpty(packageName)) {
+ root.addAttribute("packageName", packageName); //$NON-NLS-1$
+ }
+ final String revEngFile = additional.getProperty("revEngFile", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ if (!StringHelper.isEmpty(revEngFile)) {
+ root.addAttribute("revEngFile", revEngFile); //$NON-NLS-1$
+ }
+ final String reverseStrategy = additional.getProperty("reverseStrategy", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ if (!StringHelper.isEmpty(reverseStrategy)) {
+ root.addAttribute("reverseStrategy", reverseStrategy); //$NON-NLS-1$
+ }
+ if (includeMappings) {
+ Element fileset = root.addElement("fileset"); //$NON-NLS-1$
+ fileset.addAttribute("dir", "./src"); //$NON-NLS-1$ //$NON-NLS-2$
+ fileset.addAttribute("id", "id"); //$NON-NLS-1$ //$NON-NLS-2$
+ Element include = fileset.addElement("include"); //$NON-NLS-1$
+ include.addAttribute("name", "**/*"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ return root;
+ }
+
+ public static void dump(OutputStream os, Element element) {
+ try {
+ // try to "pretty print" it
+ OutputFormat outformat = OutputFormat.createPrettyPrint();
+ XMLWriter writer = new XMLWriter(os, outformat);
+ writer.write(element);
+ writer.flush();
+ } catch (Throwable t) {
+ // otherwise, just dump it
+ try {
+ os.write(element.asXML().getBytes());
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+
+ }
+}
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/eclipse/HibernatePlugin.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/eclipse/HibernatePlugin.java 2010-07-07 08:43:22 UTC (rev 23271)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/eclipse/HibernatePlugin.java 2010-07-07 12:53:56 UTC (rev 23272)
@@ -21,10 +21,15 @@
*/
package org.hibernate.eclipse;
+import java.io.File;
+import java.io.IOException;
import java.net.URL;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Plugin;
import org.hibernate.eclipse.logging.LoggingHelper;
import org.hibernate.eclipse.logging.PluginLogManager;
@@ -32,37 +37,65 @@
/**
* @author max
- *
*/
public class HibernatePlugin extends Plugin {
+ // The shared instance.
+ private static HibernatePlugin plugin;
+
+ /**
+ * The constructor.
+ */
+ public HibernatePlugin() {
+ super();
+ setPlugin(this);
+ }
+
public void start(BundleContext context) throws Exception {
super.start(context);
configureLog4jHooks();
Log log = LogFactory.getLog(HibernatePlugin.class);
- log.info("HibernatePlugin Started"); //$NON-NLS-1$
+ log.info("HibernatePlugin Started"); //$NON-NLS-1$
}
-
+
private void configureLog4jHooks() {
URL entry = getBundle().getEntry("hibernate-log4j.xml"); //$NON-NLS-1$
- if(entry==null) {
- entry = getBundle().getEntry("hibernate-log4j.properties"); //$NON-NLS-1$
+ if (entry == null) {
+ entry = getBundle().getEntry("hibernate-log4j.properties"); //$NON-NLS-1$
}
-
- if(entry==null) {
+
+ if (entry == null) {
// should log this!
} else {
LoggingHelper helper = LoggingHelper.getDefault();
- PluginLogManager manager = new PluginLogManager(this, helper, entry);
+ PluginLogManager manager = new PluginLogManager(this, helper, entry);
}
-
-
-
-
}
public void stop(BundleContext context) throws Exception {
LoggingHelper.getDefault().stop(context);
- super.stop( context );
+ super.stop(context);
+ setPlugin(null);
}
+
+ /**
+ * Returns the shared instance.
+ */
+ public static HibernatePlugin getDefault() {
+ return plugin;
+ }
+
+ private static void setPlugin(HibernatePlugin plugin) {
+ HibernatePlugin.plugin = plugin;
+ }
+
+ public static File getResourceItem(String strResPath) throws IOException {
+ IPath resourcePath = new Path(strResPath);
+ File resourceFolder = resourcePath.toFile();
+ URL entry = getDefault().getBundle().getEntry(strResPath);
+ URL resProject = FileLocator.resolve(entry);
+ String tplPrjLcStr = FileLocator.resolve(resProject).getFile();
+ resourceFolder = new File(tplPrjLcStr);
+ return resourceFolder;
+ }
}
Added: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/icons/images/ant_codegen_export.gif
===================================================================
(Binary files differ)
Property changes on: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/icons/images/ant_codegen_export.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/plugin.properties
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/plugin.properties 2010-07-07 08:43:22 UTC (rev 23271)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/plugin.properties 2010-07-07 12:53:56 UTC (rev 23272)
@@ -9,3 +9,5 @@
Bundle-Vendor.0 = JBoss by Red Hat
Bundle-Name.0 = Hibernate Console
#NavigatorContent_HibernateKnownConfigs=Hibernate Known Configurations
+exportHibernateAntCodeGenerationWizardName=Ant Code Generation
+exportHibernateAntCodeGenerationWizardDescription=Export Hibernate Code Generation Configuration to Ant Code Generation script
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/plugin.xml
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/plugin.xml 2010-07-07 08:43:22 UTC (rev 23271)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/plugin.xml 2010-07-07 12:53:56 UTC (rev 23272)
@@ -749,6 +749,23 @@
label="%GenerateEntities">
</action>-->
</extension>
+ <extension
+ point="org.eclipse.ui.exportWizards">
+ <wizard
+ category="org.hibernate.eclipse.console.HibernateToolsExport"
+ class="org.hibernate.eclipse.codegen.ExportAntCodeGenWizard"
+ icon="icons/images/ant_codegen_export.gif"
+ id="org.hibernate.eclipse.codegen.ExportAntCodeGenWizard"
+ name="%exportHibernateAntCodeGenerationWizardName">
+ <description>
+ %exportHibernateAntCodeGenerationWizardDescription
+ </description>
+ </wizard>
+ <category
+ id="org.hibernate.eclipse.console.HibernateToolsExport"
+ name="Hibernate">
+ </category>
+ </extension>
<!-- <extension
point="org.eclipse.ui.themes">
<themeElementCategory
Added: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/codegen/ExportAntCodeGenWizard.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/codegen/ExportAntCodeGenWizard.java (rev 0)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/codegen/ExportAntCodeGenWizard.java 2010-07-07 12:53:56 UTC (rev 23272)
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.hibernate.eclipse.codegen;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.IExportWizard;
+import org.eclipse.ui.IWorkbench;
+import org.hibernate.eclipse.console.HibernateConsoleMessages;
+import org.hibernate.eclipse.console.HibernateConsolePlugin;
+
+/**
+ * Export wizard responsible to generate Ant code generation script
+ * from existing Hibernate Tools code generation launch configuration.
+ *
+ * @author Vitali Yemialyanchyk
+ */
+public class ExportAntCodeGenWizard extends Wizard implements IExportWizard {
+
+ protected ExportAntCodeGenWizardPage exportAntCodeGenWizardPage = null;
+ /**
+ * The workbench.
+ */
+ private IWorkbench workbench;
+ /**
+ * The current selection.
+ */
+ protected IStructuredSelection selection;
+
+ /**
+ * Creates a wizard for creating a new file resource in the workspace.
+ */
+ public ExportAntCodeGenWizard() {
+ setWindowTitle(HibernateConsoleMessages.ExportAntCodeGenWizard_title);
+ ImageDescriptor descriptor = HibernateConsolePlugin.getImageDescriptor("icons/images/newhibernate_wiz.gif"); //$NON-NLS-1$
+ setDefaultPageImageDescriptor(descriptor);
+ }
+
+ /* (non-Javadoc)
+ * Method declared on IWizard.
+ */
+ public boolean performFinish() {
+ IFile file = exportAntCodeGenWizardPage.createNewFile();
+ if (file == null || file.getParent() == null) {
+ return false;
+ }
+ try {
+ file.getParent().refreshLocal(IResource.DEPTH_ZERO, null);
+ } catch (CoreException e) {
+ HibernateConsolePlugin.getDefault()
+ .logErrorMessage("Refresh parent: ", e); //$NON-NLS-1$
+ }
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * Method declared on IWizard.
+ */
+ public void addPages() {
+ exportAntCodeGenWizardPage = new ExportAntCodeGenWizardPage(
+ HibernateConsoleMessages.ExportAntCodeGenWizard_page_name, getSelection());
+ exportAntCodeGenWizardPage.setTitle(HibernateConsoleMessages.ExportAntCodeGenWizard_title);
+ exportAntCodeGenWizardPage.setDescription(HibernateConsoleMessages.ExportAntCodeGenWizard_description);
+ exportAntCodeGenWizardPage.setFileExtension("xml"); //$NON-NLS-1$
+ addPage(exportAntCodeGenWizardPage);
+ }
+
+ /* (non-Javadoc)
+ * Method declared on IWorkbenchWizard.
+ */
+ public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
+ this.workbench = workbench;
+ this.selection = currentSelection;
+ setWindowTitle(HibernateConsoleMessages.ExportAntCodeGenWizard_title);
+ ImageDescriptor descriptor = HibernateConsolePlugin.getImageDescriptor("icons/images/newhibernate_wiz.gif"); //$NON-NLS-1$
+ setDefaultPageImageDescriptor(descriptor);
+ }
+
+ /**
+ * Returns the selection which was passed to <code>init</code>.
+ *
+ * @return the selection
+ */
+ public IStructuredSelection getSelection() {
+ return selection;
+ }
+
+ /**
+ * Returns the workbench which was passed to <code>init</code>.
+ *
+ * @return the workbench
+ */
+ public IWorkbench getWorkbench() {
+ return workbench;
+ }
+}
Added: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/codegen/ExportAntCodeGenWizardPage.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/codegen/ExportAntCodeGenWizardPage.java (rev 0)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/codegen/ExportAntCodeGenWizardPage.java 2010-07-07 12:53:56 UTC (rev 23272)
@@ -0,0 +1,163 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.hibernate.eclipse.codegen;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+
+import org.dom4j.Element;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.jdt.internal.ui.wizards.dialogfields.ComboDialogField;
+import org.eclipse.jdt.internal.ui.wizards.dialogfields.DialogField;
+import org.eclipse.jdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
+import org.hibernate.console.ConfigurationXMLFactory;
+import org.hibernate.eclipse.console.HibernateConsoleMessages;
+import org.hibernate.eclipse.console.HibernateConsolePlugin;
+import org.hibernate.eclipse.console.utils.LaunchHelper;
+import org.hibernate.eclipse.launch.CodeGenXMLFactory;
+
+/**
+ * @author Vitali Yemialyanchyk
+ */
+@SuppressWarnings("restriction")
+public class ExportAntCodeGenWizardPage extends WizardNewFileCreationPage implements Listener {
+
+ protected ComboDialogField consoleConfigurationName;
+
+ /**
+ * Creates a new file creation (Ant code generation) wizard page.
+ * If the initial resource selection contains exactly one
+ * container resource then it will be used as
+ * the default container resource.
+ *
+ * @param pageName
+ * the name of the page
+ * @param selection
+ * the current resource selection
+ */
+ public ExportAntCodeGenWizardPage(String pageName,
+ IStructuredSelection selection) {
+ super(pageName, selection);
+ setPageComplete(false);
+ }
+
+ /**
+ * @see #setControl(Control)
+ */
+ protected void setControl(Control newControl) {
+ newControl.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL
+ | GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
+ super.setControl(newControl);
+ }
+
+ /**
+ * @see #createControl(Composite)
+ */
+ public void createControl(Composite parent) {
+ initializeDialogUnits(parent);
+ Composite topLevel = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ layout.marginWidth = 0;
+ topLevel.setLayout(layout);
+ topLevel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL
+ | GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
+ topLevel.setFont(parent.getFont());
+ setControlCombo(topLevel);
+ super.createControl(topLevel);
+ setControl(topLevel);
+ }
+
+ protected void setControlCombo(Control newControl) {
+ consoleConfigurationName = new ComboDialogField(SWT.READ_ONLY);
+ consoleConfigurationName.setLabelText(
+ HibernateConsoleMessages.ExportAntCodeGenWizardPage_hibernate_code_generation_configurations);
+ ILaunchConfiguration[] launchCfgs;
+ try {
+ launchCfgs = LaunchHelper.findFilteredCodeGenerationConfigs();
+ } catch (CoreException e) {
+ launchCfgs = new ILaunchConfiguration[0];
+ }
+ String[] names = new String[launchCfgs.length];
+ for (int i = 0; i < launchCfgs.length; i++) {
+ ILaunchConfiguration launchCfg = launchCfgs[i];
+ names[i] = launchCfg.getName();
+ }
+ consoleConfigurationName.setItems(names);
+ IDialogFieldListener fieldlistener = new IDialogFieldListener() {
+ public void dialogFieldChanged(DialogField field) {
+ setPageComplete(validatePage());
+ }
+ };
+ consoleConfigurationName.setDialogFieldListener(fieldlistener);
+ consoleConfigurationName.doFillIntoGrid((Composite)newControl, 2);
+ }
+
+ /**
+ * @see #validatePage()
+ */
+ protected boolean validatePage() {
+ boolean res = super.validatePage();
+ if (res) {
+ if (consoleConfigurationName.getSelectionIndex() == -1) {
+ setErrorMessage(HibernateConsoleMessages.ExportAntCodeGenWizardPage_empty_hibernate_code_generation_configuration);
+ res = false;
+ }
+ }
+ return res;
+ }
+
+ public ILaunchConfiguration getSelectedLaunchConfig() {
+ ILaunchConfiguration[] launchCfgs;
+ try {
+ launchCfgs = LaunchHelper.findFilteredCodeGenerationConfigs();
+ } catch (CoreException e) {
+ launchCfgs = new ILaunchConfiguration[0];
+ }
+ int n = consoleConfigurationName.getSelectionIndex();
+ if (0 <= n && n < launchCfgs.length) {
+ return launchCfgs[n];
+ }
+ return null;
+ }
+
+ protected InputStream getInitialContents() {
+ ILaunchConfiguration lc = getSelectedLaunchConfig();
+ if (lc == null) {
+ return null;
+ }
+ CodeGenXMLFactory cgfXML = new CodeGenXMLFactory(lc);
+ Element rootBuildXml = cgfXML.createRoot();
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ConfigurationXMLFactory.dump(baos, rootBuildXml);
+ //
+ ByteArrayInputStream bais = null;
+ try {
+ bais = new ByteArrayInputStream(baos.toString().getBytes("UTF-8")); //$NON-NLS-1$
+ } catch (UnsupportedEncodingException uec) {
+ HibernateConsolePlugin.getDefault()
+ .logErrorMessage("Problems converting to UTF-8", uec); //$NON-NLS-1$
+ bais = new ByteArrayInputStream(baos.toString().getBytes());
+ }
+ return bais;
+ }
+}
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.java 2010-07-07 08:43:22 UTC (rev 23271)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.java 2010-07-07 12:53:56 UTC (rev 23272)
@@ -515,6 +515,12 @@
public static String AddRemoveTableComposite_no_dependencies;
public static String AddRemoveTableComposite_control_depth_level;
+
+ public static String ExportAntCodeGenWizard_title;
+ public static String ExportAntCodeGenWizard_description;
+ public static String ExportAntCodeGenWizard_page_name;
+ public static String ExportAntCodeGenWizardPage_hibernate_code_generation_configurations;
+ public static String ExportAntCodeGenWizardPage_empty_hibernate_code_generation_configuration;
//
static {
// initialize resource bundle
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.properties
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.properties 2010-07-07 08:43:22 UTC (rev 23271)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsoleMessages.properties 2010-07-07 12:53:56 UTC (rev 23272)
@@ -515,3 +515,9 @@
AddRemoveTableComposite_no_dependencies=no dependencies
AddRemoveTableComposite_control_depth_level=depth control
+
+ExportAntCodeGenWizard_title=Export Hibernate Code Generation Configuration to Ant Script
+ExportAntCodeGenWizard_description=Export Hibernate Code Generation Configuration to Ant Script \n(create Ant build.xml)
+ExportAntCodeGenWizard_page_name=Export Hibernate Code Generation Configuration to Ant Script
+ExportAntCodeGenWizardPage_hibernate_code_generation_configurations=Hibernate Code Generation Configurations:
+ExportAntCodeGenWizardPage_empty_hibernate_code_generation_configuration=Hibernate Code Generation Configuration is empty
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterDefinition.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterDefinition.java 2010-07-07 08:43:22 UTC (rev 23271)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterDefinition.java 2010-07-07 12:53:56 UTC (rev 23272)
@@ -167,5 +167,7 @@
return id;
}
-
+ public String getExporterTag() {
+ return getId().substring(getId().lastIndexOf(".") + 1); //$NON-NLS-1$
+ }
}
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterFactory.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterFactory.java 2010-07-07 08:43:22 UTC (rev 23271)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/model/impl/ExporterFactory.java 2010-07-07 12:53:56 UTC (rev 23272)
@@ -18,6 +18,7 @@
import org.hibernate.cfg.Configuration;
import org.hibernate.console.HibernateConsoleRuntimeException;
import org.hibernate.eclipse.console.HibernateConsoleMessages;
+import org.hibernate.eclipse.launch.ExporterAttributes;
import org.hibernate.eclipse.launch.HibernateLaunchConstants;
import org.hibernate.eclipse.launch.PathHelper;
import org.hibernate.tool.hbm2x.ArtifactCollector;
@@ -84,11 +85,6 @@
return definition;
}
- // todo: move to ExporterAttributes together with isEnabled functionallity...
- String getLaunchAttributePrefix(String exporterId) {
- return HibernateLaunchConstants.ATTR_EXPORTERS + "." + exporterId; //$NON-NLS-1$
- }
-
public boolean isEnabled(ILaunchConfiguration configuration) {
boolean enabled = false;
@@ -96,7 +92,7 @@
if(configuration.getAttribute(HibernateLaunchConstants.ATTR_EXPORTERS, (List<String>)null)==null) {
enabled = configuration.getAttribute( getId(), false );
} else {
- enabled = configuration.getAttribute( getLaunchAttributePrefix( getId() ), false );
+ enabled = configuration.getAttribute(ExporterAttributes.getLaunchAttributePrefix(getId()), false);
}
} catch(CoreException ce) {
// ignore; assume false
@@ -112,7 +108,7 @@
if(oldSettings) {
configuration.setAttribute( getId(), isEnabled() );
} else {
- configuration.setAttribute( getLaunchAttributePrefix( getId() ), isEnabled());
+ configuration.setAttribute(ExporterAttributes.getLaunchAttributePrefix(getId()), isEnabled());
}
}
@@ -140,6 +136,10 @@
return exporterId;
}
+ public String getExporterTag() {
+ return definition.getExporterTag();
+ }
+
public void setProperties(Map<String, String> props) {
inputProperties.clear();
inputProperties.putAll( props );
Added: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenXMLFactory.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenXMLFactory.java (rev 0)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenXMLFactory.java 2010-07-07 12:53:56 UTC (rev 23272)
@@ -0,0 +1,163 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.hibernate.eclipse.launch;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.dom4j.DocumentFactory;
+import org.dom4j.Element;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.hibernate.console.ConfigurationXMLFactory;
+import org.hibernate.console.ConnectionProfileUtil;
+import org.hibernate.console.ConsoleConfiguration;
+import org.hibernate.console.KnownConfigurations;
+import org.hibernate.console.preferences.ConsoleConfigurationPreferences;
+import org.hibernate.eclipse.console.model.impl.ExporterFactory;
+import org.hibernate.eclipse.console.model.impl.ExporterProperty;
+
+/**
+ * XML document part creation factory,
+ * responsible for creation whole Ant code generation script for
+ * Hibernate Tools.
+ *
+ * @author Vitali Yemialyanchyk
+ */
+public class CodeGenXMLFactory {
+ protected ILaunchConfiguration lc = null;
+
+ public CodeGenXMLFactory(ILaunchConfiguration lc) {
+ this.lc = lc;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Element createRoot() {
+ ExporterAttributes attributes = null;
+ try {
+ attributes = new ExporterAttributes(lc);
+ } catch (CoreException e) {
+ // ignore
+ }
+ if (attributes == null) {
+ return null;
+ }
+ Properties props = new Properties();
+ if (attributes.isReverseEngineer()) {
+ props.setProperty("isRevEng", Boolean.toString(attributes.isReverseEngineer())); //$NON-NLS-1$
+ props.setProperty("packageName", attributes.getPackageName()); //$NON-NLS-1$
+ props.setProperty("detectManyToMany", Boolean.toString(attributes.detectManyToMany())); //$NON-NLS-1$
+ props.setProperty("detectOneToOne", Boolean.toString(attributes.detectOneToOne())); //$NON-NLS-1$
+ props.setProperty("detectOptimisticLock", Boolean.toString(attributes.detectOptimisticLock())); //$NON-NLS-1$
+ props.setProperty("reverseStrategy", attributes.getRevengStrategy()); //$NON-NLS-1$
+ String revEngFile = getResLocation(attributes.getRevengSettings());
+ props.setProperty("revEngFile", revEngFile); //$NON-NLS-1$
+ }
+ String consoleConfigName = attributes.getConsoleConfigurationName();
+ ConsoleConfigurationPreferences consoleConfigPrefs =
+ getConsoleConfigPreferences(consoleConfigName);
+ ConfigurationXMLFactory csfXML = new ConfigurationXMLFactory(
+ consoleConfigPrefs, props);
+ Element rootConsoleConfig = csfXML.createRoot(false);
+ //
+ Element root = DocumentFactory.getInstance().createElement("project"); //$NON-NLS-1$
+ root.addAttribute("name", "CodeGen"); //$NON-NLS-1$ //$NON-NLS-2$
+ String defaultTargetName = "JdbcCodeGen"; //$NON-NLS-1$
+ root.addAttribute("default", defaultTargetName); //$NON-NLS-1$
+ Element el = root.addElement("property"); //$NON-NLS-1$
+ el.addAttribute("name", "build.dir"); //$NON-NLS-1$ //$NON-NLS-2$
+ String location = getResLocation(attributes.getOutputPath());
+ el.addAttribute("location", location); //$NON-NLS-1$
+ el = root.addElement("property"); //$NON-NLS-1$
+ el.addAttribute("name", "jdbc.driver"); //$NON-NLS-1$ //$NON-NLS-2$
+ String driverURL = getConnectionProfileDriverURL(consoleConfigPrefs.getConnectionProfileName());
+ el.addAttribute("location", driverURL); //$NON-NLS-1$
+ //
+ Element target = root.addElement("target"); //$NON-NLS-1$
+ target.addAttribute("name", defaultTargetName); //$NON-NLS-1$
+ //
+ Element taskdef = target.addElement("taskdef"); //$NON-NLS-1$
+ taskdef.addAttribute("name", "hibernatetool"); //$NON-NLS-1$ //$NON-NLS-2$
+ taskdef.addAttribute("classname", "org.hibernate.tool.ant.HibernateToolTask"); //$NON-NLS-1$ //$NON-NLS-2$
+ //
+ Element hibernatetool = target.addElement("hibernatetool"); //$NON-NLS-1$
+ hibernatetool.addAttribute("destdir", "${build.dir}"); //$NON-NLS-1$ //$NON-NLS-2$
+ hibernatetool.content().add(rootConsoleConfig);
+ //
+ Properties globalProps = new Properties();
+ globalProps.put("ejb3", "" + attributes.isEJB3Enabled()); //$NON-NLS-1$ //$NON-NLS-2$
+ globalProps.put("jdk5", "" + attributes.isJDK5Enabled()); //$NON-NLS-1$//$NON-NLS-2$
+ List<ExporterFactory> exporterFactories = attributes.getExporterFactories();
+ for (Iterator<ExporterFactory> iter = exporterFactories.iterator(); iter.hasNext();) {
+ ExporterFactory ef = iter.next();
+ if (!ef.isEnabled(lc)) {
+ continue;
+ }
+ Map<String, ExporterProperty> defExpProps = ef.getDefaultExporterProperties();
+ String expName = ef.getExporterTag();
+ Element exporter = hibernatetool.addElement(expName);
+ Properties expProps = new Properties();
+ expProps.putAll(globalProps);
+ expProps.putAll(ef.getProperties());
+ for (Map.Entry<String, ExporterProperty> name2prop : defExpProps.entrySet()) {
+ Object val = expProps.get(name2prop.getKey());
+ if (val == null || 0 == val.toString().compareTo(name2prop.getValue().getDefaultValue())) {
+ continue;
+ }
+ exporter.addAttribute(name2prop.getKey(), val.toString());
+ }
+ if ("hbmtemplate".compareToIgnoreCase(expName) == 0 ) { //$NON-NLS-1$
+ Element property = null;
+ if (attributes.isJDK5Enabled()) {
+ property = exporter.addElement("property"); //$NON-NLS-1$
+ property.addAttribute("key", "jdk5"); //$NON-NLS-1$ //$NON-NLS-2$
+ property.addAttribute("value", "" + attributes.isJDK5Enabled()); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ if (attributes.isEJB3Enabled()) {
+ property = exporter.addElement("property"); //$NON-NLS-1$
+ property.addAttribute("key", "ejb3"); //$NON-NLS-1$ //$NON-NLS-2$
+ property.addAttribute("value", "" + attributes.isEJB3Enabled()); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ }
+ return root;
+ }
+
+ public ConsoleConfigurationPreferences getConsoleConfigPreferences(String consoleConfigName) {
+ ConsoleConfiguration consoleConfig = KnownConfigurations.getInstance().find(consoleConfigName);
+ return consoleConfig.getPreferences();
+ }
+
+ public IResource findResource(String path) {
+ final IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();
+ final IResource res = PathHelper.findMember(wsRoot, path);
+ return res;
+ }
+
+ public String getResLocation(String path) {
+ final IResource outputPathRes = findResource(path);
+ String location = ""; //$NON-NLS-1$
+ if (outputPathRes != null) {
+ location = outputPathRes.getLocation().toString();
+ }
+ return location;
+ }
+
+ public String getConnectionProfileDriverURL(String connectionProfile) {
+ String driverURL = ConnectionProfileUtil.getConnectionProfileDriverURL(connectionProfile);
+ return driverURL;
+ }
+}
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ExporterAttributes.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ExporterAttributes.java 2010-07-07 08:43:22 UTC (rev 23271)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/ExporterAttributes.java 2010-07-07 12:53:56 UTC (rev 23272)
@@ -113,12 +113,12 @@
}
}
- static String getLaunchAttributePrefix(String exporterId) {
- return HibernateLaunchConstants.ATTR_EXPORTERS + "." + exporterId; //$NON-NLS-1$
- }
+ public static String getLaunchAttributePrefix(String exporterId) {
+ return HibernateLaunchConstants.ATTR_EXPORTERS + "." + exporterId; //$NON-NLS-1$
+ }
- @SuppressWarnings("unchecked")
-private List<ExporterFactory> readExporterFactories(ILaunchConfiguration configuration) throws CoreException {
+ @SuppressWarnings("unchecked")
+ private List<ExporterFactory> readExporterFactories(ILaunchConfiguration configuration) throws CoreException {
List<String> exporterNames = configuration.getAttribute(HibernateLaunchConstants.ATTR_EXPORTERS, (List<String>)null);
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/specimen/AntCodeGenReveng_test1.xml
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/specimen/AntCodeGenReveng_test1.xml (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/specimen/AntCodeGenReveng_test1.xml 2010-07-07 12:53:56 UTC (rev 23272)
@@ -0,0 +1,17 @@
+<project name="CodeGen" default="JdbcCodeGen">
+ <property name="build.dir" location="ResLocation/test"/>
+ <property name="jdbc.driver" location="TestDriverPath.jar"/>
+ <target name="JdbcCodeGen">
+ <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask"/>
+ <hibernatetool destdir="${build.dir}">
+ <jdbcconfiguration configurationFile="project\src\hibernate.cfg.xml" detectManyToMany="true" detectOneToOne="true" detectOptimisticLock="true" revEngFile="ResLocation/test"/>
+ <hbm2doc/>
+ <hbm2cfgxml/>
+ <hbm2hbmxml/>
+ <hbmtemplate/>
+ <hbm2java/>
+ <hbm2ddl/>
+ <hbm2dao/>
+ </hibernatetool>
+ </target>
+</project>
\ No newline at end of file
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/specimen/AntCodeGenReveng_test2.xml
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/specimen/AntCodeGenReveng_test2.xml (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/specimen/AntCodeGenReveng_test2.xml 2010-07-07 12:53:56 UTC (rev 23272)
@@ -0,0 +1,11 @@
+<project name="CodeGen" default="JdbcCodeGen">
+ <property name="build.dir" location="ResLocation/test"/>
+ <property name="jdbc.driver" location="TestDriverPath.jar"/>
+ <target name="JdbcCodeGen">
+ <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask"/>
+ <hibernatetool destdir="${build.dir}">
+ <jdbcconfiguration configurationFile="project\src\hibernate.cfg.xml" detectManyToMany="true" detectOneToOne="true" detectOptimisticLock="true" revEngFile="ResLocation/test"/>
+ <hbm2java/>
+ </hibernatetool>
+ </target>
+</project>
\ No newline at end of file
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/specimen/AntCodeGen_test1.xml
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/specimen/AntCodeGen_test1.xml (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/specimen/AntCodeGen_test1.xml 2010-07-07 12:53:56 UTC (rev 23272)
@@ -0,0 +1,17 @@
+<project name="CodeGen" default="JdbcCodeGen">
+ <property name="build.dir" location="ResLocation/test"/>
+ <property name="jdbc.driver" location="TestDriverPath.jar"/>
+ <target name="JdbcCodeGen">
+ <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask"/>
+ <hibernatetool destdir="${build.dir}">
+ <configuration configurationFile="project\src\hibernate.cfg.xml"/>
+ <hbm2doc/>
+ <hbm2cfgxml/>
+ <hbm2hbmxml/>
+ <hbmtemplate/>
+ <hbm2java/>
+ <hbm2ddl/>
+ <hbm2dao/>
+ </hibernatetool>
+ </target>
+</project>
\ No newline at end of file
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/specimen/AntCodeGen_test2.xml
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/specimen/AntCodeGen_test2.xml (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/specimen/AntCodeGen_test2.xml 2010-07-07 12:53:56 UTC (rev 23272)
@@ -0,0 +1,11 @@
+<project name="CodeGen" default="JdbcCodeGen">
+ <property name="build.dir" location="ResLocation/test"/>
+ <property name="jdbc.driver" location="TestDriverPath.jar"/>
+ <target name="JdbcCodeGen">
+ <taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask"/>
+ <hibernatetool destdir="${build.dir}">
+ <configuration configurationFile="project\src\hibernate.cfg.xml"/>
+ <hbm2java/>
+ </hibernatetool>
+ </target>
+</project>
\ No newline at end of file
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/CodeGenXMLFactoryTest.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/CodeGenXMLFactoryTest.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/CodeGenXMLFactoryTest.java 2010-07-07 12:53:56 UTC (rev 23272)
@@ -0,0 +1,174 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.hibernate.eclipse.console.test;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.dom4j.Element;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.hibernate.console.ConfigurationXMLFactory;
+import org.hibernate.console.preferences.ConsoleConfigurationPreferences;
+import org.hibernate.eclipse.console.ExtensionManager;
+import org.hibernate.eclipse.console.model.impl.ExporterDefinition;
+import org.hibernate.eclipse.console.test.launchcfg.TestConsoleConfigurationPreferences;
+import org.hibernate.eclipse.console.test.launchcfg.TestLaunchConfig;
+import org.hibernate.eclipse.launch.CodeGenXMLFactory;
+import org.hibernate.eclipse.launch.ExporterAttributes;
+import org.hibernate.eclipse.launch.HibernateLaunchConstants;
+
+import junit.framework.TestCase;
+
+/**
+ * @author Vitali Yemialyanchyk
+ */
+public class CodeGenXMLFactoryTest extends TestCase {
+
+ public static final String SPECIMEN_PATH = "res/specimen/".replaceAll("//", File.separator); //$NON-NLS-1$ //$NON-NLS-2$
+
+ public static final String HBMTEMPLATE0 = "hbm2java"; //$NON-NLS-1$
+ public static final String HBMTEMPLATE0_PROPERTIES = HibernateLaunchConstants.ATTR_EXPORTERS
+ + '.' + HBMTEMPLATE0 + ".properties"; //$NON-NLS-1$
+ public static final String OUTDIR_PATH = "outputdir/test"; //$NON-NLS-1$
+
+ public class TestConsoleConfigPref extends TestConsoleConfigurationPreferences {
+ public File getConfigXMLFile() {
+ final File xmlConfig = new File("project/src/hibernate.cfg.xml"); //$NON-NLS-1$
+ return xmlConfig;
+ }
+ }
+
+ public class CodeGenXMLFactory4Test extends CodeGenXMLFactory {
+
+ public CodeGenXMLFactory4Test(ILaunchConfiguration lc) {
+ super(lc);
+ }
+
+ public ConsoleConfigurationPreferences getConsoleConfigPreferences(String consoleConfigName) {
+ ConsoleConfigurationPreferences pref = new TestConsoleConfigPref();
+ return pref;
+ }
+
+ public String getConnectionProfileDriverURL(String connectionProfile) {
+ return "TestDriverPath.jar"; //$NON-NLS-1$
+ }
+
+ public String getResLocation(String path) {
+ return "ResLocation/test"; //$NON-NLS-1$
+ }
+ }
+
+ public void testCodeGenXMLFactoryRevengAll() {
+ String codeGen = codeGenXMLFactory(true, true);
+ String specimen = getSpecimen("AntCodeGenReveng_test1.xml"); //$NON-NLS-1$
+ assertEquals(specimen.trim(), codeGen.trim().replaceAll("\n", "\r\n")); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ public void testCodeGenXMLFactoryRevengOne() {
+ String codeGen = codeGenXMLFactory(true, false);
+ String specimen = getSpecimen("AntCodeGenReveng_test2.xml"); //$NON-NLS-1$
+ assertEquals(specimen.trim(), codeGen.trim().replaceAll("\n", "\r\n")); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ public void testCodeGenXMLFactoryAll() {
+ String codeGen = codeGenXMLFactory(false, true);
+ String specimen = getSpecimen("AntCodeGen_test1.xml"); //$NON-NLS-1$
+ assertEquals(specimen.trim(), codeGen.trim().replaceAll("\n", "\r\n")); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ public void testCodeGenXMLFactoryOne() {
+ String codeGen = codeGenXMLFactory(false, false);
+ String specimen = getSpecimen("AntCodeGen_test2.xml"); //$NON-NLS-1$
+ assertEquals(specimen.trim(), codeGen.trim().replaceAll("\n", "\r\n")); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ public String codeGenXMLFactory(boolean reveng, boolean exportersAll) {
+ Map<String, ExporterDefinition> exDefinitions = ExtensionManager.findExporterDefinitionsAsMap();
+ Map<String, Object> testLCAttr = new HashMap<String, Object>();
+ String tmp = "12345678901234567890"; //$NON-NLS-1$
+ testLCAttr.put(HibernateLaunchConstants.ATTR_TEMPLATE_DIR, tmp);
+ testLCAttr.put(HibernateLaunchConstants.ATTR_OUTPUT_DIR, tmp);
+ testLCAttr.put(HibernateLaunchConstants.ATTR_REVERSE_ENGINEER_SETTINGS, tmp);
+ List<String> exportersList = new ArrayList<String>();
+ if (exportersAll) {
+ exportersList.clear();
+ } else {
+ exportersList.add(HBMTEMPLATE0);
+ }
+ for (Map.Entry<String, ExporterDefinition> exDef : exDefinitions.entrySet()) {
+ String tmp0 = exDef.getValue().getExporterTag();
+ String tmp1 = ExporterAttributes.getLaunchAttributePrefix(tmp0);
+ testLCAttr.put(tmp1 + ".extension_id", //$NON-NLS-1$
+ HibernateLaunchConstants.ATTR_PREFIX + tmp0);
+ testLCAttr.put(tmp1, Boolean.TRUE);
+ if (exportersAll) {
+ exportersList.add(tmp0);
+ }
+ }
+ testLCAttr.put(HibernateLaunchConstants.ATTR_EXPORTERS, exportersList);
+ Map<String, String> expProps2 = new HashMap<String, String>();
+ expProps2.put(HibernateLaunchConstants.ATTR_OUTPUT_DIR, OUTDIR_PATH);
+ testLCAttr.put(HBMTEMPLATE0_PROPERTIES, expProps2);
+ testLCAttr.put(HibernateLaunchConstants.ATTR_REVERSE_ENGINEER, reveng);
+ TestLaunchConfig testLC = new TestLaunchConfig(testLCAttr);
+ CodeGenXMLFactory cgfXML = new CodeGenXMLFactory4Test(testLC);
+ Element rootBuildXml = cgfXML.createRoot();
+ ConfigurationXMLFactory.dump(System.out, rootBuildXml);
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ConfigurationXMLFactory.dump(baos, rootBuildXml);
+ return baos.toString();
+ }
+
+ public String getSpecimen(String fileName) {
+ File resourceFile = null;
+ try {
+ resourceFile = getResourceItem(SPECIMEN_PATH + fileName);
+ } catch (IOException e1) {
+ }
+ if (resourceFile == null || !resourceFile.exists()) {
+ return null;
+ }
+ StringBuffer cbuf = new StringBuffer((int) resourceFile.length());
+ try {
+ String ls = System.getProperties().getProperty("line.separator", "\n"); //$NON-NLS-1$//$NON-NLS-2$
+ BufferedReader in = new BufferedReader(new FileReader(resourceFile));
+ String str;
+ while ((str = in.readLine()) != null) {
+ cbuf.append(str + ls);
+ }
+ in.close();
+ } catch (IOException e) {
+ }
+ return cbuf.toString();
+ }
+
+ protected File getResourceItem(String strResPath) throws IOException {
+ IPath resourcePath = new Path(strResPath);
+ File resourceFolder = resourcePath.toFile();
+ URL entry = HibernateConsoleTestPlugin.getDefault().getBundle().getEntry(
+ strResPath);
+ URL resProject = FileLocator.resolve(entry);
+ String tplPrjLcStr = FileLocator.resolve(resProject).getFile();
+ resourceFolder = new File(tplPrjLcStr);
+ return resourceFolder;
+ }
+}
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsoleConfigurationTest.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsoleConfigurationTest.java 2010-07-07 08:43:22 UTC (rev 23271)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsoleConfigurationTest.java 2010-07-07 12:53:56 UTC (rev 23272)
@@ -1,27 +1,17 @@
package org.hibernate.eclipse.console.test;
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-import java.util.Properties;
-
import junit.framework.TestCase;
-import org.eclipse.core.runtime.FileLocator;
import org.hibernate.SessionFactory;
import org.hibernate.console.ConcoleConfigurationAdapter;
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.HibernateConsoleRuntimeException;
import org.hibernate.console.KnownConfigurations;
import org.hibernate.console.QueryPage;
-import org.hibernate.console.preferences.ConsoleConfigurationPreferences;
-import org.osgi.framework.Bundle;
-import org.w3c.dom.Element;
+import org.hibernate.eclipse.console.test.launchcfg.TestConsoleConfigurationPreferences;
public class ConsoleConfigurationTest extends TestCase {
- public static final String HIBERNATE_CFG_XML_PATH = "/res/project/src/hibernate.cfg.xml".replaceAll("//", File.separator); //$NON-NLS-1$ //$NON-NLS-2$
-
private ConsoleConfiguration consoleCfg;
public ConsoleConfigurationTest(String name) {
@@ -41,90 +31,6 @@
consoleCfg = null;
}
- static class TestConsoleConfigurationPreferences implements ConsoleConfigurationPreferences {
-
- public void setName(String name) {
- fail();
- }
-
- public void readStateFrom(Element element) {
- fail();
- }
-
- public void writeStateTo(Element node) {
- fail();
- }
-
- public File getPropertyFile() {
- return null;
- }
-
- public File getConfigXMLFile() {
- File xmlConfig = null;
- Bundle bundle = HibernateConsoleTestPlugin.getDefault().getBundle();
- try {
- URL url = FileLocator.resolve(bundle.getEntry(HIBERNATE_CFG_XML_PATH));
- xmlConfig = new File(url.getFile());
- } catch (IOException e) {
- fail("Cannot find file: " + HIBERNATE_CFG_XML_PATH); //$NON-NLS-1$
- }
- return xmlConfig;
- }
-
- public Properties getProperties() {
- Properties p = new Properties();
- p.setProperty("hibernate.dialect", "org.hibernate.dialect.HSQLDialect"); //$NON-NLS-1$ //$NON-NLS-2$
- return p;
- }
-
- public File[] getMappingFiles() {
- return new File[0];
- }
-
- public URL[] getCustomClassPathURLS() {
- return new URL[0];
- }
-
- public String getName() {
- return ConsoleTestMessages.ConsoleConfigurationTest_fake_prefs;
- }
-
-
-
- public String getEntityResolverName() {
- return ""; //$NON-NLS-1$
- }
-
- public ConfigurationMode getConfigurationMode() {
- return ConfigurationMode.CORE;
- }
-
- public String getNamingStrategy() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public String getPersistenceUnitName() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public String getConnectionProfileName() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.hibernate.console.preferences.ConsoleConfigurationPreferences#getDialectName()
- */
- public String getDialectName() {
- // TODO Auto-generated method stub
- return null;
- }
-
- }
-
-
static class MockCCListener extends ConcoleConfigurationAdapter {
int factoryBuilt = 0;
int factoryClosing = 0;
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/QueryParametersTest.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/QueryParametersTest.java 2010-07-07 08:43:22 UTC (rev 23271)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/QueryParametersTest.java 2010-07-07 12:53:56 UTC (rev 23272)
@@ -9,7 +9,7 @@
import org.hibernate.console.ConsoleQueryParameter;
import org.hibernate.console.KnownConfigurations;
import org.hibernate.console.QueryInputModel;
-import org.hibernate.eclipse.console.test.ConsoleConfigurationTest.TestConsoleConfigurationPreferences;
+import org.hibernate.eclipse.console.test.launchcfg.TestConsoleConfigurationPreferences;
public class QueryParametersTest extends TestCase {
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/RefactoringTest.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/RefactoringTest.java 2010-07-07 08:43:22 UTC (rev 23271)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/RefactoringTest.java 2010-07-07 12:53:56 UTC (rev 23272)
@@ -16,27 +16,18 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import junit.framework.TestCase;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationType;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.debug.core.ILaunchDelegate;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.internal.launching.DefaultProjectClasspathEntry;
import org.eclipse.jdt.internal.launching.RuntimeClasspathEntry;
import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
+import org.hibernate.eclipse.console.test.launchcfg.TestLaunchConfig;
import org.hibernate.eclipse.console.test.project.SimpleTestProject;
import org.hibernate.eclipse.launch.HibernateLaunchConstants;
import org.hibernate.eclipse.launch.IConsoleConfigurationLaunchConstants;
@@ -49,10 +40,11 @@
@SuppressWarnings("restriction")
public class RefactoringTest extends TestCase {
- private static final String HBMTEMPLATE0 = "hbmtemplate0";
- private static final String HBMTEMPLATE0_PROPERTIES = HibernateLaunchConstants.ATTR_EXPORTERS + '.' + HBMTEMPLATE0 + ".properties";
+ private static final String HBMTEMPLATE0 = "hbmtemplate0"; //$NON-NLS-1$
+ private static final String HBMTEMPLATE0_PROPERTIES = HibernateLaunchConstants.ATTR_EXPORTERS + '.' + HBMTEMPLATE0 + ".properties"; //$NON-NLS-1$
private final String[] oldPathElements = new String[]{"oldPrj","oldSrc", "oldPack", "oldHibernate.cfg.xml"}; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
private final String[] newPathElements = new String[]{"newPrj","newSrc", "newPack", "newHibernate.cfg.xml"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ private static final String OUTDIR = "outputdir"; //$NON-NLS-1$
SimpleTestProject project = null;
@@ -94,7 +86,7 @@
testCodeGenerationAttr.put(HibernateLaunchConstants.ATTR_REVERSE_ENGINEER_SETTINGS, oldPathStr.toString());
testCodeGenerationAttr.put(HibernateLaunchConstants.ATTR_EXPORTERS, Collections.singletonList(HBMTEMPLATE0));
Map<String, String> expProps = new HashMap<String, String>();
- expProps.put("outputdir", generateOldPathForSegment(2).toString());
+ expProps.put(OUTDIR, generateOldPathForSegment(2).toString());
testCodeGenerationAttr.put(HBMTEMPLATE0_PROPERTIES, expProps);
testNotChangedCodeGenerationAttr.put(HibernateLaunchConstants.ATTR_TEMPLATE_DIR, notChangedPathStr.toString());
@@ -102,7 +94,7 @@
testNotChangedCodeGenerationAttr.put(HibernateLaunchConstants.ATTR_REVERSE_ENGINEER_SETTINGS, notChangedPathStr.toString());
testCodeGenerationAttr.put(HibernateLaunchConstants.ATTR_EXPORTERS, Collections.singletonList(HBMTEMPLATE0));
Map<String, String> expProps2 = new HashMap<String, String>();
- expProps2.put("outputdir", generateOldPathForSegment(2).toString());
+ expProps2.put(OUTDIR, generateOldPathForSegment(2).toString());
testNotChangedCodeGenerationAttr.put(HBMTEMPLATE0_PROPERTIES, expProps2);
@@ -294,7 +286,7 @@
assertEquals(truePath.removeLastSegments(1).makeAbsolute(), new Path(newPath).makeAbsolute());
Map<String, String> props = testCodeGenerationConfig.getAttribute(HBMTEMPLATE0_PROPERTIES,
new HashMap<String, String>());
- assertEquals(truePath.removeLastSegments(1).makeAbsolute(), new Path(props.get("outputdir")).makeAbsolute());
+ assertEquals(truePath.removeLastSegments(1).makeAbsolute(), new Path(props.get(OUTDIR)).makeAbsolute());
}
private Path generateNewPathForSegment(int segmentNum){
@@ -328,399 +320,6 @@
return new Path(newPath);
}
-//====================================================================================
- static class TestWorkingCopy implements ILaunchConfigurationWorkingCopy{
-
- private TestLaunchConfig parent;
-
- private Map<String, Object> attributes = new HashMap<String, Object>();
-
- TestWorkingCopy(TestLaunchConfig parent){
- this.parent = parent;
- }
-
- public void addModes(Set modes) {}
-
- public ILaunchConfiguration doSave() throws CoreException {
- parent.updatedAttributes.putAll(attributes);
- return parent;
- }
-
- public boolean hasAttribute(String attributeName)
- throws CoreException {
- fail(ConsoleTestMessages.RefactoringTest_method_not_tested);
- return false;
- }
-
- public Object removeAttribute(String attributeName) {
- fail(ConsoleTestMessages.RefactoringTest_method_not_tested);
- return null;
- }
- public ILaunchConfiguration getOriginal() {
- return parent;
- }
-
- public ILaunchConfigurationWorkingCopy getParent() {
- return null;
- }
-
- public boolean isDirty() {
- return true;
- }
-
-
- public void removeModes(Set modes) {}
-
- public void rename(String name) {}
-
- public void setAttribute(String attributeName, int value) { }
-
- public void setAttribute(String attributeName, String value) {
- attributes.put(attributeName, value);
- }
-
- public void setAttribute(String attributeName, List value) {
- attributes.put(attributeName, value);
- }
-
- public void setAttribute(String attributeName, Map value) {
- attributes.put(attributeName, value);
- }
-
- public void setAttribute(String attributeName, boolean value) {fail(ConsoleTestMessages.RefactoringTest_method_not_tested);}
-
- public void setAttributes(Map attributes) { fail(ConsoleTestMessages.RefactoringTest_method_not_tested);}
-
- public void setContainer(IContainer container) {fail(ConsoleTestMessages.RefactoringTest_method_not_tested);}
-
- public void setMappedResources(IResource[] resources) {fail(ConsoleTestMessages.RefactoringTest_method_not_tested);}
-
- public void setModes(Set modes) {fail(ConsoleTestMessages.RefactoringTest_method_not_tested);}
-
- public void setPreferredLaunchDelegate(Set modes, String delegateId) {fail(ConsoleTestMessages.RefactoringTest_method_not_tested);}
-
- public boolean contentsEqual(ILaunchConfiguration configuration) {
- return false;
- }
-
- public ILaunchConfigurationWorkingCopy copy(String name)
- throws CoreException {
- fail(ConsoleTestMessages.RefactoringTest_method_not_tested);
- return null;
- }
-
- public void delete() throws CoreException {}
-
- public boolean exists() {
- return false;
- }
-
- public boolean getAttribute(String attributeName, boolean defaultValue)
- throws CoreException {
- return parent.getAttribute(attributeName, defaultValue);
- }
-
- public int getAttribute(String attributeName, int defaultValue)
- throws CoreException {
- fail(ConsoleTestMessages.RefactoringTest_method_not_tested);
- return 0;
- }
-
- public List getAttribute(String attributeName, List defaultValue)
- throws CoreException {
- return parent.getAttribute(attributeName, defaultValue);
- }
-
- public Set getAttribute(String attributeName, Set defaultValue)
- throws CoreException {
- fail(ConsoleTestMessages.RefactoringTest_method_not_tested);
- return null;
- }
-
- public Map getAttribute(String attributeName, Map defaultValue)
- throws CoreException {
- return parent.getAttribute(attributeName, defaultValue);
- }
-
- public String getAttribute(String attributeName, String defaultValue)
- throws CoreException {
- return parent.getAttribute(attributeName, defaultValue);
- }
-
- public Map getAttributes() throws CoreException {
- return attributes;
- }
-
- public String getCategory() throws CoreException {
- return parent.getCategory();
- }
-
- public IFile getFile() {
- return null;
- }
-
- public IPath getLocation() {
- return null;
- }
-
- public IResource[] getMappedResources() throws CoreException {
- return null;
- }
-
- public String getMemento() throws CoreException {
- return null;
- }
-
- public Set getModes() throws CoreException {
- return null;
- }
-
- public String getName() {
- return null;
- }
-
- public ILaunchDelegate getPreferredDelegate(Set modes)
- throws CoreException {
- return null;
- }
-
- public ILaunchConfigurationType getType() throws CoreException {
- return null;
- }
-
- public ILaunchConfigurationWorkingCopy getWorkingCopy()
- throws CoreException {
- return null;
- }
-
- public boolean isLocal() {
- return false;
- }
-
- public boolean isMigrationCandidate() throws CoreException {
- return false;
- }
-
- public boolean isReadOnly() {
- return false;
- }
-
- public boolean isWorkingCopy() {
- return false;
- }
-
- public ILaunch launch(String mode, IProgressMonitor monitor)
- throws CoreException {
- return null;
- }
-
- public ILaunch launch(String mode, IProgressMonitor monitor,
- boolean build) throws CoreException {
- return null;
- }
-
- public ILaunch launch(String mode, IProgressMonitor monitor,
- boolean build, boolean register) throws CoreException {
- return null;
- }
-
- public void migrate() throws CoreException {}
-
- public boolean supportsMode(String mode) throws CoreException {
- return false;
- }
-
- public Object getAdapter(Class adapter) {
- return null;
- }
-
- public void setAttribute(String attributeName, Set value) {
- attributes.put(attributeName, value);
- }
-
- }
-
- @SuppressWarnings("unchecked")
- static class TestLaunchConfig implements ILaunchConfiguration{
-
- private Map<String, Object> attributes = new HashMap<String, Object>();
-
- public Map<String, Object> updatedAttributes = new HashMap<String, Object>();
-
- // returns updated attribute
- public Object getNewAttribute(String attributeName){
- return updatedAttributes.get(attributeName);
- }
-
- TestLaunchConfig(Map<String, Object> attributes){
- if (attributes != null){
- this.attributes = attributes;
- }
- }
-
- public boolean contentsEqual(ILaunchConfiguration configuration) {
- return false;
- }
-
- public ILaunchConfigurationWorkingCopy copy(String name)
- throws CoreException {
- return null;
- }
-
- public void delete() throws CoreException {
-
- }
-
- public boolean exists() {
- return false;
- }
-
- public boolean getAttribute(String attributeName, boolean defaultValue)
- throws CoreException {
- if (attributes.containsKey(attributeName)){
- return (Boolean) attributes.get(attributeName);
- } else {
- return defaultValue;
- }
- }
-
- public boolean hasAttribute(String attributeName)
- throws CoreException {
- return attributes.containsKey(attributeName);
- }
-
- public int getAttribute(String attributeName, int defaultValue)
- throws CoreException {
- if (attributes.containsKey(attributeName)){
- return (Integer) attributes.get(attributeName);
- } else {
- return defaultValue;
- }
- }
-
- public List getAttribute(String attributeName, List defaultValue)
- throws CoreException {
- if (attributes.containsKey(attributeName)){
- return (List) attributes.get(attributeName);
- } else {
- return defaultValue;
- }
- }
-
- public Set getAttribute(String attributeName, Set defaultValue)
- throws CoreException {
- return null;
- }
-
- public Map getAttribute(String attributeName, Map defaultValue)
- throws CoreException {
- if (attributes.containsKey(attributeName)){
- return (Map) attributes.get(attributeName);
- } else {
- return defaultValue;
- }
- }
-
- public String getAttribute(String attributeName, String defaultValue)
- throws CoreException {
- if (attributes.containsKey(attributeName)){
- return (String) attributes.get(attributeName);
- } else {
- return defaultValue;
- }
- }
-
- public Map getAttributes() throws CoreException {
- return null;
- }
-
- public String getCategory() throws CoreException {
- return ConsoleTestMessages.RefactoringTest_category;
- }
-
- public IFile getFile() {
- return null;
- }
-
- public IPath getLocation() {
- return null;
- }
-
- public IResource[] getMappedResources() throws CoreException {
- return null;
- }
-
- public String getMemento() throws CoreException {
- return null;
- }
-
- public Set getModes() throws CoreException {
- return null;
- }
-
- public String getName() {
- return ConsoleTestMessages.RefactoringTest_test_launch_config;
- }
-
- public ILaunchDelegate getPreferredDelegate(Set modes)
- throws CoreException {
- return null;
- }
-
- public ILaunchConfigurationType getType() throws CoreException {
- return null;
- }
-
- public ILaunchConfigurationWorkingCopy getWorkingCopy()
- throws CoreException {
- return new TestWorkingCopy(this);
- }
-
- public boolean isLocal() {
- return false;
- }
-
- public boolean isMigrationCandidate() throws CoreException {
- return false;
- }
-
- public boolean isReadOnly() {
- return false;
- }
-
- public boolean isWorkingCopy() {
- return false;
- }
-
- public ILaunch launch(String mode, IProgressMonitor monitor)
- throws CoreException {
- return null;
- }
-
- public ILaunch launch(String mode, IProgressMonitor monitor,
- boolean build) throws CoreException {
- return null;
- }
-
- public ILaunch launch(String mode, IProgressMonitor monitor,
- boolean build, boolean register) throws CoreException {
- return null;
- }
-
- public void migrate() throws CoreException {
-
- }
-
- public boolean supportsMode(String mode) throws CoreException {
- return false;
- }
-
- public Object getAdapter(Class adapter) {
- return null;
- }
-
-
- };
}
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/launchcfg/TestConsoleConfigurationPreferences.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/launchcfg/TestConsoleConfigurationPreferences.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/launchcfg/TestConsoleConfigurationPreferences.java 2010-07-07 12:53:56 UTC (rev 23272)
@@ -0,0 +1,99 @@
+package org.hibernate.eclipse.console.test.launchcfg;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.util.Properties;
+
+import junit.framework.Assert;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.hibernate.console.preferences.ConsoleConfigurationPreferences;
+import org.hibernate.eclipse.console.test.ConsoleTestMessages;
+import org.hibernate.eclipse.console.test.HibernateConsoleTestPlugin;
+import org.osgi.framework.Bundle;
+import org.w3c.dom.Element;
+
+public class TestConsoleConfigurationPreferences implements ConsoleConfigurationPreferences {
+
+ public static final String HIBERNATE_CFG_XML_PATH = "/res/project/src/hibernate.cfg.xml".replaceAll("//", File.separator); //$NON-NLS-1$ //$NON-NLS-2$
+
+ public void setName(String name) {
+ Assert.fail();
+ }
+
+ public void readStateFrom(Element element) {
+ Assert.fail();
+ }
+
+ public void writeStateTo(Element node) {
+ Assert.fail();
+ }
+
+ public File getPropertyFile() {
+ return null;
+ }
+
+ public File getConfigXMLFile() {
+ File xmlConfig = null;
+ Bundle bundle = HibernateConsoleTestPlugin.getDefault().getBundle();
+ try {
+ URL url = FileLocator.resolve(bundle.getEntry(HIBERNATE_CFG_XML_PATH));
+ xmlConfig = new File(url.getFile());
+ } catch (IOException e) {
+ Assert.fail("Cannot find file: " + HIBERNATE_CFG_XML_PATH); //$NON-NLS-1$
+ }
+ return xmlConfig;
+ }
+
+ public Properties getProperties() {
+ Properties p = new Properties();
+ p.setProperty("hibernate.dialect", "org.hibernate.dialect.HSQLDialect"); //$NON-NLS-1$ //$NON-NLS-2$
+ return p;
+ }
+
+ public File[] getMappingFiles() {
+ return new File[0];
+ }
+
+ public URL[] getCustomClassPathURLS() {
+ return new URL[0];
+ }
+
+ public String getName() {
+ return ConsoleTestMessages.ConsoleConfigurationTest_fake_prefs;
+ }
+
+ public String getEntityResolverName() {
+ return ""; //$NON-NLS-1$
+ }
+
+ public ConfigurationMode getConfigurationMode() {
+ return ConfigurationMode.CORE;
+ }
+
+ public String getNamingStrategy() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getPersistenceUnitName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getConnectionProfileName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.hibernate.console.preferences.ConsoleConfigurationPreferences#getDialectName()
+ */
+ public String getDialectName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/launchcfg/TestLaunchConfig.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/launchcfg/TestLaunchConfig.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/launchcfg/TestLaunchConfig.java 2010-07-07 12:53:56 UTC (rev 23272)
@@ -0,0 +1,198 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.hibernate.eclipse.console.test.launchcfg;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.ILaunchDelegate;
+import org.hibernate.eclipse.console.test.ConsoleTestMessages;
+
+@SuppressWarnings("rawtypes")
+public class TestLaunchConfig implements ILaunchConfiguration {
+
+ private Map<String, Object> attributes = new HashMap<String, Object>();
+
+ public Map<String, Object> updatedAttributes = new HashMap<String, Object>();
+
+ // returns updated attribute
+ public Object getNewAttribute(final String attributeName) {
+ return updatedAttributes.get(attributeName);
+ }
+
+ public TestLaunchConfig(final Map<String, Object> attributes) {
+ if (attributes != null) {
+ this.attributes = attributes;
+ }
+ }
+
+ public boolean contentsEqual(final ILaunchConfiguration configuration) {
+ return false;
+ }
+
+ public ILaunchConfigurationWorkingCopy copy(final String name) throws CoreException {
+ return null;
+ }
+
+ public void delete() throws CoreException {
+
+ }
+
+ public boolean exists() {
+ return false;
+ }
+
+ public boolean getAttribute(final String attributeName, final boolean defaultValue) throws CoreException {
+ if (attributes.containsKey(attributeName)) {
+ return (Boolean) attributes.get(attributeName);
+ } else {
+ return defaultValue;
+ }
+ }
+
+ public boolean hasAttribute(final String attributeName) throws CoreException {
+ return attributes.containsKey(attributeName);
+ }
+
+ public int getAttribute(final String attributeName, final int defaultValue) throws CoreException {
+ if (attributes.containsKey(attributeName)) {
+ return (Integer) attributes.get(attributeName);
+ } else {
+ return defaultValue;
+ }
+ }
+
+ public List getAttribute(final String attributeName, final List defaultValue) throws CoreException {
+ if (attributes.containsKey(attributeName)) {
+ return (List) attributes.get(attributeName);
+ } else {
+ return defaultValue;
+ }
+ }
+
+ public Set getAttribute(final String attributeName, final Set defaultValue) throws CoreException {
+ return null;
+ }
+
+ public Map getAttribute(final String attributeName, final Map defaultValue) throws CoreException {
+ if (attributes.containsKey(attributeName)) {
+ return (Map) attributes.get(attributeName);
+ } else {
+ return defaultValue;
+ }
+ }
+
+ public String getAttribute(final String attributeName, final String defaultValue) throws CoreException {
+ if (attributes.containsKey(attributeName)) {
+ return (String) attributes.get(attributeName);
+ } else {
+ return defaultValue;
+ }
+ }
+
+ public Map getAttributes() throws CoreException {
+ return null;
+ }
+
+ public String getCategory() throws CoreException {
+ return ConsoleTestMessages.RefactoringTest_category;
+ }
+
+ public IFile getFile() {
+ return null;
+ }
+
+ public IPath getLocation() {
+ return null;
+ }
+
+ public IResource[] getMappedResources() throws CoreException {
+ return null;
+ }
+
+ public String getMemento() throws CoreException {
+ return null;
+ }
+
+ public Set getModes() throws CoreException {
+ return null;
+ }
+
+ public String getName() {
+ return ConsoleTestMessages.RefactoringTest_test_launch_config;
+ }
+
+ public ILaunchDelegate getPreferredDelegate(final Set modes) throws CoreException {
+ return null;
+ }
+
+ public ILaunchConfigurationType getType() throws CoreException {
+ return null;
+ }
+
+ public ILaunchConfigurationWorkingCopy getWorkingCopy() throws CoreException {
+ return new TestWorkingCopy(this);
+ }
+
+ public boolean isLocal() {
+ return false;
+ }
+
+ public boolean isMigrationCandidate() throws CoreException {
+ return false;
+ }
+
+ public boolean isReadOnly() {
+ return false;
+ }
+
+ public boolean isWorkingCopy() {
+ return false;
+ }
+
+ public ILaunch launch(final String mode, final IProgressMonitor monitor) throws CoreException {
+ return null;
+ }
+
+ public ILaunch launch(final String mode, final IProgressMonitor monitor, final boolean build)
+ throws CoreException {
+ return null;
+ }
+
+ public ILaunch launch(final String mode, final IProgressMonitor monitor, final boolean build, final boolean register)
+ throws CoreException {
+ return null;
+ }
+
+ public void migrate() throws CoreException {
+
+ }
+
+ public boolean supportsMode(final String mode) throws CoreException {
+ return false;
+ }
+
+ public Object getAdapter(final Class adapter) {
+ return null;
+ }
+
+};
Added: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/launchcfg/TestWorkingCopy.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/launchcfg/TestWorkingCopy.java (rev 0)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/launchcfg/TestWorkingCopy.java 2010-07-07 12:53:56 UTC (rev 23272)
@@ -0,0 +1,250 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.hibernate.eclipse.console.test.launchcfg;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import junit.framework.Assert;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.ILaunchDelegate;
+import org.hibernate.eclipse.console.test.ConsoleTestMessages;
+
+@SuppressWarnings("rawtypes")
+public class TestWorkingCopy implements ILaunchConfigurationWorkingCopy {
+
+ private TestLaunchConfig parent;
+
+ private Map<String, Object> attributes = new HashMap<String, Object>();
+
+ public TestWorkingCopy(TestLaunchConfig parent) {
+ this.parent = parent;
+ }
+
+ public void addModes(Set modes) {
+ }
+
+ public ILaunchConfiguration doSave() throws CoreException {
+ parent.updatedAttributes.putAll(attributes);
+ return parent;
+ }
+
+ public boolean hasAttribute(String attributeName) throws CoreException {
+ Assert.fail(ConsoleTestMessages.RefactoringTest_method_not_tested);
+ return false;
+ }
+
+ public Object removeAttribute(String attributeName) {
+ Assert.fail(ConsoleTestMessages.RefactoringTest_method_not_tested);
+ return null;
+ }
+
+ public ILaunchConfiguration getOriginal() {
+ return parent;
+ }
+
+ public ILaunchConfigurationWorkingCopy getParent() {
+ return null;
+ }
+
+ public boolean isDirty() {
+ return true;
+ }
+
+ public void removeModes(Set modes) {
+ }
+
+ public void rename(String name) {
+ }
+
+ public void setAttribute(String attributeName, int value) {
+ }
+
+ public void setAttribute(String attributeName, String value) {
+ attributes.put(attributeName, value);
+ }
+
+ public void setAttribute(String attributeName, List value) {
+ attributes.put(attributeName, value);
+ }
+
+ public void setAttribute(String attributeName, Map value) {
+ attributes.put(attributeName, value);
+ }
+
+ public void setAttribute(String attributeName, boolean value) {
+ Assert.fail(ConsoleTestMessages.RefactoringTest_method_not_tested);
+ }
+
+ public void setAttributes(Map attributes) {
+ Assert.fail(ConsoleTestMessages.RefactoringTest_method_not_tested);
+ }
+
+ public void setContainer(IContainer container) {
+ Assert.fail(ConsoleTestMessages.RefactoringTest_method_not_tested);
+ }
+
+ public void setMappedResources(IResource[] resources) {
+ Assert.fail(ConsoleTestMessages.RefactoringTest_method_not_tested);
+ }
+
+ public void setModes(Set modes) {
+ Assert.fail(ConsoleTestMessages.RefactoringTest_method_not_tested);
+ }
+
+ public void setPreferredLaunchDelegate(Set modes, String delegateId) {
+ Assert.fail(ConsoleTestMessages.RefactoringTest_method_not_tested);
+ }
+
+ public boolean contentsEqual(ILaunchConfiguration configuration) {
+ return false;
+ }
+
+ public ILaunchConfigurationWorkingCopy copy(String name) throws CoreException {
+ Assert.fail(ConsoleTestMessages.RefactoringTest_method_not_tested);
+ return null;
+ }
+
+ public void delete() throws CoreException {
+ }
+
+ public boolean exists() {
+ return false;
+ }
+
+ public boolean getAttribute(String attributeName, boolean defaultValue) throws CoreException {
+ return parent.getAttribute(attributeName, defaultValue);
+ }
+
+ public int getAttribute(String attributeName, int defaultValue) throws CoreException {
+ Assert.fail(ConsoleTestMessages.RefactoringTest_method_not_tested);
+ return 0;
+ }
+
+ public List getAttribute(String attributeName, List defaultValue) throws CoreException {
+ return parent.getAttribute(attributeName, defaultValue);
+ }
+
+ public Set getAttribute(String attributeName, Set defaultValue) throws CoreException {
+ Assert.fail(ConsoleTestMessages.RefactoringTest_method_not_tested);
+ return null;
+ }
+
+ public Map getAttribute(String attributeName, Map defaultValue) throws CoreException {
+ return parent.getAttribute(attributeName, defaultValue);
+ }
+
+ public String getAttribute(String attributeName, String defaultValue) throws CoreException {
+ return parent.getAttribute(attributeName, defaultValue);
+ }
+
+ public Map getAttributes() throws CoreException {
+ return attributes;
+ }
+
+ public String getCategory() throws CoreException {
+ return parent.getCategory();
+ }
+
+ public IFile getFile() {
+ return null;
+ }
+
+ public IPath getLocation() {
+ return null;
+ }
+
+ public IResource[] getMappedResources() throws CoreException {
+ return null;
+ }
+
+ public String getMemento() throws CoreException {
+ return null;
+ }
+
+ public Set getModes() throws CoreException {
+ return null;
+ }
+
+ public String getName() {
+ return null;
+ }
+
+ public ILaunchDelegate getPreferredDelegate(Set modes) throws CoreException {
+ return null;
+ }
+
+ public ILaunchConfigurationType getType() throws CoreException {
+ return null;
+ }
+
+ public ILaunchConfigurationWorkingCopy getWorkingCopy() throws CoreException {
+ return null;
+ }
+
+ public boolean isLocal() {
+ return false;
+ }
+
+ public boolean isMigrationCandidate() throws CoreException {
+ return false;
+ }
+
+ public boolean isReadOnly() {
+ return false;
+ }
+
+ public boolean isWorkingCopy() {
+ return false;
+ }
+
+ public ILaunch launch(String mode, IProgressMonitor monitor) throws CoreException {
+ return null;
+ }
+
+ public ILaunch launch(String mode, IProgressMonitor monitor, boolean build)
+ throws CoreException {
+ return null;
+ }
+
+ public ILaunch launch(String mode, IProgressMonitor monitor, boolean build, boolean register)
+ throws CoreException {
+ return null;
+ }
+
+ public void migrate() throws CoreException {
+ }
+
+ public boolean supportsMode(String mode) throws CoreException {
+ return false;
+ }
+
+ public Object getAdapter(Class adapter) {
+ return null;
+ }
+
+ public void setAttribute(String attributeName, Set value) {
+ attributes.put(attributeName, value);
+ }
+
+}
15 years, 9 months
JBoss Tools SVN: r23271 - trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/src/org/jboss/tools/jsf/vpe/ajax4jsf/template.
by jbosstools-commits@lists.jboss.org
Author: dvinnichek
Date: 2010-07-07 04:43:22 -0400 (Wed, 07 Jul 2010)
New Revision: 23271
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/src/org/jboss/tools/jsf/vpe/ajax4jsf/template/Ajax4JSFMediaOutput.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/src/org/jboss/tools/jsf/vpe/ajax4jsf/template/Ajax4JSFStatusTemplate.java
Log:
fix templates for a4j components according to JBIDE-6542
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/src/org/jboss/tools/jsf/vpe/ajax4jsf/template/Ajax4JSFMediaOutput.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/src/org/jboss/tools/jsf/vpe/ajax4jsf/template/Ajax4JSFMediaOutput.java 2010-07-07 07:04:14 UTC (rev 23270)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/src/org/jboss/tools/jsf/vpe/ajax4jsf/template/Ajax4JSFMediaOutput.java 2010-07-07 08:43:22 UTC (rev 23271)
@@ -53,17 +53,15 @@
Element sourceElement = (Element) sourceNode;
nsIDOMElement mainTag = createMainTag(visualDocument, sourceElement);
- String uriAttribute = sourceElement.getAttribute(Ajax4JSF.ATTR_URI_ATTRIBUTE);
- if (uriAttribute == null || "".equals(uriAttribute)) { //$NON-NLS-1$
- uriAttribute = HTML.ATTR_SRC;
- }
-
+ String uriAttribute = sourceElement.hasAttribute(Ajax4JSF.ATTR_URI_ATTRIBUTE) ?
+ sourceElement.getAttribute(Ajax4JSF.ATTR_URI_ATTRIBUTE) : HTML.ATTR_SRC;
+
mainTag.setAttribute(uriAttribute, "file:///" + getAbsoluteResourcePath(IMG_PATH).replace('\\', '/')); //$NON-NLS-1$
VisualDomUtil.copyAttributes(sourceElement, SAME_ATTRIBUTES_LIST, mainTag);
-
- String styleClass = sourceElement.getAttribute(Ajax4JSF.ATTR_STYLE_CLASS);
- if (styleClass != null) {
+
+ if (sourceElement.hasAttribute(Ajax4JSF.ATTR_STYLE_CLASS)) {
+ String styleClass = sourceElement.getAttribute(Ajax4JSF.ATTR_STYLE_CLASS);
mainTag.setAttribute(HTML.ATTR_CLASS, styleClass);
}
@@ -87,12 +85,10 @@
*/
private static nsIDOMElement createMainTag(nsIDOMDocument visualDocument,
Element sourceElement) {
- String element = sourceElement.getAttribute(Ajax4JSF.ATTR_ELEMENT);
+
+ String element = sourceElement.hasAttribute(Ajax4JSF.ATTR_ELEMENT) ?
+ sourceElement.getAttribute(Ajax4JSF.ATTR_ELEMENT) : HTML.TAG_IMG;
- if (element == null || "".equals(element)) { //$NON-NLS-1$
- element = HTML.TAG_IMG;
- }
-
nsIDOMElement mainTag = visualDocument.createElement(element);
return mainTag;
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/src/org/jboss/tools/jsf/vpe/ajax4jsf/template/Ajax4JSFStatusTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/src/org/jboss/tools/jsf/vpe/ajax4jsf/template/Ajax4JSFStatusTemplate.java 2010-07-07 07:04:14 UTC (rev 23270)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/src/org/jboss/tools/jsf/vpe/ajax4jsf/template/Ajax4JSFStatusTemplate.java 2010-07-07 08:43:22 UTC (rev 23271)
@@ -93,13 +93,13 @@
// set class of the span to "{@styleClass} {@stopStyleClass}"
{
- String styleClass = sourceElement.getAttribute(RichFaces.ATTR_STYLE_CLASS);
- String stopStyleClass = sourceElement.getAttribute(ATTR_STOP_STYLE_CLASS);
StringBuffer spanClass = new StringBuffer();
- if (styleClass != null) {
+ if (sourceElement.hasAttribute(RichFaces.ATTR_STYLE_CLASS)) {
+ String styleClass = sourceElement.getAttribute(RichFaces.ATTR_STYLE_CLASS);
spanClass.append(styleClass);
}
- if (stopStyleClass != null) {
+ if (sourceElement.hasAttribute(ATTR_STOP_STYLE_CLASS)) {
+ String stopStyleClass = sourceElement.getAttribute(ATTR_STOP_STYLE_CLASS);
spanClass.append(HTML.VALUE_CLASS_DELIMITER).append(stopStyleClass);
}
span.setAttribute(HTML.ATTR_CLASS, spanClass.toString());
@@ -107,13 +107,13 @@
// set style of the span to "{@style};{@stopStyle}"
{
- String style = sourceElement.getAttribute(RichFaces.ATTR_STYLE);
- String stopStyle = sourceElement.getAttribute(ATTR_STOP_STYLE);
StringBuffer spanStyle = new StringBuffer();
- if (style != null) {
+ if (sourceElement.hasAttribute(RichFaces.ATTR_STYLE)) {
+ String style = sourceElement.getAttribute(RichFaces.ATTR_STYLE);
spanStyle.append(style).append(HTML.VALUE_STYLE_DELIMITER);
}
- if (stopStyle != null) {
+ if (sourceElement.hasAttribute(ATTR_STOP_STYLE)) {
+ String stopStyle = sourceElement.getAttribute(ATTR_STOP_STYLE);
spanStyle.append(stopStyle).append(HTML.VALUE_STYLE_DELIMITER);
}
span.setAttribute(HTML.ATTR_STYLE, spanStyle.toString());
15 years, 9 months
JBoss Tools SVN: r23270 - in branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui: META-INF and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2010-07-07 03:04:14 -0400 (Wed, 07 Jul 2010)
New Revision: 23270
Added:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/dbm/
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/dbm/editor/
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/dbm/editor/AbstractSmooksMultiplePageEditor.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/dbm/editor/ISmooksModelProvider.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/dbm/editor/SmooksConfigurationFormPage.java
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/dbm/editor/SmooksMultiplePageEditor.java
Modified:
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/plugin.xml
branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/wizards/SmooksConfigurationFileNewWizard.java
Log:
Update Wizard and Option Form Page
Modified: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF 2010-07-07 04:17:12 UTC (rev 23269)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/META-INF/MANIFEST.MF 2010-07-07 07:04:14 UTC (rev 23270)
@@ -14,9 +14,6 @@
org.eclipse.ui.forms,
org.eclipse.wst.sse.core,
org.eclipse.wst.sse.ui,
- org.eclipse.emf,
- org.eclipse.emf.edit,
- org.eclipse.emf.edit.ui,
org.eclipse.jdt.core,
org.eclipse.jdt.ui,
org.eclipse.wst.validation,
@@ -38,7 +35,7 @@
org.eclipse.jdt.debug.ui,
org.eclipse.jdt.junit,
org.eclipse.ui.console,
- org.jboss.tools.smooks.model
+ org.jboss.tools.smooks.model;bundle-version="1.1.0"
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Modified: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/plugin.xml
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/plugin.xml 2010-07-07 04:17:12 UTC (rev 23269)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/plugin.xml 2010-07-07 07:04:14 UTC (rev 23270)
@@ -5,7 +5,7 @@
<extension
point="org.eclipse.ui.editors">
<editor
- class="org.jboss.tools.smooks.configuration.editors.SmooksMultiFormEditor"
+ class="org.jboss.tools.smooks.dbm.editor.SmooksMultiplePageEditor"
contributorClass="org.jboss.tools.smooks.configuration.editors.SmooksMultiPageEditorContributor"
icon="icons/smooks-sm.gif"
id="org.jboss.tools.smooks.configuration.editors.MultiPageEditor"
Modified: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/wizards/SmooksConfigurationFileNewWizard.java
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/wizards/SmooksConfigurationFileNewWizard.java 2010-07-07 04:17:12 UTC (rev 23269)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/wizards/SmooksConfigurationFileNewWizard.java 2010-07-07 07:04:14 UTC (rev 23270)
@@ -31,7 +31,7 @@
import org.eclipse.ui.part.FileEditorInput;
import org.jboss.tools.smooks.configuration.SmooksConfigurationActivator;
import org.jboss.tools.smooks.configuration.SmooksConstants;
-import org.jboss.tools.smooks.configuration.editors.SmooksMultiFormEditor;
+//import org.jboss.tools.smooks.configuration.editors.SmooksMultiFormEditor;
/**
*
@@ -139,7 +139,7 @@
FileEditorInput editorInput = new FileEditorInput(configFile);
try {
if ( fversion.equals(SmooksConstants.VERSION_1_2)) {
- page.openEditor(editorInput, SmooksMultiFormEditor.EDITOR_ID, true);
+ page.openEditor(editorInput, "org.jboss.tools.smooks.configuration.editors.MultiPageEditor", true);
}
} catch (PartInitException e) {
SmooksConfigurationActivator.getDefault().log(e);
Added: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/dbm/editor/AbstractSmooksMultiplePageEditor.java
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/dbm/editor/AbstractSmooksMultiplePageEditor.java (rev 0)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/dbm/editor/AbstractSmooksMultiplePageEditor.java 2010-07-07 07:04:14 UTC (rev 23270)
@@ -0,0 +1,568 @@
+/**
+ *
+ */
+package org.jboss.tools.smooks.dbm.editor;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Timer;
+import java.util.TimerTask;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IResourceDeltaVisitor;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.jface.text.DocumentEvent;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IDocumentListener;
+import org.eclipse.jface.text.TextViewer;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.forms.editor.FormEditor;
+import org.eclipse.ui.ide.FileStoreEditorInput;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.texteditor.IDocumentProvider;
+import org.eclipse.wst.sse.ui.StructuredTextEditor;
+import org.jboss.tools.smooks.configuration.RuntimeDependency;
+import org.jboss.tools.smooks.configuration.RuntimeMetadata;
+import org.jboss.tools.smooks.configuration.SmooksConfigurationActivator;
+import org.jboss.tools.smooks.configuration.editors.SmooksXMLEditor;
+import org.jboss.tools.smooks.editor.ISourceSynchronizeListener;
+import org.jboss.tools.smooks.editor.Messages;
+import org.jboss.tools.smooks.graphical.editors.ISmooksEditorInitListener;
+import org.jboss.tools.smooks.model.SmooksEditorModelBuilder;
+import org.jboss.tools.smooks.model.SmooksModel;
+import org.milyn.javabean.dynamic.Model;
+
+/**
+ * @author Dart
+ *
+ */
+public class AbstractSmooksMultiplePageEditor extends FormEditor implements
+ ISmooksModelProvider {
+
+ private boolean handleEMFModelChange;
+
+ private IResourceChangeListener resourceChangeListener = null;
+
+ protected StructuredTextEditor textEditor = null;
+
+ private IDocumentListener xmlDocumentTraker = null;
+
+ private Exception initSmooksModelException = null;
+
+ protected SmooksEditorModelBuilder smooksEditorModelBuilder = null;
+
+ protected List<ISmooksEditorInitListener> smooksInitListener = new ArrayList<ISmooksEditorInitListener>();
+
+ protected List<ISourceSynchronizeListener> sourceSynchronizeListener = new ArrayList<ISourceSynchronizeListener>();
+
+ protected Model<SmooksModel> smooksModel;
+
+ public AbstractSmooksMultiplePageEditor() {
+ super();
+ resourceChangeListener = new SmooksResourceTraker();
+ xmlDocumentTraker = new SmooksXMLEditorDocumentListener();
+ smooksEditorModelBuilder = new SmooksEditorModelBuilder();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.forms.editor.FormEditor#addPages()
+ */
+ @Override
+ protected void addPages() {
+ textEditor = createTextEditor();
+ try {
+ int index = this.addPage(textEditor, getEditorInput());
+ setPageText(index,
+ Messages.AbstractSmooksFormEditor_Source_Page_Title);
+ } catch (PartInitException e) {
+ e.printStackTrace();
+ }
+ int messageType = IMessageProvider.ERROR;
+ Exception exception = initSmooksModelException;
+ if (exception == null) {
+ exception = checkSmooksConfigContents(null);
+ messageType = IMessageProvider.WARNING;
+ }
+ if (exception != null) {
+ for (Iterator<?> iterator = this.smooksInitListener.iterator(); iterator
+ .hasNext();) {
+ ISmooksEditorInitListener initListener = (ISmooksEditorInitListener) iterator
+ .next();
+ initListener.initFailed(messageType, exception.getMessage());
+ }
+ }
+ }
+
+ public void addSmooksEditorInitListener(ISmooksEditorInitListener listener) {
+ this.smooksInitListener.add(listener);
+ }
+
+ public void removeSmooksEditorInitListener(
+ ISmooksEditorInitListener listener) {
+ this.smooksInitListener.remove(listener);
+ }
+
+ public void addSourceSynchronizeListener(ISourceSynchronizeListener listener) {
+ this.sourceSynchronizeListener.add(listener);
+ }
+
+ public void removeSourceSynchronizeListener(
+ ISourceSynchronizeListener listener) {
+ this.sourceSynchronizeListener.remove(listener);
+ }
+
+ @Override
+ public void init(IEditorSite site, IEditorInput input)
+ throws PartInitException {
+ RuntimeMetadata runtimeMetadata = new RuntimeMetadata();
+ String filePath = null;
+ IFile file = null;
+ if (input instanceof FileStoreEditorInput) {
+ try {
+ filePath = ((FileStoreEditorInput) input).getURI().toURL().getFile();
+ runtimeMetadata.setSmooksConfig(new File(filePath));
+ } catch (MalformedURLException e) {
+ throw new PartInitException(Messages.AbstractSmooksFormEditor_Exception_Transform_URL, e);
+ }
+ }
+ if (input instanceof IFileEditorInput) {
+ file = ((IFileEditorInput) input).getFile();
+ runtimeMetadata.setSmooksConfig(file);
+ filePath = file.getFullPath().toPortableString();
+ }
+
+ if (filePath == null)
+ throw new PartInitException(Messages.AbstractSmooksFormEditor_Exception_Cannot_Get_Input_File);
+ super.init(site, input);
+ }
+
+ public void setInput(IEditorInput input) {
+ if (getEditorInput() != null) {
+ IFile file = ((IFileEditorInput) getEditorInput()).getFile();
+ file.getWorkspace().removeResourceChangeListener(
+ resourceChangeListener);
+ }
+
+ super.setInput(input);
+
+ if (getEditorInput() != null) {
+ IFile file = ((IFileEditorInput) getEditorInput()).getFile();
+ file.getWorkspace().addResourceChangeListener(
+ resourceChangeListener);
+ setPartName(file.getName());
+ }
+
+ String filePath = null;
+
+ IFile file = null;
+
+ if (input instanceof IFileEditorInput) {
+ file = ((IFileEditorInput) input).getFile();
+ filePath = file.getFullPath().toPortableString();
+ }
+
+ // create EMF resource
+ if (file != null) {
+ try {
+ smooksModel = smooksEditorModelBuilder.readModel(file
+ .getContents());
+ } catch (Exception e) {
+ initSmooksModelException = e;
+ }
+ } else {
+ }
+
+ // if (ex == null) {
+ // if (smooksModel == null) {
+ // try {
+ // smooksResource.load(Collections.emptyMap());
+ // smooksModel = smooksResource.getContents().get(0);
+ // } catch (IOException e) {
+ //
+ // }
+ // } else {
+ // smooksResource.getContents().add(smooksModel);
+ // }
+ // }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.part.EditorPart#doSave(org.eclipse.core.runtime.
+ * IProgressMonitor)
+ */
+ @Override
+ public void doSave(IProgressMonitor monitor) {
+ if (monitor == null) {
+ monitor = new NullProgressMonitor();
+ }
+ try {
+ IEditorPart activeEditor = getActiveEditor();
+ if (/* this.smooksModel == null || */(activeEditor != null && activeEditor == textEditor)) {
+ textEditor.doSave(monitor);
+ /*
+ * ((BasicCommandStack)
+ * editingDomain.getCommandStack()).saveIsDone();
+ */
+
+ }
+ /*
+ * else { Map<?, ?> options = Collections.emptyMap();
+ * initSaveOptions(options); if (editingDomain != null) {
+ * ResourceSet resourceSet = editingDomain.getResourceSet();
+ * List<Resource> resourceList = resourceSet.getResources();
+ * monitor.
+ * beginTask(Messages.AbstractSmooksFormEditor_Task_Saving_File,
+ * resourceList.size());
+ *
+ * for (Iterator<Resource> iterator = resourceList.iterator();
+ * iterator.hasNext();) { handleEMFModelChange = true; Resource
+ * resource = (Resource) iterator.next(); ByteArrayOutputStream
+ * outputStream = new ByteArrayOutputStream();
+ * resource.save(outputStream, options); IResource file =
+ * SmooksUIUtils.getResource(resource); if (file.exists() && file
+ * instanceof IFile) { ByteArrayInputStream inputStream = new
+ * ByteArrayInputStream(outputStream.toByteArray());
+ * ByteArrayOutputStream newOutputStream =
+ * getFormattedXMLContentsStream(inputStream); try { ((IFile)
+ * file).setContents(new
+ * ByteArrayInputStream(newOutputStream.toByteArray()),
+ * IResource.FORCE, monitor); } catch (CoreException e) {
+ * e.printStackTrace(); } finally { if (outputStream != null) {
+ * outputStream.close(); } if (newOutputStream != null) {
+ * newOutputStream.close(); } if (inputStream != null) {
+ * inputStream.close(); } } } monitor.worked(1); }
+ * ((BasicCommandStack)
+ * editingDomain.getCommandStack()).saveIsDone();
+ * textEditor.doRevertToSaved(); } }
+ */
+ // graphChanged = false;
+ firePropertyChange(PROP_DIRTY);
+ // if (this.smooksModel != null && validator != null) {
+ // validator.startValidate(smooksModel.eResource().getContents(),
+ // editingDomain);
+ // }
+ } catch (Exception e) {
+ SmooksConfigurationActivator.log(e);
+ } finally {
+ monitor.done();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.part.EditorPart#doSaveAs()
+ */
+ @Override
+ public void doSaveAs() {
+ // TODO Auto-generated method stub
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.part.EditorPart#isSaveAsAllowed()
+ */
+ @Override
+ public boolean isSaveAsAllowed() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ protected Exception checkSmooksConfigContents(InputStream stream) {
+ // Check
+ Exception exception = null;
+ IFile file = null;
+ String filePath = null;
+ RuntimeMetadata runtimeMetadata = new RuntimeMetadata();
+ IEditorInput input = getEditorInput();
+ if (input instanceof FileStoreEditorInput) {
+ try {
+ filePath = ((FileStoreEditorInput) input).getURI().toURL()
+ .getFile();
+ runtimeMetadata.setSmooksConfig(new File(filePath), stream);
+ } catch (MalformedURLException e) {
+ exception = e;
+ // throw new PartInitException("Transform URL to URL error.",
+ // e);
+ }
+ }
+ if (exception == null) {
+ if (input instanceof IFileEditorInput) {
+ file = ((IFileEditorInput) input).getFile();
+ File f = new File(file.getRawLocation().toOSString().trim());
+ runtimeMetadata.setSmooksConfig(f, stream);
+ }
+
+ try {
+
+ assertConfigSupported(runtimeMetadata);
+
+ } catch (PartInitException e) {
+ exception = e;
+ }
+ }
+ return exception;
+ }
+
+ private void assertConfigSupported(RuntimeMetadata runtimeMetadata)
+ throws PartInitException {
+ List<RuntimeDependency> dependencies = runtimeMetadata
+ .getDependencies();
+
+ for (RuntimeDependency dependency : dependencies) {
+ if (!dependency.isSupportedByEditor()) {
+ java.net.URI changeToNS = dependency.getChangeToNS();
+ String errorMsg = Messages.AbstractSmooksFormEditor_Error_Unsupported
+ + dependency.getNamespaceURI()
+ + Messages.AbstractSmooksFormEditor_Error_Unsupported2;
+
+ if (changeToNS != null) {
+ errorMsg += Messages.AbstractSmooksFormEditor_Error_Update_Namespace
+ + changeToNS
+ + Messages.AbstractSmooksFormEditor_Error_Update_Namespace2;
+ }
+
+ throw new PartInitException(errorMsg);
+ }
+ }
+ }
+
+ protected StructuredTextEditor createTextEditor() {
+ SmooksXMLEditor xmlEditor = new SmooksXMLEditor() {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.jboss.tools.smooks.configuration.editors.SmooksXMLEditor#
+ * doSetInput(org.eclipse.ui.IEditorInput)
+ */
+ @Override
+ public void doSetInput(IEditorInput input) throws CoreException {
+ TextViewer viewer = getTextViewer();
+ if (viewer != null) {
+ IDocument document = viewer.getDocument();
+ if (document != null) {
+ document.removeDocumentListener(xmlDocumentTraker);
+ }
+ }
+ super.doSetInput(input);
+ viewer = getTextViewer();
+ if (viewer != null) {
+ IDocument document = viewer.getDocument();
+ if (document != null) {
+ document.addDocumentListener(xmlDocumentTraker);
+ }
+ }
+ }
+
+ public void createPartControl(Composite parent) {
+ super.createPartControl(parent);
+ getTextViewer().getDocument().addDocumentListener(
+ xmlDocumentTraker);
+
+ }
+
+ };
+ return xmlEditor;
+ }
+
+ public void createNewModelViaTextPage() {
+ IDocumentProvider dp = textEditor.getDocumentProvider();
+ if (dp == null)
+ return;
+ Exception exception = null;
+ int messageType = IMessageProvider.NONE;
+ IDocument document = dp.getDocument(textEditor.getEditorInput());
+ String conents = document.get();
+ InputStream stream = new ByteArrayInputStream(conents.getBytes());
+ exception = checkSmooksConfigContents(stream);
+ if (exception != null)
+ messageType = IMessageProvider.WARNING;
+ if (exception == null) {
+ try {
+ stream = new ByteArrayInputStream(conents.getBytes());
+ this.smooksModel = smooksEditorModelBuilder.readModel(stream);
+ } catch (Exception e) {
+ smooksModel = null;
+ exception = e;
+ messageType = IMessageProvider.ERROR;
+ } finally {
+ if (stream != null) {
+ try {
+ stream.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+ // setPlatformVersion(SmooksUIUtils.judgeSmooksPlatformVersion(smooksModel));
+ // judgeInputReader();
+ for (Iterator<?> iterator = this.sourceSynchronizeListener.iterator(); iterator
+ .hasNext();) {
+ ISourceSynchronizeListener l = (ISourceSynchronizeListener) iterator
+ .next();
+ try {
+ l.sourceChange(smooksModel);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ String message = null;
+ if (exception != null) {
+ message = exception.getMessage();
+ }
+ if (message == null) {
+ message = Messages.AbstractSmooksFormEditor_Error_Unknown;
+ }
+ for (Iterator<?> iterator = this.smooksInitListener.iterator(); iterator
+ .hasNext();) {
+ ISmooksEditorInitListener initListener = (ISmooksEditorInitListener) iterator
+ .next();
+ initListener.initFailed(messageType, message);
+ }
+ }
+
+ public void handleDocumentChange() {
+ createNewModelViaTextPage();
+ }
+
+ public class SmooksXMLEditorDocumentListener implements IDocumentListener {
+ protected Timer timer = new Timer();
+ protected TimerTask timerTask;
+
+ public void documentAboutToBeChanged(DocumentEvent documentEvent) {
+ // Ingore
+ }
+
+ public void documentChanged(final DocumentEvent documentEvent) {
+ try {
+ // This is need for the Properties view.
+ //
+ // setSelection(StructuredSelection.EMPTY);
+
+ if (timerTask != null) {
+ timerTask.cancel();
+ }
+
+ if (handleEMFModelChange) {
+ handleEMFModelChange = false;
+ } else {
+ timerTask = new TimerTask() {
+ @Override
+ public void run() {
+ getSite().getShell().getDisplay()
+ .asyncExec(new Runnable() {
+ public void run() {
+ handleDocumentChange();
+ }
+ });
+ }
+ };
+
+ timer.schedule(timerTask, 1000);
+ }
+ } catch (Exception exception) {
+ SmooksConfigurationActivator.log(exception);
+ }
+ }
+ }
+
+ public class SmooksResourceTraker implements IResourceChangeListener,
+ IResourceDeltaVisitor {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.core.resources.IResourceChangeListener#resourceChanged
+ * (org.eclipse.core.resources.IResourceChangeEvent)
+ */
+ public void resourceChanged(IResourceChangeEvent event) {
+ IResourceDelta delta = event.getDelta();
+ try {
+ if (delta != null)
+ delta.accept(this);
+ } catch (CoreException exception) {
+ }
+ }
+
+ public boolean visit(IResourceDelta delta) throws CoreException {
+ if (delta == null
+ || !delta.getResource().equals(
+ ((IFileEditorInput) getEditorInput()).getFile()))
+ return true;
+
+ if (delta.getKind() == IResourceDelta.REMOVED) {
+ Display display = getSite().getShell().getDisplay();
+ if ((IResourceDelta.MOVED_TO & delta.getFlags()) == 0) { // if
+ // the
+ // file
+ // was
+ // deleted
+ // NOTE: The case where an open, unsaved file is deleted is
+ // being handled by the
+ // PartListener added to the Workbench in the initialize()
+ // method.
+ display.asyncExec(new Runnable() {
+ public void run() {
+ // if (!isDirty())
+ closeEditor(false);
+ }
+ });
+ } else { // else if it was moved or renamed
+ final IFile newFile = ResourcesPlugin.getWorkspace()
+ .getRoot().getFile(delta.getMovedToPath());
+ display.asyncExec(new Runnable() {
+ public void run() {
+ // try {
+ // ((SmooksXMLEditor) textEditor).doSetInput(new
+ // FileEditorInput(newFile));
+ // } catch (CoreException e) {
+ // e.printStackTrace();
+ // }
+ setInput(new FileEditorInput(newFile));
+ }
+ });
+ }
+ }
+ return false;
+ }
+ }
+
+ private void closeEditor(boolean forceSave) {
+ this.close(forceSave);
+ }
+
+ public Model<SmooksModel> getSmooksModel() {
+ return smooksModel;
+ }
+
+}
Property changes on: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/dbm/editor/AbstractSmooksMultiplePageEditor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/dbm/editor/ISmooksModelProvider.java
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/dbm/editor/ISmooksModelProvider.java (rev 0)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/dbm/editor/ISmooksModelProvider.java 2010-07-07 07:04:14 UTC (rev 23270)
@@ -0,0 +1,15 @@
+/**
+ *
+ */
+package org.jboss.tools.smooks.dbm.editor;
+
+import org.jboss.tools.smooks.model.SmooksModel;
+import org.milyn.javabean.dynamic.Model;
+
+/**
+ * @author Dart
+ *
+ */
+public interface ISmooksModelProvider {
+ Model<SmooksModel> getSmooksModel();
+}
Property changes on: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/dbm/editor/ISmooksModelProvider.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/dbm/editor/SmooksConfigurationFormPage.java
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/dbm/editor/SmooksConfigurationFormPage.java (rev 0)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/dbm/editor/SmooksConfigurationFormPage.java 2010-07-07 07:04:14 UTC (rev 23270)
@@ -0,0 +1,333 @@
+/**
+ *
+ */
+package org.jboss.tools.smooks.dbm.editor;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.forms.IFormColors;
+import org.eclipse.ui.forms.IManagedForm;
+import org.eclipse.ui.forms.IMessage;
+import org.eclipse.ui.forms.editor.FormEditor;
+import org.eclipse.ui.forms.editor.FormPage;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.ScrolledPageBook;
+import org.eclipse.ui.forms.widgets.Section;
+import org.jboss.tools.smooks.configuration.SmooksConstants;
+import org.jboss.tools.smooks.configuration.editors.Messages;
+import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
+import org.jboss.tools.smooks.editor.ISourceSynchronizeListener;
+import org.jboss.tools.smooks.graphical.editors.ISmooksEditorInitListener;
+import org.jboss.tools.smooks.graphical.editors.SmooksMessage;
+import org.jboss.tools.smooks.model.core.Param;
+import org.jboss.tools.smooks.model.core.Params;
+
+/**
+ * @author Dart
+ *
+ */
+public class SmooksConfigurationFormPage extends FormPage implements ISmooksEditorInitListener , ISourceSynchronizeListener {
+
+ private String currentMessage = null;
+ private ISmooksModelProvider smooksModelProvider;
+// private ModelPanelCreator defaultSettingPanelCreator;
+ private Section globalParamSection;
+ private Section settingSection;
+ protected boolean lockEventFire = false;
+
+ private Combo streamFilterTypeCombo;
+ private Button defaultSerializationOnCheckbox;
+ private Combo versionCombo;
+ private int currentMessageType;
+
+ public SmooksConfigurationFormPage(FormEditor editor, String id,
+ String title, ISmooksModelProvider provider) {
+ super(editor, id, title);
+ this.smooksModelProvider = provider;
+ }
+
+ public SmooksConfigurationFormPage(String id, String title, ISmooksModelProvider provider) {
+ super(id, title);
+ this.smooksModelProvider = provider;
+ }
+
+ protected void createFormContent(IManagedForm managedForm) {
+ final ScrolledForm form = managedForm.getForm();
+ FormToolkit toolkit = managedForm.getToolkit();
+ toolkit.decorateFormHeading(form.getForm());
+ String title = getTitle();
+ form.setText(title);
+ GridLayout gl = new GridLayout();
+ gl.marginHeight = 0;
+ gl.marginWidth = 0;
+ form.getBody().setLayout(gl);
+
+ ScrolledPageBook pageBook = new ScrolledPageBook(form.getBody());
+ pageBook.setBackground(toolkit.getColors().getBackground());
+ Composite mainComposite = pageBook.createPage(pageBook);
+ pageBook.showPage(pageBook);
+
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ pageBook.setLayoutData(gd);
+
+ GridLayout mgl = new GridLayout();
+ mgl.numColumns = 2;
+ mgl.horizontalSpacing = 20;
+ mainComposite.setLayout(mgl);
+
+ settingSection = toolkit.createSection(mainComposite, Section.TITLE_BAR);
+ settingSection.setLayout(new FillLayout());
+ settingSection.setText(Messages.SmooksConfigurationOverviewPage_ConfigurationSectionTitle);
+ Composite settingComposite = toolkit.createComposite(settingSection);
+ settingSection.setClient(settingComposite);
+ gd = new GridData();
+ gd.widthHint = 500;
+ gd.verticalAlignment = GridData.BEGINNING;
+ settingSection.setLayoutData(gd);
+
+ GridLayout sgl = new GridLayout();
+ settingComposite.setLayout(sgl);
+ sgl.numColumns = 2;
+
+ createSettingSection(settingComposite, toolkit);
+
+ globalParamSection = toolkit.createSection(mainComposite, Section.TITLE_BAR | Section.TWISTIE
+ | Section.EXPANDED);
+ globalParamSection.setText(Messages.SmooksConfigurationOverviewPage_FilterSettingSectionTitle);
+ globalParamSection.setLayout(new FillLayout());
+ Composite globalParamComposite = toolkit.createComposite(globalParamSection);
+ globalParamSection.setClient(globalParamComposite);
+ gd = new GridData();
+ gd.verticalAlignment = GridData.BEGINNING;
+ gd.widthHint = 500;
+ globalParamSection.setLayoutData(gd);
+
+ GridLayout gpgl = new GridLayout();
+ globalParamComposite.setLayout(gpgl);
+ gpgl.numColumns = 2;
+
+ createGlobalParamterSection(globalParamComposite, toolkit);
+
+
+ updateFormHeader();
+ }
+
+ protected void updateFormHeader() {
+ if (currentMessageType == IMessageProvider.NONE) {
+ if (this.getManagedForm() != null) {
+ getManagedForm().getMessageManager().removeAllMessages();
+ getManagedForm().getMessageManager().update();
+
+ streamFilterTypeCombo.setEnabled(true);
+ defaultSerializationOnCheckbox.setEnabled(true);
+ }
+ } else {
+ if (this.getManagedForm() != null) {
+ streamFilterTypeCombo.setEnabled(false);
+ defaultSerializationOnCheckbox.setEnabled(false);
+ String[] messages = currentMessage.split("\n"); //$NON-NLS-1$
+ List<IMessage> messageList = new ArrayList<IMessage>();
+ for (int i = 0; i < messages.length; i++) {
+ String message = messages[i];
+ if (message != null)
+ message.trim();
+ if (message.length() == 0) {
+ continue;
+ }
+ messageList.add(new SmooksMessage(currentMessageType, message));
+ }
+ String mainMessage = null;
+ if (messageList.isEmpty()) {
+ mainMessage = currentMessage;
+ } else {
+ mainMessage = messageList.get(0).getMessage();
+ }
+ this.getManagedForm().getForm().getForm().setMessage(mainMessage, currentMessageType,
+ messageList.toArray(new IMessage[] {}));
+ }
+ }
+ }
+
+ private void createSettingSection(Composite settingComposite, FormToolkit toolkit) {
+ toolkit.createLabel(settingComposite, Messages.SmooksConfigurationOverviewPage_VersionLabel).setForeground(
+ toolkit.getColors().getColor(IFormColors.TITLE));
+ int type = SWT.BORDER;
+// if (SmooksUIUtils.isLinuxOS()) {
+// type = SWT.BORDER;
+// }
+ versionCombo = new Combo(settingComposite, type | SWT.READ_ONLY);
+ versionCombo.setEnabled(false);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ versionCombo.setLayoutData(gd);
+ for (int i = 0; i < SmooksConstants.SMOOKS_VERSIONS.length; i++) {
+ String version = SmooksConstants.SMOOKS_VERSIONS[i];
+ versionCombo.add(version);
+ }
+
+ String version = getSmooksVersion();
+ if (version != null)
+ versionCombo.setText(version);
+ versionCombo.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ // if (smooksModelProvider != null) {
+ // smooksModelProvider.getSmooksGraphicsExt().setPlatformVersion(v);
+ // }
+ }
+ });
+
+ toolkit.paintBordersFor(settingComposite);
+ }
+
+ private String getSmooksVersion() {
+ return "1.1";
+ }
+
+
+ private void createGlobalParamterSection(Composite globalParamComposite, FormToolkit toolkit) {
+ if (smooksModelProvider != null) {
+
+ toolkit.createLabel(globalParamComposite, Messages.SmooksConfigurationOverviewPage_FilterTypeLabel)
+ .setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ GridData gd = new GridData(SWT.FILL, SWT.NONE, true, false);
+ streamFilterTypeCombo = new Combo(globalParamComposite, SWT.DROP_DOWN | SWT.READ_ONLY);
+ streamFilterTypeCombo.setItems(new String[] { "SAX", "DOM" }); //$NON-NLS-1$ //$NON-NLS-2$
+ streamFilterTypeCombo.setLayoutData(gd);
+
+ toolkit.createLabel(globalParamComposite, Messages.SmooksConfigurationOverviewPage_SerializationLabel)
+ .setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ gd = new GridData(SWT.FILL, SWT.NONE, true, false);
+ defaultSerializationOnCheckbox = toolkit.createButton(globalParamComposite, null, SWT.CHECK); //$NON-NLS-1$
+ defaultSerializationOnCheckbox.setLayoutData(gd);
+
+ initGlobalSettingControls();
+
+ toolkit.paintBordersFor(globalParamComposite);
+
+ streamFilterTypeCombo.addSelectionListener(new SelectionListener() {
+
+ public void widgetSelected(SelectionEvent e) {
+ if (lockEventFire)
+ return;
+ String value = streamFilterTypeCombo.getText();
+ updateGlobalProperty("stream.filter.type", value); //$NON-NLS-1$
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+ });
+
+ defaultSerializationOnCheckbox.addSelectionListener(new SelectionListener() {
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ if (lockEventFire)
+ return;
+ String value = Boolean.toString(defaultSerializationOnCheckbox.getSelection());
+ updateGlobalProperty("default.serialization.on", value); //$NON-NLS-1$
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ widgetDefaultSelected(e);
+ }
+ });
+ }
+
+ }
+
+ protected Params getParams(){
+ if(smooksModelProvider != null){
+ return smooksModelProvider.getSmooksModel().getModelRoot().getParams();
+ }
+ return null;
+ }
+
+ protected void initGlobalSettingControls() {
+ Params m = getParams();
+ if (m != null) {
+ List<Param> parmList = m.getParams();
+ for (int i = 0; i < parmList.size(); i++) {
+ Param param = (Param) parmList.get(i);
+ if (param.getName().equals("stream.filter.type")) { //$NON-NLS-1$
+ streamFilterTypeCombo.setText(param.getValue());
+ } else if (param.getName().equals("default.serialization.on")) { //$NON-NLS-1$
+ Boolean boolValue = Boolean.valueOf(param.getValue());
+ defaultSerializationOnCheckbox.setSelection(boolValue.booleanValue());
+ }
+ }
+ } else { // set defaults
+ streamFilterTypeCombo.setText("SAX"); //$NON-NLS-1$
+ defaultSerializationOnCheckbox.setSelection(true);
+ }
+ }
+
+ private void updateGlobalProperty(String propertyID, String value) {
+ boolean foundProperty = false;
+ if (getSmooksVersion() == null) {
+ return;
+ }
+ Params parent = getParams();
+ Param param = null;
+ Param newparam = null;
+ if (parent != null) {
+ List<?> parmList = parent.getParams();
+ for (int i = 0; i < parmList.size(); i++) {
+ param = (Param) parmList.get(i);
+ if (param.getName().equals(propertyID)) {
+ param.setValue(value);
+ foundProperty = true;
+ break;
+ }
+ }
+ }
+ if(!foundProperty){
+ newparam = new Param();
+ newparam.setName(propertyID);
+ newparam.setValue(value);
+ parent.getParams().add(newparam);
+ }
+ }
+
+ public void initFailed(int messageType, String message) {
+
+ }
+
+ public void sourceChange(Object model) {
+ lockEventFire = true;
+ if (streamFilterTypeCombo == null || defaultSerializationOnCheckbox == null || versionCombo == null) {
+ lockEventFire = false;
+ return;
+ }
+ streamFilterTypeCombo.setEnabled(true);
+ defaultSerializationOnCheckbox.setEnabled(true);
+ String version = getSmooksVersion();
+ if (version == null)
+ version = ""; //$NON-NLS-1$
+ versionCombo.setText(version);
+
+ if (model == null) {
+ // the file was broken
+ streamFilterTypeCombo.setEnabled(false);
+
+ defaultSerializationOnCheckbox.setEnabled(false);
+ defaultSerializationOnCheckbox.setSelection(false);
+ } else {
+ initGlobalSettingControls();
+ }
+ lockEventFire = false;
+ }
+}
Property changes on: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/dbm/editor/SmooksConfigurationFormPage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/dbm/editor/SmooksMultiplePageEditor.java
===================================================================
--- branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/dbm/editor/SmooksMultiplePageEditor.java (rev 0)
+++ branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/dbm/editor/SmooksMultiplePageEditor.java 2010-07-07 07:04:14 UTC (rev 23270)
@@ -0,0 +1,35 @@
+/**
+ *
+ */
+package org.jboss.tools.smooks.dbm.editor;
+
+import org.eclipse.ui.PartInitException;
+import org.jboss.tools.smooks.configuration.editors.Messages;
+
+/**
+ * @author Dart
+ *
+ */
+public class SmooksMultiplePageEditor extends AbstractSmooksMultiplePageEditor {
+
+ private SmooksConfigurationFormPage optionsPage;
+
+ @Override
+ protected void addPages() {
+ optionsPage = createSmooksConfigurationOverviewPage();
+ addSourceSynchronizeListener(optionsPage);
+ addSmooksEditorInitListener(optionsPage);
+ try {
+ int index = this.addPage(optionsPage);
+ setPageText(index, Messages.SmooksMultiFormEditor_opetiontab_label);
+ } catch (PartInitException e) {
+ e.printStackTrace();
+ }
+ super.addPages();
+ }
+
+ private SmooksConfigurationFormPage createSmooksConfigurationOverviewPage() {
+ return new SmooksConfigurationFormPage(this,
+ "options_page", Messages.SmooksMultiFormEditor_optinepage_name, this); //$NON-NLS-1$
+ }
+}
Property changes on: branches/smooks-dmb/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/dbm/editor/SmooksMultiplePageEditor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 9 months
JBoss Tools SVN: r23269 - branches and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2010-07-07 00:17:12 -0400 (Wed, 07 Jul 2010)
New Revision: 23269
Added:
branches/jbosstools-3.2.0.M1/
Removed:
jbosstools-3.2.0.M1/
Log:
tag as 3.2.0.M1
Copied: branches/jbosstools-3.2.0.M1 (from rev 23268, jbosstools-3.2.0.M1)
15 years, 9 months
JBoss Tools SVN: r23268 - /.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2010-07-07 00:12:48 -0400 (Wed, 07 Jul 2010)
New Revision: 23268
Added:
jbosstools-3.2.0.M1/
Log:
tag as 3.2.0.M1
Copied: jbosstools-3.2.0.M1 (from rev 23267, trunk)
15 years, 9 months
JBoss Tools SVN: r23267 - trunk/documentation/guides/Teiid_Designer_User_Guide/en-US.
by jbosstools-commits@lists.jboss.org
Author: irooskov(a)redhat.com
Date: 2010-07-06 23:04:36 -0400 (Tue, 06 Jul 2010)
New Revision: 23267
Modified:
trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/editingmodelobjects.xml
trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/editmodelsandprojects.xml
trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/editors.xml
trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/importers.xml
trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/intro.xml
trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/legal_notice.xml
trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/mainmenu.xml
trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/master.xml
trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/newmodels.xml
trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/perspectives.xml
trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/preferences.xml
trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/relationships.xml
trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/searching.xml
trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/testmodels.xml
trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/views.xml
Log:
updated to build with Publican and Maven
Modified: trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/editingmodelobjects.xml
===================================================================
--- trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/editingmodelobjects.xml 2010-07-06 23:57:23 UTC (rev 23266)
+++ trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/editingmodelobjects.xml 2010-07-07 03:04:36 UTC (rev 23267)
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"[
-<!ENTITY % CustomDTD SYSTEM "../custom.dtd">
-%CustomDTD;
-]>
+
<chapter id="editing-model-objects-chapter">
<title>Creating and Editing Model Objects</title>
<para><emphasis role="bold">Go To: <ulink url="index.html">Table of Contents</ulink></emphasis></para>
@@ -1565,4 +1562,4 @@
</figure>
</sect2>
</sect1>
-</chapter>
\ No newline at end of file
+</chapter>
Modified: trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/editmodelsandprojects.xml
===================================================================
--- trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/editmodelsandprojects.xml 2010-07-06 23:57:23 UTC (rev 23266)
+++ trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/editmodelsandprojects.xml 2010-07-07 03:04:36 UTC (rev 23267)
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"[
-<!ENTITY % CustomDTD SYSTEM "../custom.dtd">
-%CustomDTD;
-]>
+
<chapter id="edit-models-and-projects-chapter">
<title>Editing Models and Projects</title>
<para><emphasis role="bold">Go To: <ulink url="index.html">Table of Contents</ulink></emphasis></para>
@@ -266,4 +263,4 @@
</itemizedlist>
</sect1>
</chapter>
-
\ No newline at end of file
+
Modified: trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/editors.xml
===================================================================
--- trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/editors.xml 2010-07-06 23:57:23 UTC (rev 23266)
+++ trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/editors.xml 2010-07-07 03:04:36 UTC (rev 23267)
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"[
-<!ENTITY % CustomDTD SYSTEM "../custom.dtd">
-%CustomDTD;
-]>
+
<chapter id="editors-chapter">
<title>Editors</title>
@@ -1163,4 +1160,4 @@
</sect2>
</sect1>
-</chapter>
\ No newline at end of file
+</chapter>
Modified: trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/importers.xml
===================================================================
--- trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/importers.xml 2010-07-06 23:57:23 UTC (rev 23266)
+++ trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/importers.xml 2010-07-07 03:04:36 UTC (rev 23267)
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"[
-<!ENTITY % CustomDTD SYSTEM "../custom.dtd">
-%CustomDTD;
-]>
+
<chapter id="importers-chapter">
<title>Importers</title>
<para><emphasis role="bold">Go To: <ulink url="index.html">Table of Contents</ulink></emphasis></para>
@@ -1427,4 +1424,4 @@
</itemizedlist>
</sect1>
-</chapter>
\ No newline at end of file
+</chapter>
Modified: trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/intro.xml
===================================================================
--- trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/intro.xml 2010-07-06 23:57:23 UTC (rev 23266)
+++ trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/intro.xml 2010-07-07 03:04:36 UTC (rev 23267)
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"[
-<!ENTITY % CustomDTD SYSTEM "../custom.dtd">
-%CustomDTD;
-]>
+
<chapter id="intro-chapter">
<title>Introduction</title>
<para><emphasis role="bold">Go To: <ulink url="index.html">Table of Contents</ulink></emphasis></para>
@@ -720,4 +717,4 @@
</sect1>
-</chapter>
\ No newline at end of file
+</chapter>
Modified: trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/legal_notice.xml
===================================================================
--- trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/legal_notice.xml 2010-07-06 23:57:23 UTC (rev 23266)
+++ trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/legal_notice.xml 2010-07-07 03:04:36 UTC (rev 23267)
@@ -23,8 +23,8 @@
02110-1301 USA.
-->
-<!DOCTYPE legalnotice PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
+
<legalnotice id="Legal_Notice">
<title>Legal Notice</title>
<para>
Modified: trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/mainmenu.xml
===================================================================
--- trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/mainmenu.xml 2010-07-06 23:57:23 UTC (rev 23266)
+++ trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/mainmenu.xml 2010-07-07 03:04:36 UTC (rev 23267)
@@ -1,9 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"[
-<!ENTITY % CustomDTD SYSTEM "../custom.dtd">
-%CustomDTD;
-]>
+
<!-- ####### MAIN MENU ######################################## -->
<chapter id="main-menu-chapter">
@@ -779,4 +776,4 @@
</figure>
</sect1>
-</chapter>
\ No newline at end of file
+</chapter>
Modified: trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/master.xml
===================================================================
--- trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/master.xml 2010-07-06 23:57:23 UTC (rev 23266)
+++ trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/master.xml 2010-07-07 03:04:36 UTC (rev 23267)
@@ -14,18 +14,15 @@
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
# ================================================================================== -->
-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
- <!ENTITY % CustomDTD SYSTEM "custom.dtd">
- %CustomDTD;
-]>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.docbook.org/xml/4.5/docbookx.dtd" [
+]>
<book>
<bookinfo>
- <title>&ProjectProduct;</title>
- <subtitle>Users Guide</subtitle>
- <releaseinfo>&versionNumber;
+ <title>Teiid Designer User Guide</title>
+ <releaseinfo>6.0.0
</releaseinfo>
- <productnumber>&versionNumber;
+ <productnumber>6.0.0
</productnumber>
<issuenum>1</issuenum>
<mediaobject>
@@ -37,25 +34,26 @@
</imageobject>
</mediaobject>
<copyright>
- <year>©rightYear;
+ <year>2010
</year>
- <holder>©rightHolder;
+ <holder>Red Hat, Inc.
</holder>
</copyright>
<xi:include href="legal_notice.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
</bookinfo>
- <xi:include href="content/intro.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="content/perspectives.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="content/mainmenu.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="content/views.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="content/editors.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="content/importers.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="content/newmodels.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="content/editingmodelobjects.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="content/editmodelsandprojects.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="content/testmodels.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="content/searching.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="content/relationships.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="content/preferences.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
-</book>
\ No newline at end of file
+
+ <xi:include href="intro.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="perspectives.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="mainmenu.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="views.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="editors.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="importers.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="newmodels.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="editingmodelobjects.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="editmodelsandprojects.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="testmodels.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="searching.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="relationships.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="preferences.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+</book>
Modified: trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/newmodels.xml
===================================================================
--- trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/newmodels.xml 2010-07-06 23:57:23 UTC (rev 23266)
+++ trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/newmodels.xml 2010-07-07 03:04:36 UTC (rev 23267)
@@ -1,9 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"[
-<!ENTITY % CustomDTD SYSTEM "../custom.dtd">
-%CustomDTD;
-]>
+
<!-- ####### NEW MODEL WIZARDS AND BUILDERS ######################################## -->
<chapter id="newmodels-chapter">
@@ -1535,4 +1532,4 @@
</itemizedlist>
</sect2>
</sect1>
-</chapter>
\ No newline at end of file
+</chapter>
Modified: trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/perspectives.xml
===================================================================
--- trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/perspectives.xml 2010-07-06 23:57:23 UTC (rev 23266)
+++ trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/perspectives.xml 2010-07-07 03:04:36 UTC (rev 23267)
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"[
-<!ENTITY % CustomDTD SYSTEM "../custom.dtd">
-%CustomDTD;
-]>
+
<chapter id="perspectives-chapter">
<title>Teiid Designer Perspectives</title>
<para><emphasis role="bold">Go To: <ulink url="index.html">Table of Contents</ulink></emphasis></para>
@@ -194,4 +191,4 @@
</mediaobject>
</figure>
</sect1>
-</chapter>
\ No newline at end of file
+</chapter>
Modified: trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/preferences.xml
===================================================================
--- trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/preferences.xml 2010-07-06 23:57:23 UTC (rev 23266)
+++ trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/preferences.xml 2010-07-07 03:04:36 UTC (rev 23267)
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"[
-<!ENTITY % CustomDTD SYSTEM "../custom.dtd">
-%CustomDTD;
-]>
+
<chapter id="preferences-chapter">
<title>User Preferences</title>
@@ -271,4 +268,4 @@
</sect2>
</sect1>
-</chapter>
\ No newline at end of file
+</chapter>
Modified: trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/relationships.xml
===================================================================
--- trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/relationships.xml 2010-07-06 23:57:23 UTC (rev 23266)
+++ trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/relationships.xml 2010-07-07 03:04:36 UTC (rev 23267)
@@ -1,9 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"[
-<!ENTITY % CustomDTD SYSTEM "../custom.dtd">
-%CustomDTD;
-]>
+
<!-- ####### GENERIC RELATIONSHIPS ######################################## -->
<chapter id="relationships-chapter">
@@ -374,4 +371,4 @@
<para> The navigator also provides toolbar and right-click menu actions
to perform various functions in the navigator.</para>
</sect1>
-</chapter>
\ No newline at end of file
+</chapter>
Modified: trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/searching.xml
===================================================================
--- trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/searching.xml 2010-07-06 23:57:23 UTC (rev 23266)
+++ trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/searching.xml 2010-07-07 03:04:36 UTC (rev 23267)
@@ -1,9 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"[
-<!ENTITY % CustomDTD SYSTEM "../custom.dtd">
-%CustomDTD;
-]>
+
<!-- ####### SEARCHING ######################################### -->
<chapter id="searching-chapter">
Modified: trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/testmodels.xml
===================================================================
--- trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/testmodels.xml 2010-07-06 23:57:23 UTC (rev 23266)
+++ trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/testmodels.xml 2010-07-07 03:04:36 UTC (rev 23267)
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"[
-<!ENTITY % CustomDTD SYSTEM "../custom.dtd">
-%CustomDTD;
-]>
+
<chapter id="test-models-chapter">
<title>Testing Your Models</title>
@@ -665,4 +662,4 @@
</figure>
</sect1>
-</chapter>
\ No newline at end of file
+</chapter>
Modified: trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/views.xml
===================================================================
--- trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/views.xml 2010-07-06 23:57:23 UTC (rev 23266)
+++ trunk/documentation/guides/Teiid_Designer_User_Guide/en-US/views.xml 2010-07-07 03:04:36 UTC (rev 23267)
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"[
-<!ENTITY % CustomDTD SYSTEM "../custom.dtd">
-%CustomDTD;
-]>
+
<chapter id="views-chapter">
<title>Teiid Designer Views</title>
@@ -1238,4 +1235,4 @@
</figure>
</sect1>
-</chapter>
\ No newline at end of file
+</chapter>
15 years, 9 months
JBoss Tools SVN: r23266 - trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/META-INF.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2010-07-06 19:57:23 -0400 (Tue, 06 Jul 2010)
New Revision: 23266
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/META-INF/MANIFEST.MF
Log:
fix for 10 errors in JBIDE4373Test
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/META-INF/MANIFEST.MF 2010-07-06 23:26:25 UTC (rev 23265)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/META-INF/MANIFEST.MF 2010-07-06 23:57:23 UTC (rev 23266)
@@ -37,7 +37,11 @@
org.jboss.tools.jsf.vpe.facelets;bundle-version="3.1.0",
org.jboss.tools.jsf.vpe.richfaces;bundle-version="3.1.0",
org.jboss.tools.jsf.vpe.myfaces;bundle-version="3.1.0",
- org.jboss.tools.jsf.vpe.jstl;bundle-version="3.1.0"
+ org.jboss.tools.jsf.vpe.jstl;bundle-version="3.1.0",
+ org.jboss.tools.jsf.text.ext;bundle-version="3.1.0",
+ org.jboss.tools.jsf.text.ext.facelets;bundle-version="3.1.0",
+ org.jboss.tools.jsf.text.ext.richfaces;bundle-version="3.1.0",
+ org.jboss.tools.jst.text.ext;bundle-version="3.1.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: org.jboss.tools.jsf.vpe.jsf.test
15 years, 9 months