Author: vyemialyanchyk
Date: 2009-08-10 11:24:19 -0400 (Mon, 10 Aug 2009)
New Revision: 17036
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/AutoLayoutAction.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ExportImageAction.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/OpenMappingAction.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/OpenSourceAction.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ToggleConnectionsAction.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ToggleShapeExpandStateAction.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ToggleShapeVisibleStateAction.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/ElementsFactory.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmDiagram.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/Shape.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/Utils.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ComponentShapeEditPart.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ExpandableShapeEditPart.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ExpandableShapeTreeEditPart.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/OrmShapeEditPart.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ShapeEditPart.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ShapeTreeEditPart.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/MappingTestsBase.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4148 - junit tests fix
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/AutoLayoutAction.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/AutoLayoutAction.java 2009-08-10
11:24:11 UTC (rev 17035)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/AutoLayoutAction.java 2009-08-10
15:24:19 UTC (rev 17036)
@@ -20,14 +20,15 @@
public class AutoLayoutAction extends DiagramBaseAction {
public static final String ACTION_ID = "auto_layout_id"; //$NON-NLS-1$
+ private static final ImageDescriptor img =
+ ImageDescriptor.createFromFile(DiagramViewer.class, "icons/autolayout.png");
//$NON-NLS-1$
public AutoLayoutAction(DiagramViewer editor) {
super(editor);
setId(ACTION_ID);
setText(DiagramViewerMessages.AutoLayoutAction_auto_layout);
setToolTipText(DiagramViewerMessages.AutoLayoutAction_auto_layout);
- setImageDescriptor(ImageDescriptor.createFromFile(
- DiagramViewer.class, "icons/autolayout.png")); //$NON-NLS-1$
+ setImageDescriptor(img);
}
public void run() {
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ExportImageAction.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ExportImageAction.java 2009-08-10
11:24:11 UTC (rev 17035)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ExportImageAction.java 2009-08-10
15:24:19 UTC (rev 17036)
@@ -40,13 +40,14 @@
DiagramViewerMessages.ExportImageAction_jpg_format,
DiagramViewerMessages.ExportImageAction_bmp_format };
private FileDialog saveDialog = null;
+ private static final ImageDescriptor img =
+ ImageDescriptor.createFromFile(DiagramViewer.class, "icons/export.png");
//$NON-NLS-1$
public ExportImageAction(DiagramViewer editor) {
super(editor);
setId(ACTION_ID);
setText(DiagramViewerMessages.ExportImageAction_export_as_image);
- setImageDescriptor(ImageDescriptor.createFromFile(
- DiagramViewer.class,"icons/export.png")); //$NON-NLS-1$
+ setImageDescriptor(img);
}
/**
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/OpenMappingAction.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/OpenMappingAction.java 2009-08-10
11:24:11 UTC (rev 17035)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/OpenMappingAction.java 2009-08-10
15:24:19 UTC (rev 17036)
@@ -16,6 +16,7 @@
import org.eclipse.gef.ui.actions.SelectionAction;
import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PartInitException;
@@ -36,12 +37,14 @@
*/
public class OpenMappingAction extends SelectionAction {
public static final String ACTION_ID =
"org.jboss.tools.hibernate.ui.diagram.editors.actions.open.mapping";
//$NON-NLS-1$
+ private static final ImageDescriptor img =
+ UiPlugin.getImageDescriptor("icons/mapping.gif"); //$NON-NLS-1$
public OpenMappingAction(IWorkbenchPart part) {
super(part);
setId(ACTION_ID);
setText(DiagramViewerMessages.OpenMappingAction_open_mapping_file);
- setImageDescriptor(UiPlugin.getImageDescriptor("icons/mapping.gif"));
//$NON-NLS-1$
+ setImageDescriptor(img);
}
public void run() {
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/OpenSourceAction.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/OpenSourceAction.java 2009-08-10
11:24:11 UTC (rev 17035)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/OpenSourceAction.java 2009-08-10
15:24:19 UTC (rev 17036)
@@ -6,6 +6,7 @@
import org.eclipse.gef.ui.actions.SelectionAction;
import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PartInitException;
@@ -28,12 +29,14 @@
*/
public class OpenSourceAction extends SelectionAction {
public static final String ACTION_ID =
"org.jboss.tools.hibernate.ui.diagram.editors.actions.open.source";
//$NON-NLS-1$
+ private static final ImageDescriptor img =
+ UiPlugin.getImageDescriptor("icons/java.gif"); //$NON-NLS-1$
public OpenSourceAction(IWorkbenchPart part) {
super(part);
setId(ACTION_ID);
setText(DiagramViewerMessages.OpenSourceAction_open_source_file);
- setImageDescriptor(UiPlugin.getImageDescriptor("icons/java.gif"));
//$NON-NLS-1$
+ setImageDescriptor(img);
}
public void run() {
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ToggleConnectionsAction.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ToggleConnectionsAction.java 2009-08-10
11:24:11 UTC (rev 17035)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ToggleConnectionsAction.java 2009-08-10
15:24:19 UTC (rev 17036)
@@ -20,14 +20,15 @@
public class ToggleConnectionsAction extends DiagramBaseAction {
public static final String ACTION_ID = "toggleConnectionsId"; //$NON-NLS-1$
+ private static final ImageDescriptor img =
+ ImageDescriptor.createFromFile(DiagramViewer.class,
"icons/toggleconnections.png"); //$NON-NLS-1$
public ToggleConnectionsAction(DiagramViewer editor) {
super(editor);
setId(ACTION_ID);
setText(DiagramViewerMessages.ToggleConnectionsAction_toggle_connections);
setToolTipText(DiagramViewerMessages.ToggleConnectionsAction_toggle_connections);
- setImageDescriptor(ImageDescriptor.createFromFile(
- DiagramViewer.class, "icons/toggleconnections.png")); //$NON-NLS-1$
+ setImageDescriptor(img);
}
public void run() {
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ToggleShapeExpandStateAction.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ToggleShapeExpandStateAction.java 2009-08-10
11:24:11 UTC (rev 17035)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ToggleShapeExpandStateAction.java 2009-08-10
15:24:19 UTC (rev 17036)
@@ -32,14 +32,15 @@
public class ToggleShapeExpandStateAction extends DiagramBaseAction {
public static final String ACTION_ID = "toggleShapeExpandStateId";
//$NON-NLS-1$
+ private static final ImageDescriptor img =
+ ImageDescriptor.createFromFile(DiagramViewer.class,
"icons/toggleshapeexpandstate.png"); //$NON-NLS-1$
public ToggleShapeExpandStateAction(DiagramViewer editor) {
super(editor);
setId(ACTION_ID);
setText(DiagramViewerMessages.ToggleShapeExpandStateAction_toggle_expand_state);
setToolTipText(DiagramViewerMessages.ToggleShapeExpandStateAction_toggle_expand_state);
- setImageDescriptor(ImageDescriptor.createFromFile(
- DiagramViewer.class, "icons/toggleshapeexpandstate.png")); //$NON-NLS-1$
+ setImageDescriptor(img);
}
@SuppressWarnings("unchecked")
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ToggleShapeVisibleStateAction.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ToggleShapeVisibleStateAction.java 2009-08-10
11:24:11 UTC (rev 17035)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/actions/ToggleShapeVisibleStateAction.java 2009-08-10
15:24:19 UTC (rev 17036)
@@ -34,14 +34,15 @@
public class ToggleShapeVisibleStateAction extends DiagramBaseAction {
public static final String ACTION_ID = "toggleShapeVisibleStateId";
//$NON-NLS-1$
+ private static final ImageDescriptor img =
+ ImageDescriptor.createFromFile(DiagramViewer.class,
"icons/toggleshapevisiblestate.png"); //$NON-NLS-1$
public ToggleShapeVisibleStateAction(DiagramViewer editor) {
super(editor);
setId(ACTION_ID);
setText(DiagramViewerMessages.ToggleShapeVisibleStateAction_toggle_visible_state);
setToolTipText(DiagramViewerMessages.ToggleShapeVisibleStateAction_toggle_visible_state);
- setImageDescriptor(ImageDescriptor.createFromFile(
- DiagramViewer.class, "icons/toggleshapevisiblestate.png")); //$NON-NLS-1$
+ setImageDescriptor(img);
}
@SuppressWarnings("unchecked")
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/ElementsFactory.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/ElementsFactory.java 2009-08-10
11:24:11 UTC (rev 17035)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/ElementsFactory.java 2009-08-10
15:24:19 UTC (rev 17036)
@@ -407,7 +407,19 @@
if (processed.contains(shapeCol)) {
continue;
}
- if (dbColumn.getName().equals(((Column)(shapeCol).getOrmElement()).getName())) {
+ if (shape.equals(shapeCol)) {
+ continue;
+ }
+ Object ormElement = shapeCol.getOrmElement();
+ String name2 = ""; //$NON-NLS-1$
+ if (ormElement instanceof Column) {
+ Column dbColumn2 = (Column)ormElement;
+ name2 = dbColumn2.getName();
+ } else if (ormElement instanceof Property) {
+ Property property2 = (Property)ormElement;
+ name2 = property2.getName();
+ }
+ if (dbColumn.getName().equals(name2)) {
if (!isConnectionExist(shape, shapeCol)) {
connections.add(new Connection(shape, shapeCol));
}
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmDiagram.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmDiagram.java 2009-08-10
11:24:11 UTC (rev 17035)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/OrmDiagram.java 2009-08-10
15:24:19 UTC (rev 17036)
@@ -38,6 +38,7 @@
import org.hibernate.mapping.RootClass;
import org.jboss.tools.hibernate.ui.diagram.UiPlugin;
import org.jboss.tools.hibernate.ui.diagram.rulers.DiagramRuler;
+import org.jboss.tools.hibernate.ui.view.OrmLabelProvider;
/**
* The whole diagram, all information about diagram elements are here.
@@ -53,6 +54,7 @@
// hibernate console configuration is the source of diagram elements
private ConsoleConfiguration consoleConfig;
+ private OrmLabelProvider labelProvider = new OrmLabelProvider();
private boolean dirty = false;
private HashMap<String, OrmShape> elements = new HashMap<String,
OrmShape>();
@@ -74,6 +76,7 @@
public OrmDiagram(ConsoleConfiguration consoleConfig, RootClass ioe) {
createRulers();
this.consoleConfig = consoleConfig;
+ labelProvider.setConfig(consoleConfig.getConfiguration());
ormElements = new RootClass[1];
ormElements[0] = ioe;
entityNames = new String[1];
@@ -88,6 +91,7 @@
public OrmDiagram(ConsoleConfiguration consoleConfig, RootClass[] ioe) {
createRulers();
this.consoleConfig = consoleConfig;
+ labelProvider.setConfig(consoleConfig.getConfiguration());
ormElements = new RootClass[ioe.length];
System.arraycopy(ioe, 0, ormElements, 0, ioe.length);
// should sort elements - cause different sort order gives different file name
@@ -476,4 +480,8 @@
public String getKey() {
return null;
}
+
+ public OrmLabelProvider getLabelProvider() {
+ return labelProvider;
+ }
}
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/Shape.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/Shape.java 2009-08-10
11:24:11 UTC (rev 17035)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/Shape.java 2009-08-10
15:24:19 UTC (rev 17036)
@@ -21,7 +21,6 @@
import org.hibernate.mapping.Property;
import org.hibernate.mapping.Value;
import org.jboss.tools.hibernate.ui.view.HibernateUtils;
-import org.jboss.tools.hibernate.ui.view.OrmLabelProvider;
/**
* Shape which represents particular Hibernate element on the diagram.
@@ -50,7 +49,6 @@
*/
private BaseElement parent;
- private static OrmLabelProvider labelProvider = new OrmLabelProvider();
private static IPropertyDescriptor[] descriptors_property;
private static IPropertyDescriptor[] descriptors_column;
@@ -252,8 +250,7 @@
} else if (col != null) {
String sqlType = col.getSqlType();
if (sqlType == null) {
- labelProvider.setConfig(getOrmDiagram().getConsoleConfig().getConfiguration());
- labelProvider.updateColumnSqlType(col);
+ getOrmDiagram().getLabelProvider().updateColumnSqlType(col);
sqlType = col.getSqlType();
}
StringBuffer name = new StringBuffer();
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/Utils.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/Utils.java 2009-08-10
11:24:11 UTC (rev 17035)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/Utils.java 2009-08-10
15:24:19 UTC (rev 17036)
@@ -26,11 +26,15 @@
public static boolean isConnectionExist(Shape source, Shape target) {
boolean res = false;
if (source != null && target != null) {
- List<Connection> sourceConnections = source.getSourceConnections();
- for (int i = 0; !res && i < sourceConnections.size(); i++) {
- Connection conn = sourceConnections.get(i);
- if (conn.getTarget().equals(target)) {
- res = true;
+ if (source.equals(target)) {
+ res = true;
+ } else {
+ List<Connection> sourceConnections = source.getSourceConnections();
+ for (int i = 0; !res && i < sourceConnections.size(); i++) {
+ Connection conn = sourceConnections.get(i);
+ if (conn.getTarget().equals(target)) {
+ res = true;
+ }
}
}
}
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ComponentShapeEditPart.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ComponentShapeEditPart.java 2009-08-10
11:24:11 UTC (rev 17035)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ComponentShapeEditPart.java 2009-08-10
15:24:19 UTC (rev 17036)
@@ -43,8 +43,8 @@
@Override
protected IFigure createFigure() {
ComponentFigure figure = new ComponentFigure();
- figure.createTitle(ormLabelProvider.getText(getElement()),
- ormLabelProvider.getImage(getElement()), getColor());
+ figure.createTitle(getOrmDiagram().getLabelProvider().getText(getElement()),
+ getOrmDiagram().getLabelProvider().getImage(getElement()), getColor());
figure.setBorder(new FocusBorder());
figure.setSize(-1, -1);
return figure;
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ExpandableShapeEditPart.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ExpandableShapeEditPart.java 2009-08-10
11:24:11 UTC (rev 17035)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ExpandableShapeEditPart.java 2009-08-10
15:24:19 UTC (rev 17036)
@@ -47,9 +47,9 @@
@Override
protected IFigure createFigure() {
Label label = new TitleLabel();
- label.setText(ormLabelProvider.getText(getElement()));
+ label.setText(getOrmDiagram().getLabelProvider().getText(getElement()));
label.setBackgroundColor(getColor());
- label.setIcon(ormLabelProvider.getImage(getElement()));
+ label.setIcon(getOrmDiagram().getLabelProvider().getImage(getElement()));
label.setLabelAlignment(PositionConstants.LEFT);
label.setOpaque(true);
TopLineBorder border =
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ExpandableShapeTreeEditPart.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ExpandableShapeTreeEditPart.java 2009-08-10
11:24:11 UTC (rev 17035)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ExpandableShapeTreeEditPart.java 2009-08-10
15:24:19 UTC (rev 17036)
@@ -17,10 +17,8 @@
import java.util.List;
import org.eclipse.swt.widgets.Tree;
-import org.hibernate.console.ConsoleConfiguration;
import org.jboss.tools.hibernate.ui.diagram.editors.model.ExpandableShape;
import org.jboss.tools.hibernate.ui.diagram.editors.model.Shape;
-import org.jboss.tools.hibernate.ui.view.OrmLabelProvider;
/**
* @author some modifications from Vitali
@@ -29,8 +27,6 @@
org.eclipse.gef.editparts.AbstractTreeEditPart implements
PropertyChangeListener {
- protected OrmLabelProvider ormLabelProvider;
-
/**
* Constructor initializes this with the given model.
*
@@ -39,8 +35,6 @@
*/
public ExpandableShapeTreeEditPart(ExpandableShape model) {
super(model);
- ConsoleConfiguration cfg = model.getOrmDiagram().getConsoleConfig();
- ormLabelProvider = new OrmLabelProvider(cfg.getConfiguration());
}
/**
@@ -79,8 +73,8 @@
}
Shape model = (Shape) getModel();
Object element = model.getOrmElement();
- setWidgetImage(ormLabelProvider.getImage(element));
- setWidgetText(ormLabelProvider.getText(element));
+ setWidgetImage(getExpandeableShape().getOrmDiagram().getLabelProvider().getImage(element));
+ setWidgetText(getExpandeableShape().getOrmDiagram().getLabelProvider().getText(element));
}
}
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/OrmShapeEditPart.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/OrmShapeEditPart.java 2009-08-10
11:24:11 UTC (rev 17035)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/OrmShapeEditPart.java 2009-08-10
15:24:19 UTC (rev 17036)
@@ -63,8 +63,8 @@
Object element = getElement();
TitleFigure figure = new TitleFigure();
figure.setLayoutManager(new ToolbarLayout());
- String text = ormLabelProvider.getText(element);
- figure.createTitle(text, ormLabelProvider.getImage(element), getColor());
+ String text = getOrmDiagram().getLabelProvider().getText(element);
+ figure.createTitle(text, getOrmDiagram().getLabelProvider().getImage(element),
getColor());
figure.setBackgroundColor(getBackgroundColor());
return figure;
}
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ShapeEditPart.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ShapeEditPart.java 2009-08-10
11:24:11 UTC (rev 17035)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ShapeEditPart.java 2009-08-10
15:24:19 UTC (rev 17036)
@@ -31,7 +31,6 @@
import org.eclipse.gef.editpolicies.SelectionEditPolicy;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.RGB;
-import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.mapping.Column;
import org.hibernate.mapping.Component;
import org.hibernate.mapping.DependantValue;
@@ -45,23 +44,17 @@
import org.jboss.tools.hibernate.ui.diagram.editors.model.Connection;
import org.jboss.tools.hibernate.ui.diagram.editors.model.BaseElement;
import org.jboss.tools.hibernate.ui.diagram.editors.model.Shape;
-import org.jboss.tools.hibernate.ui.view.OrmLabelProvider;
/**
* @author some modifications from Vitali
*/
public class ShapeEditPart extends OrmEditPart implements NodeEditPart {
- protected OrmLabelProvider ormLabelProvider = new OrmLabelProvider();
protected ChopboxAnchorNearestSide sourceAnchor = null;
protected ChopboxAnchorNearestSide targetAnchor = null;
public void setModel(Object model) {
super.setModel(model);
- if (getOrmDiagram() != null) {
- ConsoleConfiguration consoleConfig = getOrmDiagram().getConsoleConfig();
- ormLabelProvider.setConfig(consoleConfig.getConfiguration());
- }
}
protected void createEditPolicies() {
@@ -74,9 +67,9 @@
@Override
protected IFigure createFigure() {
Label label = new Label();
- label.setText(ormLabelProvider.getText(getElement()));
+ label.setText(getOrmDiagram().getLabelProvider().getText(getElement()));
label.setBackgroundColor(getColor());
- label.setIcon(ormLabelProvider.getImage(getElement()));
+ label.setIcon(getOrmDiagram().getLabelProvider().getImage(getElement()));
label.setLabelAlignment(PositionConstants.LEFT);
label.setOpaque(true);
TopLineBorder border = new TopLineBorder(1, 2 + getModelShape().getIndent(), 1, 2);
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ShapeTreeEditPart.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ShapeTreeEditPart.java 2009-08-10
11:24:11 UTC (rev 17035)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/parts/ShapeTreeEditPart.java 2009-08-10
15:24:19 UTC (rev 17036)
@@ -16,10 +16,7 @@
import java.util.List;
import org.eclipse.swt.widgets.Tree;
-import org.hibernate.console.ConsoleConfiguration;
-import org.jboss.tools.hibernate.ui.diagram.editors.model.ExpandableShape;
import org.jboss.tools.hibernate.ui.diagram.editors.model.Shape;
-import org.jboss.tools.hibernate.ui.view.OrmLabelProvider;
/**
* @author some modifications from Vitali
@@ -28,8 +25,6 @@
org.eclipse.gef.editparts.AbstractTreeEditPart implements
PropertyChangeListener {
- protected OrmLabelProvider ormLabelProvider;
-
/**
* Constructor initializes this with the given model.
*
@@ -38,8 +33,6 @@
*/
public ShapeTreeEditPart(Shape model) {
super(model);
- ConsoleConfiguration cfg = model.getOrmDiagram().getConsoleConfig();
- ormLabelProvider = new OrmLabelProvider(cfg.getConfiguration());
}
/**
@@ -47,8 +40,8 @@
*
* @return Model of this.
*/
- protected ExpandableShape getExpandeableShape() {
- return (ExpandableShape) getModel();
+ protected Shape getShape() {
+ return (Shape) getModel();
}
/**
@@ -73,8 +66,8 @@
}
Shape model = (Shape) getModel();
Object element = model.getOrmElement();
- setWidgetImage(ormLabelProvider.getImage(element));
- setWidgetText(ormLabelProvider.getText(element));
+ setWidgetImage(getShape().getOrmDiagram().getLabelProvider().getImage(element));
+ setWidgetText(getShape().getOrmDiagram().getLabelProvider().getText(element));
}
}
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/MappingTestsBase.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/MappingTestsBase.java 2009-08-10
11:24:11 UTC (rev 17035)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/mappingproject/MappingTestsBase.java 2009-08-10
15:24:19 UTC (rev 17036)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.hibernate.eclipse.console.test.mappingproject;
import java.io.IOException;
@@ -24,6 +34,10 @@
import junit.framework.TestResult;
import junit.framework.TestSuite;
+/**
+ * @author Vitali Yemialyanchyk
+ *
+ */
@SuppressWarnings("restriction")
public abstract class MappingTestsBase extends TestCase {