JBoss Tools SVN: r16358 - trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2009-07-02 14:42:04 -0400 (Thu, 02 Jul 2009)
New Revision: 16358
Added:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/.settings/
Modified:
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/.project
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/build.properties
trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/plugin.properties
Log:
https://jira.jboss.org/jira/browse/JBIDE-4524 - rename veditor plugin
Modified: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/.project
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/.project 2009-07-02 18:39:40 UTC (rev 16357)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/.project 2009-07-02 18:42:04 UTC (rev 16358)
@@ -1,28 +1,28 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.jboss.tools.hibernate.ui.veditor.test</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.hibernate.ui.test</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Modified: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/build.properties
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/build.properties 2009-07-02 18:39:40 UTC (rev 16357)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/build.properties 2009-07-02 18:42:04 UTC (rev 16358)
@@ -1,9 +1,9 @@
bin.includes = META-INF/,\
- org.jboss.tools.hibernate.ui.veditor.test.jar,\
+ org.jboss.tools.hibernate.ui.diagram.test.jar,\
plugin.properties
-jars.compile.order = org.jboss.tools.hibernate.ui.veditor.test.jar
-source.org.jboss.tools.hibernate.ui.veditor.test.jar = src/
-output.org.jboss.tools.hibernate.ui.veditor.test.jar = bin/
+jars.compile.order = org.jboss.tools.hibernate.ui.diagram.test.jar
+source.org.jboss.tools.hibernate.ui.diagram.test.jar = src/
+output.org.jboss.tools.hibernate.ui.diagram.test.jar = bin/
src.includes = src/,\
build.properties,\
META-INF/,\
Modified: trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/plugin.properties
===================================================================
--- trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/plugin.properties 2009-07-02 18:39:40 UTC (rev 16357)
+++ trunk/hibernatetools/tests/org.jboss.tools.hibernate.ui.veditor.test/plugin.properties 2009-07-02 18:42:04 UTC (rev 16358)
@@ -1,3 +1,3 @@
-#Properties file for org.jboss.tools.hibernate.ui.veditor.test
+#Properties file for org.jboss.tools.hibernate.ui.diagram.test
Bundle-Vendor.0 = JBoss by Red Hat
-Bundle-Name.0 = Visual Editor Test Plug-in
\ No newline at end of file
+Bundle-Name.0 = UI Test Plug-in
\ No newline at end of file
14 years, 9 months
JBoss Tools SVN: r16357 - in trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors: actions and 7 other directories.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2009-07-02 14:39:40 -0400 (Thu, 02 Jul 2009)
New Revision: 16357
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/DiagramContentOutlinePage.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/EditorActionContributor.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/AutoLayoutAction.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ExportImageAction.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/OpenMappingAction.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/OpenSourceAction.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/autolayout/AutoLayout.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/autolayout/IDiagramInfo.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/autolayout/IItemInfo.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/autolayout/ILinkInfo.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/autolayout/impl/AutoLayoutImpl.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/autolayout/impl/Group.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/autolayout/impl/GroupArranger.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/autolayout/impl/Groups.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/autolayout/impl/Item.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/autolayout/impl/Items.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/autolayout/impl/LayuotConstants.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/autolayout/impl/TransitionArranger.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/command/ShapeSetConstraintCommand.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/figures/ComponentFigure.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/figures/RoundLineBorder.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/figures/RoundPolylineConnection.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/figures/TitleFigure.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/figures/TitleLabel.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/figures/TopLineBorder.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/model/ComponentShape.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/model/Connection.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/model/ExpandeableShape.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/model/ModelElement.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmDiagram.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmShape.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/model/Shape.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/model/SpecialOrmShape.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/model/SpecialRootClass.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ColorConstants.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ComponentShapeEditPart.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ConnectionEditPart.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/DiagramEditPart.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/DiagramTreeEditPart.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ExpandeableShapeEditPart.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ExpandeableShapeTreeEditPart.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/GEFRootEditPart.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/OrmEditPart.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/OrmEditPartFactory.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/OrmShapeEditPart.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ResourceManager.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ShapeEditPart.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ShapeTreeEditPart.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/TreePartFactory.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/popup/PopupMenuProvider.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4524 - rename veditor plugin
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/DiagramContentOutlinePage.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/DiagramContentOutlinePage.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/DiagramContentOutlinePage.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -8,7 +8,7 @@
* Contributor:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.hibernate.ui.veditor.editors;
+package org.jboss.tools.hibernate.ui.diagram.editors;
import java.util.HashSet;
import java.util.Set;
@@ -38,8 +38,8 @@
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.part.IPageSite;
import org.eclipse.ui.part.PageBook;
-import org.jboss.tools.hibernate.ui.veditor.editors.model.OrmDiagram;
-import org.jboss.tools.hibernate.ui.veditor.editors.parts.TreePartFactory;
+import org.jboss.tools.hibernate.ui.diagram.editors.model.OrmDiagram;
+import org.jboss.tools.hibernate.ui.diagram.editors.parts.TreePartFactory;
public class DiagramContentOutlinePage extends ContentOutlinePage implements
@@ -47,7 +47,7 @@
private GraphicalViewer graphicalViewer;
- private VisualEditor editor;
+ private DiagramViewer editor;
private OrmDiagram ormDiagram;
@@ -149,7 +149,7 @@
}
};
showOutlineAction.setImageDescriptor(ImageDescriptor.createFromFile(
- VisualEditor.class,"icons/outline.gif")); //$NON-NLS-1$
+ DiagramViewer.class,"icons/outline.gif")); //$NON-NLS-1$
tbm.add(showOutlineAction);
showOverviewAction = new Action() {
public void run() {
@@ -157,7 +157,7 @@
}
};
showOverviewAction.setImageDescriptor(ImageDescriptor.createFromFile(
- VisualEditor.class,"icons/overview.gif")); //$NON-NLS-1$
+ DiagramViewer.class,"icons/overview.gif")); //$NON-NLS-1$
tbm.add(showOverviewAction);
showPage(ID_OVERVIEW);
}
@@ -310,11 +310,11 @@
this.ormDiagram = ormDiagram;
}
- public VisualEditor getEditor() {
+ public DiagramViewer getEditor() {
return editor;
}
- public void setEditor(VisualEditor editor) {
+ public void setEditor(DiagramViewer editor) {
this.editor = editor;
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/EditorActionContributor.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/EditorActionContributor.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/EditorActionContributor.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -8,7 +8,7 @@
* Contributor:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.hibernate.ui.veditor.editors;
+package org.jboss.tools.hibernate.ui.diagram.editors;
import org.eclipse.gef.ui.actions.ActionBarContributor;
import org.eclipse.gef.ui.actions.RedoRetargetAction;
@@ -16,16 +16,16 @@
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.ui.actions.ActionFactory;
import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
-import org.jboss.tools.hibernate.ui.veditor.UIVEditorMessages;
+import org.jboss.tools.hibernate.ui.diagram.DiagramViewerMessages;
+import org.jboss.tools.hibernate.ui.diagram.UiPlugin;
import org.jboss.tools.hibernate.ui.view.ImageBundle;
-import org.jboss.tools.hibernate.ui.view.ViewPlugin;
public class EditorActionContributor extends ActionBarContributor {
protected void buildActions() {
IWorkbenchAction workbenchAction = ActionFactory.REFRESH.create(getPage().getWorkbenchWindow());
- workbenchAction.setImageDescriptor(ViewPlugin.getImageDescriptor(ImageBundle.getString("Explorer.refreshOrmGef"))); //$NON-NLS-1$
- workbenchAction.setToolTipText(UIVEditorMessages.EditorActionContributor_refresh_visual_mapping);
+ workbenchAction.setImageDescriptor(UiPlugin.getImageDescriptor2(ImageBundle.getString("Explorer.refreshOrmGef"))); //$NON-NLS-1$
+ workbenchAction.setToolTipText(DiagramViewerMessages.EditorActionContributor_refresh_visual_mapping);
addAction(workbenchAction);
addRetargetAction(new UndoRetargetAction());
addRetargetAction(new RedoRetargetAction());
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/AutoLayoutAction.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/AutoLayoutAction.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/AutoLayoutAction.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -8,23 +8,23 @@
* Contributors:
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.hibernate.ui.veditor.editors.actions;
+package org.jboss.tools.hibernate.ui.diagram.editors.actions;
import org.eclipse.jface.action.Action;
-import org.jboss.tools.hibernate.ui.veditor.editors.VisualEditor;
+import org.jboss.tools.hibernate.ui.diagram.editors.DiagramViewer;
public class AutoLayoutAction extends Action {
public static final String ACTION_ID = "Auto layout"; //$NON-NLS-1$
- private VisualEditor editor;
+ private DiagramViewer editor;
- public AutoLayoutAction(VisualEditor editor) {
+ public AutoLayoutAction(DiagramViewer editor) {
this.editor = editor;
setId(ACTION_ID);
setText(ACTION_ID);
//setImageDescriptor(ImageDescriptor.createFromFile(
- // VisualEditor.class, "icons/export.png"));
+ // DiagramViewer.class, "icons/export.png"));
}
public void run() {
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ExportImageAction.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ExportImageAction.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ExportImageAction.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -8,7 +8,7 @@
* Contributor:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.hibernate.ui.veditor.editors.actions;
+package org.jboss.tools.hibernate.ui.diagram.editors.actions;
import java.io.ByteArrayOutputStream;
import java.io.FileOutputStream;
@@ -30,25 +30,25 @@
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.ImageLoader;
import org.eclipse.swt.widgets.FileDialog;
-import org.jboss.tools.hibernate.ui.veditor.UIVEditorMessages;
-import org.jboss.tools.hibernate.ui.veditor.editors.VisualEditor;
+import org.jboss.tools.hibernate.ui.diagram.DiagramViewerMessages;
+import org.jboss.tools.hibernate.ui.diagram.editors.DiagramViewer;
public class ExportImageAction extends Action {
public static final String ACTION_ID = "Export as Image"; //$NON-NLS-1$
public static final String[] dialogFilterExtensions = new String[] { "*.png", "*.jpg", "*.bmp" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- public static final String[] dialogFilterNames = new String[] { UIVEditorMessages.ExportImageAction_png_format,
- UIVEditorMessages.ExportImageAction_jpg_format, UIVEditorMessages.ExportImageAction_bmp_format };
+ public static final String[] dialogFilterNames = new String[] { DiagramViewerMessages.ExportImageAction_png_format,
+ DiagramViewerMessages.ExportImageAction_jpg_format, DiagramViewerMessages.ExportImageAction_bmp_format };
- private VisualEditor editor;
+ private DiagramViewer editor;
private FileDialog saveDialog = null;
- public ExportImageAction(VisualEditor editor) {
+ public ExportImageAction(DiagramViewer editor) {
this.editor = editor;
setId(ACTION_ID);
setText(ACTION_ID);
setImageDescriptor(ImageDescriptor.createFromFile(
- VisualEditor.class,"icons/export.png")); //$NON-NLS-1$
+ DiagramViewer.class,"icons/export.png")); //$NON-NLS-1$
}
/**
@@ -93,7 +93,7 @@
outStream.flush();
} catch (Exception e) {
MessageDialog.openInformation(this.editor.getSite().getShell(),
- UIVEditorMessages.ExportImageAction_error, UIVEditorMessages.ExportImageAction_failed_to_export_image + e.getMessage());
+ DiagramViewerMessages.ExportImageAction_error, DiagramViewerMessages.ExportImageAction_failed_to_export_image + e.getMessage());
return;
}
finally {
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/OpenMappingAction.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/OpenMappingAction.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/OpenMappingAction.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -8,7 +8,7 @@
* Contributor:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.hibernate.ui.veditor.editors.actions;
+package org.jboss.tools.hibernate.ui.diagram.editors.actions;
import java.io.FileNotFoundException;
import java.util.Iterator;
@@ -21,34 +21,35 @@
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.mapping.Property;
-import org.jboss.tools.hibernate.ui.veditor.UIVEditorMessages;
-import org.jboss.tools.hibernate.ui.veditor.VisualEditorPlugin;
-import org.jboss.tools.hibernate.ui.veditor.editors.VisualEditor;
-import org.jboss.tools.hibernate.ui.veditor.editors.model.SpecialRootClass;
-import org.jboss.tools.hibernate.ui.view.views.ObjectEditorInput;
+import org.jboss.tools.hibernate.ui.diagram.DiagramViewerMessages;
+import org.jboss.tools.hibernate.ui.diagram.UiPlugin;
+import org.jboss.tools.hibernate.ui.diagram.editors.DiagramViewer;
+import org.jboss.tools.hibernate.ui.diagram.editors.model.SpecialRootClass;
+import org.jboss.tools.hibernate.ui.view.ObjectEditorInput;
/**
* @author Dmitry Geraskov
*
*/
public class OpenMappingAction extends SelectionAction {
- public static final String ACTION_ID = "org.jboss.tools.hibernate.ui.veditor.editors.actions.open.mapping"; //$NON-NLS-1$
+ public static final String ACTION_ID = "org.jboss.tools.hibernate.ui.diagram.editors.actions.open.mapping"; //$NON-NLS-1$
public OpenMappingAction(IWorkbenchPart part) {
super(part);
setId(ACTION_ID);
- setText(UIVEditorMessages.OpenMappingAction_open_mapping_file);
- setImageDescriptor(VisualEditorPlugin.getImageDescriptor("icons/mapping.gif")); //$NON-NLS-1$
+ setText(DiagramViewerMessages.OpenMappingAction_open_mapping_file);
+ setImageDescriptor(UiPlugin.getImageDescriptor("icons/mapping.gif")); //$NON-NLS-1$
}
public void run() {
- ObjectEditorInput objectEditorInput = (ObjectEditorInput)((VisualEditor)getWorkbenchPart()).getEditorInput();
+ ObjectEditorInput objectEditorInput = (ObjectEditorInput)((DiagramViewer)getWorkbenchPart()).getEditorInput();
ConsoleConfiguration consoleConfig = objectEditorInput.getConfiguration();
- VisualEditor part = (VisualEditor)getWorkbenchPart();
- Set selectedElements = part.getSelectedElements();
+ DiagramViewer part = (DiagramViewer)getWorkbenchPart();
+ //Set selectedElements = part.getSelectedElements();
+ Set<Object> selectedElements = part.getSelectedElements2();
- Iterator iterator = selectedElements.iterator();
+ Iterator<Object> iterator = selectedElements.iterator();
while (iterator.hasNext()) {
Object selection = iterator.next();
if (selection instanceof Property
@@ -58,11 +59,11 @@
try {
org.hibernate.eclipse.console.actions.OpenMappingAction.run(consoleConfig, compositSel, parentProperty);
} catch (PartInitException e) {
- HibernateConsolePlugin.getDefault().logErrorMessage(UIVEditorMessages.OpenMappingAction_canot_find_or_open_mapping_file, e);
+ HibernateConsolePlugin.getDefault().logErrorMessage(DiagramViewerMessages.OpenMappingAction_canot_find_or_open_mapping_file, e);
} catch (JavaModelException e) {
- HibernateConsolePlugin.getDefault().logErrorMessage(UIVEditorMessages.OpenMappingAction_canot_find_or_open_mapping_file, e);
+ HibernateConsolePlugin.getDefault().logErrorMessage(DiagramViewerMessages.OpenMappingAction_canot_find_or_open_mapping_file, e);
} catch (FileNotFoundException e) {
- HibernateConsolePlugin.getDefault().logErrorMessage(UIVEditorMessages.OpenMappingAction_canot_find_or_open_mapping_file, e);
+ HibernateConsolePlugin.getDefault().logErrorMessage(DiagramViewerMessages.OpenMappingAction_canot_find_or_open_mapping_file, e);
}
continue;
}
@@ -72,17 +73,17 @@
try {
org.hibernate.eclipse.console.actions.OpenMappingAction.run(consoleConfig, selection);
} catch (PartInitException e) {
- HibernateConsolePlugin.getDefault().logErrorMessage(UIVEditorMessages.OpenMappingAction_open_mapping_file, e);
+ HibernateConsolePlugin.getDefault().logErrorMessage(DiagramViewerMessages.OpenMappingAction_open_mapping_file, e);
} catch (JavaModelException e) {
- HibernateConsolePlugin.getDefault().logErrorMessage(UIVEditorMessages.OpenMappingAction_open_mapping_file, e);
+ HibernateConsolePlugin.getDefault().logErrorMessage(DiagramViewerMessages.OpenMappingAction_open_mapping_file, e);
} catch (FileNotFoundException e) {
- HibernateConsolePlugin.getDefault().logErrorMessage(UIVEditorMessages.OpenMappingAction_open_mapping_file, e);
+ HibernateConsolePlugin.getDefault().logErrorMessage(DiagramViewerMessages.OpenMappingAction_open_mapping_file, e);
}
}
}
protected boolean calculateEnabled() {
- VisualEditor part = (VisualEditor)getWorkbenchPart();
+ DiagramViewer part = (DiagramViewer)getWorkbenchPart();
return part.getSelectedElements().size() > 0;
}
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/OpenSourceAction.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/OpenSourceAction.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/OpenSourceAction.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -1,4 +1,4 @@
-package org.jboss.tools.hibernate.ui.veditor.editors.actions;
+package org.jboss.tools.hibernate.ui.diagram.editors.actions;
import java.io.FileNotFoundException;
import java.util.Iterator;
@@ -13,30 +13,30 @@
import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.Property;
-import org.jboss.tools.hibernate.ui.veditor.UIVEditorMessages;
-import org.jboss.tools.hibernate.ui.veditor.VisualEditorPlugin;
-import org.jboss.tools.hibernate.ui.veditor.editors.VisualEditor;
-import org.jboss.tools.hibernate.ui.view.views.ObjectEditorInput;
+import org.jboss.tools.hibernate.ui.diagram.DiagramViewerMessages;
+import org.jboss.tools.hibernate.ui.diagram.UiPlugin;
+import org.jboss.tools.hibernate.ui.diagram.editors.DiagramViewer;
+import org.jboss.tools.hibernate.ui.view.ObjectEditorInput;
/**
* @author Dmitry Geraskov
*
*/
public class OpenSourceAction extends SelectionAction {
- public static final String ACTION_ID = "org.jboss.tools.hibernate.ui.veditor.editors.actions.open.source"; //$NON-NLS-1$
+ public static final String ACTION_ID = "org.jboss.tools.hibernate.ui.diagram.editors.actions.open.source"; //$NON-NLS-1$
public OpenSourceAction(IWorkbenchPart part) {
super(part);
setId(ACTION_ID);
- setText(UIVEditorMessages.OpenSourceAction_open_source_file);
- setImageDescriptor(VisualEditorPlugin.getImageDescriptor("icons/java.gif")); //$NON-NLS-1$
+ setText(DiagramViewerMessages.OpenSourceAction_open_source_file);
+ setImageDescriptor(UiPlugin.getImageDescriptor("icons/java.gif")); //$NON-NLS-1$
}
public void run() {
- ObjectEditorInput objectEditorInput = (ObjectEditorInput)((VisualEditor)getWorkbenchPart()).getEditorInput();
+ ObjectEditorInput objectEditorInput = (ObjectEditorInput)((DiagramViewer)getWorkbenchPart()).getEditorInput();
ConsoleConfiguration consoleConfig = objectEditorInput.getConfiguration();
- VisualEditor part = (VisualEditor)getWorkbenchPart();
+ DiagramViewer part = (DiagramViewer)getWorkbenchPart();
Set selectedElements = part.getSelectedElements();
Iterator iterator = selectedElements.iterator();
@@ -60,20 +60,20 @@
try {
new org.hibernate.eclipse.console.actions.OpenSourceAction().run(consoleConfig, selection, fullyQualifiedName);
} catch (PartInitException e) {
- HibernateConsolePlugin.getDefault().logErrorMessage(UIVEditorMessages.OpenSourceAction_canot_open_source_file, e);
+ HibernateConsolePlugin.getDefault().logErrorMessage(DiagramViewerMessages.OpenSourceAction_canot_open_source_file, e);
} catch (JavaModelException e) {
- HibernateConsolePlugin.getDefault().logErrorMessage(UIVEditorMessages.OpenSourceAction_canot_find_source_file, e);
+ HibernateConsolePlugin.getDefault().logErrorMessage(DiagramViewerMessages.OpenSourceAction_canot_find_source_file, e);
} catch (FileNotFoundException e) {
- HibernateConsolePlugin.getDefault().logErrorMessage(UIVEditorMessages.OpenSourceAction_canot_find_source_file, e);
+ HibernateConsolePlugin.getDefault().logErrorMessage(DiagramViewerMessages.OpenSourceAction_canot_find_source_file, e);
}
}
}
protected boolean calculateEnabled() {
- //VisualEditor part = (VisualEditor)getWorkbenchPart();
- //return part.getSelectedElements().size() > 0;
- /**/
- VisualEditor part = (VisualEditor)getWorkbenchPart();
+ DiagramViewer part = (DiagramViewer)getWorkbenchPart();
+ return part.getSelectedElements().size() > 0;
+ /** /
+ DiagramViewer part = (DiagramViewer)getWorkbenchPart();
Set selectedElements = part.getSelectedElements();
Iterator iterator = selectedElements.iterator();
while (iterator.hasNext()) {
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/autolayout/AutoLayout.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/autolayout/AutoLayout.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/autolayout/AutoLayout.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -8,10 +8,10 @@
* Contributor:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.hibernate.ui.veditor.editors.autolayout;
+package org.jboss.tools.hibernate.ui.diagram.editors.autolayout;
-import org.jboss.tools.hibernate.ui.veditor.editors.autolayout.impl.AutoLayoutImpl;
-import org.jboss.tools.hibernate.ui.veditor.editors.autolayout.impl.Items;
+import org.jboss.tools.hibernate.ui.diagram.editors.autolayout.impl.AutoLayoutImpl;
+import org.jboss.tools.hibernate.ui.diagram.editors.autolayout.impl.Items;
public class AutoLayout {
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/autolayout/IDiagramInfo.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/autolayout/IDiagramInfo.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/autolayout/IDiagramInfo.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -8,7 +8,7 @@
* Contributor:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.hibernate.ui.veditor.editors.autolayout;
+package org.jboss.tools.hibernate.ui.diagram.editors.autolayout;
public interface IDiagramInfo {
IItemInfo[] getItems();
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/autolayout/IItemInfo.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/autolayout/IItemInfo.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/autolayout/IItemInfo.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -8,7 +8,7 @@
* Contributor:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.hibernate.ui.veditor.editors.autolayout;
+package org.jboss.tools.hibernate.ui.diagram.editors.autolayout;
public interface IItemInfo {
public String getID();
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/autolayout/ILinkInfo.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/autolayout/ILinkInfo.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/autolayout/ILinkInfo.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -8,7 +8,7 @@
* Contributor:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.hibernate.ui.veditor.editors.autolayout;
+package org.jboss.tools.hibernate.ui.diagram.editors.autolayout;
public interface ILinkInfo {
public String getTargetID();
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/autolayout/impl/AutoLayoutImpl.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/autolayout/impl/AutoLayoutImpl.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/autolayout/impl/AutoLayoutImpl.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -8,11 +8,11 @@
* Contributor:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.hibernate.ui.veditor.editors.autolayout.impl;
+package org.jboss.tools.hibernate.ui.diagram.editors.autolayout.impl;
-import org.jboss.tools.hibernate.ui.veditor.editors.autolayout.IItemInfo;
-import org.jboss.tools.hibernate.ui.veditor.editors.autolayout.ILinkInfo;
-import org.jboss.tools.hibernate.ui.veditor.editors.autolayout.IDiagramInfo;
+import org.jboss.tools.hibernate.ui.diagram.editors.autolayout.IItemInfo;
+import org.jboss.tools.hibernate.ui.diagram.editors.autolayout.ILinkInfo;
+import org.jboss.tools.hibernate.ui.diagram.editors.autolayout.IDiagramInfo;
public class AutoLayoutImpl {
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/autolayout/impl/Group.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/autolayout/impl/Group.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/autolayout/impl/Group.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -8,7 +8,7 @@
* Contributor:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.hibernate.ui.veditor.editors.autolayout.impl;
+package org.jboss.tools.hibernate.ui.diagram.editors.autolayout.impl;
import java.util.ArrayList;
import java.util.List;
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/autolayout/impl/GroupArranger.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/autolayout/impl/GroupArranger.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/autolayout/impl/GroupArranger.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -8,7 +8,7 @@
* Contributor:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.hibernate.ui.veditor.editors.autolayout.impl;
+package org.jboss.tools.hibernate.ui.diagram.editors.autolayout.impl;
public class GroupArranger {
Group group;
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/autolayout/impl/Groups.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/autolayout/impl/Groups.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/autolayout/impl/Groups.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -8,7 +8,7 @@
* Contributor:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.hibernate.ui.veditor.editors.autolayout.impl;
+package org.jboss.tools.hibernate.ui.diagram.editors.autolayout.impl;
import java.util.*;
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/autolayout/impl/Item.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/autolayout/impl/Item.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/autolayout/impl/Item.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -8,12 +8,12 @@
* Contributor:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.hibernate.ui.veditor.editors.autolayout.impl;
+package org.jboss.tools.hibernate.ui.diagram.editors.autolayout.impl;
import java.util.*;
-import org.jboss.tools.hibernate.ui.veditor.editors.autolayout.IItemInfo;
-import org.jboss.tools.hibernate.ui.veditor.editors.autolayout.ILinkInfo;
+import org.jboss.tools.hibernate.ui.diagram.editors.autolayout.IItemInfo;
+import org.jboss.tools.hibernate.ui.diagram.editors.autolayout.ILinkInfo;
public class Item {
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/autolayout/impl/Items.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/autolayout/impl/Items.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/autolayout/impl/Items.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -8,14 +8,14 @@
* Contributor:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.hibernate.ui.veditor.editors.autolayout.impl;
+package org.jboss.tools.hibernate.ui.diagram.editors.autolayout.impl;
import java.util.*;
-import org.jboss.tools.hibernate.ui.veditor.VisualEditorPlugin;
-import org.jboss.tools.hibernate.ui.veditor.editors.autolayout.IItemInfo;
-import org.jboss.tools.hibernate.ui.veditor.editors.autolayout.ILinkInfo;
-import org.jboss.tools.hibernate.ui.veditor.editors.autolayout.IDiagramInfo;
+import org.jboss.tools.hibernate.ui.diagram.UiPlugin;
+import org.jboss.tools.hibernate.ui.diagram.editors.autolayout.IItemInfo;
+import org.jboss.tools.hibernate.ui.diagram.editors.autolayout.ILinkInfo;
+import org.jboss.tools.hibernate.ui.diagram.editors.autolayout.IDiagramInfo;
public class Items {
protected LayuotConstants constants;
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/autolayout/impl/LayuotConstants.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/autolayout/impl/LayuotConstants.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/autolayout/impl/LayuotConstants.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -8,7 +8,7 @@
* Contributor:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.hibernate.ui.veditor.editors.autolayout.impl;
+package org.jboss.tools.hibernate.ui.diagram.editors.autolayout.impl;
public class LayuotConstants {
static int DELTA_X = 200;
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/autolayout/impl/TransitionArranger.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/autolayout/impl/TransitionArranger.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/autolayout/impl/TransitionArranger.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -8,11 +8,11 @@
* Contributor:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.hibernate.ui.veditor.editors.autolayout.impl;
+package org.jboss.tools.hibernate.ui.diagram.editors.autolayout.impl;
import java.util.List;
-import org.jboss.tools.hibernate.ui.veditor.editors.autolayout.ILinkInfo;
+import org.jboss.tools.hibernate.ui.diagram.editors.autolayout.ILinkInfo;
public class TransitionArranger {
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/command/ShapeSetConstraintCommand.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/command/ShapeSetConstraintCommand.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/command/ShapeSetConstraintCommand.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -8,15 +8,15 @@
* Contributor:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.hibernate.ui.veditor.editors.command;
+package org.jboss.tools.hibernate.ui.diagram.editors.command;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.gef.RequestConstants;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.requests.ChangeBoundsRequest;
-import org.jboss.tools.hibernate.ui.veditor.UIVEditorMessages;
-import org.jboss.tools.hibernate.ui.veditor.editors.model.OrmShape;
+import org.jboss.tools.hibernate.ui.diagram.DiagramViewerMessages;
+import org.jboss.tools.hibernate.ui.diagram.editors.model.OrmShape;
public class ShapeSetConstraintCommand extends Command {
@@ -34,7 +34,7 @@
this.shape = shape;
this.request = req;
this.newLocation = newLocation.getCopy();
- setLabel(UIVEditorMessages.ShapeSetConstraintCommand_move);
+ setLabel(DiagramViewerMessages.ShapeSetConstraintCommand_move);
}
public boolean canExecute() {
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/figures/ComponentFigure.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/figures/ComponentFigure.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/figures/ComponentFigure.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -8,7 +8,7 @@
* Contributor:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.hibernate.ui.veditor.editors.figures;
+package org.jboss.tools.hibernate.ui.diagram.editors.figures;
import java.util.List;
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/figures/RoundLineBorder.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/figures/RoundLineBorder.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/figures/RoundLineBorder.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -8,7 +8,7 @@
* Contributor:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.hibernate.ui.veditor.editors.figures;
+package org.jboss.tools.hibernate.ui.diagram.editors.figures;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.IFigure;
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/figures/RoundPolylineConnection.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/figures/RoundPolylineConnection.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/figures/RoundPolylineConnection.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -8,7 +8,7 @@
* Contributor:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.hibernate.ui.veditor.editors.figures;
+package org.jboss.tools.hibernate.ui.diagram.editors.figures;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.PolylineConnection;
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/figures/TitleFigure.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/figures/TitleFigure.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/figures/TitleFigure.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -8,7 +8,7 @@
* Contributor:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.hibernate.ui.veditor.editors.figures;
+package org.jboss.tools.hibernate.ui.diagram.editors.figures;
import java.util.List;
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/figures/TitleLabel.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/figures/TitleLabel.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/figures/TitleLabel.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -8,20 +8,20 @@
* Contributor:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.hibernate.ui.veditor.editors.figures;
+package org.jboss.tools.hibernate.ui.diagram.editors.figures;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.swt.graphics.Image;
+import org.jboss.tools.hibernate.ui.diagram.UiPlugin;
import org.jboss.tools.hibernate.ui.view.ImageBundle;
-import org.jboss.tools.hibernate.ui.view.ViewPlugin;
public class TitleLabel extends Label {
- static Image shevronUp = ViewPlugin.getImageDescriptor(ImageBundle.getString("VisualMapping.shevronUp")).createImage(); //$NON-NLS-1$
- static Image shevronDown = ViewPlugin.getImageDescriptor(ImageBundle.getString("VisualMapping.shevronDown")).createImage(); //$NON-NLS-1$
+ static Image shevronUp = UiPlugin.getImageDescriptor2(ImageBundle.getString("VisualMapping.shevronUp")).createImage(); //$NON-NLS-1$
+ static Image shevronDown = UiPlugin.getImageDescriptor2(ImageBundle.getString("VisualMapping.shevronDown")).createImage(); //$NON-NLS-1$
protected boolean hiden = false;
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/figures/TopLineBorder.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/figures/TopLineBorder.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/figures/TopLineBorder.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -8,7 +8,7 @@
* Contributor:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.hibernate.ui.veditor.editors.figures;
+package org.jboss.tools.hibernate.ui.diagram.editors.figures;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.IFigure;
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/model/ComponentShape.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/model/ComponentShape.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/model/ComponentShape.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -8,7 +8,7 @@
* Contributor:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.hibernate.ui.veditor.editors.model;
+package org.jboss.tools.hibernate.ui.diagram.editors.model;
import java.util.Iterator;
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/model/Connection.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/model/Connection.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/model/Connection.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -8,7 +8,7 @@
* Contributor:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.hibernate.ui.veditor.editors.model;
+package org.jboss.tools.hibernate.ui.diagram.editors.model;
public class Connection extends ModelElement {
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/model/ExpandeableShape.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/model/ExpandeableShape.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/model/ExpandeableShape.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -8,7 +8,7 @@
* Contributor:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.hibernate.ui.veditor.editors.model;
+package org.jboss.tools.hibernate.ui.diagram.editors.model;
public class ExpandeableShape extends Shape {
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/model/ModelElement.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/model/ModelElement.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/model/ModelElement.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -8,7 +8,7 @@
* Contributor:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.hibernate.ui.veditor.editors.model;
+package org.jboss.tools.hibernate.ui.diagram.editors.model;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmDiagram.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmDiagram.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmDiagram.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -8,7 +8,7 @@
* Contributor:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.hibernate.ui.veditor.editors.model;
+package org.jboss.tools.hibernate.ui.diagram.editors.model;
import java.io.File;
import java.io.FileInputStream;
@@ -32,6 +32,7 @@
import org.eclipse.jdt.core.IJavaProject;
import org.hibernate.cfg.Configuration;
import org.hibernate.console.ConsoleConfiguration;
+import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.eclipse.console.utils.ProjectUtils;
import org.hibernate.mapping.Collection;
import org.hibernate.mapping.Column;
@@ -48,8 +49,8 @@
import org.hibernate.mapping.Value;
import org.hibernate.type.EntityType;
import org.hibernate.type.Type;
-import org.jboss.tools.hibernate.ui.veditor.VisualEditorPlugin;
-import org.jboss.tools.hibernate.ui.view.views.HibernateUtils;
+import org.jboss.tools.hibernate.ui.diagram.UiPlugin;
+import org.jboss.tools.hibernate.ui.view.HibernateUtils;
import sun.misc.Compare;
import sun.misc.Sort;
@@ -60,7 +61,7 @@
public static final String DIRTY = "dirty"; //$NON-NLS-1$
private boolean dirty = false;
private String childrenLocations[];
- private HashMap<String,OrmShape> elements = new HashMap<String,OrmShape>();
+ private HashMap<String, OrmShape> elements = new HashMap<String, OrmShape>();
private RootClass[] ormElements;
private ConsoleConfiguration consoleConfig;
private String[] entityNames;
@@ -126,7 +127,7 @@
storePath = javaProject.getProject().getLocation();
}
else {
- storePath = VisualEditorPlugin.getDefault().getStateLocation();
+ storePath = UiPlugin.getDefault().getStateLocation();
}
return storePath.append(".settings").append(HIBERNATE_MAPPING_LAYOUT_FOLDER_NAME); //$NON-NLS-1$
}
@@ -308,100 +309,108 @@
@SuppressWarnings("unchecked")
private OrmShape getOrCreatePersistentClass(PersistentClass persistentClass, Table componentClassDatabaseTable){
OrmShape classShape = null;
+ if (persistentClass == null) {
+ return classShape;
+ }
OrmShape shape = null;
- if(persistentClass != null) {
- classShape = elements.get(HibernateUtils.getPersistentClassName(persistentClass.getEntityName()));
- if (classShape == null) classShape = createShape(persistentClass);
- if(componentClassDatabaseTable == null && persistentClass.getTable() != null)
- componentClassDatabaseTable = persistentClass.getTable();
- if(componentClassDatabaseTable != null) {
- shape = elements.get(HibernateUtils.getTableName(componentClassDatabaseTable));
- if (shape == null) shape = getOrCreateDatabaseTable(componentClassDatabaseTable);
- createConnections(classShape, shape);
- if(!isConnectionExist(classShape, shape)){
- new Connection(classShape, shape);
- classShape.firePropertyChange(REFRESH, null, null);
- shape.firePropertyChange(REFRESH, null, null);
+ classShape = elements.get(HibernateUtils.getPersistentClassName(persistentClass.getEntityName()));
+ if (classShape == null) {
+ classShape = createShape(persistentClass);
+ }
+ if (componentClassDatabaseTable == null && persistentClass.getTable() != null) {
+ componentClassDatabaseTable = persistentClass.getTable();
+ }
+ if (componentClassDatabaseTable != null) {
+ shape = elements.get(HibernateUtils.getTableName(componentClassDatabaseTable));
+ if (shape == null) {
+ shape = getOrCreateDatabaseTable(componentClassDatabaseTable);
+ }
+ createConnections(classShape, shape);
+ if (!isConnectionExist(classShape, shape)) {
+ new Connection(classShape, shape);
+ classShape.firePropertyChange(REFRESH, null, null);
+ shape.firePropertyChange(REFRESH, null, null);
+ }
+ }
+ RootClass rc = (RootClass)persistentClass;
+ Iterator iter = rc.getSubclassIterator();
+ while (iter.hasNext()) {
+ Object element = iter.next();
+ if (element instanceof Subclass) {
+ Subclass subclass = (Subclass)element;
+ OrmShape subclassShape = elements.get(HibernateUtils.getPersistentClassName(subclass.getEntityName()));
+ if (subclassShape == null) {
+ subclassShape = createShape(subclass);
}
- }
- RootClass rc = (RootClass)persistentClass;
- Iterator iter = rc.getSubclassIterator();
- while (iter.hasNext()) {
- Object element = iter.next();
- if (element instanceof Subclass) {
- Subclass subclass = (Subclass)element;
- OrmShape subclassShape = elements.get(HibernateUtils.getPersistentClassName(subclass.getEntityName()));
- if (subclassShape == null) subclassShape = createShape(subclass);
- if (((Subclass)element).isJoinedSubclass()) {
- Table jcTable = ((Subclass)element).getTable();
- OrmShape jcTableShape = getOrCreateDatabaseTable(jcTable);
- createConnections(subclassShape, jcTableShape);
- if(!isConnectionExist(subclassShape, jcTableShape)){
- new Connection(subclassShape, jcTableShape);
- subclassShape.firePropertyChange(REFRESH, null, null);
- jcTableShape.firePropertyChange(REFRESH, null, null);
- }
- } else {
- createConnections(subclassShape, shape);
- if(!isConnectionExist(subclassShape, shape)){
- new Connection(subclassShape, shape);
- subclassShape.firePropertyChange(REFRESH, null, null);
- shape.firePropertyChange(REFRESH, null, null);
- }
+ if (((Subclass)element).isJoinedSubclass()) {
+ Table jcTable = ((Subclass)element).getTable();
+ OrmShape jcTableShape = getOrCreateDatabaseTable(jcTable);
+ createConnections(subclassShape, jcTableShape);
+ if (!isConnectionExist(subclassShape, jcTableShape)) {
+ new Connection(subclassShape, jcTableShape);
+ subclassShape.firePropertyChange(REFRESH, null, null);
+ jcTableShape.firePropertyChange(REFRESH, null, null);
}
- OrmShape ownerTableShape = getOrCreateDatabaseTable(((Subclass)element).getRootTable());
- createConnections(subclassShape, ownerTableShape);
+ } else {
+ createConnections(subclassShape, shape);
+ if (!isConnectionExist(subclassShape, shape)) {
+ new Connection(subclassShape, shape);
+ subclassShape.firePropertyChange(REFRESH, null, null);
+ shape.firePropertyChange(REFRESH, null, null);
+ }
+ }
+ OrmShape ownerTableShape = getOrCreateDatabaseTable(((Subclass)element).getRootTable());
+ createConnections(subclassShape, ownerTableShape);
- Iterator<Join> joinIterator = subclass.getJoinIterator();
- while (joinIterator.hasNext()) {
- Join join = joinIterator.next();
- Iterator<Property> iterator = join.getPropertyIterator();
- while (iterator.hasNext()) {
- Property property = iterator.next();
- OrmShape tableShape = getOrCreateDatabaseTable(property.getValue().getTable());
- createConnections(subclassShape, tableShape);
- subclassShape.firePropertyChange(REFRESH, null, null);
- tableShape.firePropertyChange(REFRESH, null, null);
- }
+ Iterator<Join> joinIterator = subclass.getJoinIterator();
+ while (joinIterator.hasNext()) {
+ Join join = joinIterator.next();
+ Iterator<Property> iterator = join.getPropertyIterator();
+ while (iterator.hasNext()) {
+ Property property = iterator.next();
+ OrmShape tableShape = getOrCreateDatabaseTable(property.getValue().getTable());
+ createConnections(subclassShape, tableShape);
+ subclassShape.firePropertyChange(REFRESH, null, null);
+ tableShape.firePropertyChange(REFRESH, null, null);
}
}
}
+ }
- if (persistentClass.getIdentifier() instanceof Component) {
- Component identifier = (Component)persistentClass.getIdentifier();
- if (identifier.getComponentClassName() != null && !identifier.getComponentClassName().equals(identifier.getOwner().getEntityName())) {
- OrmShape componentClassShape = elements.get(identifier.getComponentClassName());
- if (componentClassShape == null && persistentClass instanceof RootClass) {
- componentClassShape = getOrCreateComponentClass(((RootClass)persistentClass).getIdentifierProperty());
+ if (persistentClass.getIdentifier() instanceof Component) {
+ Component identifier = (Component)persistentClass.getIdentifier();
+ if (identifier.getComponentClassName() != null && !identifier.getComponentClassName().equals(identifier.getOwner().getEntityName())) {
+ OrmShape componentClassShape = elements.get(identifier.getComponentClassName());
+ if (componentClassShape == null && persistentClass instanceof RootClass) {
+ componentClassShape = getOrCreateComponentClass(((RootClass)persistentClass).getIdentifierProperty());
- Shape idPropertyShape = classShape.getChild(persistentClass.getIdentifierProperty());
- if (idPropertyShape != null && !isConnectionExist(idPropertyShape, componentClassShape)) {
- new Connection(idPropertyShape, componentClassShape);
- idPropertyShape.firePropertyChange(REFRESH, null, null);
- componentClassShape.firePropertyChange(REFRESH, null, null);
- }
+ Shape idPropertyShape = classShape.getChild(persistentClass.getIdentifierProperty());
+ if (idPropertyShape != null && !isConnectionExist(idPropertyShape, componentClassShape)) {
+ new Connection(idPropertyShape, componentClassShape);
+ idPropertyShape.firePropertyChange(REFRESH, null, null);
+ componentClassShape.firePropertyChange(REFRESH, null, null);
+ }
- OrmShape tableShape = getOrCreateDatabaseTable(identifier.getTable());
- if (componentClassShape != null) {
- createConnections(componentClassShape, tableShape);
- componentClassShape.firePropertyChange(REFRESH, null, null);
- tableShape.firePropertyChange(REFRESH, null, null);
- }
+ OrmShape tableShape = getOrCreateDatabaseTable(identifier.getTable());
+ if (componentClassShape != null) {
+ createConnections(componentClassShape, tableShape);
+ componentClassShape.firePropertyChange(REFRESH, null, null);
+ tableShape.firePropertyChange(REFRESH, null, null);
}
}
}
+ }
- Iterator joinIterator = persistentClass.getJoinIterator();
- while (joinIterator.hasNext()) {
- Join join = (Join)joinIterator.next();
- Iterator<Property> iterator = join.getPropertyIterator();
- while (iterator.hasNext()) {
- Property property = iterator.next();
- OrmShape tableShape = getOrCreateDatabaseTable(property.getValue().getTable());
- createConnections(classShape, tableShape);
- classShape.firePropertyChange(REFRESH, null, null);
- tableShape.firePropertyChange(REFRESH, null, null);
- }
+ Iterator joinIterator = persistentClass.getJoinIterator();
+ while (joinIterator.hasNext()) {
+ Join join = (Join)joinIterator.next();
+ Iterator<Property> iterator = join.getPropertyIterator();
+ while (iterator.hasNext()) {
+ Property property = iterator.next();
+ OrmShape tableShape = getOrCreateDatabaseTable(property.getValue().getTable());
+ createConnections(classShape, tableShape);
+ classShape.firePropertyChange(REFRESH, null, null);
+ tableShape.firePropertyChange(REFRESH, null, null);
}
}
return classShape;
@@ -410,10 +419,10 @@
@SuppressWarnings("unchecked")
private OrmShape getOrCreateDatabaseTable(Table databaseTable){
OrmShape tableShape = null;
- if(databaseTable != null) {
+ if (databaseTable != null) {
String tableName = HibernateUtils.getTableName(databaseTable);
tableShape = elements.get(tableName);
- if(tableShape == null) {
+ if (tableShape == null) {
tableShape = createShape(databaseTable);
final Configuration config = consoleConfig.getConfiguration();
Iterator iterator = config.getClassMappings();
@@ -423,8 +432,9 @@
RootClass cls = (RootClass)clazz;
Table table = cls.getTable();
if (tableName.equals(table.getName() + "." + table.getName())) { //$NON-NLS-1$
- if (elements.get(HibernateUtils.getPersistentClassName(cls.getEntityName())) == null)
+ if (elements.get(HibernateUtils.getPersistentClassName(cls.getEntityName())) == null) {
getOrCreatePersistentClass(cls, null);
+ }
}
}
}
@@ -477,9 +487,11 @@
private boolean isConnectionExist(Shape source, Shape target){
Connection conn;
if (source != null && source.getSourceConnections() != null) {
- for(int i=0;i<source.getSourceConnections().size();i++){
+ for (int i = 0; i < source.getSourceConnections().size(); i++) {
conn = source.getSourceConnections().get(i);
- if(conn.getTarget().equals(target)) return true;
+ if (conn.getTarget().equals(target)) {
+ return true;
+ }
}
}
return false;
@@ -501,40 +513,41 @@
}
public void processExpand(ExpandeableShape shape) {
+ Object element = shape.getOrmElement();
+ if (!(element instanceof Property)) {
+ return;
+ }
OrmShape s = null;
- Object element = shape.getOrmElement();
- if (element instanceof Property) {
- Property property = (Property)element;
- if (!property.isComposite()) {
- Type type = ((Property)element).getType();
- if (type.isEntityType()) {
- EntityType et = (EntityType) type;
- final Configuration config = consoleConfig.getConfiguration();
- Object clazz = config.getClassMapping(et.getAssociatedEntityName());
- if (clazz instanceof RootClass) {
- RootClass rootClass = (RootClass)clazz;
- s = getOrCreatePersistentClass(rootClass, null);
- if (!isConnectionExist(shape, s)) {
- new Connection(shape, s);
- shape.firePropertyChange(REFRESH, null, null);
- s.firePropertyChange(REFRESH, null, null);
- }
- } else if (clazz instanceof Subclass) {
- s = getOrCreatePersistentClass(((Subclass)clazz).getRootClass(), null);
+ Property property = (Property)element;
+ if (!property.isComposite()) {
+ Type type = ((Property)element).getType();
+ if (type.isEntityType()) {
+ EntityType et = (EntityType) type;
+ final Configuration config = consoleConfig.getConfiguration();
+ Object clazz = config.getClassMapping(et.getAssociatedEntityName());
+ if (clazz instanceof RootClass) {
+ RootClass rootClass = (RootClass)clazz;
+ s = getOrCreatePersistentClass(rootClass, null);
+ if (!isConnectionExist(shape, s)) {
+ new Connection(shape, s);
+ shape.firePropertyChange(REFRESH, null, null);
+ s.firePropertyChange(REFRESH, null, null);
}
+ } else if (clazz instanceof Subclass) {
+ s = getOrCreatePersistentClass(((Subclass)clazz).getRootClass(), null);
}
- } else {
- s = getOrCreatePersistentClass(new SpecialRootClass(property), null);
- new Connection(shape, s);
- createConnections(s, getOrCreateDatabaseTable(property.getValue().getTable()));
- shape.firePropertyChange(REFRESH, null, null);
- s.firePropertyChange(REFRESH, null, null);
}
- if(!shape.getParent().equals(s)) {
- shape.setReference(s);
- }
- firePropertyChange(REFRESH, null, null);
+ } else {
+ s = getOrCreatePersistentClass(new SpecialRootClass(property), null);
+ new Connection(shape, s);
+ createConnections(s, getOrCreateDatabaseTable(property.getValue().getTable()));
+ shape.firePropertyChange(REFRESH, null, null);
+ s.firePropertyChange(REFRESH, null, null);
}
+ if(!shape.getParent().equals(s)) {
+ shape.setReference(s);
+ }
+ firePropertyChange(REFRESH, null, null);
}
public void update(){
@@ -565,16 +578,16 @@
}
SimpleValue value = (SimpleValue)csChild0.getOrmElement();
OrmShape tableShape = getOrCreateDatabaseTable(value.getTable());
- Iterator iterator = value.getColumnIterator();
- while (iterator.hasNext()) {
- Object o = iterator.next();
- if (o instanceof Column) {
- Column column = (Column)o;
- Shape colShape = tableShape.getChild(column);
- if (!isConnectionExist(csChild0, colShape)) {
- new Connection(csChild0, colShape);
+ Iterator it = value.getColumnIterator();
+ while (it.hasNext()) {
+ Object el = it.next();
+ if (el instanceof Column) {
+ Column col = (Column)el;
+ Shape shape = tableShape.getChild(col);
+ if (shape != null && !isConnectionExist(csChild0, shape)) {
+ new Connection(csChild0, shape);
csChild0.firePropertyChange(REFRESH, null, null);
- childShape.firePropertyChange(REFRESH, null, null);
+ shape.firePropertyChange(REFRESH, null, null);
}
}
}
@@ -595,45 +608,45 @@
childShape.firePropertyChange(REFRESH, null, null);
}
OrmShape keyTableShape = getOrCreateDatabaseTable(collection.getKey().getTable());
- Iterator iter = collection.getKey().getColumnIterator();
- while (iter.hasNext()) {
- Object o = iter.next();
- if (o instanceof Column) {
- Column col = (Column)o;
- Shape keyColumnShape = keyTableShape.getChild(col);
- if (keyColumnShape != null && !isConnectionExist(csChild0, keyColumnShape)) {
- new Connection(csChild0, keyColumnShape);
+ Iterator it = collection.getKey().getColumnIterator();
+ while (it.hasNext()) {
+ Object el = it.next();
+ if (el instanceof Column) {
+ Column col = (Column)el;
+ Shape shape = keyTableShape.getChild(col);
+ if (shape != null && !isConnectionExist(csChild0, shape)) {
+ new Connection(csChild0, shape);
csChild0.firePropertyChange(REFRESH, null, null);
- keyColumnShape.firePropertyChange(REFRESH, null, null);
+ shape.firePropertyChange(REFRESH, null, null);
}
}
}
} else /* if (collection.isMap() || collection.isSet()) */ {
childShape = getOrCreateDatabaseTable(collection.getCollectionTable());
- Iterator columnIterator = ((DependantValue)csChild0.getOrmElement()).getColumnIterator();
- while (columnIterator.hasNext()) {
- Object o = columnIterator.next();
- if (o instanceof Column) {
- Shape keyShape = childShape.getChild((Column)o);
- if (!isConnectionExist(csChild0, keyShape)) {
- new Connection(csChild0, keyShape);
+ Iterator it = ((DependantValue)csChild0.getOrmElement()).getColumnIterator();
+ while (it.hasNext()) {
+ Object el = it.next();
+ if (el instanceof Column) {
+ Column col = (Column)el;
+ Shape shape = childShape.getChild(col);
+ if (shape != null && !isConnectionExist(csChild0, shape)) {
+ new Connection(csChild0, shape);
csChild0.firePropertyChange(REFRESH, null, null);
- keyShape.firePropertyChange(REFRESH, null, null);
+ shape.firePropertyChange(REFRESH, null, null);
}
}
}
-
- Iterator iter = ((SimpleValue)csChild1.getOrmElement()).getColumnIterator();
- while (iter.hasNext()) {
- Object element = iter.next();
- if (element instanceof Column) {
- Column col = (Column)element;
- Shape elementShape = childShape.getChild(col);
- if (!isConnectionExist(csChild1, elementShape)){
- new Connection(csChild1, elementShape);
+ it = ((SimpleValue)csChild1.getOrmElement()).getColumnIterator();
+ while (it.hasNext()) {
+ Object el = it.next();
+ if (el instanceof Column) {
+ Column col = (Column)el;
+ Shape shape = childShape.getChild(col);
+ if (shape != null && !isConnectionExist(csChild1, shape)){
+ new Connection(csChild1, shape);
csChild1.firePropertyChange(REFRESH, null, null);
- elementShape.firePropertyChange(REFRESH, null, null);
+ shape.firePropertyChange(REFRESH, null, null);
}
}
}
@@ -647,33 +660,38 @@
public OrmShape getOrCreateComponentClass(Property property) {
OrmShape classShape = null;
- if (property != null) {
- if (property.getValue() instanceof Collection) {
- Component component = (Component)((Collection)property.getValue()).getElement();
- if (component != null) {
- classShape = createShape(property);
- OrmShape tableShape = elements.get(HibernateUtils.getTableName(component.getTable()));
- if (tableShape == null) tableShape = getOrCreateDatabaseTable(component.getTable());
- createConnections(classShape, tableShape);
- if (!isConnectionExist(classShape, tableShape)) {
- new Connection(classShape, tableShape);
- classShape.firePropertyChange(REFRESH, null, null);
- tableShape.firePropertyChange(REFRESH, null, null);
- }
- Shape parentShape = ((SpecialOrmShape)classShape).getParentShape();
- if (parentShape != null) {
- OrmShape parentClassShape = elements.get(HibernateUtils.getPersistentClassName(((Property)parentShape.getOrmElement()).getPersistentClass().getEntityName()));
- if (!isConnectionExist(parentShape, parentClassShape)) {
- new Connection(parentShape, parentClassShape);
- parentShape.firePropertyChange(REFRESH, null, null);
- parentClassShape.firePropertyChange(REFRESH, null, null);
- }
- }
+ if (property == null) {
+ return classShape;
+ }
+ if (property.getValue() instanceof Collection) {
+ Component component = (Component)((Collection)property.getValue()).getElement();
+ if (component != null) {
+ classShape = createShape(property);
+ OrmShape tableShape = elements.get(HibernateUtils.getTableName(component.getTable()));
+ if (tableShape == null) {
+ tableShape = getOrCreateDatabaseTable(component.getTable());
}
- } else if (property.getValue() instanceof Component) {
- classShape = elements.get(((Component)property.getValue()).getComponentClassName());
- if (classShape == null) classShape = createShape(property);
+ createConnections(classShape, tableShape);
+ if (!isConnectionExist(classShape, tableShape)) {
+ new Connection(classShape, tableShape);
+ classShape.firePropertyChange(REFRESH, null, null);
+ tableShape.firePropertyChange(REFRESH, null, null);
+ }
+ Shape parentShape = ((SpecialOrmShape)classShape).getParentShape();
+ if (parentShape != null) {
+ OrmShape parentClassShape = elements.get(HibernateUtils.getPersistentClassName(((Property)parentShape.getOrmElement()).getPersistentClass().getEntityName()));
+ if (!isConnectionExist(parentShape, parentClassShape)) {
+ new Connection(parentShape, parentClassShape);
+ parentShape.firePropertyChange(REFRESH, null, null);
+ parentClassShape.firePropertyChange(REFRESH, null, null);
+ }
+ }
}
+ } else if (property.getValue() instanceof Component) {
+ classShape = elements.get(((Component)property.getValue()).getComponentClassName());
+ if (classShape == null) {
+ classShape = createShape(property);
+ }
}
return classShape;
}
@@ -681,28 +699,31 @@
private OrmShape getOrCreateAssociationClass(Property property) {
OrmShape classShape = null;
OneToMany component = (OneToMany)((Collection)property.getValue()).getElement();
- if (component != null) {
- if (component.getAssociatedClass() instanceof RootClass) {
- classShape = getOrCreatePersistentClass(component.getAssociatedClass(), null);
- if (classShape == null) classShape = createShape(component.getAssociatedClass());
- OrmShape tableShape = elements.get(HibernateUtils.getTableName(component.getAssociatedClass().getTable()));
- if (tableShape == null) tableShape = getOrCreateDatabaseTable(component.getAssociatedClass().getTable());
- createConnections(classShape, tableShape);
- if(!isConnectionExist(classShape, tableShape)){
- new Connection(classShape, tableShape);
- classShape.firePropertyChange(REFRESH, null, null);
- tableShape.firePropertyChange(REFRESH, null, null);
- }
+ if (component == null) {
+ return classShape;
+ }
+ if (component.getAssociatedClass() instanceof RootClass) {
+ classShape = getOrCreatePersistentClass(component.getAssociatedClass(), null);
+ if (classShape == null) {
+ classShape = createShape(component.getAssociatedClass());
}
+ OrmShape tableShape = elements.get(HibernateUtils.getTableName(component.getAssociatedClass().getTable()));
+ if (tableShape == null) {
+ tableShape = getOrCreateDatabaseTable(component.getAssociatedClass().getTable());
+ }
+ createConnections(classShape, tableShape);
+ if (!isConnectionExist(classShape, tableShape)) {
+ new Connection(classShape, tableShape);
+ classShape.firePropertyChange(REFRESH, null, null);
+ tableShape.firePropertyChange(REFRESH, null, null);
+ }
}
return classShape;
}
-
-
-
+
public String getKey(Shape shape) {
Object element = shape.getOrmElement();
- String key=null;
+ String key = null;
if (element instanceof RootClass) {
key = HibernateUtils.getPersistentClassName(((RootClass)element).getEntityName());
} else if (element instanceof Table) {
@@ -713,7 +734,6 @@
} else if (element instanceof Subclass) {
key = HibernateUtils.getPersistentClassName(((Subclass)element).getEntityName());
}
-
return key;
}
@@ -773,7 +793,7 @@
fos = new FileOutputStream(file);
properties.store(fos, ""); //$NON-NLS-1$
} catch (IOException e) {
- VisualEditorPlugin.getDefault().logError("Can't save layout of mapping.", e); //$NON-NLS-1$
+ HibernateConsolePlugin.getDefault().logErrorMessage("Can't save layout of mapping.", e); //$NON-NLS-1$
} finally {
if (fos != null) {
try {
@@ -798,7 +818,7 @@
file.create(source, true, null);
}
} catch (CoreException e) {
- VisualEditorPlugin.getDefault().logError(e);
+ HibernateConsolePlugin.getDefault().logErrorMessage("CoreException: ", e); //$NON-NLS-1$
}
}
return file;
@@ -818,7 +838,7 @@
loadSuccessfull = true;
}
} catch (IOException ex) {
- VisualEditorPlugin.getDefault().logError("Can't load layout of mapping.", ex); //$NON-NLS-1$
+ HibernateConsolePlugin.getDefault().logErrorMessage("Can't load layout of mapping.", ex); //$NON-NLS-1$
} finally {
if (fis != null) {
try {
@@ -845,7 +865,7 @@
}
public void setState(Properties properties,Shape shape, boolean value) {
- setState(properties, getKey(shape)+".state", value); //$NON-NLS-1$
+ setState(properties, getKey(shape) + ".state", value); //$NON-NLS-1$
}
private boolean getState(Properties properties, String key) {
@@ -855,15 +875,15 @@
private 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$
+ String str = properties.getProperty(key + ".x", "0"); //$NON-NLS-1$ //$NON-NLS-2$
point.x = Integer.parseInt(str);
- String str2 = properties.getProperty(key+".y", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+ String str2 = properties.getProperty(key + ".y", "0"); //$NON-NLS-1$ //$NON-NLS-2$
point.y = Integer.parseInt(str2);
return point;
}
private void setPoint(Properties properties, String key, Point point) {
- String key1 = key+".x"; //$NON-NLS-1$
+ String key1 = key + ".x"; //$NON-NLS-1$
if (!properties.containsKey(key1)) {
properties.remove(key1);
properties.put(key1, "" + point.x); //$NON-NLS-1$
@@ -889,7 +909,7 @@
}
public boolean getState(Properties properties, Shape shape){
- return getState(properties, getKey(shape)+".state"); //$NON-NLS-1$
+ return getState(properties, getKey(shape) + ".state"); //$NON-NLS-1$
}
public ConsoleConfiguration getConsoleConfig() {
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmShape.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmShape.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmShape.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -8,7 +8,7 @@
* Contributor:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.hibernate.ui.veditor.editors.model;
+package org.jboss.tools.hibernate.ui.diagram.editors.model;
import java.util.Iterator;
@@ -40,7 +40,7 @@
Shape bodyOrmShape;
Object ormElement = getOrmElement();
if (ormElement instanceof RootClass) {
- RootClass rootClass = (RootClass)getOrmElement();
+ RootClass rootClass = (RootClass)ormElement;
Property identifierProperty = rootClass.getIdentifierProperty();
if (identifierProperty != null) {
addChild(new Shape(identifierProperty));
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/model/Shape.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/model/Shape.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/model/Shape.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -8,7 +8,7 @@
* Contributor:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.hibernate.ui.veditor.editors.model;
+package org.jboss.tools.hibernate.ui.diagram.editors.model;
import java.util.ArrayList;
import java.util.List;
@@ -19,8 +19,8 @@
import org.hibernate.mapping.Component;
import org.hibernate.mapping.Property;
import org.hibernate.mapping.Value;
-import org.jboss.tools.hibernate.ui.view.views.HibernateUtils;
-import org.jboss.tools.hibernate.ui.view.views.OrmModelNameVisitor;
+import org.jboss.tools.hibernate.ui.view.HibernateUtils;
+import org.jboss.tools.hibernate.ui.view.OrmLabelProvider;
public class Shape extends ModelElement {
@@ -33,9 +33,9 @@
public static final String SHOW_SELECTION = "show selection"; //$NON-NLS-1$
public static final String SET_FOCUS = "set focus"; //$NON-NLS-1$
- private Object ormElement;
+ private Object ormElement;
- static OrmModelNameVisitor ormModelNameVisitor;
+ private static OrmLabelProvider labelProvider = new OrmLabelProvider();
private static IPropertyDescriptor[] descriptors_property;
private static IPropertyDescriptor[] descriptors_column;
@@ -61,8 +61,6 @@
static {
- ormModelNameVisitor = new OrmModelNameVisitor();
-
descriptors_property = new IPropertyDescriptor[] {
new TextPropertyDescriptor(PROPERTY_NAME, PROPERTY_NAME),
new TextPropertyDescriptor(PROPERTY_TYPE, PROPERTY_TYPE),
@@ -233,103 +231,87 @@
if (PROPERTY_NAME.equals(propertyId)) {
if (prop != null) {
res = prop.getName();
- }
- else if (col != null) {
+ } else if (col != null) {
res = col.getName();
}
- }
- else if (PROPERTY_TYPE.equals(propertyId)) {
+ } else if (PROPERTY_TYPE.equals(propertyId)) {
if (prop != null) {
Value value = prop.getValue();
if (value instanceof Component) {
res = prop.getValue().toString();
- }
- else {
+ } else {
res = prop.getType().getReturnedClass().getName();
}
- }
- else if (col != null) {
- String type = ormModelNameVisitor.getColumnSqlType(col, getOrmDiagram().getConsoleConfig());
-
+ } else if (col != null) {
+ String sqlType = col.getSqlType();
+ if (sqlType == null) {
+ labelProvider.setConfig(getOrmDiagram().getConsoleConfig().getConfiguration());
+ labelProvider.updateColumnSqlType(col);
+ sqlType = col.getSqlType();
+ }
StringBuffer name = new StringBuffer();
-
- if (type != null) {
- name.append(type.toUpperCase());
+ if (sqlType != null) {
+ name.append(sqlType.toUpperCase());
name.append(HibernateUtils.getTable(col) != null
&& HibernateUtils.isPrimaryKey(col) ? " PK" : ""); //$NON-NLS-1$ //$NON-NLS-2$
name.append(HibernateUtils.getTable(col) != null
&& HibernateUtils.isForeignKey(col) ? " FK" : ""); //$NON-NLS-1$ //$NON-NLS-2$
}
-
res = name.toString();
}
- }
- else if (PROPERTY_VALUE.equals(propertyId)) {
+ } else if (PROPERTY_VALUE.equals(propertyId)) {
if (prop != null) {
res = prop.getValue().toString();
- }
- else if (getOrmElement() instanceof Column) {
+ } else if (getOrmElement() instanceof Column) {
res = col.getValue().toString();
}
- }
- else if (PROPERTY_CLASS.equals(propertyId)) {
+ } else if (PROPERTY_CLASS.equals(propertyId)) {
if (prop != null) {
if (prop.getPersistentClass() != null) {
res = prop.getPersistentClass().getClassName();
}
}
- }
- else if (PROPERTY_SELECT.equals(propertyId)) {
+ } else if (PROPERTY_SELECT.equals(propertyId)) {
if (prop != null) {
res = Boolean.valueOf(prop.isSelectable()).toString();
}
- }
- else if (PROPERTY_INSERT.equals(propertyId)) {
+ } else if (PROPERTY_INSERT.equals(propertyId)) {
if (prop != null) {
res = Boolean.valueOf(prop.isInsertable()).toString();
}
- }
- else if (PROPERTY_UPDATE.equals(propertyId)) {
+ } else if (PROPERTY_UPDATE.equals(propertyId)) {
if (prop != null) {
res = Boolean.valueOf(prop.isUpdateable()).toString();
}
- }
- else if (PROPERTY_CASCADE.equals(propertyId)) {
+ } else if (PROPERTY_CASCADE.equals(propertyId)) {
if (prop != null) {
res = prop.getCascade();
}
- }
- else if (PROPERTY_LAZY.equals(propertyId)) {
+ } else if (PROPERTY_LAZY.equals(propertyId)) {
if (prop != null) {
res = Boolean.valueOf(prop.isLazy()).toString();
}
- }
- else if (PROPERTY_OPTIONAL.equals(propertyId)) {
+ } else if (PROPERTY_OPTIONAL.equals(propertyId)) {
if (prop != null) {
res = Boolean.valueOf(prop.isOptional()).toString();
}
- }
- else if (PROPERTY_NATURAL_IDENTIFIER.equals(propertyId)) {
+ } else if (PROPERTY_NATURAL_IDENTIFIER.equals(propertyId)) {
if (prop != null) {
res = Boolean.valueOf(prop.isNaturalIdentifier()).toString();
}
- }
- else if (PROPERTY_NODE_NAME.equals(propertyId)) {
+ } else if (PROPERTY_NODE_NAME.equals(propertyId)) {
if (prop != null) {
res = prop.getNodeName();
}
- }
- else if (PROPERTY_OPTIMISTIC_LOCKED.equals(propertyId)) {
+ } else if (PROPERTY_OPTIMISTIC_LOCKED.equals(propertyId)) {
if (prop != null) {
res = Boolean.valueOf(prop.isOptimisticLocked()).toString();
}
- }
- else if (PROPERTY_NULLABLE.equals(propertyId)) {
+ } else if (PROPERTY_NULLABLE.equals(propertyId)) {
if (col != null) {
res = Boolean.valueOf(col.isNullable()).toString();
}
- }
- else if (PROPERTY_UNIQUE.equals(propertyId)) {
+ } else if (PROPERTY_UNIQUE.equals(propertyId)) {
if (col != null) {
res = Boolean.valueOf(col.isUnique()).toString();
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/model/SpecialOrmShape.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/model/SpecialOrmShape.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/model/SpecialOrmShape.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -8,16 +8,17 @@
* Contributor:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.hibernate.ui.veditor.editors.model;
+package org.jboss.tools.hibernate.ui.diagram.editors.model;
import java.util.Iterator;
+import org.hibernate.MappingException;
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.execution.ExecutionContext.Command;
+import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.mapping.Property;
import org.hibernate.mapping.RootClass;
import org.hibernate.type.Type;
-import org.jboss.tools.hibernate.ui.veditor.VisualEditorPlugin;
public class SpecialOrmShape extends OrmShape {
private Shape parentShape;
@@ -27,6 +28,7 @@
// generate();
}
+ @SuppressWarnings("unchecked")
protected void generate() {
Shape bodyOrmShape;
RootClass rootClass = (RootClass)getOrmElement();
@@ -42,37 +44,33 @@
parentShape = bodyOrmShape;
}
- Iterator iterator = rootClass.getPropertyIterator();
+ Iterator<Property> iterator = rootClass.getPropertyIterator();
while (iterator.hasNext()) {
- Property field = (Property)iterator.next();
- try {
- Type type = null;
- if (getOrmDiagram() != null){
- ConsoleConfiguration cfg = getOrmDiagram().getConsoleConfig();
- final Property fField = field;
- type = (Type) cfg.execute(new Command(){
- public Object execute() {
- return fField.getValue().getType();
- }});
- } else {
- try{
- type = field.getValue().getType();
- } catch (Exception e){
- //type is not accessible
- VisualEditorPlugin.getDefault().logError(e);
- }
+ Property field = iterator.next();
+ Type type = null;
+ if (getOrmDiagram() != null){
+ ConsoleConfiguration cfg = getOrmDiagram().getConsoleConfig();
+ final Property fField = field;
+ type = (Type) cfg.execute(new Command(){
+ public Object execute() {
+ return fField.getValue().getType();
+ }});
+ } else {
+ try{
+ type = field.getValue().getType();
+ } catch (MappingException e){
+ //type is not accessible
+ HibernateConsolePlugin.getDefault().logErrorMessage("MappingException: ", e); //$NON-NLS-1$
}
- if (type != null && type.isEntityType()) {
- bodyOrmShape = new ExpandeableShape(field);
- } else if (type != null && type.isCollectionType()) {
- bodyOrmShape = new ComponentShape(field);
- } else {
- bodyOrmShape = new Shape(field);
- }
- addChild(bodyOrmShape);
- } catch (Exception e) {
- VisualEditorPlugin.getDefault().logError(e);
}
+ if (type != null && type.isEntityType()) {
+ bodyOrmShape = new ExpandeableShape(field);
+ } else if (type != null && type.isCollectionType()) {
+ bodyOrmShape = new ComponentShape(field);
+ } else {
+ bodyOrmShape = new Shape(field);
+ }
+ addChild(bodyOrmShape);
}
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/model/SpecialRootClass.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/model/SpecialRootClass.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/model/SpecialRootClass.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -8,7 +8,7 @@
* Contributor:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.hibernate.ui.veditor.editors.model;
+package org.jboss.tools.hibernate.ui.diagram.editors.model;
import java.util.Iterator;
@@ -19,40 +19,53 @@
import org.hibernate.mapping.RootClass;
// TODO: What is this ? And why is it extending mapping classes ?!
+// vitali: it seems this is class to "wrap" properties set to RootClass
+//
+// TODO: vitali: try to change "extends RootClass" into property
public class SpecialRootClass extends RootClass {
+//public class SpecialRootClass {
private Property property;
private Property parentProperty;
+ //protected String entityName;
+ //protected String className;
+ //protected ArrayList properties = new ArrayList();
+ //protected RootClass rootClass;
+
public SpecialRootClass(Property property) {
- super();
this.property = property;
+ //this.rootClass = null;
generate();
}
+ @SuppressWarnings("unchecked")
private void generate() {
- if (property != null) {
- Component component = null;
- if (property.getValue() instanceof Collection) {
- Collection collection = (Collection)property.getValue();
- component = (Component)collection.getElement();
- } else if (property.getValue() instanceof Component) {
- component = (Component)property.getValue();
+ if (property == null) {
+ return;
+ }
+ Component component = null;
+ if (property.getValue() instanceof Collection) {
+ Collection collection = (Collection)property.getValue();
+ component = (Component)collection.getElement();
+ } else if (property.getValue() instanceof Component) {
+ component = (Component)property.getValue();
+ }
+ if (component != null) {
+ setClassName(component.getComponentClassName());
+ setEntityName(component.getComponentClassName());
+ PersistentClass ownerClass = component.getOwner();
+ if (component.getParentProperty() != null) {
+ parentProperty = new Property();
+ parentProperty.setName(component.getParentProperty());
+ parentProperty.setPersistentClass(ownerClass);
}
- if (component != null) {
- setClassName(component.getComponentClassName());
- setEntityName(component.getComponentClassName());
- PersistentClass ownerClass = component.getOwner();
- if (component.getParentProperty() != null) {
- parentProperty = new Property();
- parentProperty.setName(component.getParentProperty());
- parentProperty.setPersistentClass(ownerClass);
+ Iterator<Property> iterator = component.getPropertyIterator();
+ while (iterator.hasNext()) {
+ Property property = iterator.next();
+ if (property != null) {
+ addProperty(property);
}
- Iterator iterator = component.getPropertyIterator();
- while (iterator.hasNext()) {
- Property property = (Property)iterator.next();
- if (property != null) addProperty(property);
- }
}
}
}
@@ -64,4 +77,53 @@
public Property getProperty() {
return this.property;
}
+ /** /
+ public String getEntityName() {
+ if (rootClass != null) {
+ return rootClass.getEntityName();
+ }
+ return entityName;
+ }
+
+ public void setEntityName(String entityName) {
+ if (rootClass != null) {
+ rootClass.setEntityName(className);
+ }
+ this.entityName = entityName;
+ }
+
+ public String getClassName() {
+ if (rootClass != null) {
+ return rootClass.getClassName();
+ }
+ return className;
+ }
+
+ public void setClassName(String className) {
+ if (rootClass != null) {
+ rootClass.setClassName(className);
+ }
+ this.className = className;
+ }
+
+ public void addProperty(Property p) {
+ properties.add(p);
+ p.setPersistentClass(rootClass);
+ }
+
+ public RootClass getRootClass() {
+ return rootClass;
+ }
+
+ public void setRootClass(RootClass rootClass) {
+ this.rootClass = rootClass;
+ if (rootClass != null) {
+ this.entityName = rootClass.getEntityName();
+ this.className = rootClass.getClassName();
+ } else {
+ this.entityName = null;
+ this.className = null;
+ }
+ }
+ /**/
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ColorConstants.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ColorConstants.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ColorConstants.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -8,12 +8,12 @@
* Contributor:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.hibernate.ui.veditor.editors.parts;
+package org.jboss.tools.hibernate.ui.diagram.editors.parts;
import org.eclipse.osgi.util.NLS;
public class ColorConstants extends NLS {
- private static final String BUNDLE_NAME = "org.jboss.tools.hibernate.ui.veditor.editors.parts.ColorConstants"; //$NON-NLS-1$
+ private static final String BUNDLE_NAME = "org.jboss.tools.hibernate.ui.diagram.editors.parts.ColorConstants"; //$NON-NLS-1$
private ColorConstants() {
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ComponentShapeEditPart.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ComponentShapeEditPart.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ComponentShapeEditPart.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -8,7 +8,7 @@
* Contributor:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.hibernate.ui.veditor.editors.parts;
+package org.jboss.tools.hibernate.ui.diagram.editors.parts;
import java.beans.PropertyChangeEvent;
@@ -23,12 +23,12 @@
import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gef.Request;
import org.eclipse.gef.RequestConstants;
-import org.jboss.tools.hibernate.ui.veditor.editors.figures.ComponentFigure;
-import org.jboss.tools.hibernate.ui.veditor.editors.figures.TitleLabel;
-import org.jboss.tools.hibernate.ui.veditor.editors.model.ComponentShape;
-import org.jboss.tools.hibernate.ui.veditor.editors.model.ExpandeableShape;
-import org.jboss.tools.hibernate.ui.veditor.editors.model.OrmDiagram;
-import org.jboss.tools.hibernate.ui.veditor.editors.model.OrmShape;
+import org.jboss.tools.hibernate.ui.diagram.editors.figures.ComponentFigure;
+import org.jboss.tools.hibernate.ui.diagram.editors.figures.TitleLabel;
+import org.jboss.tools.hibernate.ui.diagram.editors.model.ComponentShape;
+import org.jboss.tools.hibernate.ui.diagram.editors.model.ExpandeableShape;
+import org.jboss.tools.hibernate.ui.diagram.editors.model.OrmDiagram;
+import org.jboss.tools.hibernate.ui.diagram.editors.model.OrmShape;
public class ComponentShapeEditPart extends ExpandeableShapeEditPart {
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ConnectionEditPart.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ConnectionEditPart.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ConnectionEditPart.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -8,7 +8,7 @@
* Contributor:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.hibernate.ui.veditor.editors.parts;
+package org.jboss.tools.hibernate.ui.diagram.editors.parts;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
@@ -29,12 +29,10 @@
import org.hibernate.mapping.RootClass;
import org.hibernate.mapping.Subclass;
import org.hibernate.mapping.Table;
-import org.jboss.tools.hibernate.ui.veditor.editors.figures.RoundPolylineConnection;
-import org.jboss.tools.hibernate.ui.veditor.editors.model.Connection;
-import org.jboss.tools.hibernate.ui.veditor.editors.model.ModelElement;
+import org.jboss.tools.hibernate.ui.diagram.editors.figures.RoundPolylineConnection;
+import org.jboss.tools.hibernate.ui.diagram.editors.model.Connection;
+import org.jboss.tools.hibernate.ui.diagram.editors.model.ModelElement;
-
-
class ConnectionEditPart extends AbstractConnectionEditPart
implements PropertyChangeListener, EditPartListener {
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/DiagramEditPart.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/DiagramEditPart.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/DiagramEditPart.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -8,7 +8,7 @@
* Contributor:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.hibernate.ui.veditor.editors.parts;
+package org.jboss.tools.hibernate.ui.diagram.editors.parts;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
@@ -37,25 +37,25 @@
import org.eclipse.gef.editpolicies.XYLayoutEditPolicy;
import org.eclipse.gef.requests.ChangeBoundsRequest;
import org.eclipse.gef.requests.CreateRequest;
+import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.mapping.Collection;
import org.hibernate.mapping.Component;
import org.hibernate.mapping.RootClass;
import org.hibernate.mapping.Table;
-import org.jboss.tools.hibernate.ui.veditor.VisualEditorPlugin;
-import org.jboss.tools.hibernate.ui.veditor.editors.VisualEditor;
-import org.jboss.tools.hibernate.ui.veditor.editors.autolayout.AutoLayout;
-import org.jboss.tools.hibernate.ui.veditor.editors.autolayout.IItemInfo;
-import org.jboss.tools.hibernate.ui.veditor.editors.autolayout.ILinkInfo;
-import org.jboss.tools.hibernate.ui.veditor.editors.autolayout.IDiagramInfo;
-import org.jboss.tools.hibernate.ui.veditor.editors.command.ShapeSetConstraintCommand;
-import org.jboss.tools.hibernate.ui.veditor.editors.model.Connection;
-import org.jboss.tools.hibernate.ui.veditor.editors.model.ModelElement;
-import org.jboss.tools.hibernate.ui.veditor.editors.model.OrmDiagram;
-import org.jboss.tools.hibernate.ui.veditor.editors.model.OrmShape;
-import org.jboss.tools.hibernate.ui.veditor.editors.model.Shape;
-import org.jboss.tools.hibernate.ui.veditor.editors.model.SpecialOrmShape;
-import org.jboss.tools.hibernate.ui.veditor.editors.model.SpecialRootClass;
-import org.jboss.tools.hibernate.ui.view.views.HibernateUtils;
+import org.jboss.tools.hibernate.ui.diagram.editors.DiagramViewer;
+import org.jboss.tools.hibernate.ui.diagram.editors.autolayout.AutoLayout;
+import org.jboss.tools.hibernate.ui.diagram.editors.autolayout.IItemInfo;
+import org.jboss.tools.hibernate.ui.diagram.editors.autolayout.ILinkInfo;
+import org.jboss.tools.hibernate.ui.diagram.editors.autolayout.IDiagramInfo;
+import org.jboss.tools.hibernate.ui.diagram.editors.command.ShapeSetConstraintCommand;
+import org.jboss.tools.hibernate.ui.diagram.editors.model.Connection;
+import org.jboss.tools.hibernate.ui.diagram.editors.model.ModelElement;
+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;
+import org.jboss.tools.hibernate.ui.diagram.editors.model.SpecialOrmShape;
+import org.jboss.tools.hibernate.ui.diagram.editors.model.SpecialRootClass;
+import org.jboss.tools.hibernate.ui.view.HibernateUtils;
class DiagramEditPart extends OrmEditPart implements PropertyChangeListener {
@@ -81,7 +81,7 @@
autolayout();
// restore();
} else if (OrmDiagram.DIRTY.equals(prop)) {
- ((VisualEditor) ((DefaultEditDomain) getViewer().getEditDomain())
+ ((DiagramViewer) ((DefaultEditDomain) getViewer().getEditDomain())
.getEditorPart()).refreshDirty();
}
}
@@ -110,7 +110,7 @@
ormShape.setLocation(new Point(Integer
.parseInt(xy[0]), Integer.parseInt(xy[1])));
} catch (NumberFormatException e) {
- VisualEditorPlugin.getDefault().logError(e);
+ HibernateConsolePlugin.getDefault().logErrorMessage("NumberFormatException: ", e); //$NON-NLS-1$
}
}
if (xy.length > 2) {
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/DiagramTreeEditPart.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/DiagramTreeEditPart.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/DiagramTreeEditPart.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -1,4 +1,4 @@
-package org.jboss.tools.hibernate.ui.veditor.editors.parts;
+package org.jboss.tools.hibernate.ui.diagram.editors.parts;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
@@ -7,8 +7,8 @@
import java.util.List;
import org.eclipse.swt.widgets.Tree;
-import org.jboss.tools.hibernate.ui.veditor.editors.model.OrmDiagram;
-import org.jboss.tools.hibernate.ui.veditor.editors.model.Shape;
+import org.jboss.tools.hibernate.ui.diagram.editors.model.OrmDiagram;
+import org.jboss.tools.hibernate.ui.diagram.editors.model.Shape;
public class DiagramTreeEditPart extends org.eclipse.gef.editparts.AbstractTreeEditPart
implements PropertyChangeListener
@@ -19,8 +19,8 @@
*
* @param model Model for this.
*/
- public DiagramTreeEditPart(Object model) {
- super (model);
+ public DiagramTreeEditPart(OrmDiagram model) {
+ super(model);
}
/**
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ExpandeableShapeEditPart.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ExpandeableShapeEditPart.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ExpandeableShapeEditPart.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -8,7 +8,7 @@
* Contributor:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.hibernate.ui.veditor.editors.parts;
+package org.jboss.tools.hibernate.ui.diagram.editors.parts;
import java.beans.PropertyChangeEvent;
import java.util.ArrayList;
@@ -23,12 +23,12 @@
import org.eclipse.swt.graphics.RGB;
import org.hibernate.mapping.RootClass;
import org.hibernate.mapping.Table;
-import org.jboss.tools.hibernate.ui.veditor.editors.figures.TitleLabel;
-import org.jboss.tools.hibernate.ui.veditor.editors.figures.TopLineBorder;
-import org.jboss.tools.hibernate.ui.veditor.editors.model.Connection;
-import org.jboss.tools.hibernate.ui.veditor.editors.model.ExpandeableShape;
-import org.jboss.tools.hibernate.ui.veditor.editors.model.OrmShape;
-import org.jboss.tools.hibernate.ui.veditor.editors.model.Shape;
+import org.jboss.tools.hibernate.ui.diagram.editors.figures.TitleLabel;
+import org.jboss.tools.hibernate.ui.diagram.editors.figures.TopLineBorder;
+import org.jboss.tools.hibernate.ui.diagram.editors.model.Connection;
+import org.jboss.tools.hibernate.ui.diagram.editors.model.ExpandeableShape;
+import org.jboss.tools.hibernate.ui.diagram.editors.model.OrmShape;
+import org.jboss.tools.hibernate.ui.diagram.editors.model.Shape;
public class ExpandeableShapeEditPart extends ShapeEditPart {
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ExpandeableShapeTreeEditPart.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ExpandeableShapeTreeEditPart.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ExpandeableShapeTreeEditPart.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -1,4 +1,4 @@
-package org.jboss.tools.hibernate.ui.veditor.editors.parts;
+package org.jboss.tools.hibernate.ui.diagram.editors.parts;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
@@ -8,18 +8,15 @@
import org.eclipse.swt.widgets.Tree;
import org.hibernate.console.ConsoleConfiguration;
-import org.jboss.tools.hibernate.ui.veditor.editors.model.ExpandeableShape;
-import org.jboss.tools.hibernate.ui.veditor.editors.model.Shape;
-import org.jboss.tools.hibernate.ui.view.views.OrmLabelProvider;
-import org.jboss.tools.hibernate.ui.view.views.OrmModelImageVisitor;
-import org.jboss.tools.hibernate.ui.view.views.OrmModelNameVisitor;
+import org.jboss.tools.hibernate.ui.diagram.editors.model.ExpandeableShape;
+import org.jboss.tools.hibernate.ui.diagram.editors.model.Shape;
+import org.jboss.tools.hibernate.ui.view.OrmLabelProvider;
public class ExpandeableShapeTreeEditPart extends
org.eclipse.gef.editparts.AbstractTreeEditPart implements
PropertyChangeListener {
- static final protected OrmLabelProvider ormLabelProvider = new OrmLabelProvider(
- new OrmModelImageVisitor(), new OrmModelNameVisitor());
+ protected OrmLabelProvider ormLabelProvider;
/**
* Constructor initializes this with the given model.
@@ -27,8 +24,10 @@
* @param model
* Model for this.
*/
- public ExpandeableShapeTreeEditPart(Object model) {
+ public ExpandeableShapeTreeEditPart(ExpandeableShape model) {
super(model);
+ ConsoleConfiguration cfg = model.getOrmDiagram().getConsoleConfig();
+ ormLabelProvider = new OrmLabelProvider(cfg.getConfiguration());
}
/**
@@ -65,14 +64,10 @@
if (getWidget() instanceof Tree) {
return;
}
-
Shape model = (Shape) getModel();
-
Object element = model.getOrmElement();
- ConsoleConfiguration cfg = model.getOrmDiagram().getConsoleConfig();
-
setWidgetImage(ormLabelProvider.getImage(element));
- setWidgetText(ormLabelProvider.getText(element, cfg));
+ setWidgetText(ormLabelProvider.getText(element));
}
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/GEFRootEditPart.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/GEFRootEditPart.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/GEFRootEditPart.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -8,10 +8,8 @@
* Contributors:
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.hibernate.ui.veditor.editors.parts;
+package org.jboss.tools.hibernate.ui.diagram.editors.parts;
-import java.util.List;
-
import org.eclipse.draw2d.ConnectionLayer;
import org.eclipse.draw2d.IFigure;
import org.eclipse.gef.LayerConstants;
@@ -25,14 +23,12 @@
super();
}
+ @SuppressWarnings("unchecked")
public void setToFront(AbstractConnectionEditPart editpart) {
ConnectionLayer layer = (ConnectionLayer)getLayer(LayerConstants.CONNECTION_LAYER);
IFigure fig = editpart.getFigure();
-
- List children = layer.getChildren();
-
- children.remove(fig);
- children.add(fig);
+ layer.getChildren().remove(fig);
+ layer.getChildren().add(fig);
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/OrmEditPart.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/OrmEditPart.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/OrmEditPart.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -8,7 +8,7 @@
* Contributor:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.hibernate.ui.veditor.editors.parts;
+package org.jboss.tools.hibernate.ui.diagram.editors.parts;
import java.util.ArrayList;
import java.util.HashMap;
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/OrmEditPartFactory.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/OrmEditPartFactory.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/OrmEditPartFactory.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -8,17 +8,17 @@
* Contributor:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.hibernate.ui.veditor.editors.parts;
+package org.jboss.tools.hibernate.ui.diagram.editors.parts;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPartFactory;
-import org.jboss.tools.hibernate.ui.veditor.UIVEditorMessages;
-import org.jboss.tools.hibernate.ui.veditor.editors.model.ComponentShape;
-import org.jboss.tools.hibernate.ui.veditor.editors.model.Connection;
-import org.jboss.tools.hibernate.ui.veditor.editors.model.ExpandeableShape;
-import org.jboss.tools.hibernate.ui.veditor.editors.model.OrmDiagram;
-import org.jboss.tools.hibernate.ui.veditor.editors.model.OrmShape;
-import org.jboss.tools.hibernate.ui.veditor.editors.model.Shape;
+import org.jboss.tools.hibernate.ui.diagram.DiagramViewerMessages;
+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.ExpandeableShape;
+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;
public class OrmEditPartFactory implements EditPartFactory {
@@ -50,8 +50,8 @@
return new ConnectionEditPart();
}
throw new RuntimeException(
- UIVEditorMessages.PartFactory_canot_create_part_for_model_element
- + ((modelElement != null) ? modelElement.getClass().getName() : UIVEditorMessages.PartFactory_null));
+ DiagramViewerMessages.PartFactory_canot_create_part_for_model_element
+ + ((modelElement != null) ? modelElement.getClass().getName() : DiagramViewerMessages.PartFactory_null));
}
}
\ No newline at end of file
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/OrmShapeEditPart.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/OrmShapeEditPart.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/OrmShapeEditPart.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -8,7 +8,7 @@
* Contributor:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.hibernate.ui.veditor.editors.parts;
+package org.jboss.tools.hibernate.ui.diagram.editors.parts;
import java.beans.PropertyChangeEvent;
@@ -31,11 +31,11 @@
import org.hibernate.mapping.RootClass;
import org.hibernate.mapping.Subclass;
import org.hibernate.mapping.Table;
-import org.jboss.tools.hibernate.ui.veditor.editors.figures.RoundLineBorder;
-import org.jboss.tools.hibernate.ui.veditor.editors.figures.TitleFigure;
-import org.jboss.tools.hibernate.ui.veditor.editors.figures.TitleLabel;
-import org.jboss.tools.hibernate.ui.veditor.editors.model.OrmDiagram;
-import org.jboss.tools.hibernate.ui.veditor.editors.model.OrmShape;
+import org.jboss.tools.hibernate.ui.diagram.editors.figures.RoundLineBorder;
+import org.jboss.tools.hibernate.ui.diagram.editors.figures.TitleFigure;
+import org.jboss.tools.hibernate.ui.diagram.editors.figures.TitleLabel;
+import org.jboss.tools.hibernate.ui.diagram.editors.model.OrmDiagram;
+import org.jboss.tools.hibernate.ui.diagram.editors.model.OrmShape;
public class OrmShapeEditPart extends ExpandeableShapeEditPart{
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ResourceManager.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ResourceManager.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ResourceManager.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -8,7 +8,7 @@
* Contributor:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.hibernate.ui.veditor.editors.parts;
+package org.jboss.tools.hibernate.ui.diagram.editors.parts;
import java.util.HashMap;
import java.util.Iterator;
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ShapeEditPart.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ShapeEditPart.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ShapeEditPart.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -8,7 +8,7 @@
* Contributor:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.hibernate.ui.veditor.editors.parts;
+package org.jboss.tools.hibernate.ui.diagram.editors.parts;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
@@ -40,23 +40,31 @@
import org.hibernate.mapping.Property;
import org.hibernate.mapping.SimpleValue;
import org.hibernate.mapping.Table;
-import org.jboss.tools.hibernate.ui.veditor.editors.figures.TitleFigure;
-import org.jboss.tools.hibernate.ui.veditor.editors.figures.TopLineBorder;
-import org.jboss.tools.hibernate.ui.veditor.editors.model.Connection;
-import org.jboss.tools.hibernate.ui.veditor.editors.model.ModelElement;
-import org.jboss.tools.hibernate.ui.veditor.editors.model.OrmDiagram;
-import org.jboss.tools.hibernate.ui.veditor.editors.model.Shape;
-import org.jboss.tools.hibernate.ui.view.views.OrmLabelProvider;
-import org.jboss.tools.hibernate.ui.view.views.OrmModelImageVisitor;
-import org.jboss.tools.hibernate.ui.view.views.OrmModelNameVisitor;
+import org.jboss.tools.hibernate.ui.diagram.editors.figures.TitleFigure;
+import org.jboss.tools.hibernate.ui.diagram.editors.figures.TopLineBorder;
+import org.jboss.tools.hibernate.ui.diagram.editors.model.Connection;
+import org.jboss.tools.hibernate.ui.diagram.editors.model.ModelElement;
+import org.jboss.tools.hibernate.ui.diagram.editors.model.OrmDiagram;
+import org.jboss.tools.hibernate.ui.diagram.editors.model.Shape;
+import org.jboss.tools.hibernate.ui.view.OrmLabelProvider;
-public class ShapeEditPart extends
-OrmEditPart implements PropertyChangeListener, NodeEditPart {
+public class ShapeEditPart extends OrmEditPart implements PropertyChangeListener, NodeEditPart {
- static final protected OrmLabelProvider ormLabelProvider =
- new OrmLabelProvider(new OrmModelImageVisitor(), new OrmModelNameVisitor());
+ protected OrmLabelProvider ormLabelProvider = new OrmLabelProvider();
+ public void setModel(Object model) {
+ super.setModel(model);
+ ModelElement modelTmp = (ModelElement)model;
+ while (modelTmp.getParent() != null) {
+ modelTmp = modelTmp.getParent();
+ }
+ if (modelTmp instanceof OrmDiagram) {
+ ConsoleConfiguration consoleConfig = ((OrmDiagram)modelTmp).getConsoleConfig();
+ ormLabelProvider.setConfig(consoleConfig.getConfiguration());
+ }
+ }
+
protected void createEditPolicies() {
installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new ShapesSelectionEditPolicy());
}
@@ -65,15 +73,7 @@
protected IFigure createFigure() {
if (getModel() instanceof Shape) {
Label label = new Label();
- ModelElement model = (ModelElement) getModel();
- while (model.getParent() != null) {
- model = model.getParent();
- }
- ConsoleConfiguration cfg = null;
- if (model instanceof OrmDiagram) {
- cfg = ((OrmDiagram) model).getConsoleConfig();
- }
- label.setText(ormLabelProvider.getText(getElement(), cfg));
+ label.setText(ormLabelProvider.getText(getElement()));
label.setBackgroundColor(getColor());
label.setIcon(ormLabelProvider.getImage(getElement()));
label.setLabelAlignment(PositionConstants.LEFT);
@@ -119,14 +119,14 @@
public void activate() {
if (!isActive()) {
super.activate();
- ((ModelElement) getModel()).addPropertyChangeListener(this);
+ getCastedModel().addPropertyChangeListener(this);
}
}
public void deactivate() {
if (isActive()) {
super.deactivate();
- ((ModelElement) getModel()).removePropertyChangeListener(this);
+ getCastedModel().removePropertyChangeListener(this);
}
}
@@ -243,28 +243,28 @@
protected void hideSelection() {
getCastedModel().hideSelection();
- Iterator iter = getCastedModel().getSourceConnections().iterator();
+ Iterator<Connection> iter = getCastedModel().getSourceConnections().iterator();
while (iter.hasNext()) {
- Connection element = (Connection) iter.next();
+ Connection element = iter.next();
element.hideSelection();
}
iter = getCastedModel().getTargetConnections().iterator();
while (iter.hasNext()) {
- Connection element = (Connection) iter.next();
+ Connection element = iter.next();
element.hideSelection();
}
}
protected void showSelection() {
getCastedModel().showSelection();
- Iterator iter = getCastedModel().getSourceConnections().iterator();
+ Iterator<Connection> iter = getCastedModel().getSourceConnections().iterator();
while (iter.hasNext()) {
- Connection element = (Connection) iter.next();
+ Connection element = iter.next();
element.showSelection();
}
iter = getCastedModel().getTargetConnections().iterator();
while (iter.hasNext()) {
- Connection element = (Connection) iter.next();
+ Connection element = iter.next();
element.showSelection();
}
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ShapeTreeEditPart.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ShapeTreeEditPart.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ShapeTreeEditPart.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -1,4 +1,4 @@
-package org.jboss.tools.hibernate.ui.veditor.editors.parts;
+package org.jboss.tools.hibernate.ui.diagram.editors.parts;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
@@ -7,18 +7,15 @@
import org.eclipse.swt.widgets.Tree;
import org.hibernate.console.ConsoleConfiguration;
-import org.jboss.tools.hibernate.ui.veditor.editors.model.ExpandeableShape;
-import org.jboss.tools.hibernate.ui.veditor.editors.model.Shape;
-import org.jboss.tools.hibernate.ui.view.views.OrmLabelProvider;
-import org.jboss.tools.hibernate.ui.view.views.OrmModelImageVisitor;
-import org.jboss.tools.hibernate.ui.view.views.OrmModelNameVisitor;
+import org.jboss.tools.hibernate.ui.diagram.editors.model.ExpandeableShape;
+import org.jboss.tools.hibernate.ui.diagram.editors.model.Shape;
+import org.jboss.tools.hibernate.ui.view.OrmLabelProvider;
public class ShapeTreeEditPart extends
org.eclipse.gef.editparts.AbstractTreeEditPart implements
PropertyChangeListener {
- static final protected OrmLabelProvider ormLabelProvider = new OrmLabelProvider(
- new OrmModelImageVisitor(), new OrmModelNameVisitor());
+ protected OrmLabelProvider ormLabelProvider;
/**
* Constructor initializes this with the given model.
@@ -26,8 +23,10 @@
* @param model
* Model for this.
*/
- public ShapeTreeEditPart(Object model) {
+ public ShapeTreeEditPart(Shape model) {
super(model);
+ ConsoleConfiguration cfg = model.getOrmDiagram().getConsoleConfig();
+ ormLabelProvider = new OrmLabelProvider(cfg.getConfiguration());
}
/**
@@ -45,7 +44,7 @@
*
* @return <code>null</code>
*/
- protected List getModelChildren() {
+ protected List<?> getModelChildren() {
return Collections.EMPTY_LIST;
}
@@ -60,12 +59,9 @@
return;
}
Shape model = (Shape) getModel();
-
Object element = model.getOrmElement();
- ConsoleConfiguration cfg = model.getOrmDiagram().getConsoleConfig();
-
setWidgetImage(ormLabelProvider.getImage(element));
- setWidgetText(ormLabelProvider.getText(element, cfg));
+ setWidgetText(ormLabelProvider.getText(element));
}
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/TreePartFactory.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/TreePartFactory.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/TreePartFactory.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -1,27 +1,27 @@
-package org.jboss.tools.hibernate.ui.veditor.editors.parts;
+package org.jboss.tools.hibernate.ui.diagram.editors.parts;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPartFactory;
-import org.jboss.tools.hibernate.ui.veditor.UIVEditorMessages;
-import org.jboss.tools.hibernate.ui.veditor.editors.model.ExpandeableShape;
-import org.jboss.tools.hibernate.ui.veditor.editors.model.OrmDiagram;
-import org.jboss.tools.hibernate.ui.veditor.editors.model.Shape;
+import org.jboss.tools.hibernate.ui.diagram.DiagramViewerMessages;
+import org.jboss.tools.hibernate.ui.diagram.editors.model.ExpandeableShape;
+import org.jboss.tools.hibernate.ui.diagram.editors.model.OrmDiagram;
+import org.jboss.tools.hibernate.ui.diagram.editors.model.Shape;
public class TreePartFactory implements EditPartFactory {
public EditPart createEditPart(EditPart context, Object modelElement) {
if (modelElement instanceof OrmDiagram) {
- return new DiagramTreeEditPart(modelElement);
+ return new DiagramTreeEditPart((OrmDiagram)modelElement);
}
if (modelElement instanceof ExpandeableShape) {
- return new ExpandeableShapeTreeEditPart(modelElement);
+ return new ExpandeableShapeTreeEditPart((ExpandeableShape)modelElement);
}
if (modelElement instanceof Shape) {
- return new ShapeTreeEditPart(modelElement);
+ return new ShapeTreeEditPart((Shape)modelElement);
}
- throw new RuntimeException(UIVEditorMessages.PartFactory_canot_create_part_for_model_element
+ throw new RuntimeException(DiagramViewerMessages.PartFactory_canot_create_part_for_model_element
+ ((modelElement != null) ? modelElement.getClass().getName()
- : UIVEditorMessages.PartFactory_null));
+ : DiagramViewerMessages.PartFactory_null));
}
}
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/popup/PopupMenuProvider.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/popup/PopupMenuProvider.java 2009-07-02 18:30:20 UTC (rev 16356)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/editors/popup/PopupMenuProvider.java 2009-07-02 18:39:40 UTC (rev 16357)
@@ -8,7 +8,7 @@
* Contributors:
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
******************************************************************************/
-package org.jboss.tools.hibernate.ui.veditor.editors.popup;
+package org.jboss.tools.hibernate.ui.diagram.editors.popup;
import org.eclipse.gef.ContextMenuProvider;
import org.eclipse.gef.EditPartViewer;
@@ -29,12 +29,12 @@
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.Property;
import org.hibernate.mapping.Table;
-import org.jboss.tools.hibernate.ui.veditor.editors.actions.AutoLayoutAction;
-import org.jboss.tools.hibernate.ui.veditor.editors.actions.ExportImageAction;
-import org.jboss.tools.hibernate.ui.veditor.editors.actions.OpenMappingAction;
-import org.jboss.tools.hibernate.ui.veditor.editors.actions.OpenSourceAction;
-import org.jboss.tools.hibernate.ui.veditor.editors.model.Shape;
-import org.jboss.tools.hibernate.ui.veditor.editors.parts.OrmEditPart;
+import org.jboss.tools.hibernate.ui.diagram.editors.actions.AutoLayoutAction;
+import org.jboss.tools.hibernate.ui.diagram.editors.actions.ExportImageAction;
+import org.jboss.tools.hibernate.ui.diagram.editors.actions.OpenMappingAction;
+import org.jboss.tools.hibernate.ui.diagram.editors.actions.OpenSourceAction;
+import org.jboss.tools.hibernate.ui.diagram.editors.model.Shape;
+import org.jboss.tools.hibernate.ui.diagram.editors.parts.OrmEditPart;
public class PopupMenuProvider extends ContextMenuProvider {
private ActionRegistry actionRegistry;
14 years, 9 months
JBoss Tools SVN: r16356 - in trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui: diagram and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2009-07-02 14:30:20 -0400 (Thu, 02 Jul 2009)
New Revision: 16356
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/DiagramViewerMessages.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/DiagramViewerMessages.properties
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/UiPlugin.java
Removed:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/UIVEditorMessages.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/UIVEditorMessages.properties
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/VisualEditorPlugin.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4524 - rename veditor plugin
Copied: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram (from rev 16317, trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor)
Copied: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/DiagramViewerMessages.java (from rev 16317, trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/UIVEditorMessages.java)
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/DiagramViewerMessages.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/DiagramViewerMessages.java 2009-07-02 18:30:20 UTC (rev 16356)
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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;
+
+import org.eclipse.osgi.util.NLS;
+
+public class DiagramViewerMessages extends NLS {
+ private static final String BUNDLE_NAME = "org.jboss.tools.hibernate.ui.diagram.DiagramViewerMessages"; //$NON-NLS-1$
+
+ private DiagramViewerMessages() {
+ }
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, DiagramViewerMessages.class);
+ }
+
+ public static String EditorActionContributor_refresh_visual_mapping;
+ public static String DiagramViewer_diagram_for;
+ public static String ExportImageAction_bmp_format;
+ public static String ExportImageAction_error;
+ public static String ExportImageAction_failed_to_export_image;
+ public static String ExportImageAction_jpg_format;
+ public static String ExportImageAction_png_format;
+ public static String OpenMappingAction_canot_find_or_open_mapping_file;
+ public static String OpenMappingAction_open_mapping_file;
+ public static String OpenSourceAction_canot_find_source_file;
+ public static String OpenSourceAction_canot_open_source_file;
+ public static String OpenSourceAction_open_source_file;
+ public static String ShapeSetConstraintCommand_move;
+ public static String PartFactory_canot_create_part_for_model_element;
+ public static String PartFactory_null;
+}
Copied: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/DiagramViewerMessages.properties (from rev 16317, trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/UIVEditorMessages.properties)
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/DiagramViewerMessages.properties (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/DiagramViewerMessages.properties 2009-07-02 18:30:20 UTC (rev 16356)
@@ -0,0 +1,15 @@
+EditorActionContributor_refresh_visual_mapping=Refresh Visual Mapping
+DiagramViewer_diagram_for=Diagram for
+ExportImageAction_bmp_format=Bitmap format (*.bmp)
+ExportImageAction_error=Error
+ExportImageAction_failed_to_export_image=Failed to export image:
+ExportImageAction_jpg_format=JPEG format (*.jpg)
+ExportImageAction_png_format=PNG format (*.png)
+OpenMappingAction_canot_find_or_open_mapping_file=Can't find or open mapping file.
+OpenMappingAction_open_mapping_file=Open Mapping File
+OpenSourceAction_canot_find_source_file=Can't find source file.
+OpenSourceAction_canot_open_source_file=Can't open source file.
+OpenSourceAction_open_source_file=Open Source File
+ShapeSetConstraintCommand_move=move
+PartFactory_canot_create_part_for_model_element=Can't create part for model element:
+PartFactory_null=null
Deleted: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/UIVEditorMessages.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/UIVEditorMessages.java 2009-07-01 10:59:16 UTC (rev 16317)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/UIVEditorMessages.java 2009-07-02 18:30:20 UTC (rev 16356)
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.veditor;
-
-import org.eclipse.osgi.util.NLS;
-
-public class UIVEditorMessages extends NLS {
- private static final String BUNDLE_NAME = "org.jboss.tools.hibernate.ui.veditor.UIVEditorMessages"; //$NON-NLS-1$
-
- private UIVEditorMessages() {
- }
-
- static {
- NLS.initializeMessages(BUNDLE_NAME, UIVEditorMessages.class);
- }
-
- public static String EditorActionContributor_refresh_visual_mapping;
- public static String VisualEditor_diagram_for;
- public static String ExportImageAction_bmp_format;
- public static String ExportImageAction_error;
- public static String ExportImageAction_failed_to_export_image;
- public static String ExportImageAction_jpg_format;
- public static String ExportImageAction_png_format;
- public static String OpenMappingAction_canot_find_or_open_mapping_file;
- public static String OpenMappingAction_open_mapping_file;
- public static String OpenSourceAction_canot_find_source_file;
- public static String OpenSourceAction_canot_open_source_file;
- public static String OpenSourceAction_open_source_file;
- public static String ShapeSetConstraintCommand_move;
- public static String PartFactory_canot_create_part_for_model_element;
- public static String PartFactory_null;
-}
Deleted: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/UIVEditorMessages.properties
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/UIVEditorMessages.properties 2009-07-01 10:59:16 UTC (rev 16317)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/UIVEditorMessages.properties 2009-07-02 18:30:20 UTC (rev 16356)
@@ -1,15 +0,0 @@
-EditorActionContributor_refresh_visual_mapping=Refresh Visual Mapping
-VisualEditor_diagram_for=Diagram for
-ExportImageAction_bmp_format=Bitmap format (*.bmp)
-ExportImageAction_error=Error
-ExportImageAction_failed_to_export_image=Failed to export image:
-ExportImageAction_jpg_format=JPEG format (*.jpg)
-ExportImageAction_png_format=PNG format (*.png)
-OpenMappingAction_canot_find_or_open_mapping_file=Can't find or open mapping file.
-OpenMappingAction_open_mapping_file=Open Mapping File
-OpenSourceAction_canot_find_source_file=Can't find source file.
-OpenSourceAction_canot_open_source_file=Can't open source file.
-OpenSourceAction_open_source_file=Open Source File
-ShapeSetConstraintCommand_move=move
-PartFactory_canot_create_part_for_model_element=Can't create part for model element:
-PartFactory_null=null
Copied: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/UiPlugin.java (from rev 16317, trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/VisualEditorPlugin.java)
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/UiPlugin.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/UiPlugin.java 2009-07-02 18:30:20 UTC (rev 16356)
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.plugin.*;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.osgi.framework.BundleContext;
+
+public class UiPlugin extends AbstractUIPlugin {
+
+ public final static String ID = "org.jboss.tools.hibernate.ui"; //$NON-NLS-1$
+
+ //The shared instance.
+ private static UiPlugin plugin;
+
+ public UiPlugin() {
+ setPlugin(this);
+ }
+
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ super.stop(context);
+ setPlugin(null);
+ }
+
+ public static UiPlugin getDefault() {
+ return plugin;
+ }
+
+ private static void setPlugin(UiPlugin plugin) {
+ UiPlugin.plugin = plugin;
+ }
+
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return AbstractUIPlugin.imageDescriptorFromPlugin(ID, path);
+ }
+
+ public static ImageDescriptor getImageDescriptor2(String name) {
+ final String iconPath = "images/"; //$NON-NLS-1$
+ final URL installURL = getDefault().getBundle().getEntry("/"); //$NON-NLS-1$
+ URL url = null;
+ try {
+ url = new URL(installURL, iconPath + name);
+ } catch (MalformedURLException e) {
+ }
+ return ImageDescriptor.createFromURL(url);
+ }
+
+ public static IWorkbenchPage getPage(){
+ IWorkbench workbench = PlatformUI.getWorkbench();
+ IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
+ return window.getActivePage();
+ }
+
+ public static Shell getShell(){
+ IWorkbench workbench = PlatformUI.getWorkbench();
+ IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
+ return window.getShell();
+ }
+}
Deleted: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/VisualEditorPlugin.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/VisualEditorPlugin.java 2009-07-01 10:59:16 UTC (rev 16317)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/diagram/VisualEditorPlugin.java 2009-07-02 18:30:20 UTC (rev 16356)
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.veditor;
-
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.plugin.*;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.jboss.tools.hibernate.ui.view.BaseUIPlugin;
-import org.osgi.framework.BundleContext;
-
-public class VisualEditorPlugin extends BaseUIPlugin {
-
- public final static String PLUGIN_ID= "org.jboss.tools.hibernate.ui.veditor"; //$NON-NLS-1$
-
- //The shared instance.
- private static VisualEditorPlugin plugin;
-
- public VisualEditorPlugin() {
- setPlugin(this);
- }
-
- public void start(BundleContext context) throws Exception {
- super.start(context);
- }
-
- public void stop(BundleContext context) throws Exception {
- super.stop(context);
- setPlugin(null);
- }
-
- public static VisualEditorPlugin getDefault() {
- return plugin;
- }
-
- private static void setPlugin(VisualEditorPlugin plugin) {
- VisualEditorPlugin.plugin = plugin;
- }
-
- public static ImageDescriptor getImageDescriptor(String path) {
- return AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, path);
- }
-
- public static IWorkbenchPage getPage(){
- IWorkbench workbench = PlatformUI.getWorkbench();
- IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
- return window.getActivePage();
- }
-
- public static Shell getShell(){
- IWorkbench workbench = PlatformUI.getWorkbench();
- IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
- return window.getShell();
- }
-}
14 years, 9 months
JBoss Tools SVN: r16355 - in trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui: view and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2009-07-02 14:12:57 -0400 (Thu, 02 Jul 2009)
New Revision: 16355
Added:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/view/
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/view/HibernateUtils.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/view/ImageBundle.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/view/ObjectEditorInput.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/view/OpenDiagramActionDelegate.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/view/OrmImageMap.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/view/OrmLabelMap.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/view/OrmLabelProvider.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/view/UIViewMessages.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/view/UIViewMessages.properties
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/view/image.properties
Log:
https://jira.jboss.org/jira/browse/JBIDE-4524 - rename veditor plugin
Copied: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/view/HibernateUtils.java (from rev 16319, trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/HibernateUtils.java)
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/view/HibernateUtils.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/view/HibernateUtils.java 2009-07-02 18:12:57 UTC (rev 16355)
@@ -0,0 +1,70 @@
+package org.jboss.tools.hibernate.ui.view;
+
+import java.util.Iterator;
+
+import org.hibernate.mapping.Column;
+import org.hibernate.mapping.ForeignKey;
+import org.hibernate.mapping.PersistentClass;
+import org.hibernate.mapping.Table;
+
+public class HibernateUtils {
+
+ public static String getTableName(String catalog, String schema, String name) {
+ return (catalog != null ? catalog + "." : "") + (schema != null ? schema + "." : "") + name; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ }
+
+ public static String getTableName(Table table) {
+ return getTableName(table.getCatalog(), table.getSchema(), table.getName());
+ }
+
+ public static String getPersistentClassName(PersistentClass rootClass) {
+ if (rootClass == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return rootClass.getEntityName() != null ? rootClass.getEntityName() : rootClass.getClassName();
+ }
+
+ public static String getPersistentClassName(String className) {
+ if (className == null) {
+ return ""; //$NON-NLS-1$
+ } else if (className.indexOf(".") < 0) { //$NON-NLS-1$
+ return "default." + className; //$NON-NLS-1$
+ }
+ return className;
+ }
+
+ public static boolean isPrimaryKey(Column column) {
+ Table table = getTable(column);
+ if (table != null) {
+ if (table.getPrimaryKey() != null) {
+ if (table.getPrimaryKey().containsColumn(column)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ @SuppressWarnings("unchecked")
+ public static boolean isForeignKey(Column column){
+ Table table = getTable(column);
+ if (table != null) {
+ Iterator<ForeignKey> iter = table.getForeignKeyIterator();
+ while (iter.hasNext()) {
+ ForeignKey fk = iter.next();
+ if (fk.containsColumn(column)) {
+ return true;
+ }
+ }
+ }
+ return false;
+
+ }
+
+ public static Table getTable(Column column){
+ if (column.getValue() != null) {
+ return column.getValue().getTable();
+ }
+ return null;
+ }
+}
Copied: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/view/ImageBundle.java (from rev 16319, trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/ImageBundle.java)
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/view/ImageBundle.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/view/ImageBundle.java 2009-07-02 18:12:57 UTC (rev 16355)
@@ -0,0 +1,22 @@
+package org.jboss.tools.hibernate.ui.view;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class ImageBundle {
+ private static final String BUNDLE_NAME = "org.jboss.tools.hibernate.ui.view.image"; //$NON-NLS-1$
+
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
+ .getBundle(BUNDLE_NAME);
+
+ private ImageBundle() {
+ }
+
+ public static String getString(String key) {
+ try {
+ return RESOURCE_BUNDLE.getString(key);
+ } catch (MissingResourceException e) {
+ return '!' + key + '!';
+ }
+ }
+}
Copied: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/view/ObjectEditorInput.java (from rev 16319, trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/ObjectEditorInput.java)
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/view/ObjectEditorInput.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/view/ObjectEditorInput.java 2009-07-02 18:12:57 UTC (rev 16355)
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.jface.resource.ImageDescriptor;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IPersistableElement;
+import org.hibernate.console.ConsoleConfiguration;
+
+
+public class ObjectEditorInput implements IEditorInput{
+
+ protected Object fObject;
+ protected ConsoleConfiguration configuration;
+
+ public ObjectEditorInput(ConsoleConfiguration configuration, Object object) {
+ fObject = object;
+ this.configuration = configuration;
+ }
+
+ public Object getObject() {
+ return fObject;
+ }
+
+
+ public boolean exists() {
+ return false;
+ }
+
+
+ public ImageDescriptor getImageDescriptor() {
+ return ImageDescriptor.getMissingImageDescriptor();
+ }
+
+
+ public String getName() {
+ return ""; //$NON-NLS-1$
+ }
+
+
+ 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) {
+ return (obj instanceof ObjectEditorInput && ((ObjectEditorInput)obj).fObject == fObject);
+ }
+
+ public int hashCode() {
+ return fObject.hashCode();
+ }
+}
Copied: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/view/OpenDiagramActionDelegate.java (from rev 16319, trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OpenDiagramActionDelegate.java)
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/view/OpenDiagramActionDelegate.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/view/OpenDiagramActionDelegate.java 2009-07-02 18:12:57 UTC (rev 16355)
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.TreePath;
+import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.ide.IDE;
+import org.eclipse.ui.internal.ObjectPluginAction;
+import org.hibernate.console.ConsoleConfiguration;
+import org.hibernate.eclipse.console.HibernateConsolePlugin;
+import org.hibernate.mapping.PersistentClass;
+import org.hibernate.mapping.RootClass;
+import org.jboss.tools.hibernate.ui.diagram.UiPlugin;
+
+@SuppressWarnings("restriction")
+public class OpenDiagramActionDelegate implements IObjectActionDelegate {
+
+ //private IWorkbenchPart fPart;
+
+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+ //this.fPart = targetPart;
+ }
+
+ public void selectionChanged(IAction action, ISelection selection) {
+ }
+
+ public void run(IAction action) {
+ ObjectPluginAction objectPluginAction = (ObjectPluginAction)action;
+ Map<ConsoleConfiguration, Set<PersistentClass>> mapCC_PCs = new HashMap<ConsoleConfiguration, Set<PersistentClass>>();
+ TreePath[] paths = ((TreeSelection)objectPluginAction.getSelection()).getPaths();
+ for (int i = 0; i < paths.length; i++) {
+ Object last_el = paths[i].getLastSegment();
+ if (last_el instanceof PersistentClass) {
+ PersistentClass persClass = (PersistentClass) last_el;
+ ConsoleConfiguration consoleConfiguration = (ConsoleConfiguration)(paths[i].getFirstSegment());
+ Set<PersistentClass> setPC = mapCC_PCs.get(consoleConfiguration);
+ if (null == setPC) {
+ setPC = new HashSet<PersistentClass>();
+ mapCC_PCs.put(consoleConfiguration, setPC);
+ }
+ setPC.add(persClass);
+ }
+ }
+ for (Iterator<ConsoleConfiguration> it = mapCC_PCs.keySet().iterator(); it.hasNext(); ) {
+ ConsoleConfiguration consoleConfiguration = it.next();
+ Set<PersistentClass> setPC = mapCC_PCs.get(consoleConfiguration);
+ try {
+ openEditor(setPC, consoleConfiguration);
+ } catch (PartInitException e) {
+ HibernateConsolePlugin.getDefault().logErrorMessage("Can't open mapping view.", e); //$NON-NLS-1$
+ }
+ }
+ }
+
+ public IEditorPart openEditor(PersistentClass persClass,
+ ConsoleConfiguration consoleConfiguration) throws PartInitException {
+ ObjectEditorInput input = new ObjectEditorInput(consoleConfiguration, 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 {
+
+ if (setPC.size() <= 0) {
+ return null;
+ }
+ RootClass[] rcArr = new RootClass[setPC.size()];
+ PersistentClass persClass = null;
+ int i = 0;
+ for (Iterator<PersistentClass> it = setPC.iterator(); it.hasNext(); ) {
+ persClass = it.next();
+ rcArr[i++] = persClass.getRootClass();
+ }
+ ObjectEditorInput input = new ObjectEditorInput(consoleConfiguration, rcArr);
+ return IDE.openEditor(UiPlugin.getPage(), input, "org.jboss.tools.hibernate.ui.diagram.editors.DiagramViewer"); //$NON-NLS-1$
+ }
+}
\ No newline at end of file
Copied: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/view/OrmImageMap.java (from rev 16319, trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmImageMap.java)
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/view/OrmImageMap.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/view/OrmImageMap.java 2009-07-02 18:12:57 UTC (rev 16355)
@@ -0,0 +1,201 @@
+/*******************************************************************************
+ * 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.jface.resource.ImageDescriptor;
+import org.hibernate.mapping.Any;
+import org.hibernate.mapping.Array;
+import org.hibernate.mapping.Bag;
+import org.hibernate.mapping.Column;
+import org.hibernate.mapping.Component;
+import org.hibernate.mapping.DependantValue;
+import org.hibernate.mapping.IdentifierBag;
+import org.hibernate.mapping.List;
+import org.hibernate.mapping.ManyToOne;
+import org.hibernate.mapping.Map;
+import org.hibernate.mapping.OneToMany;
+import org.hibernate.mapping.OneToOne;
+import org.hibernate.mapping.PersistentClass;
+import org.hibernate.mapping.PrimitiveArray;
+import org.hibernate.mapping.Property;
+import org.hibernate.mapping.Set;
+import org.hibernate.mapping.SimpleValue;
+import org.hibernate.mapping.Table;
+import org.hibernate.mapping.Value;
+import org.jboss.tools.hibernate.ui.diagram.UiPlugin;
+
+/**
+ * Map: ORM object -> Image descriptor
+ */
+public class OrmImageMap {
+
+ private OrmImageMap() {}
+
+ public static ImageDescriptor getImageDescriptor(final Object obj) {
+ String imageName = null;
+ if (obj instanceof Table) {
+ imageName = getImageName((Table)obj);
+ } else if (obj instanceof Column) {
+ imageName = getImageName((Column)obj);
+ } else if (obj instanceof Property) {
+ imageName = getImageName((Property)obj);
+ } else if (obj instanceof OneToMany) {
+ imageName = getImageName((OneToMany)obj);
+ } else if (obj instanceof SimpleValue) {
+ imageName = getImageName((SimpleValue)obj);
+ } else if (obj instanceof PersistentClass) {
+ imageName = getImageName((PersistentClass)obj);
+ }
+ return UiPlugin.getImageDescriptor(ImageBundle.getString(imageName));
+ }
+
+ /**
+ * the image name for hierarchy:
+ * Table
+ * @param table
+ * @return
+ */
+ public static String getImageName(Table table) {
+ return "Image_DatabaseTable"; //$NON-NLS-1$
+ }
+
+ /**
+ * the image name for hierarchy:
+ * Column
+ * @param column
+ * @return
+ */
+ public static String getImageName(Column column) {
+ String str = "Image_DatabaseColumn"; //$NON-NLS-1$
+ final boolean primaryKey = HibernateUtils.isPrimaryKey(column);
+ final boolean foreignKey = HibernateUtils.isForeignKey(column);
+ final Table table = HibernateUtils.getTable(column);
+ if (column.isUnique()) {
+ str = "Image_DatabaseUniqueKeyColumn"; //$NON-NLS-1$
+ } else if (primaryKey && table != null && foreignKey) {
+ str = "Image_DatabasePrimaryForeignKeysColumn"; //$NON-NLS-1$
+ } else if (primaryKey) {
+ str = "Image_DatabasePrimaryKeyColumn"; //$NON-NLS-1$
+ } else if (table != null && foreignKey) {
+ str = "Image_DatabaseForeignKeyColumn"; //$NON-NLS-1$
+ }
+ return str;
+
+ }
+
+ /**
+ * the image name for hierarchy:
+ * Property
+ * @param field
+ * @return
+ */
+ public static String getImageName(Property field) {
+ String str = "Image_PersistentFieldSimple"; //$NON-NLS-1$
+ if (field == null) {
+ return str;
+ }
+ final PersistentClass persistentClass = field.getPersistentClass();
+ if (persistentClass != null && persistentClass.getVersion() == field) {
+ str = "Image_PersistentFieldSimple_version"; //$NON-NLS-1$
+ } else if (persistentClass != null && persistentClass.getIdentifierProperty() == field) {
+ str = "Image_PersistentFieldSimple_id"; //$NON-NLS-1$
+ } else if (field.getValue() != null) {
+ final Value value = field.getValue();
+ if (value instanceof OneToMany) {
+ str = "Image_PersistentFieldOne-to-many"; //$NON-NLS-1$
+ } else if (value instanceof OneToOne) {
+ str = "Image_PersistentFieldOne-to-one"; //$NON-NLS-1$
+ } else if (value instanceof ManyToOne) {
+ str = "Image_PersistentFieldMany-to-one"; //$NON-NLS-1$
+ } else if (value instanceof Any) {
+ str = "Image_PersistentFieldAny"; //$NON-NLS-1$
+ } else if (field.getType() != null && field.getType().isCollectionType()) {
+ if (value instanceof PrimitiveArray) {
+ str = "Image_Collection_primitive_array"; //$NON-NLS-1$
+ } else if (value instanceof Array) {
+ str = "Image_Collection_array"; //$NON-NLS-1$
+ } else if (value instanceof List) {
+ str = "Image_Collection_list"; //$NON-NLS-1$
+ } else if (value instanceof Set) {
+ str = "Image_Collection_set"; //$NON-NLS-1$
+ } else if (value instanceof Map) {
+ str = "Image_Collection_map"; //$NON-NLS-1$
+ } else if (value instanceof Bag) {
+ str = "Image_Collection_bag"; //$NON-NLS-1$
+ } else if (value instanceof IdentifierBag) {
+ str = "Image_Collection_idbag"; //$NON-NLS-1$
+ } else {
+ str = "Image_Collection"; //$NON-NLS-1$
+ }
+ }
+ } else if ("parent".equals(field.getName())) { //$NON-NLS-1$
+ str = "Image_PersistentFieldParent"; //$NON-NLS-1$
+ }
+ return str;
+ }
+
+ /**
+ * the image name for hierarchy:
+ * OneToMany
+ * @param field
+ * @return
+ */
+ public static String getImageName(OneToMany field) {
+ return "Image_PersistentFieldOne-to-many"; //$NON-NLS-1$
+ }
+
+ /**
+ * the image name for hierarchy:
+ * SimpleValue
+ * |-- Any
+ * |-- Component
+ * |-- DependantValue
+ * |-- ToOne
+ * |-- ManyToOne
+ * |-- OneToOne
+ * @param field
+ * @return
+ */
+ public static String getImageName(SimpleValue field) {
+ String res = "Image_PersistentFieldSimple"; //$NON-NLS-1$
+ if (field instanceof Any) {
+ res = "Image_PersistentFieldMany-to-any"; //$NON-NLS-1$
+ } else if (field instanceof Component) {
+ res = "Image_PersistentFieldComponent"; //$NON-NLS-1$
+ } else if (field instanceof DependantValue) {
+ DependantValue mapping = (DependantValue)field;
+ if (mapping.getTable().getIdentifierValue() == mapping) {
+ res = "Image_PersistentFieldComponent_id"; //$NON-NLS-1$
+ }
+ } else if (field instanceof ManyToOne) {
+ res = "Image_PersistentFieldMany-to-many"; //$NON-NLS-1$
+ }
+ return res;
+ }
+
+ /**
+ * the image name for hierarchy:
+ * PersistentClass
+ * |-- RootClass
+ * | |-- SpecialRootClass
+ * |
+ * |-- Subclass
+ * |-- JoinedSubclass
+ * |-- SingleTableSubclass
+ * |-- UnionSubclass
+ * @param persistentClass
+ * @return
+ */
+ public static String getImageName(PersistentClass persistentClass) {
+ return "Image_PersistentClass"; //$NON-NLS-1$
+ }
+
+}
Copied: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/view/OrmLabelMap.java (from rev 16319, trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmLabelMap.java)
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/view/OrmLabelMap.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/view/OrmLabelMap.java 2009-07-02 18:12:57 UTC (rev 16355)
@@ -0,0 +1,201 @@
+/*******************************************************************************
+ * 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.hibernate.eclipse.console.workbench.TypeNameValueVisitor;
+import org.hibernate.mapping.Column;
+import org.hibernate.mapping.Component;
+import org.hibernate.mapping.DependantValue;
+import org.hibernate.mapping.OneToMany;
+import org.hibernate.mapping.PersistentClass;
+import org.hibernate.mapping.Property;
+import org.hibernate.mapping.SimpleValue;
+import org.hibernate.mapping.Table;
+import org.hibernate.mapping.Value;
+import org.hibernate.type.Type;
+
+/**
+ * Map: ORM object -> label
+ */
+public class OrmLabelMap {
+
+ static private String SPACE = " "; //$NON-NLS-1$
+ static private String POINTER = " -> "; //$NON-NLS-1$
+
+ private OrmLabelMap() {}
+
+ public static String getLabel(final Object obj) {
+ String label = null;
+ if (obj instanceof Table) {
+ label = getParticularLabel((Table)obj);
+ } else if (obj instanceof Column) {
+ label = getParticularLabel((Column)obj);
+ } else if (obj instanceof Property) {
+ label = getParticularLabel((Property)obj);
+ } else if (obj instanceof OneToMany) {
+ label = getParticularLabel((OneToMany)obj);
+ } else if (obj instanceof SimpleValue) {
+ label = getParticularLabel((SimpleValue)obj);
+ } else if (obj instanceof PersistentClass) {
+ label = getParticularLabel((PersistentClass)obj);
+ } else if (obj instanceof String) {
+ label = (String)obj;
+ } else {
+ throw unknownElement(obj);
+ }
+ if (label == null) {
+ label = UIViewMessages.OrmLabelProvider_orm_element;
+ }
+ return label;
+ }
+
+ public static String getParticularLabel(Table table) {
+ return HibernateUtils.getTableName(table);
+ }
+
+ public static String getParticularLabel(Column column) {
+ final String sqlType = column.getSqlType();
+ StringBuffer name = new StringBuffer();
+ name.append(column.getName());
+ if (sqlType != null) {
+ name.append(" ["); //$NON-NLS-1$
+ name.append(sqlType.toUpperCase());
+ name.append(column.isNullable() ? " Nullable" : ""); //$NON-NLS-1$ //$NON-NLS-2$
+ name.append(HibernateUtils.getTable(column) != null
+ && HibernateUtils.isPrimaryKey(column) ? " PK" : ""); //$NON-NLS-1$ //$NON-NLS-2$
+ name.append(HibernateUtils.getTable(column) != null
+ && HibernateUtils.isForeignKey(column) ? " FK" : ""); //$NON-NLS-1$ //$NON-NLS-2$
+ name.append("]"); //$NON-NLS-1$
+ }
+ return name.toString();
+ }
+
+ public static String getParticularLabel(Property field) {
+ StringBuffer name = new StringBuffer();
+ name.append(field.getName());
+ name.append(" :"); //$NON-NLS-1$
+ String typeString = null;
+ Type type = null;
+ try {
+ type = field.getType();
+ } catch (Exception e) {
+ // ignore - this is only way to catch java.lang.reflect.InvocationTargetException
+ }
+ if (type != null && type.getReturnedClass() != null) {
+ typeString = type.getReturnedClass().getName();
+ } else {
+ if (field.getValue() instanceof Component) {
+ typeString = ((Component)field.getValue()).getComponentClassName();
+ } else if (field.getValue()!= null && field.getValue().isSimpleValue()) {
+ typeString = ((SimpleValue)field.getValue()).getTypeName();
+ }
+ }
+ if (typeString != null) {
+ typeString = correctTypeString(typeString);
+ name.append(SPACE);
+ name.append(typeString);
+ return name.toString();
+ }
+ Value value = field.getValue();
+ String typeName = null;
+ if (value != null) {
+ typeName = (String) value.accept(new TypeNameValueVisitor(false));
+ if (typeName != null) {
+ return field.getName() + " : " + typeName; //$NON-NLS-1$
+ }
+ }
+ return field.getName();
+ }
+
+ public static String getParticularLabel(OneToMany field) {
+ return UIViewMessages.OrmLabelProvider_element;
+ }
+
+ /**
+ * the label for hierarchy:
+ * SimpleValue
+ * |-- Any
+ * |-- Component
+ * |-- DependantValue
+ * |-- ToOne
+ * |-- ManyToOne
+ * |-- OneToOne
+ * @param field
+ * @return
+ */
+ public static String getParticularLabel(SimpleValue field) {
+ String label = UIViewMessages.OrmLabelProvider_element;
+ if (field instanceof DependantValue) {
+ label = "key"; //$NON-NLS-1$
+ } else if (field instanceof Component) {
+ label = "element"; //$NON-NLS-1$
+ }
+ return label;
+ }
+
+ /**
+ * the label for hierarchy:
+ * PersistentClass
+ * |-- RootClass
+ * | |-- SpecialRootClass
+ * |
+ * |-- Subclass
+ * |-- JoinedSubclass
+ * |-- SingleTableSubclass
+ * |-- UnionSubclass
+ * @param persistentClass
+ * @return
+ */
+ public static String getParticularLabel(PersistentClass persistentClass) {
+ StringBuffer name = new StringBuffer();
+ name.append(persistentClass.getEntityName() != null ?
+ persistentClass.getEntityName() : persistentClass.getClassName());
+ Table table = persistentClass.getTable();
+ if (table != null) {
+ final String tableName = HibernateUtils.getTableName(table);
+ if (tableName != null) {
+ name.append(POINTER);
+ name.append(tableName);
+ }
+ }
+ return name.toString();
+ }
+
+ private static String correctTypeString(String str) {
+ String ret = str;
+ while (ret.startsWith("[")) { //$NON-NLS-1$
+ ret = ret.substring(1).concat("[]"); //$NON-NLS-1$
+ }
+ switch (ret.toCharArray()[0]) {
+ case 'Z': ret = "boolean".concat(ret.substring(1));break; //$NON-NLS-1$
+ case 'B': ret = "byte".concat(ret.substring(1));break; //$NON-NLS-1$
+ case 'C': ret = "char".concat(ret.substring(1));break; //$NON-NLS-1$
+ case 'L': ret = ret.substring(1);break;
+ case 'D': ret = "double".concat(ret.substring(1));break; //$NON-NLS-1$
+ case 'F': ret = "float".concat(ret.substring(1));break; //$NON-NLS-1$
+ case 'I': ret = "int".concat(ret.substring(1));break; //$NON-NLS-1$
+ case 'J': ret = "long".concat(ret.substring(1));break; //$NON-NLS-1$
+ case 'S': ret = "short".concat(ret.substring(1));break; //$NON-NLS-1$
+ }
+ return ret;
+ }
+
+ private static RuntimeException unknownElement(Object element) {
+ String msg = UIViewMessages.OrmLabelProvider_unknown_type_of_element_in_tree_of_type;
+ if (element != null && element.getClass() != null ) {
+ msg = msg + element.getClass().getName();
+ } else {
+ msg = msg + element;
+ }
+ return new RuntimeException(msg);
+
+ }
+}
\ No newline at end of file
Copied: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/view/OrmLabelProvider.java (from rev 16319, trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmLabelProvider.java)
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/view/OrmLabelProvider.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/view/OrmLabelProvider.java 2009-07-02 18:12:57 UTC (rev 16355)
@@ -0,0 +1,139 @@
+/*******************************************************************************
+ * 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.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IColorProvider;
+import org.eclipse.jface.viewers.IFontProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.cfg.Environment;
+import org.hibernate.dialect.Dialect;
+import org.hibernate.eclipse.console.HibernateConsolePlugin;
+import org.hibernate.engine.Mapping;
+import org.hibernate.mapping.Column;
+import org.hibernate.mapping.Property;
+import org.hibernate.mapping.RootClass;
+
+public class OrmLabelProvider extends LabelProvider implements IColorProvider, IFontProvider {
+
+ private Map<ImageDescriptor, Image> imageCache = new HashMap<ImageDescriptor, Image>(25);
+
+ protected Configuration config = null;
+ protected Mapping mapping = null;
+ protected Dialect dialect = null;
+
+ public OrmLabelProvider() {
+ }
+
+ public OrmLabelProvider(Configuration config) {
+ super();
+ setConfig(config);
+ }
+
+ public void setConfig(Configuration config) {
+ if (this.config == config) {
+ return;
+ }
+ this.config = config;
+ mapping = null;
+ dialect = null;
+ }
+
+ @Override
+ public Image getImage(Object element) {
+ ImageDescriptor descriptor = OrmImageMap.getImageDescriptor(element);
+ if (descriptor == null) {
+ return null;
+ }
+ Image image = imageCache.get(descriptor);
+ if (image == null) {
+ image = descriptor.createImage();
+ imageCache.put(descriptor, image);
+ }
+ return image;
+ }
+
+ @Override
+ public String getText(Object obj) {
+ if (obj instanceof Column) {
+ updateColumnSqlType((Column)obj);
+ }
+ return OrmLabelMap.getLabel(obj);
+ }
+
+ public void dispose() {
+ for (Iterator<Image> i = imageCache.values().iterator(); i.hasNext();) {
+ i.next().dispose();
+ }
+ imageCache.clear();
+ }
+
+ public Color getForeground(Object element) {
+ if (element instanceof RootClass) {
+ return Display.getCurrent().getSystemColor(SWT.COLOR_DARK_GREEN);
+ } else if (element instanceof Property) {
+ return Display.getCurrent().getSystemColor(SWT.COLOR_DARK_BLUE);
+ }
+ return null;
+ }
+
+ public Color getBackground(Object element) {
+ return null;
+ }
+
+ public Font getFont(Object element) {
+ //return JFaceResources.getFontRegistry().getBold(JFaceResources.getTextFont().getFontData()[0].getName());
+ return null;
+ }
+
+ /**
+ * For correct label creation should update column sql type.
+ * @param column
+ * @return
+ */
+ public boolean updateColumnSqlType(final Column column) {
+ String sqlType = column.getSqlType();
+ if (sqlType != null) {
+ return false;
+ }
+ if (mapping == null) {
+ mapping = config.buildMapping();
+ }
+ if (dialect == null) {
+ final String dialectName = config.getProperty(Environment.DIALECT);
+ if (dialectName != null) {
+ try {
+ dialect = (Dialect) Class.forName(dialectName).newInstance();
+ } catch (InstantiationException e) {
+ HibernateConsolePlugin.getDefault().logErrorMessage("Exception: ", e); //$NON-NLS-1$
+ } catch (IllegalAccessException e) {
+ HibernateConsolePlugin.getDefault().logErrorMessage("Exception: ", e); //$NON-NLS-1$
+ } catch (ClassNotFoundException e) {
+ HibernateConsolePlugin.getDefault().logErrorMessage("Exception: ", e); //$NON-NLS-1$
+ }
+ }
+ }
+ sqlType = column.getSqlType(dialect, mapping);
+ column.setSqlType(sqlType);
+ return true;
+ }
+
+}
\ No newline at end of file
Copied: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/view/UIViewMessages.java (from rev 16319, trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/UIViewMessages.java)
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/view/UIViewMessages.java (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/view/UIViewMessages.java 2009-07-02 18:12:57 UTC (rev 16355)
@@ -0,0 +1,21 @@
+package org.jboss.tools.hibernate.ui.view;
+
+import org.eclipse.osgi.util.NLS;
+
+public class UIViewMessages extends NLS {
+ private static final String BUNDLE_NAME = "org.jboss.tools.hibernate.ui.view.UIViewMessages"; //$NON-NLS-1$
+ public static String BaseUIPlugin_hibernate_console;
+ public static String ViewPlugin_canot_load_preference_store_properties;
+ public static String OrmLabelProvider_element;
+ public static String OrmLabelProvider_orm_element;
+ public static String OrmLabelProvider_unknown_type_of_element_in_tree_of_type;
+ public static String ViewPlugin_no_message_1;
+ public static String ViewPlugin_no_message_2;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, UIViewMessages.class);
+ }
+
+ private UIViewMessages() {
+ }
+}
Copied: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/view/UIViewMessages.properties (from rev 16319, trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/UIViewMessages.properties)
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/view/UIViewMessages.properties (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/view/UIViewMessages.properties 2009-07-02 18:12:57 UTC (rev 16355)
@@ -0,0 +1,9 @@
+BaseUIPlugin_hibernate_console=Hibernate Console
+ViewPlugin_canot_load_preference_store_properties=Can't load preference store properties
+
+OrmLabelProvider_element=element
+OrmLabelProvider_orm_element=OrmElement
+OrmLabelProvider_unknown_type_of_element_in_tree_of_type=Unknown type of element in tree of type:
+
+ViewPlugin_no_message_1=: <no message>
+ViewPlugin_no_message_2=<No message>
Copied: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/view/image.properties (from rev 16319, trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/image.properties)
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/view/image.properties (rev 0)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/view/image.properties 2009-07-02 18:12:57 UTC (rev 16355)
@@ -0,0 +1,100 @@
+# START NON-TRANSLATABLE
+
+#Image
+Image_OrmModel=exdOrmModel.gif
+Image_DatabaseSchema=exdDatabaseSchema.gif
+Image_DatabaseTable=exdDatabaseTable.gif
+Image_DatabaseView=exdDatabaseView.gif
+Image_DatabaseConstraint=exdDatabaseConstraint1.gif
+Image_Package=exdPackage.gif
+Image_Mapping=exdMapping.gif
+Image_MappingStorage=exdMappingStorage.gif
+Image_PersistentClass=exdPersistentClass.gif
+Image_PersistentField=exdPersistentField.gif
+
+Image_PersistentClassMapping=exdPersistentClassMapping.gif
+#Image_PersistentRootClassMapping=exdPersistentRootClassMapping.gif
+Image_PersistentRootClassMapping=exdPersistentRootClassMappingC.gif
+Image_PersistentSubclassMapping=exdPersistentSubclassMapping.gif
+Image_PersistentUnionSubclassMapping=exdPersistentUnionSubclassMapping.gif
+Image_PersistentJoinedSubclassMapping=exdPersistentJoinedSubclassMapping.gif
+
+
+Image_PersistentFieldMapping=exdPersistentFieldMapping1.gif
+Image_PersistentValueMapping=exdPersistentValueMapping1.gif
+
+##Image for PersistentField
+Image_PersistentFieldAny=any.gif
+Image_PersistentFieldComponent=component.gif
+Image_PersistentFieldComponent_id=component_id.gif
+Image_PersistentFieldMany-to-any=many-to-any.gif
+Image_PersistentFieldMany-to-many=many-to-many.gif
+Image_PersistentFieldMany-to-one=many-to-one.gif
+Image_PersistentFieldMany-to-one_id=many-to-one_id.gif
+Image_PersistentFieldOne-to-many=one-to-many.gif
+Image_PersistentFieldOne-to-one=one-to-one.gif
+Image_PersistentFieldOne-to-one_id=one-to-one_id.gif
+Image_PersistentFieldSimple=simple.gif
+Image_PersistentFieldSimple_id=simple_id.gif
+Image_PersistentFieldSimple_version=simple_version.gif
+Image_PersistentFieldNot_mapped=not_mapped.gif
+Image_PersistentFieldParent=parent.gif
+
+##Image for Collection
+Image_Collection=collection.gif
+Image_Collection_array=collection_array.gif
+Image_Collection_primitive_array=collection_primitive_array.gif
+Image_Collection_set=collection_set.gif
+Image_Collection_bag=collection_bag.gif
+Image_Collection_idbag=collection_idbag.gif
+Image_Collection_list=collection_list.gif
+Image_Collection_map=collection_map.gif
+Image_NamedQueryMapping=hql.gif
+
+
+##Image for IDatabaseColumn
+Image_DatabaseColumn=exdDatabaseColumn.gif
+Image_DatabasePrimaryKeyColumn=exdDatabasePrimaryKeyColumn.gif
+Image_DatabaseForeignKeyColumn=exdDatabaseForeignKeyColumn.gif
+Image_DatabaseDiscriminatorColumn=exdDatabaseDiscriminatorColumn.gif
+Image_DatabaseVersionColumn=exdDatabaseVersionColumn.gif
+Image_DatabasePrimaryForeignKeysColumn=exdDatabasePrimaryForeignKeysColumn.gif
+Image_DatabaseUniqueKeyColumn=unique_key.gif
+
+#Explorer
+Explorer.RootPackageClassField=exdPackage.gif
+Explorer.RootClassField=exdPersistentClassMapping.gif
+Explorer.RootStorageClassField=exdPersistentField.gif
+Explorer.WizardAction=exdWizardAction1.gif
+Explorer.DialogAction=exdDialogAction1.gif
+Explorer.Delete=delete_edit.gif
+Explorer.hibernateAddMappingWizard=exdMapping_new.gif
+Explorer.refreshOrmGef=refresh_orm_gef.gif
+
+ExplorerBase.RootSchemaTableColumn=exdDatabaseSchema.gif
+ExplorerBase.RootTableColumn=exdDatabaseColumn.gif
+
+#Wizard
+Wizard.Title=wiz_icon.gif
+
+#Decorator
+Decorator.Error=error_view.gif
+Decorator.Warning=warning_vew.gif
+Decorator.Unknown=unknown.gif
+
+#NamedQueriesWizard
+NamedQueriesWizard.object=object.gif
+NamedQueriesWizard.object_none=object_none.gif
+NamedQueriesWizard.property=property.gif
+NamedQueriesWizard.error=error_st_obj.gif
+
+#TreeModel
+TreeModelLabel.jar_obj=jar_obj.gif
+TreeModelLabel.file_obj=file_obj.gif
+TreeModelLabel.fldr_obj=fldr_obj.gif
+
+#VisualMapping
+VisualMapping.shevronUp=shevron_up.gif
+VisualMapping.shevronDown=shevron_down.gif
+
+# END NON-TRANSLATABLE
14 years, 9 months
JBoss Tools SVN: r16353 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2009-07-02 14:07:28 -0400 (Thu, 02 Jul 2009)
New Revision: 16353
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/.project
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/build.properties
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/plugin.properties
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/plugin.xml
Log:
https://jira.jboss.org/jira/browse/JBIDE-4524 - rename veditor plugin
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/.project
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/.project 2009-07-02 18:05:43 UTC (rev 16352)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/.project 2009-07-02 18:07:28 UTC (rev 16353)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>org.jboss.tools.hibernate.ui.veditor</name>
+ <name>org.jboss.tools.hibernate.ui</name>
<comment></comment>
<projects>
</projects>
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/build.properties
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/build.properties 2009-07-02 18:05:43 UTC (rev 16352)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/build.properties 2009-07-02 18:07:28 UTC (rev 16353)
@@ -1,15 +1,12 @@
bin.includes = plugin.xml,\
+ org.jboss.tools.hibernate.ui.jar,\
META-INF/,\
- META-INF/,\
- META-INF/,\
- META-INF/,\
- META-INF/,\
- META-INF/,\
- orm2-veditor.jar,\
- META-INF/,\
about.html,\
icons/,\
+ images/,\
plugin.properties
-jars.compile.order = orm2-veditor.jar
-source.orm2-veditor.jar = src/
-additional.bundles = org.eclipse.ui.ide
+jars.compile.order = org.jboss.tools.hibernate.ui.jar
+source.org.jboss.tools.hibernate.ui.jar = src/
+output.org.jboss.tools.hibernate.ui.jar = bin/
+src.includes = src/,\
+ about.html
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/plugin.properties
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/plugin.properties 2009-07-02 18:05:43 UTC (rev 16352)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/plugin.properties 2009-07-02 18:07:28 UTC (rev 16353)
@@ -1,2 +1,2 @@
providerName=JBoss by Red Hat
-pluginName=Visual Editor Plugin
+pluginName=UI Plugin
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/plugin.xml
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/plugin.xml 2009-07-02 18:05:43 UTC (rev 16352)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/plugin.xml 2009-07-02 18:07:28 UTC (rev 16353)
@@ -4,12 +4,24 @@
<extension
point="org.eclipse.ui.editors">
<editor
- class="org.jboss.tools.hibernate.ui.veditor.editors.VisualEditor"
- contributorClass="org.jboss.tools.hibernate.ui.veditor.editors.EditorActionContributor"
+ class="org.jboss.tools.hibernate.ui.diagram.editors.DiagramViewer"
+ contributorClass="org.jboss.tools.hibernate.ui.diagram.editors.EditorActionContributor"
icon="$nl$/icons/hibernate_small_icon.gif"
- id="org.jboss.tools.hibernate.ui.veditor.editors.visualeditor"
+ id="org.jboss.tools.hibernate.ui.diagram.editors.DiagramViewer"
name="Hibernate Diagram Viewer">
</editor>
</extension>
+ <extension point="org.eclipse.ui.popupMenus">
+ <objectContribution id="diagramEditorAction" objectClass="org.hibernate.mapping.PersistentClass">
+ <menu id="org.jboss.tools.hibernate.ui.view.openDiagram" label="Open Mapping Diagram" path="diagramEditorAction"/>
+ <action
+ id="org.jboss.tools.hibernate.ui.view.openDiagramAction"
+ label="Open Mapping Diagram"
+ icon="images/hibernate_small_icon.gif"
+ class="org.jboss.tools.hibernate.ui.view.OpenDiagramActionDelegate">
+ </action>
+ </objectContribution>
+ </extension>
+
</plugin>
14 years, 9 months
JBoss Tools SVN: r16352 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/META-INF.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2009-07-02 14:05:43 -0400 (Thu, 02 Jul 2009)
New Revision: 16352
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/META-INF/MANIFEST.MF
Log:
https://jira.jboss.org/jira/browse/JBIDE-4524 - rename veditor plugin
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/META-INF/MANIFEST.MF
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/META-INF/MANIFEST.MF 2009-07-02 18:05:16 UTC (rev 16351)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/META-INF/MANIFEST.MF 2009-07-02 18:05:43 UTC (rev 16352)
@@ -1,13 +1,14 @@
Manifest-Version: 1.0
-Eclipse-LazyStart: true
+Bundle-ActivationPolicy: lazy
Bundle-Name: %pluginName
-Bundle-ClassPath: orm2-veditor.jar
-Bundle-Activator: org.jboss.tools.hibernate.ui.veditor.VisualEditorPlugin
+Bundle-ClassPath: org.jboss.tools.hibernate.ui.jar
+Bundle-Activator: org.jboss.tools.hibernate.ui.diagram.UiPlugin
Bundle-Vendor: %providerName
Bundle-ManifestVersion: 2
Bundle-Localization: plugin
-Bundle-SymbolicName: org.jboss.tools.hibernate.ui.veditor;singleton:=true
+Bundle-SymbolicName: org.jboss.tools.hibernate.ui;singleton:=true
Require-Bundle: org.eclipse.ui,
+ org.eclipse.ui.ide,
org.eclipse.ui.views,
org.eclipse.core.runtime,
org.eclipse.gef,
@@ -15,15 +16,15 @@
org.eclipse.core.resources,
org.hibernate.eclipse,
org.eclipse.jdt.core,
- org.jboss.tools.hibernate.ui.view,
org.hibernate.eclipse.console
Bundle-Version: 2.0.0
-Export-Package: org.jboss.tools.hibernate.ui.veditor,
- org.jboss.tools.hibernate.ui.veditor.editors,
- org.jboss.tools.hibernate.ui.veditor.editors.actions,
- org.jboss.tools.hibernate.ui.veditor.editors.command,
- org.jboss.tools.hibernate.ui.veditor.editors.figures,
- org.jboss.tools.hibernate.ui.veditor.editors.model,
- org.jboss.tools.hibernate.ui.veditor.editors.parts
+Export-Package: org.jboss.tools.hibernate.ui.diagram,
+ org.jboss.tools.hibernate.ui.diagram.editors,
+ org.jboss.tools.hibernate.ui.diagram.editors.actions,
+ org.jboss.tools.hibernate.ui.diagram.editors.command,
+ org.jboss.tools.hibernate.ui.diagram.editors.figures,
+ org.jboss.tools.hibernate.ui.diagram.editors.model,
+ org.jboss.tools.hibernate.ui.diagram.editors.parts,
+ org.jboss.tools.hibernate.ui.view
Import-Package: org.eclipse.ui.actions
14 years, 9 months
JBoss Tools SVN: r16350 - in trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view: META-INF and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2009-07-02 13:45:17 -0400 (Thu, 02 Jul 2009)
New Revision: 16350
Removed:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/images/
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/ImageBundle.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/UIViewMessages.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/UIViewMessages.properties
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/image.properties
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/HibernateUtils.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/ObjectEditorInput.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OpenDiagramActionDelegate.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmImageMap.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmLabelMap.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmLabelProvider.java
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/META-INF/MANIFEST.MF
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/plugin.xml
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/ViewPlugin.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4524 - rename veditor plugin
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/META-INF/MANIFEST.MF
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/META-INF/MANIFEST.MF 2009-07-02 17:42:29 UTC (rev 16349)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/META-INF/MANIFEST.MF 2009-07-02 17:45:17 UTC (rev 16350)
@@ -7,20 +7,7 @@
Bundle-Activator: org.jboss.tools.hibernate.ui.view.ViewPlugin
Bundle-Vendor: %Bundle-Vendor.0
Bundle-Localization: plugin
-Export-Package: org.jboss.tools.hibernate.ui.view,
- org.jboss.tools.hibernate.ui.view.views
+Export-Package: org.jboss.tools.hibernate.ui.view
Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.core.resources,
- org.eclipse.jdt.core,
- org.eclipse.jdt.ui,
- org.eclipse.core.resources,
- org.eclipse.ui.ide,
- org.eclipse.ui.views,
- org.eclipse.ltk.core.refactoring,
- org.eclipse.ui.editors,
- org.eclipse.jface.text,
- org.hibernate.eclipse,
- org.eclipse.debug.core,
- org.hibernate.eclipse.console
-Eclipse-LazyStart: true
+ org.eclipse.core.runtime
+Bundle-ActivationPolicy: lazy
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/plugin.xml
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/plugin.xml 2009-07-02 17:42:29 UTC (rev 16349)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/plugin.xml 2009-07-02 17:45:17 UTC (rev 16350)
@@ -1,15 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?><?eclipse version="3.0"?>
<plugin>
-
- <extension point="org.eclipse.ui.popupMenus">
- <objectContribution id="diagramEditorAction" objectClass="org.hibernate.mapping.PersistentClass">
- <menu id="org.jboss.tools.hibernate.ui.view.openDiagram" label="Open Mapping Diagram" path="diagramEditorAction"/>
- <action
- id="org.jboss.tools.hibernate.ui.view.openDiagramAction"
- label="Open Mapping Diagram"
- icon="images/hibernate_small_icon.gif"
- class="org.jboss.tools.hibernate.ui.view.views.OpenDiagramActionDelegate">
- </action>
- </objectContribution>
- </extension>
</plugin>
Deleted: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/ImageBundle.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/ImageBundle.java 2009-07-02 17:42:29 UTC (rev 16349)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/ImageBundle.java 2009-07-02 17:45:17 UTC (rev 16350)
@@ -1,22 +0,0 @@
-package org.jboss.tools.hibernate.ui.view;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-public class ImageBundle {
- private static final String BUNDLE_NAME = "org.jboss.tools.hibernate.ui.view.image"; //$NON-NLS-1$
-
- private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
- .getBundle(BUNDLE_NAME);
-
- private ImageBundle() {
- }
-
- public static String getString(String key) {
- try {
- return RESOURCE_BUNDLE.getString(key);
- } catch (MissingResourceException e) {
- return '!' + key + '!';
- }
- }
-}
Deleted: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/UIViewMessages.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/UIViewMessages.java 2009-07-02 17:42:29 UTC (rev 16349)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/UIViewMessages.java 2009-07-02 17:45:17 UTC (rev 16350)
@@ -1,21 +0,0 @@
-package org.jboss.tools.hibernate.ui.view;
-
-import org.eclipse.osgi.util.NLS;
-
-public class UIViewMessages extends NLS {
- private static final String BUNDLE_NAME = "org.jboss.tools.hibernate.ui.view.UIViewMessages"; //$NON-NLS-1$
- public static String BaseUIPlugin_hibernate_console;
- public static String ViewPlugin_canot_load_preference_store_properties;
- public static String OrmLabelProvider_element;
- public static String OrmLabelProvider_orm_element;
- public static String OrmLabelProvider_unknown_type_of_element_in_tree_of_type;
- public static String ViewPlugin_no_message_1;
- public static String ViewPlugin_no_message_2;
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, UIViewMessages.class);
- }
-
- private UIViewMessages() {
- }
-}
Deleted: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/UIViewMessages.properties
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/UIViewMessages.properties 2009-07-02 17:42:29 UTC (rev 16349)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/UIViewMessages.properties 2009-07-02 17:45:17 UTC (rev 16350)
@@ -1,9 +0,0 @@
-BaseUIPlugin_hibernate_console=Hibernate Console
-ViewPlugin_canot_load_preference_store_properties=Can't load preference store properties
-
-OrmLabelProvider_element=element
-OrmLabelProvider_orm_element=OrmElement
-OrmLabelProvider_unknown_type_of_element_in_tree_of_type=Unknown type of element in tree of type:
-
-ViewPlugin_no_message_1=: <no message>
-ViewPlugin_no_message_2=<No message>
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/ViewPlugin.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/ViewPlugin.java 2009-07-02 17:42:29 UTC (rev 16349)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/ViewPlugin.java 2009-07-02 17:45:17 UTC (rev 16350)
@@ -35,17 +35,6 @@
setPlugin(this);
}
- public static ImageDescriptor getImageDescriptor(String name) {
- final String iconPath = "images/"; //$NON-NLS-1$
- final URL installURL = getDefault().getBundle().getEntry("/"); //$NON-NLS-1$
- URL url = null;
- try {
- url = new URL(installURL, iconPath + name);
- } catch (MalformedURLException e) {
- }
- return ImageDescriptor.createFromURL(url);
- }
-
public void start(BundleContext context) throws Exception {
super.start(context);
}
Deleted: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/image.properties
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/image.properties 2009-07-02 17:42:29 UTC (rev 16349)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/image.properties 2009-07-02 17:45:17 UTC (rev 16350)
@@ -1,100 +0,0 @@
-# START NON-TRANSLATABLE
-
-#Image
-Image_OrmModel=exdOrmModel.gif
-Image_DatabaseSchema=exdDatabaseSchema.gif
-Image_DatabaseTable=exdDatabaseTable.gif
-Image_DatabaseView=exdDatabaseView.gif
-Image_DatabaseConstraint=exdDatabaseConstraint1.gif
-Image_Package=exdPackage.gif
-Image_Mapping=exdMapping.gif
-Image_MappingStorage=exdMappingStorage.gif
-Image_PersistentClass=exdPersistentClass.gif
-Image_PersistentField=exdPersistentField.gif
-
-Image_PersistentClassMapping=exdPersistentClassMapping.gif
-#Image_PersistentRootClassMapping=exdPersistentRootClassMapping.gif
-Image_PersistentRootClassMapping=exdPersistentRootClassMappingC.gif
-Image_PersistentSubclassMapping=exdPersistentSubclassMapping.gif
-Image_PersistentUnionSubclassMapping=exdPersistentUnionSubclassMapping.gif
-Image_PersistentJoinedSubclassMapping=exdPersistentJoinedSubclassMapping.gif
-
-
-Image_PersistentFieldMapping=exdPersistentFieldMapping1.gif
-Image_PersistentValueMapping=exdPersistentValueMapping1.gif
-
-##Image for PersistentField
-Image_PersistentFieldAny=any.gif
-Image_PersistentFieldComponent=component.gif
-Image_PersistentFieldComponent_id=component_id.gif
-Image_PersistentFieldMany-to-any=many-to-any.gif
-Image_PersistentFieldMany-to-many=many-to-many.gif
-Image_PersistentFieldMany-to-one=many-to-one.gif
-Image_PersistentFieldMany-to-one_id=many-to-one_id.gif
-Image_PersistentFieldOne-to-many=one-to-many.gif
-Image_PersistentFieldOne-to-one=one-to-one.gif
-Image_PersistentFieldOne-to-one_id=one-to-one_id.gif
-Image_PersistentFieldSimple=simple.gif
-Image_PersistentFieldSimple_id=simple_id.gif
-Image_PersistentFieldSimple_version=simple_version.gif
-Image_PersistentFieldNot_mapped=not_mapped.gif
-Image_PersistentFieldParent=parent.gif
-
-##Image for Collection
-Image_Collection=collection.gif
-Image_Collection_array=collection_array.gif
-Image_Collection_primitive_array=collection_primitive_array.gif
-Image_Collection_set=collection_set.gif
-Image_Collection_bag=collection_bag.gif
-Image_Collection_idbag=collection_idbag.gif
-Image_Collection_list=collection_list.gif
-Image_Collection_map=collection_map.gif
-Image_NamedQueryMapping=hql.gif
-
-
-##Image for IDatabaseColumn
-Image_DatabaseColumn=exdDatabaseColumn.gif
-Image_DatabasePrimaryKeyColumn=exdDatabasePrimaryKeyColumn.gif
-Image_DatabaseForeignKeyColumn=exdDatabaseForeignKeyColumn.gif
-Image_DatabaseDiscriminatorColumn=exdDatabaseDiscriminatorColumn.gif
-Image_DatabaseVersionColumn=exdDatabaseVersionColumn.gif
-Image_DatabasePrimaryForeignKeysColumn=exdDatabasePrimaryForeignKeysColumn.gif
-Image_DatabaseUniqueKeyColumn=unique_key.gif
-
-#Explorer
-Explorer.RootPackageClassField=exdPackage.gif
-Explorer.RootClassField=exdPersistentClassMapping.gif
-Explorer.RootStorageClassField=exdPersistentField.gif
-Explorer.WizardAction=exdWizardAction1.gif
-Explorer.DialogAction=exdDialogAction1.gif
-Explorer.Delete=delete_edit.gif
-Explorer.hibernateAddMappingWizard=exdMapping_new.gif
-Explorer.refreshOrmGef=refresh_orm_gef.gif
-
-ExplorerBase.RootSchemaTableColumn=exdDatabaseSchema.gif
-ExplorerBase.RootTableColumn=exdDatabaseColumn.gif
-
-#Wizard
-Wizard.Title=wiz_icon.gif
-
-#Decorator
-Decorator.Error=error_view.gif
-Decorator.Warning=warning_vew.gif
-Decorator.Unknown=unknown.gif
-
-#NamedQueriesWizard
-NamedQueriesWizard.object=object.gif
-NamedQueriesWizard.object_none=object_none.gif
-NamedQueriesWizard.property=property.gif
-NamedQueriesWizard.error=error_st_obj.gif
-
-#TreeModel
-TreeModelLabel.jar_obj=jar_obj.gif
-TreeModelLabel.file_obj=file_obj.gif
-TreeModelLabel.fldr_obj=fldr_obj.gif
-
-#VisualMapping
-VisualMapping.shevronUp=shevron_up.gif
-VisualMapping.shevronDown=shevron_down.gif
-
-# END NON-TRANSLATABLE
Deleted: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/HibernateUtils.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/HibernateUtils.java 2009-07-02 17:42:29 UTC (rev 16349)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/HibernateUtils.java 2009-07-02 17:45:17 UTC (rev 16350)
@@ -1,70 +0,0 @@
-package org.jboss.tools.hibernate.ui.view.views;
-
-import java.util.Iterator;
-
-import org.hibernate.mapping.Column;
-import org.hibernate.mapping.ForeignKey;
-import org.hibernate.mapping.PersistentClass;
-import org.hibernate.mapping.Table;
-
-public class HibernateUtils {
-
- public static String getTableName(String catalog, String schema, String name) {
- return (catalog != null ? catalog + "." : "") + (schema != null ? schema + "." : "") + name; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- }
-
- public static String getTableName(Table table) {
- return getTableName(table.getCatalog(), table.getSchema(), table.getName());
- }
-
- public static String getPersistentClassName(PersistentClass rootClass) {
- if (rootClass == null) {
- return ""; //$NON-NLS-1$
- }
- return rootClass.getEntityName() != null ? rootClass.getEntityName() : rootClass.getClassName();
- }
-
- public static String getPersistentClassName(String className) {
- if (className == null) {
- return ""; //$NON-NLS-1$
- } else if (className.indexOf(".") < 0) { //$NON-NLS-1$
- return "default." + className; //$NON-NLS-1$
- }
- return className;
- }
-
- public static boolean isPrimaryKey(Column column) {
- Table table = getTable(column);
- if (table != null) {
- if (table.getPrimaryKey() != null) {
- if (table.getPrimaryKey().containsColumn(column)) {
- return true;
- }
- }
- }
- return false;
- }
-
- @SuppressWarnings("unchecked")
- public static boolean isForeignKey(Column column){
- Table table = getTable(column);
- if (table != null) {
- Iterator<ForeignKey> iter = table.getForeignKeyIterator();
- while (iter.hasNext()) {
- ForeignKey fk = iter.next();
- if (fk.containsColumn(column)) {
- return true;
- }
- }
- }
- return false;
-
- }
-
- public static Table getTable(Column column){
- if (column.getValue() != null) {
- return column.getValue().getTable();
- }
- return null;
- }
-}
Deleted: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/ObjectEditorInput.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/ObjectEditorInput.java 2009-07-02 17:42:29 UTC (rev 16349)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/ObjectEditorInput.java 2009-07-02 17:45:17 UTC (rev 16350)
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.views;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IPersistableElement;
-import org.hibernate.console.ConsoleConfiguration;
-
-
-public class ObjectEditorInput implements IEditorInput{
-
- protected Object fObject;
- protected ConsoleConfiguration configuration;
-
- public ObjectEditorInput(ConsoleConfiguration configuration, Object object) {
- fObject = object;
- this.configuration = configuration;
- }
-
- public Object getObject() {
- return fObject;
- }
-
-
- public boolean exists() {
- return false;
- }
-
-
- public ImageDescriptor getImageDescriptor() {
- return ImageDescriptor.getMissingImageDescriptor();
- }
-
-
- public String getName() {
- return ""; //$NON-NLS-1$
- }
-
-
- 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) {
- return (obj instanceof ObjectEditorInput && ((ObjectEditorInput)obj).fObject == fObject);
- }
-
- public int hashCode() {
- return fObject.hashCode();
- }
-}
Deleted: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OpenDiagramActionDelegate.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OpenDiagramActionDelegate.java 2009-07-02 17:42:29 UTC (rev 16349)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OpenDiagramActionDelegate.java 2009-07-02 17:45:17 UTC (rev 16350)
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.views;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.TreePath;
-import org.eclipse.jface.viewers.TreeSelection;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.ide.IDE;
-import org.eclipse.ui.internal.ObjectPluginAction;
-import org.hibernate.console.ConsoleConfiguration;
-import org.hibernate.eclipse.console.HibernateConsolePlugin;
-import org.hibernate.mapping.PersistentClass;
-import org.hibernate.mapping.RootClass;
-import org.jboss.tools.hibernate.ui.view.ViewPlugin;
-
-@SuppressWarnings("restriction")
-public class OpenDiagramActionDelegate implements IObjectActionDelegate {
-
- private HashMap<Object, ObjectEditorInput> hashMap = new HashMap<Object, ObjectEditorInput>();
- //private IWorkbenchPart fPart;
-
- public void setActivePart(IAction action, IWorkbenchPart targetPart) {
- //this.fPart = targetPart;
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- }
-
- public void run(IAction action) {
- ObjectPluginAction objectPluginAction = (ObjectPluginAction)action;
- Map<ConsoleConfiguration, Set<PersistentClass>> mapCC_PCs = new HashMap<ConsoleConfiguration, Set<PersistentClass>>();
- TreePath[] paths = ((TreeSelection)objectPluginAction.getSelection()).getPaths();
- for (int i = 0; i < paths.length; i++) {
- Object last_el = paths[i].getLastSegment();
- if (last_el instanceof PersistentClass) {
- PersistentClass persClass = (PersistentClass) last_el;
- ConsoleConfiguration consoleConfiguration = (ConsoleConfiguration)(paths[i].getFirstSegment());
- Set<PersistentClass> setPC = mapCC_PCs.get(consoleConfiguration);
- if (null == setPC) {
- setPC = new HashSet<PersistentClass>();
- mapCC_PCs.put(consoleConfiguration, setPC);
- }
- setPC.add(persClass);
- }
- }
- for (Iterator<ConsoleConfiguration> it = mapCC_PCs.keySet().iterator(); it.hasNext(); ) {
- ConsoleConfiguration consoleConfiguration = it.next();
- Set<PersistentClass> setPC = mapCC_PCs.get(consoleConfiguration);
- try {
- openEditor(setPC, consoleConfiguration);
- } catch (PartInitException e) {
- HibernateConsolePlugin.getDefault().logErrorMessage("Can't open mapping view.", e); //$NON-NLS-1$
- }
- }
- }
-
- public IEditorPart openEditor(PersistentClass persClass,
- ConsoleConfiguration consoleConfiguration) throws PartInitException {
- ObjectEditorInput input = hashMap.get(persClass.getRootClass());
- if (input == null) {
- input = new ObjectEditorInput(consoleConfiguration, persClass.getRootClass());
- hashMap.put(persClass.getRootClass(), input);
- }
-
- return IDE.openEditor(ViewPlugin.getPage(),input, "org.jboss.tools.hibernate.ui.veditor.editors.visualeditor"); //$NON-NLS-1$
- }
-
- public IEditorPart openEditor(Set<PersistentClass> setPC, ConsoleConfiguration consoleConfiguration) throws PartInitException {
-
- if (0 >= setPC.size()) {
- return null;
- }
-
- RootClass[] rcArr = new RootClass[setPC.size()];
- String id = ""; //$NON-NLS-1$
- PersistentClass persClass = null;
- int i = 0;
- for (Iterator<PersistentClass> it = setPC.iterator(); it.hasNext(); ) {
- persClass = it.next();
- id += "@" + persClass.toString(); //$NON-NLS-1$
- rcArr[i++] = persClass.getRootClass();
- }
- ObjectEditorInput input = hashMap.get(id);
- if (null == input) {
- input = new ObjectEditorInput(consoleConfiguration, rcArr);
- hashMap.put(id, input);
- }
-
- return IDE.openEditor(ViewPlugin.getPage(),input, "org.jboss.tools.hibernate.ui.veditor.editors.visualeditor"); //$NON-NLS-1$
- }
-}
\ No newline at end of file
Deleted: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmImageMap.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmImageMap.java 2009-07-02 17:42:29 UTC (rev 16349)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmImageMap.java 2009-07-02 17:45:17 UTC (rev 16350)
@@ -1,202 +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.views;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.hibernate.mapping.Any;
-import org.hibernate.mapping.Array;
-import org.hibernate.mapping.Bag;
-import org.hibernate.mapping.Column;
-import org.hibernate.mapping.Component;
-import org.hibernate.mapping.DependantValue;
-import org.hibernate.mapping.IdentifierBag;
-import org.hibernate.mapping.List;
-import org.hibernate.mapping.ManyToOne;
-import org.hibernate.mapping.Map;
-import org.hibernate.mapping.OneToMany;
-import org.hibernate.mapping.OneToOne;
-import org.hibernate.mapping.PersistentClass;
-import org.hibernate.mapping.PrimitiveArray;
-import org.hibernate.mapping.Property;
-import org.hibernate.mapping.Set;
-import org.hibernate.mapping.SimpleValue;
-import org.hibernate.mapping.Table;
-import org.hibernate.mapping.Value;
-import org.jboss.tools.hibernate.ui.view.ImageBundle;
-import org.jboss.tools.hibernate.ui.view.ViewPlugin;
-
-/**
- * Map: ORM object -> Image descriptor
- */
-public class OrmImageMap {
-
- private OrmImageMap() {}
-
- public static ImageDescriptor getImageDescriptor(final Object obj) {
- String imageName = null;
- if (obj instanceof Table) {
- imageName = getImageName((Table)obj);
- } else if (obj instanceof Column) {
- imageName = getImageName((Column)obj);
- } else if (obj instanceof Property) {
- imageName = getImageName((Property)obj);
- } else if (obj instanceof OneToMany) {
- imageName = getImageName((OneToMany)obj);
- } else if (obj instanceof SimpleValue) {
- imageName = getImageName((SimpleValue)obj);
- } else if (obj instanceof PersistentClass) {
- imageName = getImageName((PersistentClass)obj);
- }
- return ViewPlugin.getImageDescriptor(ImageBundle.getString(imageName));
- }
-
- /**
- * the image name for hierarchy:
- * Table
- * @param table
- * @return
- */
- public static String getImageName(Table table) {
- return "Image_DatabaseTable"; //$NON-NLS-1$
- }
-
- /**
- * the image name for hierarchy:
- * Column
- * @param column
- * @return
- */
- public static String getImageName(Column column) {
- String str = "Image_DatabaseColumn"; //$NON-NLS-1$
- final boolean primaryKey = HibernateUtils.isPrimaryKey(column);
- final boolean foreignKey = HibernateUtils.isForeignKey(column);
- final Table table = HibernateUtils.getTable(column);
- if (column.isUnique()) {
- str = "Image_DatabaseUniqueKeyColumn"; //$NON-NLS-1$
- } else if (primaryKey && table != null && foreignKey) {
- str = "Image_DatabasePrimaryForeignKeysColumn"; //$NON-NLS-1$
- } else if (primaryKey) {
- str = "Image_DatabasePrimaryKeyColumn"; //$NON-NLS-1$
- } else if (table != null && foreignKey) {
- str = "Image_DatabaseForeignKeyColumn"; //$NON-NLS-1$
- }
- return str;
-
- }
-
- /**
- * the image name for hierarchy:
- * Property
- * @param field
- * @return
- */
- public static String getImageName(Property field) {
- String str = "Image_PersistentFieldSimple"; //$NON-NLS-1$
- if (field == null) {
- return str;
- }
- final PersistentClass persistentClass = field.getPersistentClass();
- if (persistentClass != null && persistentClass.getVersion() == field) {
- str = "Image_PersistentFieldSimple_version"; //$NON-NLS-1$
- } else if (persistentClass != null && persistentClass.getIdentifierProperty() == field) {
- str = "Image_PersistentFieldSimple_id"; //$NON-NLS-1$
- } else if (field.getValue() != null) {
- final Value value = field.getValue();
- if (value instanceof OneToMany) {
- str = "Image_PersistentFieldOne-to-many"; //$NON-NLS-1$
- } else if (value instanceof OneToOne) {
- str = "Image_PersistentFieldOne-to-one"; //$NON-NLS-1$
- } else if (value instanceof ManyToOne) {
- str = "Image_PersistentFieldMany-to-one"; //$NON-NLS-1$
- } else if (value instanceof Any) {
- str = "Image_PersistentFieldAny"; //$NON-NLS-1$
- } else if (field.getType() != null && field.getType().isCollectionType()) {
- if (value instanceof PrimitiveArray) {
- str = "Image_Collection_primitive_array"; //$NON-NLS-1$
- } else if (value instanceof Array) {
- str = "Image_Collection_array"; //$NON-NLS-1$
- } else if (value instanceof List) {
- str = "Image_Collection_list"; //$NON-NLS-1$
- } else if (value instanceof Set) {
- str = "Image_Collection_set"; //$NON-NLS-1$
- } else if (value instanceof Map) {
- str = "Image_Collection_map"; //$NON-NLS-1$
- } else if (value instanceof Bag) {
- str = "Image_Collection_bag"; //$NON-NLS-1$
- } else if (value instanceof IdentifierBag) {
- str = "Image_Collection_idbag"; //$NON-NLS-1$
- } else {
- str = "Image_Collection"; //$NON-NLS-1$
- }
- }
- } else if ("parent".equals(field.getName())) { //$NON-NLS-1$
- str = "Image_PersistentFieldParent"; //$NON-NLS-1$
- }
- return str;
- }
-
- /**
- * the image name for hierarchy:
- * OneToMany
- * @param field
- * @return
- */
- public static String getImageName(OneToMany field) {
- return "Image_PersistentFieldOne-to-many"; //$NON-NLS-1$
- }
-
- /**
- * the image name for hierarchy:
- * SimpleValue
- * |-- Any
- * |-- Component
- * |-- DependantValue
- * |-- ToOne
- * |-- ManyToOne
- * |-- OneToOne
- * @param field
- * @return
- */
- public static String getImageName(SimpleValue field) {
- String res = "Image_PersistentFieldSimple"; //$NON-NLS-1$
- if (field instanceof Any) {
- res = "Image_PersistentFieldMany-to-any"; //$NON-NLS-1$
- } else if (field instanceof Component) {
- res = "Image_PersistentFieldComponent"; //$NON-NLS-1$
- } else if (field instanceof DependantValue) {
- DependantValue mapping = (DependantValue)field;
- if (mapping.getTable().getIdentifierValue() == mapping) {
- res = "Image_PersistentFieldComponent_id"; //$NON-NLS-1$
- }
- } else if (field instanceof ManyToOne) {
- res = "Image_PersistentFieldMany-to-many"; //$NON-NLS-1$
- }
- return res;
- }
-
- /**
- * the image name for hierarchy:
- * PersistentClass
- * |-- RootClass
- * | |-- SpecialRootClass
- * |
- * |-- Subclass
- * |-- JoinedSubclass
- * |-- SingleTableSubclass
- * |-- UnionSubclass
- * @param persistentClass
- * @return
- */
- public static String getImageName(PersistentClass persistentClass) {
- return "Image_PersistentClass"; //$NON-NLS-1$
- }
-
-}
Deleted: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmLabelMap.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmLabelMap.java 2009-07-02 17:42:29 UTC (rev 16349)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmLabelMap.java 2009-07-02 17:45:17 UTC (rev 16350)
@@ -1,202 +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.views;
-
-import org.hibernate.eclipse.console.workbench.TypeNameValueVisitor;
-import org.hibernate.mapping.Column;
-import org.hibernate.mapping.Component;
-import org.hibernate.mapping.DependantValue;
-import org.hibernate.mapping.OneToMany;
-import org.hibernate.mapping.PersistentClass;
-import org.hibernate.mapping.Property;
-import org.hibernate.mapping.SimpleValue;
-import org.hibernate.mapping.Table;
-import org.hibernate.mapping.Value;
-import org.hibernate.type.Type;
-import org.jboss.tools.hibernate.ui.view.UIViewMessages;
-
-/**
- * Map: ORM object -> label
- */
-public class OrmLabelMap {
-
- static private String SPACE = " "; //$NON-NLS-1$
- static private String POINTER = " -> "; //$NON-NLS-1$
-
- private OrmLabelMap() {}
-
- public static String getLabel(final Object obj) {
- String label = null;
- if (obj instanceof Table) {
- label = getParticularLabel((Table)obj);
- } else if (obj instanceof Column) {
- label = getParticularLabel((Column)obj);
- } else if (obj instanceof Property) {
- label = getParticularLabel((Property)obj);
- } else if (obj instanceof OneToMany) {
- label = getParticularLabel((OneToMany)obj);
- } else if (obj instanceof SimpleValue) {
- label = getParticularLabel((SimpleValue)obj);
- } else if (obj instanceof PersistentClass) {
- label = getParticularLabel((PersistentClass)obj);
- } else if (obj instanceof String) {
- label = (String)obj;
- } else {
- throw unknownElement(obj);
- }
- if (label == null) {
- label = UIViewMessages.OrmLabelProvider_orm_element;
- }
- return label;
- }
-
- public static String getParticularLabel(Table table) {
- return HibernateUtils.getTableName(table);
- }
-
- public static String getParticularLabel(Column column) {
- final String sqlType = column.getSqlType();
- StringBuffer name = new StringBuffer();
- name.append(column.getName());
- if (sqlType != null) {
- name.append(" ["); //$NON-NLS-1$
- name.append(sqlType.toUpperCase());
- name.append(column.isNullable() ? " Nullable" : ""); //$NON-NLS-1$ //$NON-NLS-2$
- name.append(HibernateUtils.getTable(column) != null
- && HibernateUtils.isPrimaryKey(column) ? " PK" : ""); //$NON-NLS-1$ //$NON-NLS-2$
- name.append(HibernateUtils.getTable(column) != null
- && HibernateUtils.isForeignKey(column) ? " FK" : ""); //$NON-NLS-1$ //$NON-NLS-2$
- name.append("]"); //$NON-NLS-1$
- }
- return name.toString();
- }
-
- public static String getParticularLabel(Property field) {
- StringBuffer name = new StringBuffer();
- name.append(field.getName());
- name.append(" :"); //$NON-NLS-1$
- String typeString = null;
- Type type = null;
- try {
- type = field.getType();
- } catch (Exception e) {
- // ignore - this is only way to catch java.lang.reflect.InvocationTargetException
- }
- if (type != null && type.getReturnedClass() != null) {
- typeString = type.getReturnedClass().getName();
- } else {
- if (field.getValue() instanceof Component) {
- typeString = ((Component)field.getValue()).getComponentClassName();
- } else if (field.getValue()!= null && field.getValue().isSimpleValue()) {
- typeString = ((SimpleValue)field.getValue()).getTypeName();
- }
- }
- if (typeString != null) {
- typeString = correctTypeString(typeString);
- name.append(SPACE);
- name.append(typeString);
- return name.toString();
- }
- Value value = field.getValue();
- String typeName = null;
- if (value != null) {
- typeName = (String) value.accept(new TypeNameValueVisitor(false));
- if (typeName != null) {
- return field.getName() + " : " + typeName; //$NON-NLS-1$
- }
- }
- return field.getName();
- }
-
- public static String getParticularLabel(OneToMany field) {
- return UIViewMessages.OrmLabelProvider_element;
- }
-
- /**
- * the label for hierarchy:
- * SimpleValue
- * |-- Any
- * |-- Component
- * |-- DependantValue
- * |-- ToOne
- * |-- ManyToOne
- * |-- OneToOne
- * @param field
- * @return
- */
- public static String getParticularLabel(SimpleValue field) {
- String label = UIViewMessages.OrmLabelProvider_element;
- if (field instanceof DependantValue) {
- label = "key"; //$NON-NLS-1$
- } else if (field instanceof Component) {
- label = "element"; //$NON-NLS-1$
- }
- return label;
- }
-
- /**
- * the label for hierarchy:
- * PersistentClass
- * |-- RootClass
- * | |-- SpecialRootClass
- * |
- * |-- Subclass
- * |-- JoinedSubclass
- * |-- SingleTableSubclass
- * |-- UnionSubclass
- * @param persistentClass
- * @return
- */
- public static String getParticularLabel(PersistentClass persistentClass) {
- StringBuffer name = new StringBuffer();
- name.append(persistentClass.getEntityName() != null ?
- persistentClass.getEntityName() : persistentClass.getClassName());
- Table table = persistentClass.getTable();
- if (table != null) {
- final String tableName = HibernateUtils.getTableName(table);
- if (tableName != null) {
- name.append(POINTER);
- name.append(tableName);
- }
- }
- return name.toString();
- }
-
- private static String correctTypeString(String str) {
- String ret = str;
- while (ret.startsWith("[")) { //$NON-NLS-1$
- ret = ret.substring(1).concat("[]"); //$NON-NLS-1$
- }
- switch (ret.toCharArray()[0]) {
- case 'Z': ret = "boolean".concat(ret.substring(1));break; //$NON-NLS-1$
- case 'B': ret = "byte".concat(ret.substring(1));break; //$NON-NLS-1$
- case 'C': ret = "char".concat(ret.substring(1));break; //$NON-NLS-1$
- case 'L': ret = ret.substring(1);break;
- case 'D': ret = "double".concat(ret.substring(1));break; //$NON-NLS-1$
- case 'F': ret = "float".concat(ret.substring(1));break; //$NON-NLS-1$
- case 'I': ret = "int".concat(ret.substring(1));break; //$NON-NLS-1$
- case 'J': ret = "long".concat(ret.substring(1));break; //$NON-NLS-1$
- case 'S': ret = "short".concat(ret.substring(1));break; //$NON-NLS-1$
- }
- return ret;
- }
-
- private static RuntimeException unknownElement(Object element) {
- String msg = UIViewMessages.OrmLabelProvider_unknown_type_of_element_in_tree_of_type;
- if (element != null && element.getClass() != null ) {
- msg = msg + element.getClass().getName();
- } else {
- msg = msg + element;
- }
- return new RuntimeException(msg);
-
- }
-}
\ No newline at end of file
Deleted: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmLabelProvider.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmLabelProvider.java 2009-07-02 17:42:29 UTC (rev 16349)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.view/src/org/jboss/tools/hibernate/ui/view/views/OrmLabelProvider.java 2009-07-02 17:45:17 UTC (rev 16350)
@@ -1,139 +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.views;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IColorProvider;
-import org.eclipse.jface.viewers.IFontProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.hibernate.cfg.Configuration;
-import org.hibernate.cfg.Environment;
-import org.hibernate.dialect.Dialect;
-import org.hibernate.eclipse.console.HibernateConsolePlugin;
-import org.hibernate.engine.Mapping;
-import org.hibernate.mapping.Column;
-import org.hibernate.mapping.Property;
-import org.hibernate.mapping.RootClass;
-
-public class OrmLabelProvider extends LabelProvider implements IColorProvider, IFontProvider {
-
- private Map<ImageDescriptor, Image> imageCache = new HashMap<ImageDescriptor, Image>(25);
-
- protected Configuration config = null;
- protected Mapping mapping = null;
- protected Dialect dialect = null;
-
- public OrmLabelProvider() {
- }
-
- public OrmLabelProvider(Configuration config) {
- super();
- setConfig(config);
- }
-
- public void setConfig(Configuration config) {
- if (this.config == config) {
- return;
- }
- this.config = config;
- mapping = null;
- dialect = null;
- }
-
- @Override
- public Image getImage(Object element) {
- ImageDescriptor descriptor = OrmImageMap.getImageDescriptor(element);
- if (descriptor == null) {
- return null;
- }
- Image image = imageCache.get(descriptor);
- if (image == null) {
- image = descriptor.createImage();
- imageCache.put(descriptor, image);
- }
- return image;
- }
-
- @Override
- public String getText(Object obj) {
- if (obj instanceof Column) {
- updateColumnSqlType((Column)obj);
- }
- return OrmLabelMap.getLabel(obj);
- }
-
- public void dispose() {
- for (Iterator<Image> i = imageCache.values().iterator(); i.hasNext();) {
- i.next().dispose();
- }
- imageCache.clear();
- }
-
- public Color getForeground(Object element) {
- if (element instanceof RootClass) {
- return Display.getCurrent().getSystemColor(SWT.COLOR_DARK_GREEN);
- } else if (element instanceof Property) {
- return Display.getCurrent().getSystemColor(SWT.COLOR_DARK_BLUE);
- }
- return null;
- }
-
- public Color getBackground(Object element) {
- return null;
- }
-
- public Font getFont(Object element) {
- //return JFaceResources.getFontRegistry().getBold(JFaceResources.getTextFont().getFontData()[0].getName());
- return null;
- }
-
- /**
- * For correct label creation should update column sql type.
- * @param column
- * @return
- */
- public boolean updateColumnSqlType(final Column column) {
- String sqlType = column.getSqlType();
- if (sqlType != null) {
- return false;
- }
- if (mapping == null) {
- mapping = config.buildMapping();
- }
- if (dialect == null) {
- final String dialectName = config.getProperty(Environment.DIALECT);
- if (dialectName != null) {
- try {
- dialect = (Dialect) Class.forName(dialectName).newInstance();
- } catch (InstantiationException e) {
- HibernateConsolePlugin.getDefault().logErrorMessage("Exception: ", e); //$NON-NLS-1$
- } catch (IllegalAccessException e) {
- HibernateConsolePlugin.getDefault().logErrorMessage("Exception: ", e); //$NON-NLS-1$
- } catch (ClassNotFoundException e) {
- HibernateConsolePlugin.getDefault().logErrorMessage("Exception: ", e); //$NON-NLS-1$
- }
- }
- }
- sqlType = column.getSqlType(dialect, mapping);
- column.setSqlType(sqlType);
- return true;
- }
-
-}
\ No newline at end of file
14 years, 9 months
JBoss Tools SVN: r16349 - trunk/hibernatetools/features/org.hibernate.eclipse.feature.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2009-07-02 13:42:29 -0400 (Thu, 02 Jul 2009)
New Revision: 16349
Modified:
trunk/hibernatetools/features/org.hibernate.eclipse.feature/feature.xml
Log:
https://jira.jboss.org/jira/browse/JBIDE-4524 - rename veditor plugin
Modified: trunk/hibernatetools/features/org.hibernate.eclipse.feature/feature.xml
===================================================================
--- trunk/hibernatetools/features/org.hibernate.eclipse.feature/feature.xml 2009-07-02 17:42:05 UTC (rev 16348)
+++ trunk/hibernatetools/features/org.hibernate.eclipse.feature/feature.xml 2009-07-02 17:42:29 UTC (rev 16349)
@@ -492,6 +492,12 @@
unpack="false"/>
<plugin
+ id="org.jboss.tools.hibernate.ui"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"/>
+
+ <plugin
id="org.jboss.tools.hibernate.ui.veditor"
download-size="0"
install-size="0"
14 years, 9 months