JBoss Tools SVN: r17956 - workspace/mareshkau.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2009-10-07 09:07:35 -0400 (Wed, 07 Oct 2009)
New Revision: 17956
Modified:
workspace/mareshkau/xulrunner1.9.diff
Log:
DragNDrop has been adjusted under linux platform for XR1.9
Modified: workspace/mareshkau/xulrunner1.9.diff
===================================================================
--- workspace/mareshkau/xulrunner1.9.diff 2009-10-07 12:38:03 UTC (rev 17955)
+++ workspace/mareshkau/xulrunner1.9.diff 2009-10-07 13:07:35 UTC (rev 17956)
@@ -1,6 +1,6 @@
Index: trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/XulRunnerBrowser.java
===================================================================
---- trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/XulRunnerBrowser.java (revision 17893)
+--- trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/XulRunnerBrowser.java (revision 17955)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/XulRunnerBrowser.java (working copy)
@@ -50,8 +50,8 @@
@@ -13,126 +13,6 @@
// TODO Sergey Vasilyev Think. May be XULRUNNER_BUNDLE shouldn't be final?
private static final String XULRUNNER_BUNDLE;
private static final String XULRUNNER_ENTRY = "/xulrunner"; //$NON-NLS-1$
-Index: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java
-===================================================================
---- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java (revision 17893)
-+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java (working copy)
-@@ -923,7 +923,7 @@
- nsIEditingSession iEditingSession = (nsIEditingSession) getXulRunnerEditor().
- getComponentManager().createInstanceByContractID(XPCOM.NS_EDITINGSESSION_CONTRACTID, null, nsIEditingSession.NS_IEDITINGSESSION_IID);
- //make window editable
-- iEditingSession.makeWindowEditable(getXulRunnerEditor().getWebBrowser().getContentDOMWindow(), "html", true); //$NON-NLS-1$
-+ iEditingSession.makeWindowEditable(getXulRunnerEditor().getWebBrowser().getContentDOMWindow(), "html", true,true,true); //$NON-NLS-1$
- //here we setup editor for window
- iEditingSession.setupEditorOnWindow(getXulRunnerEditor().getWebBrowser().getContentDOMWindow());
- //getting some editor to disable some actions
-Index: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VisualDomUtil.java
-===================================================================
---- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VisualDomUtil.java (revision 17893)
-+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VisualDomUtil.java (working copy)
-@@ -10,18 +10,14 @@
- ******************************************************************************/
- package org.jboss.tools.vpe.editor.util;
-
--import java.lang.ref.Reference;
--import java.lang.ref.SoftReference;
- import java.util.ArrayList;
- import java.util.HashSet;
- import java.util.List;
- import java.util.Set;
--
- import org.eclipse.swt.graphics.Point;
- import org.eclipse.swt.graphics.Rectangle;
- import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
- import org.jboss.tools.vpe.editor.template.VpeCreationData;
--import org.mozilla.interfaces.nsIAccessibilityService;
- import org.mozilla.interfaces.nsIAccessible;
- import org.mozilla.interfaces.nsIDOMDocument;
- import org.mozilla.interfaces.nsIDOMElement;
-@@ -33,7 +29,6 @@
- import org.mozilla.interfaces.nsIDOMNodeList;
- import org.mozilla.interfaces.nsIDOMRange;
- import org.mozilla.interfaces.nsISelection;
--import org.mozilla.xpcom.Mozilla;
- import org.mozilla.xpcom.XPCOMException;
- import org.w3c.dom.Element;
- import org.w3c.dom.NamedNodeMap;
-@@ -50,7 +45,7 @@
- public static String FACELETS_URI = "http://java.sun.com/jsf/facelets"; //$NON-NLS-1$
-
- private static final String ACCESSIBILITY_SERVICE_CONTRACT_ID = "@mozilla.org/accessibilityService;1"; //$NON-NLS-1$
-- private static Reference<nsIAccessibilityService> accessibilityServiceCache = null;
-+// private static Reference<nsIAccessibilityService> accessibilityServiceCache = null;
-
- private static Set<String> escapedTags;
-
-@@ -236,23 +231,23 @@
- *
- * @author yradtsevich
- */
-- public static nsIAccessibilityService getAccessibilityService() {
-- nsIAccessibilityService accessibilityService = null;
-- if (accessibilityServiceCache != null) {
-- // get accessibilityService from cache
-- accessibilityService = accessibilityServiceCache.get();
-- }
-- if (accessibilityService == null) {
-- accessibilityService = (nsIAccessibilityService) Mozilla.getInstance()
-- .getServiceManager()
-- .getServiceByContractID(ACCESSIBILITY_SERVICE_CONTRACT_ID,
-- nsIAccessibilityService.NS_IACCESSIBILITYSERVICE_IID);
--
-- // cache accessibilityService
-- accessibilityServiceCache = new SoftReference<nsIAccessibilityService>(accessibilityService);
-- }
-- return accessibilityService;
-- }
-+// public static nsIAccessibilityService getAccessibilityService() {
-+// nsIAccessibilityService accessibilityService = null;
-+// if (accessibilityServiceCache != null) {
-+// // get accessibilityService from cache
-+// accessibilityService = accessibilityServiceCache.get();
-+// }
-+// if (accessibilityService == null) {
-+// accessibilityService = (nsIAccessibilityService) Mozilla.getInstance()
-+// .getServiceManager()
-+// .getServiceByContractID(ACCESSIBILITY_SERVICE_CONTRACT_ID,
-+// nsIAccessibilityService.NS_IACCESSIBILITYSERVICE_IID);
-+//
-+// // cache accessibilityService
-+// accessibilityServiceCache = new SoftReference<nsIAccessibilityService>(accessibilityService);
-+// }
-+// return accessibilityService;
-+// }
-
- /**
- * Returns on screen bounds of the {@code node}
-@@ -264,8 +259,8 @@
- */
- public static Rectangle getBounds(nsIDOMNode node) {
- Rectangle bounds = null;
--
-- nsIAccessible accessible = getAccessibilityService().getAccessibleFor(node);
-+
-+ nsIAccessible accessible = (nsIAccessible) node.queryInterface(nsIAccessible.NS_IACCESSIBLE_IID);
- if (accessible != null) {
- int[] xArray = new int[1]; // Left hand corner of the node
- int[] yArray = new int[1]; // Top corner of the node
-Index: trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/XulRunnerBrowser.java
-===================================================================
---- trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/XulRunnerBrowser.java (revision 17893)
-+++ trunk/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/browser/XulRunnerBrowser.java (working copy)
-@@ -50,8 +50,8 @@
-
- public class XulRunnerBrowser implements nsIWebBrowserChrome,
- nsIWebProgressListener, nsITooltipListener {
-- private static final String XULRUNNER_LOWER_VERSION = "1.8.1.2"; //$NON-NLS-1$
-- private static final String XULRUNNER_HIGHER_VERSION = "1.8.1.9"; //$NON-NLS-1$
-+ private static final String XULRUNNER_LOWER_VERSION = "1.9.1.0"; //$NON-NLS-1$
-+ private static final String XULRUNNER_HIGHER_VERSION = "1.9.1.9"; //$NON-NLS-1$
- // TODO Sergey Vasilyev Think. May be XULRUNNER_BUNDLE shouldn't be final?
- private static final String XULRUNNER_BUNDLE;
- private static final String XULRUNNER_ENTRY = "/xulrunner"; //$NON-NLS-1$
@@ -82,7 +82,7 @@
}
@@ -142,9 +22,59 @@
browser = new Browser(parent, SWT.MOZILLA);
+Index: trunk/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlTextTemplate.java
+===================================================================
+--- trunk/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlTextTemplate.java (revision 17955)
++++ trunk/vpe/plugins/org.jboss.tools.vpe.html/src/org/jboss/tools/vpe/html/template/HtmlTextTemplate.java (working copy)
+@@ -19,14 +19,12 @@
+ import org.jboss.tools.vpe.editor.mapping.VpeElementData;
+ import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
+ import org.jboss.tools.vpe.editor.template.VpeCreationData;
+-import org.jboss.tools.vpe.editor.util.NodesManagingUtil;
+ import org.jboss.tools.vpe.editor.util.TextUtil;
+ import org.jboss.tools.vpe.editor.util.VisualDomUtil;
+ import org.mozilla.interfaces.nsIDOMDocument;
+ import org.mozilla.interfaces.nsIDOMElement;
+ import org.mozilla.interfaces.nsIDOMNode;
+ import org.w3c.dom.Node;
+-import org.w3c.dom.ranges.RangeException;
+
+ /**
+ * @author mareshkau
+@@ -42,7 +40,7 @@
+ String sourceText = sourceNode.getNodeValue();
+
+ if (sourceText.trim().length() <= 0) {
+- return new VpeCreationData(visualDocument.createTextNode(sourceText));
++ return new VpeCreationData(visualDocument.createTextNode("")); //$NON-NLS-1$
+ }
+ String visualText = TextUtil.visualText(sourceText);
+
+Index: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
+===================================================================
+--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java (revision 17955)
++++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java (working copy)
+@@ -2013,6 +2013,8 @@
+ styleClasses = ATTR_DRAG_AVAILABLE_CLASS + " " //$NON-NLS-1$
+ + styleClasses;
+ }
++ //if mouse in drag area, and left button is pressed than we should
++ //start drag session manually.
+ } else {
+ // change cursor style to normal
+ if (styleClasses != null) {
+@@ -2025,7 +2027,7 @@
+ }
+ }
+
+- private boolean inDragArea(Rectangle dragArea, Point mousePoint) {
++ public static boolean inDragArea(Rectangle dragArea, Point mousePoint) {
+ // TODO add drag and drop support
+ return dragArea.contains(mousePoint)
+ && mousePoint.x < (dragArea.x + DRAG_AREA_WIDTH)
Index: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java
===================================================================
---- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java (revision 17893)
+--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java (revision 17955)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/mozilla/MozillaEditor.java (working copy)
@@ -923,7 +923,7 @@
nsIEditingSession iEditingSession = (nsIEditingSession) getXulRunnerEditor().
@@ -157,7 +87,7 @@
//getting some editor to disable some actions
Index: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VisualDomUtil.java
===================================================================
---- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VisualDomUtil.java (revision 17893)
+--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VisualDomUtil.java (revision 17955)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VisualDomUtil.java (working copy)
@@ -10,18 +10,14 @@
******************************************************************************/
@@ -247,3 +177,59 @@
if (accessible != null) {
int[] xArray = new int[1]; // Left hand corner of the node
int[] yArray = new int[1]; // Top corner of the node
+Index: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
+===================================================================
+--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java (revision 17955)
++++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java (working copy)
+@@ -18,6 +18,7 @@
+ import org.eclipse.core.runtime.IPath;
+ import org.eclipse.core.runtime.IProgressMonitor;
+ import org.eclipse.core.runtime.IStatus;
++import org.eclipse.core.runtime.Platform;
+ import org.eclipse.core.runtime.Status;
+ import org.eclipse.core.runtime.jobs.Job;
+ import org.eclipse.jface.action.MenuManager;
+@@ -129,6 +130,7 @@
+ import org.jboss.tools.vpe.resref.core.TaglibReferenceList;
+ import org.jboss.tools.vpe.selbar.SelectionBar;
+ import org.jboss.tools.vpe.xulrunner.editor.XulRunnerEditor;
++import org.jboss.tools.vpe.xulrunner.editor.XulRunnerVpeUtils;
+ import org.mozilla.interfaces.nsIDOMDocument;
+ import org.mozilla.interfaces.nsIDOMElement;
+ import org.mozilla.interfaces.nsIDOMEvent;
+@@ -179,7 +181,7 @@
+ private VpePageContext pageContext;
+ private BundleMap bundle;
+ private VpeEditorPart editPart;
+- private static final int LEFT_BUTTON = 0;
++ public static final int LEFT_BUTTON = 0;
+
+ private CSSReferenceList cssReferenceListListener;
+ private TaglibReferenceList taglibReferenceListListener;
+@@ -1096,8 +1098,17 @@
+ // }
+
+ // selection will be set only if press left button
+- if (mouseEvent.getButton() == LEFT_BUTTON)
++ if (mouseEvent.getButton() == LEFT_BUTTON) {
+ selectionManager.setSelection(mouseEvent);
++ //drag gesture isn't generated in XR 1.9 for Linux Platforms, so we start it's manually
++ //mareshkau
++ nsIDOMElement selectedElement = getXulRunnerEditor().getLastSelectedElement();
++ if (Platform.OS_LINUX.equals(Platform.getOS()) &&
++ VpeVisualDomBuilder.inDragArea(XulRunnerVpeUtils.getElementBounds(selectedElement), VisualDomUtil
++ .getMousePoint(mouseEvent))) {
++ dragGesture(mouseEvent);
++ }
++ }
+ } finally {
+ switcher.stopActiveEditor();
+ }
+@@ -1313,6 +1324,7 @@
+ boolean canDragFlag = canInnerDrag(mouseEvent);
+ // start drag sessionvpe-element
+ if (canDragFlag) {
++
+ startDragSession(domEvent);
+ }
+ }
16 years, 6 months
JBoss Tools SVN: r17955 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2009-10-07 08:38:03 -0400 (Wed, 07 Oct 2009)
New Revision: 17955
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRefactorSearcher.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4771
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRefactorSearcher.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRefactorSearcher.java 2009-10-07 12:28:43 UTC (rev 17954)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRefactorSearcher.java 2009-10-07 12:38:03 UTC (rev 17955)
@@ -454,11 +454,10 @@
if (javaElement instanceof IType
&& segmentJavaElement instanceof IType) {
if (EclipseJavaUtil.isDerivedClass(
- ((IType) segmentJavaElement)
- .getFullyQualifiedName(),
- ((IType) javaElement).getFullyQualifiedName(), file
- .getProject()))
- ;
+ ((IType) javaElement).getFullyQualifiedName(),
+ ((IType) segmentJavaElement).getFullyQualifiedName(),
+ file.getProject()))
+ match(file, offset, length, true);
} else if (javaElement.equals(segmentJavaElement))
match(file, offset, length, true);
}
16 years, 6 months
JBoss Tools SVN: r17954 - 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: 2009-10-07 08:28:43 -0400 (Wed, 07 Oct 2009)
New Revision: 17954
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/Generated.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/GenerationTime.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernateNamedColumn.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaBasicMappingImpl.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/GeneratedAnnotation.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/GeneratedAnnotationImpl.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/GeneratedComposite.java
Removed:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernateBaseColumn.java
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/HibernateJpaFactory.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernateColumn.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernateDiscriminatorColumn.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernateEntity.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernateJoinColumn.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaColumnImpl.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/orm/HibernateOrmEntity.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/orm/HibernateOrmEntityImpl.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/HibernateAbstractInheritanceComposite.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/HibernateBasicMappingComposite.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/HibernateDiscriminatorColumnComposite.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/HibernateUIMappingMessages.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/messages.properties
Log:
https://jira.jboss.org/jira/browse/JBIDE-4665
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 2009-10-07 11:21:00 UTC (rev 17953)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaAnnotationDefinitionProvider.java 2009-10-07 12:28:43 UTC (rev 17954)
@@ -20,6 +20,7 @@
import org.jboss.tools.hibernate.jpt.core.internal.resource.java.HibernateNamedQueriesAnnotationDefinition;
import org.jboss.tools.hibernate.jpt.core.internal.resource.java.HibernateNamedQueryAnnotationDefinition;
import org.jboss.tools.hibernate.jpt.core.internal.resource.java.DiscriminatorFormulaAnnotationImpl.DiscriminatorFormulaAnnotationDefinition;
+import org.jboss.tools.hibernate.jpt.core.internal.resource.java.GeneratedAnnotationImpl.GeneratedAnnotationDefinition;
import org.jboss.tools.hibernate.jpt.core.internal.resource.java.GenericGeneratorAnnotationImpl.GenericGeneratorAnnotationDefinition;
import org.jboss.tools.hibernate.jpt.core.internal.resource.java.SourceGenericGeneratorsAnnotation.GenericGeneratorsAnnotationDefinition;
@@ -68,5 +69,6 @@
@Override
protected void addAttributeSupportingAnnotationDefinitionsTo(List<AnnotationDefinition> definitions) {
definitions.add(GenericGeneratorAnnotationDefinition.instance());
+ definitions.add(GeneratedAnnotationDefinition.instance());
}
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaFactory.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaFactory.java 2009-10-07 11:21:00 UTC (rev 17953)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/HibernateJpaFactory.java 2009-10-07 12:28:43 UTC (rev 17954)
@@ -13,6 +13,7 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jpt.core.JpaProject;
import org.eclipse.jpt.core.context.XmlContextNode;
+import org.eclipse.jpt.core.context.java.JavaBasicMapping;
import org.eclipse.jpt.core.context.java.JavaColumn;
import org.eclipse.jpt.core.context.java.JavaDiscriminatorColumn;
import org.eclipse.jpt.core.context.java.JavaEmbeddable;
@@ -60,6 +61,7 @@
import org.jboss.tools.hibernate.jpt.core.internal.context.HibernateNamedNativeQuery;
import org.jboss.tools.hibernate.jpt.core.internal.context.HibernateNamedQuery;
import org.jboss.tools.hibernate.jpt.core.internal.context.HibernatePersistenceUnit;
+import org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateJavaBasicMappingImpl;
import org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateJavaColumnImpl;
import org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateJavaDiscriminatorColumnImpl;
import org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateJavaEmbeddable;
@@ -206,6 +208,10 @@
return new HibernateJavaTableImpl(parent);
}
+ public JavaBasicMapping buildJavaBasicMapping(JavaPersistentAttribute parent) {
+ return new HibernateJavaBasicMappingImpl(parent);
+ }
+
// ********** ORM Context Model **********
@Override
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/Generated.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/Generated.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/Generated.java 2009-10-07 12:28:43 UTC (rev 17954)
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.hibernate.jpt.core.internal.context;
+
+import org.eclipse.jpt.core.context.JpaContextNode;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+public interface Generated extends JpaContextNode {
+
+ GenerationTime getGenerationTime();
+
+ void setGenerationTime(GenerationTime value);
+ String GENERATION_TIME_PROPERTY = "value"; //$NON-NLS-1$
+
+}
Property changes on: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/Generated.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/GenerationTime.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/GenerationTime.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/GenerationTime.java 2009-10-07 12:28:43 UTC (rev 17954)
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.hibernate.jpt.core.internal.context;
+
+import org.jboss.tools.hibernate.jpt.core.internal.context.basic.Hibernate;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ * Corresponds to the Hibernate enum
+ * org.hibernate.annotations.GenerationTime
+ *
+ * Provisional API: This interface is part of an interim API that is still under
+ * development and expected to change significantly before reaching stability.
+ * It is available at this early stage to solicit feedback from pioneering
+ * adopters on the understanding that any code that uses this API will almost
+ * certainly be broken (repeatedly) as the API evolves.
+ */
+public enum GenerationTime {
+
+ NEVER(Hibernate.GENERATION_TIME__NEVER),
+ INSERT(Hibernate.GENERATION_TIME__INSERT),
+ ALWAYS(Hibernate.GENERATION_TIME__ALWAYS);
+
+ private String javaAnnotationValue;
+
+ GenerationTime(String javaAnnotationValue) {
+ if (javaAnnotationValue == null) {
+ throw new NullPointerException();
+ }
+ this.javaAnnotationValue = javaAnnotationValue;
+ }
+
+ public String getJavaAnnotationValue() {
+ return this.javaAnnotationValue;
+ }
+
+ // ********** static methods **********
+
+ public static GenerationTime fromJavaAnnotationValue(Object javaAnnotationValue) {
+ return (javaAnnotationValue == null) ? null : fromJavaAnnotationValue_(javaAnnotationValue);
+ }
+
+ private static GenerationTime fromJavaAnnotationValue_(Object javaAnnotationValue) {
+ for (GenerationTime generationTime : GenerationTime.values()) {
+ if (generationTime.getJavaAnnotationValue().equals(javaAnnotationValue)) {
+ return generationTime;
+ }
+ }
+ return null;
+ }
+
+ public static String toJavaAnnotationValue(GenerationTime generationTime) {
+ return (generationTime == null) ? null : generationTime.getJavaAnnotationValue();
+ }
+
+}
Property changes on: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/GenerationTime.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Deleted: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernateBaseColumn.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernateBaseColumn.java 2009-10-07 11:21:00 UTC (rev 17953)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernateBaseColumn.java 2009-10-07 12:28:43 UTC (rev 17954)
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.hibernate.jpt.core.internal.context;
-
-import org.eclipse.jpt.core.context.BaseColumn;
-
-/**
- * @author Dmitry Geraskov
- *
- */
-public interface HibernateBaseColumn extends BaseColumn {
-
- String getDBColumnName();
-
- String getSpecifiedDBColumnName();
-
- String getDefaultDBColumnName();
-
-}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernateColumn.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernateColumn.java 2009-10-07 11:21:00 UTC (rev 17953)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernateColumn.java 2009-10-07 12:28:43 UTC (rev 17954)
@@ -16,13 +16,7 @@
* @author Dmitry Geraskov
*
*/
-public interface HibernateColumn extends Column {
-
- String getDBColumnName();
-
- String getSpecifiedDBColumnName();
-
- String getDefaultDBColumnName();
+public interface HibernateColumn extends Column, HibernateNamedColumn {
//**** Table ****
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernateDiscriminatorColumn.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernateDiscriminatorColumn.java 2009-10-07 11:21:00 UTC (rev 17953)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernateDiscriminatorColumn.java 2009-10-07 12:28:43 UTC (rev 17954)
@@ -17,12 +17,8 @@
* @author Dmitry Geraskov
*
*/
-public interface HibernateDiscriminatorColumn extends DiscriminatorColumn {
+public interface HibernateDiscriminatorColumn extends DiscriminatorColumn,
+HibernateNamedColumn {
- String getDBColumnName();
-
- String getSpecifiedDBColumnName();
-
- String getDefaultDBColumnName();
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernateEntity.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernateEntity.java 2009-10-07 11:21:00 UTC (rev 17953)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernateEntity.java 2009-10-07 12:28:43 UTC (rev 17954)
@@ -21,12 +21,6 @@
String DISCRIMINATOR_FORMULA_PROPERTY = "discriminatorFormula"; //$NON-NLS-1$
- DiscriminatorFormula getDiscriminatorFormula();
-
- DiscriminatorFormula addDiscriminatorFormula();
-
- void removeDiscriminatorFormula();
-
HibernateTable getTable();
//Column getPrimaryIdColumn();
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernateJoinColumn.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernateJoinColumn.java 2009-10-07 11:21:00 UTC (rev 17953)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernateJoinColumn.java 2009-10-07 12:28:43 UTC (rev 17954)
@@ -18,14 +18,8 @@
* @author Dmitry Geraskov
*
*/
-public interface HibernateJoinColumn extends JoinColumn {
+public interface HibernateJoinColumn extends JoinColumn, HibernateNamedColumn {
- String getDBColumnName();
-
- String getSpecifiedDBColumnName();
-
- String getDefaultDBColumnName();
-
//**** referenced column
String getReferencedDBColumnName();
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernateNamedColumn.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernateNamedColumn.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernateNamedColumn.java 2009-10-07 12:28:43 UTC (rev 17954)
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.hibernate.jpt.core.internal.context;
+
+import org.eclipse.jpt.core.context.NamedColumn;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+public interface HibernateNamedColumn extends NamedColumn {
+
+ String getDBColumnName();
+
+ String getSpecifiedDBColumnName();
+
+ String getDefaultDBColumnName();
+
+}
Property changes on: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/HibernateNamedColumn.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaBasicMappingImpl.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaBasicMappingImpl.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaBasicMappingImpl.java 2009-10-07 12:28:43 UTC (rev 17954)
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.hibernate.jpt.core.internal.context.java;
+
+import java.util.Iterator;
+
+import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
+import org.eclipse.jpt.core.internal.context.java.AbstractJavaBasicMapping;
+import org.eclipse.jpt.core.resource.java.JPA;
+import org.eclipse.jpt.utility.internal.iterators.ArrayIterator;
+import org.jboss.tools.hibernate.jpt.core.internal.context.Generated;
+import org.jboss.tools.hibernate.jpt.core.internal.context.GenerationTime;
+import org.jboss.tools.hibernate.jpt.core.internal.context.basic.Hibernate;
+import org.jboss.tools.hibernate.jpt.core.internal.resource.java.GeneratedAnnotation;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+public class HibernateJavaBasicMappingImpl extends AbstractJavaBasicMapping
+implements Generated {
+
+ protected GenerationTime specifiedGenerationTime;
+
+ public HibernateJavaBasicMappingImpl(JavaPersistentAttribute parent) {
+ super(parent);
+ }
+
+ public Iterator<String> supportingAnnotationNames() {
+ return new ArrayIterator<String>(
+ JPA.COLUMN,
+ JPA.LOB,
+ JPA.TEMPORAL,
+ JPA.ENUMERATED,
+ Hibernate.GENERATED);
+ }
+
+ @Override
+ protected void initialize() {
+ super.initialize();
+ this.specifiedGenerationTime = this.getResourceGenerationTime();
+ }
+
+ public GeneratedAnnotation getResourceGenerated() {
+ return (GeneratedAnnotation) getResourcePersistentAttribute().getSupportingAnnotation(GeneratedAnnotation.ANNOTATION_NAME);
+ }
+
+ public GeneratedAnnotation addResourceGenerated() {
+ return (GeneratedAnnotation) getResourcePersistentAttribute().addSupportingAnnotation(GeneratedAnnotation.ANNOTATION_NAME);
+ }
+
+ public void removeResourceGenerated() {
+ getResourcePersistentAttribute().removeSupportingAnnotation(GeneratedAnnotation.ANNOTATION_NAME);
+ }
+
+ protected GenerationTime getResourceGenerationTime(){
+ GeneratedAnnotation geneatedAnnotation = getResourceGenerated();
+ return geneatedAnnotation == null ? null : geneatedAnnotation.getValue();
+ }
+
+ public GenerationTime getGenerationTime() {
+ return this.specifiedGenerationTime;
+ }
+
+ public void setGenerationTime(GenerationTime newValue) {
+ GenerationTime oldValue = this.specifiedGenerationTime;
+ this.specifiedGenerationTime = newValue;
+ if (newValue != null){
+ GeneratedAnnotation annotation = getResourceGenerated() != null
+ ? getResourceGenerated()
+ : addResourceGenerated();
+ annotation.setValue(newValue);
+ } else {
+ removeResourceGenerated();
+ }
+ firePropertyChanged(Generated.GENERATION_TIME_PROPERTY, oldValue, newValue);
+ }
+
+ public void setGenerationTime_(GenerationTime newGenerationTime) {
+ GenerationTime oldValue = this.specifiedGenerationTime;
+ this.specifiedGenerationTime = newGenerationTime;
+ firePropertyChanged(Generated.GENERATION_TIME_PROPERTY, oldValue, newGenerationTime);
+ }
+
+ @Override
+ protected void update() {
+ super.update();
+ this.setGenerationTime_(this.getResourceGenerationTime());
+ }
+
+}
Property changes on: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaBasicMappingImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaColumnImpl.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaColumnImpl.java 2009-10-07 11:21:00 UTC (rev 17953)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaColumnImpl.java 2009-10-07 12:28:43 UTC (rev 17954)
@@ -13,6 +13,7 @@
import org.eclipse.jpt.core.context.java.JavaColumn;
import org.eclipse.jpt.core.context.java.JavaJpaContextNode;
import org.eclipse.jpt.core.internal.context.java.GenericJavaColumn;
+import org.eclipse.jpt.core.resource.java.ColumnAnnotation;
import org.eclipse.jpt.db.Column;
import org.eclipse.jpt.db.Table;
import org.eclipse.wst.validation.internal.core.Message;
@@ -28,7 +29,7 @@
*
*/
public class HibernateJavaColumnImpl extends GenericJavaColumn implements HibernateJavaColumn {
-
+
public HibernateJavaColumnImpl(JavaJpaContextNode parent, JavaColumn.Owner owner) {
super(parent, owner);
}
@@ -37,6 +38,14 @@
public HibernateJpaProject getJpaProject() {
return (HibernateJpaProject) super.getJpaProject();
}
+
+ @Override
+ public void initialize(ColumnAnnotation column) {
+ super.initialize(column);
+ //this.initializGenerated();
+ }
+
+ //********* DB Column name ******************
@Override
public Column getDbColumn() {
@@ -82,6 +91,8 @@
}
return super.buildDefaultName();
}
+
+ //************ DB Table name ***********
public String getDBTableName() {
return getSpecifiedDBTableName() != null ? getSpecifiedDBTableName()
@@ -107,4 +118,31 @@
return this.getSpecifiedTable();
}
+ //********** Generated ************
+ /*private void initializGenerated() {
+ GeneratedAnnotation generatedResource = getGeneratedResource();
+ if (generatedResource != null) {
+ this.generated = buildGenerated(generatedResource);
+ }
+ }
+
+ public GeneratedAnnotation getGeneratedResource() {
+ return (GeneratedAnnotation) this.javaResourcePersistentType.getSupportingAnnotation(GeneratedAnnotation.ANNOTATION_NAME);
+ }
+
+ public JavaGenerated addGenerated() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public JavaGenerated getGenerated() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void removeGenerated() {
+ // TODO Auto-generated method stub
+
+ }*/
+
}
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 2009-10-07 11:21:00 UTC (rev 17953)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/java/HibernateJavaEntity.java 2009-10-07 12:28:43 UTC (rev 17954)
@@ -22,6 +22,8 @@
JavaDiscriminatorFormula getDiscriminatorFormula();
JavaDiscriminatorFormula addDiscriminatorFormula();
+
+ void removeDiscriminatorFormula();
HibernateJavaTable getTable();
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/orm/HibernateOrmEntity.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/orm/HibernateOrmEntity.java 2009-10-07 11:21:00 UTC (rev 17953)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/orm/HibernateOrmEntity.java 2009-10-07 12:28:43 UTC (rev 17954)
@@ -12,7 +12,6 @@
package org.jboss.tools.hibernate.jpt.core.internal.context.orm;
import org.eclipse.jpt.core.context.orm.OrmEntity;
-import org.jboss.tools.hibernate.jpt.core.internal.context.DiscriminatorFormula;
import org.jboss.tools.hibernate.jpt.core.internal.context.HibernateEntity;
/**
@@ -21,9 +20,6 @@
*/
public interface HibernateOrmEntity extends HibernateEntity, OrmEntity {
- DiscriminatorFormula getDiscriminatorFormula();
-
- DiscriminatorFormula addDiscriminatorFormula();
-
HibernateOrmTable getTable();
+
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/orm/HibernateOrmEntityImpl.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/orm/HibernateOrmEntityImpl.java 2009-10-07 11:21:00 UTC (rev 17953)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/context/orm/HibernateOrmEntityImpl.java 2009-10-07 12:28:43 UTC (rev 17954)
@@ -30,7 +30,6 @@
import org.hibernate.cfg.NamingStrategy;
import org.jboss.tools.hibernate.jpt.core.internal.HibernateJpaProject;
import org.jboss.tools.hibernate.jpt.core.internal.HibernateJptPlugin;
-import org.jboss.tools.hibernate.jpt.core.internal.context.DiscriminatorFormula;
import org.jboss.tools.hibernate.jpt.core.internal.context.GenericGenerator;
import org.jboss.tools.hibernate.jpt.core.internal.context.HibernateNamedNativeQuery;
import org.jboss.tools.hibernate.jpt.core.internal.context.HibernateNamedQuery;
@@ -139,16 +138,6 @@
//******** TODO **********
- public DiscriminatorFormula addDiscriminatorFormula() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public DiscriminatorFormula getDiscriminatorFormula() {
- // TODO Auto-generated method stub
- return null;
- }
-
public void removeDiscriminatorFormula() {
// TODO Auto-generated method stub
}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/GeneratedAnnotation.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/GeneratedAnnotation.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/GeneratedAnnotation.java 2009-10-07 12:28:43 UTC (rev 17954)
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.hibernate.jpt.core.internal.resource.java;
+
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.resource.java.Annotation;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.jboss.tools.hibernate.jpt.core.internal.context.GenerationTime;
+import org.jboss.tools.hibernate.jpt.core.internal.context.basic.Hibernate;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+public interface GeneratedAnnotation extends Annotation {
+ String ANNOTATION_NAME = Hibernate.GENERATED;
+
+ /**
+ * Corresponds to the 'value' element of the GeneratedAnnotation annotation.
+ * Return null if the element does not exist in the annotation
+ */
+ GenerationTime getValue();
+ String VALUE_PROPERTY = Hibernate.GENERATED__VALUE;
+
+ /**
+ * Corresponds to the 'value' element of the GeneratedAnnotation annotation.
+ * Setting to null will remove the element.
+ */
+ void setValue(GenerationTime value);
+
+ /**
+ * Return the {@link TextRange} for the 'value' element.
+ */
+ TextRange getValueTextRange(CompilationUnit astRoot);
+}
Property changes on: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/GeneratedAnnotation.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/GeneratedAnnotationImpl.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/GeneratedAnnotationImpl.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/GeneratedAnnotationImpl.java 2009-10-07 12:28:43 UTC (rev 17954)
@@ -0,0 +1,131 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.hibernate.jpt.core.internal.resource.java;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.ShortCircuitAnnotationElementAdapter;
+import org.eclipse.jpt.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.resource.java.Annotation;
+import org.eclipse.jpt.core.resource.java.AnnotationDefinition;
+import org.eclipse.jpt.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.core.utility.TextRange;
+import org.eclipse.jpt.core.utility.jdt.AnnotationElementAdapter;
+import org.eclipse.jpt.core.utility.jdt.Attribute;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationAdapter;
+import org.eclipse.jpt.core.utility.jdt.DeclarationAnnotationElementAdapter;
+import org.eclipse.jpt.core.utility.jdt.Member;
+import org.jboss.tools.hibernate.jpt.core.internal.context.GenerationTime;
+import org.jboss.tools.hibernate.jpt.core.internal.context.basic.Hibernate;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+public class GeneratedAnnotationImpl extends SourceAnnotation<Attribute> implements
+GeneratedAnnotation {
+
+ public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME);
+
+ private static final DeclarationAnnotationElementAdapter<String> VALUE_ADAPTER = buildValueAdapter(DECLARATION_ANNOTATION_ADAPTER);
+ private final AnnotationElementAdapter<String> valueAdapter;
+ private GenerationTime value;
+
+ protected GeneratedAnnotationImpl(JavaResourceNode parent, Attribute attribute) {
+ super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER);
+ this.valueAdapter = this.buildAdapter(VALUE_ADAPTER);
+ }
+
+ public void initialize(CompilationUnit astRoot) {
+ this.value = this.buildValue(astRoot);
+ }
+
+ public void update(CompilationUnit astRoot) {
+ this.setValue(this.buildValue(astRoot));
+ }
+
+ // ***** value
+ public GenerationTime getValue() {
+ return value;
+ }
+
+ public void setValue(GenerationTime value) {
+ if (this.attributeValueHasNotChanged(this.value, value)) {
+ return;
+ }
+ GenerationTime old = this.value;
+ this.value = value;
+ this.valueAdapter.setValue(GenerationTime.toJavaAnnotationValue(value));
+ this.firePropertyChanged(VALUE_PROPERTY, old, value);
+ }
+
+ private GenerationTime buildValue(CompilationUnit astRoot) {
+ return GenerationTime.fromJavaAnnotationValue(this.valueAdapter.getValue(astRoot));
+ }
+
+ public TextRange getValueTextRange(CompilationUnit astRoot) {
+ return this.getElementTextRange(VALUE_ADAPTER, astRoot);
+ }
+
+ public String getAnnotationName() {
+ return ANNOTATION_NAME;
+ }
+
+ AnnotationElementAdapter<String> buildAdapter(DeclarationAnnotationElementAdapter<String> daea) {
+ return new ShortCircuitAnnotationElementAdapter<String>(this.member, daea);
+ }
+
+ private static DeclarationAnnotationElementAdapter<String> buildValueAdapter(DeclarationAnnotationAdapter adapter) {
+ return new EnumDeclarationAnnotationElementAdapter(adapter, Hibernate.GENERATED__VALUE);
+ }
+
+ public static class GeneratedAnnotationDefinition implements AnnotationDefinition
+ {
+ // singleton
+ private static final GeneratedAnnotationDefinition INSTANCE = new GeneratedAnnotationDefinition();
+
+ /**
+ * Return the singleton.
+ */
+ public static AnnotationDefinition instance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Ensure non-instantiability.
+ */
+ private GeneratedAnnotationDefinition() {
+ super();
+ }
+
+ public Annotation buildAnnotation(JavaResourcePersistentMember parent, Member attribute) {
+ return new GeneratedAnnotationImpl(parent, (Attribute) attribute);
+ }
+
+ public String getAnnotationName() {
+ return GeneratedAnnotation.ANNOTATION_NAME;
+ }
+
+ public Annotation buildAnnotation(JavaResourcePersistentMember arg0,
+ IAnnotation arg1) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Annotation buildNullAnnotation(JavaResourcePersistentMember parent) {
+ throw new UnsupportedOperationException();
+ }
+
+ }
+
+}
Property changes on: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/GeneratedAnnotationImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/GeneratedComposite.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/GeneratedComposite.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/GeneratedComposite.java 2009-10-07 12:28:43 UTC (rev 17954)
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.hibernate.jpt.ui.internal.mapping.details;
+
+import java.util.Collection;
+
+import org.eclipse.jpt.ui.internal.widgets.EnumFormComboViewer;
+import org.eclipse.jpt.ui.internal.widgets.FormPane;
+import org.eclipse.swt.widgets.Composite;
+import org.jboss.tools.hibernate.jpt.core.internal.context.Generated;
+import org.jboss.tools.hibernate.jpt.core.internal.context.GenerationTime;
+
+/**
+ * @author Dmitry Geraskov
+ *
+ */
+public class GeneratedComposite extends FormPane<Generated> {
+ /**
+ * Creates a new <code>GeneratedComposite</code>.
+ *
+ * @param parentPane The parent container of this one
+ * @param parent The parent container
+ */
+ public GeneratedComposite(FormPane<? extends Generated> parentPane,
+ Composite parent) {
+
+ super(parentPane, parent);
+ }
+
+ private EnumFormComboViewer<Generated, GenerationTime> addGenerationTimeCombo(Composite container) {
+
+ return new EnumFormComboViewer<Generated, GenerationTime>(this, container) {
+
+ @Override
+ protected void addPropertyNames(Collection<String> propertyNames) {
+ super.addPropertyNames(propertyNames);
+ propertyNames.add(Generated.GENERATION_TIME_PROPERTY);
+ }
+
+ @Override
+ protected GenerationTime[] getChoices() {
+ return GenerationTime.values();
+ }
+
+ @Override
+ protected GenerationTime getDefaultValue() {
+ return null;
+ }
+
+ @Override
+ protected GenerationTime getValue() {
+ return getSubject().getGenerationTime();
+ }
+
+ @Override
+ protected void setValue(GenerationTime value) {
+ getSubject().setGenerationTime(value);
+ }
+
+ @Override
+ protected String displayString(GenerationTime value) {
+ return value == null ? null : value.toString();
+ }
+ };
+ }
+
+ @Override
+ protected void initializeLayout(Composite container) {
+
+ addLabeledComposite(
+ container,
+ HibernateUIMappingMessages.BasicGeneralSection_generated,
+ addGenerationTimeCombo(container),
+ null//TODO help
+ );
+ }
+}
Property changes on: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/GeneratedComposite.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/HibernateAbstractInheritanceComposite.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/HibernateAbstractInheritanceComposite.java 2009-10-07 11:21:00 UTC (rev 17953)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/HibernateAbstractInheritanceComposite.java 2009-10-07 12:28:43 UTC (rev 17954)
@@ -19,6 +19,7 @@
import org.eclipse.jpt.ui.internal.mappings.db.ColumnCombo;
import org.eclipse.jpt.ui.internal.mappings.details.AbstractEntityComposite;
import org.eclipse.jpt.ui.internal.mappings.details.AbstractInheritanceComposite;
+import org.eclipse.jpt.ui.internal.mappings.details.DiscriminatorColumnComposite;
import org.eclipse.jpt.ui.internal.util.ControlEnabler;
import org.eclipse.jpt.ui.internal.widgets.EnumFormComboViewer;
import org.eclipse.jpt.ui.internal.widgets.FormPane;
@@ -32,6 +33,7 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.jboss.tools.hibernate.jpt.core.internal.context.HibernateEntity;
+import org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateJavaEntity;
/**
* Here the layout of this pane:
@@ -103,6 +105,7 @@
super(parentPane, parent, false);
}
+ @SuppressWarnings("unchecked")
@Override
protected void initializeLayout(Composite container) {
@@ -141,7 +144,12 @@
new ControlEnabler(buildDiscriminatorValueEnabledHolder(), discriminatorValueCombo, discriminatorValueLabel);
- new HibernateDiscriminatorColumnComposite<HibernateEntity>(this, container);
+ if (getSubject() instanceof HibernateJavaEntity) {
+ new HibernateDiscriminatorColumnComposite((FormPane<? extends HibernateJavaEntity>) this, container);
+ } else {
+ new DiscriminatorColumnComposite<Entity>(this, container);
+ }
+
// Primary Key Join Columns widgets
addPrimaryKeyJoinColumnsComposite(addSubPane(container, 5));
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/HibernateBasicMappingComposite.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/HibernateBasicMappingComposite.java 2009-10-07 11:21:00 UTC (rev 17953)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/HibernateBasicMappingComposite.java 2009-10-07 12:28:43 UTC (rev 17954)
@@ -33,6 +33,7 @@
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
+import org.jboss.tools.hibernate.jpt.core.internal.context.Generated;
import org.jboss.tools.hibernate.jpt.core.internal.context.HibernateColumn;
/**
@@ -106,6 +107,7 @@
initializeTypePane(container);
}
+ @SuppressWarnings("unchecked")
private void initializeGeneralPane(Composite container) {
int groupBoxMargin = getGroupBoxMargin();
@@ -114,6 +116,10 @@
// Align the widgets under the ColumnComposite
container = addSubPane(container, 0, groupBoxMargin, 0, groupBoxMargin);
+ if (getSubject() instanceof Generated) {
+ new GeneratedComposite((FormPane<? extends Generated>) this, container);
+ }
+
new FetchTypeComposite(this, container);
new OptionalComposite(this, addSubPane(container, 4));
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/HibernateDiscriminatorColumnComposite.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/HibernateDiscriminatorColumnComposite.java 2009-10-07 11:21:00 UTC (rev 17953)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/HibernateDiscriminatorColumnComposite.java 2009-10-07 12:28:43 UTC (rev 17954)
@@ -38,7 +38,7 @@
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Spinner;
import org.jboss.tools.hibernate.jpt.core.internal.context.DiscriminatorFormula;
-import org.jboss.tools.hibernate.jpt.core.internal.context.HibernateEntity;
+import org.jboss.tools.hibernate.jpt.core.internal.context.java.HibernateJavaEntity;
import org.jboss.tools.hibernate.jpt.ui.internal.mappings.db.xpl.ColumnCombo;
/**
@@ -74,7 +74,7 @@
* @version 2.0
* @since 2.0
*/
-public class HibernateDiscriminatorColumnComposite <T extends HibernateEntity> extends FormPane<T> {
+public class HibernateDiscriminatorColumnComposite extends FormPane<HibernateJavaEntity> {
private WritablePropertyValueModel<DiscriminatorFormula> discriminatorFormulaHolder;
@@ -84,7 +84,7 @@
* @param parentPane The parent container of this one
* @param parent The parent container
*/
- public HibernateDiscriminatorColumnComposite(FormPane<? extends T> parentPane,
+ public HibernateDiscriminatorColumnComposite(FormPane<? extends HibernateJavaEntity> parentPane,
Composite parent) {
super(parentPane, parent, false);
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/HibernateUIMappingMessages.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/HibernateUIMappingMessages.java 2009-10-07 11:21:00 UTC (rev 17953)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/HibernateUIMappingMessages.java 2009-10-07 12:28:43 UTC (rev 17954)
@@ -44,6 +44,7 @@
public static String HibernateIdMappingComposite_genericGeneratorSection;
public static String HibernateIdMappingComposite_genericGeneratorCheckBox;
public static String HibernateDiscriminatorColumnComposite_formula;
+ public static String BasicGeneralSection_generated;
private HibernateUIMappingMessages() {}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/messages.properties
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/messages.properties 2009-10-07 11:21:00 UTC (rev 17953)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.ui/src/org/jboss/tools/hibernate/jpt/ui/internal/mapping/details/messages.properties 2009-10-07 12:28:43 UTC (rev 17954)
@@ -21,4 +21,5 @@
NameStateObject_nameAlreadyExists=The name already exists.
HibernateIdMappingComposite_genericGeneratorSection=Generic Generator
HibernateIdMappingComposite_genericGeneratorCheckBox=Generic generator
-HibernateDiscriminatorColumnComposite_formula=Formula:
\ No newline at end of file
+HibernateDiscriminatorColumnComposite_formula=Formula:
+BasicGeneralSection_generated = Generation Time:
\ No newline at end of file
16 years, 6 months
JBoss Tools SVN: r17953 - in trunk/hibernatetools: plugins/org.jboss.tools.hibernate.ui/META-INF and 8 other directories.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2009-10-07 07:21:00 -0400 (Wed, 07 Oct 2009)
New Revision: 17953
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/MessageShape.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/DiagramEditorInput.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/DiagramEditorInputFactory.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/DiagramEditorStorage.java
Removed:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/ObjectEditorInput.java
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/META-INF/MANIFEST.MF
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/plugin.xml
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/DiagramViewerMessages.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/DiagramViewerMessages.properties
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/DiagramContentOutlinePage.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/DiagramViewer.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/AutoLayoutAction.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/CollapseAllAction.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/DiagramBaseAction.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ExpandAllAction.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/OpenMappingAction.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/OpenSourceAction.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/RefreshAction.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/figures/TitleFigure.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/figures/TitleLabel.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/BaseElement.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/ComponentShape.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/ElementsFactory.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/ExpandableShape.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmDiagram.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmShape.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/Shape.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/Utils.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/DiagramEditPart.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/OrmEditPart.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/OrmEditPartFactory.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/OrmShapeEditPart.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ShapeEditPart.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/OpenDiagramActionDelegate.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/OrmImageMap.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/OrmLabelProvider.java
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.test/src/org/jboss/tools/hibernate/ui/diagram/editors/model/test/OrmDiagramTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4866 & https://jira.jboss.org/jira/browse/JBIDE-4964 - fixed
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/META-INF/MANIFEST.MF 2009-10-07 10:14:09 UTC (rev 17952)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/META-INF/MANIFEST.MF 2009-10-07 11:21:00 UTC (rev 17953)
@@ -12,7 +12,6 @@
org.eclipse.ui.views,
org.eclipse.core.runtime,
org.eclipse.gef,
- org.eclipse.ui.editors,
org.eclipse.core.resources,
org.hibernate.eclipse,
org.eclipse.jdt.core,
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/plugin.xml
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/plugin.xml 2009-10-07 10:14:09 UTC (rev 17952)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/plugin.xml 2009-10-07 11:21:00 UTC (rev 17953)
@@ -4,6 +4,8 @@
<extension
point="org.eclipse.ui.editors">
<editor
+ default="true"
+ extensions="hibernate"
class="org.jboss.tools.hibernate.ui.diagram.editors.DiagramViewer"
contributorClass="org.jboss.tools.hibernate.ui.diagram.editors.DiagramActionBarContributor"
icon="$nl$/icons/hibernate_small_icon.gif"
@@ -30,5 +32,12 @@
</action>
</objectContribution>
</extension>
+ <extension
+ point="org.eclipse.ui.elementFactories">
+ <factory
+ class="org.jboss.tools.hibernate.ui.view.DiagramEditorInputFactory"
+ id="org.jboss.tools.hibernate.ui.view.DiagramEditorInputFactory">
+ </factory>
+ </extension>
</plugin>
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/DiagramViewerMessages.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/DiagramViewerMessages.java 2009-10-07 10:14:09 UTC (rev 17952)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/DiagramViewerMessages.java 2009-10-07 11:21:00 UTC (rev 17953)
@@ -57,4 +57,5 @@
public static String TogglePropertyMappingAction_property_mappings;
public static String ToggleAssociationAction_associations;
public static String ToggleForeignKeyConstraintAction_foreign_key_constraints;
+ public static String MessageShape_warning;
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/DiagramViewerMessages.properties
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/DiagramViewerMessages.properties 2009-10-07 10:14:09 UTC (rev 17952)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/DiagramViewerMessages.properties 2009-10-07 11:21:00 UTC (rev 17953)
@@ -33,3 +33,4 @@
TogglePropertyMappingAction_property_mappings=Property Mappings
ToggleAssociationAction_associations=Associations
ToggleForeignKeyConstraintAction_foreign_key_constraints=Foreign key constraints
+MessageShape_warning=Hibernate Console Configuration is not loaded cause Hibernate plugins are not active. To activate Open Hibernate Configurations view and press refresh button.
\ No newline at end of file
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/DiagramContentOutlinePage.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/DiagramContentOutlinePage.java 2009-10-07 10:14:09 UTC (rev 17952)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/DiagramContentOutlinePage.java 2009-10-07 11:21:00 UTC (rev 17953)
@@ -378,7 +378,9 @@
setDescription(DiagramViewerMessages.DiagramViewer_OutlinePage_Sort_description);
boolean checked = getOrmDiagram().isDeepIntoSort();
- valueChanged(checked);
+ if (checked) {
+ valueChanged(checked);
+ }
}
public void run() {
@@ -389,15 +391,10 @@
setChecked(on);
BusyIndicator.showWhile(outline.getDisplay(), new Runnable() {
public void run() {
- if (on) {
- getOrmDiagram().setDeepIntoSort(true);
- getOrmDiagram().refresh();
- setContents(getOrmDiagram());
- } else {
- getOrmDiagram().setDeepIntoSort(false);
- getOrmDiagram().refresh();
- setContents(getOrmDiagram());
- }
+ final OrmDiagram od = getOrmDiagram();
+ od.setDeepIntoSort(on);
+ od.refresh();
+ setContents(od);
}
});
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/DiagramViewer.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/DiagramViewer.java 2009-10-07 10:14:09 UTC (rev 17952)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/DiagramViewer.java 2009-10-07 11:21:00 UTC (rev 17953)
@@ -18,6 +18,9 @@
import java.util.List;
import java.util.Set;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.draw2d.PositionConstants;
import org.eclipse.gef.DefaultEditDomain;
@@ -55,9 +58,9 @@
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.dialogs.SaveAsDialog;
+import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
-import org.hibernate.console.ConsoleConfiguration;
-import org.hibernate.mapping.RootClass;
import org.jboss.tools.hibernate.ui.diagram.DiagramViewerMessages;
import org.jboss.tools.hibernate.ui.diagram.editors.actions.ActionMenu;
import org.jboss.tools.hibernate.ui.diagram.editors.actions.AutoLayoutAction;
@@ -83,7 +86,7 @@
import org.jboss.tools.hibernate.ui.diagram.editors.popup.PopupMenuProvider;
import org.jboss.tools.hibernate.ui.diagram.rulers.DiagramRuler;
import org.jboss.tools.hibernate.ui.diagram.rulers.DiagramRulerProvider;
-import org.jboss.tools.hibernate.ui.view.ObjectEditorInput;
+import org.jboss.tools.hibernate.ui.view.DiagramEditorInput;
/**
*
@@ -92,7 +95,6 @@
*/
public class DiagramViewer extends GraphicalEditor {
- private OrmDiagram ormDiagram = null;
private GEFRootEditPart gefRootEditPart = new GEFRootEditPart();
private RulerComposite rulerComp;
@@ -102,11 +104,29 @@
public void doSave(IProgressMonitor monitor) {
saveProperties();
- ormDiagram.saveInFile();
- ormDiagram.setDirty(false);
+ //getOrmDiagram().saveInFile();
+ getOrmDiagram().saveInXmlFile();
+ getOrmDiagram().setDirty(false);
}
public void doSaveAs() {
+ SaveAsDialog saveAsDialog = new SaveAsDialog(getSite().getWorkbenchWindow().getShell());
+ saveAsDialog.setOriginalName(getDiagramName());
+ saveAsDialog.open();
+ final IPath pathSave = saveAsDialog.getResult();
+ if (pathSave == null) {
+ return;
+ }
+ saveProperties();
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IPath pathTmp = workspace.getRoot().getFullPath().append(pathSave);
+ pathTmp = workspace.getRoot().getLocation().append(pathTmp);
+ String ext = pathSave.getFileExtension();
+ if (ext == null) {
+ pathTmp = pathTmp.addFileExtension("hibernate"); //$NON-NLS-1$
+ }
+ getOrmDiagram().saveInFile(pathTmp, true);
+ getOrmDiagram().setDirty(false);
}
protected void initializeGraphicalViewer() {
@@ -125,7 +145,7 @@
//
viewer.setRootEditPart(gefRootEditPart);
viewer.addDropTargetListener(createTransferDropTargetListener());
- viewer.setContents(ormDiagram);
+ viewer.setContents(getOrmDiagram());
PopupMenuProvider provider = new PopupMenuProvider(viewer, getActionRegistry());
viewer.setContextMenu(provider);
@@ -134,20 +154,20 @@
viewer.setProperty(MouseWheelHandler.KeyGenerator.getKey(SWT.MOD1),
MouseWheelZoomHandler.SINGLETON);
// Ruler properties
- DiagramRuler ruler = ormDiagram.getRuler(PositionConstants.WEST);
+ DiagramRuler ruler = getOrmDiagram().getRuler(PositionConstants.WEST);
RulerProvider rulerProvider = null;
if (ruler != null) {
rulerProvider = new DiagramRulerProvider(ruler);
}
getGraphicalViewer().setProperty(RulerProvider.PROPERTY_VERTICAL_RULER, rulerProvider);
- ruler = ormDiagram.getRuler(PositionConstants.NORTH);
+ ruler = getOrmDiagram().getRuler(PositionConstants.NORTH);
rulerProvider = null;
if (ruler != null) {
rulerProvider = new DiagramRulerProvider(ruler);
}
getGraphicalViewer().setProperty(RulerProvider.PROPERTY_HORIZONTAL_RULER, rulerProvider);
getGraphicalViewer().setProperty(RulerProvider.PROPERTY_RULER_VISIBILITY,
- new Boolean(ormDiagram.getRulerVisibility()));
+ new Boolean(getOrmDiagram().getRulerVisibility()));
loadProperties();
}
@@ -260,7 +280,7 @@
}
public boolean isSaveAsAllowed() {
- return false;
+ return true;
}
public boolean isSaveOnCloseNeeded() {
@@ -272,34 +292,40 @@
}
public boolean isDirty() {
- return ormDiagram.isDirty();
+ return getOrmDiagram().isDirty();
}
protected void setInput(IEditorInput input) {
- ObjectEditorInput objectEditorInput = (ObjectEditorInput)input;
- ConsoleConfiguration configuration = objectEditorInput.getConfiguration();
- ArrayList<RootClass> roots = objectEditorInput.getRootClasses();
- setPartName(DiagramViewerMessages.DiagramViewer_diagram_for + " " + objectEditorInput.getName()); //$NON-NLS-1$
- if (roots.size() == 1) {
- RootClass rootClass = roots.get(0);
- ormDiagram = new OrmDiagram(configuration, rootClass);
- } else if (roots.size() > 1) {
- RootClass[] rootClasses = roots.toArray(new RootClass[0]);
- ormDiagram = new OrmDiagram(configuration, rootClasses);
+ DiagramEditorInput diagramInput = null;
+ if (input instanceof FileEditorInput) {
+ diagramInput = new DiagramEditorInput((FileEditorInput)input);
+ } else if (input instanceof DiagramEditorInput) {
+ diagramInput = (DiagramEditorInput)input;
}
- super.setInput(input);
+ setPartName(DiagramViewerMessages.DiagramViewer_diagram_for + " " + diagramInput.getName()); //$NON-NLS-1$
+ super.setInput(diagramInput);
loadProperties();
}
+ public DiagramEditorInput getDiagramInput() {
+ DiagramEditorInput diagramInput = (DiagramEditorInput)getEditorInput();
+ return diagramInput;
+ }
+
public String getDiagramName() {
IEditorInput input = getEditorInput();
- if (input instanceof ObjectEditorInput) {
- ObjectEditorInput objectEditorInput = (ObjectEditorInput)input;
+ if (input instanceof DiagramEditorInput) {
+ DiagramEditorInput objectEditorInput = (DiagramEditorInput)input;
return objectEditorInput.getName();
}
return ""; //$NON-NLS-1$
}
+ public void refresh() {
+ getOrmDiagram().refresh();
+ setPartName(DiagramViewerMessages.DiagramViewer_diagram_for + " " + getDiagramInput().getName()); //$NON-NLS-1$
+ }
+
/**
* @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
*/
@@ -310,7 +336,7 @@
new TreeViewer(), getActionRegistry());
outline.setGraphicalViewer(getGraphicalViewer());
outline.setSelectionSynchronizer(getSelectionSynchronizer());
- outline.setOrmDiagram(ormDiagram);
+ outline.setOrmDiagram(getOrmDiagram());
outline.setEditor(this);
RefreshAction refreshAction = (RefreshAction)getActionRegistry().getAction(
ActionFactory.REFRESH.getId());
@@ -337,8 +363,8 @@
return ret;
}
- public OrmDiagram getViewerContents() {
- return ormDiagram;
+ public OrmDiagram getOrmDiagram() {
+ return getDiagramInput().getOrmDiagram();
}
public DefaultEditDomain getDefaultEditDomain() {
@@ -361,56 +387,56 @@
}
protected boolean loadProperties() {
- if (ormDiagram == null || getGraphicalViewer() == null) {
+ if (getOrmDiagram() == null || getGraphicalViewer() == null) {
return false;
}
// Ruler properties
- DiagramRuler ruler = ormDiagram.getRuler(PositionConstants.WEST);
+ DiagramRuler ruler = getOrmDiagram().getRuler(PositionConstants.WEST);
RulerProvider provider = null;
if (ruler != null) {
provider = new DiagramRulerProvider(ruler);
}
getGraphicalViewer().setProperty(RulerProvider.PROPERTY_VERTICAL_RULER, provider);
- ruler = ormDiagram.getRuler(PositionConstants.NORTH);
+ ruler = getOrmDiagram().getRuler(PositionConstants.NORTH);
provider = null;
if (ruler != null) {
provider = new DiagramRulerProvider(ruler);
}
getGraphicalViewer().setProperty(RulerProvider.PROPERTY_HORIZONTAL_RULER, provider);
getGraphicalViewer().setProperty(RulerProvider.PROPERTY_RULER_VISIBILITY,
- new Boolean(ormDiagram.getRulerVisibility()));
+ new Boolean(getOrmDiagram().getRulerVisibility()));
// Snap to Geometry property
getGraphicalViewer().setProperty(SnapToGeometry.PROPERTY_SNAP_ENABLED,
- new Boolean(ormDiagram.isSnapToGeometryEnabled()));
+ new Boolean(getOrmDiagram().isSnapToGeometryEnabled()));
// Grid properties
getGraphicalViewer().setProperty(SnapToGrid.PROPERTY_GRID_ENABLED,
- new Boolean(ormDiagram.isGridEnabled()));
+ new Boolean(getOrmDiagram().isGridEnabled()));
// We keep grid visibility and enablement in sync
getGraphicalViewer().setProperty(SnapToGrid.PROPERTY_GRID_VISIBLE,
- new Boolean(ormDiagram.isGridEnabled()));
+ new Boolean(getOrmDiagram().isGridEnabled()));
// Zoom
ZoomManager manager = (ZoomManager)getGraphicalViewer()
.getProperty(ZoomManager.class.toString());
if (manager != null) {
- manager.setZoom(ormDiagram.getZoom());
+ manager.setZoom(getOrmDiagram().getZoom());
}
return true;
}
protected boolean saveProperties() {
- if (ormDiagram == null || getGraphicalViewer() == null) {
+ if (getOrmDiagram() == null || getGraphicalViewer() == null) {
return false;
}
- ormDiagram.setRulerVisibility(((Boolean)getGraphicalViewer()
+ getOrmDiagram().setRulerVisibility(((Boolean)getGraphicalViewer()
.getProperty(RulerProvider.PROPERTY_RULER_VISIBILITY)).booleanValue());
- ormDiagram.setGridEnabled(((Boolean)getGraphicalViewer()
+ getOrmDiagram().setGridEnabled(((Boolean)getGraphicalViewer()
.getProperty(SnapToGrid.PROPERTY_GRID_ENABLED)).booleanValue());
- ormDiagram.setSnapToGeometry(((Boolean)getGraphicalViewer()
+ getOrmDiagram().setSnapToGeometry(((Boolean)getGraphicalViewer()
.getProperty(SnapToGeometry.PROPERTY_SNAP_ENABLED)).booleanValue());
- ormDiagram.setZoom(getZoom());
+ getOrmDiagram().setZoom(getZoom());
return true;
}
@@ -494,44 +520,44 @@
public boolean getConnectionsVisibilityAssociation() {
- return getViewerContents().getConnectionsVisibilityAssociation();
+ return getOrmDiagram().getConnectionsVisibilityAssociation();
}
public void setConnectionsVisibilityAssociation(boolean connectionsVisibilityAssociation) {
- getViewerContents().setConnectionsVisibilityAssociation(connectionsVisibilityAssociation);
+ getOrmDiagram().setConnectionsVisibilityAssociation(connectionsVisibilityAssociation);
ActionRegistry registry = getActionRegistry();
IAction action = registry.getAction(ToggleAssociationAction.ACTION_ID);
action.setChecked(connectionsVisibilityAssociation);
}
public boolean getConnectionsVisibilityClassMapping() {
- return getViewerContents().getConnectionsVisibilityClassMapping();
+ return getOrmDiagram().getConnectionsVisibilityClassMapping();
}
public void setConnectionsVisibilityClassMapping(boolean connectionsVisibilityClassMapping) {
- getViewerContents().setConnectionsVisibilityClassMapping(connectionsVisibilityClassMapping);
+ getOrmDiagram().setConnectionsVisibilityClassMapping(connectionsVisibilityClassMapping);
ActionRegistry registry = getActionRegistry();
IAction action = registry.getAction(ToggleClassMappingAction.ACTION_ID);
action.setChecked(connectionsVisibilityClassMapping);
}
public boolean getConnectionsVisibilityForeignKeyConstraint() {
- return getViewerContents().getConnectionsVisibilityForeignKeyConstraint();
+ return getOrmDiagram().getConnectionsVisibilityForeignKeyConstraint();
}
public void setConnectionsVisibilityForeignKeyConstraint(boolean connectionsVisibilityForeignKeyConstraint) {
- getViewerContents().setConnectionsVisibilityForeignKeyConstraint(connectionsVisibilityForeignKeyConstraint);
+ getOrmDiagram().setConnectionsVisibilityForeignKeyConstraint(connectionsVisibilityForeignKeyConstraint);
ActionRegistry registry = getActionRegistry();
IAction action = registry.getAction(ToggleForeignKeyConstraintAction.ACTION_ID);
action.setChecked(connectionsVisibilityForeignKeyConstraint);
}
public boolean getConnectionsVisibilityPropertyMapping() {
- return getViewerContents().getConnectionsVisibilityPropertyMapping();
+ return getOrmDiagram().getConnectionsVisibilityPropertyMapping();
}
public void setConnectionsVisibilityPropertyMapping(boolean connectionsVisibilityPropertyMapping) {
- getViewerContents().setConnectionsVisibilityPropertyMapping(connectionsVisibilityPropertyMapping);
+ getOrmDiagram().setConnectionsVisibilityPropertyMapping(connectionsVisibilityPropertyMapping);
ActionRegistry registry = getActionRegistry();
IAction action = registry.getAction(TogglePropertyMappingAction.ACTION_ID);
action.setChecked(connectionsVisibilityPropertyMapping);
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/AutoLayoutAction.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/AutoLayoutAction.java 2009-10-07 10:14:09 UTC (rev 17952)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/AutoLayoutAction.java 2009-10-07 11:21:00 UTC (rev 17953)
@@ -32,6 +32,6 @@
}
public void run() {
- getDiagramViewer().getViewerContents().autolayout();
+ getDiagramViewer().getOrmDiagram().autolayout();
}
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/CollapseAllAction.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/CollapseAllAction.java 2009-10-07 10:14:09 UTC (rev 17952)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/CollapseAllAction.java 2009-10-07 11:21:00 UTC (rev 17953)
@@ -29,6 +29,6 @@
}
public void run() {
- getDiagramViewer().getViewerContents().collapseAll();
+ getDiagramViewer().getOrmDiagram().collapseAll();
}
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/DiagramBaseAction.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/DiagramBaseAction.java 2009-10-07 10:14:09 UTC (rev 17952)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/DiagramBaseAction.java 2009-10-07 11:21:00 UTC (rev 17953)
@@ -11,7 +11,9 @@
package org.jboss.tools.hibernate.ui.diagram.editors.actions;
import org.eclipse.jface.action.Action;
+import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.views.contentoutline.ContentOutline;
import org.jboss.tools.hibernate.ui.diagram.editors.DiagramContentOutlinePage;
@@ -35,7 +37,15 @@
protected DiagramViewer getDiagramViewer() {
DiagramViewer res = editor;
- IWorkbenchPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart();
+ final IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ if (workbenchWindow == null) {
+ return res;
+ }
+ final IWorkbenchPage workbenchPage = workbenchWindow.getActivePage();
+ if (workbenchPage == null) {
+ return res;
+ }
+ IWorkbenchPart part = workbenchPage.getActivePart();
if (part instanceof DiagramViewer) {
res = (DiagramViewer)part;
} else if (part instanceof ContentOutline) {
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ExpandAllAction.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ExpandAllAction.java 2009-10-07 10:14:09 UTC (rev 17952)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ExpandAllAction.java 2009-10-07 11:21:00 UTC (rev 17953)
@@ -29,6 +29,6 @@
}
public void run() {
- getDiagramViewer().getViewerContents().expandAll();
+ getDiagramViewer().getOrmDiagram().expandAll();
}
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/OpenMappingAction.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/OpenMappingAction.java 2009-10-07 10:14:09 UTC (rev 17952)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/OpenMappingAction.java 2009-10-07 11:21:00 UTC (rev 17953)
@@ -28,7 +28,7 @@
import org.jboss.tools.hibernate.ui.diagram.editors.DiagramViewer;
import org.jboss.tools.hibernate.ui.diagram.editors.model.Shape;
import org.jboss.tools.hibernate.ui.diagram.editors.model.SpecialRootClass;
-import org.jboss.tools.hibernate.ui.view.ObjectEditorInput;
+import org.jboss.tools.hibernate.ui.view.DiagramEditorInput;
/**
* @author Dmitry Geraskov
@@ -47,8 +47,8 @@
}
public void run() {
- ObjectEditorInput objectEditorInput = (ObjectEditorInput)((DiagramViewer)getWorkbenchPart()).getEditorInput();
- ConsoleConfiguration consoleConfig = objectEditorInput.getConfiguration();
+ DiagramEditorInput objectEditorInput = (DiagramEditorInput)((DiagramViewer)getWorkbenchPart()).getEditorInput();
+ ConsoleConfiguration consoleConfig = objectEditorInput.getConsoleConfig();
DiagramViewer part = (DiagramViewer)getWorkbenchPart();
Set<Shape> selectedElements = part.getSelectedElements();
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/OpenSourceAction.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/OpenSourceAction.java 2009-10-07 10:14:09 UTC (rev 17952)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/OpenSourceAction.java 2009-10-07 11:21:00 UTC (rev 17953)
@@ -30,7 +30,7 @@
import org.jboss.tools.hibernate.ui.diagram.editors.DiagramViewer;
import org.jboss.tools.hibernate.ui.diagram.editors.model.Connection;
import org.jboss.tools.hibernate.ui.diagram.editors.model.Shape;
-import org.jboss.tools.hibernate.ui.view.ObjectEditorInput;
+import org.jboss.tools.hibernate.ui.view.DiagramEditorInput;
/**
* @author Dmitry Geraskov
@@ -49,8 +49,8 @@
}
public void run() {
- ObjectEditorInput objectEditorInput = (ObjectEditorInput)((DiagramViewer)getWorkbenchPart()).getEditorInput();
- ConsoleConfiguration consoleConfig = objectEditorInput.getConfiguration();
+ DiagramEditorInput objectEditorInput = (DiagramEditorInput)((DiagramViewer)getWorkbenchPart()).getEditorInput();
+ ConsoleConfiguration consoleConfig = objectEditorInput.getConsoleConfig();
DiagramViewer part = (DiagramViewer)getWorkbenchPart();
Set<Shape> selectedElements = part.getSelectedElements();
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/RefreshAction.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/RefreshAction.java 2009-10-07 10:14:09 UTC (rev 17952)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/RefreshAction.java 2009-10-07 11:21:00 UTC (rev 17953)
@@ -36,7 +36,7 @@
}
public void run() {
- getDiagramViewer().getViewerContents().refresh();
+ getDiagramViewer().refresh();
if (outline != null) {
// synchronize contents of outline page
outline.setContents(outline.getOrmDiagram());
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/figures/TitleFigure.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/figures/TitleFigure.java 2009-10-07 10:14:09 UTC (rev 17952)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/figures/TitleFigure.java 2009-10-07 11:21:00 UTC (rev 17953)
@@ -18,6 +18,7 @@
import org.eclipse.draw2d.PositionConstants;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.RGB;
@@ -59,10 +60,15 @@
removeTitle();
TitleLabel label = new TitleLabel(fontHeight);
label.setText(text);
- FontData fontData[] = Display.getCurrent().getSystemFont().getFontData();
- fontData[0].setStyle(SWT.BOLD);
- fontData[0].height = fontHeight;
- label.setFont(ResourceManager.getInstance().getFont(fontData[0]));
+ if (Display.getCurrent() != null) {
+ final Font font = Display.getCurrent().getSystemFont();
+ if (font != null) {
+ FontData fontData[] = font.getFontData();
+ fontData[0].setStyle(SWT.BOLD);
+ fontData[0].height = fontHeight;
+ label.setFont(ResourceManager.getInstance().getFont(fontData[0]));
+ }
+ }
label.setBackgroundColor(bg);
label.setIcon(icon);
label.setLabelAlignment(PositionConstants.LEFT);
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/figures/TitleLabel.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/figures/TitleLabel.java 2009-10-07 10:14:09 UTC (rev 17952)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/figures/TitleLabel.java 2009-10-07 11:21:00 UTC (rev 17953)
@@ -14,6 +14,7 @@
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
@@ -37,9 +38,14 @@
protected boolean expanded = true;
public TitleLabel(float fontHeight) {
- FontData fontData[] = Display.getCurrent().getSystemFont().getFontData();
- fontData[0].height = fontHeight;
- setFont(ResourceManager.getInstance().getFont(fontData[0]));
+ if (Display.getCurrent() != null) {
+ final Font font = Display.getCurrent().getSystemFont();
+ if (font != null) {
+ FontData fontData[] = font.getFontData();
+ fontData[0].height = fontHeight;
+ setFont(ResourceManager.getInstance().getFont(fontData[0]));
+ }
+ }
}
/**
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/BaseElement.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/BaseElement.java 2009-10-07 10:14:09 UTC (rev 17952)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/BaseElement.java 2009-10-07 11:21:00 UTC (rev 17953)
@@ -18,6 +18,7 @@
import java.util.List;
import java.util.Properties;
+import org.eclipse.ui.IMemento;
import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.eclipse.ui.views.properties.IPropertySource;
@@ -29,6 +30,7 @@
*/
public abstract class BaseElement implements IPropertySource, Comparable<BaseElement> {
+ public static final String CLASS_NAME = "className"; //$NON-NLS-1$
public static final String SELECTED = "selected"; //$NON-NLS-1$
public static final String VISIBLE = "visible"; //$NON-NLS-1$
public static final String VISIBLE_CHILDREN = "visibileChildren"; //$NON-NLS-1$
@@ -266,33 +268,90 @@
* @return key value for object of this class
*/
public abstract String getKey();
+
+ public void setPrValue(IMemento memento, String propertyName, boolean value) {
+ Utils.setPropertyValue(memento, getKey() + "." + propertyName, value); //$NON-NLS-1$
+ }
+
+ public boolean getPrValue(IMemento memento, String propertyName, boolean def) {
+ return Utils.getPropertyValue(memento, getKey() + "." + propertyName, def); //$NON-NLS-1$
+ }
+
+ public void setPrValue(Properties properties, String propertyName, boolean value) {
+ Utils.setPropertyValue(properties, getKey() + "." + propertyName, value); //$NON-NLS-1$
+ }
+
+ public boolean getPrValue(Properties properties, String propertyName, boolean def) {
+ return Utils.getPropertyValue(properties, getKey() + "." + propertyName, def); //$NON-NLS-1$
+ }
+
+ public void setPrValue(IMemento memento, String propertyName, int value) {
+ Utils.setPropertyValue(memento, getKey() + "." + propertyName, Integer.toString(value)); //$NON-NLS-1$
+ }
+
+ public int getPrValue(IMemento memento, String propertyName, int def) {
+ return Utils.getPropertyValue(memento, getKey() + "." + propertyName, def); //$NON-NLS-1$
+ }
+
+ public void setPrValue(Properties properties, String propertyName, int value) {
+ Utils.setPropertyValue(properties, getKey() + "." + propertyName, Integer.toString(value)); //$NON-NLS-1$
+ }
+
+ public int getPrValue(Properties properties, String propertyName, int def) {
+ return Utils.getPropertyValue(properties, getKey() + "." + propertyName, def); //$NON-NLS-1$
+ }
+
+ public void setPrValue(IMemento memento, String propertyName, double value) {
+ Utils.setPropertyValue(memento, getKey() + "." + propertyName, Double.toString(value)); //$NON-NLS-1$
+ }
+
+ public double getPrValue(IMemento memento, String propertyName, double def) {
+ return Utils.getPropertyValue(memento, getKey() + "." + propertyName, def); //$NON-NLS-1$
+ }
+
+ public void setPrValue(Properties properties, String propertyName, double value) {
+ Utils.setPropertyValue(properties, getKey() + "." + propertyName, Double.toString(value)); //$NON-NLS-1$
+ }
+
+ public double getPrValue(Properties properties, String propertyName, double def) {
+ return Utils.getPropertyValue(properties, getKey() + "." + propertyName, def); //$NON-NLS-1$
+ }
- protected void setPropertyValue(Properties properties, String key, boolean value) {
- if (properties.containsKey(key)) {
- properties.remove(key);
- }
- properties.put(key, Boolean.valueOf(value).toString());
+ public void setPrValue(IMemento memento, String propertyName, String value) {
+ Utils.setPropertyValue(memento, getKey() + "." + propertyName, value); //$NON-NLS-1$
}
- protected boolean getPropertyValue(Properties properties, String key) {
- String str = properties.getProperty(key, "true"); //$NON-NLS-1$
- return Boolean.valueOf(str).booleanValue();
+ public String getPrValue(IMemento memento, String propertyName, String def) {
+ return Utils.getPropertyValue(memento, getKey() + "." + propertyName, def); //$NON-NLS-1$
}
- public void setPrValue(Properties properties, boolean value, String propertyName) {
- setPropertyValue(properties, getKey() + "." + propertyName, value); //$NON-NLS-1$
+ public void setPrValue(Properties properties, String propertyName, String value) {
+ Utils.setPropertyValue(properties, getKey() + "." + propertyName, value); //$NON-NLS-1$
}
- public boolean getPrValue(Properties properties, String propertyName) {
- return getPropertyValue(properties, getKey() + "." + propertyName); //$NON-NLS-1$
+ public String getPrValue(Properties properties, String propertyName, String def) {
+ return Utils.getPropertyValue(properties, getKey() + "." + propertyName, def); //$NON-NLS-1$
}
+ public void loadState(IMemento memento) {
+ boolean visibleChildren = getPrValue(memento, VISIBLE_CHILDREN, true);
+ setVisibleChildren(visibleChildren);
+ boolean visible = getPrValue(memento, VISIBLE, true);
+ setVisible(visible);
+ boolean selected = getPrValue(memento, SELECTED, true);
+ setSelected(selected);
+ Iterator<Shape> it = getChildrenIterator();
+ while (it.hasNext()) {
+ it.next().loadState(memento);
+ }
+ }
+
protected void loadFromProperties(Properties properties) {
- boolean visibleChildren = getPrValue(properties, VISIBLE_CHILDREN);
+ boolean visibleChildren = getPrValue(properties, VISIBLE_CHILDREN, true);
setVisibleChildren(visibleChildren);
- boolean visible = getPrValue(properties, VISIBLE);
+ boolean visible = getPrValue(properties, VISIBLE, true);
setVisible(visible);
- boolean selected = getPrValue(properties, SELECTED);
+ boolean selected = getPrValue(properties, SELECTED, true);
setSelected(selected);
Iterator<Shape> it = getChildrenIterator();
while (it.hasNext()) {
@@ -300,13 +359,30 @@
}
}
+ public void saveState(IMemento memento) {
+ String className = getClass().getCanonicalName();
+ setPrValue(memento, CLASS_NAME, className);
+ boolean visibleChildren = isVisibleChildren();
+ setPrValue(memento, VISIBLE_CHILDREN, visibleChildren);
+ boolean visible = isVisible();
+ setPrValue(memento, VISIBLE, visible);
+ boolean selected = isSelected();
+ setPrValue(memento, SELECTED, selected);
+ Iterator<Shape> it = getChildrenIterator();
+ while (it.hasNext()) {
+ it.next().saveState(memento);
+ }
+ }
+
protected void saveInProperties(Properties properties) {
+ String className = getClass().getCanonicalName();
+ setPrValue(properties, CLASS_NAME, className);
boolean visibleChildren = isVisibleChildren();
- setPrValue(properties, visibleChildren, VISIBLE_CHILDREN);
+ setPrValue(properties, VISIBLE_CHILDREN, visibleChildren);
boolean visible = isVisible();
- setPrValue(properties, visible, VISIBLE);
+ setPrValue(properties, VISIBLE, visible);
boolean selected = isSelected();
- setPrValue(properties, selected, SELECTED);
+ setPrValue(properties, SELECTED, selected);
Iterator<Shape> it = getChildrenIterator();
while (it.hasNext()) {
it.next().saveInProperties(properties);
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/ComponentShape.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/ComponentShape.java 2009-10-07 10:14:09 UTC (rev 17952)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/ComponentShape.java 2009-10-07 11:21:00 UTC (rev 17953)
@@ -10,6 +10,8 @@
******************************************************************************/
package org.jboss.tools.hibernate.ui.diagram.editors.model;
+import java.util.Properties;
+
import org.hibernate.mapping.Collection;
import org.hibernate.mapping.Property;
@@ -38,4 +40,14 @@
addChild(bodyOrmShape);
}
}
+
+ @Override
+ protected void loadFromProperties(Properties properties) {
+ super.loadFromProperties(properties);
+ }
+
+ @Override
+ protected void saveInProperties(Properties properties) {
+ super.saveInProperties(properties);
+ }
}
\ No newline at end of file
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/ElementsFactory.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/ElementsFactory.java 2009-10-07 10:14:09 UTC (rev 17952)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/ElementsFactory.java 2009-10-07 11:21:00 UTC (rev 17953)
@@ -74,7 +74,8 @@
Type type = ((Property)element).getType();
if (type.isEntityType()) {
EntityType et = (EntityType) type;
- Object clazz = config.getClassMapping(et.getAssociatedEntityName());
+ Object clazz = config != null ?
+ config.getClassMapping(et.getAssociatedEntityName()) : null;
if (clazz instanceof RootClass) {
RootClass rootClass = (RootClass)clazz;
s = getOrCreatePersistentClass(rootClass, null);
@@ -192,15 +193,17 @@
tableShape = getShape(databaseTable);
if (tableShape == null) {
tableShape = createShape(databaseTable);
- Iterator iterator = config.getClassMappings();
- while (iterator.hasNext()) {
- Object clazz = iterator.next();
- if (clazz instanceof RootClass) {
- RootClass cls = (RootClass)clazz;
- if (databaseTable.equals(cls.getTable())) {
- // create persistent class shape only for RootClass,
- // which has same table reference
- getOrCreatePersistentClass(cls, null);
+ if (config != null) {
+ Iterator iterator = config.getClassMappings();
+ while (iterator.hasNext()) {
+ Object clazz = iterator.next();
+ if (clazz instanceof RootClass) {
+ RootClass cls = (RootClass)clazz;
+ if (databaseTable.equals(cls.getTable())) {
+ // create persistent class shape only for RootClass,
+ // which has same table reference
+ getOrCreatePersistentClass(cls, null);
+ }
}
}
}
@@ -363,8 +366,6 @@
}
return classShape;
}
-
-
protected OrmShape createShape(Object ormElement) {
OrmShape ormShape = null;
@@ -386,10 +387,7 @@
}
return ormShape;
}
-
-
-
@SuppressWarnings("unchecked")
private boolean createConnections(ExpandableShape persistentClass, ExpandableShape dbTable) {
boolean res = false;
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/ExpandableShape.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/ExpandableShape.java 2009-10-07 10:14:09 UTC (rev 17952)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/ExpandableShape.java 2009-10-07 11:21:00 UTC (rev 17953)
@@ -12,6 +12,8 @@
import java.util.Properties;
+import org.eclipse.ui.IMemento;
+
/**
* Shape with two intrinsic states: expand and collapse.
*
@@ -77,16 +79,30 @@
}
@Override
+ public void loadState(IMemento memento) {
+ super.loadState(memento);
+ boolean expanded = getPrValue(memento, EXPANDED, true);
+ setExpanded(expanded);
+ }
+
+ @Override
protected void loadFromProperties(Properties properties) {
super.loadFromProperties(properties);
- boolean expanded = getPrValue(properties, EXPANDED);
+ boolean expanded = getPrValue(properties, EXPANDED, true);
setExpanded(expanded);
}
@Override
+ public void saveState(IMemento memento) {
+ boolean expanded = isExpanded();
+ setPrValue(memento, EXPANDED, expanded);
+ super.saveState(memento);
+ }
+
+ @Override
protected void saveInProperties(Properties properties) {
boolean expanded = isExpanded();
- setPrValue(properties, expanded, EXPANDED);
+ setPrValue(properties, EXPANDED, expanded);
super.saveInProperties(properties);
}
}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/MessageShape.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/MessageShape.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/MessageShape.java 2009-10-07 11:21:00 UTC (rev 17953)
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.hibernate.ui.diagram.editors.model;
+
+import org.jboss.tools.hibernate.ui.diagram.DiagramViewerMessages;
+
+/**
+*
+* author: Vitali Yemialyanchyk
+*/
+public class MessageShape extends OrmShape {
+
+ protected MessageShape() {
+ super(DiagramViewerMessages.MessageShape_warning);
+ }
+
+ @Override
+ public String getKey() {
+ return null;
+ }
+
+}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmDiagram.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmDiagram.java 2009-10-07 10:14:09 UTC (rev 17952)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmDiagram.java 2009-10-07 11:21:00 UTC (rev 17953)
@@ -10,15 +10,18 @@
******************************************************************************/
package org.jboss.tools.hibernate.ui.diagram.editors.model;
+import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
-import java.util.Arrays;
+import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
@@ -33,8 +36,13 @@
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.WorkbenchException;
+import org.eclipse.ui.XMLMemento;
import org.hibernate.cfg.Configuration;
import org.hibernate.console.ConsoleConfiguration;
+import org.hibernate.console.KnownConfigurations;
+import org.hibernate.console.execution.ExecutionContext;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.eclipse.console.utils.ProjectUtils;
import org.hibernate.mapping.RootClass;
@@ -45,7 +53,7 @@
/**
* The whole diagram, all information about diagram elements are here.
- * @author some modifications from Vitali
+ * @author Vitali Yemialianchyk
* @see BaseElement
*/
public class OrmDiagram extends BaseElement {
@@ -56,80 +64,123 @@
public static final String AUTOLAYOUT = "autolayout"; //$NON-NLS-1$
// hibernate console configuration is the source of diagram elements
- private ConsoleConfiguration consoleConfig;
- private OrmLabelProvider labelProvider = new OrmLabelProvider();
+ protected String consoleConfigName;
+ protected ArrayList<RootClass> roots = new ArrayList<RootClass>();
+ protected ArrayList<String> entityNames = new ArrayList<String>();
private boolean dirty = false;
- private HashMap<String, OrmShape> elements = new HashMap<String, OrmShape>();
- private RootClass[] ormElements;
- private String[] entityNames;
- private boolean connectionsVisibilityClassMapping = true;
- private boolean connectionsVisibilityPropertyMapping = true;
- private boolean connectionsVisibilityAssociation = true;
- private boolean connectionsVisibilityForeignKeyConstraint = true;
- private ArrayList<Connection> connections = new ArrayList<Connection>();
+
+ protected HashMap<String, OrmShape> elements = new HashMap<String, OrmShape>();
+ protected ArrayList<Connection> connections = new ArrayList<Connection>();
+
+ protected OrmLabelProvider labelProvider = new OrmLabelProvider();
+ protected boolean connectionsVisibilityClassMapping = true;
+ protected boolean connectionsVisibilityPropertyMapping = true;
+ protected boolean connectionsVisibilityAssociation = true;
+ protected boolean connectionsVisibilityForeignKeyConstraint = true;
+
// editor elements settings
protected DiagramRuler leftRuler, topRuler;
- private boolean rulersVisibility = false;
- private boolean snapToGeometry = false;
- private boolean gridEnabled = false;
- private double zoom = 1.0;
- private float fontHeight = 8.5f;
- private boolean deepIntoSort = false;
-
+ protected boolean rulersVisibility = false;
+ protected boolean snapToGeometry = false;
+ protected boolean gridEnabled = false;
+ protected double zoom = 1.0;
+ protected float fontHeight = 8.5f;
+ protected boolean deepIntoSort = false;
//
private boolean fileLoadSuccessfull = false;
+ // this is workaround to load diagram state in the case if Console Config loaded later
+ // so we can correctly refresh diagram state
+ private IMemento memento = null;
- public OrmDiagram(ConsoleConfiguration consoleConfig, RootClass ioe) {
- initFontHeight();
- createRulers();
- this.consoleConfig = consoleConfig;
- labelProvider.setConfig(consoleConfig.getConfiguration());
- ormElements = new RootClass[1];
- ormElements[0] = ioe;
- entityNames = new String[1];
- entityNames[0] = ioe.getEntityName();
- recreateChildren();
- sortChildren(deepIntoSort);
- loadFromFile();
- refreshDiagramElements();
- setDirty(false);
+ public class RootClassComparator implements Comparator<RootClass> {
+ public int compare(RootClass o1, RootClass o2) {
+ return getItemName(o1).compareTo(getItemName(o2));
+ }
}
- public OrmDiagram(ConsoleConfiguration consoleConfig, RootClass[] ioe) {
+ public OrmDiagram(String consoleConfigName, ArrayList<RootClass> rts) {
initFontHeight();
createRulers();
- this.consoleConfig = consoleConfig;
- labelProvider.setConfig(consoleConfig.getConfiguration());
- ormElements = new RootClass[ioe.length];
- System.arraycopy(ioe, 0, ormElements, 0, ioe.length);
+ this.consoleConfigName = consoleConfigName;
+ @SuppressWarnings("unused")
+ ConsoleConfiguration consoleConfig = getConsoleConfig();
+ labelProvider.setConsoleConfigName(consoleConfigName);
+ roots.addAll(rts);
// should sort elements - cause different sort order gives different file name
// for the same thing
- Arrays.sort(ormElements, new OrmElCompare());
- entityNames = new String[ioe.length];
- for (int i = 0; i < ormElements.length; i++) {
- entityNames[i] = ormElements[i].getEntityName();
+ Collections.sort(roots, new RootClassComparator());
+ entityNames.clear();
+ for (int i = 0; i < roots.size(); i++) {
+ entityNames.add(getItemFullName(roots.get(i)));
}
recreateChildren();
sortChildren(deepIntoSort);
- loadFromFile();
+ if (consoleConfigName.length() > 0) {
+ ////loadFromFile();
+ loadFromXmlFile();
+ }
refreshDiagramElements();
setDirty(false);
}
+
+ public String getDiagramName() {
+ String name = ""; //$NON-NLS-1$
+ ArrayList<String> names = new ArrayList<String>();
+ for (int i = 0; i < entityNames.size(); i++) {
+ names.add(getItemName(entityNames.get(i)));
+ }
+ // sort to get same name for same combinations of entities
+ Collections.sort(names);
+ name = names.size() > 0 ? names.get(0) : ""; //$NON-NLS-1$
+ for (int i = 1; i < names.size(); i++) {
+ name += " & " + names.get(i); //$NON-NLS-1$
+ }
+ return name;
+ }
- protected void recreateChildren() {
+ protected String getItemFullName(RootClass rootClass) {
+ if (rootClass == null) {
+ return ""; //$NON-NLS-1$
+ }
+ String res = rootClass.getEntityName();
+ if (res == null) {
+ res = rootClass.getClassName();
+ }
+ if (res == null) {
+ res = rootClass.getNodeName();
+ }
+ return res;
+ }
+
+ protected String getItemName(String name) {
+ String res = name;
+ return res.substring(res.lastIndexOf(".") + 1); //$NON-NLS-1$
+ }
+
+ protected String getItemName(RootClass rootClass) {
+ return getItemName(getItemFullName(rootClass));
+ }
+
+ public void recreateChildren() {
deleteChildren();
elements.clear();
connections.clear();
final ElementsFactory factory = new ElementsFactory(
- consoleConfig.getConfiguration(), elements, connections);
- for (int i = 0; i < ormElements.length; i++) {
- factory.getOrCreatePersistentClass(ormElements[i], null);
+ getConfig(), elements, connections);
+ for (int i = 0; i < roots.size(); i++) {
+ RootClass rc = roots.get(i);
+ if (rc != null) {
+ factory.getOrCreatePersistentClass(rc, null);
+ }
}
updateChildrenList();
factory.createChildren(this);
updateChildrenList();
+ if (getChildrenNumber() == 0) {
+ addChild(new MessageShape());
+ }
}
protected void updateChildrenList() {
@@ -174,6 +225,7 @@
public IPath getStoreFolderPath() {
IPath storePath = null;
+ ConsoleConfiguration consoleConfig = getConsoleConfig();
IJavaProject javaProject = ProjectUtils.findJavaProject(consoleConfig);
if (javaProject != null && javaProject.getProject() != null) {
storePath = javaProject.getProject().getLocation();
@@ -195,13 +247,13 @@
*/
public String getStoreFileName() {
StringBuilder name = new StringBuilder();
- for (int i = 0; i < ormElements.length; i++) {
+ for (int i = 0; i < entityNames.size(); i++) {
name.append("_"); //$NON-NLS-1$
- name.append(ormElements[i].getNodeName());
+ name.append(getItemName(entityNames.get(i)));
}
- String res = consoleConfig.getName() + name.toString();
+ String res = getConsoleConfigName() + name.toString();
if (res.length() > 64) {
- res = consoleConfig.getName() + "_" + md5sum(name.toString()); //$NON-NLS-1$
+ res = getConsoleConfigName() + "_" + md5sum(name.toString()); //$NON-NLS-1$
}
return res;
}
@@ -241,35 +293,53 @@
}
public RootClass getOrmElement(int idx) {
- if (0 > idx || idx >= ormElements.length) {
+ if (0 > idx || idx >= roots.size()) {
return null;
}
- return ormElements[idx];
+ return roots.get(idx);
}
- public RootClass[] getOrmElements() {
- return ormElements;
+ public boolean refreshRootsFromNames() {
+ final Configuration config = getConfig();
+ if (config == null) {
+ return false;
+ }
+ for (int i = 0; i < roots.size(); i++) {
+ RootClass newOrmElement = (RootClass)config.getClassMapping(entityNames.get(i));
+ if (roots.get(i) == null) {
+ if (newOrmElement == null) {
+ continue;
+ }
+ }
+ else if (roots.get(i).equals(newOrmElement)) {
+ continue;
+ }
+ roots.set(i, newOrmElement);
+ }
+ return true;
}
@Override
public void refresh() {
- final Configuration config = consoleConfig.getConfiguration();
- for (int i = 0; i < ormElements.length; i++) {
- RootClass newOrmElement = (RootClass)config.getClassMapping(entityNames[i]);
- if (ormElements[i].equals(newOrmElement)) {
- continue;
- }
- ormElements[i] = newOrmElement;
- }
+ refreshRootsFromNames();
// -> save just into properties
Properties properties = new Properties();
- saveInProperties(properties);
+ if (memento == null) {
+ saveInProperties(properties);
+ }
recreateChildren();
sortChildren(deepIntoSort);
- // -> load just from properties
- loadFromProperties(properties);
+ if (memento == null) {
+ // -> load just from properties
+ loadFromProperties(properties);
+ } else {
+ loadState(memento);
+ }
refreshDiagramElements();
- updateDirty(true);
+ updateDirty(memento != null ? false : true);
+ if (memento != null && getConsoleConfig() != null) {
+ memento = null;
+ }
super.refresh();
}
@@ -387,58 +457,123 @@
}
}
+ static public String getConsoleConfigName(IMemento memento) {
+ String str = memento.getString("consoleConfig_name"); //$NON-NLS-1$
+ if (str == null) {
+ str = ""; //$NON-NLS-1$
+ }
+ return str;
+ }
+
@Override
+ public void loadState(IMemento memento) {
+ super.loadState(memento);
+ consoleConfigName = getPrValue(memento, "consoleConfig_name", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ @SuppressWarnings("unused")
+ ConsoleConfiguration consoleConfig = getConsoleConfig();
+ labelProvider.setConsoleConfigName(consoleConfigName);
+ int size = getPrValue(memento, "entityNames_size", 0); //$NON-NLS-1$
+ roots.clear();
+ entityNames.clear();
+ for (int i = 0; i < size; i++) {
+ roots.add(null);
+ entityNames.add(getPrValue(memento, "entityNames_" + Integer.toString(i), "")); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ rulersVisibility = getPrValue(memento, "rulersVisibility", false); //$NON-NLS-1$
+ snapToGeometry = getPrValue(memento, "snapToGeometry", false); //$NON-NLS-1$
+ gridEnabled = getPrValue(memento, "gridEnabled", false); //$NON-NLS-1$
+ zoom = getPrValue(memento, "zoom", 1.0); //$NON-NLS-1$
+ deepIntoSort = getPrValue(memento, "deepIntoSort", false); //$NON-NLS-1$
+ connectionsVisibilityAssociation = getPrValue(memento, "connectionsVisibilityAssociation", true); //$NON-NLS-1$
+ connectionsVisibilityClassMapping = getPrValue(memento, "connectionsVisibilityClassMapping", true); //$NON-NLS-1$
+ connectionsVisibilityForeignKeyConstraint = getPrValue(memento, "connectionsVisibilityForeignKeyConstraint", true); //$NON-NLS-1$
+ connectionsVisibilityPropertyMapping = getPrValue(memento, "connectionsVisibilityPropertyMapping", true); //$NON-NLS-1$
+ refreshRootsFromNames();
+ }
+
+ @Override
protected void loadFromProperties(Properties properties) {
super.loadFromProperties(properties);
- String str = properties.getProperty("rulersVisibility", "false"); //$NON-NLS-1$ //$NON-NLS-2$
- rulersVisibility = Boolean.valueOf(str).booleanValue();
- str = properties.getProperty("snapToGeometry", "false"); //$NON-NLS-1$ //$NON-NLS-2$
- snapToGeometry = Boolean.valueOf(str).booleanValue();
- str = properties.getProperty("gridEnabled", "false"); //$NON-NLS-1$ //$NON-NLS-2$
- gridEnabled = Boolean.valueOf(str).booleanValue();
- str = properties.getProperty("zoom", "1.0"); //$NON-NLS-1$ //$NON-NLS-2$
- zoom = Double.valueOf(str).doubleValue();
- str = properties.getProperty("deepIntoSort", "false"); //$NON-NLS-1$ //$NON-NLS-2$
- deepIntoSort = Boolean.valueOf(str).booleanValue();
- str = properties.getProperty("connectionsVisibilityAssociation", "true"); //$NON-NLS-1$ //$NON-NLS-2$
- connectionsVisibilityAssociation = Boolean.valueOf(str).booleanValue();
- str = properties.getProperty("connectionsVisibilityClassMapping", "true"); //$NON-NLS-1$ //$NON-NLS-2$
- connectionsVisibilityClassMapping = Boolean.valueOf(str).booleanValue();
- str = properties.getProperty("connectionsVisibilityForeignKeyConstraint", "true"); //$NON-NLS-1$ //$NON-NLS-2$
- connectionsVisibilityForeignKeyConstraint = Boolean.valueOf(str).booleanValue();
- str = properties.getProperty("connectionsVisibilityPropertyMapping", "true"); //$NON-NLS-1$ //$NON-NLS-2$
- connectionsVisibilityPropertyMapping = Boolean.valueOf(str).booleanValue();
+ consoleConfigName = getPrValue(properties, "consoleConfig_name", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ @SuppressWarnings("unused")
+ ConsoleConfiguration consoleConfig = getConsoleConfig();
+ labelProvider.setConsoleConfigName(consoleConfigName);
+ int size = getPrValue(properties, "entityNames_size", 0); //$NON-NLS-1$
+ roots.clear();
+ entityNames.clear();
+ for (int i = 0; i < size; i++) {
+ roots.add(null);
+ entityNames.add(getPrValue(properties, "entityNames_" + Integer.toString(i), "")); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ rulersVisibility = getPrValue(properties, "rulersVisibility", false); //$NON-NLS-1$
+ snapToGeometry = getPrValue(properties, "snapToGeometry", false); //$NON-NLS-1$
+ gridEnabled = getPrValue(properties, "gridEnabled", false); //$NON-NLS-1$
+ zoom = getPrValue(properties, "zoom", 1.0); //$NON-NLS-1$
+ deepIntoSort = getPrValue(properties, "deepIntoSort", false); //$NON-NLS-1$
+ connectionsVisibilityAssociation = getPrValue(properties, "connectionsVisibilityAssociation", true); //$NON-NLS-1$
+ connectionsVisibilityClassMapping = getPrValue(properties, "connectionsVisibilityClassMapping", true); //$NON-NLS-1$
+ connectionsVisibilityForeignKeyConstraint = getPrValue(properties, "connectionsVisibilityForeignKeyConstraint", true); //$NON-NLS-1$
+ connectionsVisibilityPropertyMapping = getPrValue(properties, "connectionsVisibilityPropertyMapping", true); //$NON-NLS-1$
+ refreshRootsFromNames();
}
@Override
+ public void saveState(IMemento memento) {
+ setPrValue(memento, "consoleConfig_name", consoleConfigName); //$NON-NLS-1$
+ setPrValue(memento, "entityNames_size", "" + entityNames.size()); //$NON-NLS-1$ //$NON-NLS-2$
+ for (int i = 0; i < entityNames.size(); i++) {
+ setPrValue(memento, "entityNames_" + Integer.toString(i), "" + entityNames.get(i)); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ setPrValue(memento, "rulersVisibility", "" + rulersVisibility); //$NON-NLS-1$ //$NON-NLS-2$
+ setPrValue(memento, "snapToGeometry", "" + snapToGeometry); //$NON-NLS-1$ //$NON-NLS-2$
+ setPrValue(memento, "gridEnabled", "" + gridEnabled); //$NON-NLS-1$ //$NON-NLS-2$
+ setPrValue(memento, "zoom", "" + zoom); //$NON-NLS-1$ //$NON-NLS-2$
+ setPrValue(memento, "deepIntoSort", "" + deepIntoSort); //$NON-NLS-1$ //$NON-NLS-2$
+ setPrValue(memento, "connectionsVisibilityAssociation", "" + connectionsVisibilityAssociation); //$NON-NLS-1$ //$NON-NLS-2$
+ setPrValue(memento, "connectionsVisibilityClassMapping", "" + connectionsVisibilityClassMapping); //$NON-NLS-1$ //$NON-NLS-2$
+ setPrValue(memento, "connectionsVisibilityForeignKeyConstraint", "" + connectionsVisibilityForeignKeyConstraint); //$NON-NLS-1$ //$NON-NLS-2$
+ setPrValue(memento, "connectionsVisibilityPropertyMapping", "" + connectionsVisibilityPropertyMapping); //$NON-NLS-1$ //$NON-NLS-2$
+ super.saveState(memento);
+ }
+
+ @Override
protected void saveInProperties(Properties properties) {
- properties.put("rulersVisibility", "" + rulersVisibility); //$NON-NLS-1$ //$NON-NLS-2$
- properties.put("snapToGeometry", "" + snapToGeometry); //$NON-NLS-1$ //$NON-NLS-2$
- properties.put("gridEnabled", "" + gridEnabled); //$NON-NLS-1$ //$NON-NLS-2$
- properties.put("zoom", "" + zoom); //$NON-NLS-1$ //$NON-NLS-2$
- properties.put("deepIntoSort", "" + deepIntoSort); //$NON-NLS-1$ //$NON-NLS-2$
- properties.put("connectionsVisibilityAssociation", "" + connectionsVisibilityAssociation); //$NON-NLS-1$ //$NON-NLS-2$
- properties.put("connectionsVisibilityClassMapping", "" + connectionsVisibilityClassMapping); //$NON-NLS-1$ //$NON-NLS-2$
- properties.put("connectionsVisibilityForeignKeyConstraint", "" + connectionsVisibilityForeignKeyConstraint); //$NON-NLS-1$ //$NON-NLS-2$
- properties.put("connectionsVisibilityPropertyMapping", "" + connectionsVisibilityPropertyMapping); //$NON-NLS-1$ //$NON-NLS-2$
+ setPrValue(properties, "consoleConfig_name", consoleConfigName); //$NON-NLS-1$
+ setPrValue(properties, "entityNames_size", "" + entityNames.size()); //$NON-NLS-1$ //$NON-NLS-2$
+ for (int i = 0; i < entityNames.size(); i++) {
+ setPrValue(properties, "entityNames_" + Integer.toString(i), "" + entityNames.get(i)); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ setPrValue(properties, "rulersVisibility", "" + rulersVisibility); //$NON-NLS-1$ //$NON-NLS-2$
+ setPrValue(properties, "snapToGeometry", "" + snapToGeometry); //$NON-NLS-1$ //$NON-NLS-2$
+ setPrValue(properties, "gridEnabled", "" + gridEnabled); //$NON-NLS-1$ //$NON-NLS-2$
+ setPrValue(properties, "zoom", "" + zoom); //$NON-NLS-1$ //$NON-NLS-2$
+ setPrValue(properties, "deepIntoSort", "" + deepIntoSort); //$NON-NLS-1$ //$NON-NLS-2$
+ setPrValue(properties, "connectionsVisibilityAssociation", "" + connectionsVisibilityAssociation); //$NON-NLS-1$ //$NON-NLS-2$
+ setPrValue(properties, "connectionsVisibilityClassMapping", "" + connectionsVisibilityClassMapping); //$NON-NLS-1$ //$NON-NLS-2$
+ setPrValue(properties, "connectionsVisibilityForeignKeyConstraint", "" + connectionsVisibilityForeignKeyConstraint); //$NON-NLS-1$ //$NON-NLS-2$
+ setPrValue(properties, "connectionsVisibilityPropertyMapping", "" + connectionsVisibilityPropertyMapping); //$NON-NLS-1$ //$NON-NLS-2$
super.saveInProperties(properties);
}
- public void saveInFile() {
- Properties properties = new Properties();
- saveInProperties(properties);
+ public void saveInFile(IPath path, boolean format) {
FileOutputStream fos = null;
try {
- File folder = new File(getStoreFolderPath().toOSString());
- if (!folder.exists()) {
- folder.mkdirs();
- }
- File file = new File(getStoreFilePath().toOSString());
+ File file = new File(path.toOSString());
if (!file.exists()) {
file.createNewFile();
}
fos = new FileOutputStream(file);
- properties.store(fos, ""); //$NON-NLS-1$
+ if (format) {
+ XMLMemento memento = XMLMemento.createWriteRoot("OrmDiagram"); //$NON-NLS-1$
+ saveState(memento);
+ OutputStreamWriter writer = new OutputStreamWriter(fos, "utf-8"); //$NON-NLS-1$
+ memento.save(writer);
+ writer.close();
+ } else {
+ Properties properties = new Properties();
+ saveInProperties(properties);
+ properties.store(fos, ""); //$NON-NLS-1$
+ }
} catch (IOException e) {
HibernateConsolePlugin.getDefault().logErrorMessage("Can't save layout of mapping.", e); //$NON-NLS-1$
} finally {
@@ -451,6 +586,22 @@
}
}
}
+
+ public void saveInXmlFile() {
+ File folder = new File(getStoreFolderPath().toOSString());
+ if (!folder.exists()) {
+ folder.mkdirs();
+ }
+ saveInFile(getStoreFilePath(), true);
+ }
+
+ public void saveInFile() {
+ File folder = new File(getStoreFolderPath().toOSString());
+ if (!folder.exists()) {
+ folder.mkdirs();
+ }
+ saveInFile(getStoreFilePath(), false);
+ }
public IFile createLayoutFile(InputStream source) {
IFile file = null;
@@ -470,17 +621,29 @@
return file;
}
- public void loadFromFile() {
+ public void loadFromFile(IPath path, boolean format) {
fileLoadSuccessfull = false;
FileInputStream fis = null;
try {
- File file = new File(getStoreFilePath().toOSString());
+ File file = new File(path.toOSString());
if (file.exists()) {
fis = new FileInputStream(file);
- Properties properties = new Properties();
- properties.load(fis);
- loadFromProperties(properties);
- fileLoadSuccessfull = true;
+ if (format) {
+ BufferedReader reader = new BufferedReader(
+ new InputStreamReader(fis, "utf-8")); //$NON-NLS-1$
+ try {
+ IMemento memento = XMLMemento.createReadRoot(reader);
+ loadState(memento);
+ fileLoadSuccessfull = true;
+ } catch (WorkbenchException e) {
+ HibernateConsolePlugin.getDefault().logErrorMessage("Can't load layout of mapping.", e); //$NON-NLS-1$
+ }
+ } else {
+ Properties properties = new Properties();
+ properties.load(fis);
+ loadFromProperties(properties);
+ fileLoadSuccessfull = true;
+ }
}
} catch (IOException ex) {
HibernateConsolePlugin.getDefault().logErrorMessage("Can't load layout of mapping.", ex); //$NON-NLS-1$
@@ -494,12 +657,47 @@
}
}
}
+
+ public void loadFromXmlFile() {
+ loadFromFile(getStoreFilePath(), true);
+ }
+
+ public void loadFromFile() {
+ loadFromFile(getStoreFilePath(), false);
+ }
public boolean isFileLoadSuccessfull() {
return fileLoadSuccessfull;
}
+ public String getConsoleConfigName() {
+ return consoleConfigName;
+ }
+
+ protected Configuration getConfig() {
+ final ConsoleConfiguration consoleConfig = getConsoleConfig();
+ if (consoleConfig != null) {
+ Configuration config = consoleConfig.getConfiguration();
+ if (config == null) {
+ consoleConfig.build();
+ consoleConfig.execute(new ExecutionContext.Command() {
+ public Object execute() {
+ if (consoleConfig.hasConfiguration()) {
+ consoleConfig.getConfiguration().buildMappings();
+ }
+ return consoleConfig;
+ }
+ } );
+ config = consoleConfig.getConfiguration();
+ }
+ return config;
+ }
+ return null;
+ }
+
public ConsoleConfiguration getConsoleConfig() {
+ final KnownConfigurations knownConfigurations = KnownConfigurations.getInstance();
+ ConsoleConfiguration consoleConfig = knownConfigurations.find(consoleConfigName);
return consoleConfig;
}
@@ -579,4 +777,48 @@
public void setDeepIntoSort(boolean deepIntoSort) {
this.deepIntoSort = deepIntoSort;
}
+
+ public boolean equals(Object obj) {
+ boolean res = false;
+ if (!(obj instanceof OrmDiagram)) {
+ return res;
+ }
+ final OrmDiagram od = (OrmDiagram)obj;
+ if (consoleConfigName == null) {
+ if (od.getConsoleConfigName() != null) {
+ return res;
+ }
+ } else if (!consoleConfigName.equals(od.getConsoleConfigName())) {
+ return res;
+ }
+ final ArrayList<RootClass> rootsOd = od.roots;
+ if (roots.size() != rootsOd.size()) {
+ return res;
+ }
+ res = true;
+ for (int i = 0; i < roots.size(); i++) {
+ RootClass rc = roots.get(i);
+ if (rc == null) {
+ if (rc != rootsOd.get(i)) {
+ res = false;
+ break;
+ }
+ } else if (!rc.equals(rootsOd.get(i))) {
+ res = false;
+ break;
+ }
+ }
+ return res;
+ }
+
+ public int hashCode() {
+ if (consoleConfigName == null) {
+ return roots.hashCode();
+ }
+ return roots.hashCode() + consoleConfigName.hashCode();
+ }
+
+ public void setMemento(IMemento memento) {
+ this.memento = memento;
+ }
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmShape.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmShape.java 2009-10-07 10:14:09 UTC (rev 17952)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmShape.java 2009-10-07 11:21:00 UTC (rev 17953)
@@ -14,6 +14,7 @@
import java.util.Properties;
import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.ui.IMemento;
import org.hibernate.mapping.Collection;
import org.hibernate.mapping.Column;
import org.hibernate.mapping.Component;
@@ -248,6 +249,22 @@
verticalGuide = vGuide;
}
+ protected Point getPoint(IMemento memento, String key) {
+ Point point = new Point(0, 0);
+ String str = Utils.getPropertyValue(memento, key + ".x", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+ point.x = Integer.parseInt(str);
+ String str2 = Utils.getPropertyValue(memento, key + ".y", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+ point.y = Integer.parseInt(str2);
+ return point;
+ }
+
+ protected void setPoint(IMemento memento, String key, Point point) {
+ String key1 = key + ".x"; //$NON-NLS-1$
+ memento.putString(key1, "" + point.x); //$NON-NLS-1$
+ String key2 = key + ".y"; //$NON-NLS-1$
+ memento.putString(key2, "" + point.y); //$NON-NLS-1$
+ }
+
protected Point getPoint(Properties properties, String key) {
Point point = new Point(0, 0);
String str = properties.getProperty(key + ".x", "0"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -261,19 +278,24 @@
String key1 = key + ".x"; //$NON-NLS-1$
if (!properties.containsKey(key1)) {
properties.remove(key1);
- properties.put(key1, "" + point.x); //$NON-NLS-1$
- } else {
- properties.put(key1, "" + point.x); //$NON-NLS-1$
}
+ properties.put(key1, "" + point.x); //$NON-NLS-1$
String key2 = key + ".y"; //$NON-NLS-1$
if (!properties.containsKey(key2)) {
properties.remove(key2);
- properties.put(key2, "" + point.y); //$NON-NLS-1$
- } else {
- properties.put(key2, "" + point.y); //$NON-NLS-1$
}
+ properties.put(key2, "" + point.y); //$NON-NLS-1$
}
+ public void setPosition(IMemento memento) {
+ Point point = getLocation();
+ setPoint(memento, getKey(), point);
+ }
+
+ public Point getPosition(IMemento memento) {
+ return getPoint(memento, getKey());
+ }
+
public void setPosition(Properties properties) {
Point point = getLocation();
setPoint(properties, getKey(), point);
@@ -284,6 +306,13 @@
}
@Override
+ public void loadState(IMemento memento) {
+ super.loadState(memento);
+ Point pos = getPosition(memento);
+ setLocation(pos);
+ }
+
+ @Override
protected void loadFromProperties(Properties properties) {
super.loadFromProperties(properties);
Point pos = getPosition(properties);
@@ -291,6 +320,12 @@
}
@Override
+ public void saveState(IMemento memento) {
+ setPosition(memento);
+ super.saveState(memento);
+ }
+
+ @Override
protected void saveInProperties(Properties properties) {
setPosition(properties);
super.saveInProperties(properties);
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/Shape.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/Shape.java 2009-10-07 10:14:09 UTC (rev 17952)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/Shape.java 2009-10-07 11:21:00 UTC (rev 17953)
@@ -14,6 +14,7 @@
import java.util.List;
import java.util.Properties;
+import org.eclipse.ui.IMemento;
import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.eclipse.ui.views.properties.TextPropertyDescriptor;
import org.hibernate.mapping.Column;
@@ -31,6 +32,7 @@
public class Shape extends BaseElement {
public static final String SET_FOCUS = "setFocus"; //$NON-NLS-1$
+ public static final String IDENT = "indent"; //$NON-NLS-1$
/**
* left indent for property string on diagram
@@ -212,15 +214,28 @@
}
@Override
+ public void loadState(IMemento memento) {
+ super.loadState(memento);
+ int indentTmp = getPrValue(memento, IDENT, 0);
+ indent = indentTmp;
+ }
+
+ @Override
protected void loadFromProperties(Properties properties) {
super.loadFromProperties(properties);
- String str = properties.getProperty("indent", "0"); //$NON-NLS-1$ //$NON-NLS-2$
- indent = Integer.valueOf(str).intValue();
+ int indentTmp = getPrValue(properties, IDENT, 0);
+ indent = indentTmp;
}
@Override
+ public void saveState(IMemento memento) {
+ setPrValue(memento, IDENT, indent);
+ super.saveState(memento);
+ }
+
+ @Override
protected void saveInProperties(Properties properties) {
- properties.put("indent", "" + indent); //$NON-NLS-1$ //$NON-NLS-2$
+ setPrValue(properties, IDENT, indent);
super.saveInProperties(properties);
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/Utils.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/Utils.java 2009-10-07 10:14:09 UTC (rev 17952)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/Utils.java 2009-10-07 11:21:00 UTC (rev 17953)
@@ -11,9 +11,12 @@
package org.jboss.tools.hibernate.ui.diagram.editors.model;
import java.util.List;
+import java.util.Properties;
+import org.eclipse.ui.IMemento;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.Property;
+import org.hibernate.mapping.SimpleValue;
import org.hibernate.mapping.Table;
/**
@@ -55,12 +58,18 @@
} else if (obj instanceof Property) {
Property property = (Property)obj;
res = property.getPersistentClass().getEntityName() + "." + property.getName(); //$NON-NLS-1$
+ } else if (obj instanceof SimpleValue) {
+ SimpleValue sv = (SimpleValue)obj;
+ res = getTableName(sv.getTable()) + "." + sv.getForeignKeyName(); //$NON-NLS-1$
} else if (obj instanceof String) {
res = (String)obj;
}
if (res.length() > 0 && res.indexOf(".") < 0) { //$NON-NLS-1$
return "default." + res; //$NON-NLS-1$
}
+ if (res.length() == 0) {
+ res = "null"; //$NON-NLS-1$
+ }
return res;
}
@@ -71,4 +80,87 @@
public static String getTableName(Table table) {
return getTableName(table.getCatalog(), table.getSchema(), table.getName());
}
+
+ ////////////////////////////////////////////
+
+ public static void setPropertyValue(IMemento memento, String key, boolean value) {
+ memento.putString(key, Boolean.valueOf(value).toString());
+ }
+
+ public static boolean getPropertyValue(IMemento memento, String key, boolean def) {
+ String str = memento.getString(key);
+ if (str == null) {
+ str = Boolean.toString(def);
+ }
+ return Boolean.valueOf(str).booleanValue();
+ }
+
+ public static void setPropertyValue(Properties properties, String key, boolean value) {
+ if (properties.containsKey(key)) {
+ properties.remove(key);
+ }
+ properties.put(key, Boolean.valueOf(value).toString());
+ }
+
+ public static boolean getPropertyValue(Properties properties, String key, boolean def) {
+ String str = properties.getProperty(key, Boolean.toString(def));
+ return Boolean.valueOf(str).booleanValue();
+ }
+
+ ///
+
+ public static double getPropertyValue(IMemento memento, String key, double def) {
+ String str = memento.getString(key);
+ if (str == null) {
+ str = Double.toString(def);
+ }
+ return Double.valueOf(str).doubleValue();
+ }
+
+ public static double getPropertyValue(Properties properties, String key, double def) {
+ String str = properties.getProperty(key, Double.toString(def));
+ return Double.valueOf(str).doubleValue();
+ }
+
+ ///
+
+ public static int getPropertyValue(IMemento memento, String key, int def) {
+ String str = memento.getString(key);
+ if (str == null) {
+ str = Integer.toString(def);
+ }
+ return Integer.valueOf(str).intValue();
+ }
+
+ public static int getPropertyValue(Properties properties, String key, int def) {
+ String str = properties.getProperty(key, Integer.toString(def));
+ return Integer.valueOf(str).intValue();
+ }
+
+ ///
+
+ public static String getPropertyValue(IMemento memento, String key, String def) {
+ String str = memento.getString(key);
+ if (str == null) {
+ str = def;
+ }
+ return str;
+ }
+
+ public static void setPropertyValue(IMemento memento, String key, String value) {
+ memento.putString(key, value);
+ }
+
+ public static String getPropertyValue(Properties properties, String key, String def) {
+ return properties.getProperty(key, def);
+ }
+
+ public static void setPropertyValue(Properties properties, String key, String value) {
+ if (properties.containsKey(key)) {
+ properties.remove(key);
+ }
+ if (value != null) {
+ properties.put(key, value);
+ }
+ }
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/DiagramEditPart.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/DiagramEditPart.java 2009-10-07 10:14:09 UTC (rev 17952)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/DiagramEditPart.java 2009-10-07 11:21:00 UTC (rev 17953)
@@ -146,7 +146,7 @@
Iterator<Shape> it = diagram.getChildrenIterator();
while (it.hasNext()) {
Shape child = it.next();
- if (child.isVisible()) {
+ if (child.isVisible() && (child instanceof OrmShape)) {
IItemInfo item = new DiagramElementInfo((OrmShape)child);
addItem(item);
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/OrmEditPart.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/OrmEditPart.java 2009-10-07 10:14:09 UTC (rev 17952)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/OrmEditPart.java 2009-10-07 11:21:00 UTC (rev 17953)
@@ -193,7 +193,7 @@
public OrmDiagram getOrmDiagram() {
BaseElement modelTmp = (BaseElement)getModel();
OrmDiagram res = modelTmp instanceof OrmDiagram ? (OrmDiagram)modelTmp : null;
- while (modelTmp.getParent() != null) {
+ while (modelTmp != null && modelTmp.getParent() != null) {
modelTmp = modelTmp.getParent();
res = modelTmp instanceof OrmDiagram ? (OrmDiagram)modelTmp : res;
}
@@ -202,6 +202,6 @@
public BaseElement getModelParent() {
BaseElement modelTmp = (BaseElement)getModel();
- return modelTmp.getParent();
+ return modelTmp != null ? modelTmp.getParent() : null;
}
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/OrmEditPartFactory.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/OrmEditPartFactory.java 2009-10-07 10:14:09 UTC (rev 17952)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/OrmEditPartFactory.java 2009-10-07 11:21:00 UTC (rev 17953)
@@ -16,6 +16,7 @@
import org.jboss.tools.hibernate.ui.diagram.editors.model.ComponentShape;
import org.jboss.tools.hibernate.ui.diagram.editors.model.Connection;
import org.jboss.tools.hibernate.ui.diagram.editors.model.ExpandableShape;
+import org.jboss.tools.hibernate.ui.diagram.editors.model.MessageShape;
import org.jboss.tools.hibernate.ui.diagram.editors.model.OrmDiagram;
import org.jboss.tools.hibernate.ui.diagram.editors.model.OrmShape;
import org.jboss.tools.hibernate.ui.diagram.editors.model.Shape;
@@ -46,6 +47,8 @@
res = new ShapeEditPart();
} else if (baseElement instanceof Connection) {
res = new ConnectionEditPart();
+ } else if (baseElement instanceof MessageShape) {
+ res = new OrmShapeEditPart();
}
if (res == null) {
throw new RuntimeException(
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/OrmShapeEditPart.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/OrmShapeEditPart.java 2009-10-07 10:14:09 UTC (rev 17952)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/OrmShapeEditPart.java 2009-10-07 11:21:00 UTC (rev 17953)
@@ -32,7 +32,7 @@
/**
* @author some modifications from Vitali
*/
-public class OrmShapeEditPart extends ExpandableShapeEditPart{
+public class OrmShapeEditPart extends ExpandableShapeEditPart {
public OrmShape getModelOrmShape() {
return (OrmShape)getModel();
@@ -128,6 +128,8 @@
Integer.parseInt(ColorConstants.Colors_DatabaseColumnR),
Integer.parseInt(ColorConstants.Colors_DatabaseColumnG),
Integer.parseInt(ColorConstants.Colors_DatabaseColumnB)));
+ } else if (element instanceof String) {
+ return ResourceManager.getInstance().getColor(new RGB(0, 0, 0));
} else {
throw new IllegalArgumentException();
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ShapeEditPart.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ShapeEditPart.java 2009-10-07 10:14:09 UTC (rev 17952)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ShapeEditPart.java 2009-10-07 11:21:00 UTC (rev 17953)
@@ -78,7 +78,8 @@
label.setLabelAlignment(PositionConstants.LEFT);
label.setOpaque(true);
TopLineBorder border = new TopLineBorder(1, 2 + getModelShape().getIndent(), 1, 2);
- border.setColor(getOrmShapeEditPart().getColor());
+ final OrmShapeEditPart osep = getOrmShapeEditPart();
+ border.setColor(osep != null ? osep.getColor() : ResourceManager.getInstance().getColor(new RGB(0, 0, 0)));
label.setBorder(border);
return label;
}
@@ -283,7 +284,7 @@
protected OrmShapeEditPart getOrmShapeEditPart() {
int i = 0;
EditPart part = this;
- while (!((part instanceof OrmShapeEditPart))) {
+ while (part != null && !(part instanceof OrmShapeEditPart)) {
part = part.getParent();
if (i++ > 4) {
throw new RuntimeException();
Copied: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/DiagramEditorInput.java (from rev 17792, trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/ObjectEditorInput.java)
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/DiagramEditorInput.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/DiagramEditorInput.java 2009-10-07 11:21:00 UTC (rev 17953)
@@ -0,0 +1,146 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.hibernate.ui.view;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.resources.IStorage;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.IPersistableElement;
+import org.eclipse.ui.IStorageEditorInput;
+import org.eclipse.ui.part.FileEditorInput;
+import org.hibernate.console.ConsoleConfiguration;
+import org.hibernate.mapping.RootClass;
+import org.jboss.tools.hibernate.ui.diagram.editors.model.OrmDiagram;
+
+/**
+ *
+ * author: Vitali Yemialyanchyk
+ */
+public class DiagramEditorInput implements IEditorInput, IStorageEditorInput, IPersistableElement {
+
+ protected OrmDiagram ormDiagram = null;
+ /** The storage object used by this editor input. */
+ private DiagramEditorStorage storage = new DiagramEditorStorage();
+
+ public DiagramEditorInput() {
+ ArrayList<RootClass> roots = new ArrayList<RootClass>();
+ createOrmDiagram("", roots); //$NON-NLS-1$
+ }
+
+ public DiagramEditorInput(FileEditorInput fei) {
+ ArrayList<RootClass> roots = new ArrayList<RootClass>();
+ createOrmDiagram("", roots); //$NON-NLS-1$
+ ormDiagram.loadFromFile(fei.getPath(), true);
+ if (ormDiagram.getConsoleConfig() != null) {
+ ormDiagram.recreateChildren();
+ ormDiagram.loadFromFile(fei.getPath(), true);
+ ormDiagram.refresh();
+ }
+ ormDiagram.setDirty(false);
+ }
+
+ public DiagramEditorInput(String configName, RootClass rc) {
+ ArrayList<RootClass> roots = new ArrayList<RootClass>();
+ roots.add(rc);
+ createOrmDiagram(configName, roots);
+ }
+
+ public DiagramEditorInput(String configName, RootClass[] rcs) {
+ ArrayList<RootClass> roots = new ArrayList<RootClass>();
+ for (int i = 0; i < rcs.length; i++) {
+ roots.add(rcs[i]);
+ }
+ createOrmDiagram(configName, roots);
+ }
+
+ protected void createOrmDiagram(String configName, ArrayList<RootClass> roots) {
+ ormDiagram = new OrmDiagram(configName, roots);
+ }
+
+ public OrmDiagram getOrmDiagram() {
+ return ormDiagram;
+ }
+
+ public ConsoleConfiguration getConsoleConfig() {
+ return getOrmDiagram().getConsoleConfig();
+ }
+
+ public boolean exists() {
+ if (storage != null) {
+ return true;
+ }
+ return false;
+ }
+
+ public ImageDescriptor getImageDescriptor() {
+ return ImageDescriptor.getMissingImageDescriptor();
+ }
+
+ public String getName() {
+ return ormDiagram.getDiagramName();
+ }
+
+ public IPersistableElement getPersistable() {
+ return this;
+ }
+
+ public String getToolTipText() {
+ return getName();
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object getAdapter(Class adapter) {
+ return null;
+ }
+
+ public boolean equals(Object obj) {
+ boolean res = false;
+ if (!(obj instanceof DiagramEditorInput)) {
+ return res;
+ }
+ final DiagramEditorInput oei = (DiagramEditorInput)obj;
+ return ormDiagram.equals(oei.ormDiagram);
+ }
+
+ public int hashCode() {
+ return ormDiagram.hashCode();
+ }
+
+ public IStorage getStorage() {
+ return storage;
+ }
+
+ public String getFactoryId() {
+ return DiagramEditorInputFactory.ID_FACTORY;
+ }
+
+ public void saveState(IMemento memento) {
+ ormDiagram.saveState(memento);
+ //DiagramEditorInputFactory.saveState(memento, this);
+ }
+
+
+ public void loadState(final IMemento memento) {
+ ormDiagram.loadState(memento);
+ if (ormDiagram.getConsoleConfig() != null) {
+ //ormDiagram.recreateChildren();
+ //ormDiagram.loadState(memento);
+ ormDiagram.setMemento(memento);
+ ormDiagram.refresh();
+ } else {
+ ormDiagram.setMemento(memento);
+ }
+ ormDiagram.setDirty(false);
+ }
+}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/DiagramEditorInputFactory.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/DiagramEditorInputFactory.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/DiagramEditorInputFactory.java 2009-10-07 11:21:00 UTC (rev 17953)
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.hibernate.ui.view;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.ui.IElementFactory;
+import org.eclipse.ui.IMemento;
+
+/**
+ *
+ * author: Vitali Yemialyanchyk
+ */
+public class DiagramEditorInputFactory implements IElementFactory {
+
+ public final static String ID_FACTORY = "org.jboss.tools.hibernate.ui.view.DiagramEditorInputFactory"; //$NON-NLS-1$
+
+ public IAdaptable createElement(IMemento memento) {
+ DiagramEditorInput hqlStorageInput = new DiagramEditorInput();
+ hqlStorageInput.loadState(memento);
+ IAdaptable input = hqlStorageInput;
+ return input;
+ }
+}
Added: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/DiagramEditorStorage.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/DiagramEditorStorage.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/DiagramEditorStorage.java 2009-10-07 11:21:00 UTC (rev 17953)
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.hibernate.ui.view;
+
+import java.io.InputStream;
+
+import org.eclipse.core.resources.IStorage;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.jboss.tools.hibernate.ui.diagram.editors.model.OrmDiagram;
+
+/**
+ *
+ * author: Vitali Yemialyanchyk
+ */
+public class DiagramEditorStorage implements IStorage {
+
+ protected OrmDiagram ormDiagram = null;
+
+ public void init(OrmDiagram ormDiagram) {
+ this.ormDiagram = ormDiagram;
+ }
+
+ public InputStream getContents() throws CoreException {
+ if (ormDiagram == null) {
+ return null;
+ }
+ return null;
+ }
+
+ public IPath getFullPath() {
+ if (ormDiagram == null) {
+ return null;
+ }
+ return ormDiagram.getStoreFilePath();
+ }
+
+ public String getName() {
+ if (ormDiagram == null) {
+ return null;
+ }
+ return ormDiagram.getDiagramName();
+ }
+
+ public boolean isReadOnly() {
+ return false;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object getAdapter(Class adapter) {
+ return null;
+ }
+
+}
Deleted: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/ObjectEditorInput.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/ObjectEditorInput.java 2009-10-07 10:14:09 UTC (rev 17952)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/ObjectEditorInput.java 2009-10-07 11:21:00 UTC (rev 17953)
@@ -1,142 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2009 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.hibernate.ui.view;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IPersistableElement;
-import org.hibernate.console.ConsoleConfiguration;
-import org.hibernate.mapping.RootClass;
-
-/**
- *
- * author: ?
- * author: Vitali Yemialyanchyk
- */
-public class ObjectEditorInput implements IEditorInput{
-
- protected ArrayList<RootClass> roots;
- protected ConsoleConfiguration configuration;
-
- public ObjectEditorInput(ConsoleConfiguration configuration, RootClass rc) {
- roots = new ArrayList<RootClass>();
- roots.add(rc);
- this.configuration = configuration;
- }
-
- public ObjectEditorInput(ConsoleConfiguration configuration, RootClass[] rcs) {
- roots = new ArrayList<RootClass>();
- for (int i = 0; i < rcs.length; i++) {
- roots.add(rcs[i]);
- }
- Collections.sort(roots, new RootClassComparator());
- this.configuration = configuration;
- }
-
- public class RootClassComparator implements Comparator<RootClass> {
- public int compare(RootClass o1, RootClass o2) {
- return getItemName(o1).compareTo(getItemName(o2));
- }
- }
-
- public boolean exists() {
- return false;
- }
-
- public ArrayList<RootClass> getRootClasses() {
- return roots;
- }
-
- public ImageDescriptor getImageDescriptor() {
- return ImageDescriptor.getMissingImageDescriptor();
- }
-
- public String getName() {
- return getDiagramName();
- }
-
- public String getDiagramName() {
- String name = ""; //$NON-NLS-1$
- ArrayList<String> names = new ArrayList<String>();
- for (int i = 0; i < roots.size(); i++) {
- names.add(getItemName(roots.get(i)));
- }
- // sort to get same name for same combinations of entities
- Collections.sort(names);
- name = names.size() > 0 ? names.get(0) : ""; //$NON-NLS-1$
- for (int i = 1; i < names.size(); i++) {
- name += " & " + names.get(i); //$NON-NLS-1$
- }
- return name;
- }
-
- protected String getItemName(RootClass rootClass) {
- String res = rootClass.getEntityName();
- if (res == null) {
- res = rootClass.getClassName();
- }
- if (res == null) {
- res = rootClass.getNodeName();
- }
- res = res.substring(res.lastIndexOf(".") + 1); //$NON-NLS-1$
- return res;
- }
-
- public IPersistableElement getPersistable() {
- return null;
- }
-
-
- public String getToolTipText() {
- return ""; //$NON-NLS-1$
- }
-
-
- @SuppressWarnings("unchecked")
- public Object getAdapter(Class adapter) {
- return null;
- }
-
- public ConsoleConfiguration getConfiguration() {
- return configuration;
- }
-
- public boolean equals(Object obj) {
- boolean res = false;
- if (!(obj instanceof ObjectEditorInput)) {
- return res;
- }
- final ObjectEditorInput oei = (ObjectEditorInput)obj;
- if (!configuration.equals(oei.getConfiguration())) {
- return res;
- }
- final ArrayList<RootClass> rootsOei = oei.getRootClasses();
- if (roots.size() != rootsOei.size()) {
- return res;
- }
- res = true;
- for (int i = 0; i < roots.size(); i++) {
- if (!roots.get(i).equals(rootsOei.get(i))) {
- res = false;
- break;
- }
- }
- return res;
- }
-
- public int hashCode() {
- return roots.hashCode() + configuration.hashCode();
- }
-}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/OpenDiagramActionDelegate.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/OpenDiagramActionDelegate.java 2009-10-07 10:14:09 UTC (rev 17952)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/OpenDiagramActionDelegate.java 2009-10-07 11:21:00 UTC (rev 17953)
@@ -104,12 +104,12 @@
}
public IEditorPart openEditor(PersistentClass persClass,
- ConsoleConfiguration consoleConfiguration) throws PartInitException {
- ObjectEditorInput input = new ObjectEditorInput(consoleConfiguration, persClass.getRootClass());
+ ConsoleConfiguration consoleConfig) throws PartInitException {
+ DiagramEditorInput input = new DiagramEditorInput(consoleConfig.getName(), persClass.getRootClass());
return IDE.openEditor(UiPlugin.getPage(), input, "org.jboss.tools.hibernate.ui.diagram.editors.DiagramViewer"); //$NON-NLS-1$
}
- public IEditorPart openEditor(Set<PersistentClass> setPC, ConsoleConfiguration consoleConfiguration) throws PartInitException {
+ public IEditorPart openEditor(Set<PersistentClass> setPC, ConsoleConfiguration consoleConfig) throws PartInitException {
if (setPC.size() <= 0) {
return null;
@@ -121,7 +121,7 @@
persClass = it.next();
rcArr[i++] = persClass.getRootClass();
}
- ObjectEditorInput input = new ObjectEditorInput(consoleConfiguration, rcArr);
+ DiagramEditorInput input = new DiagramEditorInput(consoleConfig.getName(), rcArr);
return IDE.openEditor(UiPlugin.getPage(), input, "org.jboss.tools.hibernate.ui.diagram.editors.DiagramViewer"); //$NON-NLS-1$
}
}
\ No newline at end of file
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/OrmImageMap.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/OrmImageMap.java 2009-10-07 10:14:09 UTC (rev 17952)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/OrmImageMap.java 2009-10-07 11:21:00 UTC (rev 17953)
@@ -55,6 +55,8 @@
imageName = getImageName((SimpleValue)obj);
} else if (obj instanceof PersistentClass) {
imageName = getImageName((PersistentClass)obj);
+ } else if (obj instanceof String) {
+ imageName = "Image_Error"; //$NON-NLS-1$;
}
return UiPlugin.getImageDescriptor("images/" + ImageBundle.getString(imageName)); //$NON-NLS-1$
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/OrmLabelProvider.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/OrmLabelProvider.java 2009-10-07 10:14:09 UTC (rev 17952)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/view/OrmLabelProvider.java 2009-10-07 11:21:00 UTC (rev 17953)
@@ -26,6 +26,9 @@
import org.hibernate.MappingException;
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment;
+import org.hibernate.console.ConsoleConfiguration;
+import org.hibernate.console.KnownConfigurations;
+import org.hibernate.console.execution.ExecutionContext;
import org.hibernate.dialect.Dialect;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.engine.Mapping;
@@ -40,27 +43,54 @@
private Map<ImageDescriptor, Image> imageCache = new HashMap<ImageDescriptor, Image>(25);
- protected Configuration config = null;
+ protected String consoleConfigName;
protected Mapping mapping = null;
protected Dialect dialect = null;
public OrmLabelProvider() {
}
- public OrmLabelProvider(Configuration config) {
+ public OrmLabelProvider(String consoleConfigName) {
super();
- setConfig(config);
+ setConsoleConfigName(consoleConfigName);
}
- public void setConfig(Configuration config) {
- if (this.config == config) {
+ public void setConsoleConfigName(String consoleConfigName) {
+ if (this.consoleConfigName == consoleConfigName) {
return;
}
- this.config = config;
+ this.consoleConfigName = consoleConfigName;
mapping = null;
dialect = null;
}
+ protected Configuration getConfig() {
+ final ConsoleConfiguration consoleConfig = getConsoleConfig();
+ if (consoleConfig != null) {
+ Configuration config = consoleConfig.getConfiguration();
+ if (config == null) {
+ consoleConfig.build();
+ consoleConfig.execute(new ExecutionContext.Command() {
+ public Object execute() {
+ if (consoleConfig.hasConfiguration()) {
+ consoleConfig.getConfiguration().buildMappings();
+ }
+ return consoleConfig;
+ }
+ } );
+ config = consoleConfig.getConfiguration();
+ }
+ return config;
+ }
+ return null;
+ }
+
+ protected ConsoleConfiguration getConsoleConfig() {
+ final KnownConfigurations knownConfigurations = KnownConfigurations.getInstance();
+ ConsoleConfiguration consoleConfig = knownConfigurations.find(consoleConfigName);
+ return consoleConfig;
+ }
+
@Override
public Image getImage(Object element) {
ImageDescriptor descriptor = OrmImageMap.getImageDescriptor(element);
@@ -118,10 +148,11 @@
if (sqlType != null) {
return false;
}
- if (mapping == null) {
+ final Configuration config = getConfig();
+ if (mapping == null && config != null) {
mapping = config.buildMapping();
}
- if (dialect == null) {
+ if (dialect == null && config != null) {
final String dialectName = config.getProperty(Environment.DIALECT);
if (dialectName != null) {
try {
Modified: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.test/src/org/jboss/tools/hibernate/ui/diagram/editors/model/test/OrmDiagramTest.java
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.test/src/org/jboss/tools/hibernate/ui/diagram/editors/model/test/OrmDiagramTest.java 2009-10-07 10:14:09 UTC (rev 17952)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.test/src/org/jboss/tools/hibernate/ui/diagram/editors/model/test/OrmDiagramTest.java 2009-10-07 11:21:00 UTC (rev 17953)
@@ -43,6 +43,8 @@
final ConsoleConfiguration consoleConfig = context.mock(ConsoleConfiguration.class);
final Configuration config = context.mock(Configuration.class);
final RootClass ioe = context.mock(RootClass.class);
+ ArrayList<RootClass> rts = new ArrayList<RootClass>();
+ rts.add(ioe);
final List<Object> emptyList = new ArrayList<Object>();
final Iterator<Object> emptyListIterator = emptyList.iterator();
@@ -94,7 +96,11 @@
will(returnValue("")); //$NON-NLS-1$
}
});
- final OrmDiagram ormDiagram = new OrmDiagram(consoleConfig, ioe);
+ final OrmDiagram ormDiagram = new OrmDiagram("", rts) { //$NON-NLS-1$
+ public ConsoleConfiguration getConsoleConfig() {
+ return consoleConfig;
+ }
+ };
ormDiagram.saveInFile();
// test is the folder created
File folder = new File(ormDiagram.getStoreFolderPath().toOSString());
16 years, 6 months
JBoss Tools SVN: r17952 - trunk/seam/docs/reference/en/modules.
by jbosstools-commits@lists.jboss.org
Author: ochikvina
Date: 2009-10-07 06:14:09 -0400 (Wed, 07 Oct 2009)
New Revision: 17952
Modified:
trunk/seam/docs/reference/en/modules/seam_editors.xml
Log:
https://jira.jboss.org/jira/browse/JBDS-773 - updating the 'Seam Validation' section, adding new screenshots and description on the new validation feature;
Modified: trunk/seam/docs/reference/en/modules/seam_editors.xml
===================================================================
--- trunk/seam/docs/reference/en/modules/seam_editors.xml 2009-10-07 10:11:52 UTC (rev 17951)
+++ trunk/seam/docs/reference/en/modules/seam_editors.xml 2009-10-07 10:14:09 UTC (rev 17952)
@@ -637,9 +637,45 @@
<para>On WTP projects validation are enabled by default and thus executed automatically, but
on normal Java projects you will have to go and add the Validation builder of your
project . It is available in the properties of your project under
- <property>Validation</property>. The validations can be run manually by clicking
- <property>Validate</property> via the context menu on your project which will
- execute all the active WTP validations.</para>
+ <emphasis><property>Validation</property>.</emphasis></para>
+
+ <figure>
+ <title>Enabling the Validation Builder</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/seam_editors/validator1.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>The validations can be run manually by clicking
+ <emphasis><property>Validate</property></emphasis> via the context menu on your project (folder or file inside your project) which will
+ execute all the active WTP validations. Following to the project's preferences under <emphasis>
+ <property>Validation</property></emphasis> it's possible to enable/disable any validator.
+ </para>
+
+ <para>It's also possible to turn off the validation for some resource (a file, folder) inside your project via the <emphasis>
+ <property>Exclude Validation</property></emphasis> context menu option.</para>
+
+ <figure>
+ <title>Excluding Validation for the WebContent Folder</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/seam_editors/validator2.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>As a result, if you've turned off the validation for a folder (or file), it is put to the excluded group of the Validation filters and be ignored during the validation.</para>
+
+ <figure>
+ <title>Validation Filters</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/seam_editors/validator3.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
</section>
</section>
16 years, 6 months
JBoss Tools SVN: r17951 - trunk/seam/docs/reference/en/images/seam_editors.
by jbosstools-commits@lists.jboss.org
Author: ochikvina
Date: 2009-10-07 06:11:52 -0400 (Wed, 07 Oct 2009)
New Revision: 17951
Added:
trunk/seam/docs/reference/en/images/seam_editors/validator1.png
trunk/seam/docs/reference/en/images/seam_editors/validator2.png
trunk/seam/docs/reference/en/images/seam_editors/validator3.png
Log:
https://jira.jboss.org/jira/browse/JBDS-773 - adding new screenshots;
Added: trunk/seam/docs/reference/en/images/seam_editors/validator1.png
===================================================================
(Binary files differ)
Property changes on: trunk/seam/docs/reference/en/images/seam_editors/validator1.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/seam/docs/reference/en/images/seam_editors/validator2.png
===================================================================
(Binary files differ)
Property changes on: trunk/seam/docs/reference/en/images/seam_editors/validator2.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/seam/docs/reference/en/images/seam_editors/validator3.png
===================================================================
(Binary files differ)
Property changes on: trunk/seam/docs/reference/en/images/seam_editors/validator3.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
16 years, 6 months
JBoss Tools SVN: r17950 - trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2009-10-06 15:05:58 -0400 (Tue, 06 Oct 2009)
New Revision: 17950
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/AddModuleDependenciesPropertiesPage.java
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/ExportedClasspathFoldersReferenceWizardFragment.java
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/NewReferenceWizard.java
trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/OutputFolderReferenceWizardFragment.java
Log:
JBIDE-4983 - handling consumed references in the new UI
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/AddModuleDependenciesPropertiesPage.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/AddModuleDependenciesPropertiesPage.java 2009-10-06 18:10:06 UTC (rev 17949)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/AddModuleDependenciesPropertiesPage.java 2009-10-06 19:05:58 UTC (rev 17950)
@@ -67,6 +67,7 @@
import org.eclipse.wst.common.componentcore.ComponentCore;
import org.eclipse.wst.common.componentcore.datamodel.properties.ICreateReferenceComponentsDataModelProperties;
import org.eclipse.wst.common.componentcore.internal.ComponentResource;
+import org.eclipse.wst.common.componentcore.internal.DependencyType;
import org.eclipse.wst.common.componentcore.internal.StructureEdit;
import org.eclipse.wst.common.componentcore.internal.WorkbenchComponent;
import org.eclipse.wst.common.componentcore.internal.operation.CreateReferenceComponentsDataModelProvider;
@@ -110,6 +111,8 @@
// Mappings that are current
protected HashMap<IVirtualComponent, String> objectToRuntimePath = new HashMap<IVirtualComponent, String>();
+ protected ArrayList<IVirtualComponent> consumedReferences = new ArrayList<IVirtualComponent>();
+
// A single list of wb-resource mappings. If there's any change,
// all old will be removed and new ones added
protected ArrayList<ComponentResourceProxy> resourceMappings = new ArrayList<ComponentResourceProxy>();
@@ -481,10 +484,15 @@
WizardDialog wd = new WizardDialog(addReferenceButton.getShell(), wizard);
if( wd.open() != Window.CANCEL) {
if( editing && selected != null) {
- objectToRuntimePath.remove(selected); // remove old
+ // remove old
+ objectToRuntimePath.remove(selected);
+ consumedReferences.remove(selected);
}
+
Object c1 = wizard.getTaskModel().getObject(NewReferenceWizard.COMPONENT);
Object p1 = wizard.getTaskModel().getObject(NewReferenceWizard.COMPONENT_PATH);
+ DependencyType type = (DependencyType)wizard.getTaskModel().getObject(NewReferenceWizard.DEPENDENCY_TYPE);
+ boolean consumed = type == null ? false : type.equals(DependencyType.CONSUMES_LITERAL);
IVirtualComponent[] compArr = c1 instanceof IVirtualComponent ?
new IVirtualComponent[] { (IVirtualComponent)c1 } :
(IVirtualComponent[])c1;
@@ -493,6 +501,8 @@
(String[])p1;
for( int i = 0; i < compArr.length; i++ ) {
objectToRuntimePath.put(compArr[i], pathArr[i]);
+ if( consumed )
+ consumedReferences.add(compArr[i]);
}
refresh();
}
@@ -589,6 +599,8 @@
objectToRuntimePath.put(comp, val.toString());
oldComponentToRuntimePath.put((IVirtualComponent) comp, val.toString());
+ if( refs[i].getDependencyType() == DependencyType.CONSUMES)
+ consumedReferences.add(comp);
}
ComponentResource[] allMappings = findAllMappings();
@@ -785,8 +797,14 @@
protected IDataModelOperation getRemoveComponentOperation(IVirtualComponent component) {
String path, archiveName;
- path = new Path(oldComponentToRuntimePath.get(component)).removeLastSegments(1).toString();
- archiveName = new Path(oldComponentToRuntimePath.get(component)).lastSegment();
+ path = archiveName = null;
+
+ if( !consumedReferences.contains(component)) {
+ path = new Path(oldComponentToRuntimePath.get(component)).removeLastSegments(1).toString();
+ archiveName = new Path(oldComponentToRuntimePath.get(component)).lastSegment();
+ } else {
+ path = oldComponentToRuntimePath.get(component);
+ }
IDataModelProvider provider = getRemoveReferenceDataModelProvider(component);
IDataModel model = DataModelFactory.createDataModel(provider);
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/ExportedClasspathFoldersReferenceWizardFragment.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/ExportedClasspathFoldersReferenceWizardFragment.java 2009-10-06 18:10:06 UTC (rev 17949)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/ExportedClasspathFoldersReferenceWizardFragment.java 2009-10-06 19:05:58 UTC (rev 17950)
@@ -36,6 +36,7 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.internal.SharedImages;
+import org.eclipse.wst.common.componentcore.internal.DependencyType;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
@@ -191,6 +192,7 @@
ExportedClasspathFoldersVirtualComponent vc = new ExportedClasspathFoldersVirtualComponent(parentComp.getProject(), parentComp);
getTaskModel().putObject(NewReferenceWizard.COMPONENT, vc);
getTaskModel().putObject(NewReferenceWizard.COMPONENT_PATH, "/");
+ getTaskModel().putObject(NewReferenceWizard.DEPENDENCY_TYPE, DependencyType.CONSUMES_LITERAL);
}
protected IPath getOriginalPath(IClasspathEntry entry) {
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/NewReferenceWizard.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/NewReferenceWizard.java 2009-10-06 18:10:06 UTC (rev 17949)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/NewReferenceWizard.java 2009-10-06 19:05:58 UTC (rev 17950)
@@ -14,7 +14,9 @@
public static final String COMPONENT_PATH = "dependency.component.path";
public static final String PROJECT = "root.project";
public static final String ROOT_COMPONENT = "root.component";
+ public static final String DEPENDENCY_TYPE = "dependency.type";
+
public NewReferenceWizard() {
super("New Reference Wizard", new RootWizardFragment());
getRootFragment().setTaskModel(getTaskModel());
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/OutputFolderReferenceWizardFragment.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/OutputFolderReferenceWizardFragment.java 2009-10-06 18:10:06 UTC (rev 17949)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.wtp.ui/src/org/jboss/ide/eclipse/as/wtp/ui/propertypage/OutputFolderReferenceWizardFragment.java 2009-10-06 19:05:58 UTC (rev 17950)
@@ -20,6 +20,7 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.internal.SharedImages;
+import org.eclipse.wst.common.componentcore.internal.DependencyType;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.server.ui.wizard.IWizardHandle;
import org.eclipse.wst.server.ui.wizard.WizardFragment;
@@ -107,6 +108,7 @@
selected = selected == null ? parentComp.getProject() : selected;
OutputFoldersVirtualComponent vc = new OutputFoldersVirtualComponent(selected, parentComp);
getTaskModel().putObject(NewReferenceWizard.COMPONENT, vc);
+ getTaskModel().putObject(NewReferenceWizard.DEPENDENCY_TYPE, DependencyType.CONSUMES_LITERAL);
String s = (String)getTaskModel().getObject(NewReferenceWizard.COMPONENT_PATH);
if( s == null )
getTaskModel().putObject(NewReferenceWizard.COMPONENT_PATH, "/");
16 years, 6 months
JBoss Tools SVN: r17949 - trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2009-10-06 14:10:06 -0400 (Tue, 06 Oct 2009)
New Revision: 17949
Modified:
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/ESBProjectWizard.java
Log:
Missing call to superclass constructor
Modified: trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/ESBProjectWizard.java
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/ESBProjectWizard.java 2009-10-06 18:03:41 UTC (rev 17948)
+++ trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/wizards/ESBProjectWizard.java 2009-10-06 18:10:06 UTC (rev 17949)
@@ -40,6 +40,7 @@
INewWizard {
public ESBProjectWizard() {
+ super();
setWindowTitle(JBossESBUIMessages.ESBProjectWizard_Title);
setDefaultPageImageDescriptor(ESBSharedImages.getImageDescriptor(ESBSharedImages.WIZARD_NEW_PROJECT));
}
16 years, 6 months
JBoss Tools SVN: r17948 - trunk/bpel/features/org.jboss.tools.bpel.feature.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2009-10-06 14:03:41 -0400 (Tue, 06 Oct 2009)
New Revision: 17948
Modified:
trunk/bpel/features/org.jboss.tools.bpel.feature/feature.xml
Log:
JBIDE-4938 removing the ode runtime objects as their publish method is now incorrect
Modified: trunk/bpel/features/org.jboss.tools.bpel.feature/feature.xml
===================================================================
--- trunk/bpel/features/org.jboss.tools.bpel.feature/feature.xml 2009-10-06 17:55:04 UTC (rev 17947)
+++ trunk/bpel/features/org.jboss.tools.bpel.feature/feature.xml 2009-10-06 18:03:41 UTC (rev 17948)
@@ -36,13 +36,6 @@
unpack="false"/>
<plugin
- id="org.eclipse.bpel.apache.ode.runtime"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
id="org.eclipse.bpel.common.model"
download-size="0"
install-size="0"
16 years, 6 months
JBoss Tools SVN: r17947 - trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-10-06 13:55:04 -0400 (Tue, 06 Oct 2009)
New Revision: 17947
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbObject.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4979
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbObject.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbObject.java 2009-10-06 17:53:57 UTC (rev 17946)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbObject.java 2009-10-06 17:55:04 UTC (rev 17947)
@@ -32,7 +32,7 @@
/**
* @author Viacheslav Kabanovich
*/
-public class KbObject {
+public class KbObject implements Cloneable {
/**
* Object that allows to identify this object.
*/
16 years, 6 months