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;