Author: dazarov
Date: 2007-07-13 10:32:14 -0400 (Fri, 13 Jul 2007)
New Revision: 2430
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/ComponentShape.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/ExpandeableShape.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ExpandeableShapeEditPart.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ShapeEditPart.java
Log:
http://jira.jboss.com/jira/browse/EXIN-365
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/ComponentShape.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/ComponentShape.java 2007-07-13
14:31:55 UTC (rev 2429)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/ComponentShape.java 2007-07-13
14:32:14 UTC (rev 2430)
@@ -18,15 +18,7 @@
protected boolean childsHiden = true;
- private OrmShape reference=null;
- public void setReference(OrmShape reference){
- this.reference = reference;
- }
-
- public OrmShape getReference(){
- return reference;
- }
public ComponentShape(Object ioe) {
super(ioe);
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/ExpandeableShape.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/ExpandeableShape.java 2007-07-13
14:31:55 UTC (rev 2429)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/ExpandeableShape.java 2007-07-13
14:32:14 UTC (rev 2430)
@@ -23,7 +23,16 @@
public static final String SHOW_REFERENCES = "show references";
private boolean refHide = false;
-
+
+ private OrmShape reference=null;
+
+ public void setReference(OrmShape reference){
+ this.reference = reference;
+ }
+
+ public OrmShape getReference(){
+ return reference;
+ }
public ExpandeableShape(Object ioe) {
super(ioe);
}
@@ -31,7 +40,10 @@
public void refreshReferences(Object model) {
refHide = !refHide;
if (model instanceof OrmDiagram) {
- ((OrmDiagram)model).processExpand(this);
+ if(refHide)
+ ((OrmDiagram)model).processExpand(this);
+ else
+ ((OrmDiagram)model).processCollapse(this);
}
firePropertyChange(SHOW_REFERENCES, null, new Boolean(refHide));
}
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ExpandeableShapeEditPart.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ExpandeableShapeEditPart.java 2007-07-13
14:31:55 UTC (rev 2429)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ExpandeableShapeEditPart.java 2007-07-13
14:32:14 UTC (rev 2430)
@@ -14,15 +14,34 @@
import java.util.List;
import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.PositionConstants;
import org.eclipse.gef.Request;
import org.eclipse.gef.RequestConstants;
import org.eclipse.swt.graphics.RGB;
+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.ExpandeableShape;
import org.jboss.tools.hibernate.ui.veditor.editors.model.Shape;
public class ExpandeableShapeEditPart extends ShapeEditPart {
-
+ protected IFigure createFigure() {
+ if (getModel() instanceof Shape) {
+ Label label = new TitleLabel();
+ label.setText(ormLabelProvider.getText(getElement()));
+ label.setBackgroundColor(getColor());
+ label.setIcon(ormLabelProvider.getImage(getElement()));
+ label.setLabelAlignment(PositionConstants.LEFT);
+ label.setOpaque(true);
+ TopLineBorder border = new TopLineBorder(1,2+getCastedModel().getIndent(),1,2);
+ border.setColor(getOrmShapeEditPart().getColor());
+ label.setBorder(border);
+ return label;
+ } else {
+ throw new IllegalArgumentException();
+ }
+ }
public void performRequest(Request req) {
if(RequestConstants.REQ_OPEN.equals(req.getType())) {
((ExpandeableShape)getModel()).refreshReferences(getViewer().getContents().getModel());
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ShapeEditPart.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ShapeEditPart.java 2007-07-13
14:31:55 UTC (rev 2429)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ShapeEditPart.java 2007-07-13
14:32:14 UTC (rev 2430)
@@ -172,7 +172,7 @@
return anchor;
}
- private OrmShapeEditPart getOrmShapeEditPart() {
+ protected OrmShapeEditPart getOrmShapeEditPart() {
int i = 0;
EditPart part = this;
while (!((part instanceof OrmShapeEditPart))) {
@@ -268,7 +268,7 @@
}
- private Object getElement() {
+ protected Object getElement() {
Object element = getCastedModel().getOrmElement();
if (element instanceof SpecialRootClass) element = (RootClass)element;
return element;