Author: tfmorris
Date: 2007-11-24 13:10:19-0800
New Revision: 13835
Modified:
trunk/src_new/org/argouml/uml/diagram/ui/ArgoFigText.java
trunk/src_new/org/argouml/uml/diagram/ui/FigAssociation.java
trunk/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java
Log:
Make more conservative so it works with ArgoEclipse
Modified: trunk/src_new/org/argouml/uml/diagram/ui/ArgoFigText.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/ui/ArgoFigText.java?view=diff&rev=13835&p1=trunk/src_new/org/argouml/uml/diagram/ui/ArgoFigText.java&p2=trunk/src_new/org/argouml/uml/diagram/ui/ArgoFigText.java&r1=13834&r2=13835
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/ui/ArgoFigText.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/ui/ArgoFigText.java 2007-11-24 13:10:19-0800
@@ -44,6 +44,7 @@
import org.tigris.gef.base.Globals;
import org.tigris.gef.base.Layer;
import org.tigris.gef.base.LayerPerspective;
+import org.tigris.gef.graph.GraphModel;
import org.tigris.gef.presentation.FigText;
/**
@@ -143,9 +144,12 @@
if (layer == null) {
return null;
}
- UMLMutableGraphSupport gm =
- (UMLMutableGraphSupport) layer.getGraphModel();
- return gm.getProject();
+ GraphModel gm = layer.getGraphModel();
+ if (gm instanceof UMLMutableGraphSupport) {
+ return ((UMLMutableGraphSupport) gm).getProject();
+ } else {
+ return ProjectManager.getManager().getCurrentProject();
+ }
}
/**
Modified: trunk/src_new/org/argouml/uml/diagram/ui/FigAssociation.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/ui/FigAssociation.java?view=diff&rev=13835&p1=trunk/src_new/org/argouml/uml/diagram/ui/FigAssociation.java&p2=trunk/src_new/org/argouml/uml/diagram/ui/FigAssociation.java&r1=13834&r2=13835
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/ui/FigAssociation.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/ui/FigAssociation.java 2007-11-24 13:10:19-0800
@@ -41,6 +41,7 @@
import org.argouml.application.events.ArgoNotationEvent;
import org.argouml.application.events.ArgoNotationEventListener;
import org.argouml.i18n.Translator;
+import org.argouml.kernel.Project;
import org.argouml.kernel.ProjectManager;
import org.argouml.model.AddAssociationEvent;
import org.argouml.model.AttributeChangeEvent;
@@ -49,6 +50,7 @@
import org.argouml.notation.NotationProviderFactory2;
import org.argouml.ui.ArgoJMenu;
import org.argouml.ui.targetmanager.TargetManager;
+import org.argouml.uml.diagram.ArgoDiagram;
import org.tigris.gef.base.Layer;
import org.tigris.gef.base.PathConvPercentPlusConst;
import org.tigris.gef.presentation.ArrowHead;
@@ -132,8 +134,17 @@
setBetweenNearestPoints(true);
// next line necessary for loading
- setLayer(ProjectManager.getManager().getCurrentProject()
- .getActiveDiagram().getLayer());
+ Project p = ProjectManager.getManager().getCurrentProject();
+ if (p != null) {
+ ArgoDiagram d = p.getActiveDiagram();
+ if (d != null) {
+ Layer l = d.getLayer();
+ if (l!= null) {
+ setLayer(l);
+ }
+ }
+ }
+
}
/**
Modified: trunk/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java?view=diff&rev=13835&p1=trunk/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java&p2=trunk/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java&r1=13834&r2=13835
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java 2007-11-24 13:10:19-0800
@@ -96,6 +96,7 @@
import org.tigris.gef.base.Layer;
import org.tigris.gef.base.LayerPerspective;
import org.tigris.gef.base.Selection;
+import org.tigris.gef.graph.GraphModel;
import org.tigris.gef.graph.MutableGraphSupport;
import org.tigris.gef.presentation.Fig;
import org.tigris.gef.presentation.FigGroup;
@@ -244,7 +245,7 @@
* <code>SmallIcon</code> mode.
*/
private List<Fig> floatingStereotypes = new ArrayList<Fig>();
-
+
/**
* The current stereotype view
*
@@ -270,7 +271,7 @@
* @see FigProfileIcon
*/
private FigText originalNameFig;
-
+
/**
* EnclosedFigs are the Figs that are enclosed by this figure. Say that
* it is a Package then these are the Classes, Interfaces, Packages etc
@@ -1362,7 +1363,7 @@
Project p = getProject();
if (p != null) {
updateFont();
- }
+ }
updateBounds();
}
}
@@ -1559,8 +1560,8 @@
this.removeFig(stereotypeFigProfileIcon);
stereotypeFigProfileIcon = null;
- }
-
+ }
+
if (originalNameFig != null) {
this.setNameFig(originalNameFig);
originalNameFig = null;
@@ -1569,7 +1570,7 @@
for (Fig icon : floatingStereotypes) {
this.removeFig(icon);
}
- floatingStereotypes.clear();
+ floatingStereotypes.clear();
int practicalView = getPracticalView();
@@ -2018,7 +2019,7 @@
* @see org.argouml.uml.diagram.ui.ArgoFig#getProject()
*/
public Project getProject() {
- LayerPerspective layer = (LayerPerspective) getLayer();
+ LayerPerspective layer = (LayerPerspective) getLayer();
if (layer == null) {
/* TODO: Without this, we fail to draw e.g. a Class.
* But is this a good solution?
@@ -2039,9 +2040,13 @@
if (layer == null) {
return null;
}
- UMLMutableGraphSupport gm =
- (UMLMutableGraphSupport) layer.getGraphModel();
- return gm.getProject();
+
+ GraphModel gm = layer.getGraphModel();
+ if (gm instanceof UMLMutableGraphSupport) {
+ return ((UMLMutableGraphSupport) gm).getProject();
+ } else {
+ return ProjectManager.getManager().getCurrentProject();
+ }
}
/**
@@ -2166,16 +2171,16 @@
// calcBounds(); // Don't do this! Causes e.g. FigActor to not center properly.
updateBounds();
damage();
- }
+}
- /**
+/**
* This function should, for all FigTexts,
* recalculate the font-style (plain, bold, italic, bold/italic),
* and apply it by calling FigText.setFont(). <p>
- *
+ *
* If the "deepUpdateFont" function does not
* work for a subclass, then override this method.
- */
+ */
protected void updateFont() {
int style = getNameFigFontStyle();
Font f = getProject().getProjectSettings().getFont(style);
@@ -2201,9 +2206,9 @@
*/
if (p != null) {
ProjectSettings ps = p.getProjectSettings();
- showBoldName = ps.getShowBoldNamesValue();
+ showBoldName = ps.getShowBoldNamesValue();
}
-
+
return showBoldName ? Font.BOLD : Font.PLAIN;
}
@@ -2231,4 +2236,5 @@
}
}
}
-}
+ }
+
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.