JBoss Tools SVN: r17130 - in trunk/jsf: plugins/org.jboss.tools.jsf.vpe.facelets/src/org/jboss/tools/jsf/vpe/facelets/template and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: yradtsevich
Date: 2009-08-18 09:56:19 -0400 (Tue, 18 Aug 2009)
New Revision: 17130
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.facelets/src/org/jboss/tools/jsf/vpe/facelets/template/messages/
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.facelets/src/org/jboss/tools/jsf/vpe/facelets/template/messages/Messages.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.facelets/src/org/jboss/tools/jsf/vpe/facelets/template/messages/messages.properties
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.facelets/src/org/jboss/tools/jsf/vpe/facelets/util/
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.facelets/src/org/jboss/tools/jsf/vpe/facelets/util/FaceletsUtil.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/resources/faceletsTest/WebContent/pages/components/composition_errorMessage.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/resources/faceletsTest/WebContent/pages/components/composition_errorMessage.xhtml.xml
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.facelets/src/org/jboss/tools/jsf/vpe/facelets/template/VpeCompositionTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.facelets/src/org/jboss/tools/jsf/vpe/facelets/template/VpeDefineTemplate.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/src/org/jboss/tools/jsf/vpe/facelets/test/FaceletsComponentContentTest.java
Log:
issue JBIDE-4416: Modify templates for ui:composition and ui:define
https://jira.jboss.org/jira/browse/JBIDE-4416
- the part #1 has been fixed: now if the template file is not found, error message is shown.
- JUnit test has been added
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.facelets/src/org/jboss/tools/jsf/vpe/facelets/template/VpeCompositionTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.facelets/src/org/jboss/tools/jsf/vpe/facelets/template/VpeCompositionTemplate.java 2009-08-18 13:34:19 UTC (rev 17129)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.facelets/src/org/jboss/tools/jsf/vpe/facelets/template/VpeCompositionTemplate.java 2009-08-18 13:56:19 UTC (rev 17130)
@@ -12,7 +12,10 @@
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
+import org.eclipse.osgi.util.NLS;
+import org.jboss.tools.jsf.vpe.facelets.template.messages.Messages;
import org.jboss.tools.jsf.vpe.facelets.template.util.Facelets;
+import org.jboss.tools.jsf.vpe.facelets.util.FaceletsUtil;
import org.jboss.tools.vpe.editor.VpeVisualDomBuilder;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
@@ -28,32 +31,33 @@
public class VpeCompositionTemplate extends VpeDefineContainerTemplate {
+ public static final String MESSAGE_STYLE
+ = "color:red;font-style:italic;"; //$NON-NLS-1$
+ public static final String ANY_TAG_CAPTION_CLASS
+ = "__any__tag__caption"; //$NON-NLS-1$
+
public VpeCreationData create(VpePageContext pageContext, Node sourceNode, nsIDOMDocument visualDocument){
Attr attr = ((Element)sourceNode).getAttributeNode(Facelets.ATTR_TEMPLATE);
- if (attr != null) {
- return super.createTemplate(attr.getNodeValue(), pageContext, sourceNode, visualDocument);
- } else {
- nsIDOMElement composition = visualDocument.createElement(HTML.TAG_DIV);
- return new VpeCreationData(composition);
- }
+ return super.createTemplate(attr == null ? null : attr.getNodeValue(),
+ pageContext, sourceNode, visualDocument);
}
protected VpeCreationData createStub(String fileName, Node sourceElement, nsIDOMDocument visualDocument) {
nsIDOMElement container = visualDocument.createElement(HTML.TAG_DIV);
- container.setAttribute("style", "border: 1px dashed #2A7F00"); //$NON-NLS-1$ //$NON-NLS-2$
+ container.setAttribute(HTML.ATTR_STYLE, "border: 1px dashed #2A7F00"); //$NON-NLS-1$
VpeVisualDomBuilder.markIncludeElement(container);
- nsIDOMElement title = visualDocument.createElement(HTML.TAG_DIV);
- nsIDOMElement tag = visualDocument.createElement(HTML.TAG_SPAN);
- tag.setAttribute("class", "__any__tag__caption"); //$NON-NLS-1$ //$NON-NLS-2$
- tag.appendChild(visualDocument.createTextNode(sourceElement.getNodeName()));
- title.appendChild(tag);
- if (fileName != null) {
- title.appendChild(visualDocument.createTextNode(fileName));
+ final String message;
+ if (fileName == null) {
+ message = Messages.TEMPLATE_NOT_SPECIFIED;
+ } else {
+ message = NLS.bind(Messages.TEMPLATE_NOT_FOUND, fileName);
}
- container.appendChild(title);
-
+
+ container.appendChild(FaceletsUtil.createErrorMessageElement(
+ visualDocument, sourceElement.getNodeName(), message));
+
return new VpeCreationData(container);
}
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 2009-08-18 13:34:19 UTC (rev 17129)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.facelets/src/org/jboss/tools/jsf/vpe/facelets/template/VpeDefineTemplate.java 2009-08-18 13:56:19 UTC (rev 17130)
@@ -10,6 +10,10 @@
******************************************************************************/
package org.jboss.tools.jsf.vpe.facelets.template;
+import org.eclipse.osgi.util.NLS;
+import org.jboss.tools.jsf.vpe.facelets.template.messages.Messages;
+import org.jboss.tools.jsf.vpe.facelets.template.util.Facelets;
+import org.jboss.tools.jsf.vpe.facelets.util.FaceletsUtil;
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
@@ -57,19 +61,19 @@
private VpeCreationData createStub(Element sourceElement, nsIDOMDocument visualDocument) {
nsIDOMElement container = visualDocument.createElement(HTML.TAG_DIV);
- container.setAttribute("style", "border: 1px solid gray"); //$NON-NLS-1$ //$NON-NLS-2$
+ container.setAttribute(HTML.ATTR_STYLE, "border: 1px solid gray"); //$NON-NLS-1$
- nsIDOMElement title = visualDocument.createElement(HTML.TAG_DIV);
- nsIDOMElement tag = visualDocument.createElement(HTML.TAG_SPAN);
- tag.setAttribute("class", "__any__tag__caption"); //$NON-NLS-1$ //$NON-NLS-2$
- tag.appendChild(visualDocument.createTextNode(sourceElement.getNodeName()));
- title.appendChild(tag);
- String name = sourceElement.getAttribute("name"); //$NON-NLS-1$
- if (name != null && name.length() > 0) {
- title.appendChild(visualDocument.createTextNode(name));
+ String name = sourceElement.getAttribute(Facelets.ATTR_NAME);
+ final String message;
+ if (name != null) {
+ message = NLS.bind(Messages.UNKNOWN_NAME, name);
+ } else {
+ message = Messages.NAME_NOT_SPECIFIED;
}
- container.appendChild(title);
-
+
+ container.appendChild(FaceletsUtil.createErrorMessageElement(
+ visualDocument, sourceElement.getNodeName(), message));
+
return new VpeCreationData(container);
}
}
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.facelets/src/org/jboss/tools/jsf/vpe/facelets/template/messages/Messages.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.facelets/src/org/jboss/tools/jsf/vpe/facelets/template/messages/Messages.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.facelets/src/org/jboss/tools/jsf/vpe/facelets/template/messages/Messages.java 2009-08-18 13:56:19 UTC (rev 17130)
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.vpe.facelets.template.messages;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * @author yradtsevich
+ *
+ */
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME
+ = "org.jboss.tools.jsf.vpe.facelets.template.messages.messages";//$NON-NLS-1$
+ static {
+ // load message values from bundle file
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+ private Messages(){}
+
+ public static String TEMPLATE_NOT_SPECIFIED;
+ public static String TEMPLATE_NOT_FOUND;
+ public static String UNKNOWN_NAME;
+ public static String NAME_NOT_SPECIFIED;
+}
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.facelets/src/org/jboss/tools/jsf/vpe/facelets/template/messages/messages.properties
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.facelets/src/org/jboss/tools/jsf/vpe/facelets/template/messages/messages.properties (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.facelets/src/org/jboss/tools/jsf/vpe/facelets/template/messages/messages.properties 2009-08-18 13:56:19 UTC (rev 17130)
@@ -0,0 +1,4 @@
+TEMPLATE_NOT_SPECIFIED=Template file is not specified.
+TEMPLATE_NOT_FOUND=Template file is not found: "{0}"
+UNKNOWN_NAME=Unknown name: "{0}"
+NAME_NOT_SPECIFIED=Name is not specified.
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.facelets/src/org/jboss/tools/jsf/vpe/facelets/util/FaceletsUtil.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.facelets/src/org/jboss/tools/jsf/vpe/facelets/util/FaceletsUtil.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.facelets/src/org/jboss/tools/jsf/vpe/facelets/util/FaceletsUtil.java 2009-08-18 13:56:19 UTC (rev 17130)
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.vpe.facelets.util;
+
+import org.jboss.tools.vpe.editor.util.HTML;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
+
+/**
+ * Contains various utility methods used by facelets templates.
+ *
+ * @author yradtsevich
+ */
+public class FaceletsUtil {
+ private static final String ANY_TAG_CAPTION_CLASS
+ = "__any__tag__caption"; //$NON-NLS-1$
+ private static final String MESSAGE_STYLE
+ = "color:red;font-style:italic;"; //$NON-NLS-1$
+
+ /**
+ * Creates and returns a DIV element composed of name of JSP tag
+ * and the errorMessage.
+ * <P>
+ * Should be used to show messages in the VPE like:
+ * <pre>ui:composition Template is not found.</pre>
+ */
+ public static nsIDOMElement createErrorMessageElement(
+ nsIDOMDocument visualDocument,
+ String tagName, String errorMessage) {
+ nsIDOMElement element = visualDocument.createElement(HTML.TAG_DIV);
+
+ nsIDOMElement nameTag = visualDocument.createElement(HTML.TAG_SPAN);
+ nameTag.setAttribute(HTML.ATTR_CLASS, ANY_TAG_CAPTION_CLASS);
+ nameTag.appendChild(visualDocument.createTextNode(tagName));
+ element.appendChild(nameTag);
+
+ nsIDOMElement messageTag = visualDocument.createElement(HTML.TAG_SPAN);
+ messageTag.setAttribute(HTML.ATTR_CLASS, ANY_TAG_CAPTION_CLASS);
+ messageTag.setAttribute(HTML.ATTR_STYLE, MESSAGE_STYLE);
+ messageTag.appendChild(visualDocument.createTextNode(
+ " " + errorMessage));//$NON-NLS-1$
+ element.appendChild(messageTag);
+
+ return element;
+ }
+}
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/resources/faceletsTest/WebContent/pages/components/composition_errorMessage.xhtml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/resources/faceletsTest/WebContent/pages/components/composition_errorMessage.xhtml (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/resources/faceletsTest/WebContent/pages/components/composition_errorMessage.xhtml 2009-08-18 13:56:19 UTC (rev 17130)
@@ -0,0 +1,10 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core">
+
+<ui:composition template="/pages/components/notexistedfile.xhtml" id="composition1">
+ <ui:define name="pageTitle">JSF 1.2 and Facelets under Tomcat. KickStart Application</ui:define>
+</ui:composition>
+</html>
Added: trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/resources/faceletsTest/WebContent/pages/components/composition_errorMessage.xhtml.xml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/resources/faceletsTest/WebContent/pages/components/composition_errorMessage.xhtml.xml (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/resources/faceletsTest/WebContent/pages/components/composition_errorMessage.xhtml.xml 2009-08-18 13:56:19 UTC (rev 17130)
@@ -0,0 +1,27 @@
+<tests>
+ <test id="composition1">
+ <DIV STYLE="border: 1px dashed rgb(42, 127, 0);">
+ <DIV>
+ <SPAN CLASS="__any__tag__caption">
+ ui:composition
+ </SPAN>
+ <SPAN CLASS="__any__tag__caption" STYLE="color: red; font-style: italic;">
+ Template file is not found: "/pages/components/notexistedfile.xhtml"
+ </SPAN>
+ </DIV>
+ <DIV STYLE="border: 1px solid gray;">
+ <DIV>
+ <SPAN CLASS="__any__tag__caption">
+ ui:define
+ </SPAN>
+ <SPAN CLASS="__any__tag__caption" STYLE="color: red; font-style: italic;">
+ Unknown name: "pageTitle"
+ </SPAN>
+ </DIV>
+ <SPAN CLASS="vpe-text">
+ JSF 1.2 and Facelets under Tomcat. KickStart Application
+ </SPAN>
+ </DIV>
+ </DIV>
+ </test>
+</tests>
\ No newline at end of file
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/src/org/jboss/tools/jsf/vpe/facelets/test/FaceletsComponentContentTest.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/src/org/jboss/tools/jsf/vpe/facelets/test/FaceletsComponentContentTest.java 2009-08-18 13:34:19 UTC (rev 17129)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.facelets.test/src/org/jboss/tools/jsf/vpe/facelets/test/FaceletsComponentContentTest.java 2009-08-18 13:56:19 UTC (rev 17130)
@@ -21,13 +21,16 @@
performContentTest("components/compositionWithoutTaglibs.xhtml");//$NON-NLS-1$
}
+ public void testCompositionErrorMessage() throws Throwable {
+ performContentTest("components/composition_errorMessage.xhtml");//$NON-NLS-1$
+ }
+
public void testCustomFaceletComponent() throws Throwable {
performContentTest("components/customFaceletComponent.xhtml");//$NON-NLS-1$
}
-
+
@Override
protected String getTestProjectName() {
return FaceletsAllTests.IMPORT_PROJECT_NAME;
}
-
}
16 years, 4 months
JBoss Tools SVN: r17129 - in trunk/hibernatetools: plugins/org.hibernate.eclipse/src/org/hibernate/console/node and 9 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2009-08-18 09:34:19 -0400 (Tue, 18 Aug 2009)
New Revision: 17129
Added:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConcoleConfigurationAdapter.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/KnownConfigurationsAdapter.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaProject.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/NamingStrategyMappingTools.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaColumn.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaJoinColumn.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaManyToManyMapping.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaManyToOneMapping.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaOneToManyMapping.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaOneToOneMapping.java
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/ConfigurationCombo.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsolePlugin.java
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/KnownConfigurationsProvider.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfigurationListener.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/KnownConfigurations.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/KnownConfigurationsListener.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/ConfigurationListNode.java
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/ConfigurationNode.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/META-INF/MANIFEST.MF
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaFactory.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJptPlugin.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaEntityImpl.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/platform/HibernateJpaPlatformUi.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizard.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizardPage.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizard.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizardPage.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateInitWizardPage.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/KnownConfigurationsTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4761
Added HibernateProject-point to add hibernate specific methods (getNamingStrategy/ConsoleConfiguration)
Added listener to ConsoleConfiguration build process.
Added NamingStrategy support in default db object's name.
Added: trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConcoleConfigurationAdapter.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConcoleConfigurationAdapter.java (rev 0)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConcoleConfigurationAdapter.java 2009-08-18 13:34:19 UTC (rev 17129)
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.hibernate.console;
+
+import org.hibernate.SessionFactory;
+import org.hibernate.cfg.Configuration;
+
+/**
+ * This adapter class provides default implementations for the
+ * methods described by the <code>ConcoleConfigurationListener</code> interface.
+ * <p>
+ * Classes that wish to deal with <code>ConcoleConfiguration</code> events can
+ * extend this class and override only the methods which they are
+ * interested in.
+ * </p>
+ *
+ * @see ConcoleConfigurationListener
+ * @see ConcoleConfiguration
+ *
+ * @author Dmitry Geraskov
+ */
+public abstract class ConcoleConfigurationAdapter implements
+ ConsoleConfigurationListener {
+
+ public void queryPageCreated(QueryPage qp) {}
+
+ public void sessionFactoryBuilt(ConsoleConfiguration ccfg,
+ SessionFactory builtSessionFactory) {}
+
+ public void sessionFactoryClosing(ConsoleConfiguration configuration,
+ SessionFactory aboutToCloseFactory) {}
+
+ public void configurationBuilt(ConsoleConfiguration ccfg){};
+}
Property changes on: trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConcoleConfigurationAdapter.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java 2009-08-18 12:10:46 UTC (rev 17128)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java 2009-08-18 13:34:19 UTC (rev 17129)
@@ -110,6 +110,7 @@
public void build() {
configuration = buildWith(null, true);
+ fireConfigurationBuilt();
}
private Configuration buildJPAConfiguration(String persistenceUnit, Properties properties, String entityResolver, boolean includeMappings) {
@@ -552,8 +553,13 @@
});
}
+
+ private void fireConfigurationBuilt() {
+ for (ConsoleConfigurationListener view : consoleCfgListeners) {
+ view.configurationBuilt(this);
+ }
+ }
-
private void fireQueryPageCreated(QueryPage qp) {
for (ConsoleConfigurationListener view : consoleCfgListeners) {
view.queryPageCreated(qp);
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfigurationListener.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfigurationListener.java 2009-08-18 12:10:46 UTC (rev 17128)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfigurationListener.java 2009-08-18 13:34:19 UTC (rev 17129)
@@ -43,5 +43,7 @@
* @param closedSessionFactory TODO
*/
public void sessionFactoryClosing(ConsoleConfiguration configuration, SessionFactory aboutToCloseFactory);
+
+ public void configurationBuilt(ConsoleConfiguration ccfg);
}
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/KnownConfigurations.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/KnownConfigurations.java 2009-08-18 12:10:46 UTC (rev 17128)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/KnownConfigurations.java 2009-08-18 13:34:19 UTC (rev 17129)
@@ -66,7 +66,7 @@
private QueryPageModel queryPages = new QueryPageModel();
private List<KnownConfigurationsListener> configurationListeners = new ArrayList<KnownConfigurationsListener>();
private Map<String, ConsoleConfiguration> configurations;
- private ConsoleConfigurationListener sfListener = new ConsoleConfigurationListener() {
+ private ConsoleConfigurationListener sfListener = new ConcoleConfigurationAdapter() {
public void sessionFactoryClosing(final ConsoleConfiguration configuration, final SessionFactory closingFactory) {
fireNotification(new Notification() {
@@ -87,6 +87,14 @@
public void queryPageCreated(QueryPage qp) {
queryPages.add(qp);
}
+
+ public void configurationBuilt(final ConsoleConfiguration ccfg) {
+ fireNotification(new Notification() {
+ public void notify(KnownConfigurationsListener listener) {
+ listener.configurationBuilt(ccfg);
+ }
+ });
+ };
};
Added: trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/KnownConfigurationsAdapter.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/KnownConfigurationsAdapter.java (rev 0)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/KnownConfigurationsAdapter.java 2009-08-18 13:34:19 UTC (rev 17129)
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.hibernate.console;
+
+import org.hibernate.SessionFactory;
+
+/**
+ * This adapter class provides default implementations for the
+ * methods described by the <code>KnownConfigurationsListener</code> interface.
+ * <p>
+ * Classes that wish to deal with <code>KnownConfigurations</code> events can
+ * extend this class and override only the methods which they are
+ * interested in.
+ * </p>
+ *
+ * @see KnownConfigurationsListener
+ * @see KnownConfigurations
+ *
+ * @author Dmitry Geraskov
+ */
+
+public abstract class KnownConfigurationsAdapter implements KnownConfigurationsListener {
+
+ public void configurationAdded(ConsoleConfiguration root) {}
+
+ public void configurationBuilt(ConsoleConfiguration ccfg) {}
+
+ public void configurationRemoved(ConsoleConfiguration root,
+ boolean forUpdate) {}
+
+ public void sessionFactoryBuilt(ConsoleConfiguration ccfg,
+ SessionFactory builtFactory) {}
+
+ public void sessionFactoryClosing(ConsoleConfiguration configuration,
+ SessionFactory closingFactory) {}
+
+}
Property changes on: trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/KnownConfigurationsAdapter.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/KnownConfigurationsListener.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/KnownConfigurationsListener.java 2009-08-18 12:10:46 UTC (rev 17128)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/KnownConfigurationsListener.java 2009-08-18 13:34:19 UTC (rev 17129)
@@ -27,6 +27,8 @@
public interface KnownConfigurationsListener {
public void configurationAdded(ConsoleConfiguration root);
+ public void configurationBuilt(ConsoleConfiguration ccfg);
+
public void sessionFactoryBuilt(ConsoleConfiguration ccfg, SessionFactory builtFactory);
public void sessionFactoryClosing(ConsoleConfiguration configuration, SessionFactory closingFactory);
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/ConfigurationListNode.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/ConfigurationListNode.java 2009-08-18 12:10:46 UTC (rev 17128)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/ConfigurationListNode.java 2009-08-18 13:34:19 UTC (rev 17129)
@@ -24,10 +24,9 @@
import java.util.Arrays;
import java.util.Comparator;
-import org.hibernate.SessionFactory;
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.KnownConfigurations;
-import org.hibernate.console.KnownConfigurationsListener;
+import org.hibernate.console.KnownConfigurationsAdapter;
/**
* @author max
@@ -42,7 +41,7 @@
super(null,null);
this.kc = kc;
- kc.addConsoleConfigurationListener(new KnownConfigurationsListener() {
+ kc.addConsoleConfigurationListener(new KnownConfigurationsAdapter() {
public void configurationAdded(ConsoleConfiguration root) {
markChildrenForReload();
}
@@ -55,14 +54,6 @@
public void configurationRemoved(ConsoleConfiguration root, boolean forUpdate) {
markChildrenForReload();
}
-
- public void sessionFactoryClosing(ConsoleConfiguration configuration, SessionFactory closingFactory) {
- }
-
- public void sessionFactoryBuilt(ConsoleConfiguration ccfg, SessionFactory builtFactory) {
- // TODO Auto-generated method stub
-
- }
});
}
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/ConfigurationNode.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/ConfigurationNode.java 2009-08-18 12:10:46 UTC (rev 17128)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/node/ConfigurationNode.java 2009-08-18 13:34:19 UTC (rev 17129)
@@ -22,11 +22,10 @@
package org.hibernate.console.node;
import org.hibernate.SessionFactory;
+import org.hibernate.console.ConcoleConfigurationAdapter;
import org.hibernate.console.ConsoleConfiguration;
-import org.hibernate.console.ConsoleConfigurationListener;
import org.hibernate.console.ConsoleMessages;
import org.hibernate.console.ImageConstants;
-import org.hibernate.console.QueryPage;
/**
* @author max
@@ -40,7 +39,7 @@
public ConfigurationNode(BaseNode parent, ConsoleConfiguration configuration) {
super(null,parent);
this.configuration = configuration;
- configuration.addConsoleConfigurationListener(new ConsoleConfigurationListener() {
+ configuration.addConsoleConfigurationListener(new ConcoleConfigurationAdapter() {
public void sessionFactoryBuilt(ConsoleConfiguration ccfg, SessionFactory builtSessionFactory) {
clear();
}
@@ -48,8 +47,6 @@
public void sessionFactoryClosing(ConsoleConfiguration configuration, SessionFactory closedSessionFactory) {
clear();
}
-
- public void queryPageCreated(QueryPage qp) { }
});
name = configuration.getName();
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/ConfigurationCombo.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/ConfigurationCombo.java 2009-08-18 12:10:46 UTC (rev 17128)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/ConfigurationCombo.java 2009-08-18 13:34:19 UTC (rev 17129)
@@ -11,6 +11,7 @@
import org.hibernate.SessionFactory;
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.KnownConfigurations;
+import org.hibernate.console.KnownConfigurationsAdapter;
import org.hibernate.console.KnownConfigurationsListener;
final class ConfigurationCombo extends ComboContribution {
@@ -38,7 +39,7 @@
Control control = super.createControl( parent );
- listener = new KnownConfigurationsListener() {
+ listener = new KnownConfigurationsAdapter() {
public void sessionFactoryClosing(
ConsoleConfiguration configuration,
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsolePlugin.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsolePlugin.java 2009-08-18 12:10:46 UTC (rev 17128)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/HibernateConsolePlugin.java 2009-08-18 13:34:19 UTC (rev 17129)
@@ -54,10 +54,10 @@
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.hibernate.HibernateException;
-import org.hibernate.SessionFactory;
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.HibernateConsoleRuntimeException;
import org.hibernate.console.KnownConfigurations;
+import org.hibernate.console.KnownConfigurationsAdapter;
import org.hibernate.console.KnownConfigurationsListener;
import org.hibernate.console.preferences.ConsoleConfigurationPreferences;
import org.hibernate.eclipse.console.actions.AddConfigurationAction;
@@ -126,20 +126,8 @@
private void listenForConfigurations() {
final ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
- kcl = new KnownConfigurationsListener() {
+ kcl = new KnownConfigurationsAdapter() {
- public void sessionFactoryClosing(ConsoleConfiguration configuration,
- SessionFactory closingFactory) {
- // TODO Auto-generated method stub
-
- }
-
- public void sessionFactoryBuilt(ConsoleConfiguration ccfg,
- SessionFactory builtFactory) {
- // TODO Auto-generated method stub
-
- }
-
/**
* @param root
* @param forUpdate - shows whether physical removal necessary
@@ -153,12 +141,6 @@
}
}
}
-
- public void configurationAdded(ConsoleConfiguration root) {
- // TODO Auto-generated method stub
-
- }
-
};
KnownConfigurations.getInstance().addConsoleConfigurationListener(kcl);
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/KnownConfigurationsProvider.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/KnownConfigurationsProvider.java 2009-08-18 12:10:46 UTC (rev 17128)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/console/views/KnownConfigurationsProvider.java 2009-08-18 13:34:19 UTC (rev 17129)
@@ -104,4 +104,8 @@
}
});
}
+
+ public void configurationBuilt(ConsoleConfiguration ccfg) {
+ //TODO refresh tree?
+ }
}
\ No newline at end of file
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/META-INF/MANIFEST.MF 2009-08-18 12:10:46 UTC (rev 17128)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/META-INF/MANIFEST.MF 2009-08-18 13:34:19 UTC (rev 17129)
@@ -24,5 +24,6 @@
org.jboss.tools.hibernate.jpt.core.internal.context.java
Bundle-Localization: plugin
Bundle-Activator: org.jboss.tools.hibernate.jpt.core.internal.HibernateJptPlugin
+Bundle-ActivationPolicy: lazy
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaFactory.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaFactory.java 2009-08-18 12:10:46 UTC (rev 17128)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaFactory.java 2009-08-18 13:34:19 UTC (rev 17129)
@@ -10,12 +10,21 @@
******************************************************************************/
package org.jboss.tools.hibernate.jpt.core.internal;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jpt.core.JpaProject;
+import org.eclipse.jpt.core.context.java.JavaColumn;
import org.eclipse.jpt.core.context.java.JavaEmbeddable;
import org.eclipse.jpt.core.context.java.JavaEntity;
import org.eclipse.jpt.core.context.java.JavaIdMapping;
+import org.eclipse.jpt.core.context.java.JavaJoinColumn;
import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.core.context.java.JavaManyToManyMapping;
+import org.eclipse.jpt.core.context.java.JavaManyToOneMapping;
+import org.eclipse.jpt.core.context.java.JavaOneToManyMapping;
+import org.eclipse.jpt.core.context.java.JavaOneToOneMapping;
import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
import org.eclipse.jpt.core.context.java.JavaPersistentType;
+import org.eclipse.jpt.core.context.java.JavaColumn.Owner;
import org.eclipse.jpt.core.context.persistence.Persistence;
import org.eclipse.jpt.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.core.internal.platform.GenericJpaFactory;
@@ -23,10 +32,16 @@
import org.jboss.tools.hibernate.jpt.core.internal.context.HibernateNamedNativeQuery;
import org.jboss.tools.hibernate.jpt.core.internal.context.HibernateNamedQuery;
import org.jboss.tools.hibernate.jpt.core.internal.context.HibernatePersistenceUnit;
+import org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateJavaColumn;
import org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateJavaEmbeddable;
import org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateJavaEntity;
import org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateJavaEntityImpl;
import org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateJavaIdMapping;
+import org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateJavaJoinColumn;
+import org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateJavaManyToManyMapping;
+import org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateJavaManyToOneMapping;
+import org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateJavaOneToManyMapping;
+import org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateJavaOneToOneMapping;
import org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateJavaParameter;
import org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateNamedNativeQueryImpl;
import org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateNamedQueryImpl;
@@ -41,13 +56,21 @@
* @author Dmitry Geraskov
*
*/
+@SuppressWarnings("restriction")
public class HibernateJpaFactory extends GenericJpaFactory {
+
+ // ********** Core Model **********
+ public JpaProject buildJpaProject(JpaProject.Config config) throws CoreException {
+ return new HibernateJpaProject(config);
+ }
+ // ********** Persistence Context Model **********
@Override
public PersistenceUnit buildPersistenceUnit(Persistence parent, XmlPersistenceUnit persistenceUnit) {
return new HibernatePersistenceUnit(parent, persistenceUnit);
}
+ // ********** Java Context Model **********
@Override
public JavaEntity buildJavaEntity(JavaPersistentType parent) {
return new HibernateJavaEntityImpl(parent);
@@ -82,5 +105,40 @@
public JavaEmbeddable buildJavaEmbeddable(JavaPersistentType parent) {
return new HibernateJavaEmbeddable(parent);
}
+
+ @Override
+ public JavaColumn buildJavaColumn(JavaJpaContextNode parent, Owner owner) {
+ return new HibernateJavaColumn(parent, owner);
+ }
+
+ @Override
+ public JavaOneToManyMapping buildJavaOneToManyMapping(
+ JavaPersistentAttribute parent) {
+ return new HibernateJavaOneToManyMapping(parent);
+ }
+
+ @Override
+ public JavaManyToManyMapping buildJavaManyToManyMapping(
+ JavaPersistentAttribute parent) {
+ return new HibernateJavaManyToManyMapping(parent);
+ }
+
+ @Override
+ public JavaManyToOneMapping buildJavaManyToOneMapping(
+ JavaPersistentAttribute parent) {
+ return new HibernateJavaManyToOneMapping(parent);
+ }
+
+ @Override
+ public JavaOneToOneMapping buildJavaOneToOneMapping(
+ JavaPersistentAttribute parent) {
+ return new HibernateJavaOneToOneMapping(parent);
+ }
+
+ @Override
+ public JavaJoinColumn buildJavaJoinColumn(JavaJpaContextNode parent,
+ org.eclipse.jpt.core.context.java.JavaJoinColumn.Owner owner) {
+ return new HibernateJavaJoinColumn(parent, owner);
+ }
}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaProject.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaProject.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaProject.java 2009-08-18 13:34:19 UTC (rev 17129)
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.hibernate.jpt.core.internal;
+
+import org.eclipse.core.resources.ProjectScope;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.jpt.core.JpaProject;
+import org.eclipse.jpt.core.internal.AbstractJpaProject;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.cfg.NamingStrategy;
+import org.hibernate.console.ConsoleConfiguration;
+import org.hibernate.console.KnownConfigurations;
+import org.osgi.service.prefs.Preferences;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+@SuppressWarnings("restriction")
+public class HibernateJpaProject extends AbstractJpaProject {
+
+
+ public HibernateJpaProject(JpaProject.Config config) throws CoreException {
+ super(config);
+ }
+
+ public NamingStrategy getNamingStrategy(){
+ String ccName = getDefaultConsoleConfigurationName();
+ if (ccName != null || "".equals(ccName)){//$NON-NLS-1$
+ ConsoleConfiguration cc = KnownConfigurations.getInstance().find(ccName);
+ if (cc != null){
+ if (cc.getConfiguration() != null){
+ Configuration config = cc.getConfiguration();
+ return config.getNamingStrategy();
+ }
+ }
+ }
+ return null;
+ }
+
+ public String getDefaultConsoleConfigurationName(){
+ IScopeContext scope = new ProjectScope(getProject());
+ Preferences node = scope.getNode("org.hibernate.eclipse.console"); //$NON-NLS-1$
+ if(node!=null) {
+ return node.get("default.configuration", getName() ); //$NON-NLS-1$
+ }
+ return null;
+ }
+
+}
Property changes on: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaProject.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJptPlugin.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJptPlugin.java 2009-08-18 12:10:46 UTC (rev 17128)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJptPlugin.java 2009-08-18 13:34:19 UTC (rev 17129)
@@ -10,19 +10,25 @@
******************************************************************************/
package org.jboss.tools.hibernate.jpt.core.internal;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ProjectScope;
+import java.util.Iterator;
+
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.jpt.core.JpaProject;
-import org.osgi.service.prefs.Preferences;
+import org.eclipse.jpt.core.internal.JpaModelManager;
+import org.hibernate.console.ConsoleConfiguration;
+import org.hibernate.console.KnownConfigurations;
+import org.hibernate.console.KnownConfigurationsAdapter;
+import org.osgi.framework.BundleContext;
/**
* @author Dmitry Geraskov
*
*/
+@SuppressWarnings("restriction")
public class HibernateJptPlugin extends Plugin {
public static final String ID = "org.jboss.tools.hibernate.jpt.core"; //$NON-NLS-1$
@@ -84,16 +90,51 @@
log(IStatus.INFO, message, null);
}
- public static String getDefaultConsoleConfiguration(JpaProject jpaProject){
- IProject project = jpaProject.getProject();
- IScopeContext scope = new ProjectScope(project);
-
- Preferences node = scope.getNode("org.hibernate.eclipse.console"); //$NON-NLS-1$
-
- if(node!=null) {
- return node.get("default.configuration", project.getName() ); //$NON-NLS-1$
- }
- return null;
- }
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ KnownConfigurations.getInstance().addConsoleConfigurationListener(new KnownConfigurationsAdapter(){
+
+ private void revalidateProjects(ConsoleConfiguration ccfg){
+ //FIXME: call only Dali's validator
+ try {
+ Iterator<JpaProject> jpaProjects = JpaModelManager.instance().getJpaModel().jpaProjects();
+ while (jpaProjects.hasNext()) {
+ JpaProject jpaProject = (JpaProject) jpaProjects.next();
+ if (jpaProject instanceof HibernateJpaProject) {
+ String ccName = ((HibernateJpaProject)jpaProject).getDefaultConsoleConfigurationName();
+ if (ccfg.getName().equals(ccName)){
+ jpaProject.getJavaProject().getProject().build(IncrementalProjectBuilder.FULL_BUILD, null);
+ }
+ }
+
+
+ }
+ } catch (CoreException e) {
+ logException(e);
+ }
+ }
+
+ @Override
+ public void configurationBuilt(ConsoleConfiguration ccfg) {
+ if (ccfg.getConfiguration() == null
+ || ccfg.getConfiguration().getNamingStrategy() == null){
+ return;
+ }
+ revalidateProjects(ccfg);
+ }
+
+ @Override
+ public void configurationRemoved(ConsoleConfiguration root,
+ boolean forUpdate) {
+ if(forUpdate || root.getConfiguration() == null
+ || root.getConfiguration().getNamingStrategy() == null) {
+ return;
+ }
+ revalidateProjects(root);
+ }
+
+ });
+ }
}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/NamingStrategyMappingTools.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/NamingStrategyMappingTools.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/NamingStrategyMappingTools.java 2009-08-18 13:34:19 UTC (rev 17129)
@@ -0,0 +1,125 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.hibernate.jpt.core.internal.context;
+
+import org.eclipse.jpt.core.context.Entity;
+import org.eclipse.jpt.core.context.JoinColumn;
+import org.eclipse.jpt.core.context.RelationshipMapping;
+import org.eclipse.jpt.core.internal.context.MappingTools;
+import org.eclipse.jpt.db.Table;
+import org.hibernate.cfg.NamingStrategy;
+import org.jboss.tools.hibernate.jpt.core.internal.HibernateJpaProject;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+@SuppressWarnings("restriction")
+public class NamingStrategyMappingTools extends MappingTools {
+
+ public static String buildJoinTableDefaultName(RelationshipMapping relationshipMapping) {
+ if (relationshipMapping.getJpaProject().getDataSource().connectionProfileIsActive()) {
+ return buildDbJoinTableDefaultName(relationshipMapping);
+ }
+ // continue with a "best effort":
+ String owningTableName = relationshipMapping.getTypeMapping().getPrimaryTableName();
+ if (owningTableName == null) {
+ return null;
+ }
+ Entity targetEntity = relationshipMapping.getResolvedTargetEntity();
+ if (targetEntity == null) {
+ return null;
+ }
+ String targetTableName = targetEntity.getPrimaryTableName();
+ if (targetTableName == null) {
+ return null;
+ }
+ NamingStrategy namingStrategy =((HibernateJpaProject)targetEntity.getJpaProject()).getNamingStrategy();
+ if (namingStrategy != null){
+ String name = namingStrategy.collectionTableName(relationshipMapping.getEntity().getPersistentType().getName(),
+ owningTableName, targetEntity.getPersistentType().getName(), targetTableName, relationshipMapping.getName());
+ Table primaryTable = relationshipMapping.getTypeMapping().getPrimaryDbTable();
+ return primaryTable.getDatabase().convertNameToIdentifier(name);
+ }
+ return owningTableName + '_' + targetTableName;
+ }
+
+ protected static String buildDbJoinTableDefaultName(RelationshipMapping relationshipMapping) {
+ Table owningTable = relationshipMapping.getTypeMapping().getPrimaryDbTable();
+ if (owningTable == null) {
+ return null;
+ }
+ Entity targetEntity = relationshipMapping.getResolvedTargetEntity();
+ if (targetEntity == null) {
+ return null;
+ }
+ Table targetTable = targetEntity.getPrimaryDbTable();
+ if (targetTable == null) {
+ return null;
+ }
+ NamingStrategy namingStrategy = ((HibernateJpaProject)targetEntity.getJpaProject()).getNamingStrategy();
+ if (namingStrategy != null){
+ String name = namingStrategy.collectionTableName(relationshipMapping.getEntity().getPersistentType().getName(),
+ owningTable.getName(), targetEntity.getPersistentType().getName(), targetTable.getName(), relationshipMapping.getName());
+ return owningTable.getDatabase().convertNameToIdentifier(name);
+ }
+ String name = owningTable.getName() + '_' + targetTable.getName();
+ return owningTable.getDatabase().convertNameToIdentifier(name);
+ }
+
+ public static String buildJoinColumnDefaultName(JoinColumn joinColumn) {
+ JoinColumn.Owner owner = joinColumn.getOwner();
+ RelationshipMapping relationshipMapping = owner.getRelationshipMapping();
+ if (relationshipMapping == null) {
+ return null;
+ }
+ if (owner.joinColumnsSize() != 1) {
+ return null;
+ }
+ String prefix = owner.getAttributeName();
+ Entity targetEntity = owner.getTargetEntity();
+ if (targetEntity == null) {
+ return null;
+ }
+ String targetEntityName = targetEntity.getName();
+ // not sure which of these is correct...
+ // (the spec implies that the referenced column is always the
+ // primary key column of the target entity)
+ // Column targetColumn = joinColumn.getTargetPrimaryKeyDbColumn();
+ String targetColumnName = joinColumn.getReferencedColumnName();
+
+ NamingStrategy namingStrategy = ((HibernateJpaProject)targetEntity.getJpaProject()).getNamingStrategy();
+ if (namingStrategy != null){
+ String logicalTargetColumnName = namingStrategy.logicalColumnName(targetColumnName, prefix);
+ String name = namingStrategy.foreignKeyColumnName(prefix,
+ targetEntity.getPersistentType().getName(),
+ targetEntity.getPrimaryTableName(),
+ logicalTargetColumnName);
+ return targetEntity.getPrimaryDbTable().getDatabase().convertNameToIdentifier(name);
+ }
+ if (prefix == null) {
+ prefix = targetEntityName;
+ }
+ if (targetColumnName == null) {
+ return null;
+ }
+ String name = prefix + '_' + targetColumnName;
+ // not sure which of these is correct...
+ // converting the name to an identifier will result in the identifier
+ // being delimited nearly every time (at least on non-Sybase/MS
+ // databases); but that probably is not the intent of the spec...
+ // return targetColumn.getDatabase().convertNameToIdentifier(name);
+ return name;
+ }
+
+
+}
Property changes on: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/NamingStrategyMappingTools.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaColumn.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaColumn.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaColumn.java 2009-08-18 13:34:19 UTC (rev 17129)
@@ -0,0 +1,30 @@
+package org.jboss.tools.hibernate.jpt.core.internal.context.java;
+
+import org.eclipse.jpt.core.context.java.JavaColumn;
+import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.core.internal.context.java.GenericJavaColumn;
+import org.hibernate.cfg.NamingStrategy;
+import org.jboss.tools.hibernate.jpt.core.internal.HibernateJpaProject;
+
+@SuppressWarnings("restriction")
+public class HibernateJavaColumn extends GenericJavaColumn {
+
+ public HibernateJavaColumn(JavaJpaContextNode parent, JavaColumn.Owner owner) {
+ super(parent, owner);
+ }
+
+ @Override
+ public HibernateJpaProject getJpaProject() {
+ return (HibernateJpaProject) super.getJpaProject();
+ }
+
+ @Override
+ protected String buildDefaultName() {
+ NamingStrategy namingStrategy = getJpaProject().getNamingStrategy();
+ if (namingStrategy != null && super.buildDefaultName() != null){
+ return namingStrategy.propertyToColumnName(super.buildDefaultName());
+ }
+ return super.buildDefaultName();
+ }
+
+}
Property changes on: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaColumn.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaEntityImpl.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaEntityImpl.java 2009-08-18 12:10:46 UTC (rev 17128)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaEntityImpl.java 2009-08-18 13:34:19 UTC (rev 17129)
@@ -16,12 +16,18 @@
import java.util.ListIterator;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.context.BaseJoinColumn;
+import org.eclipse.jpt.core.context.Entity;
+import org.eclipse.jpt.core.context.TypeMapping;
+import org.eclipse.jpt.core.context.java.JavaBaseJoinColumn;
import org.eclipse.jpt.core.context.java.JavaGenerator;
import org.eclipse.jpt.core.context.java.JavaPersistentType;
import org.eclipse.jpt.core.context.java.JavaQuery;
+import org.eclipse.jpt.core.context.java.JavaBaseJoinColumn.Owner;
import org.eclipse.jpt.core.internal.context.java.AbstractJavaEntity;
import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.core.resource.java.NestableAnnotation;
+import org.eclipse.jpt.core.utility.TextRange;
import org.eclipse.jpt.utility.Filter;
import org.eclipse.jpt.utility.internal.CollectionTools;
import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
@@ -29,7 +35,9 @@
import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+import org.hibernate.cfg.NamingStrategy;
import org.jboss.tools.hibernate.jpt.core.internal.HibernateJpaFactory;
+import org.jboss.tools.hibernate.jpt.core.internal.HibernateJpaProject;
import org.jboss.tools.hibernate.jpt.core.internal.context.GenericGenerator;
import org.jboss.tools.hibernate.jpt.core.internal.context.HibernateNamedNativeQuery;
import org.jboss.tools.hibernate.jpt.core.internal.context.HibernateNamedQuery;
@@ -46,6 +54,7 @@
* @author Dmitry Geraskov
*
*/
+@SuppressWarnings("restriction")
public class HibernateJavaEntityImpl extends AbstractJavaEntity
implements HibernateJavaEntity {
@@ -86,6 +95,11 @@
return (HibernateJpaFactory) this.getJpaPlatform().getJpaFactory();
}
+ @Override
+ public HibernateJpaProject getJpaProject() {
+ return (HibernateJpaProject) super.getJpaProject();
+ }
+
@SuppressWarnings("unchecked")
@Override
public Iterator<JavaQuery> queries() {
@@ -450,4 +464,63 @@
}
return null;
}
+
+ protected String getResourceDefaultName() {
+ NamingStrategy namingStrategy = getJpaProject().getNamingStrategy();
+ if (namingStrategy != null){
+ return namingStrategy.classToTableName(javaResourcePersistentType.getName());
+ }
+ return javaResourcePersistentType.getName();
+ }
+
+ @Override
+ protected Owner createPrimaryKeyJoinColumnOwner() {
+ return new HibernatePrimaryKeyJoinColumnOwner();
+ }
+
+ // ********** pk join column owner **********
+
+ class HibernatePrimaryKeyJoinColumnOwner implements JavaBaseJoinColumn.Owner
+ {
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return HibernateJavaEntityImpl.this.getValidationTextRange(astRoot);
+ }
+
+ public TypeMapping getTypeMapping() {
+ return HibernateJavaEntityImpl.this;
+ }
+
+ public org.eclipse.jpt.db.Table getDbTable(String tableName) {
+ return HibernateJavaEntityImpl.this.getDbTable(tableName);
+ }
+
+ public org.eclipse.jpt.db.Table getReferencedColumnDbTable() {
+ Entity parentEntity = HibernateJavaEntityImpl.this.getParentEntity();
+ return (parentEntity == null) ? null : parentEntity.getPrimaryDbTable();
+ }
+
+ public int joinColumnsSize() {
+ return HibernateJavaEntityImpl.this.primaryKeyJoinColumnsSize();
+ }
+
+ public boolean isVirtual(BaseJoinColumn joinColumn) {
+ return HibernateJavaEntityImpl.this.defaultPrimaryKeyJoinColumn == joinColumn;
+ }
+
+ public String getDefaultColumnName() {
+ if (joinColumnsSize() != 1) {
+ return null;
+ }
+ Entity parentEntity = HibernateJavaEntityImpl.this.getParentEntity();
+ NamingStrategy ns = HibernateJavaEntityImpl.this.getJpaProject().getNamingStrategy();
+ if (ns == null)
+ return parentEntity.getPrimaryKeyColumnName();
+
+ String name = ns.joinKeyColumnName(parentEntity.getPrimaryKeyColumnName(),
+ parentEntity.getPrimaryTableName());
+ return parentEntity.getPrimaryDbTable().getDatabase().convertNameToIdentifier(name) ;
+ }
+ }
}
+
+
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaJoinColumn.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaJoinColumn.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaJoinColumn.java 2009-08-18 13:34:19 UTC (rev 17129)
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.hibernate.jpt.core.internal.context.java;
+
+import org.eclipse.jpt.core.context.java.JavaJoinColumn;
+import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.core.internal.context.java.GenericJavaJoinColumn;
+import org.jboss.tools.hibernate.jpt.core.internal.context.NamingStrategyMappingTools;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+@SuppressWarnings("restriction")
+public class HibernateJavaJoinColumn extends GenericJavaJoinColumn {
+
+ public HibernateJavaJoinColumn(JavaJpaContextNode parent, JavaJoinColumn.Owner owner) {
+ super(parent, owner);
+ }
+
+ @Override
+ protected String buildDefaultName() {
+ return NamingStrategyMappingTools.buildJoinColumnDefaultName(this);
+ }
+
+
+
+}
Property changes on: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaJoinColumn.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaManyToManyMapping.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaManyToManyMapping.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaManyToManyMapping.java 2009-08-18 13:34:19 UTC (rev 17129)
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.hibernate.jpt.core.internal.context.java;
+
+import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.java.GenericJavaManyToManyMapping;
+import org.jboss.tools.hibernate.jpt.core.internal.context.NamingStrategyMappingTools;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+
+@SuppressWarnings("restriction")
+public class HibernateJavaManyToManyMapping extends
+ GenericJavaManyToManyMapping {
+
+ public HibernateJavaManyToManyMapping(JavaPersistentAttribute parent) {
+ super(parent);
+ }
+
+ @Override
+ public String getJoinTableDefaultName() {
+ return NamingStrategyMappingTools.buildJoinTableDefaultName(this);
+ }
+
+}
Property changes on: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaManyToManyMapping.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaManyToOneMapping.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaManyToOneMapping.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaManyToOneMapping.java 2009-08-18 13:34:19 UTC (rev 17129)
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.hibernate.jpt.core.internal.context.java;
+
+import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.java.GenericJavaManyToOneMapping;
+import org.jboss.tools.hibernate.jpt.core.internal.context.NamingStrategyMappingTools;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+
+@SuppressWarnings("restriction")
+public class HibernateJavaManyToOneMapping extends GenericJavaManyToOneMapping {
+
+
+ public HibernateJavaManyToOneMapping(JavaPersistentAttribute parent) {
+ super(parent);
+ }
+
+ @Override
+ public String getJoinTableDefaultName() {
+ return NamingStrategyMappingTools.buildJoinTableDefaultName(this);
+ }
+
+}
Property changes on: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaManyToOneMapping.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaOneToManyMapping.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaOneToManyMapping.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaOneToManyMapping.java 2009-08-18 13:34:19 UTC (rev 17129)
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.hibernate.jpt.core.internal.context.java;
+
+import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.java.GenericJavaOneToManyMapping;
+import org.jboss.tools.hibernate.jpt.core.internal.context.NamingStrategyMappingTools;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+
+@SuppressWarnings("restriction")
+public class HibernateJavaOneToManyMapping extends GenericJavaOneToManyMapping {
+
+ public HibernateJavaOneToManyMapping(JavaPersistentAttribute parent) {
+ super(parent);
+ }
+
+ @Override
+ public String getJoinTableDefaultName() {
+ return NamingStrategyMappingTools.buildJoinTableDefaultName(this);
+ }
+
+}
Property changes on: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaOneToManyMapping.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaOneToOneMapping.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaOneToOneMapping.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaOneToOneMapping.java 2009-08-18 13:34:19 UTC (rev 17129)
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.hibernate.jpt.core.internal.context.java;
+
+import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.java.GenericJavaOneToOneMapping;
+import org.jboss.tools.hibernate.jpt.core.internal.context.NamingStrategyMappingTools;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+
+@SuppressWarnings("restriction")
+public class HibernateJavaOneToOneMapping extends GenericJavaOneToOneMapping {
+
+ public HibernateJavaOneToOneMapping(JavaPersistentAttribute parent) {
+ super(parent);
+ }
+
+ @Override
+ public String getJoinTableDefaultName() {
+ return NamingStrategyMappingTools.buildJoinTableDefaultName(this);
+ }
+
+}
Property changes on: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaOneToOneMapping.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/platform/HibernateJpaPlatformUi.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/platform/HibernateJpaPlatformUi.java 2009-08-18 12:10:46 UTC (rev 17128)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/platform/HibernateJpaPlatformUi.java 2009-08-18 13:34:19 UTC (rev 17129)
@@ -27,6 +27,7 @@
import org.eclipse.jpt.ui.navigator.JpaNavigatorProvider;
import org.eclipse.jpt.ui.structure.JpaStructureProvider;
import org.hibernate.eclipse.launch.HibernateLaunchConstants;
+import org.jboss.tools.hibernate.jpt.core.internal.HibernateJpaProject;
import org.jboss.tools.hibernate.jpt.ui.HibernateJptUIPlugin;
import org.jboss.tools.hibernate.jpt.ui.wizard.GenerateDdlWizard;
import org.jboss.tools.hibernate.jpt.ui.wizard.GenerateEntitiesWizard;
@@ -35,6 +36,8 @@
* @author Dmitry Geraskov
*
*/
+
+@SuppressWarnings("restriction")
public class HibernateJpaPlatformUi extends GenericJpaPlatformUi {
public static final String LaunchConfigurationType_ID = "org.hibernate.eclipse.launch.CodeGenerationLaunchConfigurationType"; //$NON-NLS-1$
@@ -54,7 +57,7 @@
@Override
public void generateEntities(JpaProject project, IStructuredSelection selection) {
- GenerateEntitiesWizard wizard = new GenerateEntitiesWizard(project, selection);
+ GenerateEntitiesWizard wizard = new GenerateEntitiesWizard((HibernateJpaProject) project, selection);
WizardDialog dialog = new WizardDialog(null, wizard);
dialog.open();
@@ -62,7 +65,7 @@
@Override
public void generateDDL(JpaProject project, IStructuredSelection selection) {
- GenerateDdlWizard wizard = new GenerateDdlWizard(project, selection);
+ GenerateDdlWizard wizard = new GenerateDdlWizard((HibernateJpaProject) project, selection);
WizardDialog dialog = new WizardDialog(null, wizard);
dialog.open();
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizard.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizard.java 2009-08-18 12:10:46 UTC (rev 17128)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizard.java 2009-08-18 13:34:19 UTC (rev 17129)
@@ -18,10 +18,10 @@
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.jpt.core.JpaProject;
import org.eclipse.jpt.ui.internal.JptUiMessages;
import org.hibernate.console.KnownConfigurations;
import org.hibernate.eclipse.launch.HibernateLaunchConstants;
+import org.jboss.tools.hibernate.jpt.core.internal.HibernateJpaProject;
import org.jboss.tools.hibernate.jpt.ui.HibernateJptUIPlugin;
import org.jboss.tools.hibernate.jpt.ui.internal.platform.HibernateJpaPlatformUi;
@@ -29,14 +29,16 @@
* @author Dmitry Geraskov
*
*/
+
+@SuppressWarnings("restriction")
public class GenerateDdlWizard extends Wizard {
- private JpaProject jpaProject;
+ private HibernateJpaProject jpaProject;
private GenerateDdlWizardPage initPage;
- public GenerateDdlWizard(JpaProject jpaProject, IStructuredSelection selection) {
+ public GenerateDdlWizard(HibernateJpaProject jpaProject, IStructuredSelection selection) {
super();
this.jpaProject = jpaProject;
this.setWindowTitle( JptUiMessages.GenericPlatformUiDialog_notSupportedMessageTitle);
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizardPage.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizardPage.java 2009-08-18 12:10:46 UTC (rev 17128)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateDdlWizardPage.java 2009-08-18 13:34:19 UTC (rev 17129)
@@ -14,19 +14,21 @@
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jdt.internal.ui.wizards.dialogfields.StringDialogField;
-import org.eclipse.jpt.core.JpaProject;
import org.eclipse.swt.widgets.Composite;
import org.hibernate.util.StringHelper;
+import org.jboss.tools.hibernate.jpt.core.internal.HibernateJpaProject;
/**
* @author Dmitry Geraskov
*
*/
+
+@SuppressWarnings("restriction")
public class GenerateDdlWizardPage extends GenerateInitWizardPage {
private StringDialogField filename;
- protected GenerateDdlWizardPage(JpaProject jpaProject) {
+ protected GenerateDdlWizardPage(HibernateJpaProject jpaProject) {
super(jpaProject);
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizard.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizard.java 2009-08-18 12:10:46 UTC (rev 17128)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizard.java 2009-08-18 13:34:19 UTC (rev 17129)
@@ -15,10 +15,10 @@
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.jpt.core.JpaProject;
import org.eclipse.jpt.ui.internal.JptUiMessages;
import org.hibernate.console.KnownConfigurations;
import org.hibernate.eclipse.launch.HibernateLaunchConstants;
+import org.jboss.tools.hibernate.jpt.core.internal.HibernateJpaProject;
import org.jboss.tools.hibernate.jpt.ui.HibernateJptUIPlugin;
import org.jboss.tools.hibernate.jpt.ui.internal.platform.HibernateJpaPlatformUi;
@@ -26,15 +26,17 @@
* @author Dmitry Geraskov
*
*/
+
+@SuppressWarnings("restriction")
public class GenerateEntitiesWizard extends Wizard {
- private JpaProject jpaProject;
+ private HibernateJpaProject jpaProject;
private GenerateEntitiesWizardPage initPage;
- public GenerateEntitiesWizard( JpaProject jpaProject, IStructuredSelection selection) {
+ public GenerateEntitiesWizard( HibernateJpaProject jpaProject, IStructuredSelection selection) {
super();
this.jpaProject = jpaProject;
this.setWindowTitle( JptUiMessages.GenerateEntitiesWizard_generateEntities);
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizardPage.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizardPage.java 2009-08-18 12:10:46 UTC (rev 17128)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateEntitiesWizardPage.java 2009-08-18 13:34:19 UTC (rev 17129)
@@ -21,12 +21,14 @@
import org.eclipse.swt.widgets.Composite;
import org.hibernate.eclipse.console.HibernateConsoleMessages;
import org.hibernate.eclipse.launch.PathHelper;
-import org.hibernate.util.StringHelper;
+import org.jboss.tools.hibernate.jpt.core.internal.HibernateJpaProject;
/**
* @author Dmitry Geraskov
*
*/
+
+@SuppressWarnings("restriction")
public class GenerateEntitiesWizardPage extends GenerateInitWizardPage {
private StringDialogField packageName;
@@ -34,7 +36,7 @@
/**
* @param pageName
*/
- public GenerateEntitiesWizardPage(JpaProject jpaProject) {
+ public GenerateEntitiesWizardPage(HibernateJpaProject jpaProject) {
super(jpaProject);
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateInitWizardPage.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateInitWizardPage.java 2009-08-18 12:10:46 UTC (rev 17128)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/wizard/GenerateInitWizardPage.java 2009-08-18 13:34:19 UTC (rev 17129)
@@ -50,13 +50,15 @@
import org.hibernate.eclipse.launch.PathHelper;
import org.hibernate.tool.hbm2x.StringUtils;
import org.hibernate.util.StringHelper;
-import org.jboss.tools.hibernate.jpt.core.internal.HibernateJptPlugin;
+import org.jboss.tools.hibernate.jpt.core.internal.HibernateJpaProject;
import org.jboss.tools.hibernate.jpt.ui.HibernateJptUIPlugin;
/**
* @author Dmitry Geraskov
*
*/
+
+@SuppressWarnings("restriction")
public abstract class GenerateInitWizardPage extends WizardPage {
private static final String AUTODETECT = Messages.GenerateInitWizardPage_autodetect;
@@ -77,7 +79,7 @@
private Group dbGroup;
- private JpaProject jpaProject;
+ private HibernateJpaProject jpaProject;
protected int numColumns = 3;
@@ -87,7 +89,7 @@
}
};
- public GenerateInitWizardPage(JpaProject jpaProject){
+ public GenerateInitWizardPage(HibernateJpaProject jpaProject){
super("", Messages.GenerateInitWizardPage_title, null); //$NON-NLS-1$
this.jpaProject = jpaProject;
}
@@ -153,7 +155,7 @@
names[i] = configuration.getName();
}
consoleConfigurationName.setItems(names);
- consoleConfigurationName.setText(HibernateJptPlugin.getDefaultConsoleConfiguration(jpaProject));
+ consoleConfigurationName.setText(jpaProject.getDefaultConsoleConfigurationName());
consoleConfigurationName.setDialogFieldListener(fieldlistener);
consoleConfigurationName.doFillIntoGrid(container, numColumns);
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 2009-08-18 12:10:46 UTC (rev 17128)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/ConsoleConfigurationTest.java 2009-08-18 13:34:19 UTC (rev 17129)
@@ -9,8 +9,8 @@
import org.eclipse.core.runtime.FileLocator;
import org.hibernate.SessionFactory;
+import org.hibernate.console.ConcoleConfigurationAdapter;
import org.hibernate.console.ConsoleConfiguration;
-import org.hibernate.console.ConsoleConfigurationListener;
import org.hibernate.console.HibernateConsoleRuntimeException;
import org.hibernate.console.KnownConfigurations;
import org.hibernate.console.QueryPage;
@@ -125,7 +125,7 @@
}
- static class MockCCListener implements ConsoleConfigurationListener {
+ static class MockCCListener extends ConcoleConfigurationAdapter {
int factoryBuilt = 0;
int factoryClosing = 0;
public int queryCreated;
@@ -143,9 +143,6 @@
public void queryPageCreated(QueryPage qp) {
queryCreated++;
}
-
-
-
}
public void testBuildConfiguration() {
@@ -155,7 +152,7 @@
consoleCfg.addConsoleConfigurationListener(listener);
consoleCfg.build();
-
+
assertEquals(0, listener.factoryBuilt);
consoleCfg.buildSessionFactory();
assertEquals(1, listener.factoryBuilt);
Modified: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/KnownConfigurationsTest.java
===================================================================
--- trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/KnownConfigurationsTest.java 2009-08-18 12:10:46 UTC (rev 17128)
+++ trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/KnownConfigurationsTest.java 2009-08-18 13:34:19 UTC (rev 17129)
@@ -11,7 +11,7 @@
import org.hibernate.SessionFactory;
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.KnownConfigurations;
-import org.hibernate.console.KnownConfigurationsListener;
+import org.hibernate.console.KnownConfigurationsAdapter;
import org.hibernate.console.preferences.ConsoleConfigurationPreferences;
import org.w3c.dom.Element;
@@ -21,7 +21,7 @@
super( name );
}
- static class CCListener implements KnownConfigurationsListener {
+ static class CCListener extends KnownConfigurationsAdapter {
List<ConsoleConfiguration> added = new ArrayList<ConsoleConfiguration>();
16 years, 4 months
JBoss Tools SVN: r17128 - trunk/struts/docs/struts_tools_tutorial/en/images/struts_application.
by jbosstools-commits@lists.jboss.org
Author: chukhutsina
Date: 2009-08-18 08:10:46 -0400 (Tue, 18 Aug 2009)
New Revision: 17128
Modified:
trunk/struts/docs/struts_tools_tutorial/en/images/struts_application/struts_application_4.png
trunk/struts/docs/struts_tools_tutorial/en/images/struts_application/struts_application_5.png
Log:
<html><head><meta name="qrichtext" content="1" /></head><body style="font-size:9pt;font-family:Sans Serif">
<p>https://jira.jboss.org/jira/browse/JBDS-720 -Screens of VPE in Struts tutorial were updated.</p>
</body></html>
Modified: trunk/struts/docs/struts_tools_tutorial/en/images/struts_application/struts_application_4.png
===================================================================
(Binary files differ)
Modified: trunk/struts/docs/struts_tools_tutorial/en/images/struts_application/struts_application_5.png
===================================================================
(Binary files differ)
16 years, 4 months
JBoss Tools SVN: r17127 - trunk/jsf/docs/jsf_tools_tutorial/en/images/jsf_application.
by jbosstools-commits@lists.jboss.org
Author: chukhutsina
Date: 2009-08-18 07:44:03 -0400 (Tue, 18 Aug 2009)
New Revision: 17127
Modified:
trunk/jsf/docs/jsf_tools_tutorial/en/images/jsf_application/jsf_application_6.png
trunk/jsf/docs/jsf_tools_tutorial/en/images/jsf_application/jsf_application_8.png
Log:
<html><head><meta name="qrichtext" content="1" /></head><body style="font-size:9pt;font-family:Sans Serif">
<p>https://jira.jboss.org/jira/browse/JBDS-720 -Screens in JSF tutorial were updated.</p>
</body></html>
Modified: trunk/jsf/docs/jsf_tools_tutorial/en/images/jsf_application/jsf_application_6.png
===================================================================
(Binary files differ)
Modified: trunk/jsf/docs/jsf_tools_tutorial/en/images/jsf_application/jsf_application_8.png
===================================================================
(Binary files differ)
16 years, 4 months
JBoss Tools SVN: r17126 - in trunk: jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2009-08-18 06:32:33 -0400 (Tue, 18 Aug 2009)
New Revision: 17126
Modified:
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/contentassist/SortingCompoundContentAssistProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/FaceletPageContectAssistProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JspContentAssistProcessor.java
Log:
JBIDE-4776: CA does not show proposals when it should
Issue is fixed
Modified: trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/contentassist/SortingCompoundContentAssistProcessor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/contentassist/SortingCompoundContentAssistProcessor.java 2009-08-18 10:20:30 UTC (rev 17125)
+++ trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/contentassist/SortingCompoundContentAssistProcessor.java 2009-08-18 10:32:33 UTC (rev 17126)
@@ -15,7 +15,6 @@
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
@@ -34,6 +33,7 @@
import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
import org.eclipse.wst.sse.core.internal.provisional.StructuredModelManager;
+import org.eclipse.wst.sse.ui.internal.contentassist.CustomCompletionProposal;
import org.eclipse.wst.sse.ui.internal.contentassist.IRelevanceCompletionProposal;
import org.eclipse.wst.sse.ui.internal.util.Sorter;
@@ -260,49 +260,88 @@
* @return a list of unique completion suggestions.
*/
public ICompletionProposal[] makeUnique(ICompletionProposal[] proposals) {
- HashSet<String> present = new HashSet<String>();
- HashSet<String> info = new HashSet<String>();
- ArrayList<ICompletionProposal> unique= new ArrayList<ICompletionProposal>();
+ ArrayList<ICompletionProposal> unique = new ArrayList<ICompletionProposal>();
for (int i = 0; proposals != null && i < proposals.length; i++) {
if (proposals[i] == null)
continue;
- String infoUnquoted = proposals[i].getAdditionalProposalInfo();
- if (infoUnquoted != null) {
- if (infoUnquoted.startsWith("\"")) //$NON-NLS-1$
- infoUnquoted = infoUnquoted.substring(1);
- if (infoUnquoted.endsWith("\"")) //$NON-NLS-1$
- infoUnquoted = infoUnquoted.substring(0, infoUnquoted.length() - 1);
- infoUnquoted = infoUnquoted.trim().toLowerCase();
- }
- String displayStringUnquoted = (proposals[i].getDisplayString() == null ?
- "" : //$NON-NLS-1$
- proposals[i].getDisplayString().toLowerCase());
- if (displayStringUnquoted.startsWith("\"")) //$NON-NLS-1$
- displayStringUnquoted = displayStringUnquoted.substring(1);
- if (displayStringUnquoted.endsWith("\"")) //$NON-NLS-1$
- displayStringUnquoted = displayStringUnquoted.substring(0, displayStringUnquoted.length() - 1);
- displayStringUnquoted = displayStringUnquoted.trim().toLowerCase();
-
- if (displayStringUnquoted != null && displayStringUnquoted.length() > 0 && !present.contains(displayStringUnquoted)) {
- present.add(displayStringUnquoted);
- if (infoUnquoted != null && infoUnquoted.length() > 0) {
- if (!info.contains(infoUnquoted)) {
- info.add(infoUnquoted);
- } else {
- // Do not add proposals with the same info
- continue;
- }
- }
+ ICompletionProposal existingProposal = findExistingProposal(unique, proposals[i]);
+ if (existingProposal == null) {
unique.add(proposals[i]);
}
}
-
- present.clear();
return unique.toArray(new ICompletionProposal[unique.size()]);
}
+ private ICompletionProposal findExistingProposal(List<ICompletionProposal> proposals, ICompletionProposal proposal) {
+ if (proposals == null || proposal == null)
+ return null;
+
+ for (ICompletionProposal existingProposal : proposals) {
+ String exReplString = null;
+ String exDispString = null;
+ String exInfoString = null;
+
+ if (existingProposal instanceof CustomCompletionProposal) {
+ exReplString = ((CustomCompletionProposal)existingProposal).getReplacementString();
+ }
+ exDispString = unQuote(existingProposal.getDisplayString());
+ exInfoString = unQuote(existingProposal.getAdditionalProposalInfo());
+ exReplString = getReplacementWord(exReplString == null ? exDispString : exReplString);
+
+ String replString = null;
+ String dispString = null;
+ String infoString = null;
+
+ if (proposal instanceof CustomCompletionProposal) {
+ replString = ((CustomCompletionProposal)proposal).getReplacementString();
+ }
+ dispString = unQuote(proposal.getDisplayString());
+ infoString = unQuote(proposal.getAdditionalProposalInfo());
+ replString = getReplacementWord(replString == null ? dispString : replString);
+
+ if (exReplString != null && replString != null &&
+ (exReplString.equals(replString) ||
+ exReplString.startsWith(replString) ||
+ replString.startsWith(exReplString)))
+ return existingProposal;
+ }
+
+ return null;
+ }
+
+ private String getReplacementWord(String replacement) {
+ replacement = (replacement == null ?
+ "" : //$NON-NLS-1$
+ replacement);
+ int index = replacement.indexOf('>'); //$NON-NLS-1$
+ if (index != -1) {
+ replacement = replacement.substring(0, index).trim();
+ if (replacement.endsWith("/")) //$NON-NLS-1$
+ replacement = replacement.substring(0, replacement.length() - 1).trim();
+ }
+ index = replacement.indexOf('=');
+ if (index != -1) {
+ replacement = replacement.substring(0, index).trim();
+ }
+ return replacement;
+ }
+
+ private String unQuote(String str) {
+ str = (str == null ?
+ "" : //$NON-NLS-1$
+ str.toLowerCase());
+ if (str.startsWith("\"")) //$NON-NLS-1$
+ str = str.substring(1);
+ if (str.endsWith("\"")) //$NON-NLS-1$
+ str = str.substring(0, str.length() - 1);
+ str = str.trim().toLowerCase();
+
+ return str;
+ }
+
+
protected Sorter createSorter() {
return new Sorter() {
public boolean compare(Object proposal1, Object proposal2) {
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/FaceletPageContectAssistProcessor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/FaceletPageContectAssistProcessor.java 2009-08-18 10:20:30 UTC (rev 17125)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/FaceletPageContectAssistProcessor.java 2009-08-18 10:32:33 UTC (rev 17126)
@@ -31,6 +31,7 @@
import org.jboss.tools.jst.web.kb.PageProcessor;
import org.jboss.tools.jst.web.kb.KbQuery.Type;
import org.jboss.tools.jst.web.kb.internal.FaceletPageContextImpl;
+import org.jboss.tools.jst.web.kb.internal.taglib.NameSpace;
import org.jboss.tools.jst.web.kb.taglib.CustomTagLibManager;
import org.jboss.tools.jst.web.kb.taglib.INameSpace;
import org.w3c.dom.Attr;
@@ -135,24 +136,10 @@
}
Region region = new Region(start, length);
- INameSpace nameSpace = new INameSpace(){
- public String getURI() {
- return uri.trim();
- }
- public String getPrefix() {
- return prefix.trim();
- }
- };
+ INameSpace nameSpace = new NameSpace(uri.trim(), prefix.trim());
context.addNameSpace(region, nameSpace);
if (CustomTagLibManager.FACELETS_UI_TAG_LIB_URI.equals(uri)) {
- nameSpace = new INameSpace(){
- public String getURI() {
- return CustomTagLibManager.FACELETS_HTML_TAG_LIB_URI;
- }
- public String getPrefix() {
- return ""; //$NON-NLS-1$
- }
- };
+ nameSpace = new NameSpace(CustomTagLibManager.FACELETS_HTML_TAG_LIB_URI, "");
context.addNameSpace(region, nameSpace);
}
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JspContentAssistProcessor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JspContentAssistProcessor.java 2009-08-18 10:20:30 UTC (rev 17125)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JspContentAssistProcessor.java 2009-08-18 10:32:33 UTC (rev 17126)
@@ -42,6 +42,7 @@
import org.jboss.tools.jst.web.kb.KbQuery.Type;
import org.jboss.tools.jst.web.kb.internal.JspContextImpl;
import org.jboss.tools.jst.web.kb.internal.ResourceBundle;
+import org.jboss.tools.jst.web.kb.internal.taglib.NameSpace;
import org.jboss.tools.jst.web.kb.taglib.INameSpace;
import org.jboss.tools.jst.web.kb.taglib.ITagLibrary;
import org.jboss.tools.jst.web.kb.taglib.TagLibriryManager;
@@ -113,16 +114,7 @@
uri != null && uri.trim().length() > 0) {
IRegion region = new Region(0, getDocument().getLength());
- INameSpace nameSpace = new INameSpace(){
-
- public String getURI() {
- return uri.trim();
- }
-
- public String getPrefix() {
- return prefix.trim();
- }
- };
+ INameSpace nameSpace = new NameSpace(uri.trim(), prefix.trim());
context.addNameSpace(region, nameSpace);
}
}
@@ -481,7 +473,9 @@
int replacementLength = contentAssistRequest.getReplacementLength();
int cursorPosition = getCursorPositionForProposedText(replacementString);
Image image = textProposal.getImage();
- String displayString = textProposal.getLabel();
+ String displayString = textProposal.getLabel() == null ?
+ replacementString :
+ textProposal.getLabel();
IContextInformation contextInformation = null;
String additionalProposalInfo = textProposal.getContextInfo();
int relevance = textProposal.getRelevance();
@@ -531,7 +525,9 @@
}
int cursorPosition = getCursorPositionForProposedText(replacementString);
Image image = textProposal.getImage();
- String displayString = textProposal.getLabel();
+ String displayString = textProposal.getLabel() == null ?
+ replacementString :
+ textProposal.getLabel();
IContextInformation contextInformation = null;
String additionalProposalInfo = textProposal.getContextInfo();
int relevance = textProposal.getRelevance();
16 years, 4 months
JBoss Tools SVN: r17125 - trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2009-08-18 06:20:30 -0400 (Tue, 18 Aug 2009)
New Revision: 17125
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java
Log:
JBIDE-4776: CA does not show proposals when it should
Issue is fixed
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java 2009-08-18 10:02:46 UTC (rev 17124)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java 2009-08-18 10:20:30 UTC (rev 17125)
@@ -75,11 +75,9 @@
import org.eclipse.wst.html.ui.StructuredTextViewerConfigurationHTML;
import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
import org.eclipse.wst.sse.ui.StructuredTextEditor;
import org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration;
-import org.eclipse.wst.sse.ui.internal.IModelProvider;
import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
import org.eclipse.wst.sse.ui.internal.actions.StructuredTextEditorActionConstants;
import org.eclipse.wst.sse.ui.internal.contentassist.ContentAssistUtils;
@@ -140,10 +138,10 @@
import org.jboss.tools.jst.web.kb.PageProcessor;
import org.jboss.tools.jst.web.kb.KbQuery.Type;
import org.jboss.tools.jst.web.kb.internal.JspContextImpl;
+import org.jboss.tools.jst.web.kb.internal.taglib.NameSpace;
import org.jboss.tools.jst.web.kb.internal.taglib.TLDTag;
import org.jboss.tools.jst.web.kb.taglib.IAttribute;
import org.jboss.tools.jst.web.kb.taglib.IComponent;
-import org.jboss.tools.jst.web.kb.taglib.ICustomTagLibComponent;
import org.jboss.tools.jst.web.kb.taglib.INameSpace;
import org.jboss.tools.jst.web.tld.VpeTaglibManager;
import org.jboss.tools.jst.web.tld.VpeTaglibManagerProvider;
@@ -776,14 +774,7 @@
INameSpace n = ns.get(query.getUri());
if(n == null && pageContext instanceof JspContextImpl) {
IRegion r = new Region(query.getOffset(), 0);
- ((JspContextImpl)pageContext).addNameSpace(r, new INameSpace(){
- public String getURI() {
- return query.getUri();
- }
- public String getPrefix() {
- return query.getPrefix();
- }
- });
+ ((JspContextImpl)pageContext).addNameSpace(r, new NameSpace(query.getUri(), query.getPrefix()));
((JspContextImpl)pageContext).setLibraries(processor.getTagLibraries(pageContext));
}
}
16 years, 4 months
JBoss Tools SVN: r17124 - trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2009-08-18 06:02:46 -0400 (Tue, 18 Aug 2009)
New Revision: 17124
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/JspContextImpl.java
Log:
JBIDE-4776: CA does not show proposals when it should
Issue is fixed
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/JspContextImpl.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/JspContextImpl.java 2009-08-18 09:58:20 UTC (rev 17123)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/JspContextImpl.java 2009-08-18 10:02:46 UTC (rev 17124)
@@ -12,6 +12,7 @@
import java.util.HashMap;
import java.util.Map;
+import java.util.Set;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
@@ -79,13 +80,47 @@
*/
public Map<String, INameSpace> getNameSpaces(int offset) {
Map<String, INameSpace> result = new HashMap<String, INameSpace>();
+ Map<INameSpace, IRegion> namespaceToRegions = new HashMap<INameSpace, IRegion>();
+
for (IRegion region : nameSpaces.keySet()) {
if(offset>=region.getOffset() && offset<=region.getOffset() + region.getLength()) {
- result.putAll(nameSpaces.get(region));
+ Map<String, INameSpace> namespaces = nameSpaces.get(region);
+ if (namespaces != null) {
+ for (INameSpace ns : namespaces.values()) {
+ INameSpace existingNameSpace = findNameSpaceByPrefix(namespaceToRegions.keySet(), ns.getPrefix());
+ IRegion existingRegion = namespaceToRegions.get(existingNameSpace);
+ if (existingRegion != null) {
+ // Perform visibility check for region
+ if (region.getOffset() > existingRegion.getOffset()) {
+ // Replace existingNS by this ns
+ namespaceToRegions.remove(existingNameSpace);
+ namespaceToRegions.put(ns, region);
+ }
+ } else {
+ namespaceToRegions.put(ns, region);
+ }
+ }
+ }
}
}
+
+ for (INameSpace ns : namespaceToRegions.keySet()) {
+ result.put(ns.getURI(), ns);
+ }
+
return result;
}
+
+ private INameSpace findNameSpaceByPrefix(Set<INameSpace> namespaces, String prefix) {
+ if (namespaces != null && prefix != null) {
+ for (INameSpace ns : namespaces) {
+ if (prefix.equals(ns.getPrefix())) {
+ return ns;
+ }
+ }
+ }
+ return null;
+ }
/**
* Adds new name space to the context
16 years, 4 months
JBoss Tools SVN: r17123 - trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2009-08-18 05:58:20 -0400 (Tue, 18 Aug 2009)
New Revision: 17123
Added:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/NameSpace.java
Log:
JBIDE-4776: CA does not show proposals when it should
Issue is fixed
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/NameSpace.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/NameSpace.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/NameSpace.java 2009-08-18 09:58:20 UTC (rev 17123)
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.jst.web.kb.internal.taglib;
+
+import org.jboss.tools.jst.web.kb.taglib.INameSpace;
+
+/**
+ * The Namespace holder object
+ *
+ * @author Victor Rubezhny
+ *
+ */
+public class NameSpace implements INameSpace {
+ private String fPrefix;
+ private String fUri;
+
+ /**
+ * Constructs NameSpace object
+ *
+ * @param uri
+ * @param prefix
+ */
+ public NameSpace(String uri, String prefix) {
+ this.fUri = uri;
+ this.fPrefix = prefix;
+ }
+
+ /**
+ * Returns prefix for the Namespace object
+ */
+ public String getPrefix() {
+ return fPrefix;
+ }
+
+ /**
+ * Returns URI for the Namespace object
+ */
+ public String getURI() {
+ return fUri;
+ }
+
+ /**
+ * Compares the NameSpace objects
+ */
+ public boolean equals(Object obj) {
+ if (obj instanceof INameSpace) {
+ INameSpace objNs = (INameSpace)obj;
+
+ boolean result = (fPrefix == null && objNs.getPrefix() == null) ||
+ (fPrefix != null && fPrefix.equals(objNs.getPrefix()));
+
+ if (!result)
+ return false;
+
+ return (fUri == null && objNs.getURI() == null) ||
+ (fUri != null && fUri.equals(objNs.getURI()));
+ }
+ return false;
+ }
+}
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/NameSpace.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
16 years, 4 months
JBoss Tools SVN: r17122 - in trunk/smooks/plugins: org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors and 6 other directories.
by jbosstools-commits@lists.jboss.org
Author: DartPeng
Date: 2009-08-18 05:19:10 -0400 (Tue, 18 Aug 2009)
New Revision: 17122
Added:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIReader12DataPathWizardPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIReader12DataWizard.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIReader12MappingDataPathWizardPage.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIReader12UICreator.java
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.runtime/plugin.properties
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreatorManager.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv/CSVInputDataWizard.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edi/EDIDataParser.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edi/EDIDataWizard.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader/EDIReaderUICreator.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json/JsonDataWizard.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/wizard/ViewerInitorStore.java
Log:
JBIDE-4774
Creat new EDI 1.2 reader wizard
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.runtime/plugin.properties
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.runtime/plugin.properties 2009-08-18 08:51:27 UTC (rev 17121)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.runtime/plugin.properties 2009-08-18 09:19:10 UTC (rev 17122)
@@ -1,2 +1,2 @@
-pluginName=Smooks Runtime 1.1.2 Plug-in
+pluginName=Smooks Runtime Plug-in
providerName=JBoss by Red Hat
\ No newline at end of file
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreatorManager.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreatorManager.java 2009-08-18 08:51:27 UTC (rev 17121)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/PropertyUICreatorManager.java 2009-08-18 09:19:10 UTC (rev 17122)
@@ -32,6 +32,7 @@
import org.jboss.tools.smooks.configuration.editors.edi.SegmentsUICreator;
import org.jboss.tools.smooks.configuration.editors.edi.SubComponentUICreator;
import org.jboss.tools.smooks.configuration.editors.edireader.EDIReaderUICreator;
+import org.jboss.tools.smooks.configuration.editors.edireader12.EDIReader12UICreator;
import org.jboss.tools.smooks.configuration.editors.esbrouter.RouteBeanPropertyUICreator;
import org.jboss.tools.smooks.configuration.editors.filerouting.HighWaterMarkUICreator;
import org.jboss.tools.smooks.configuration.editors.filerouting.OutputStreamUICreator;
@@ -98,6 +99,7 @@
import org.jboss.tools.smooks.model.dbrouting.impl.ResultSetImpl;
import org.jboss.tools.smooks.model.dbrouting.impl.ResultSetRowSelectorImpl;
import org.jboss.tools.smooks.model.edi.impl.EDIReaderImpl;
+import org.jboss.tools.smooks.model.edi12.impl.EDI12ReaderImpl;
import org.jboss.tools.smooks.model.esbrouting.impl.RouteBeanImpl;
import org.jboss.tools.smooks.model.fileRouting.impl.HighWaterMarkImpl;
import org.jboss.tools.smooks.model.fileRouting.impl.OutputStreamImpl;
@@ -315,6 +317,9 @@
map.put(BindingImpl.class, new Csv12ReaderBindingPropertyUICreator());
map.put(MapBindingImpl.class, new Csv12ReaderMapBindingPropertyUICreator());
+ // for EDI Reader v1.2
+ map.put(EDI12ReaderImpl.class, new EDIReader12UICreator());
+
// for Rules v1.0
map.put(RuleBaseImpl.class, new Rules10RulebaseUICreator());
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv/CSVInputDataWizard.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv/CSVInputDataWizard.java 2009-08-18 08:51:27 UTC (rev 17121)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/csv/CSVInputDataWizard.java 2009-08-18 09:19:10 UTC (rev 17122)
@@ -9,6 +9,7 @@
import java.util.Properties;
import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.ecore.util.FeatureMapUtil;
import org.eclipse.emf.edit.command.AddCommand;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -22,6 +23,7 @@
import org.jboss.tools.smooks.configuration.editors.csv.CSVDataConfigurationWizardPage.FieldString;
import org.jboss.tools.smooks.configuration.editors.wizard.IStructuredDataSelectionWizard;
import org.jboss.tools.smooks.model.csv.CsvFactory;
+import org.jboss.tools.smooks.model.csv.CsvPackage;
import org.jboss.tools.smooks.model.csv.CsvReader;
import org.jboss.tools.smooks.model.smooks.DocumentRoot;
import org.jboss.tools.smooks.model.smooks.SmooksPackage;
@@ -110,8 +112,9 @@
}
reader.setFields(fields);
- Command command = AddCommand.create(editingDomain, resourceList, SmooksPackage.eINSTANCE
- .getSmooksResourceListType_AbstractReader(), reader);
+ Command command = AddCommand.create(editingDomain, resourceList,
+ SmooksPackage.Literals.SMOOKS_RESOURCE_LIST_TYPE__ABSTRACT_READER_GROUP, FeatureMapUtil
+ .createEntry(CsvPackage.Literals.CSV_DOCUMENT_ROOT__READER, reader));
editingDomain.getCommandStack().execute(command);
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edi/EDIDataParser.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edi/EDIDataParser.java 2009-08-18 08:51:27 UTC (rev 17121)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edi/EDIDataParser.java 2009-08-18 09:19:10 UTC (rev 17122)
@@ -16,12 +16,10 @@
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
-import java.io.StringWriter;
import java.lang.reflect.InvocationTargetException;
import java.util.Iterator;
import java.util.List;
-import javax.xml.transform.dom.DOMResult;
import javax.xml.transform.stream.StreamSource;
import org.dom4j.DocumentException;
@@ -33,16 +31,15 @@
import org.jboss.tools.smooks.configuration.editors.xml.TagList;
import org.jboss.tools.smooks.configuration.editors.xml.XMLObjectAnalyzer;
import org.jboss.tools.smooks.model.edi.EDIReader;
+import org.jboss.tools.smooks.model.edi12.EDI12Reader;
import org.jboss.tools.smooks.model.graphics.ext.InputType;
import org.jboss.tools.smooks.model.graphics.ext.ParamType;
import org.jboss.tools.smooks.model.smooks.AbstractReader;
import org.jboss.tools.smooks.model.smooks.SmooksResourceListType;
+import org.jboss.tools.smooks10.model.smooks.util.SmooksModelUtils;
import org.milyn.Smooks;
-import org.milyn.SmooksUtil;
-import org.milyn.cdr.SmooksResourceConfiguration;
-import org.milyn.smooks.edi.SmooksEDIReader;
-import org.milyn.xml.XmlUtil;
-import org.w3c.dom.Document;
+import org.milyn.payload.StringResult;
+import org.milyn.smooks.edi.EDIReaderConfigurator;
/**
* @author Dart
@@ -54,12 +51,16 @@
public static final String ENCODING = "encoding";
public static final Object MAPPING_MODEL = "mappingModelFile";
-
- public TagList parseEDIFile(InputStream stream, InputType inputType,SmooksResourceListType resourceList , IProject project)
- throws IOException, DocumentException {
+
+ public static final Object VALIDATE = "validate";
+
+ public TagList parseEDIFile(InputStream stream, InputType inputType, SmooksResourceListType resourceList,
+ IProject project) throws IOException, DocumentException {
List<ParamType> paramList = inputType.getParam();
String encoding = null;
String mappingModel = null;
+ String validate = null;
+ String type = inputType.getType();
for (Iterator<?> iterator = paramList.iterator(); iterator.hasNext();) {
ParamType paramType = (ParamType) iterator.next();
@@ -70,12 +71,18 @@
int index = -1;
for (Iterator<?> iterator2 = readers.iterator(); iterator2.hasNext();) {
AbstractReader abstractReader = (AbstractReader) iterator2.next();
- if (abstractReader instanceof EDIReader) {
+ if (abstractReader instanceof EDIReader && SmooksModelUtils.INPUT_TYPE_EDI_1_1.equals(type)) {
count++;
if (index == -1) {
index = readers.indexOf(abstractReader);
}
}
+ if (abstractReader instanceof EDI12Reader && SmooksModelUtils.INPUT_TYPE_EDI_1_2.equals(type)) {
+ count++;
+ if (index == -1) {
+ index = readers.indexOf(abstractReader);
+ }
+ }
}
if (count > 1) {
@@ -83,7 +90,7 @@
// RuntimeException("The smooks config file should have only one JSON reader");
}
if (index != -1) {
- return parseEDIFile(stream, (EDIReader) readers.get(index) , project);
+ return parseEDIFile(stream, (EObject) readers.get(index), project);
}
}
@@ -96,7 +103,7 @@
}
}
- return parseEDIFile(stream, mappingModel, encoding, project);
+ return parseEDIFile(stream, mappingModel, encoding,validate, project);
}
public TagList parseEDIFile(InputStream stream, InputType inputType, SmooksResourceListType resourceList)
@@ -105,6 +112,8 @@
List<ParamType> paramList = inputType.getParam();
String encoding = null;
String mappingModel = null;
+ String validate = null;
+ String type = inputType.getType();
for (Iterator<?> iterator = paramList.iterator(); iterator.hasNext();) {
ParamType paramType = (ParamType) iterator.next();
@@ -115,12 +124,18 @@
int index = -1;
for (Iterator<?> iterator2 = readers.iterator(); iterator2.hasNext();) {
AbstractReader abstractReader = (AbstractReader) iterator2.next();
- if (abstractReader instanceof EDIReader) {
+ if (abstractReader instanceof EDIReader && SmooksModelUtils.INPUT_TYPE_EDI_1_1.equals(type)) {
count++;
if (index == -1) {
index = readers.indexOf(abstractReader);
}
}
+ if (abstractReader instanceof EDI12Reader && SmooksModelUtils.INPUT_TYPE_EDI_1_2.equals(type)) {
+ count++;
+ if (index == -1) {
+ index = readers.indexOf(abstractReader);
+ }
+ }
}
if (count > 1) {
@@ -128,7 +143,7 @@
// RuntimeException("The smooks config file should have only one JSON reader");
}
if (index != -1) {
- return parseEDIFile(stream, (EDIReader) readers.get(index));
+ return parseEDIFile(stream, (EObject) readers.get(index));
}
}
@@ -139,39 +154,69 @@
if (paramType.getName().equals(MAPPING_MODEL)) {
mappingModel = paramType.getValue();
}
+ if (paramType.getName().equals(VALIDATE)) {
+ validate = paramType.getValue();
+ }
}
- return parseEDIFile(stream, mappingModel, encoding, resourceList);
+ return parseEDIFile(stream, mappingModel, encoding,validate, resourceList);
}
- public TagList parseEDIFile(InputStream ediInputStream, EDIReader reader , IProject project) throws IOException, DocumentException {
- String encoding = reader.getEncoding();
- String mappingModel = reader.getMappingModel();
- return parseEDIFile(ediInputStream, mappingModel, encoding, project);
+
+ public TagList parseEDIFile(InputStream ediInputStream, EObject readerObj, IProject project) throws IOException,
+ DocumentException {
+ String encoding = null;
+ String mappingModel = null;
+ String validate = null;
+ if(readerObj instanceof EDIReader){
+ EDIReader reader = (EDIReader)readerObj;
+ encoding = reader.getEncoding();
+ mappingModel = reader.getMappingModel();
+ }
+ if(readerObj instanceof EDI12Reader){
+ EDI12Reader reader = (EDI12Reader)readerObj;
+ encoding = reader.getEncoding();
+ mappingModel = reader.getMappingModel();
+ }
+ return parseEDIFile(ediInputStream, mappingModel, encoding,validate, project);
}
- public TagList parseEDIFile(InputStream ediInputStream, EDIReader reader) throws IOException, DocumentException {
- String encoding = reader.getEncoding();
- String mappingModel = reader.getMappingModel();
- return parseEDIFile(ediInputStream, mappingModel, encoding, reader);
+ public TagList parseEDIFile(InputStream ediInputStream, EObject readerObj) throws IOException, DocumentException {
+
+ String encoding = null;
+ String mappingModel = null;
+ if(readerObj instanceof EDIReader){
+ EDIReader reader = (EDIReader)readerObj;
+ encoding = reader.getEncoding();
+ mappingModel = reader.getMappingModel();
+ }
+ if(readerObj instanceof EDI12Reader){
+ EDI12Reader reader = (EDI12Reader)readerObj;
+ encoding = reader.getEncoding();
+ mappingModel = reader.getMappingModel();
+ }
+ return parseEDIFile(ediInputStream, mappingModel, encoding,null,(EObject) readerObj);
}
- public TagList parseEDIFile(InputStream ediInputStream, String mappingModel, String ediFileEncoding, EObject emodel)
+ public TagList parseEDIFile(InputStream ediInputStream, String mappingModel, String ediFileEncoding, String validate , EObject emodel)
throws IOException, DocumentException {
IResource resource = SmooksUIUtils.getResource(emodel);
IProject project = null;
if (resource != null) {
project = resource.getProject();
}
- return parseEDIFile(ediInputStream, mappingModel, ediFileEncoding, project);
+ return parseEDIFile(ediInputStream, mappingModel, ediFileEncoding,validate, project);
}
public TagList parseEDIFile(InputStream ediInputStream, String mappingModel, String ediFileEncoding,
- IProject project) throws IOException, DocumentException {
+ String validate, IProject project) throws IOException, DocumentException {
Smooks smooks = new Smooks();
- SmooksResourceConfiguration readerConfig = new SmooksResourceConfiguration("org.xml.sax.driver",
- SmooksEDIReader.class.getName());
- if(mappingModel == null) return null;
+// SmooksResourceConfiguration readerConfig = new SmooksResourceConfiguration("org.xml.sax.driver",
+// SmooksEDIReader.class.getName());
+
+ if (mappingModel == null)
+ return null;
+
File f = new File(mappingModel);
String modelPath = mappingModel;
if (f.exists()) {
@@ -182,41 +227,30 @@
modelPath = tf.getLocation().toFile().toURI().toString();
}
}
-
- readerConfig.setParameter("mapping-model", modelPath);
+ EDIReaderConfigurator readerConfig = new EDIReaderConfigurator(modelPath);
if (ediFileEncoding == null || ediFileEncoding.trim().length() == 0) {
ediFileEncoding = "UTF-8";
}
- readerConfig.setParameter("encoding", ediFileEncoding);
+// readerConfig.
+// readerConfig.setParameter("encoding", ediFileEncoding);
- SmooksUtil.registerResource(readerConfig, smooks);
+ smooks.setReaderConfig(readerConfig);
+// SmooksUtil.registerResource(readerConfig, smooks);
// Use a DOM result to capture the message model for the supplied
// CSV
// message...
- DOMResult domResult = new DOMResult();
// Filter the message through Smooks and capture the result as a DOM
// in
// the domResult instance...
// FileInputStream stream
- smooks.filter(new StreamSource(ediInputStream), domResult);
+ StringResult result = new StringResult();
+ smooks.filterSource(new StreamSource(ediInputStream), result);
- // Get the Document object from the domResult. This is the message
- // model!!!...
- Document model = (Document) domResult.getNode();
- // So using the model Document, you can construct a tree structure
- // for
- // the editor.
-
- // We'll just print out the model DOM here so you can see it....
- StringWriter modelWriter = new StringWriter();
- // System.out.println(modelWriter);
- XmlUtil.serialize(model, true, modelWriter);
-
XMLObjectAnalyzer analyzer = new XMLObjectAnalyzer();
- ByteArrayInputStream byteinputStream = new ByteArrayInputStream(modelWriter.toString().getBytes());
+ ByteArrayInputStream byteinputStream = new ByteArrayInputStream(result.getResult().getBytes());
TagList tagList = analyzer.analyze(byteinputStream, null);
try {
@@ -224,10 +258,6 @@
byteinputStream.close();
byteinputStream = null;
}
- if (modelWriter != null) {
- modelWriter.close();
- modelWriter = null;
- }
if (smooks != null) {
smooks.close();
smooks = null;
@@ -236,7 +266,7 @@
ediInputStream.close();
ediInputStream = null;
}
- model = null;
+ result = null;
} catch (Throwable t) {
t.printStackTrace();
}
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edi/EDIDataWizard.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edi/EDIDataWizard.java 2009-08-18 08:51:27 UTC (rev 17121)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edi/EDIDataWizard.java 2009-08-18 09:19:10 UTC (rev 17122)
@@ -13,6 +13,7 @@
import java.util.Properties;
import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.ecore.util.FeatureMapUtil;
import org.eclipse.emf.edit.command.AddCommand;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -26,6 +27,7 @@
import org.jboss.tools.smooks.configuration.editors.wizard.IStructuredDataSelectionWizard;
import org.jboss.tools.smooks.model.edi.EDIReader;
import org.jboss.tools.smooks.model.edi.EdiFactory;
+import org.jboss.tools.smooks.model.edi.EdiPackage;
import org.jboss.tools.smooks.model.smooks.DocumentRoot;
import org.jboss.tools.smooks.model.smooks.SmooksPackage;
import org.jboss.tools.smooks.model.smooks.SmooksResourceListType;
@@ -71,8 +73,9 @@
EDIReader reader = EdiFactory.eINSTANCE.createEDIReader();
reader.setEncoding(encoding);
reader.setMappingModel(path);
- Command command = AddCommand.create(editingDomain, resourceList, SmooksPackage.eINSTANCE
- .getSmooksResourceListType_AbstractReader(), reader);
+ Command command = AddCommand.create(editingDomain, resourceList,
+ SmooksPackage.Literals.SMOOKS_RESOURCE_LIST_TYPE__ABSTRACT_READER_GROUP, FeatureMapUtil
+ .createEntry(EdiPackage.Literals.EDI_DOCUMENT_ROOT__READER, reader));
editingDomain.getCommandStack().execute(command);
}
return true;
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader/EDIReaderUICreator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader/EDIReaderUICreator.java 2009-08-18 08:51:27 UTC (rev 17121)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader/EDIReaderUICreator.java 2009-08-18 09:19:10 UTC (rev 17122)
@@ -17,7 +17,6 @@
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.jboss.tools.smooks.configuration.editors.AttributeFieldEditPart;
import org.jboss.tools.smooks.configuration.editors.PropertyUICreator;
-import org.jboss.tools.smooks.configuration.editors.SmooksMultiFormEditor;
import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
import org.jboss.tools.smooks.edimap.editor.EDIMapFormEditor;
import org.jboss.tools.smooks.editor.ISmooksModelProvider;
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIReader12DataPathWizardPage.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIReader12DataPathWizardPage.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIReader12DataPathWizardPage.java 2009-08-18 09:19:10 UTC (rev 17122)
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.smooks.configuration.editors.edireader12;
+
+import java.util.List;
+
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.jboss.tools.smooks.configuration.editors.xml.AbstractFileSelectionWizardPage;
+
+/**
+ * @author Dart (dpeng(a)redhat.com)
+ *
+ */
+public class EDIReader12DataPathWizardPage extends AbstractFileSelectionWizardPage {
+
+ public EDIReader12DataPathWizardPage(String pageName, boolean multiSelect, Object[] initSelections,
+ List<ViewerFilter> filters) {
+ super(pageName, multiSelect, initSelections, filters);
+ }
+
+ public EDIReader12DataPathWizardPage(String pageName, String[] fileExtensionNames) {
+ super(pageName, fileExtensionNames);
+ this.setTitle("EDI file selection");
+ this.setDescription("Select a EDI data file");
+ }
+
+
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.smooks.configuration.editors.xml.AbstractFileSelectionWizardPage#loadedTheObject(java.lang.String)
+ */
+ @Override
+ protected Object loadedTheObject(String path) throws Exception {
+ return null;
+ }
+
+ @Override
+ protected void changeWizardPageStatus() {
+ super.changeWizardPageStatus();
+ }
+
+ @Override
+ public boolean canFlipToNextPage() {
+ return super.canFlipToNextPage();
+// String filePath = this.getFilePath();
+// try {
+// filePath = SmooksUIUtils.parseFilePath(filePath);
+// if(filePath == null) return false;
+// return new File(filePath).exists();
+// } catch (InvocationTargetException e) {
+// return false;
+// }
+ }
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIReader12DataPathWizardPage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIReader12DataWizard.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIReader12DataWizard.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIReader12DataWizard.java 2009-08-18 09:19:10 UTC (rev 17122)
@@ -0,0 +1,196 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.smooks.configuration.editors.edireader12;
+
+import java.util.Properties;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.ecore.util.FeatureMapUtil;
+import org.eclipse.emf.edit.command.AddCommand;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+import org.jboss.tools.smooks.configuration.editors.SmooksMultiFormEditor;
+import org.jboss.tools.smooks.configuration.editors.edi.EDIDataParser;
+import org.jboss.tools.smooks.configuration.editors.wizard.IStructuredDataSelectionWizard;
+import org.jboss.tools.smooks.model.edi12.EDI12Reader;
+import org.jboss.tools.smooks.model.edi12.Edi12Factory;
+import org.jboss.tools.smooks.model.edi12.Edi12Package;
+import org.jboss.tools.smooks.model.smooks.DocumentRoot;
+import org.jboss.tools.smooks.model.smooks.SmooksPackage;
+import org.jboss.tools.smooks.model.smooks.SmooksResourceListType;
+import org.jboss.tools.smooks10.model.smooks.util.SmooksModelUtils;
+
+/**
+ * @author Dart
+ *
+ */
+public class EDIReader12DataWizard extends Wizard implements IStructuredDataSelectionWizard, INewWizard {
+
+ private EDIReader12MappingDataPathWizardPage mappingFilePage;
+
+ private EDIReader12DataPathWizardPage ediFilePage;
+
+ private SmooksResourceListType resourceList;
+
+ private EditingDomain editingDomain;
+
+ @Override
+ public void addPages() {
+ ediFilePage = new EDIReader12DataPathWizardPage("EDI Data Page", new String[] {});
+ this.addPage(ediFilePage);
+
+ mappingFilePage = new EDIReader12MappingDataPathWizardPage("EDI Config Page", null);
+ this.addPage(mappingFilePage);
+ super.addPages();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.wizard.Wizard#performFinish()
+ */
+ @Override
+ public boolean performFinish() {
+ if (mappingFilePage.isUseAvaliableReader()) {
+ return true;
+ }
+ if (mappingFilePage.isCreateNewReader()) {
+ String encoding = mappingFilePage.getEncoding();
+ String path = mappingFilePage.getFilePath();
+ String validate = mappingFilePage.getValidate();
+ EDI12Reader reader = Edi12Factory.eINSTANCE.createEDI12Reader();
+ reader.setEncoding(encoding);
+ reader.setMappingModel(path);
+ if (validate != null && validate.length() != 0) {
+ reader.setValidate(Boolean.valueOf(validate));
+ }
+ Command command = AddCommand.create(editingDomain, resourceList,
+ SmooksPackage.Literals.SMOOKS_RESOURCE_LIST_TYPE__ABSTRACT_READER_GROUP, FeatureMapUtil
+ .createEntry(Edi12Package.Literals.EDI12_DOCUMENT_ROOT__READER, reader));
+ editingDomain.getCommandStack().execute(command);
+ }
+ return true;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.jboss.tools.smooks.configuration.editors.wizard.
+ * IStructuredDataSelectionWizard
+ * #complate(org.jboss.tools.smooks.configuration
+ * .editors.SmooksMultiFormEditor)
+ */
+ public void complate(SmooksMultiFormEditor formEditor) {
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.jboss.tools.smooks.configuration.editors.wizard.
+ * IStructuredDataSelectionWizard#getInputDataTypeID()
+ */
+ public String getInputDataTypeID() {
+ return SmooksModelUtils.INPUT_TYPE_EDI_1_2;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.jboss.tools.smooks.configuration.editors.wizard.
+ * IStructuredDataSelectionWizard#getProperties()
+ */
+ public Properties getProperties() {
+ Properties pros = new Properties();
+ if (mappingFilePage.isUseAvaliableReader() || mappingFilePage.isCreateNewReader()) {
+ pros.put(EDIDataParser.USE_AVAILABEL_READER, "true");
+ return pros;
+ }
+ String encoding = mappingFilePage.getEncoding();
+ if (encoding != null && encoding.length() != 0) {
+ pros.put(EDIDataParser.ENCODING, encoding);
+ }
+
+ String path = mappingFilePage.getFilePath();
+ if(path != null && path.length() != 0){
+ pros.put(EDIDataParser.MAPPING_MODEL, path);
+ }
+
+ String validate = mappingFilePage.getValidate();
+ if(validate != null && validate.length() != 0){
+ pros.put(EDIDataParser.VALIDATE, validate);
+ }
+ return pros;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.jboss.tools.smooks.configuration.editors.wizard.
+ * IStructuredDataSelectionWizard#getReturnData()
+ */
+ public Object getReturnData() {
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.jboss.tools.smooks.configuration.editors.wizard.
+ * IStructuredDataSelectionWizard#getStructuredDataSourcePath()
+ */
+ public String getStructuredDataSourcePath() {
+ if (ediFilePage.getFilePath() != null) {
+ return ediFilePage.getFilePath();
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.jboss.tools.smooks.configuration.editors.wizard.
+ * IStructuredDataSelectionWizard#init(org.eclipse.ui.IEditorSite,
+ * org.eclipse.ui.IEditorInput)
+ */
+ public void init(IEditorSite site, IEditorInput input) {
+ IEditorPart editorPart = site.getWorkbenchWindow().getActivePage().findEditor(input);
+ if (editorPart != null && editorPart instanceof SmooksMultiFormEditor) {
+ SmooksMultiFormEditor formEditor = (SmooksMultiFormEditor) editorPart;
+ Object smooksModel = formEditor.getSmooksModel();
+ if (smooksModel instanceof DocumentRoot) {
+ resourceList = ((DocumentRoot) smooksModel).getSmooksResourceList();
+ }
+ editingDomain = formEditor.getEditingDomain();
+ }
+ if (this.mappingFilePage != null) {
+ mappingFilePage.setSmooksResourceList(resourceList);
+ }
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench,
+ * org.eclipse.jface.viewers.IStructuredSelection)
+ */
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+
+ }
+
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIReader12DataWizard.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIReader12MappingDataPathWizardPage.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIReader12MappingDataPathWizardPage.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIReader12MappingDataPathWizardPage.java 2009-08-18 09:19:10 UTC (rev 17122)
@@ -0,0 +1,297 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.smooks.configuration.editors.edireader12;
+
+import java.util.List;
+
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.jboss.tools.smooks.configuration.editors.ClassPathFileProcessor;
+import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
+import org.jboss.tools.smooks.configuration.editors.xml.AbstractFileSelectionWizardPage;
+import org.jboss.tools.smooks.model.edi12.EDI12Reader;
+import org.jboss.tools.smooks.model.edi12.impl.EDI12ReaderImpl;
+import org.jboss.tools.smooks.model.smooks.SmooksResourceListType;
+
+/**
+ * @author Dart (dpeng(a)redhat.com)
+ *
+ */
+public class EDIReader12MappingDataPathWizardPage extends AbstractFileSelectionWizardPage {
+
+ private boolean hasReader = false;
+
+ private boolean createNewReader = true;
+
+ private String mappingFile = null;
+
+ private Composite fileComposite = null;
+
+ private String encoding = "UTF-8";
+
+ private Button createNewReaderButton;
+
+ private boolean useAvaliableReader = false;
+
+ private String validate = null;
+
+ private SmooksResourceListType resourceList;
+
+ public EDIReader12MappingDataPathWizardPage(String pageName, boolean multiSelect, Object[] initSelections,
+ List<ViewerFilter> filters) {
+ super(pageName, multiSelect, initSelections, filters);
+ this.setTitle("EDI Mapping file configuration (version 1.2)");
+ this.setDescription("Select a EDI mapping config file");
+ this.setFilePathProcessor(new ClassPathFileProcessor());
+ }
+
+ public EDIReader12MappingDataPathWizardPage(String pageName, String[] fileExtensionNames) {
+ super(pageName, fileExtensionNames);
+ this.setTitle("EDI Mapping file configuration (version 1.2)");
+ this.setDescription("Select a EDI mapping config file");
+ this.setFilePathProcessor(new ClassPathFileProcessor());
+ }
+
+ public String getEncoding() {
+ return encoding;
+ }
+
+ public boolean isUseAvaliableReader() {
+ return useAvaliableReader;
+ }
+
+ public SmooksResourceListType getSmooksResourceList() {
+ return resourceList;
+ }
+
+ public void setSmooksResourceList(SmooksResourceListType resourceList) {
+ this.resourceList = resourceList;
+ }
+
+ private void initData() {
+ encoding = "UTF-8";
+ validate = null;
+ hasReader = false;
+ useAvaliableReader = false;
+ createNewReader = true;
+ if (SmooksUIUtils.hasReaderAlready(EDI12Reader.class, resourceList)
+ || SmooksUIUtils.hasReaderAlready(EDI12ReaderImpl.class, resourceList)) {
+ hasReader = true;
+ }
+
+ mappingFile = null;
+
+ if (hasReader) {
+ useAvaliableReader = true;
+ createNewReader = false;
+ }
+ }
+
+ public boolean isHasReader() {
+ return hasReader;
+ }
+
+ public boolean isCreateNewReader() {
+ return createNewReader;
+ }
+
+ public String getValidate() {
+ return validate;
+ }
+
+ public void setValidate(String validate) {
+ this.validate = validate;
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ initData();
+ super.createControl(parent);
+ }
+
+ public String getMappingFile() {
+ return mappingFile;
+ }
+
+ @Override
+ protected void createExtensionGUIFirst(Composite parent) {
+ Label encodingLabel = new Label(parent, SWT.NONE);
+ encodingLabel.setText("Encoding:");
+ final Text encodingText = new Text(parent, SWT.BORDER);
+ encodingText.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ mappingFile = encodingText.getText();
+ }
+ });
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ encodingText.setLayoutData(gd);
+
+
+ Label validateLabel = new Label(parent, SWT.NONE);
+ validateLabel.setText("Validate:");
+ final Combo validateCombo = new Combo(parent, SWT.BORDER | SWT.READ_ONLY);
+ validateCombo.add("");
+ validateCombo.add("TRUE");
+ validateCombo.add("FALSE");
+ validateCombo.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ validate = encodingText.getText();
+ }
+ });
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ validateCombo.setLayoutData(gd);
+ }
+
+ @Override
+ protected Composite createFileSelectionComposite(Composite parent) {
+ Composite chooseComposite = new Composite(parent, SWT.NONE);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ chooseComposite.setLayoutData(gd);
+
+ GridLayout gl = new GridLayout();
+ gl.numColumns = 2;
+ chooseComposite.setLayout(gl);
+
+ Button newReaderButton = new Button(chooseComposite, SWT.RADIO);
+ newReaderButton.setText("Create new EDI reader configurations");
+
+ final Button useReaderButton = new Button(chooseComposite, SWT.RADIO);
+ useReaderButton.setText("Use available EDI reader configurations");
+
+ fileComposite = super.createFileSelectionComposite(parent);
+
+ createNewReaderButton = new Button(fileComposite, SWT.CHECK);
+ createNewReaderButton.setText("Create New EDI Reader");
+ createNewReaderButton.setSelection(true);
+
+ if (hasReader) {
+ createNewReaderButton.setSelection(false);
+ createNewReaderButton.setEnabled(false);
+
+ useReaderButton.setSelection(true);
+ this.setConfigCompositeStates(false);
+ } else {
+ newReaderButton.setSelection(true);
+ createNewReaderButton.setSelection(true);
+ }
+
+ createNewReaderButton.addSelectionListener(new SelectionListener() {
+
+ public void widgetSelected(SelectionEvent e) {
+ createNewReader = createNewReaderButton.getSelection();
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+ });
+
+ newReaderButton.addSelectionListener(new SelectionListener() {
+
+ public void widgetSelected(SelectionEvent e) {
+ useAvaliableReader = useReaderButton.getSelection();
+ setConfigCompositeStates(true);
+ changeWizardPageStatus();
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+
+ }
+ });
+ useReaderButton.addSelectionListener(new SelectionListener() {
+
+ public void widgetSelected(SelectionEvent e) {
+ useAvaliableReader = useReaderButton.getSelection();
+ setConfigCompositeStates(false);
+ changeWizardPageStatus();
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+
+ }
+ });
+ gd = new GridData();
+ gd.horizontalSpan = 2;
+ createNewReaderButton.setLayoutData(gd);
+ return fileComposite;
+ }
+
+ private void setConfigCompositeStates(boolean enabled) {
+ fileComposite.setEnabled(enabled);
+ Control[] controls = fileComposite.getChildren();
+ for (int i = 0; i < controls.length; i++) {
+ Control c = controls[i];
+ if (c == createNewReaderButton) {
+ if (hasReader) {
+ c.setEnabled(false);
+ continue;
+ }
+ }
+ if (c == fileTextComposite) {
+ Control[] cs = ((Composite) c).getChildren();
+ for (int j = 0; j < cs.length; j++) {
+ Control cc = cs[j];
+ cc.setEnabled(enabled);
+ }
+ }
+ c.setEnabled(enabled);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.jboss.tools.smooks.configuration.editors.xml.
+ * AbstractFileSelectionWizardPage#loadedTheObject(java.lang.String)
+ */
+ @Override
+ protected Object loadedTheObject(String path) throws Exception {
+ return null;
+ }
+
+ @Override
+ protected void changeWizardPageStatus() {
+ if (!useAvaliableReader) {
+ super.changeWizardPageStatus();
+ } else {
+ setErrorMessage(null);
+ setPageComplete(true);
+ }
+ }
+
+ @Override
+ public boolean canFlipToNextPage() {
+ return super.canFlipToNextPage();
+ // String filePath = this.getFilePath();
+ // try {
+ // filePath = SmooksUIUtils.parseFilePath(filePath);
+ // if(filePath == null) return false;
+ // return new File(filePath).exists();
+ // } catch (InvocationTargetException e) {
+ // return false;
+ // }
+ }
+}
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIReader12MappingDataPathWizardPage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIReader12UICreator.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIReader12UICreator.java (rev 0)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIReader12UICreator.java 2009-08-18 09:19:10 UTC (rev 17122)
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.smooks.configuration.editors.edireader12;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.jboss.tools.smooks.configuration.editors.AttributeFieldEditPart;
+import org.jboss.tools.smooks.configuration.editors.PropertyUICreator;
+import org.jboss.tools.smooks.configuration.editors.uitls.SmooksUIUtils;
+import org.jboss.tools.smooks.edimap.editor.EDIMapFormEditor;
+import org.jboss.tools.smooks.editor.ISmooksModelProvider;
+import org.jboss.tools.smooks.model.edi12.Edi12Package;
+
+/**
+ * @author Dart Peng (dpeng(a)redhat.com) Date Apr 10, 2009
+ */
+public class EDIReader12UICreator extends PropertyUICreator {
+
+ public EDIReader12UICreator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.jboss.tools.smooks.configuration.editors.IPropertyUICreator#
+ * createPropertyUI(org.eclipse.ui.forms.widgets.FormToolkit,
+ * org.eclipse.swt.widgets.Composite,
+ * org.eclipse.emf.edit.provider.IItemPropertyDescriptor, java.lang.Object,
+ * org.eclipse.emf.ecore.EAttribute)
+ */
+ public AttributeFieldEditPart createPropertyUI(FormToolkit toolkit, Composite parent,
+ IItemPropertyDescriptor propertyDescriptor, Object model, EAttribute feature,
+ ISmooksModelProvider formEditor, IEditorPart part) {
+ if (feature == Edi12Package.eINSTANCE.getEDI12Reader_Encoding()) {
+ }
+ if (feature == Edi12Package.eINSTANCE.getEDI12Reader_MappingModel()) {
+ return SmooksUIUtils.createFileSelectionTextFieldEditor(null, parent, null, toolkit, propertyDescriptor,
+ model, SmooksUIUtils.VALUE_TYPE_VALUE, EDIMapFormEditor.EDITOR_ID, null);
+ }
+ return super.createPropertyUI(toolkit, parent, propertyDescriptor, model, feature, formEditor, part);
+ }
+
+ @Override
+ public boolean isFileSelectionFeature(EAttribute attribute) {
+ // if (attribute == EdiPackage.eINSTANCE.getEDIReader_MappingModel()) {
+ // return true;
+ // }
+ return super.isFileSelectionFeature(attribute);
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/edireader12/EDIReader12UICreator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json/JsonDataWizard.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json/JsonDataWizard.java 2009-08-18 08:51:27 UTC (rev 17121)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/json/JsonDataWizard.java 2009-08-18 09:19:10 UTC (rev 17122)
@@ -15,6 +15,7 @@
import java.util.Properties;
import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.ecore.util.FeatureMapUtil;
import org.eclipse.emf.edit.command.AddCommand;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -29,6 +30,7 @@
import org.jboss.tools.smooks.configuration.editors.uitls.JsonInputDataParser;
import org.jboss.tools.smooks.configuration.editors.wizard.IStructuredDataSelectionWizard;
import org.jboss.tools.smooks.model.json.JsonFactory;
+import org.jboss.tools.smooks.model.json.JsonPackage;
import org.jboss.tools.smooks.model.json.JsonReader;
import org.jboss.tools.smooks.model.json.Key;
import org.jboss.tools.smooks.model.json.KeyMap;
@@ -146,8 +148,9 @@
if (ier != null && ier.length() != 0) {
reader.setIllegalElementNameCharReplacement(ier);
}
- Command command = AddCommand.create(editingDomain, resourceList, SmooksPackage.eINSTANCE
- .getSmooksResourceListType_AbstractReader(), reader);
+ Command command = AddCommand.create(editingDomain, resourceList,
+ SmooksPackage.Literals.SMOOKS_RESOURCE_LIST_TYPE__ABSTRACT_READER_GROUP, FeatureMapUtil
+ .createEntry(JsonPackage.Literals.JSON_DOCUMENT_ROOT__READER, reader));
editingDomain.getCommandStack().execute(command);
}
return true;
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/wizard/ViewerInitorStore.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/wizard/ViewerInitorStore.java 2009-08-18 08:51:27 UTC (rev 17121)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/configuration/editors/wizard/ViewerInitorStore.java 2009-08-18 09:19:10 UTC (rev 17122)
@@ -20,6 +20,7 @@
import org.jboss.tools.smooks.configuration.editors.csv.CSVInputDataWizard;
import org.jboss.tools.smooks.configuration.editors.csv12.CSV12InputDataWizard;
import org.jboss.tools.smooks.configuration.editors.edi.EDIDataWizard;
+import org.jboss.tools.smooks.configuration.editors.edireader12.EDIReader12DataWizard;
import org.jboss.tools.smooks.configuration.editors.javabean.JavabeanContentProvider;
import org.jboss.tools.smooks.configuration.editors.javabean.JavabeanStrucutredDataWizard;
import org.jboss.tools.smooks.configuration.editors.javabean.JavabeanlabelProvider;
@@ -277,7 +278,24 @@
ediViewerInitor.setStructuredDataLoadWizard(new EDIDataWizard());
// jsonViewerInitor.setWizardIconPath(GraphicsConstants.IMAGE_JAVA_FILE);
map.put(typeID, ediViewerInitor);
+
+ // for EDI 1.2
+ BaseViewerInitor edi12ViewerInitor = new BaseViewerInitor();
+ name = "EDI 1.2";
+ description = "Select EDI data file as the input data. (version 1.2)";
+ iconPath = null;
+ typeID = SmooksModelUtils.INPUT_TYPE_EDI_1_2;
+ edi12ViewerInitor.setName(name);
+ edi12ViewerInitor.setDescription(description);
+ edi12ViewerInitor.setWizardIconPath(iconPath);
+ edi12ViewerInitor.setTypeID(typeID);
+ edi12ViewerInitor.setLabelProvider(new XMLStructuredDataLabelProvider());
+ edi12ViewerInitor.setTreeContentProvider(new XMLStructuredDataContentProvider());
+ edi12ViewerInitor.setStructuredDataLoadWizard(new EDIReader12DataWizard());
+ // jsonViewerInitor.setWizardIconPath(GraphicsConstants.IMAGE_JAVA_FILE);
+ map.put(typeID, edi12ViewerInitor);
+
return map;
}
16 years, 4 months
JBoss Tools SVN: r17121 - trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2009-08-18 04:51:27 -0400 (Tue, 18 Aug 2009)
New Revision: 17121
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SeamRuntimeListFieldEditor.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4657 - Fixed
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SeamRuntimeListFieldEditor.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SeamRuntimeListFieldEditor.java 2009-08-18 08:39:50 UTC (rev 17120)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SeamRuntimeListFieldEditor.java 2009-08-18 08:51:27 UTC (rev 17121)
@@ -12,16 +12,11 @@
import java.beans.PropertyChangeListener;
import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Properties;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
@@ -64,14 +59,12 @@
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.ui.wizards.datatransfer.ZipFileStructureProvider;
import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.SeamUtil;
import org.jboss.tools.seam.core.project.facet.SeamRuntime;
import org.jboss.tools.seam.core.project.facet.SeamVersion;
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
-import org.jboss.tools.seam.ui.SeamGuiPlugin;
import org.jboss.tools.seam.ui.SeamUIMessages;
import org.jboss.tools.seam.ui.internal.project.facet.ValidatorFactory;
import org.jboss.tools.seam.ui.wizard.SeamFormWizard;
@@ -633,7 +626,7 @@
} else if(!SeamUtil.areSeamVersionsMatched(version.getValueAsString(), seamVersion)) {
String trimmedVersion = SeamUtil.trimSeamVersion(version.getValueAsString(), 1);
String trimmedSeamVersion = SeamUtil.trimSeamVersion(seamVersion, 1);
- if(SeamUtil.areSeamVersionsMatched(trimmedVersion, trimmedSeamVersion)) {
+ if(SeamVersion.findMatchingVersion(seamVersion)==null && SeamUtil.areSeamVersionsMatched(trimmedVersion, trimmedSeamVersion)) {
setMessage(NLS.bind(SeamUIMessages.SEAM_RUNTIME_LIST_FIELD_EDITOR_THE_SELECTED_SEAM_APPEARS_TO_BE_OF_INCOMATIBLE_VERSION,
seamVersion), IMessageProvider.WARNING);
} else {
16 years, 4 months