JBoss Tools SVN: r29197 - trunk/documentation/guides/JBDS_Release_Notes/en-US.
by jbosstools-commits@lists.jboss.org
Author: mcaspers
Date: 2011-02-17 15:37:45 -0500 (Thu, 17 Feb 2011)
New Revision: 29197
Modified:
trunk/documentation/guides/JBDS_Release_Notes/en-US/Article_Info.xml
trunk/documentation/guides/JBDS_Release_Notes/en-US/Known_Issues_4_0_0.xml
trunk/documentation/guides/JBDS_Release_Notes/en-US/Overview.xml
Log:
General Documentation Updates
Modified: trunk/documentation/guides/JBDS_Release_Notes/en-US/Article_Info.xml
===================================================================
--- trunk/documentation/guides/JBDS_Release_Notes/en-US/Article_Info.xml 2011-02-17 20:33:17 UTC (rev 29196)
+++ trunk/documentation/guides/JBDS_Release_Notes/en-US/Article_Info.xml 2011-02-17 20:37:45 UTC (rev 29197)
@@ -3,13 +3,13 @@
<!-- Modify the title tag to change which book will be built -->
<articleinfo>
- <title>4.0.0 Release Notes</title>
- <!-- <title>Release Notes</title> -->
+ <!--title>4.0.0 Release Notes</title-->
+ <title>Release Notes</title>
<subtitle>Information about the changes made for this release of the JBoss Developer Studio.</subtitle>
<productname>JBoss Developer Studio</productname>
<productnumber>4.0</productnumber>
<edition>0</edition>
- <pubsnumber>19</pubsnumber>
+ <pubsnumber>20</pubsnumber>
<abstract>
<para>
These release notes contain important information related to the JBoss Developer Studio. New features,<!-- known problems,--> resources, and other current issues are addressed here.
Modified: trunk/documentation/guides/JBDS_Release_Notes/en-US/Known_Issues_4_0_0.xml
===================================================================
--- trunk/documentation/guides/JBDS_Release_Notes/en-US/Known_Issues_4_0_0.xml 2011-02-17 20:33:17 UTC (rev 29196)
+++ trunk/documentation/guides/JBDS_Release_Notes/en-US/Known_Issues_4_0_0.xml 2011-02-17 20:37:45 UTC (rev 29197)
@@ -22,7 +22,18 @@
</listitem>
<listitem>
<para>
- <ulink url="https://issues.jboss.org/browse/JBDS-1554">JBDS-1554</ulink>: The new project wizards do not display their associated Eclipse perspective. The workaround is to manually display the appropiate perspective by selecting <menuchoice><guimenuitem>Window</guimenuitem><guimenuitem>Open Perspective</guimenuitem></menuchoice>.
+ <ulink url="https://issues.jboss.org/browse/JBDS-1554">JBDS-1554</ulink>: The new project wizards do not display their associated Eclipse perspective. The workaround is to manually display the appropiate perspective by selecting <menuchoice><guimenuitem>Window</guimenuitem><guimenuitem>Open Perspective</guimenuitem></menuchoice>. The following is a list of project types and their matching persepctives:
+ <itemizedlist>
+ <listitem>
+ <para>JSF Project: Web Development</para>
+ </listitem>
+ <listitem>
+ <para>Struts Project: Web Development</para>
+ </listitem>
+ <listitem>
+ <para>Seam Web Project: Seam or Web Development</para>
+ </listitem>
+ </itemizedlist>
</para>
</listitem>
<listitem>
Modified: trunk/documentation/guides/JBDS_Release_Notes/en-US/Overview.xml
===================================================================
--- trunk/documentation/guides/JBDS_Release_Notes/en-US/Overview.xml 2011-02-17 20:33:17 UTC (rev 29196)
+++ trunk/documentation/guides/JBDS_Release_Notes/en-US/Overview.xml 2011-02-17 20:37:45 UTC (rev 29197)
@@ -85,6 +85,9 @@
<para>
<emphasis role="bold">Technical Previews:</emphasis> A Technical preview of CDI and JSF 2 (including composite components, code completions and validations) tooling is included, along with a JBoss AS 6 compatible server adapter. Technical previews of Servlet 3, Richfaces 4 and BPEL are also available.
</para>
+ <para>
+ Information on how to access the tech previews can be found in the <ulink url="http://docs.redhat.com/docs/en-US/JBoss_Developer_Studio/4.0/html-single/...">Getting Started Guide</ulink>.
+ </para>
</listitem>
<listitem>
<para>
13 years, 10 months
JBoss Tools SVN: r29196 - trunk/documentation/guides/GettingStartedGuide/en-US.
by jbosstools-commits@lists.jboss.org
Author: mcaspers
Date: 2011-02-17 15:33:17 -0500 (Thu, 17 Feb 2011)
New Revision: 29196
Modified:
trunk/documentation/guides/GettingStartedGuide/en-US/Book_Info.xml
trunk/documentation/guides/GettingStartedGuide/en-US/Installation_Guide.xml
trunk/documentation/guides/GettingStartedGuide/en-US/installation.xml
Log:
General Documentation Updates
Modified: trunk/documentation/guides/GettingStartedGuide/en-US/Book_Info.xml
===================================================================
--- trunk/documentation/guides/GettingStartedGuide/en-US/Book_Info.xml 2011-02-17 14:27:03 UTC (rev 29195)
+++ trunk/documentation/guides/GettingStartedGuide/en-US/Book_Info.xml 2011-02-17 20:33:17 UTC (rev 29196)
@@ -8,7 +8,7 @@
<productname>JBoss Developer Studio</productname>
<productnumber>4.0</productnumber>
<edition>4.0.0</edition>
- <pubsnumber>10</pubsnumber>
+ <pubsnumber>11</pubsnumber>
<abstract>
<para>The Getting Started Guide explains the JBoss Developer Studio.</para>
</abstract>
@@ -25,13 +25,13 @@
<!-- The following code is used to build an installation guide, which includes only the installation.xml file. To build the Installation Guide simply uncomment the following <bookinfo> tag and comment out the <bookinfo> tag above -->
-<!--bookinfo>
+<!--<bookinfo>
<title>Installation Guide</title>
<subtitle>Provides information on how to install JBoss Developer Studio.</subtitle>
<productname>JBoss Developer Studio</productname>
<productnumber>4.0</productnumber>
<edition>4.0.0</edition>
- <pubsnumber>10</pubsnumber>
+ <pubsnumber>11</pubsnumber>
<abstract>
<para>JBoss Developer Studio Installation Guide.</para>
</abstract>
@@ -44,4 +44,4 @@
</corpauthor>
<xi:include href="Common_Content/Legal_Notice.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
<xi:include href="Author_Group.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
-</bookinfo-->
+</bookinfo>-->
Modified: trunk/documentation/guides/GettingStartedGuide/en-US/Installation_Guide.xml
===================================================================
--- trunk/documentation/guides/GettingStartedGuide/en-US/Installation_Guide.xml 2011-02-17 14:27:03 UTC (rev 29195)
+++ trunk/documentation/guides/GettingStartedGuide/en-US/Installation_Guide.xml 2011-02-17 20:33:17 UTC (rev 29196)
@@ -4,6 +4,7 @@
<book>
<xi:include href="Book_Info.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
<xi:include href="Preface.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
+<xi:include href="minimumrequirements.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
<xi:include href="installation.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
<xi:include href="Installation_Revision_History.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
</book>
Modified: trunk/documentation/guides/GettingStartedGuide/en-US/installation.xml
===================================================================
--- trunk/documentation/guides/GettingStartedGuide/en-US/installation.xml 2011-02-17 14:27:03 UTC (rev 29195)
+++ trunk/documentation/guides/GettingStartedGuide/en-US/installation.xml 2011-02-17 20:33:17 UTC (rev 29196)
@@ -343,8 +343,28 @@
</figure>
</section>
+
+ <section id="tech_previews">
+ <title>Getting Access to Tech Previews</title>
+
+ <para>
+ A number of components that are not officially supported in this release of JDBS have been made available through an additional Tech Preview Eclipse update site. To access this update site select <menuchoice><guimenuitem>Help</guimenuitem><guimenuitem>Install New Software...</guimenuitem></menuchoice> in Eclipse, click the <guibutton>Add...</guibutton> button, and in the <guilabel>Add Repository</guilabel> dialog box enter <guilabel>JBDS Tech Preview</guilabel> in the <guilabel>Name</guilabel> field and <guilabel>http://devstudio.jboss.com/updates/4.0/techpreview</guilabel> in the <guilabel>Location</guilabel> field. Click the <guibutton>OK</guibutton> button to save your changes.
+ </para>
+
+ <para>
+ Eclipse will then list the components available on the update site, which you can select and install by following the prompts.
+ </para>
+
+ <note>
+ <title>Note</title>
+ <para>
+ If you are prompted for credentials when accessing the Tech Preview Update Site, enter the username and password that were supplied in an email or shown in the <ulink url="http://access.redhat.com">Customer Service Portal</ulink>. If you experience any issues accessing the Tech Preview Update Site please contact technical support.
+ </para>
+ </note>
+
+ </section>
- <section id="jbds_jbosstools">
+ <!--section id="jbds_jbosstools">
<title>JBoss Developer Studio and JBoss Tools</title>
@@ -412,15 +432,15 @@
<listitem>
<para>Smooks Tools</para>
</listitem>
- <!--listitem>
+ <listitem>
<para>Deltacloud Tools</para>
- </listitem-->
+ </listitem>
</itemizedlist>
- <!--note>
+ <note>
<title>Note</title>
<para>The JBoss Tools Deltacloud component is not included with JBoss Developer Studio in this release.</para>
- </note-->
+ </note>
<para>To install the JBoss Tools plugins for Eclipse, you need the following:</para>
@@ -670,5 +690,5 @@
</section>
</section>
- </section>
+ </section -->
</chapter>
13 years, 10 months
JBoss Tools SVN: r29195 - in trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal: context/basic and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2011-02-17 09:27:03 -0500 (Thu, 17 Feb 2011)
New Revision: 29195
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/Parameter.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/TypeHolder.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/basic/Hibernate.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JavaType.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/TypeAnnotation.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/TypeAnnotationImpl.java
Log:
Fix wrong copyright year.
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/Parameter.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/Parameter.java 2011-02-17 14:26:23 UTC (rev 29194)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/Parameter.java 2011-02-17 14:27:03 UTC (rev 29195)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Red Hat, Inc.
+ * Copyright (c) 2009-2011 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,
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/TypeHolder.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/TypeHolder.java 2011-02-17 14:26:23 UTC (rev 29194)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/TypeHolder.java 2011-02-17 14:27:03 UTC (rev 29195)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Red Hat, Inc.
+ * Copyright (c) 2011 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,
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/basic/Hibernate.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/basic/Hibernate.java 2011-02-17 14:26:23 UTC (rev 29194)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/basic/Hibernate.java 2011-02-17 14:27:03 UTC (rev 29195)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008-2009 Red Hat, Inc.
+ * Copyright (c) 2008-2011 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,
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JavaType.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JavaType.java 2011-02-17 14:26:23 UTC (rev 29194)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JavaType.java 2011-02-17 14:27:03 UTC (rev 29195)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
+ * Copyright (c) 2011 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,
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/TypeAnnotation.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/TypeAnnotation.java 2011-02-17 14:26:23 UTC (rev 29194)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/TypeAnnotation.java 2011-02-17 14:27:03 UTC (rev 29195)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Red Hat, Inc.
+ * Copyright (c) 2011 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,
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/TypeAnnotationImpl.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/TypeAnnotationImpl.java 2011-02-17 14:26:23 UTC (rev 29194)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/TypeAnnotationImpl.java 2011-02-17 14:27:03 UTC (rev 29195)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Red Hat, Inc.
+ * Copyright (c) 2011 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,
13 years, 10 months
JBoss Tools SVN: r29194 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2011-02-17 09:26:23 -0500 (Thu, 17 Feb 2011)
New Revision: 29194
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JpaUtil.java
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JavaGenericGeneratorImpl.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/TypeImpl.java
Log:
https://issues.jboss.org/browse/JBIDE-8435
Fixed the problem with interface implementation check.
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JavaGenericGeneratorImpl.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JavaGenericGeneratorImpl.java 2011-02-17 12:41:37 UTC (rev 29193)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JavaGenericGeneratorImpl.java 2011-02-17 14:26:23 UTC (rev 29194)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009-2009 Red Hat, Inc.
+ * Copyright (c) 2009-2011 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,
@@ -11,7 +11,6 @@
package org.jboss.tools.hibernate.jpt.core.internal.context.java;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import java.util.ListIterator;
@@ -160,7 +159,7 @@
if (lwType == null || !lwType.isClass()){
messages.add(creatErrorMessage(STRATEGY_CLASS_NOT_FOUND, new String[]{strategy}, lineNum));
} else {
- if (!isImplementsIdentifierInterface(lwType)){
+ if (!JpaUtil.isTypeImplementsInterface(getJpaProject().getJavaProject(), lwType, "org.hibernate.id.IdentifierGenerator")){//$NON-NLS-1$
messages.add(creatErrorMessage(STRATEGY_INTERFACE, new String[]{strategy}, lineNum));
}
}
@@ -172,26 +171,6 @@
}
}
- /**
- *
- * @param lwType
- * @return <code>true</code> if type implements IdentifierGenerator interface.
- * @throws JavaModelException
- */
- protected boolean isImplementsIdentifierInterface(IType type) throws JavaModelException{
- if (type == null) return false;
- String[] interfaces = type.getSuperInterfaceNames();
- if (Arrays.binarySearch(interfaces, "org.hibernate.id.IdentifierGenerator") >= 0) {//$NON-NLS-1$
- return true;
- } else if (type.getSuperclassName() != null){
- IType parentType = getJpaProject().getJavaProject().findType(type.getSuperclassName());
- if (parentType != null){
- return isImplementsIdentifierInterface(parentType);
- }
- }
- return false;
- }
-
protected IMessage creatErrorMessage(String strmessage, String[] params, int lineNum){
IMessage message = new LocalMessage(IMessage.HIGH_SEVERITY,
strmessage, params, getResource());
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JpaUtil.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JpaUtil.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JpaUtil.java 2011-02-17 14:26:23 UTC (rev 29194)
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+public class JpaUtil {
+
+ /**
+ *
+ * @param javaProject
+ * @param type
+ * @param interfaceName
+ * @return <code>true</code> if the type implements interface interfaceName.
+ * @throws JavaModelException
+ */
+ public static boolean isTypeImplementsInterface(IJavaProject javaProject, IType type, String interfaceName) throws JavaModelException{
+ if (type == null) return false;
+ String[] interfaces = type.getSuperInterfaceNames();
+ for (String interface_ : interfaces) {
+ if (interfaceName.equals(interface_))
+ return true;
+ }
+ if (type.getSuperclassName() != null){
+ IType parentType = javaProject.findType(type.getSuperclassName());
+ if (parentType != null){
+ if (isTypeImplementsInterface(javaProject, parentType, interfaceName)){
+ return true;
+ }
+ }
+ }
+ for (String interface_ : interfaces) {
+ IType parentInterface = javaProject.findType(interface_);
+ if (isTypeImplementsInterface(javaProject, parentInterface, interfaceName)){
+ return true;
+ }
+ }
+ return false;
+ }
+
+}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/TypeImpl.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/TypeImpl.java 2011-02-17 12:41:37 UTC (rev 29193)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/TypeImpl.java 2011-02-17 14:26:23 UTC (rev 29194)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
+ * Copyright (c) 2011 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,
@@ -12,16 +12,14 @@
import java.util.List;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
import org.eclipse.jpt.core.utility.TextRange;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-import org.jboss.tools.hibernate.jpt.core.internal.context.Messages;
import org.jboss.tools.hibernate.jpt.core.internal.context.HibernatePersistenceUnit.LocalMessage;
+import org.jboss.tools.hibernate.jpt.core.internal.context.Messages;
import org.jboss.tools.hibernate.jpt.core.internal.resource.java.TypeAnnotation;
/**
@@ -101,7 +99,7 @@
if (lwType == null || !lwType.isClass()){
messages.add(creatErrorMessage(STRATEGY_CLASS_NOT_FOUND, new String[]{type}, lineNum));
} else {
- if (!isImplementsUserTypeInterface(lwType)){
+ if (!JpaUtil.isTypeImplementsInterface(getJpaProject().getJavaProject(), lwType, "org.hibernate.usertype.UserType")){//$NON-NLS-1$
messages.add(creatErrorMessage(USER_TYPE_INTERFACE, new String[]{type}, lineNum));
}
}
@@ -112,36 +110,6 @@
}*/
}
- /**
- *
- * @param lwType
- * @return <code>true</code> if type implements UserType interface.
- * @throws JavaModelException
- */
- protected boolean isImplementsUserTypeInterface(IType type) throws JavaModelException{
- if (type == null) return false;
- String[] interfaces = type.getSuperInterfaceNames();
- for (String interface_ : interfaces) {
- if ("org.hibernate.usertype.UserType".equals(interface_)) //$NON-NLS-1$
- return true;
- }
- if (type.getSuperclassName() != null){
- IType parentType = getJpaProject().getJavaProject().findType(type.getSuperclassName());
- if (parentType != null){
- if (isImplementsUserTypeInterface(parentType)){
- return true;
- }
- }
- }
- for (String interface_ : interfaces) {
- IType parentType = getJpaProject().getJavaProject().findType(interface_);
- if (isImplementsUserTypeInterface(parentType)){
- return true;
- }
- }
- return false;
- }
-
protected IMessage creatErrorMessage(String strmessage, String[] params, int lineNum){
IMessage message = new LocalMessage(IMessage.HIGH_SEVERITY,
strmessage, params, getResource());
13 years, 10 months
JBoss Tools SVN: r29193 - trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2011-02-17 07:41:37 -0500 (Thu, 17 Feb 2011)
New Revision: 29193
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/CreateJSF2CompositeAction.java
Log:
https://issues.jboss.org/browse/JBIDE-6267 , validator for component name was added.
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/CreateJSF2CompositeAction.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/CreateJSF2CompositeAction.java 2011-02-17 12:20:33 UTC (rev 29192)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/CreateJSF2CompositeAction.java 2011-02-17 12:41:37 UTC (rev 29193)
@@ -14,12 +14,16 @@
import java.io.IOException;
import java.util.List;
import java.util.Properties;
+import java.util.regex.Pattern;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.action.Action;
+import org.eclipse.jface.dialogs.IInputValidator;
import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
@@ -70,31 +74,51 @@
if (selection instanceof TextSelection) {
TextSelection textSelection = (TextSelection) selection;
String text = textSelection.getText();
+ final IProject project = editor.getProject();
/*
* Get composite template creator
*/
InputDialog dlg = new InputDialog(Display.getCurrent().getActiveShell(),
"Creating composite component", //$NON-NLS-1$
"Enter component's namespace and name:", "namespace:name", //$NON-NLS-1$ //$NON-NLS-2$
- null);
+ new IInputValidator() {
+ public String isValid(String newText) {
+ String trim = newText.trim();
+ String result = null;
+ String[] split = trim.split(":", 2); //$NON-NLS-1$
+ Pattern p = Pattern.compile("([a-zA-Z]+\\d*)+"); //$NON-NLS-1$
+ /*
+ * Check the correct format.
+ * Matcher will accept only word characters with optional numbers.
+ */
+ if ((split.length != 2) || trim.startsWith(":") || trim.endsWith(":") //$NON-NLS-1$ //$NON-NLS-2$
+ || (split[0].length() == 0) || (split[1].length() == 0)) {
+ result = "Component's name should fit in the pattern \"namespace:name\""; //$NON-NLS-1$
+ } else if(!p.matcher(split[0]).matches()) {
+ result = "Namespace '"+split[0]+"' has wrong spelling, please correct"; //$NON-NLS-1$ //$NON-NLS-2$
+ } else if(!p.matcher(split[1]).matches()) {
+ result = "Name '"+split[1]+"' has wrong spelling, please correct"; //$NON-NLS-1$ //$NON-NLS-2$
+ } else {
+ String nameSpaceURI = JSF2ResourceUtil.JSF2_URI_PREFIX + "/" + split[0]; //$NON-NLS-1$
+ Object fld = JSF2ResourceUtil.findResourcesFolderContainerByNameSpace(project, nameSpaceURI);
+ if (fld instanceof IFolder) {
+ IResource res = ((IFolder) fld).findMember(split[1]+ ".xhtml"); //$NON-NLS-1$
+ if ((res instanceof IFile) && ((IFile)res).exists() ) {
+ result = "Component with the same name already exists"; //$NON-NLS-1$
+ }
+ }
+ }
+ return result;
+ }
+ });
if (dlg.open() == Window.OK) {
/*
* Create all required files
*/
String componentName = dlg.getValue();
+ String[] split = componentName.split(":", 2); //$NON-NLS-1$
String path = ""; //$NON-NLS-1$
- String name = ""; //$NON-NLS-1$
- String namespace = ""; //$NON-NLS-1$
- int index = componentName.indexOf(":"); //$NON-NLS-1$
- if (index != -1) {
- namespace = componentName.substring(0, index);
- name = componentName.substring(index+1, componentName.length());
- }
- path = componentName.replaceAll(":", "/"); //$NON-NLS-1$ //$NON-NLS-2$
- if (!path.endsWith(".xhtml")) { //$NON-NLS-1$
- path = path + ".xhtml"; //$NON-NLS-1$
- }
- IProject project = editor.getProject();
+ path = componentName.replaceAll(":", "/") + ".xhtml"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
if (project != null) {
try {
IFile createdFile = JSF2ResourceUtil
@@ -113,7 +137,7 @@
NodeList list = document.getElementsByTagName(IMPLEMENTATION);
if (list.getLength() == 1) {
String content = document.getStructuredDocument().getText();
- index = content.indexOf("<"+IMPLEMENTATION+">") + ("<"+IMPLEMENTATION+">").length(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ int index = content.indexOf("<"+IMPLEMENTATION+">") + ("<"+IMPLEMENTATION+">").length(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
content = content.subSequence(0, index) + "\n" + text + content.subSequence(index, content.length()); //$NON-NLS-1$
domModel.reload(new ByteArrayInputStream(content.getBytes()));
model.save();
@@ -130,17 +154,17 @@
*/
StructuredTextEditor ed = ((JSPMultiPageEditor) editor).getSourceEditor();
if (ed instanceof JSPTextEditor) {
- String libraryUri = JSF2ResourceUtil.JSF2_URI_PREFIX + "/" + namespace; //$NON-NLS-1$
+ String libraryUri = JSF2ResourceUtil.JSF2_URI_PREFIX + "/" + split[0]; //$NON-NLS-1$
PaletteTaglibInserter PaletteTaglibInserter = new PaletteTaglibInserter();
Properties p = new Properties();
p.put("selectionProvider", editor.getSelectionProvider()); //$NON-NLS-1$
p.setProperty(URIConstants.LIBRARY_URI, libraryUri);
p.setProperty(URIConstants.LIBRARY_VERSION, ""); //$NON-NLS-1$
- p.setProperty(URIConstants.DEFAULT_PREFIX, namespace);
+ p.setProperty(URIConstants.DEFAULT_PREFIX, split[0]);
p.setProperty(JSPPaletteInsertHelper.PROPOPERTY_ADD_TAGLIB, "true"); //$NON-NLS-1$
p.setProperty(XModelObjectConstants.REFORMAT, "yes"); //$NON-NLS-1$
p.setProperty(XModelObjectConstants.START_TEXT,
- "<%@ taglib uri=\""+libraryUri+"\" prefix=\"" +namespace+ "\" %>\\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ "<%@ taglib uri=\""+libraryUri+"\" prefix=\"" +split[0]+ "\" %>\\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
PaletteTaglibInserter.inserTaglib(ed.getTextViewer().getDocument(), p);
}
/*
13 years, 10 months
JBoss Tools SVN: r29192 - in trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test: src/org/jboss/tools/jsf/ui/bot/test/templates and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: vpakan(a)redhat.com
Date: 2011-02-17 07:20:33 -0500 (Thu, 17 Feb 2011)
New Revision: 29192
Added:
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/templates/RemoveUnknownTemplate.xml
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/templates/UnknownTemplate.xml
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/templates/SetTemplateForUnknownTagTest.java
Log:
Fixes for JBDS 4.0.0.GA
Added: trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/templates/RemoveUnknownTemplate.xml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/templates/RemoveUnknownTemplate.xml (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/templates/RemoveUnknownTemplate.xml 2011-02-17 12:20:33 UTC (rev 29192)
@@ -0,0 +1,48 @@
+<BODY id="__content__area__" >
+<DIV style="-moz-user-modify: read-write;" >
+<DIV style="display: none; -moz-user-modify: read-only;" title="head" >
+</DIV>
+<DIV title="body" >
+<TABLE style="border: 1px dotted rgb(255, 102, 0); padding: 5px; width: 100%;" title="f:view" >
+<TR title="f:view" >
+<TD title="f:view" >
+<DIV title="f:view" >
+<H1 style="-moz-user-modify: read-write;" title="h1" >
+<SPAN class="vpe-text" title="h:outputText value: #{Message.header}" >
+Hello Demo Application
+</SPAN>
+</H1>
+<DIV style="border: 2px solid rgb(0, 0, 255) ! important; -moz-user-modify: read-only;" title="h:unknowntag" oldstyle="border: 1px solid green; -moz-user-modify: read-only;" >
+<DIV class="__any__tag__caption" style="" title="h:unknowntag" >
+h:unknowntag
+</DIV>
+<BR vpe:pseudo-element="yes" style="font-style: italic; color: green; -moz-user-modify: read-only;" >
+</BR>
+</DIV>
+<UL style="color: red; -moz-user-modify: read-only;" title="h:messages style: color: red" >
+<LI title="h:messages style: color: red" >
+Error Messages
+</LI>
+</UL>
+<FORM style="border: 1px dotted rgb(255, 102, 0); padding: 5px;" title="h:form id: greetingForm" >
+<SPAN class="vpe-text" title="h:outputText value: #{Message.prompt_message}" >
+Name:
+</SPAN>
+<SPAN class="vpe-text" title="h:inputText value: #{user.name} required: true" >
+<SPAN class="vpe-text" title="h:inputText value: #{user.name} required: true" >
+</SPAN>
+<INPUT value="#{user.name}" title="h:inputText value: #{user.name} required: true" >
+</INPUT>
+</SPAN>
+<INPUT type="button" title="h:commandButton action: hello value: Say Hello!" value="Say Hello!" style="-moz-user-modify: read-only;" >
+</INPUT>
+</FORM>
+</DIV>
+</TD>
+</TR>
+</TABLE>
+</DIV>
+</DIV>
+<IMG vpetemporarydndelement="true" id="dragIcon" src="file:////opt/jbdevstudio4.0.0.CR4/studio/plugins/org.jboss.tools.vpe_3.2.0.v20110211-1322-H26-CR3/ve/dragIcon.gif" style="position: absolute; cursor: move; left: 16px ! important; top: 78px ! important;" >
+</IMG>
+</BODY>
\ No newline at end of file
Property changes on: trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/templates/RemoveUnknownTemplate.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/templates/UnknownTemplate.xml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/templates/UnknownTemplate.xml 2011-02-17 12:16:09 UTC (rev 29191)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/templates/UnknownTemplate.xml 2011-02-17 12:20:33 UTC (rev 29192)
@@ -1,18 +1,19 @@
-<BODY id="__content__area__" >
-<DIV style="-moz-user-modify: read-write;" >
-<DIV style="display: none; -moz-user-modify: read-only;" title="head" >
+<BODY id="__content__area__">
+<DIV style="-moz-user-modify: read-write;">
+<DIV style="display: none; -moz-user-modify: read-only;" title="head">
</DIV>
-<DIV title="body" >
-<TABLE style="border: 1px dotted rgb(255, 102, 0); padding: 5px; width: 100%;" title="f:view" >
-<TR title="f:view" >
-<TD title="f:view" >
-<DIV title="f:view" >
-<H1 style="-moz-user-modify: read-write;" title="h1" >
-<SPAN class="vpe-text" title="h:outputText value: #{Message.header}" >
+<DIV title="body">
+<TABLE style="border: 1px dotted rgb(255, 102, 0); padding: 5px; width: 100%;" title="f:view">
+<TR title="f:view">
+<TD title="f:view">
+<DIV title="f:view">
+<H1 style="-moz-user-modify: read-write;" title="h1">
+<SPAN class="vpe-text" title="h:outputText
+value: #{Message.header}">
Hello Demo Application
</SPAN>
</H1>
-<DIV style="border: 2px solid rgb(0, 0, 255) ! important; -moz-user-modify: read-only;" title="h:unknowntag" oldstyle="border: 1px solid green; -moz-user-modify: read-only;" >
+<DIV style="border: 1px solid green; -moz-user-modify: read-only;" title="h:unknowntag" >
<DIV class="__any__tag__caption" style="" title="h:unknowntag" >
h:unknowntag
</DIV>
@@ -43,6 +44,6 @@
</TABLE>
</DIV>
</DIV>
-<IMG vpetemporarydndelement="true" id="dragIcon" src="file:////opt/jbdevstudio4.0.0.CR4/studio/plugins/org.jboss.tools.vpe_3.2.0.v20110211-1322-H26-CR3/ve/dragIcon.gif" style="position: absolute; cursor: move; left: 16px ! important; top: 78px ! important;" >
+<IMG vpetemporarydndelement="true" id="dragIcon" src="file:////opt/jbdevstudio4.0.0.Beta2/studio/eclipse/plugins/org.jboss.tools.vpe_3.2.0.v201012050623R-H30-Beta2/ve/dragIcon.gif" style="position: absolute; cursor: move; left: 16px ! important; top: 17px ! important;" >
</IMG>
</BODY>
\ No newline at end of file
Modified: trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/templates/SetTemplateForUnknownTagTest.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/templates/SetTemplateForUnknownTagTest.java 2011-02-17 12:16:09 UTC (rev 29191)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/templates/SetTemplateForUnknownTagTest.java 2011-02-17 12:20:33 UTC (rev 29192)
@@ -84,7 +84,7 @@
bot.button(WidgetVariables.REMOVE_BUTTON).click();
bot.shell(WidgetVariables.PREF_FILTER_SHELL_TITLE).activate();
bot.button(WidgetVariables.OK_BUTTON).click();
- checkVPE("templates/UnknownTemplate.xml"); //$NON-NLS-1$
+ checkVPE("templates/RemoveUnknownTemplate.xml"); //$NON-NLS-1$
}
private String setStyles(){
13 years, 10 months
JBoss Tools SVN: r29191 - in trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal: context and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2011-02-17 07:16:09 -0500 (Thu, 17 Feb 2011)
New Revision: 29191
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/TypeHolder.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JavaType.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/TypeImpl.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/TypeAnnotation.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/TypeAnnotationImpl.java
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateAbstractJpaFactory.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaAnnotationDefinitionProvider.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/Messages.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/Messages.properties
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/basic/Hibernate.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaBasicMapping.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaBasicMappingImpl.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaIdMapping.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaIdMappingImpl.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/jpa2/HibernateJpa2_0AnnotationDefinitionProvider.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/GenericGeneratorAnnotation.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/ParameterAnnotation.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/SourceParameterAnnotation.java
Log:
https://issues.jboss.org/browse/JBIDE-8238
Added org.hibernate.annotations.Type annotation support.
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateAbstractJpaFactory.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateAbstractJpaFactory.java 2011-02-17 08:41:55 UTC (rev 29190)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateAbstractJpaFactory.java 2011-02-17 12:16:09 UTC (rev 29191)
@@ -46,6 +46,8 @@
import org.jboss.tools.hibernate.jpt.core.internal.context.java.JavaGenericGeneratorImpl;
import org.jboss.tools.hibernate.jpt.core.internal.context.java.JavaIndex;
import org.jboss.tools.hibernate.jpt.core.internal.context.java.JavaParameter;
+import org.jboss.tools.hibernate.jpt.core.internal.context.java.JavaType;
+import org.jboss.tools.hibernate.jpt.core.internal.context.java.TypeImpl;
public abstract class HibernateAbstractJpaFactory extends AbstractJpaFactory {
@@ -149,4 +151,8 @@
return new ForeignKeyImpl(parent);
}
+ public JavaType buildType(JavaJpaContextNode parent) {
+ return new TypeImpl(parent);
+ }
+
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaAnnotationDefinitionProvider.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaAnnotationDefinitionProvider.java 2011-02-17 08:41:55 UTC (rev 29190)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaAnnotationDefinitionProvider.java 2011-02-17 12:16:09 UTC (rev 29191)
@@ -25,6 +25,7 @@
import org.jboss.tools.hibernate.jpt.core.internal.resource.java.HibernateNamedQueryAnnotationDefinition;
import org.jboss.tools.hibernate.jpt.core.internal.resource.java.IndexAnnotationImpl.IndexAnnotationDefinition;
import org.jboss.tools.hibernate.jpt.core.internal.resource.java.SourceGenericGeneratorsAnnotation.GenericGeneratorsAnnotationDefinition;
+import org.jboss.tools.hibernate.jpt.core.internal.resource.java.TypeAnnotationImpl.TypeAnnotationDefinition;
/**
* @author Dmitry Geraskov
@@ -66,6 +67,7 @@
definitions.add(GenericGeneratorAnnotationDefinition.instance());
definitions.add(GeneratedAnnotationDefinition.instance());
definitions.add(IndexAnnotationDefinition.instance());
+ definitions.add(TypeAnnotationDefinition.instance());
definitions.add(ForeignKeyAnnotationDefinition.instance());
}
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/Messages.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/Messages.java 2011-02-17 08:41:55 UTC (rev 29190)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/Messages.java 2011-02-17 12:16:09 UTC (rev 29191)
@@ -31,5 +31,9 @@
String UNRESOLVED_FOREIGN_KEY_NAME = "UNRESOLVED_FOREIGN_KEY_NAME"; //$NON-NLS-1$
String CC_NOT_EXISTS = "CC_NOT_EXISTS"; //$NON-NLS-1$
+
+ String TYPE_CANT_BE_EMPTY = "TYPE_CANT_BE_EMPTY"; //$NON-NLS-1$
+
+ String USER_TYPE_INTERFACE = "USER_TYPE_INTERFACE"; //$NON-NLS-1$
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/Messages.properties
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/Messages.properties 2011-02-17 08:41:55 UTC (rev 29190)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/Messages.properties 2011-02-17 12:16:09 UTC (rev 29191)
@@ -5,4 +5,6 @@
STRATEGY_INTERFACE = Strategy class \"{0}\" should implement interface \"org.hibernate.id.IdentifierGenerator\".
NAMING_STRATEGY_EXCEPTION = Exception occurred when calling NamingStrategy:
UNRESOLVED_FOREIGN_KEY_NAME = Foreign key \"{0}\" not found in the table \"{1}\".
-CC_NOT_EXISTS= Console configuration \"{0}\" does not exist.
\ No newline at end of file
+CC_NOT_EXISTS= Console configuration \"{0}\" does not exist.
+TYPE_CANT_BE_EMPTY=Type could not be empty.
+USER_TYPE_INTERFACE = Type class \"{0}\" should implement interface \"org.hibernate.usertype.UserType\".
\ No newline at end of file
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/TypeHolder.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/TypeHolder.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/TypeHolder.java 2011-02-17 12:16:09 UTC (rev 29191)
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * 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.JpaContextNode;
+import org.jboss.tools.hibernate.jpt.core.internal.context.java.JavaType;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+public interface TypeHolder extends JpaContextNode {
+
+ //******************** index *****************
+
+ String TYPE_PROPERTY = "type"; //$NON-NLS-1$
+
+ JavaType getType();
+
+ JavaType addType();
+
+ void removeType();
+
+}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/basic/Hibernate.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/basic/Hibernate.java 2011-02-17 08:41:55 UTC (rev 29190)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/basic/Hibernate.java 2011-02-17 12:16:09 UTC (rev 29191)
@@ -28,9 +28,9 @@
String GENERIC_GENERATOR__STRATEGY = "strategy"; //$NON-NLS-1$
String GENERIC_GENERATOR__PARAMETERS = "parameters"; //$NON-NLS-1$
- String GENERATOR_PARAMETER = PACKAGE_ + "Parameter"; //$NON-NLS-1$
- String GENERATOR_PARAMETER__NAME = "name"; //$NON-NLS-1$
- String GENERATOR_PARAMETER__VALUE = "value"; //$NON-NLS-1$
+ String PARAMETER = PACKAGE_ + "Parameter"; //$NON-NLS-1$
+ String PARAMETER__NAME = "name"; //$NON-NLS-1$
+ String PARAMETER__VALUE = "value"; //$NON-NLS-1$
String GENERIC_GENERATORS = PACKAGE_ + "GenericGenerators"; //$NON-NLS-1$
String GENERIC_GENERATORS__VALUE = "value"; //$NON-NLS-1$
@@ -105,4 +105,7 @@
String FOREIGN_KEY = PACKAGE_ + "ForeignKey"; //$NON-NLS-1$
String FOREIGN_KEY__NAME = "name"; //$NON-NLS-1$
String FOREIGN_KEY__INVERSE_NAME = "inverseName"; //$NON-NLS-1$
+
+ String TYPE = PACKAGE_ + "Type"; //$NON-NLS-1$
+ String TYPE__TYPE = "type"; //$NON-NLS-1$
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaBasicMapping.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaBasicMapping.java 2011-02-17 08:41:55 UTC (rev 29190)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaBasicMapping.java 2011-02-17 12:16:09 UTC (rev 29191)
@@ -14,11 +14,12 @@
import org.eclipse.jpt.core.context.java.JavaBasicMapping;
import org.jboss.tools.hibernate.jpt.core.internal.context.Generated;
import org.jboss.tools.hibernate.jpt.core.internal.context.IndexHolder;
+import org.jboss.tools.hibernate.jpt.core.internal.context.TypeHolder;
/**
* @author Dmitry Geraskov
*
*/
-public interface HibernateJavaBasicMapping extends JavaBasicMapping, Generated, IndexHolder {
+public interface HibernateJavaBasicMapping extends JavaBasicMapping, Generated, IndexHolder, TypeHolder {
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaBasicMappingImpl.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaBasicMappingImpl.java 2011-02-17 08:41:55 UTC (rev 29190)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaBasicMappingImpl.java 2011-02-17 12:16:09 UTC (rev 29191)
@@ -11,16 +11,21 @@
package org.jboss.tools.hibernate.jpt.core.internal.context.java;
+import java.util.List;
import java.util.Vector;
+import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
import org.eclipse.jpt.core.internal.context.java.AbstractJavaBasicMapping;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
import org.jboss.tools.hibernate.jpt.core.internal.HibernateAbstractJpaFactory;
import org.jboss.tools.hibernate.jpt.core.internal.context.Generated;
import org.jboss.tools.hibernate.jpt.core.internal.context.GenerationTime;
import org.jboss.tools.hibernate.jpt.core.internal.context.basic.Hibernate;
import org.jboss.tools.hibernate.jpt.core.internal.resource.java.GeneratedAnnotation;
import org.jboss.tools.hibernate.jpt.core.internal.resource.java.IndexAnnotation;
+import org.jboss.tools.hibernate.jpt.core.internal.resource.java.TypeAnnotation;
/**
* @author Dmitry Geraskov
@@ -33,6 +38,8 @@
protected JavaIndex index;
+ protected JavaType type;
+
public HibernateJavaBasicMappingImpl(JavaPersistentAttribute parent) {
super(parent);
}
@@ -41,6 +48,7 @@
public void addSupportingAnnotationNamesTo(Vector<String> names) {
names.add(Hibernate.GENERATED);
names.add(Hibernate.INDEX);
+ names.add(Hibernate.TYPE);
}
@Override
@@ -53,6 +61,7 @@
super.initialize();
this.specifiedGenerationTime = this.getResourceGenerationTime();
this.initializeIndex();
+ this.initializeType();
}
@Override
@@ -60,6 +69,7 @@
super.update();
this.setGenerationTime_(this.getResourceGenerationTime());
this.updateIndex();
+ this.updateType();
}
public GeneratedAnnotation getResourceGenerated() {
@@ -174,4 +184,86 @@
return (IndexAnnotation) this.getResourcePersistentAttribute().getAnnotation(IndexAnnotation.ANNOTATION_NAME);
}
+ // *** type
+
+ protected void initializeType() {
+ TypeAnnotation typeResource = getTypeResource();
+ if (typeResource != null) {
+ this.type = buildType(typeResource);
+ }
+ }
+
+ protected void updateType() {
+ TypeAnnotation typeResource = getTypeResource();
+ if (typeResource == null) {
+ if (getType() != null) {
+ setType(null);
+ }
+ }
+ else {
+ if (getType() == null) {
+ setType(buildType(typeResource));
+ }
+ else {
+ getType().update(typeResource);
+ }
+ }
+ }
+
+ public JavaType addType() {
+ if (getType() != null) {
+ throw new IllegalStateException("type already exists"); //$NON-NLS-1$
+ }
+ this.type = getJpaFactory().buildType(this);
+ TypeAnnotation typeResource = (TypeAnnotation) getResourcePersistentAttribute().addAnnotation(TypeAnnotation.ANNOTATION_NAME);
+ this.type.initialize(typeResource);
+ firePropertyChanged(TYPE_PROPERTY, null, this.type);
+ return this.type;
+ }
+
+ public JavaType getType() {
+ return this.type;
+ }
+
+ protected void setType(JavaType newType) {
+ JavaType oldType = this.type;
+ this.type = newType;
+ firePropertyChanged(TYPE_PROPERTY, oldType, newType);
+ }
+
+ public void removeType() {
+ if (getType() == null) {
+ throw new IllegalStateException("type does not exist, cannot be removed"); //$NON-NLS-1$
+ }
+ JavaType oldType = this.type;
+ this.type = null;
+ this.getResourcePersistentAttribute().removeAnnotation(TypeAnnotation.ANNOTATION_NAME);
+ firePropertyChanged(TYPE_PROPERTY, oldType, null);
+ }
+
+ protected JavaType buildType(TypeAnnotation typeResource) {
+ JavaType type = getJpaFactory().buildType(this);
+ type.initialize(typeResource);
+ return type;
+ }
+
+ protected TypeAnnotation getTypeResource() {
+ return (TypeAnnotation) this.getResourcePersistentAttribute().getAnnotation(TypeAnnotation.ANNOTATION_NAME);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jpt.core.internal.context.java.AbstractJavaBasicMapping#validate(java.util.List, org.eclipse.wst.validation.internal.provisional.core.IReporter, org.eclipse.jdt.core.dom.CompilationUnit)
+ */
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter,
+ CompilationUnit astRoot) {
+ super.validate(messages, reporter, astRoot);
+ if (this.index != null){
+ this.index.validate(messages, reporter, astRoot);
+ }
+ if (this.type != null){
+ this.type.validate(messages, reporter, astRoot);
+ }
+ }
+
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaIdMapping.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaIdMapping.java 2011-02-17 08:41:55 UTC (rev 29190)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaIdMapping.java 2011-02-17 12:16:09 UTC (rev 29191)
@@ -14,12 +14,13 @@
import org.eclipse.jpt.core.context.java.JavaIdMapping;
import org.jboss.tools.hibernate.jpt.core.internal.context.HibernateIdMapping;
import org.jboss.tools.hibernate.jpt.core.internal.context.IndexHolder;
+import org.jboss.tools.hibernate.jpt.core.internal.context.TypeHolder;
/**
* @author Dmitry Geraskov
*
*/
-public interface HibernateJavaIdMapping extends JavaIdMapping, IndexHolder, HibernateIdMapping {
+public interface HibernateJavaIdMapping extends JavaIdMapping, IndexHolder, HibernateIdMapping, TypeHolder {
HibernateJavaGeneratorContainer getGeneratorContainer();
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaIdMappingImpl.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaIdMappingImpl.java 2011-02-17 08:41:55 UTC (rev 29190)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaIdMappingImpl.java 2011-02-17 12:16:09 UTC (rev 29191)
@@ -10,13 +10,18 @@
******************************************************************************/
package org.jboss.tools.hibernate.jpt.core.internal.context.java;
+import java.util.List;
import java.util.Vector;
+import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
import org.eclipse.jpt.core.internal.context.java.AbstractJavaIdMapping;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
import org.jboss.tools.hibernate.jpt.core.internal.HibernateAbstractJpaFactory;
import org.jboss.tools.hibernate.jpt.core.internal.context.basic.Hibernate;
import org.jboss.tools.hibernate.jpt.core.internal.resource.java.IndexAnnotation;
+import org.jboss.tools.hibernate.jpt.core.internal.resource.java.TypeAnnotation;
/**
* @author Dmitry Geraskov
@@ -27,6 +32,8 @@
protected JavaIndex index;
+ protected JavaType type;
+
/**
* @param parent
*/
@@ -43,6 +50,7 @@
protected void addSupportingAnnotationNamesTo(Vector<String> names) {
super.addSupportingAnnotationNamesTo(names);
names.add(Hibernate.INDEX);
+ names.add(Hibernate.TYPE);
}
@Override
@@ -54,12 +62,14 @@
protected void initialize() {
super.initialize();
this.initializeIndex();
+ this.initializeType();
}
@Override
public void update() {
super.update();
this.updateIndex();
+ this.updateType();
}
@Override
@@ -138,5 +148,84 @@
protected IndexAnnotation getResourceIndex() {
return (IndexAnnotation) this.getResourcePersistentAttribute().getAnnotation(IndexAnnotation.ANNOTATION_NAME);
}
+
+ // *** type
+
+ protected void initializeType() {
+ TypeAnnotation typeResource = getTypeResource();
+ if (typeResource != null) {
+ this.type = buildType(typeResource);
+ }
+ }
+
+ protected void updateType() {
+ TypeAnnotation typeResource = getTypeResource();
+ if (typeResource == null) {
+ if (getType() != null) {
+ setType(null);
+ }
+ }
+ else {
+ if (getType() == null) {
+ setType(buildType(typeResource));
+ }
+ else {
+ getType().update(typeResource);
+ }
+ }
+ }
+
+ public JavaType addType() {
+ if (getType() != null) {
+ throw new IllegalStateException("type already exists"); //$NON-NLS-1$
+ }
+ this.type = getJpaFactory().buildType(this);
+ TypeAnnotation typeResource = (TypeAnnotation) getResourcePersistentAttribute().addAnnotation(TypeAnnotation.ANNOTATION_NAME);
+ this.type.initialize(typeResource);
+ firePropertyChanged(TYPE_PROPERTY, null, this.type);
+ return this.type;
+ }
+ public JavaType getType() {
+ return this.type;
+ }
+
+ protected void setType(JavaType newType) {
+ JavaType oldType = this.type;
+ this.type = newType;
+ firePropertyChanged(TYPE_PROPERTY, oldType, newType);
+ }
+
+ public void removeType() {
+ if (getType() == null) {
+ throw new IllegalStateException("type does not exist, cannot be removed"); //$NON-NLS-1$
+ }
+ JavaType oldType = this.type;
+ this.type = null;
+ this.getResourcePersistentAttribute().removeAnnotation(TypeAnnotation.ANNOTATION_NAME);
+ firePropertyChanged(TYPE_PROPERTY, oldType, null);
+ }
+
+ protected JavaType buildType(TypeAnnotation typeResource) {
+ JavaType type = getJpaFactory().buildType(this);
+ type.initialize(typeResource);
+ return type;
+ }
+
+ protected TypeAnnotation getTypeResource() {
+ return (TypeAnnotation) this.getResourcePersistentAttribute().getAnnotation(TypeAnnotation.ANNOTATION_NAME);
+ }
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter,
+ CompilationUnit astRoot) {
+ super.validate(messages, reporter, astRoot);
+ if (this.index != null){
+ this.index.validate(messages, reporter, astRoot);
+ }
+ if (this.type != null){
+ this.type.validate(messages, reporter, astRoot);
+ }
+ }
+
}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JavaType.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JavaType.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JavaType.java 2011-02-17 12:16:09 UTC (rev 29191)
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.hibernate.jpt.core.internal.context.java;
+
+import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
+import org.jboss.tools.hibernate.jpt.core.internal.resource.java.TypeAnnotation;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+public interface JavaType extends JavaJpaContextNode {
+
+ String getType();
+ void setType(String name);
+ String TYPE_TYPE = "type"; //$NON-NLS-1$
+
+ public void initialize(TypeAnnotation typeResource);
+
+ public void update(TypeAnnotation typeResource);
+
+}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/TypeImpl.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/TypeImpl.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/TypeImpl.java 2011-02-17 12:16:09 UTC (rev 29191)
@@ -0,0 +1,152 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.hibernate.jpt.core.internal.context.java;
+
+import java.util.List;
+
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+import org.jboss.tools.hibernate.jpt.core.internal.context.Messages;
+import org.jboss.tools.hibernate.jpt.core.internal.context.HibernatePersistenceUnit.LocalMessage;
+import org.jboss.tools.hibernate.jpt.core.internal.resource.java.TypeAnnotation;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+public class TypeImpl extends AbstractJavaJpaContextNode implements JavaType, Messages {
+
+ private TypeAnnotation typeResource;
+
+ private String type;
+
+ public TypeImpl(JavaJpaContextNode parent) {
+ super(parent);
+ }
+
+ public void initialize(TypeAnnotation indexResource) {
+ this.typeResource = indexResource;
+ this.type = indexResource.getType();
+ }
+
+ public void update(TypeAnnotation indexResource) {
+ this.typeResource = indexResource;
+ this.setType_(indexResource.getType());
+ }
+
+ // ***** name
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String name) {
+ String old = this.type;
+ this.type = name;
+ this.getTypeResource().setType(name);
+ this.firePropertyChanged(TYPE_TYPE, old, name);
+ }
+
+ public void setType_(String name) {
+ String old = this.type;
+ this.type = name;
+ this.firePropertyChanged(TYPE_TYPE, old, name);
+ }
+
+ public TypeAnnotation getTypeResource() {
+ return typeResource;
+ }
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return this.typeResource.getTextRange(astRoot);
+ }
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter,
+ CompilationUnit astRoot) {
+ super.validate(messages, reporter, astRoot);
+ validateType(messages, reporter, astRoot);
+ }
+
+ /**
+ * @param messages
+ * @param reporter
+ * @param astRoot
+ */
+ protected void validateType(List<IMessage> messages, IReporter reporter,
+ CompilationUnit astRoot) {
+ //TODO implement TypeDefs first as type could be a TypeDef
+ /*if (type != null) {
+ int lineNum = getValidationTextRange(astRoot) == null ? 0 : getValidationTextRange(astRoot).getLineNumber();
+ if (type.trim().length() == 0) {
+ messages.add(creatErrorMessage(TYPE_CANT_BE_EMPTY, new String[]{}, lineNum));
+ } else if (!persistentUnit.hasTypeDef(contains(type))) {
+ IType lwType = null;
+ try {
+ lwType = getJpaProject().getJavaProject().findType(type);
+ if (lwType == null || !lwType.isClass()){
+ messages.add(creatErrorMessage(STRATEGY_CLASS_NOT_FOUND, new String[]{type}, lineNum));
+ } else {
+ if (!isImplementsUserTypeInterface(lwType)){
+ messages.add(creatErrorMessage(USER_TYPE_INTERFACE, new String[]{type}, lineNum));
+ }
+ }
+ } catch (JavaModelException e) {
+ // just ignore it!
+ }
+ }
+ }*/
+ }
+
+ /**
+ *
+ * @param lwType
+ * @return <code>true</code> if type implements UserType interface.
+ * @throws JavaModelException
+ */
+ protected boolean isImplementsUserTypeInterface(IType type) throws JavaModelException{
+ if (type == null) return false;
+ String[] interfaces = type.getSuperInterfaceNames();
+ for (String interface_ : interfaces) {
+ if ("org.hibernate.usertype.UserType".equals(interface_)) //$NON-NLS-1$
+ return true;
+ }
+ if (type.getSuperclassName() != null){
+ IType parentType = getJpaProject().getJavaProject().findType(type.getSuperclassName());
+ if (parentType != null){
+ if (isImplementsUserTypeInterface(parentType)){
+ return true;
+ }
+ }
+ }
+ for (String interface_ : interfaces) {
+ IType parentType = getJpaProject().getJavaProject().findType(interface_);
+ if (isImplementsUserTypeInterface(parentType)){
+ return true;
+ }
+ }
+ return false;
+ }
+
+ protected IMessage creatErrorMessage(String strmessage, String[] params, int lineNum){
+ IMessage message = new LocalMessage(IMessage.HIGH_SEVERITY,
+ strmessage, params, getResource());
+ message.setLineNo(lineNum);
+ return message;
+ }
+
+}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/jpa2/HibernateJpa2_0AnnotationDefinitionProvider.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/jpa2/HibernateJpa2_0AnnotationDefinitionProvider.java 2011-02-17 08:41:55 UTC (rev 29190)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/jpa2/HibernateJpa2_0AnnotationDefinitionProvider.java 2011-02-17 12:16:09 UTC (rev 29191)
@@ -25,6 +25,7 @@
import org.jboss.tools.hibernate.jpt.core.internal.resource.java.HibernateNamedQueryAnnotationDefinition;
import org.jboss.tools.hibernate.jpt.core.internal.resource.java.IndexAnnotationImpl.IndexAnnotationDefinition;
import org.jboss.tools.hibernate.jpt.core.internal.resource.java.SourceGenericGeneratorsAnnotation.GenericGeneratorsAnnotationDefinition;
+import org.jboss.tools.hibernate.jpt.core.internal.resource.java.TypeAnnotationImpl.TypeAnnotationDefinition;
/**
* @author Dmitry Geraskov
@@ -66,6 +67,7 @@
definitions.add(GenericGeneratorAnnotationDefinition.instance());
definitions.add(GeneratedAnnotationDefinition.instance());
definitions.add(IndexAnnotationDefinition.instance());
+ definitions.add(TypeAnnotationDefinition.instance());
definitions.add(ForeignKeyAnnotationDefinition.instance());
}
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/GenericGeneratorAnnotation.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/GenericGeneratorAnnotation.java 2011-02-17 08:41:55 UTC (rev 29190)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/GenericGeneratorAnnotation.java 2011-02-17 12:16:09 UTC (rev 29191)
@@ -41,7 +41,6 @@
String STRATEGY_PROPERTY = "strategyProperty"; //$NON-NLS-1$
/**
- * Corresponds to the 'parameters' element of the *Generic Generator annotation.
* Return an empty iterator if the element does not exist in Java.
*/
ListIterator<ParameterAnnotation> parameters();
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/ParameterAnnotation.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/ParameterAnnotation.java 2011-02-17 08:41:55 UTC (rev 29190)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/ParameterAnnotation.java 2011-02-17 12:16:09 UTC (rev 29191)
@@ -21,14 +21,14 @@
*/
public interface ParameterAnnotation extends Annotation {
- String ANNOTATION_NAME = Hibernate.GENERATOR_PARAMETER;
+ String ANNOTATION_NAME = Hibernate.PARAMETER;
/**
* Corresponds to the 'name' element of the ParameterAnnotation annotation.
* Return null if the element does not exist in the annotation
*/
String getName();
- String NAME_PROPERTY = Hibernate.GENERATOR_PARAMETER__NAME;
+ String NAME_PROPERTY = Hibernate.PARAMETER__NAME;
/**
* Corresponds to the 'name' element of the ParameterAnnotation annotation.
@@ -48,7 +48,7 @@
* Return null if the element does not exist in the annotation
*/
String getValue();
- String VALUE_PROPERTY = Hibernate.GENERATOR_PARAMETER__VALUE;
+ String VALUE_PROPERTY = Hibernate.PARAMETER__VALUE;
/**
* Corresponds to the 'value' element of the ParameterAnnotation annotation.
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/SourceParameterAnnotation.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/SourceParameterAnnotation.java 2011-02-17 08:41:55 UTC (rev 29190)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/SourceParameterAnnotation.java 2011-02-17 12:16:09 UTC (rev 29191)
@@ -161,7 +161,7 @@
}
private static IndexedDeclarationAnnotationAdapter buildGenericGeneratorParameterAnnotationAdapter(DeclarationAnnotationAdapter genericGeneratorAdapter, int index) {
- return new NestedIndexedDeclarationAnnotationAdapter(genericGeneratorAdapter, Hibernate.GENERIC_GENERATOR__PARAMETERS, index, Hibernate.GENERATOR_PARAMETER);
+ return new NestedIndexedDeclarationAnnotationAdapter(genericGeneratorAdapter, Hibernate.GENERIC_GENERATOR__PARAMETERS, index, Hibernate.PARAMETER);
}
}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/TypeAnnotation.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/TypeAnnotation.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/TypeAnnotation.java 2011-02-17 12:16:09 UTC (rev 29191)
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * 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.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.resource.java.Annotation;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.jboss.tools.hibernate.jpt.core.internal.context.basic.Hibernate;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+public interface TypeAnnotation extends Annotation {
+ String ANNOTATION_NAME = Hibernate.TYPE;
+
+ /**
+ * Corresponds to the 'type' element of the TypeAnnotation annotation.
+ * Return null if the element does not exist in the annotation
+ */
+ String getType();
+ String TYPE_PROPERTY = Hibernate.TYPE__TYPE;
+
+ /**
+ * Corresponds to the 'type' element of the TypeAnnotation annotation.
+ * Setting to null will remove the element.
+ */
+ void setType(String value);
+
+ /**
+ * Return an empty iterator if the element does not exist in Java.
+ */
+ //ListIterator<ParameterAnnotation> parameters();
+ // String PARAMETERS_LIST = "parameters"; //$NON-NLS-1$
+
+
+ /**
+ * Return the {@link TextRange} for the 'type' element.
+ */
+ TextRange getTypeTextRange(CompilationUnit astRoot);
+}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/TypeAnnotationImpl.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/TypeAnnotationImpl.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/TypeAnnotationImpl.java 2011-02-17 12:16:09 UTC (rev 29191)
@@ -0,0 +1,133 @@
+/*******************************************************************************
+ * 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.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.resource.java.Annotation;
+import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.core.utility.jdt.Attribute;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.utility.jdt.Member;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+public class TypeAnnotationImpl extends SourceAnnotation<Attribute> implements
+TypeAnnotation {
+
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private static final DeclarationAnnotationElementAdapter<String> TYPE_ADAPTER = buildTypeAdapter(DECLARATION_ANNOTATION_ADAPTER);
+ private final AnnotationElementAdapter<String> typeAdapter;
+ private String type;
+
+ protected TypeAnnotationImpl(JavaResourceNode parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ this.typeAdapter = this.buildTypeAdapter(TYPE_ADAPTER);
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.type = this.buildType(astRoot);
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ this.syncType(this.buildType(astRoot));
+ }
+
+ // ***** type
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ if (this.attributeValueHasChanged(this.type, type)) {
+ this.type = type;
+ this.typeAdapter.setValue(type);
+ }
+ }
+
+ private void syncType(String type) {
+ String old = this.type;
+ this.type = type;
+ this.firePropertyChanged(TYPE_PROPERTY, old, type);
+ }
+
+ private String buildType(CompilationUnit astRoot) {
+ return this.typeAdapter.getValue(astRoot);
+ }
+
+ public TextRange getTypeTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(TYPE_ADAPTER, astRoot);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ AnnotationElementAdapter<String> buildTypeAdapter(DeclarationAnnotationElementAdapter<String> daea) {
+ return new ShortCircuitAnnotationElementAdapter<String>(this.member, daea);
+ }
+
+ private static DeclarationAnnotationElementAdapter<String> buildTypeAdapter(DeclarationAnnotationAdapter adapter) {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(adapter, TYPE_PROPERTY, true);
+ }
+
+ public static class TypeAnnotationDefinition implements AnnotationDefinition
+ {
+ // singleton
+ private static final TypeAnnotationDefinition INSTANCE = new TypeAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private TypeAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member attribute) {
+ return new TypeAnnotationImpl(parent, (Attribute) attribute);
+ }
+
+ public String getAnnotationName() {
+ return TypeAnnotation.ANNOTATION_NAME;
+ }
+
+ public Annotation buildAnnotation(JavaResourcePersistentMember arg0,
+ IAnnotation arg1) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ }
+
+
+}
13 years, 10 months
JBoss Tools SVN: r29190 - in trunk/forge/plugins/org.jboss.tools.seam.forge/src/org/jboss/tools/seam/forge: view and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2011-02-17 03:41:55 -0500 (Thu, 17 Feb 2011)
New Revision: 29190
Modified:
trunk/forge/plugins/org.jboss.tools.seam.forge/src/org/jboss/tools/seam/forge/console/ConsolePartitioner.java
trunk/forge/plugins/org.jboss.tools.seam.forge/src/org/jboss/tools/seam/forge/view/ConsoleViewer.java
Log:
fixed backspace glitch
Modified: trunk/forge/plugins/org.jboss.tools.seam.forge/src/org/jboss/tools/seam/forge/console/ConsolePartitioner.java
===================================================================
--- trunk/forge/plugins/org.jboss.tools.seam.forge/src/org/jboss/tools/seam/forge/console/ConsolePartitioner.java 2011-02-17 04:28:43 UTC (rev 29189)
+++ trunk/forge/plugins/org.jboss.tools.seam.forge/src/org/jboss/tools/seam/forge/console/ConsolePartitioner.java 2011-02-17 08:41:55 UTC (rev 29190)
@@ -62,7 +62,7 @@
@Override
public StyleRange[] getStyleRanges(int offset, int length) {
- System.out.println("getStyleRanges : [offset, " + offset + "] [length, " + length + "]");
+// System.out.println("getStyleRanges : [offset, " + offset + "] [length, " + length + "]");
return null;
}
Modified: trunk/forge/plugins/org.jboss.tools.seam.forge/src/org/jboss/tools/seam/forge/view/ConsoleViewer.java
===================================================================
--- trunk/forge/plugins/org.jboss.tools.seam.forge/src/org/jboss/tools/seam/forge/view/ConsoleViewer.java 2011-02-17 04:28:43 UTC (rev 29189)
+++ trunk/forge/plugins/org.jboss.tools.seam.forge/src/org/jboss/tools/seam/forge/view/ConsoleViewer.java 2011-02-17 08:41:55 UTC (rev 29190)
@@ -14,7 +14,7 @@
public class ConsoleViewer extends TextConsoleViewer {
- private static String BACKSPACE = new Character('b').toString();
+ private static String BACKSPACE = new Character('\b').toString();
private static String UP_ARROW = new Character((char)16).toString();
private static String DOWN_ARROW = new Character((char)14).toString();
13 years, 10 months