Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbblajer2007-05-11 11:39:02 +0000
committerbblajer2007-05-11 11:39:02 +0000
commit4e94c37c46a8f4ec2e856859bde83467258a19f7 (patch)
tree86b5a609c46abfc3ade3b65e70ab945218106886 /plugins/org.eclipse.gmf.runtime.lite/src/org
parenta4b2ca7e3ead07e37652cb1f5db792ee70d9ef05 (diff)
downloadorg.eclipse.gmf-tooling-4e94c37c46a8f4ec2e856859bde83467258a19f7.tar.gz
org.eclipse.gmf-tooling-4e94c37c46a8f4ec2e856859bde83467258a19f7.tar.xz
org.eclipse.gmf-tooling-4e94c37c46a8f4ec2e856859bde83467258a19f7.zip
Labels with undefined label displayer should not be editable;
Empty label text should always be replaced with default text; Closing and reopening outline should not lead to "widget disposed" exceptions; Delete outgoing links before deleting element. Make it easier to set the default text to display in the outline
Diffstat (limited to 'plugins/org.eclipse.gmf.runtime.lite/src/org')
-rw-r--r--plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/edit/parts/labels/ILabelController.java6
-rw-r--r--plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/edit/parts/tree/BaseTreeEditPart.java36
2 files changed, 39 insertions, 3 deletions
diff --git a/plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/edit/parts/labels/ILabelController.java b/plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/edit/parts/labels/ILabelController.java
index 5a9c9945d..71c0d01e1 100644
--- a/plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/edit/parts/labels/ILabelController.java
+++ b/plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/edit/parts/labels/ILabelController.java
@@ -39,10 +39,16 @@ public interface ILabelController {
}
public boolean isAffectingEvent(Notification msg) {
+ if (myController.getLabelTextDisplayer() == null) {
+ return false;
+ }
return myController.getLabelTextDisplayer().isAffectingEvent(msg);
}
public void refresh() {
+ if (myController.getLabelTextDisplayer() == null) {
+ return;
+ }
myController.setLabelText(myController.getLabelTextDisplayer().getDisplayText(mySource));
}
}
diff --git a/plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/edit/parts/tree/BaseTreeEditPart.java b/plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/edit/parts/tree/BaseTreeEditPart.java
index 2db5736db..9a50f355d 100644
--- a/plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/edit/parts/tree/BaseTreeEditPart.java
+++ b/plugins/org.eclipse.gmf.runtime.lite/src/org/eclipse/gmf/runtime/lite/edit/parts/tree/BaseTreeEditPart.java
@@ -27,8 +27,9 @@ import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.emf.transaction.util.TransactionUtil;
import org.eclipse.gef.editparts.AbstractTreeEditPart;
import org.eclipse.gef.tools.CellEditorLocator;
-import org.eclipse.gmf.runtime.lite.edit.parts.labels.ILabelTextDisplayer;
+import org.eclipse.gmf.runtime.lite.edit.parts.labels.AbstractLabelTextDisplayer;
import org.eclipse.gmf.runtime.lite.edit.parts.labels.ILabelController;
+import org.eclipse.gmf.runtime.lite.edit.parts.labels.ILabelTextDisplayer;
import org.eclipse.gmf.runtime.lite.edit.parts.labels.ItemProviderLabelTextDisplayer;
import org.eclipse.gmf.runtime.lite.edit.parts.update.IExternallyUpdatableEditPart;
import org.eclipse.gmf.runtime.lite.edit.parts.update.IUpdatableEditPart;
@@ -103,6 +104,7 @@ public class BaseTreeEditPart extends AbstractTreeEditPart implements IUpdatable
return null;
}
+ @SuppressWarnings("unchecked")
protected List getModelChildren() {
return getNotationView().getVisibleChildren();
}
@@ -128,6 +130,9 @@ public class BaseTreeEditPart extends AbstractTreeEditPart implements IUpdatable
public final ILabelTextDisplayer getLabelTextDisplayer() {
if (myLabelTextDisplayer == null) {
myLabelTextDisplayer = createLabelTextDisplayer();
+ if (myLabelTextDisplayer == null) {
+ myLabelTextDisplayer = new NullLabelTextDisplayer();
+ }
}
return myLabelTextDisplayer;
}
@@ -137,7 +142,17 @@ public class BaseTreeEditPart extends AbstractTreeEditPart implements IUpdatable
}
public void setLabelText(String text) {
- setWidgetText(text == null ? "" : text); //$NON-NLS-1$
+ if (text == null || text.length() == 0) {
+ text = getDefaultLabelText();
+ }
+ setWidgetText(text);
+ }
+
+ /**
+ * @return The text to use if an empty string would be displayed otherwise
+ */
+ protected String getDefaultLabelText() {
+ return ""; //$NON-NLS-1$
}
private Image createImage() {
@@ -174,7 +189,10 @@ public class BaseTreeEditPart extends AbstractTreeEditPart implements IUpdatable
*/
protected String getText() {
String result = getLabelTextDisplayer().getDisplayText(getElement());
- return result == null ? "" : result;
+ if (result == null || result.length() == 0) {
+ return getDefaultLabelText();
+ }
+ return result;
}
private HashMap<EStructuralFeature, Refresher> structuralFeatures2Refresher;
@@ -285,4 +303,16 @@ public class BaseTreeEditPart extends AbstractTreeEditPart implements IUpdatable
}
return editingDomain.isReadOnly(domainResource);
}
+
+ private class NullLabelTextDisplayer extends AbstractLabelTextDisplayer {
+ private NullLabelTextDisplayer() {}
+
+ public String getDisplayText(EObject source) {
+ return getDefaultLabelText();
+ }
+
+ public boolean isAffectingEvent(Notification notification) {
+ return false;
+ }
+ }
}

Back to the top