JBoss Tools SVN: r29384 - trunk/build/hudson-jobs.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2011-02-28 12:08:11 -0500 (Mon, 28 Feb 2011)
New Revision: 29384
Modified:
trunk/build/hudson-jobs/pom-checker.xml
Log:
add new fliter params to job checker; output now includes whether tests are enabled/disabled and can output default job params too
Modified: trunk/build/hudson-jobs/pom-checker.xml
===================================================================
--- trunk/build/hudson-jobs/pom-checker.xml 2011-02-28 16:41:48 UTC (rev 29383)
+++ trunk/build/hudson-jobs/pom-checker.xml 2011-02-28 17:08:11 UTC (rev 29384)
@@ -44,13 +44,20 @@
$ export JAVA_HOME=/opt/sun-java2-6.0/; mvn clean install
-->
<!-- more output w/ verbose; default false -->
- <verbose>true</verbose>
+ <verbose>false</verbose>
<!-- server and connection details -->
<!-- <hudsonURL>https://hudson.qa.jboss.com/hudson/</hudsonURL> -->
<hudsonURL>http://localhost:8080/</hudsonURL>
<username>SET USERNAME HERE</username>
<password>SET PASSWORD HERE</password>
+
+ <!-- to select a subset of jobs, use these filters; default none (all jobs on server!) -->
+ <viewFilter>view/DevStudio_Stable_Branch/</viewFilter>
+
+ <!-- default .* to select all -->
+ <regexFilter>.*</regexFilter>
+
</configuration>
</plugin>
</plugins>
13 years, 10 months
JBoss Tools SVN: r29383 - trunk/forge/plugins/org.jboss.tools.seam.forge/META-INF.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2011-02-28 11:41:48 -0500 (Mon, 28 Feb 2011)
New Revision: 29383
Modified:
trunk/forge/plugins/org.jboss.tools.seam.forge/META-INF/MANIFEST.MF
Log:
no version number on org.maven.ide.eclipse.maven_embedder
Modified: trunk/forge/plugins/org.jboss.tools.seam.forge/META-INF/MANIFEST.MF
===================================================================
--- trunk/forge/plugins/org.jboss.tools.seam.forge/META-INF/MANIFEST.MF 2011-02-28 13:44:54 UTC (rev 29382)
+++ trunk/forge/plugins/org.jboss.tools.seam.forge/META-INF/MANIFEST.MF 2011-02-28 16:41:48 UTC (rev 29383)
@@ -12,7 +12,7 @@
org.eclipse.ui.editors,
org.eclipse.ui.ide,
org.maven.ide.eclipse,
- org.maven.ide.eclipse.maven_embedder;bundle-version="0.12.1"
+ org.maven.ide.eclipse.maven_embedder
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Bundle-Activator: org.jboss.tools.seam.forge.Activator
13 years, 10 months
JBoss Tools SVN: r29382 - in workspace/snjeza/org.jboss.tools.maven.git.updatesite: features and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2011-02-28 08:44:54 -0500 (Mon, 28 Feb 2011)
New Revision: 29382
Added:
workspace/snjeza/org.jboss.tools.maven.git.updatesite/artifacts.jar
workspace/snjeza/org.jboss.tools.maven.git.updatesite/content.jar
workspace/snjeza/org.jboss.tools.maven.git.updatesite/features/
workspace/snjeza/org.jboss.tools.maven.git.updatesite/features/com.jcraft.jsch.feature_0.1.44.201102281229.jar
workspace/snjeza/org.jboss.tools.maven.git.updatesite/features/org.jboss.tools.maven.git.feature_1.0.0.201102281229.jar
workspace/snjeza/org.jboss.tools.maven.git.updatesite/plugins/
workspace/snjeza/org.jboss.tools.maven.git.updatesite/plugins/com.jcraft.jsch.source_0.1.44.v201101211721.jar
workspace/snjeza/org.jboss.tools.maven.git.updatesite/plugins/com.jcraft.jsch_0.1.44.v201101211721.jar
workspace/snjeza/org.jboss.tools.maven.git.updatesite/plugins/org.jboss.tools.maven.git_1.0.0.201102281229.jar
workspace/snjeza/org.jboss.tools.maven.git.updatesite/site.xml
Log:
Initial import.
Added: workspace/snjeza/org.jboss.tools.maven.git.updatesite/artifacts.jar
===================================================================
(Binary files differ)
Property changes on: workspace/snjeza/org.jboss.tools.maven.git.updatesite/artifacts.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/snjeza/org.jboss.tools.maven.git.updatesite/content.jar
===================================================================
(Binary files differ)
Property changes on: workspace/snjeza/org.jboss.tools.maven.git.updatesite/content.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/snjeza/org.jboss.tools.maven.git.updatesite/features/com.jcraft.jsch.feature_0.1.44.201102281229.jar
===================================================================
(Binary files differ)
Property changes on: workspace/snjeza/org.jboss.tools.maven.git.updatesite/features/com.jcraft.jsch.feature_0.1.44.201102281229.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/snjeza/org.jboss.tools.maven.git.updatesite/features/org.jboss.tools.maven.git.feature_1.0.0.201102281229.jar
===================================================================
(Binary files differ)
Property changes on: workspace/snjeza/org.jboss.tools.maven.git.updatesite/features/org.jboss.tools.maven.git.feature_1.0.0.201102281229.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/snjeza/org.jboss.tools.maven.git.updatesite/plugins/com.jcraft.jsch.source_0.1.44.v201101211721.jar
===================================================================
(Binary files differ)
Property changes on: workspace/snjeza/org.jboss.tools.maven.git.updatesite/plugins/com.jcraft.jsch.source_0.1.44.v201101211721.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/snjeza/org.jboss.tools.maven.git.updatesite/plugins/com.jcraft.jsch_0.1.44.v201101211721.jar
===================================================================
(Binary files differ)
Property changes on: workspace/snjeza/org.jboss.tools.maven.git.updatesite/plugins/com.jcraft.jsch_0.1.44.v201101211721.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/snjeza/org.jboss.tools.maven.git.updatesite/plugins/org.jboss.tools.maven.git_1.0.0.201102281229.jar
===================================================================
(Binary files differ)
Property changes on: workspace/snjeza/org.jboss.tools.maven.git.updatesite/plugins/org.jboss.tools.maven.git_1.0.0.201102281229.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/snjeza/org.jboss.tools.maven.git.updatesite/site.xml
===================================================================
--- workspace/snjeza/org.jboss.tools.maven.git.updatesite/site.xml (rev 0)
+++ workspace/snjeza/org.jboss.tools.maven.git.updatesite/site.xml 2011-02-28 13:44:54 UTC (rev 29382)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<site>
+ <feature url="features/org.jboss.tools.maven.git.feature_1.0.0.201102281229.jar" id="org.jboss.tools.maven.git.feature" version="1.0.0.201102281229">
+ <category name="org.jboss.tools.maven.git"/>
+ </feature>
+ <feature url="features/com.jcraft.jsch.feature_0.1.44.201102281229.jar" id="com.jcraft.jsch.feature" version="0.1.44.201102281229">
+ <category name="com.jcraft.jsch"/>
+ </feature>
+ <category-def name="org.jboss.tools.maven.git" label="JBoss Maven Git Integration"/>
+ <category-def name="com.jcraft.jsch" label="JSch"/>
+</site>
13 years, 10 months
JBoss Tools SVN: r29381 - workspace/snjeza.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2011-02-28 08:43:23 -0500 (Mon, 28 Feb 2011)
New Revision: 29381
Added:
workspace/snjeza/org.jboss.tools.maven.git.updatesite/
Log:
Initial import.
13 years, 10 months
JBoss Tools SVN: r29380 - 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-28 05:30:36 -0500 (Mon, 28 Feb 2011)
New Revision: 29380
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 , selection validation 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-28 09:02:34 UTC (rev 29379)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/CreateJSF2CompositeAction.java 2011-02-28 10:30:36 UTC (rev 29380)
@@ -14,6 +14,7 @@
import java.io.IOException;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -34,6 +35,7 @@
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.TextSelection;
import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.PlatformUI;
@@ -42,6 +44,8 @@
import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
import org.eclipse.wst.sse.ui.StructuredTextEditor;
+import org.eclipse.wst.xml.core.internal.document.NodeImpl;
+import org.eclipse.wst.xml.core.internal.document.TextImpl;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
import org.jboss.tools.common.model.XModelObjectConstants;
@@ -62,7 +66,7 @@
public class CreateJSF2CompositeAction extends Action {
private final String IMPLEMENTATION = "composite:implementation"; //$NON-NLS-1$
-
+
private JSPMultiPageEditor editor;
public CreateJSF2CompositeAction() {
@@ -77,82 +81,110 @@
* Get the selected text
*/
ISelection selection = editor.getSelectionProvider().getSelection();
- if (selection instanceof TextSelection) {
+ if ((selection instanceof TextSelection)
+ && (selection instanceof IStructuredSelection)) {
TextSelection textSelection = (TextSelection) selection;
- String text = textSelection.getText();
+ IStructuredSelection ss = (IStructuredSelection) selection;
final IProject project = editor.getProject();
/*
- * Get composite template creator
+ * Correct marked text if some tags were partially selected.
*/
- 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$
- 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;
+ int offset = 0;
+ int length = 0;
+ /*
+ * When there is only text node - use only selected text
+ */
+ if ((ss.size() == 1) && (ss.getFirstElement() instanceof TextImpl)) {
+ offset = textSelection.getOffset();
+ length = textSelection.getLength();
+ } else {
+ /*
+ * Otherwise selection will be expanded
+ * to the whole selected element with its children
+ */
+ Iterator it = ss.iterator();
+ boolean first = true;
+ while (it.hasNext()) {
+ Object ob = (Object) it.next();
+ if (ob instanceof NodeImpl) {
+ NodeImpl n = ((NodeImpl) ob);
+ if (first) {
+ offset = n.getStartOffset();
+ first = false;
}
- });
- if (dlg.open() == Window.OK) {
+ length += n.getEndOffset() - n.getStartOffset();
+ }
+ }
/*
- * Create all required files
+ * Get composite's name and namespace from the popup dialog
*/
- String componentName = dlg.getValue();
- String[] split = componentName.split(":", 2); //$NON-NLS-1$
- String path = ""; //$NON-NLS-1$
- path = componentName.replaceAll(":", "/") + ".xhtml"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- if (project != null) {
- try {
- IFile createdFile = JSF2ResourceUtil
- .createCompositeComponentFile(project, new Path(path));
+ 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$
+ 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$
/*
- * Add selected text to the template
+ * Check the correct format.
+ * Matcher will accept only word characters with optional numbers.
*/
- IModelManager manager = StructuredModelManager.getModelManager();
- if (manager != null) {
- IStructuredModel model = null;
- try {
+ 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$
+ path = componentName.replaceAll(":", "/") + ".xhtml"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ if (project != null) {
+ IStructuredModel model = null;
+ try {
+ IFile createdFile = JSF2ResourceUtil
+ .createCompositeComponentFile(project, new Path(path));
+ /*
+ * Add selected text to the template
+ */
+ IModelManager manager = StructuredModelManager.getModelManager();
+ if (manager != null) {
model = manager.getModelForEdit(createdFile);
if (model instanceof IDOMModel) {
IDOMModel domModel = (IDOMModel) model;
IDOMDocument document = domModel.getDocument();
NodeList list = document.getElementsByTagName(IMPLEMENTATION);
if (list.getLength() == 1) {
+ IDocument doc = editor.getDocumentProvider().getDocument(editor.getEditorInput());
+ String replacedText = doc.get(offset, length);
String content = document.getStructuredDocument().getText();
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$
+ content = content.subSequence(0, index) + "\n" + replacedText + content.subSequence(index, content.length()); //$NON-NLS-1$
domModel.reload(new ByteArrayInputStream(content.getBytes()));
model.save();
/*
* Register JSF 2 composite on the current page
*/
- IDocument doc = editor.getDocumentProvider().getDocument(editor.getEditorInput());
- int offset = textSelection.getOffset();
- int length = textSelection.getLength();
String replacement = "<" + componentName + "> </" + componentName + ">"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
doc.replace(offset, length, replacement);
/*
@@ -194,7 +226,7 @@
* Parse selected fragment to find used taglibs
*/
Pattern p = Pattern.compile("<([a-zA-Z]+\\d*)+:"); //$NON-NLS-1$
- Matcher m = p.matcher(text);
+ Matcher m = p.matcher(replacedText);
while (m.find()) {
if (sourceTaglibs.keySet().contains(m.group(1))
&& !requiredTaglibs.keySet().contains(m.group(1))) {
@@ -224,24 +256,22 @@
*/
FileEditorInput input = new FileEditorInput(createdFile);
JSPMultiPageEditor part = (JSPMultiPageEditor) PlatformUI
- .getWorkbench().getActiveWorkbenchWindow().getActivePage()
- .openEditor(input, "org.jboss.tools.jst.jsp.jspeditor.JSPTextEditor", true); //$NON-NLS-1$
+ .getWorkbench().getActiveWorkbenchWindow().getActivePage()
+ .openEditor(input, "org.jboss.tools.jst.jsp.jspeditor.JSPTextEditor", true); //$NON-NLS-1$
}
}
- } catch (CoreException e) {
- JSFModelPlugin.getPluginLog().logError(e);
- } catch (IOException e) {
- JSFModelPlugin.getPluginLog().logError(e);
- } catch (BadLocationException e) {
- JSFModelPlugin.getPluginLog().logError(e);
- } finally {
- if (model != null) {
- model.releaseFromEdit();
- }
}
+ } catch (CoreException e) {
+ JSFModelPlugin.getPluginLog().logError(e);
+ } catch (IOException e) {
+ JSFModelPlugin.getPluginLog().logError(e);
+ } catch (BadLocationException e) {
+ JSFModelPlugin.getPluginLog().logError(e);
+ } finally {
+ if (model != null) {
+ model.releaseFromEdit();
+ }
}
- } catch (CoreException e) {
- e.printStackTrace();
}
}
}
13 years, 10 months
JBoss Tools SVN: r29379 - 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-28 04:02:34 -0500 (Mon, 28 Feb 2011)
New Revision: 29379
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaTypeDefContainer.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaTypeDefContainerImpl.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JavaTypeDef.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JavaTypeDefImpl.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/TypeDefAnnotation.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/TypeDefAnnotationImpl.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/TypeDefsAnnotation.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/TypeDefsAnnotationImpl.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/HibernatePersistenceUnit.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/HibernateJavaEntity.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.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/context/java/HibernateJavaParameter.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/JpaUtil.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/jpa2/HibernateJpa2_0AnnotationDefinitionProvider.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/GenericGeneratorAnnotationImpl.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-8239
support @TypeDef and @TypeDefs
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-28 05:49:56 UTC (rev 29378)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateAbstractJpaFactory.java 2011-02-28 09:02:34 UTC (rev 29379)
@@ -1,6 +1,7 @@
package org.jboss.tools.hibernate.jpt.core.internal;
import org.eclipse.jpt.core.JpaProject;
+import org.eclipse.jpt.core.context.JpaContextNode;
import org.eclipse.jpt.core.context.java.JavaBaseColumn;
import org.eclipse.jpt.core.context.java.JavaBasicMapping;
import org.eclipse.jpt.core.context.java.JavaColumn;
@@ -37,6 +38,8 @@
import org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateJavaSecondaryTableImpl;
import org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateJavaTable;
import org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateJavaTableImpl;
+import org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateJavaTypeDefContainer;
+import org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateJavaTypeDefContainerImpl;
import org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateNamedNativeQueryImpl;
import org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateNamedQueryImpl;
import org.jboss.tools.hibernate.jpt.core.internal.context.java.IndexImpl;
@@ -47,6 +50,8 @@
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.JavaTypeDef;
+import org.jboss.tools.hibernate.jpt.core.internal.context.java.JavaTypeDefImpl;
import org.jboss.tools.hibernate.jpt.core.internal.context.java.TypeImpl;
public abstract class HibernateAbstractJpaFactory extends AbstractJpaFactory {
@@ -71,6 +76,10 @@
return new JavaGenericGeneratorImpl(parent);
}
+ public JavaTypeDef buildJavaTypeDef(JavaJpaContextNode parent) {
+ return new JavaTypeDefImpl(parent);
+ }
+
@Override
public JavaDiscriminatorColumn buildJavaDiscriminatorColumn(
JavaEntity parent,
@@ -86,8 +95,8 @@
return new HibernateNamedNativeQueryImpl(parent);
}
- public JavaParameter buildJavaParameter(JavaGenericGeneratorImpl javaGenericGeneratorImpl) {
- return new HibernateJavaParameter(javaGenericGeneratorImpl);
+ public JavaParameter buildJavaParameter(JpaContextNode parent) {
+ return new HibernateJavaParameter(parent);
}
public JavaDiscriminatorFormula buildJavaDiscriminatorFormula(
@@ -142,6 +151,10 @@
public JavaGeneratorContainer buildJavaGeneratorContainer(JavaJpaContextNode parent) {
return new HibernateJavaGeneratorContainerImpl(parent);
}
+
+ public HibernateJavaTypeDefContainer buildJavaTypeDefContainer(JavaJpaContextNode parent) {
+ return new HibernateJavaTypeDefContainerImpl(parent);
+ }
public JavaIndex buildIndex(JavaJpaContextNode parent) {
return new IndexImpl(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-28 05:49:56 UTC (rev 29378)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaAnnotationDefinitionProvider.java 2011-02-28 09:02:34 UTC (rev 29379)
@@ -26,6 +26,8 @@
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;
+import org.jboss.tools.hibernate.jpt.core.internal.resource.java.TypeDefAnnotationImpl.TypeDefAnnotationDefinition;
+import org.jboss.tools.hibernate.jpt.core.internal.resource.java.TypeDefsAnnotationImpl.TypeDefsAnnotationDefinition;
/**
* @author Dmitry Geraskov
@@ -54,6 +56,8 @@
protected void addTypeAnnotationDefinitionsTo(List<AnnotationDefinition> definitions) {
definitions.add(GenericGeneratorAnnotationDefinition.instance());
definitions.add(GenericGeneratorsAnnotationDefinition.instance());
+ definitions.add(TypeDefAnnotationDefinition.instance());
+ definitions.add(TypeDefsAnnotationDefinition.instance());
definitions.add(HibernateNamedQueryAnnotationDefinition.instance());
definitions.add(HibernateNamedQueriesAnnotationDefinition.instance());
definitions.add(HibernateNamedNativeQueryAnnotationDefinition.instance());
@@ -66,6 +70,8 @@
protected void addAttributeAnnotationDefinitionsTo(List<AnnotationDefinition> definitions) {
definitions.add(GenericGeneratorAnnotationDefinition.instance());
definitions.add(GeneratedAnnotationDefinition.instance());
+ definitions.add(TypeDefAnnotationDefinition.instance());
+ definitions.add(TypeDefsAnnotationDefinition.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/HibernatePersistenceUnit.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernatePersistenceUnit.java 2011-02-28 05:49:56 UTC (rev 29378)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernatePersistenceUnit.java 2011-02-28 09:02:34 UTC (rev 29379)
@@ -11,7 +11,12 @@
package org.jboss.tools.hibernate.jpt.core.internal.context;
import java.io.File;
+import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
+import java.util.ListIterator;
+import java.util.Set;
+import java.util.Vector;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IResource;
@@ -24,6 +29,7 @@
import org.eclipse.jpt.core.context.persistence.Persistence;
import org.eclipse.jpt.core.internal.context.persistence.AbstractPersistenceUnit;
import org.eclipse.jpt.core.resource.persistence.XmlPersistenceUnit;
+import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
import org.eclipse.wst.validation.internal.core.Message;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -31,6 +37,7 @@
import org.jboss.tools.hibernate.jpt.core.internal.context.basic.BasicHibernateProperties;
import org.jboss.tools.hibernate.jpt.core.internal.context.basic.Hibernate;
import org.jboss.tools.hibernate.jpt.core.internal.context.basic.HibernatePersistenceUnitProperties;
+import org.jboss.tools.hibernate.jpt.core.internal.context.java.JavaTypeDef;
import org.jboss.tools.hibernate.jpt.core.internal.context.persistence.HibernatePersistenceUnitPropertiesBuilder;
/**
@@ -40,7 +47,12 @@
public class HibernatePersistenceUnit extends AbstractPersistenceUnit
implements Messages, Hibernate {
+ public String TYPE_DEF_LIST = "typeDefs"; //$NON-NLS-1$
+
private HibernatePersistenceUnitProperties hibernateProperties;
+
+ /* global type def definitions, defined elsewhere in model */
+ protected final Vector<JavaTypeDef> typeDefs = new Vector<JavaTypeDef>();
/**
* @param parent
@@ -51,7 +63,19 @@
super(parent, persistenceUnit);
}
+ protected void addNonUpdateAspectNamesTo(Set<String> nonUpdateAspectNames) {
+ super.addNonUpdateAspectNamesTo(nonUpdateAspectNames);
+ nonUpdateAspectNames.add(TYPE_DEF_LIST);
+ }
+
@Override
+ public void update(XmlPersistenceUnit xpu) {
+ this.typeDefs.clear();
+ super.update(xpu);
+ this.fireListChanged(TYPE_DEF_LIST, this.typeDefs);
+ }
+
+ @Override
protected void initializeProperties() {
super.initializeProperties();
this.hibernateProperties = ((HibernatePersistenceUnitPropertiesBuilder)this.getContextNodeFactory())
@@ -74,7 +98,46 @@
public HibernatePersistenceUnitProperties getHibernatePersistenceUnitProperties() {
return this.hibernateProperties;
}
+
+ // ******** Type Def *********
+ public ListIterator<JavaTypeDef> typeDefs() {
+ return new CloneListIterator<JavaTypeDef>(this.typeDefs);
+ }
+
+ public int typeDefsSize() {
+ return this.typeDefs.size();
+ }
+
+ public void addTypeDef(JavaTypeDef typeDef) {
+ this.typeDefs.add(typeDef);
+ }
+
+ public String[] uniqueTypeDefNames() {
+ HashSet<String> names = new HashSet<String>(this.typeDefs.size());
+ this.addNonNullTypeDefNamesTo(names);
+ return names.toArray(new String[names.size()]);
+ }
+
+ public boolean hasTypeDef(String name) {
+ for (Iterator<JavaTypeDef> stream = this.typeDefs(); stream.hasNext(); ) {
+ String typeDefName = stream.next().getName();
+ if (name.equals(typeDefName)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ protected void addNonNullTypeDefNamesTo(Set<String> names) {
+ for (Iterator<JavaTypeDef> stream = this.typeDefs(); stream.hasNext(); ) {
+ String typeDefName = stream.next().getName();
+ if (typeDefName != null) {
+ names.add(typeDefName);
+ }
+ }
+ }
+
// ********** Validation ***********************************************
@Override
public void validate(List<IMessage> messages, IReporter reporter) {
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-28 05:49:56 UTC (rev 29378)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/Messages.java 2011-02-28 09:02:34 UTC (rev 29379)
@@ -35,5 +35,7 @@
String TYPE_CANT_BE_EMPTY = "TYPE_CANT_BE_EMPTY"; //$NON-NLS-1$
String USER_TYPE_INTERFACE = "USER_TYPE_INTERFACE"; //$NON-NLS-1$
+
+ String TYPE_CLASS_NOT_FOUND = "TYPE_CLASS_NOT_FOUND"; //$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-28 05:49:56 UTC (rev 29378)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/Messages.properties 2011-02-28 09:02:34 UTC (rev 29379)
@@ -7,4 +7,5 @@
UNRESOLVED_FOREIGN_KEY_NAME = Foreign key \"{0}\" not found in the table \"{1}\".
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
+USER_TYPE_INTERFACE = Type class \"{0}\" should implement interface \"org.hibernate.usertype.UserType\".
+TYPE_CLASS_NOT_FOUND = Type class \"{0}\" could not be found.
\ No newline at end of file
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-28 05:49:56 UTC (rev 29378)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/basic/Hibernate.java 2011-02-28 09:02:34 UTC (rev 29379)
@@ -108,4 +108,13 @@
String TYPE = PACKAGE_ + "Type"; //$NON-NLS-1$
String TYPE__TYPE = "type"; //$NON-NLS-1$
+
+ String TYPE_DEF = PACKAGE_ + "TypeDef"; //$NON-NLS-1$
+ String TYPE_DEF__NAME = "name"; //$NON-NLS-1$
+ String TYPE_DEF__DEF_FOR_TYPE = "defaultForType"; //$NON-NLS-1$
+ String TYPE_DEF__TYPE_CLASS = "typeClass"; //$NON-NLS-1$
+ String TYPE_DEF__PARAMETERS = "parameters"; //$NON-NLS-1$
+
+ String TYPE_DEFS = PACKAGE_ + "TypeDefs"; //$NON-NLS-1$
+ String TYPE_DEFS__VALUE = "value"; //$NON-NLS-1$
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaEntity.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaEntity.java 2011-02-28 05:49:56 UTC (rev 29378)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaEntity.java 2011-02-28 09:02:34 UTC (rev 29379)
@@ -22,6 +22,8 @@
HibernateEntity, ForeignKeyHolder{
HibernateJavaGeneratorContainer getGeneratorContainer();
+
+ HibernateJavaTypeDefContainer getTypeDefContainer();
JavaDiscriminatorFormula getDiscriminatorFormula();
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 2011-02-28 05:49:56 UTC (rev 29378)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaEntityImpl.java 2011-02-28 09:02:34 UTC (rev 29379)
@@ -28,6 +28,7 @@
import org.eclipse.jpt.core.jpa2.context.persistence.PersistenceUnit2_0;
import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.utility.Filter;
import org.eclipse.jpt.utility.internal.iterables.ArrayIterable;
import org.eclipse.jpt.utility.internal.iterables.CompositeIterable;
import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
@@ -52,6 +53,8 @@
public class HibernateJavaEntityImpl extends AbstractJavaEntity
implements HibernateJavaEntity {
+ protected final HibernateJavaTypeDefContainer typeDefContainer;
+
protected JavaDiscriminatorFormula discriminatorFormula;
protected JavaCacheable2_0 cachable;
@@ -60,6 +63,7 @@
public HibernateJavaEntityImpl(JavaPersistentType parent) {
super(parent);
+ this.typeDefContainer = getJpaFactory().buildJavaTypeDefContainer(parent);
this.cachable = buildJavaCachable();
}
@@ -70,6 +74,7 @@
@Override
public void initialize(JavaResourcePersistentType resourcePersistentType) {
super.initialize(resourcePersistentType);
+ this.typeDefContainer.initialize(resourcePersistentType);
this.initializeDiscriminatorFormula();
this.initializeForeignKey();
}
@@ -77,6 +82,7 @@
@Override
public void update(JavaResourcePersistentType resourcePersistentType) {
super.update(resourcePersistentType);
+ this.typeDefContainer.update(resourcePersistentType);
this.updateDiscriminatorFormula();
this.updateForeignKey();
}
@@ -90,15 +96,21 @@
return (HibernateJpaProject) super.getJpaProject();
}
+ public HibernateJavaTypeDefContainer getTypeDefContainer() {
+ return this.typeDefContainer;
+ }
+
protected static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY2 = new String[] {
Hibernate.GENERIC_GENERATOR,
- Hibernate.GENERIC_GENERATORS,
+ Hibernate.GENERIC_GENERATORS,
+ Hibernate.TYPE_DEF,
+ Hibernate.TYPE_DEFS,
Hibernate.NAMED_QUERY,
Hibernate.NAMED_QUERIES,
Hibernate.NAMED_NATIVE_QUERY,
Hibernate.NAMED_NATIVE_QUERIES,
Hibernate.DISCRIMINATOR_FORMULA,
- Hibernate.FOREIGN_KEY
+ Hibernate.FOREIGN_KEY,
};
protected static final Iterable<String> SUPPORTING_ANNOTATION_NAMES2 = new ArrayIterable<String>(SUPPORTING_ANNOTATION_NAMES_ARRAY2);
@@ -262,6 +274,7 @@
@Override
public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
super.validate(messages, reporter, astRoot);
+ getTypeDefContainer().validate(messages, reporter, astRoot);
this.validateForeignKey(messages, astRoot);
}
@@ -423,6 +436,23 @@
return ((PersistenceUnit2_0) getPersistenceUnit()).calculateDefaultCacheable();
}
+ /* (non-Javadoc)
+ * @see org.eclipse.jpt.core.internal.context.java.AbstractJavaEntity#javaCompletionProposals(int, org.eclipse.jpt.utility.Filter, org.eclipse.jdt.core.dom.CompilationUnit)
+ */
+ @Override
+ public Iterator<String> javaCompletionProposals(int pos,
+ Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ result = this.getTypeDefContainer().javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ return null;
+ }
+
}
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-28 05:49:56 UTC (rev 29378)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaIdMapping.java 2011-02-28 09:02:34 UTC (rev 29379)
@@ -23,5 +23,7 @@
public interface HibernateJavaIdMapping extends JavaIdMapping, IndexHolder, HibernateIdMapping, TypeHolder {
HibernateJavaGeneratorContainer getGeneratorContainer();
+
+ HibernateJavaTypeDefContainer getTypeDefContainer();
}
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-28 05:49:56 UTC (rev 29378)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaIdMappingImpl.java 2011-02-28 09:02:34 UTC (rev 29379)
@@ -10,12 +10,14 @@
******************************************************************************/
package org.jboss.tools.hibernate.jpt.core.internal.context.java;
+import java.util.Iterator;
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.jpt.utility.Filter;
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;
@@ -30,6 +32,8 @@
public class HibernateJavaIdMappingImpl extends AbstractJavaIdMapping
implements HibernateJavaIdMapping {
+ protected final HibernateJavaTypeDefContainer typeDefContainer;
+
protected JavaIndex index;
protected JavaType type;
@@ -39,6 +43,7 @@
*/
public HibernateJavaIdMappingImpl(JavaPersistentAttribute parent) {
super(parent);
+ this.typeDefContainer = getJpaFactory().buildJavaTypeDefContainer(parent);
}
@Override
@@ -61,6 +66,7 @@
@Override
protected void initialize() {
super.initialize();
+ this.typeDefContainer.initialize(this.getResourcePersistentAttribute());
this.initializeIndex();
this.initializeType();
}
@@ -68,6 +74,7 @@
@Override
public void update() {
super.update();
+ this.typeDefContainer.update(this.getResourcePersistentAttribute());
this.updateIndex();
this.updateType();
}
@@ -82,6 +89,10 @@
return this.getColumn().getDBColumnName();
}
+ public HibernateJavaTypeDefContainer getTypeDefContainer() {
+ return this.typeDefContainer;
+ }
+
// *** index
protected void initializeIndex() {
@@ -220,6 +231,7 @@
public void validate(List<IMessage> messages, IReporter reporter,
CompilationUnit astRoot) {
super.validate(messages, reporter, astRoot);
+ this.typeDefContainer.validate(messages, reporter, astRoot);
if (this.index != null){
this.index.validate(messages, reporter, astRoot);
}
@@ -227,5 +239,22 @@
this.type.validate(messages, reporter, astRoot);
}
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jpt.core.internal.context.java.AbstractJavaIdMapping#javaCompletionProposals(int, org.eclipse.jpt.utility.Filter, org.eclipse.jdt.core.dom.CompilationUnit)
+ */
+ @Override
+ public Iterator<String> javaCompletionProposals(int pos,
+ Filter<String> filter, CompilationUnit astRoot) {
+ Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ result = this.getTypeDefContainer().javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ return null;
+ }
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaParameter.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaParameter.java 2011-02-28 05:49:56 UTC (rev 29378)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaParameter.java 2011-02-28 09:02:34 UTC (rev 29379)
@@ -11,6 +11,7 @@
package org.jboss.tools.hibernate.jpt.core.internal.context.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.context.JpaContextNode;
import org.eclipse.jpt.core.internal.context.java.AbstractJavaJpaContextNode;
import org.eclipse.jpt.core.utility.TextRange;
import org.jboss.tools.hibernate.jpt.core.internal.context.Parameter;
@@ -28,7 +29,7 @@
protected ParameterAnnotation resourceParameter;
- public HibernateJavaParameter(JavaGenericGenerator parent) {
+ public HibernateJavaParameter(JpaContextNode parent) {
super(parent);
}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaTypeDefContainer.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaTypeDefContainer.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaTypeDefContainer.java 2011-02-28 09:02:34 UTC (rev 29379)
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * 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 java.util.ListIterator;
+
+import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+public interface HibernateJavaTypeDefContainer extends JavaJpaContextNode {
+
+ //******************** typeDef *****************
+
+ String TYPE_DEFS_LIST = "typeDefs"; //$NON-NLS-1$
+
+ /**
+ * Return a list iterator of the typeDefs.
+ * This will not be null.
+ */
+ ListIterator<? extends JavaTypeDef> typeDefs();
+
+ /**
+ * Return the number of typeDefs.
+ */
+ int typeDefsSize();
+
+ /**
+ * Add a typeDef to the entity return the object representing it.
+ */
+ JavaTypeDef addTypeDef(int index);
+
+ /**
+ * Remove the typeDef at the index from the entity.
+ */
+ void removeTypeDef(int index);
+
+ /**
+ * Remove the typeDef from the entity.
+ */
+ void removeTypeDef(JavaTypeDef typeDef);
+
+ /**
+ * Move the typeDef from the source index to the target index.
+ */
+ void moveTypeDef(int targetIndex, int sourceIndex);
+
+ void initialize(JavaResourcePersistentMember jrpm);
+
+ /**
+ * Update the JavaGeneratorContainer context model object to match the JavaResourcePersistentMember
+ * resource model object. see {@link org.eclipse.jpt.core.JpaProject#update()}
+ */
+ void update(JavaResourcePersistentMember jrpm);
+
+}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaTypeDefContainerImpl.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaTypeDefContainerImpl.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaTypeDefContainerImpl.java 2011-02-28 09:02:34 UTC (rev 29379)
@@ -0,0 +1,188 @@
+/*******************************************************************************
+ * 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 java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+
+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.resource.java.JavaResourcePersistentMember;
+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.CloneListIterator;
+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.resource.java.TypeDefAnnotation;
+import org.jboss.tools.hibernate.jpt.core.internal.resource.java.TypeDefsAnnotation;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+public class HibernateJavaTypeDefContainerImpl extends
+ AbstractJavaJpaContextNode implements HibernateJavaTypeDefContainer {
+
+ protected JavaResourcePersistentMember javaResourcePersistentMember;
+
+ protected final List<JavaTypeDef> typeDefs;
+
+ public HibernateJavaTypeDefContainerImpl(JavaJpaContextNode parent) {
+ super(parent);
+ this.typeDefs = new ArrayList<JavaTypeDef>();
+ }
+
+ public HibernateAbstractJpaFactory getJpaFactory(){
+ return (HibernateAbstractJpaFactory)super.getJpaFactory();
+ }
+
+ public void initialize(JavaResourcePersistentMember jrpm) {
+ this.javaResourcePersistentMember = jrpm;
+ this.initializeTypeDefs();
+ }
+
+ public void update(JavaResourcePersistentMember jrpm) {
+ this.javaResourcePersistentMember = jrpm;
+ this.updateTypeDefs();
+ }
+
+ public JavaTypeDef addTypeDef(int index) {
+ JavaTypeDef newTypeDef = getJpaFactory().buildJavaTypeDef(this);
+ this.typeDefs.add(index, newTypeDef);
+ TypeDefAnnotation typeDefAnnotation = (TypeDefAnnotation)this.javaResourcePersistentMember
+ .addAnnotation(index, TypeDefAnnotation.ANNOTATION_NAME, TypeDefsAnnotation.ANNOTATION_NAME);
+ newTypeDef.initialize(typeDefAnnotation);
+ fireItemAdded(TYPE_DEFS_LIST, index, newTypeDef);
+ return newTypeDef;
+ }
+
+ protected void addTypeDef(JavaTypeDef typeDef) {
+ this.addTypeDef(typeDefsSize(), typeDef);
+ }
+
+ protected void addTypeDef(int index, JavaTypeDef typeDef) {
+ addItemToList(index, typeDef, this.typeDefs, TYPE_DEFS_LIST);
+ }
+
+ public ListIterator<JavaTypeDef> typeDefs() {
+ return new CloneListIterator<JavaTypeDef>(typeDefs);
+ }
+
+ public int typeDefsSize() {
+ return this.typeDefs.size();
+ }
+
+ public void moveTypeDef(int targetIndex, int sourceIndex) {
+ CollectionTools.move(this.typeDefs, targetIndex, sourceIndex);
+ this.javaResourcePersistentMember.moveAnnotation(targetIndex, sourceIndex, TypeDefsAnnotation.ANNOTATION_NAME);
+ fireItemMoved(TYPE_DEFS_LIST, targetIndex, sourceIndex);
+ }
+
+ public void removeTypeDef(int index) {
+ JavaTypeDef removedTypeDef = this.typeDefs.remove(index);
+ this.javaResourcePersistentMember.removeAnnotation(index, TypeDefAnnotation.ANNOTATION_NAME, TypeDefsAnnotation.ANNOTATION_NAME);
+ fireItemRemoved(TYPE_DEFS_LIST, index, removedTypeDef);
+ }
+
+ public void removeTypeDef(JavaTypeDef typeDef) {
+ removeTypeDef(this.typeDefs.indexOf(typeDef));
+ }
+
+ protected void removeTypeDef_(JavaTypeDef typeDef) {
+ removeItemFromList(typeDef, this.typeDefs, TYPE_DEFS_LIST);
+ }
+
+ protected void initializeTypeDefs() {
+ for (Iterator<NestableAnnotation> stream = this.javaResourcePersistentMember.annotations(
+ TypeDefAnnotation.ANNOTATION_NAME,
+ TypeDefsAnnotation.ANNOTATION_NAME);
+ stream.hasNext(); ) {
+ this.typeDefs.add(buildTypeDef((TypeDefAnnotation) stream.next()));
+ }
+ }
+
+ protected JavaTypeDef buildTypeDef(TypeDefAnnotation typeDefResource) {
+ JavaTypeDef typeDef = getJpaFactory().buildJavaTypeDef(this);
+ typeDef.initialize(typeDefResource);
+ return typeDef;
+ }
+
+ protected void addTypeDefsTo(ArrayList<JavaTypeDef> typeDefs) {
+ for (JavaTypeDef typeDef : typeDefs) {
+ typeDefs.add(typeDef);
+ }
+ }
+
+ protected void updateTypeDefs() {
+ ListIterator<JavaTypeDef> typeDefs = typeDefs();
+ Iterator<NestableAnnotation> resourceTypeDefs =
+ this.javaResourcePersistentMember.annotations(
+ TypeDefAnnotation.ANNOTATION_NAME,
+ TypeDefsAnnotation.ANNOTATION_NAME);
+
+ while (typeDefs.hasNext()) {
+ JavaTypeDef typeDef = typeDefs.next();
+ if (resourceTypeDefs.hasNext()) {
+ typeDef.update((TypeDefAnnotation) resourceTypeDefs.next());
+ }
+ else {
+ removeTypeDef_(typeDef);
+ }
+ }
+
+ while (resourceTypeDefs.hasNext()) {
+ addTypeDef(buildTypeDef((TypeDefAnnotation) resourceTypeDefs.next()));
+ }
+ }
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter,
+ CompilationUnit astRoot) {
+ super.validate(messages, reporter, astRoot);
+ this.validateTypeDefs(messages, reporter, astRoot);
+ }
+
+
+ protected void validateTypeDefs(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ ListIterator<JavaTypeDef> typeDefs = typeDefs();
+ while (typeDefs.hasNext()) {
+ typeDefs.next().validate(messages, reporter, astRoot);
+ }
+ }
+
+ @Override
+ public Iterator<String> javaCompletionProposals(int pos, Filter<String> filter,
+ CompilationUnit astRoot) {
+ Iterator<String> result = super.javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ ListIterator<JavaTypeDef> typeDefs = typeDefs();
+ while (typeDefs.hasNext()) {
+ result = typeDefs.next()
+ .javaCompletionProposals(pos, filter, astRoot);
+ if (result != null) {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return this.javaResourcePersistentMember.getTextRange(astRoot);
+ }
+}
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-28 05:49:56 UTC (rev 29378)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JavaType.java 2011-02-28 09:02:34 UTC (rev 29379)
@@ -10,7 +10,9 @@
******************************************************************************/
package org.jboss.tools.hibernate.jpt.core.internal.context.java;
+import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.core.utility.TextRange;
import org.jboss.tools.hibernate.jpt.core.internal.resource.java.TypeAnnotation;
/**
@@ -26,5 +28,7 @@
public void initialize(TypeAnnotation typeResource);
public void update(TypeAnnotation typeResource);
+
+ public TextRange getTypeTextRange(CompilationUnit astRoot);
}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JavaTypeDef.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JavaTypeDef.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JavaTypeDef.java 2011-02-28 09:02:34 UTC (rev 29379)
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * 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 java.util.ListIterator;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.jboss.tools.hibernate.jpt.core.internal.context.Parameter;
+import org.jboss.tools.hibernate.jpt.core.internal.resource.java.TypeDefAnnotation;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+public interface JavaTypeDef extends JavaJpaContextNode {
+
+ String getName();
+ void setName(String name);
+ String TYPE_DEF_NAME = "name"; //$NON-NLS-1$
+
+ // **************** defaultForType class **************************************
+
+ String getDefaultForType();
+
+ String getSpecifiedDefaultForType();
+ void setSpecifiedDefaultForType(String value);
+ String SPECIFIED_DEF_FOR_TYPE_PROPERTY = "specifiedDefaultForTypeClass"; //$NON-NLS-1$
+
+ String getDefaultDefaultForType();
+ String DEFAULT_DEF_FOR_TYPE_PROPERTY = "defaultDefaultForTypeClass"; //$NON-NLS-1$
+
+ /**
+ * If the DefaultForType class is specified, this will return it fully qualified. If not
+ * specified, it returns the default for type class, which is always fully qualified
+ */
+ String getFullyQualifiedDefaultForType();
+ String FULLY_QUALIFIED_DEF_FOR_TYPE_PROPERTY = "fullyQualifiedDefaultForTypeClass"; //$NON-NLS-1$
+
+
+ // **************** type class **************************************
+
+ String getTypeClass();
+
+ String getSpecifiedTypeClass();
+ void setSpecifiedTypeClass(String value);
+ String SPECIFIED_TYPE_CLASS_PROPERTY = "specifiedTypeClass"; //$NON-NLS-1$
+
+ String getDefaultTypeClass();
+ String DEFAULT_TYPE_CLASS_PROPERTY = "defaultTypeClass"; //$NON-NLS-1$
+
+ /**
+ * If the type class is specified, this will return it fully qualified. If not
+ * specified, it returns the default type class, which is always fully qualified
+ */
+ String getFullyQualifiedTypeClass();
+ String FULLY_QUALIFIED_TYPE_CLASS_PROPERTY = "fullyQualifiedTypeClass"; //$NON-NLS-1$
+
+ //************************ parameters ***********************
+
+ String PARAMETERS_LIST = "parameters"; //$NON-NLS-1$
+
+ /**
+ * Return a list iterator of the parameters. This will not be null.
+ */
+ <T extends Parameter> ListIterator<T> parameters();
+
+ /**
+ * Return the number of parameters.
+ */
+ int parametersSize();
+
+ /**
+ * Add a parameter to the generator and return the object representing it.
+ */
+ Parameter addParameter(int index);
+
+ /**
+ * Remove the parameter from the generator.
+ */
+ void removeParameter(int index);
+
+ /**
+ * Remove the parameter at the index from the query.
+ */
+ void removeParameter(Parameter queryParameter);
+
+ /**
+ * Move the parameter from the source index to the target index.
+ */
+ void moveParameter(int targetIndex, int sourceIndex);
+
+ // **************** validation *********************************************
+
+ TextRange getNameTextRange(CompilationUnit astRoot);
+
+ void initialize(TypeDefAnnotation generator);
+
+ void update(TypeDefAnnotation generator);
+
+}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JavaTypeDefImpl.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JavaTypeDefImpl.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JavaTypeDefImpl.java 2011-02-28 09:02:34 UTC (rev 29379)
@@ -0,0 +1,387 @@
+/*******************************************************************************
+ * 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 java.util.ArrayList;
+import java.util.List;
+import java.util.ListIterator;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.context.Embeddable;
+import org.eclipse.jpt.core.context.Entity;
+import org.eclipse.jpt.core.context.PersistentType;
+import org.eclipse.jpt.core.context.TypeMapping;
+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.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.jboss.tools.hibernate.jpt.core.internal.HibernateAbstractJpaFactory;
+import org.jboss.tools.hibernate.jpt.core.internal.context.HibernatePersistenceUnit;
+import org.jboss.tools.hibernate.jpt.core.internal.context.HibernatePersistenceUnit.LocalMessage;
+import org.jboss.tools.hibernate.jpt.core.internal.context.Parameter;
+import org.jboss.tools.hibernate.jpt.core.internal.resource.java.ParameterAnnotation;
+import org.jboss.tools.hibernate.jpt.core.internal.resource.java.TypeDefAnnotation;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+public class JavaTypeDefImpl extends AbstractJavaJpaContextNode implements JavaTypeDef {
+
+ protected TypeDefAnnotation typeDefAnnotation;
+
+ protected String name;
+
+ protected String specifiedTypeClass;
+ protected String defaultTypeClass;
+ protected String fullyQualifiedTypeClass;
+ protected PersistentType resolvedTypeType;
+
+ protected String specifiedDefaultForType;
+ protected String defaultDefaultForType;
+ protected String fullyQualifiedDefaultForType;
+ protected PersistentType resolvedTargetType;
+
+ protected final List<JavaParameter> parameters;
+
+
+ public JavaTypeDefImpl(JavaJpaContextNode parent) {
+ super(parent);
+ this.parameters = new ArrayList<JavaParameter>();
+ }
+
+ public HibernatePersistenceUnit getPersistenceUnit() {
+ return (HibernatePersistenceUnit)this.getParent().getPersistenceUnit();
+ }
+
+ public void initialize(TypeDefAnnotation typeDefAnnotation) {
+ this.typeDefAnnotation = typeDefAnnotation;
+
+ this.name = typeDefAnnotation.getName();
+
+ this.defaultTypeClass = this.buildDefaultTypeClass();
+ this.specifiedTypeClass = this.getResourceTypeClass();
+ this.fullyQualifiedTypeClass = this.buildFullyQualifiedTypeClass();
+ this.resolvedTypeType = this.buildResolvedTypeType();
+
+ this.defaultDefaultForType = this.buildDefaultDefaultForType();
+ this.specifiedDefaultForType = this.getResourceDefaultForType();
+ this.fullyQualifiedDefaultForType = this.buildFullyQualifiedDefaultForType();
+ this.resolvedTargetType = this.buildResolvedTargetType();
+
+ this.initializeParameters();
+ }
+
+ public void update(TypeDefAnnotation typeDefAnnotation) {
+ this.typeDefAnnotation = typeDefAnnotation;
+
+ this.setName_(typeDefAnnotation.getName());
+
+ this.setDefaultTypeClass(this.buildDefaultTypeClass());
+ this.setSpecifiedTypeClass_(this.getResourceTypeClass());
+ this.setFullyQualifiedTypeClass(this.buildFullyQualifiedTypeClass());
+ this.resolvedTypeType = this.buildResolvedTypeType();
+
+ this.setDefaultDefaultForType(this.buildDefaultDefaultForType());
+ this.setSpecifiedDefaultForType_(this.getResourceDefaultForType());
+ this.setFullyQualifiedDefaultForType(this.buildFullyQualifiedDefaultForType());
+ this.resolvedTargetType = this.buildResolvedTargetType();
+
+ this.updateParameters();
+
+ this.getPersistenceUnit().addTypeDef(this);
+ }
+
+ protected IMessage creatErrorMessage(String strmessage, String[] params, int lineNum){
+ IMessage message = new LocalMessage(IMessage.HIGH_SEVERITY,
+ strmessage, params, getResource());
+ message.setLineNo(lineNum);
+ return message;
+ }
+
+ @Override
+ protected HibernateAbstractJpaFactory getJpaFactory() {
+ return (HibernateAbstractJpaFactory) super.getJpaFactory();
+ }
+
+ // ********** name **********
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ String old = this.name;
+ this.name = name;
+ this.typeDefAnnotation.setName(name);
+ this.firePropertyChanged(TYPE_DEF_NAME, old, name);
+ }
+
+ protected void setName_(String name) {
+ String old = this.name;
+ this.name = name;
+ this.firePropertyChanged(TYPE_DEF_NAME, old, name);
+ }
+
+
+ // ********** type class **********
+
+ public String getTypeClass() {
+ return (this.specifiedTypeClass != null) ? this.specifiedTypeClass : this.defaultTypeClass;
+ }
+
+ public String getSpecifiedTypeClass() {
+ return this.specifiedTypeClass;
+ }
+
+ public void setSpecifiedTypeClass(String typeClass) {
+ String old = this.specifiedTypeClass;
+ this.specifiedTypeClass = typeClass;
+ this.typeDefAnnotation.setTypeClass(typeClass);
+ this.firePropertyChanged(SPECIFIED_TYPE_CLASS_PROPERTY, old, typeClass);
+ }
+
+ protected void setSpecifiedTypeClass_(String typeClass) {
+ String old = this.specifiedTypeClass;
+ this.specifiedTypeClass = typeClass;
+ this.firePropertyChanged(SPECIFIED_TYPE_CLASS_PROPERTY, old, typeClass);
+ }
+
+ protected String getResourceTypeClass() {
+ return this.typeDefAnnotation.getTypeClass();
+ }
+
+ public String getDefaultTypeClass() {
+ return this.defaultTypeClass;
+ }
+
+ protected void setDefaultTypeClass(String typeClass) {
+ String old = this.defaultTypeClass;
+ this.defaultTypeClass = typeClass;
+ this.firePropertyChanged(DEFAULT_TYPE_CLASS_PROPERTY, old, typeClass);
+ }
+
+ protected String buildDefaultTypeClass() {
+ return null;
+ }
+
+ public String getFullyQualifiedTypeClass() {
+ return this.fullyQualifiedTypeClass;
+ }
+
+ protected void setFullyQualifiedTypeClass(String typeClass) {
+ String old = this.fullyQualifiedTypeClass;
+ this.fullyQualifiedTypeClass = typeClass;
+ this.firePropertyChanged(FULLY_QUALIFIED_TYPE_CLASS_PROPERTY, old, typeClass);
+ }
+
+ protected String buildFullyQualifiedTypeClass() {
+ return (this.specifiedTypeClass == null) ?
+ this.defaultTypeClass :
+ this.typeDefAnnotation.getFullyQualifiedTypeClassName();
+ }
+
+ public PersistentType getResolvedTypeType() {
+ return this.resolvedTypeType;
+ }
+
+ protected PersistentType buildResolvedTypeType() {
+ return (this.fullyQualifiedTypeClass == null) ? null : this.getPersistenceUnit().getPersistentType(this.fullyQualifiedTypeClass);
+ }
+
+ public char getTypeClassEnclosingTypeSeparator() {
+ return '.';
+ }
+
+
+ // ********** target class **********
+
+ public String getDefaultForType() {
+ return (this.specifiedDefaultForType != null) ? this.specifiedDefaultForType : this.defaultDefaultForType;
+ }
+
+ public String getSpecifiedDefaultForType() {
+ return this.specifiedDefaultForType;
+ }
+
+ public void setSpecifiedDefaultForType(String defaultForType) {
+ String old = this.specifiedDefaultForType;
+ this.specifiedDefaultForType = defaultForType;
+ this.typeDefAnnotation.setDefaultForType(defaultForType);
+ this.firePropertyChanged(SPECIFIED_DEF_FOR_TYPE_PROPERTY, old, defaultForType);
+ }
+
+ protected void setSpecifiedDefaultForType_(String defaultForType) {
+ String old = this.specifiedDefaultForType;
+ this.specifiedDefaultForType = defaultForType;
+ this.firePropertyChanged(SPECIFIED_DEF_FOR_TYPE_PROPERTY, old, defaultForType);
+ }
+
+ protected String getResourceDefaultForType() {
+ return this.typeDefAnnotation.getDefaultForType();
+ }
+
+ public String getDefaultDefaultForType() {
+ return this.defaultDefaultForType;
+ }
+
+ protected void setDefaultDefaultForType(String defaultForType) {
+ String old = this.defaultDefaultForType;
+ this.defaultDefaultForType = defaultForType;
+ this.firePropertyChanged(DEFAULT_DEF_FOR_TYPE_PROPERTY, old, defaultForType);
+ }
+
+ protected String buildDefaultDefaultForType() {
+ return void.class.getName();
+ }
+
+ public String getFullyQualifiedDefaultForType() {
+ return this.fullyQualifiedDefaultForType;
+ }
+
+ protected void setFullyQualifiedDefaultForType(String defaultForType) {
+ String old = this.fullyQualifiedDefaultForType;
+ this.fullyQualifiedDefaultForType = defaultForType;
+ this.firePropertyChanged(FULLY_QUALIFIED_DEF_FOR_TYPE_PROPERTY, old, defaultForType);
+ }
+
+ protected String buildFullyQualifiedDefaultForType() {
+ return (this.specifiedDefaultForType == null) ?
+ this.defaultDefaultForType :
+ this.typeDefAnnotation.getFullyQualifiedDefaultForTypeClassName();
+ }
+
+
+ public PersistentType getResolvedTargetType() {
+ return this.resolvedTargetType;
+ }
+
+ protected PersistentType buildResolvedTargetType() {
+ return (this.fullyQualifiedDefaultForType == null) ? null : this.getPersistenceUnit().getPersistentType(this.fullyQualifiedDefaultForType);
+ }
+
+ protected Embeddable buildResolvedTargetEmbeddable() {
+ if (this.resolvedTargetType == null) {
+ return null;
+ }
+ TypeMapping typeMapping = this.resolvedTargetType.getMapping();
+ return (typeMapping instanceof Embeddable) ? (Embeddable) typeMapping : null;
+ }
+
+ protected Entity buildResolvedTargetEntity() {
+ if (this.resolvedTargetType == null) {
+ return null;
+ }
+ TypeMapping typeMapping = this.resolvedTargetType.getMapping();
+ return (typeMapping instanceof Entity) ? (Entity) typeMapping : null;
+ }
+
+
+ public char getDefaultForTypeEnclosingTypeSeparator() {
+ return '.';
+ }
+
+ //************************ parameters ***********************
+
+ public JavaParameter addParameter(int index) {
+ JavaParameter parameter = getJpaFactory().buildJavaParameter(this);
+ this.parameters.add(index, parameter);
+ this.typeDefAnnotation.addParameter(index);
+ this.fireItemAdded(JavaTypeDef.PARAMETERS_LIST, index, parameter);
+ return parameter;
+ }
+
+ protected void addParameter(int index, JavaParameter parameter) {
+ addItemToList(index, parameter, this.parameters, JavaTypeDef.PARAMETERS_LIST);
+ }
+
+ protected void addParameter(JavaParameter parameter) {
+ addParameter(this.parameters.size(), parameter);
+ }
+
+ public void removeParameter(Parameter parameter) {
+ removeParameter(this.parameters.indexOf(parameter));
+ }
+
+ public void removeParameter(int index) {
+ JavaParameter removedParameter = this.parameters.remove(index);
+ this.typeDefAnnotation.removeParameter(index);
+ fireItemRemoved(JavaTypeDef.PARAMETERS_LIST, index, removedParameter);
+ }
+
+ protected void removeParameter_(JavaParameter parameter) {
+ removeItemFromList(parameter, this.parameters, JavaTypeDef.PARAMETERS_LIST);
+ }
+
+ public void moveParameter(int targetIndex, int sourceIndex) {
+ CollectionTools.move(this.parameters, targetIndex, sourceIndex);
+ this.typeDefAnnotation.moveParameter(targetIndex, sourceIndex);
+ fireItemMoved(JavaTypeDef.PARAMETERS_LIST, targetIndex, sourceIndex);
+ }
+
+ public ListIterator<JavaParameter> parameters() {
+ return new CloneListIterator<JavaParameter>(this.parameters);
+ }
+
+ public int parametersSize() {
+ return parameters.size();
+ }
+
+ protected void initializeParameters() {
+ ListIterator<ParameterAnnotation> resourceParameters = this.typeDefAnnotation.parameters();
+
+ while(resourceParameters.hasNext()) {
+ this.parameters.add(createParameter(resourceParameters.next()));
+ }
+ }
+
+ protected void updateParameters() {
+ ListIterator<JavaParameter> contextParameters = parameters();
+ ListIterator<ParameterAnnotation> resourceParameters = this.typeDefAnnotation.parameters();
+
+ while (contextParameters.hasNext()) {
+ JavaParameter parameter = contextParameters.next();
+ if (resourceParameters.hasNext()) {
+ parameter.update(resourceParameters.next());
+ }
+ else {
+ removeParameter_(parameter);
+ }
+ }
+
+ while (resourceParameters.hasNext()) {
+ addParameter(createParameter(resourceParameters.next()));
+ }
+ }
+
+ protected JavaParameter createParameter(ParameterAnnotation resourceParameter) {
+ JavaParameter parameter = getJpaFactory().buildJavaParameter(this);
+ parameter.initialize(resourceParameter);
+ return parameter;
+ }
+
+ // ********** text ranges **********
+
+ public TextRange getValidationTextRange(CompilationUnit astRoot) {
+ return this.getSelectionTextRange(astRoot);
+ }
+
+ public TextRange getSelectionTextRange(CompilationUnit astRoot) {
+ return this.typeDefAnnotation.getTextRange(astRoot);
+ }
+
+ public TextRange getNameTextRange(CompilationUnit astRoot) {
+ return this.typeDefAnnotation.getNameTextRange(astRoot);
+ }
+
+}
Modified: 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 2011-02-28 05:49:56 UTC (rev 29378)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/JpaUtil.java 2011-02-28 09:02:34 UTC (rev 29379)
@@ -32,16 +32,28 @@
if (type == null) return false;
String[] interfaces = type.getSuperInterfaceNames();
for (String interface_ : interfaces) {
- if (interfaceName.equals(interface_))
- return true;
+ String[][] resolvedInterfaces = type.resolveType(interface_);
+ if (resolvedInterfaces != null){
+ for (String[] parts : resolvedInterfaces) {
+ String fullName = parts[0].length() > 0 ? parts[0] + '.' + parts[1] : parts[1];
+ if (interfaceName.equals(fullName))
+ return true;
+ }
+ }
}
if (type.getSuperclassName() != null){
- IType parentType = javaProject.findType(type.getSuperclassName());
- if (parentType != null){
- if (isTypeImplementsInterface(javaProject, parentType, interfaceName)){
+ String[][] resolvedSuperClass = type.resolveType(type.getSuperclassName());
+ if (resolvedSuperClass != null){
+ String fullName = resolvedSuperClass[0][0].length() > 0 ? resolvedSuperClass[0][0] + '.' + resolvedSuperClass[0][1] : resolvedSuperClass[0][1];
+ if (interfaceName.equals(fullName))
return true;
+ IType parentType = javaProject.findType(fullName);
+ if (parentType != null){
+ if (isTypeImplementsInterface(javaProject, parentType, interfaceName)){
+ return true;
+ }
}
- }
+ }
}
for (String interface_ : interfaces) {
IType parentInterface = javaProject.findType(interface_);
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-28 05:49:56 UTC (rev 29378)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/TypeImpl.java 2011-02-28 09:02:34 UTC (rev 29379)
@@ -12,12 +12,15 @@
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.HibernatePersistenceUnit;
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;
@@ -79,6 +82,14 @@
super.validate(messages, reporter, astRoot);
validateType(messages, reporter, astRoot);
}
+
+ public HibernatePersistenceUnit getPersistenceUnit() {
+ return (HibernatePersistenceUnit) this.getParent().getPersistenceUnit();
+ }
+
+ public TextRange getTypeTextRange(CompilationUnit astRoot) {
+ return this.typeResource.getTypeTextRange(astRoot);
+ }
/**
* @param messages
@@ -87,33 +98,35 @@
*/
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();
+ //TODO implement TypeDefs package-level support
+ if (type != null) {
+ TextRange range = getTypeTextRange(astRoot) == null ? TextRange.Empty.instance() : getTypeTextRange(astRoot);
if (type.trim().length() == 0) {
- messages.add(creatErrorMessage(TYPE_CANT_BE_EMPTY, new String[]{}, lineNum));
- } else if (!persistentUnit.hasTypeDef(contains(type))) {
+ messages.add(creatErrorMessage(TYPE_CANT_BE_EMPTY, new String[]{}, range));
+ } else if (!getPersistenceUnit().hasTypeDef(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));
+ messages.add(creatErrorMessage(TYPE_CLASS_NOT_FOUND, new String[]{type}, range));
} else {
if (!JpaUtil.isTypeImplementsInterface(getJpaProject().getJavaProject(), lwType, "org.hibernate.usertype.UserType")){//$NON-NLS-1$
- messages.add(creatErrorMessage(USER_TYPE_INTERFACE, new String[]{type}, lineNum));
+ messages.add(creatErrorMessage(USER_TYPE_INTERFACE, new String[]{type}, range));
}
}
} catch (JavaModelException e) {
// just ignore it!
}
}
- }*/
+ }
}
- protected IMessage creatErrorMessage(String strmessage, String[] params, int lineNum){
+ protected IMessage creatErrorMessage(String strmessage, String[] params, TextRange range){
IMessage message = new LocalMessage(IMessage.HIGH_SEVERITY,
strmessage, params, getResource());
- message.setLineNo(lineNum);
+ message.setLineNo(range.getLineNumber());
+ message.setOffset(range.getOffset());
+ message.setLength(range.getLength());
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-28 05:49:56 UTC (rev 29378)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/jpa2/HibernateJpa2_0AnnotationDefinitionProvider.java 2011-02-28 09:02:34 UTC (rev 29379)
@@ -26,6 +26,8 @@
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;
+import org.jboss.tools.hibernate.jpt.core.internal.resource.java.TypeDefAnnotationImpl.TypeDefAnnotationDefinition;
+import org.jboss.tools.hibernate.jpt.core.internal.resource.java.TypeDefsAnnotationImpl.TypeDefsAnnotationDefinition;
/**
* @author Dmitry Geraskov
@@ -54,6 +56,8 @@
protected void addTypeAnnotationDefinitionsTo(List<AnnotationDefinition> definitions) {
definitions.add(GenericGeneratorAnnotationDefinition.instance());
definitions.add(GenericGeneratorsAnnotationDefinition.instance());
+ definitions.add(TypeDefAnnotationDefinition.instance());
+ definitions.add(TypeDefsAnnotationDefinition.instance());
definitions.add(HibernateNamedQueryAnnotationDefinition.instance());
definitions.add(HibernateNamedQueriesAnnotationDefinition.instance());
definitions.add(HibernateNamedNativeQueryAnnotationDefinition.instance());
@@ -66,6 +70,8 @@
protected void addAttributeAnnotationDefinitionsTo(List<AnnotationDefinition> definitions) {
definitions.add(GenericGeneratorAnnotationDefinition.instance());
definitions.add(GeneratedAnnotationDefinition.instance());
+ definitions.add(TypeDefAnnotationDefinition.instance());
+ definitions.add(TypeDefsAnnotationDefinition.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/GenericGeneratorAnnotationImpl.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/GenericGeneratorAnnotationImpl.java 2011-02-28 05:49:56 UTC (rev 29378)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/GenericGeneratorAnnotationImpl.java 2011-02-28 09:02:34 UTC (rev 29379)
@@ -180,7 +180,7 @@
}
NestableParameterAnnotation buildParameter(int index) {
- return SourceParameterAnnotation.createGenericGeneratorParameter(this, this.member, this.daa, index);
+ return SourceParameterAnnotation.createParameter(this, this.member, this.daa, Hibernate.GENERIC_GENERATOR__PARAMETERS, index);
}
Iterable<NestableParameterAnnotation> nestableParameters() {
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-28 05:49:56 UTC (rev 29378)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/SourceParameterAnnotation.java 2011-02-28 09:02:34 UTC (rev 29379)
@@ -156,12 +156,12 @@
// ********** static methods **********
- public static SourceParameterAnnotation createGenericGeneratorParameter(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter genericGeneratorAdapter, int index) {
- return new SourceParameterAnnotation(parent, member, buildGenericGeneratorParameterAnnotationAdapter(genericGeneratorAdapter, index));
+ public static SourceParameterAnnotation createParameter(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter annotationAdapter, String elementName, int index) {
+ return new SourceParameterAnnotation(parent, member, buildParameterAnnotationAdapter(annotationAdapter, elementName, index));
}
- private static IndexedDeclarationAnnotationAdapter buildGenericGeneratorParameterAnnotationAdapter(DeclarationAnnotationAdapter genericGeneratorAdapter, int index) {
- return new NestedIndexedDeclarationAnnotationAdapter(genericGeneratorAdapter, Hibernate.GENERIC_GENERATOR__PARAMETERS, index, Hibernate.PARAMETER);
+ private static IndexedDeclarationAnnotationAdapter buildParameterAnnotationAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, int index) {
+ return new NestedIndexedDeclarationAnnotationAdapter(annotationAdapter, elementName, index, Hibernate.PARAMETER);
}
}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/TypeDefAnnotation.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/TypeDefAnnotation.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/TypeDefAnnotation.java 2011-02-28 09:02:34 UTC (rev 29379)
@@ -0,0 +1,156 @@
+/*******************************************************************************
+ * 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.resource.java;
+
+import java.util.ListIterator;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.resource.java.NestableAnnotation;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.jboss.tools.hibernate.jpt.core.internal.context.basic.Hibernate;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+public interface TypeDefAnnotation extends NestableAnnotation {
+
+ String ANNOTATION_NAME = Hibernate.TYPE_DEF;
+
+ /**
+ * Corresponds to the 'name' element of the *TypeDef annotation.
+ * Return null if the element does not exist in Java.
+ */
+ String getName();
+ String NAME_PROPERTY = "name"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'name' element of the *TypeDef annotation.
+ * Set to null to remove the element. If no other elements exist
+ * the *Generator annotation will be removed as well.
+ */
+ void setName(String name);
+
+ /**
+ * Return the {@link TextRange} for the 'name' element. If the element
+ * does not exist return the {@link TextRange} for the *TypeDef annotation.
+ */
+ TextRange getNameTextRange(CompilationUnit astRoot);
+
+ /**
+ * Corresponds to the 'defaultForType' element of the *TypeDef annotation.
+ * Return null if the element does not exist in Java.
+ * Return the portion of the value preceding ".class".
+ * <pre>
+ * @TypeDef(defaultForType=Employee.class)
+ * </pre>
+ * will return "Employee"
+ */
+ String getDefaultForType();
+ String DEF_FOR_TYPE_PROPERTY = "defaultForType"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'defaultForType' element of the *TypeDef annotation.
+ * Set to null to remove the element.
+ */
+ void setDefaultForType(String defaultForType);
+
+ /**
+ * Return the {@link TextRange} for the 'defaultForType' element. If the element
+ * does not exist return the {@link TextRange} for the element collection annotation.
+ */
+ TextRange getDefaultForTypeTextRange(CompilationUnit astRoot);
+
+ /**
+ * Return the fully-qualified default for type class name as resolved by the AST's bindings.
+ * <pre>
+ * @TypeDef(targetClass=Employee.class)
+ * </pre>
+ * will return "model.Employee" if there is an import for model.Employee.
+ * @return
+ */
+ String getFullyQualifiedDefaultForTypeClassName();
+ String FULLY_QUALIFIED_DEFAULT_FOR_TYPE_CLASS_NAME_PROPERTY = "fullyQualifiedDefaultForTypeClassName"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'typeClass' element of the *TypeDef annotation.
+ * Return null if the element does not exist in Java.
+ * Return the portion of the value preceding ".class".
+ * <pre>
+ * @TypeDef(typeClass=Employee.class)
+ * </pre>
+ * will return "Employee"
+ */
+ String getTypeClass();
+ String TYPE_CLASS_PROPERTY = "typeClass"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'typeClass' element of the *TypeDef annotation.
+ * Set to null to remove the element.
+ */
+ void setTypeClass(String typeClass);
+
+ /**
+ * Return the {@link TextRange} for the 'typeClass' element. If the element
+ * does not exist return the {@link TextRange} for the element collection annotation.
+ */
+ TextRange getTypeClassTextRange(CompilationUnit astRoot);
+
+
+ /**
+ * Return the fully-qualified type class name as resolved by the AST's bindings.
+ * <pre>
+ * @TypeDef(targetClass=Employee.class)
+ * </pre>
+ * will return "model.Employee" if there is an import for model.Employee.
+ * @return
+ */
+ String getFullyQualifiedTypeClassName();
+ String FULLY_QUALIFIED_TYPE_CLASS_NAME_PROPERTY = "fullyQualifiedTypeClassName"; //$NON-NLS-1$
+
+
+ /**
+ * Return an empty iterator if the element does not exist in Java.
+ */
+ ListIterator<ParameterAnnotation> parameters();
+ String PARAMETERS_LIST = "parameters"; //$NON-NLS-1$
+
+ /**
+ * Corresponds to the 'parameters' element of the *TypeDef annotation.
+ */
+ int parametersSize();
+
+ /**
+ * Corresponds to the 'parameters' element of the *TypeDef annotation.
+ */
+ ParameterAnnotation parameterAt(int index);
+
+ /**
+ * Corresponds to the 'parameters' element of the *TypeDef annotation.
+ */
+ int indexOfParameter(ParameterAnnotation parameter);
+
+ /**
+ * Corresponds to the 'parameters' element of the *TypeDef annotation.
+ */
+ ParameterAnnotation addParameter(int index);
+
+ /**
+ * Corresponds to the 'parameters' element of the *TypeDef annotation.
+ */
+ void moveParameter(int targetIndex, int sourceIndex);
+
+ /**
+ * Corresponds to the 'parameters' element of the *TypeDef annotation.
+ */
+ void removeParameter(int index);
+
+}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/TypeDefAnnotationImpl.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/TypeDefAnnotationImpl.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/TypeDefAnnotationImpl.java 2011-02-28 09:02:34 UTC (rev 29379)
@@ -0,0 +1,450 @@
+/*******************************************************************************
+ * 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.resource.java;
+
+import java.util.ListIterator;
+import java.util.Vector;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.source.AnnotationContainerTools;
+import org.eclipse.jpt.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.core.internal.utility.jdt.ASTTools;
+import org.eclipse.jpt.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.MemberAnnotationAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.MemberAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.MemberIndexedAnnotationAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.SimpleTypeStringExpressionConverter;
+import org.eclipse.jpt.core.resource.java.Annotation;
+import org.eclipse.jpt.core.resource.java.AnnotationContainer;
+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.resource.java.NestableAnnotation;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.core.utility.jdt.AnnotationAdapter;
+import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.utility.jdt.ExpressionConverter;
+import org.eclipse.jpt.core.utility.jdt.IndexedAnnotationAdapter;
+import org.eclipse.jpt.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.utility.jdt.Member;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.StringTools;
+import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;
+import org.jboss.tools.hibernate.jpt.core.internal.context.basic.Hibernate;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+public class TypeDefAnnotationImpl extends SourceAnnotation<Member>
+ implements TypeDefAnnotation {
+
+ private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private final DeclarationAnnotationElementAdapter<String> nameDeclarationAdapter;
+ private final AnnotationElementAdapter<String> nameAdapter;
+ private String name;
+
+ private static final DeclarationAnnotationElementAdapter<String> TYPE_CLASS_ADAPTER = buildTypeClassAdapter();
+ private final AnnotationElementAdapter<String> typeClassAdapter;
+ private String typeClass;
+
+ String fullyQualifiedTypeClassName;
+
+ private static final DeclarationAnnotationElementAdapter<String> DEF_FOR_TYPE_ADAPTER = buildDefForTypeAdapter();
+ private final AnnotationElementAdapter<String> defaultForTypeAdapter;
+ private String defaultForType;
+
+ String fullyQualifiedDefaultForTypeClassName;
+
+ final Vector<NestableParameterAnnotation> parameters = new Vector<NestableParameterAnnotation>();
+ final ParametersAnnotationContainer parametersContainer = new ParametersAnnotationContainer();
+
+ /**
+ * @param parent
+ * @param member
+ */
+ public TypeDefAnnotationImpl(JavaResourceNode parent, Member member,
+ DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) {
+ super(parent, member, daa, annotationAdapter);
+ this.nameDeclarationAdapter = this.buildNameAdapter(daa);
+ this.nameAdapter = new ShortCircuitAnnotationElementAdapter<String>(member, nameDeclarationAdapter);
+ this.typeClassAdapter = new MemberAnnotationElementAdapter<String>(member, TYPE_CLASS_ADAPTER);
+ this.defaultForTypeAdapter = new MemberAnnotationElementAdapter<String>(member, DEF_FOR_TYPE_ADAPTER);
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.name = this.buildName(astRoot);
+ this.typeClass = this.buildTypeClass(astRoot);
+ this.fullyQualifiedTypeClassName = this.buildFullyQualifiedTypeClassName(astRoot);
+ this.defaultForType = this.buildDefaultForType(astRoot);
+ this.fullyQualifiedDefaultForTypeClassName = this.buildFullyQualifiedDefaultForTypeClassName(astRoot);
+ AnnotationContainerTools.initialize(this.parametersContainer, astRoot);
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ this.syncName(this.buildName(astRoot));
+ this.syncTypeClass(this.buildTypeClass(astRoot));
+ this.syncFullyQualifiedTypeClassName(this.buildFullyQualifiedTypeClassName(astRoot));
+ this.syncDefaultForType(this.buildDefaultForType(astRoot));
+ this.syncFullyQualifiedDefaultForTypeClassName(this.buildFullyQualifiedDefaultForTypeClassName(astRoot));
+ AnnotationContainerTools.synchronize(this.parametersContainer, astRoot);
+ }
+
+ // ********** TypeDefAnnotation implementation **********
+
+ // ***** name
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ if (this.attributeValueHasChanged(this.name, name)) {
+ this.name = name;
+ this.nameAdapter.setValue(name);
+ }
+ }
+
+ private void syncName(String astName) {
+ String old = this.name;
+ this.name = astName;
+ this.firePropertyChanged(NAME_PROPERTY, old, astName);
+ }
+
+ public TextRange getNameTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(nameDeclarationAdapter, astRoot);
+ }
+
+ protected String buildName(CompilationUnit astRoot) {
+ return this.nameAdapter.getValue(astRoot);
+ }
+
+ // ***** type class
+ public String getTypeClass() {
+ return this.typeClass;
+ }
+
+ public void setTypeClass(String typeClass) {
+ if (this.attributeValueHasChanged(this.typeClass, typeClass)) {
+ this.typeClass = typeClass;
+ this.typeClassAdapter.setValue(typeClass);
+ }
+ }
+
+ private void syncTypeClass(String astTypeClass) {
+ String old = this.typeClass;
+ this.typeClass = astTypeClass;
+ this.firePropertyChanged(TYPE_CLASS_PROPERTY, old, astTypeClass);
+ }
+
+ private String buildTypeClass(CompilationUnit astRoot) {
+ return this.typeClassAdapter.getValue(astRoot);
+ }
+
+ public TextRange getTypeClassTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(TYPE_CLASS_ADAPTER, astRoot);
+ }
+
+ // ***** fully-qualified type entity class name
+ public String getFullyQualifiedTypeClassName() {
+ return this.fullyQualifiedTypeClassName;
+ }
+
+ private void syncFullyQualifiedTypeClassName(String name) {
+ String old = this.fullyQualifiedTypeClassName;
+ this.fullyQualifiedTypeClassName = name;
+ this.firePropertyChanged(FULLY_QUALIFIED_TYPE_CLASS_NAME_PROPERTY, old, name);
+ }
+
+ private String buildFullyQualifiedTypeClassName(CompilationUnit astRoot) {
+ return (this.typeClass == null) ? null : ASTTools.resolveFullyQualifiedName(this.typeClassAdapter.getExpression(astRoot));
+ }
+
+ // ***** default for type class
+ public String getDefaultForType() {
+ return this.defaultForType;
+ }
+
+ public void setDefaultForType(String defaultForType) {
+ if (this.attributeValueHasChanged(this.defaultForType, defaultForType)) {
+ this.defaultForType = defaultForType;
+ this.defaultForTypeAdapter.setValue(defaultForType);
+ }
+ }
+
+ private void syncDefaultForType(String astDefaultForType) {
+ String old = this.defaultForType;
+ this.defaultForType = astDefaultForType;
+ this.firePropertyChanged(DEF_FOR_TYPE_PROPERTY, old, astDefaultForType);
+ }
+
+ private String buildDefaultForType(CompilationUnit astRoot) {
+ return this.defaultForTypeAdapter.getValue(astRoot);
+ }
+
+ public TextRange getDefaultForTypeTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(DEF_FOR_TYPE_ADAPTER, astRoot);
+ }
+
+ // ***** fully-qualified default for type entity class name
+ public String getFullyQualifiedDefaultForTypeClassName() {
+ return this.fullyQualifiedDefaultForTypeClassName;
+ }
+
+ private void syncFullyQualifiedDefaultForTypeClassName(String name) {
+ String old = this.fullyQualifiedDefaultForTypeClassName;
+ this.fullyQualifiedDefaultForTypeClassName = name;
+ this.firePropertyChanged(FULLY_QUALIFIED_DEFAULT_FOR_TYPE_CLASS_NAME_PROPERTY, old, name);
+ }
+
+ private String buildFullyQualifiedDefaultForTypeClassName(CompilationUnit astRoot) {
+ return (this.defaultForType == null) ? null : ASTTools.resolveFullyQualifiedName(this.defaultForTypeAdapter.getExpression(astRoot));
+ }
+ //************************ parameters ***********************
+
+ public NestableParameterAnnotation addParameter(int index) {
+ return (NestableParameterAnnotation) AnnotationContainerTools.addNestedAnnotation(index, this.parametersContainer);
+ }
+
+ NestableParameterAnnotation addParameter_() {
+ NestableParameterAnnotation parameter = this.buildParameter(this.parameters.size());
+ this.parameters.add(parameter);
+ return parameter;
+ }
+
+ NestableParameterAnnotation buildParameter(int index) {
+ return SourceParameterAnnotation.createParameter(this, this.member, this.daa, Hibernate.TYPE_DEF__PARAMETERS, index);
+ }
+
+ Iterable<NestableParameterAnnotation> nestableParameters() {
+ return this.parameters;
+ }
+
+ void syncAddParameterAnnotation(org.eclipse.jdt.core.dom.Annotation nestedAnnotation) {
+ NestableParameterAnnotation parameter = this.addParameter_();
+ parameter.initialize((CompilationUnit) nestedAnnotation.getRoot());
+ this.fireItemAdded(PARAMETERS_LIST, parametersSize() - 1, parameter);
+ }
+
+ NestableParameterAnnotation moveParameter_(int targetIndex, int sourceIndex) {
+ return CollectionTools.move(this.parameters, targetIndex, sourceIndex).get(targetIndex);
+ }
+
+ void parameterMoved(int targetIndex, int sourceIndex) {
+ this.fireItemMoved(PARAMETERS_LIST, targetIndex, sourceIndex);
+ }
+
+ public int indexOfParameter(ParameterAnnotation parameter) {
+ return this.parameters.indexOf(parameter);
+ }
+
+ public void moveParameter(int targetIndex, int sourceIndex) {
+ AnnotationContainerTools.moveNestedAnnotation(targetIndex, sourceIndex, this.parametersContainer);
+ }
+
+ public ParameterAnnotation parameterAt(int index) {
+ return this.parameters.get(index);
+ }
+
+ public ListIterator<ParameterAnnotation> parameters() {
+ return new CloneListIterator<ParameterAnnotation>(this.parameters);
+ }
+
+ public int parametersSize() {
+ return parameters.size();
+ }
+
+ public void removeParameter(int index) {
+ AnnotationContainerTools.removeNestedAnnotation(index, this.parametersContainer);
+ }
+
+ NestableParameterAnnotation removeParameter_(int index) {
+ return this.parameters.remove(index);
+ }
+
+ void parameterRemoved(int index) {
+ this.removeItemsFromList(index, this.parameters, PARAMETERS_LIST);
+ }
+
+ // ********** NestableAnnotation implementation **********
+ public void initializeFrom(NestableAnnotation oldAnnotation) {
+ TypeDefAnnotation oldTypeDef = (TypeDefAnnotation) oldAnnotation;
+ this.setName(oldTypeDef.getName());
+ this.setTypeClass(oldTypeDef.getTypeClass());
+
+ for (ParameterAnnotation oldParameter : CollectionTools.iterable(oldTypeDef.parameters())) {
+ NestableParameterAnnotation newParameter = this.addParameter(oldTypeDef.indexOfParameter(oldParameter));
+ newParameter.initializeFrom((NestableParameterAnnotation) oldParameter);
+ }
+ }
+
+
+ /**
+ * convenience implementation of method from NestableAnnotation interface
+ * for subclasses
+ */
+ public void moveAnnotation(int newIndex) {
+ this.getIndexedAnnotationAdapter().moveAnnotation(newIndex);
+ }
+
+ private IndexedAnnotationAdapter getIndexedAnnotationAdapter() {
+ return (IndexedAnnotationAdapter) this.annotationAdapter;
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ super.toString(sb);
+ sb.append(name);
+ }
+
+ private DeclarationAnnotationElementAdapter<String> buildNameAdapter(DeclarationAnnotationAdapter daa) {
+ return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, Hibernate.TYPE_DEF__NAME, false);
+ }
+
+ /**
+ * adapt the AnnotationContainer interface to the override's join columns
+ */
+ class ParametersAnnotationContainer
+ implements AnnotationContainer<NestableParameterAnnotation>
+ {
+ public String getContainerAnnotationName() {
+ return TypeDefAnnotationImpl.this.getAnnotationName();
+ }
+
+ public org.eclipse.jdt.core.dom.Annotation getAstAnnotation(CompilationUnit astRoot) {
+ return TypeDefAnnotationImpl.this.getAstAnnotation(astRoot);
+ }
+
+ public String getElementName() {
+ return Hibernate.TYPE_DEF__PARAMETERS;
+ }
+
+ public String getNestedAnnotationName() {
+ return ParameterAnnotation.ANNOTATION_NAME;
+ }
+
+ public Iterable<NestableParameterAnnotation> getNestedAnnotations() {
+ return TypeDefAnnotationImpl.this.nestableParameters();
+ }
+
+ public int getNestedAnnotationsSize() {
+ return TypeDefAnnotationImpl.this.parametersSize();
+ }
+
+ public NestableParameterAnnotation addNestedAnnotation() {
+ return TypeDefAnnotationImpl.this.addParameter_();
+ }
+
+ public void syncAddNestedAnnotation(org.eclipse.jdt.core.dom.Annotation nestedAnnotation) {
+ TypeDefAnnotationImpl.this.syncAddParameterAnnotation(nestedAnnotation);
+ }
+
+ public NestableParameterAnnotation moveNestedAnnotation(int targetIndex, int sourceIndex) {
+ return TypeDefAnnotationImpl.this.moveParameter_(targetIndex, sourceIndex);
+ }
+
+ public NestableParameterAnnotation removeNestedAnnotation(int index) {
+ return TypeDefAnnotationImpl.this.removeParameter_(index);
+ }
+
+ public void syncRemoveNestedAnnotations(int index) {
+ TypeDefAnnotationImpl.this.parameterRemoved(index);
+ }
+
+ @Override
+ public String toString() {
+ return StringTools.buildToStringFor(this);
+ }
+
+ }
+
+ public static TypeDefAnnotation createNestedTypeDef(
+ JavaResourceNode parent, Member member,
+ int index, DeclarationAnnotationAdapter attributeOverridesAdapter) {
+ IndexedDeclarationAnnotationAdapter idaa = buildNestedHibernateDeclarationAnnotationAdapter(index, attributeOverridesAdapter);
+ IndexedAnnotationAdapter annotationAdapter = new MemberIndexedAnnotationAdapter(member, idaa);
+ return new TypeDefAnnotationImpl(parent, member, idaa, annotationAdapter);
+ }
+
+ private static IndexedDeclarationAnnotationAdapter buildNestedHibernateDeclarationAnnotationAdapter(int index, DeclarationAnnotationAdapter hibernateTypeDefsAdapter) {
+ return new NestedIndexedDeclarationAnnotationAdapter(hibernateTypeDefsAdapter, index, Hibernate.TYPE_DEF);
+ }
+
+ // ********** static methods **********
+
+ private static DeclarationAnnotationElementAdapter<String> buildTypeClassAdapter() {
+ return buildTypeClassAdapter(DECLARATION_ANNOTATION_ADAPTER, Hibernate.TYPE_DEF__TYPE_CLASS);
+ }
+
+ private static DeclarationAnnotationElementAdapter<String> buildDefForTypeAdapter() {
+ return buildTypeClassAdapter(DECLARATION_ANNOTATION_ADAPTER, Hibernate.TYPE_DEF__DEF_FOR_TYPE);
+ }
+
+ private static DeclarationAnnotationElementAdapter<String> buildTypeClassAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) {
+ // TODO what about QualifiedType?
+ return buildAnnotationElementAdapter(annotationAdapter, elementName, SimpleTypeStringExpressionConverter.instance());
+ }
+
+ private static DeclarationAnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, ExpressionConverter<String> converter) {
+ return new ConversionDeclarationAnnotationElementAdapter<String>(annotationAdapter, elementName, false, converter);
+ }
+
+ public static class TypeDefAnnotationDefinition implements AnnotationDefinition
+ {
+ // singleton
+ private static final TypeDefAnnotationDefinition INSTANCE = new TypeDefAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private TypeDefAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
+ return new TypeDefAnnotationImpl(parent, member,
+ DECLARATION_ANNOTATION_ADAPTER, new MemberAnnotationAdapter(member, DECLARATION_ANNOTATION_ADAPTER));
+ }
+
+ public String getAnnotationName() {
+ return TypeDefAnnotation.ANNOTATION_NAME;
+ }
+
+ public Annotation buildAnnotation(JavaResourcePersistentMember arg0,
+ IAnnotation arg1) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildNullAnnotation(JavaResourcePersistentMember arg0) {
+ throw new UnsupportedOperationException();
+ }
+ }
+
+
+}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/TypeDefsAnnotation.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/TypeDefsAnnotation.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/TypeDefsAnnotation.java 2011-02-28 09:02:34 UTC (rev 29379)
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * 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.resource.java;
+
+import org.eclipse.jpt.core.resource.java.ContainerAnnotation;
+import org.jboss.tools.hibernate.jpt.core.internal.context.basic.Hibernate;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+public interface TypeDefsAnnotation extends
+ ContainerAnnotation<TypeDefAnnotation> {
+
+ String ANNOTATION_NAME = Hibernate.TYPE_DEFS;
+
+ String TYPE_DEFS_LIST = "typeDefs"; //$NON-NLS-1$
+
+
+}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/TypeDefsAnnotationImpl.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/TypeDefsAnnotationImpl.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/TypeDefsAnnotationImpl.java 2011-02-28 09:02:34 UTC (rev 29379)
@@ -0,0 +1,155 @@
+/*******************************************************************************
+ * 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.resource.java;
+
+import java.util.Vector;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.source.AnnotationContainerTools;
+import org.eclipse.jpt.core.internal.resource.java.source.SourceAnnotation;
+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.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.utility.jdt.Member;
+import org.eclipse.jpt.utility.internal.CollectionTools;
+import org.eclipse.jpt.utility.internal.iterables.LiveCloneIterable;
+import org.jboss.tools.hibernate.jpt.core.internal.context.basic.Hibernate;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+public class TypeDefsAnnotationImpl extends SourceAnnotation<Member> implements
+ TypeDefsAnnotation {
+
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private final Vector<TypeDefAnnotation> typeDefs = new Vector<TypeDefAnnotation>();
+
+
+ public TypeDefsAnnotationImpl(JavaResourceNode parent, Member member) {
+ super(parent, member, DECLARATION_ANNOTATION_ADAPTER);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ AnnotationContainerTools.initialize(this, astRoot);
+ }
+
+ public void synchronizeWith(CompilationUnit astRoot) {
+ AnnotationContainerTools.synchronize(this, astRoot);
+ }
+
+ @Override
+ public void toString(StringBuilder sb) {
+ sb.append(this.typeDefs);
+ }
+
+ // ********** AnnotationContainer implementation **********
+
+ public String getContainerAnnotationName() {
+ return this.getAnnotationName();
+ }
+
+ public String getElementName() {
+ return Hibernate.TYPE_DEFS__VALUE;
+ }
+
+ public String getNestedAnnotationName() {
+ return TypeDefAnnotation.ANNOTATION_NAME;
+ }
+
+ public Iterable<TypeDefAnnotation> getNestedAnnotations() {
+ return new LiveCloneIterable<TypeDefAnnotation>(this.typeDefs);
+ }
+
+ public int getNestedAnnotationsSize() {
+ return this.typeDefs.size();
+ }
+
+ public TypeDefAnnotation addNestedAnnotation() {
+ return this.addNestedAnnotation(this.typeDefs.size());
+ }
+
+ private TypeDefAnnotation addNestedAnnotation(int index) {
+ TypeDefAnnotation typeDef = this.buildTypeDef(index);
+ this.typeDefs.add(typeDef);
+ return typeDef;
+ }
+
+ public void syncAddNestedAnnotation(org.eclipse.jdt.core.dom.Annotation astAnnotation) {
+ int index = this.typeDefs.size();
+ TypeDefAnnotation typeDef = this.addNestedAnnotation(index);
+ typeDef.initialize((CompilationUnit) astAnnotation.getRoot());
+ this.fireItemAdded(TYPE_DEFS_LIST, index, typeDef);
+ }
+
+ private TypeDefAnnotation buildTypeDef(int index) {
+ return TypeDefAnnotationImpl.createNestedTypeDef(this, member, index, this.daa);
+ }
+
+ public TypeDefAnnotation moveNestedAnnotation(int targetIndex, int sourceIndex) {
+ return CollectionTools.move(this.typeDefs, targetIndex, sourceIndex).get(targetIndex);
+ }
+
+ public TypeDefAnnotation removeNestedAnnotation(int index) {
+ return this.typeDefs.remove(index);
+ }
+
+ public void syncRemoveNestedAnnotations(int index) {
+ this.removeItemsFromList(index, this.typeDefs, TYPE_DEFS_LIST);
+ }
+
+ public static class TypeDefsAnnotationDefinition implements AnnotationDefinition {
+
+ // singleton
+ private static final AnnotationDefinition INSTANCE = new TypeDefsAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure single instance.
+ */
+ private TypeDefsAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member member) {
+ return new TypeDefsAnnotationImpl(parent, member);
+ }
+
+ public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildAnnotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getAnnotationName() {
+ return TypeDefsAnnotation.ANNOTATION_NAME;
+ }
+
+ }
+
+}
13 years, 10 months
JBoss Tools SVN: r29378 - trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wizards.
by jbosstools-commits@lists.jboss.org
Author: Grid.Qian
Date: 2011-02-28 00:49:56 -0500 (Mon, 28 Feb 2011)
New Revision: 29378
Modified:
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wizards/NewFileWizardPage1.java
Log:
JBIDE-8408: make the template of bpel text scrolling
Modified: trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wizards/NewFileWizardPage1.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wizards/NewFileWizardPage1.java 2011-02-28 04:54:31 UTC (rev 29377)
+++ trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/wizards/NewFileWizardPage1.java 2011-02-28 05:49:56 UTC (rev 29378)
@@ -221,7 +221,7 @@
});
templateDescription = new Text(projectGroup, SWT.READ_ONLY | SWT.WRAP
- | SWT.SCROLL_LINE);
+ | SWT.SCROLL_LINE | SWT.V_SCROLL);
data = new GridData(GridData.FILL_HORIZONTAL);
data.widthHint = SIZING_TEXT_FIELD_WIDTH;
data.heightHint = 60;
13 years, 10 months
JBoss Tools SVN: r29377 - in trunk/esb/docs/esb_ref_guide/en-US/images: esb_project and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: mcaspers
Date: 2011-02-27 23:54:31 -0500 (Sun, 27 Feb 2011)
New Revision: 29377
Modified:
trunk/esb/docs/esb_ref_guide/en-US/images/esb_editor/01_esb_tree_view.png
trunk/esb/docs/esb_ref_guide/en-US/images/esb_editor/01a_esb_tree_view_and_links.png
trunk/esb/docs/esb_ref_guide/en-US/images/esb_editor/01b_esb_tree_view_and_links.png
trunk/esb/docs/esb_ref_guide/en-US/images/esb_editor/02_esb_source_view.png
trunk/esb/docs/esb_ref_guide/en-US/images/esb_editor/03_esb_outline_view.png
trunk/esb/docs/esb_ref_guide/en-US/images/esb_editor/04_esb_add_provider.png
trunk/esb/docs/esb_ref_guide/en-US/images/esb_editor/05_esb_add_service.png
trunk/esb/docs/esb_ref_guide/en-US/images/esb_editor/06_esb_add_listener.png
trunk/esb/docs/esb_ref_guide/en-US/images/esb_editor/06a_esb_filter.png
trunk/esb/docs/esb_ref_guide/en-US/images/esb_editor/11_esb_editor.png
trunk/esb/docs/esb_ref_guide/en-US/images/esb_editor/12_esb_editor.png
trunk/esb/docs/esb_ref_guide/en-US/images/esb_editor/12a_esb_editor.png
trunk/esb/docs/esb_ref_guide/en-US/images/esb_editor/12b_esb_editor.png
trunk/esb/docs/esb_ref_guide/en-US/images/esb_editor/13_esb_editor.png
trunk/esb/docs/esb_ref_guide/en-US/images/esb_editor/14_esb_editor.png
trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/16HelloworldProjects.png
Log:
updated images
Modified: trunk/esb/docs/esb_ref_guide/en-US/images/esb_editor/01_esb_tree_view.png
===================================================================
(Binary files differ)
Modified: trunk/esb/docs/esb_ref_guide/en-US/images/esb_editor/01a_esb_tree_view_and_links.png
===================================================================
(Binary files differ)
Modified: trunk/esb/docs/esb_ref_guide/en-US/images/esb_editor/01b_esb_tree_view_and_links.png
===================================================================
(Binary files differ)
Modified: trunk/esb/docs/esb_ref_guide/en-US/images/esb_editor/02_esb_source_view.png
===================================================================
(Binary files differ)
Modified: trunk/esb/docs/esb_ref_guide/en-US/images/esb_editor/03_esb_outline_view.png
===================================================================
(Binary files differ)
Modified: trunk/esb/docs/esb_ref_guide/en-US/images/esb_editor/04_esb_add_provider.png
===================================================================
(Binary files differ)
Modified: trunk/esb/docs/esb_ref_guide/en-US/images/esb_editor/05_esb_add_service.png
===================================================================
(Binary files differ)
Modified: trunk/esb/docs/esb_ref_guide/en-US/images/esb_editor/06_esb_add_listener.png
===================================================================
(Binary files differ)
Modified: trunk/esb/docs/esb_ref_guide/en-US/images/esb_editor/06a_esb_filter.png
===================================================================
(Binary files differ)
Modified: trunk/esb/docs/esb_ref_guide/en-US/images/esb_editor/11_esb_editor.png
===================================================================
(Binary files differ)
Modified: trunk/esb/docs/esb_ref_guide/en-US/images/esb_editor/12_esb_editor.png
===================================================================
(Binary files differ)
Modified: trunk/esb/docs/esb_ref_guide/en-US/images/esb_editor/12a_esb_editor.png
===================================================================
(Binary files differ)
Modified: trunk/esb/docs/esb_ref_guide/en-US/images/esb_editor/12b_esb_editor.png
===================================================================
(Binary files differ)
Modified: trunk/esb/docs/esb_ref_guide/en-US/images/esb_editor/13_esb_editor.png
===================================================================
(Binary files differ)
Modified: trunk/esb/docs/esb_ref_guide/en-US/images/esb_editor/14_esb_editor.png
===================================================================
(Binary files differ)
Modified: trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/16HelloworldProjects.png
===================================================================
(Binary files differ)
13 years, 10 months
JBoss Tools SVN: r29376 - in trunk/esb/docs/esb_ref_guide/en-US: images/esb_project and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: mcaspers
Date: 2011-02-27 23:24:30 -0500 (Sun, 27 Feb 2011)
New Revision: 29376
Modified:
trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/07_esb_project_example.png
trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/08_esb_project_deploy.png
trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/09_esb_runtime_new.png
trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/10_esb_runtime.png
trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/11_esb_runtime_new.png
trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/13NewServerRuntimeEnv.png
trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/14typeOfRuntime.png
trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/15AddNew.png
trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/17_Add_new_libraries.png
trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/18_select_libraries.png
trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/19_select_runtime.png
trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/20_classpath_container.png
trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/21_source.png
trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/22_Javadoc.png
trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/24_export_button.png
trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/25_esb_file.png
trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/26_esb_export.png
trunk/esb/docs/esb_ref_guide/en-US/images/esb_support/01_create_esb.png
trunk/esb/docs/esb_ref_guide/en-US/images/esb_support/02_create_esb.png
trunk/esb/docs/esb_ref_guide/en-US/images/esb_support/03_create_esb.png
trunk/esb/docs/esb_ref_guide/en-US/images/esb_support/04_create_esb.png
trunk/esb/docs/esb_ref_guide/en-US/tasks.xml
Log:
updated images
Modified: trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/07_esb_project_example.png
===================================================================
(Binary files differ)
Modified: trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/08_esb_project_deploy.png
===================================================================
(Binary files differ)
Modified: trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/09_esb_runtime_new.png
===================================================================
(Binary files differ)
Modified: trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/10_esb_runtime.png
===================================================================
(Binary files differ)
Modified: trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/11_esb_runtime_new.png
===================================================================
(Binary files differ)
Modified: trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/13NewServerRuntimeEnv.png
===================================================================
(Binary files differ)
Modified: trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/14typeOfRuntime.png
===================================================================
(Binary files differ)
Modified: trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/15AddNew.png
===================================================================
(Binary files differ)
Modified: trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/17_Add_new_libraries.png
===================================================================
(Binary files differ)
Modified: trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/18_select_libraries.png
===================================================================
(Binary files differ)
Modified: trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/19_select_runtime.png
===================================================================
(Binary files differ)
Modified: trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/20_classpath_container.png
===================================================================
(Binary files differ)
Modified: trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/21_source.png
===================================================================
(Binary files differ)
Modified: trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/22_Javadoc.png
===================================================================
(Binary files differ)
Modified: trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/24_export_button.png
===================================================================
(Binary files differ)
Modified: trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/25_esb_file.png
===================================================================
(Binary files differ)
Modified: trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/26_esb_export.png
===================================================================
(Binary files differ)
Modified: trunk/esb/docs/esb_ref_guide/en-US/images/esb_support/01_create_esb.png
===================================================================
(Binary files differ)
Modified: trunk/esb/docs/esb_ref_guide/en-US/images/esb_support/02_create_esb.png
===================================================================
(Binary files differ)
Modified: trunk/esb/docs/esb_ref_guide/en-US/images/esb_support/03_create_esb.png
===================================================================
(Binary files differ)
Modified: trunk/esb/docs/esb_ref_guide/en-US/images/esb_support/04_create_esb.png
===================================================================
(Binary files differ)
Modified: trunk/esb/docs/esb_ref_guide/en-US/tasks.xml
===================================================================
--- trunk/esb/docs/esb_ref_guide/en-US/tasks.xml 2011-02-28 03:07:41 UTC (rev 29375)
+++ trunk/esb/docs/esb_ref_guide/en-US/tasks.xml 2011-02-28 04:24:30 UTC (rev 29376)
@@ -264,10 +264,8 @@
<guimenuitem>Other</guimenuitem>
<guimenuitem>Server</guimenuitem>
<guimenuitem>Servers</guimenuitem>
- </menuchoice>,
- create a JBoss Server in the Server view and start it, and then right click the created JBoss server,
- select <emphasis><property> </property> Add and Remove Projects</emphasis>,
- and add the ESB projects you want to deploy from the left side to the right side in the opened dialog. </para>
+ </menuchoice>, create a JBoss Server in the Server view and start it, and then right click the created JBoss server, select <guilabel> Add and Remove Projects</guilabel>, and add the ESB projects you want to deploy from the left side to the right side in the opened dialog.
+ </para>
<figure>
<title>Add and Remove Projects</title>
@@ -278,9 +276,9 @@
</mediaobject>
</figure>
- <para>Click <emphasis><property>Finish</property>
- </emphasis> to add the project to the server.
- You also can drag the ESB project from the Project View to the server.</para>
+ <para>
+ Click the <guibutton>Finish</guibutton> button to add the project to the server. You also can drag the ESB project from the Project View to the server.
+ </para>
<figure>
<title>Servers View</title>
@@ -291,12 +289,12 @@
</mediaobject>
</figure>
- <para>Thus, you have just added the ESB project to the JBoss server module list. Right click the JBoss Server and select <emphasis><property>Publish</property>
- </emphasis> to publish the project on the server.
- You can check the deploying result in the Console view.</para>
- <para>The <emphasis><property>Run</property>
- </emphasis> and <emphasis><property>Debug</property>
- </emphasis> options work on ESB projects causing a (re)deploy for a user designated server.</para>
+ <para>
+ Thus, you have just added the ESB project to the JBoss server module list. Right click the JBoss Server and select <guimenuitem>Publish</guimenuitem> to publish the project on the server. You can check the deploying result in the Console view.
+ </para>
+ <para>
+ The <guimenuitem>Run</guimenuitem> and <guimenuitem>Debug</guimenuitem> options work on ESB projects causing a (re)deploy for a user designated server.
+ </para>
<para>You can also use the "Finger touch" for a quick restart of the project without restarting the server:</para>
<figure>
<title>Finger Touch button</title>
@@ -306,9 +304,10 @@
</imageobject>
</mediaobject>
</figure>
- <para>The "Finger" touches descriptors dependent on project (i.e. web.xml for WAR, application.xml for EAR) and now it is also available for jboss-esb.xml in ESB projects.</para>
- <para>You can also deploy your ESB project as an .esb archive. Right-click on the project, choose <emphasis><property>Export</property>
- </emphasis>:</para>
+ <para>
+ The "Finger" touches descriptors dependent on project (i.e. <filename>web.xml</filename> for WAR, <filename>application.xml</filename> for EAR) and now it is also available for <filename>jboss-esb.xml</filename> in ESB projects.
+ </para>
+ <para>You can also deploy your ESB project as an .esb archive. Right-click on the project, choose <guimenuitem>Export</guimenuitem>:</para>
<figure>
<title>Export of ESB project</title>
13 years, 10 months
JBoss Tools SVN: r29375 - in trunk/esb/docs/esb_ref_guide/en-US: images/esb_project and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: mcaspers
Date: 2011-02-27 22:07:41 -0500 (Sun, 27 Feb 2011)
New Revision: 29375
Modified:
trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/01_create_esb_project.png
trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/02_create_esb_project.png
trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/02a_create_esb_project.png
trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/02b_create_esb_project.png
trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/03_create_esb_project.png
trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/04_create_esb_project.png
trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/05_esb_project_example.png
trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/05a_esb_project_example.png
trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/06_esb_project_example.png
trunk/esb/docs/esb_ref_guide/en-US/introduction.xml
trunk/esb/docs/esb_ref_guide/en-US/tasks.xml
Log:
updated images
Modified: trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/01_create_esb_project.png
===================================================================
(Binary files differ)
Modified: trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/02_create_esb_project.png
===================================================================
(Binary files differ)
Modified: trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/02a_create_esb_project.png
===================================================================
(Binary files differ)
Modified: trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/02b_create_esb_project.png
===================================================================
(Binary files differ)
Modified: trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/03_create_esb_project.png
===================================================================
(Binary files differ)
Modified: trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/04_create_esb_project.png
===================================================================
(Binary files differ)
Modified: trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/05_esb_project_example.png
===================================================================
(Binary files differ)
Modified: trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/05a_esb_project_example.png
===================================================================
(Binary files differ)
Modified: trunk/esb/docs/esb_ref_guide/en-US/images/esb_project/06_esb_project_example.png
===================================================================
(Binary files differ)
Modified: trunk/esb/docs/esb_ref_guide/en-US/introduction.xml
===================================================================
--- trunk/esb/docs/esb_ref_guide/en-US/introduction.xml 2011-02-28 00:32:17 UTC (rev 29374)
+++ trunk/esb/docs/esb_ref_guide/en-US/introduction.xml 2011-02-28 03:07:41 UTC (rev 29375)
@@ -1,104 +1,117 @@
<?xml version="1.0" encoding="UTF-8"?>
<chapter id="introduction">
- <?dbhtml filename="introduction.html"?>
+ <?dbhtml filename="introduction.html"?>
- <chapterinfo>
- <keywordset>
- <keyword>JBoss Developer Studio</keyword>
- <keyword>Eclipse</keyword>
- <keyword>Java</keyword>
- <keyword>JBoss</keyword>
- <keyword>JBoss Tools</keyword>
- <keyword>JBDS</keyword>
- <keyword>ESB</keyword>
- </keywordset>
- </chapterinfo>
+ <chapterinfo>
+ <keywordset>
+ <keyword>JBoss Developer Studio</keyword>
+ <keyword>Eclipse</keyword>
+ <keyword>Java</keyword>
+ <keyword>JBoss</keyword>
+ <keyword>JBoss Tools</keyword>
+ <keyword>JBDS</keyword>
+ <keyword>ESB</keyword>
+ </keywordset>
+ </chapterinfo>
- <title>Introduction</title>
+ <title>Introduction</title>
- <section>
+ <section>
- <title>What is ESB and JBoss ESB Tools?</title>
+ <title>What is ESB and JBoss ESB Tools?</title>
- <para>ESB (Enterprise Service Bus) is an abstraction layer on top of the implementation of an
- enterprise messaging system that provides the features that Service Oriented
- Architectures may be implemented with.</para>
- <para>If you want to develop applications using ESB technology <property>JBoss ESB</property> also meets your
- needs. Read more about <property>Jboss ESB</property> at <ulink url="http://www.jboss.org/jbossesb">http://www.jboss.org/jbossesb</ulink>.</para>
-
+ <para>
+ ESB (Enterprise Service Bus) is an abstraction layer on top of the implementation of an enterprise messaging system that provides the features that Service Oriented Architectures may be implemented with.
+ </para>
+ <para>
+ If you want to develop applications using ESB technology <property>JBoss ESB</property> also meets your needs. Read more about <property>JBoss ESB</property> at <ulink url="http://www.jboss.org/jbossesb">http://www.jboss.org/jbossesb</ulink>.
+ </para>
- <para><property>JBoss ESB Tools</property> provide an ESB editor and necessary wizard for creating an ESB
- file.</para>
- <para>In this guide we provide you with the information on <property>JBoss ESB Tools</property> (installation, configuration and deployment) and usage of ESB Editor which allows you to
- develop an ESB file much faster and with far fewer errors so sparing your time.</para>
- </section>
+ <para><property>JBoss ESB Tools</property> provides an ESB editor and wizard for creating an ESB file.</para>
+ <para>
+ This guide will provide you with the information you need to install, configure and deploy <property>JBoss ESB Tools</property>. Information will also be provided on the use of the ESB Editor, which allows you to quickly develop an ESB file with fewer errors.
+ </para>
-<section>
- <title>Key Features of ESB Tools</title>
- <para>For a start, we propose you to look through the table of main features of ESB plugin:</para>
+ </section>
- <table>
-
- <title>Key Functionality of ESB Tools</title>
- <tgroup cols="3">
-
- <colspec colnum="1" align="left" colwidth="2*"/>
- <colspec colnum="2" colwidth="4*"/>
- <colspec colnum="3" align="left" colwidth="2*"/>
-
- <thead>
- <row>
- <entry>Feature</entry>
- <entry>Benefit</entry>
- <entry>Chapter</entry>
- </row>
- </thead>
-
- <tbody>
-
- <row>
- <entry><para>JBoss Tools Project Examples Wizard</para></entry>
- <entry><para>Some kinds of projects with predefined structure are available for usage.</para></entry>
- <entry>
- <xref linkend="ESB_project_wizard"/>
- </entry>
- </row>
-
- <row>
- <entry><para>JBoss Enterprise SOA Platform</para></entry>
- <entry><para>The SOA Platform integrates specific versions of JBoss ESB, jBPM, Drools and the JBoss Enterprise Application Platform that are certified to work together in a single supported enterprise distribution.</para></entry>
- <entry>
- <xref linkend="using_SOA"/>
- </entry>
- </row>
-
- <row>
- <entry><para>ESB Editor</para></entry>
- <entry><para>JBoss ESB tooling has powerful editor features including syntax validation, support for XML Schema and other.</para></entry>
+ <section>
+ <title>Key Features of ESB Tools</title>
+ <para>The table below lists the main features of the ESB plugin:</para>
+
+ <table>
+
+ <title>Key Functionality of ESB Tools</title>
+ <tgroup cols="3">
+
+ <colspec colnum="1" align="left" colwidth="2*"/>
+ <colspec colnum="2" colwidth="4*"/>
+ <colspec colnum="3" align="left" colwidth="2*"/>
+
+ <thead>
+ <row>
+ <entry>Feature</entry>
+ <entry>Benefit</entry>
+ <entry>Chapter</entry>
+ </row>
+ </thead>
+
+ <tbody>
+
+ <row>
+ <entry>
+ <para>JBoss Tools Project Examples Wizard</para>
+ </entry>
+ <entry>
+ <para>Quickly create example projects with a predefined structure.</para>
+ </entry>
+ <entry>
+ <xref linkend="ESB_project_wizard"/>
+ </entry>
+ </row>
+
+ <row>
+ <entry>
+ <para>JBoss Enterprise SOA Platform</para>
+ </entry>
+ <entry>
+ <para>
+ The SOA Platform integrates specific versions of JBoss ESB, jBPM, Drools and the JBoss Enterprise Application Platform that are certified to work together in a single supported enterprise distribution.
+ </para>
+ </entry>
+ <entry>
+ <xref linkend="using_SOA"/>
+ </entry>
+ </row>
+
+ <row>
+ <entry>
+ <para>ESB Editor</para>
+ </entry>
+ <entry>
+ <para>JBoss ESB tooling includes a powerful editor with features including syntax validation, support for XML Schema and more.</para>
+ </entry>
<!-- <entry>
<xref linkend="esb_editor">
</entry> -->
- </row>
-
- </tbody>
-
- </tgroup>
- </table>
+ </row>
-</section>
-
- <section>
- <title>Requirements and Installation</title>
-
- <para>This section will provide you with the information on how to install
- JBoss ESB plugin into Eclipse.</para>
-
- <para>ESB Tools come as one module of the JBoss Tools project. Since ESB Tools have a
+ </tbody>
+
+ </tgroup>
+ </table>
+
+ </section>
+
+ <!--<section>
+ <title>Requirements and Installation</title>
+
+ <para>This section will provide you with the information on how to install JBoss ESB plugin into Eclipse.</para>
+
+ <para>ESB Tools come as one module of the JBoss Tools project. Since ESB Tools have a
dependence on other JBoss Tools modules we recommend you to install a bundle
of all <ulink url="http://labs.jboss.com/tools/download.html">JBoss
- Tools plug-ins</ulink>. You can find all necessary installation instructions on JBoss Wiki in the <ulink url="http://www.jboss.org/tools/download/installation"
- >InstallingJBossTools</ulink> section.</para>
- </section>
-
+ Tools plug-ins</ulink>. You can find all necessary installation instructions on JBoss Wiki in the <ulink url="http://www.jboss.org/tools/download/installation">InstallingJBossTools</ulink> section.</para>
+ </section>-->
+
</chapter>
Modified: trunk/esb/docs/esb_ref_guide/en-US/tasks.xml
===================================================================
--- trunk/esb/docs/esb_ref_guide/en-US/tasks.xml 2011-02-28 00:32:17 UTC (rev 29374)
+++ trunk/esb/docs/esb_ref_guide/en-US/tasks.xml 2011-02-28 03:07:41 UTC (rev 29375)
@@ -58,7 +58,7 @@
</imageobject>
</mediaobject>
</figure>
- <para>By clicking <emphasis>Modify</emphasis> button you can open <emphasis>Project Facets Wizard</emphasis> page,where you can select
+ <para>By clicking the <guibutton>Modify</guibutton> button you can open <emphasis>Project Facets Wizard</emphasis> page, where you can select
facets that should be enabled for this project.
On the <emphasis>Project Facets Wizard</emphasis> page you can also configure runtime for the application</para>
<figure>
@@ -83,18 +83,16 @@
<para>Next step provides you an opportunity to configure your project for building a java application</para>
- <para> Clicking <guibutton>Next</guibutton> on this form brings you to the ESB facet installation page where you can
- specify the ESB Content Directory. ESB Content Directory is a folder that contains the most of
- artifacts that an ESB archive needs. You also can configure ESB libraries to the project by selecting a ESB runtime using one of the options:
- </para>
- <para>1. Use <emphasis>
- <property>Server Supplied ESB Runtime</property>
- </emphasis>
-
+ <para>
+ Clicking the <guibutton>Next</guibutton> button on this form brings you to the ESB facet installation page where you can specify the ESB Content Directory. ESB Content Directory is a folder that contains the most of artifacts that an ESB archive needs. You also can configure ESB libraries to the project by selecting a ESB runtime using one of the options:
</para>
- <para> 2. Select a ESB runtime from the JBoss ESB runtime list predefined in the preferences. If you choose the first option, make sure that the project has the Target JBoss Runtime set and this runtime has a ESB runtime installed.
- </para>
- <para>3. Choose ESB Config Version. From the version 3.1.0 JBoss ESB Tools supports three different jboss-esb.xsd versions: jbossesb-1.0.1.xsd, jbossesb-1.1.0.xsd and jbossesb-1.2.0.xsd.</para>
+ <para>1. Use <guilabel>Server Supplied ESB Runtime</guilabel></para>
+ <para>
+ 2. Select a ESB runtime from the JBoss ESB runtime list predefined in the preferences. If you choose the first option, make sure that the project has the Target JBoss Runtime set and this runtime has a ESB runtime installed.
+ </para>
+ <para>
+ 3. Choose ESB Config Version. From the version 3.1.0 JBoss ESB Tools supports three different jboss-esb.xsd versions: jbossesb-1.0.1.xsd, jbossesb-1.1.0.xsd and jbossesb-1.2.0.xsd.
+ </para>
<note>
<title>Note:</title>
<para>If you use ESB 4.7 you should select jbossesb-1.2.0.xsd.</para>
@@ -107,11 +105,7 @@
</imageobject>
</mediaobject>
</figure>
- <para>Click <emphasis>
- <property>Finish</property>
- </emphasis> and a ESB project with the default <emphasis><property>jboss-esb.xml</property>
- </emphasis>
- will be created. </para>
+ <para>Click the <guibutton>Finish</guibutton> button and a ESB project with the default <filename>jboss-esb.xml</filename> file will be created. </para>
<figure>
<title>The generated ESB project structure</title>
@@ -126,12 +120,13 @@
<section id="ESB_project_wizard">
<title>Using ESB Project Examples</title>
- <para>JBoss Tools provides a Project Example wizard that is an easy way for users to create some kinds of projects to be used as examples with some predefined structure. Let's start
- creating a ESB project using this wizard.</para>
+ <para>
+ JBoss Tools provides a Project Example wizard that is an easy way for users to create some kinds of projects to be used as examples with some predefined structure. Let's start creating a ESB project using this wizard.
+ </para>
- <para>Before creating a ESB project example create JBoss Runtime with name <emphasis><property>
- JBoss 4.2 Runtime</property>
- </emphasis>, it will be used by your ESB project example. </para>
+ <para>
+ Before creating a ESB project example create JBoss Runtime with name <emphasis><property>JBoss 4.2 Runtime</property></emphasis>, it will be used by your ESB project example.
+ </para>
<para>Select
<menuchoice>
@@ -154,9 +149,9 @@
</mediaobject>
</figure>
- <para> Clicking <emphasis>
- <property>Next</property>
- </emphasis> brings you to the wizard page where you can select a ESB project example from the example list.</para>
+ <para>
+ Clicking the <guibutton>Next</guibutton> button brings you to the wizard page where you can select a ESB project example from the example list.
+ </para>
<figure>
<title>Project Example Wizard</title>
@@ -168,8 +163,7 @@
</figure>
<note>
<title>Note:</title>
- <para>Under the <property>Projects</property>
- section you can find two categories related to ESB:</para>
+ <para>Under the <property>Projects</property> section you can find two categories related to ESB:</para>
<itemizedlist>
<listitem>
@@ -180,12 +174,9 @@
</listitem>
</itemizedlist>
-
- <para>It means that if you use a runtime pointed to a SOA-P 5.0, you should download the examples from
- the <emphasis>
- <property>ESB for SOA-P 5.0</property>
- </emphasis> category in order to avoid the incompatibility errors.
- </para>
+ <para>
+ It means that if you use a runtime pointed to a SOA-P 5.0, you should download the examples from the <emphasis><property>ESB for SOA-P 5.0</property></emphasis> category in order to avoid the incompatibility errors.
+ </para>
</note>
<para>Every ESB example has two projects, one is a ESB project and another is a Java project used to test the ESB project.</para>
@@ -247,7 +238,9 @@
</figure>
- <para>Select the <guilabel>JBoss ESB HelloWorld Example</guilabel> ESB project and then click the <guibutton>Finish</guibutton> button. As a result you will get two projects created:</para>
+ <para>
+ Select the <guilabel>JBoss ESB HelloWorld Example</guilabel> ESB project and then click the <guibutton>Finish</guibutton> button. As a result you will get two projects created:
+ </para>
<figure>
<title>JBoss ESB Project Examples: helloworld and helloworld_testclient</title>
<mediaobject>
13 years, 10 months