Bug 425508 - [e4xmi] Live editor layout is broken when ClassURI is used
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java
index cd22416..4c393f7 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java
@@ -147,12 +147,12 @@
}
ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID));
- final Link lnk = new Link(parent, SWT.NONE);
+ final Link lnk;
// ------------------------------------------------------------
{
final IContributionClassCreator c = getEditor().getContributionCreator(ApplicationPackageImpl.Literals.ADDON);
if (project != null && c != null) {
-
+ lnk = new Link(parent, SWT.NONE);
lnk.setText("<A>" + Messages.PartEditor_ClassURI + "</A>"); //$NON-NLS-1$//$NON-NLS-2$
lnk.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
lnk.addSelectionListener(new SelectionAdapter() {
@@ -162,6 +162,7 @@
}
});
} else {
+ lnk = null;
Label l = new Label(parent, SWT.NONE);
l.setText(Messages.AddonsEditor_ClassURI);
l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
@@ -174,7 +175,9 @@
@Override
public void modifyText(ModifyEvent e) {
- lnk.setToolTipText(((Text) (e.getSource())).getText());
+ if (lnk != null) {
+ lnk.setToolTipText(((Text) (e.getSource())).getText());
+ }
}
});
Binding binding = context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(getMaster()), new UpdateValueStrategy().setAfterConvertValidator(new ContributionURIValidator()), new UpdateValueStrategy());
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java
index 34b9291..d8931cc 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java
@@ -116,11 +116,11 @@
IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify);
// ------------------------------------------------------------
- final Link lnk = new Link(parent, SWT.NONE);
+ final Link lnk;
{
final IContributionClassCreator c = getEditor().getContributionCreator(MenuPackageImpl.Literals.DIRECT_MENU_ITEM);
if (project != null && c != null) {
-
+ lnk = new Link(parent, SWT.NONE);
lnk.setText("<A>" + Messages.DirectMenuItemEditor_ClassURI + "</A>"); //$NON-NLS-1$//$NON-NLS-2$
lnk.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
lnk.addSelectionListener(new SelectionAdapter() {
@@ -130,6 +130,7 @@
}
});
} else {
+ lnk = null;
Label l = new Label(parent, SWT.NONE);
l.setText(Messages.DirectMenuItemEditor_ClassURI);
l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
@@ -142,7 +143,9 @@
@Override
public void modifyText(ModifyEvent e) {
- lnk.setToolTipText(((Text) (e.getSource())).getText());
+ if (lnk != null) {
+ lnk.setToolTipText(((Text) (e.getSource())).getText());
+ }
}
});
Binding binding = context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(master), new UpdateValueStrategy().setAfterConvertValidator(new ContributionURIValidator()), new UpdateValueStrategy());
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java
index 48ce163..1344120 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java
@@ -81,9 +81,9 @@
IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify);
final IContributionClassCreator c = getEditor().getContributionCreator(MenuPackageImpl.Literals.DIRECT_TOOL_ITEM);
- final Link lnk = new Link(parent, SWT.NONE);
+ final Link lnk;
if (project != null && c != null) {
-
+ lnk = new Link(parent, SWT.NONE);
lnk.setText("<A>" + Messages.DirectMenuItemEditor_ClassURI + "</A>"); //$NON-NLS-1$//$NON-NLS-2$
lnk.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
lnk.addSelectionListener(new SelectionAdapter() {
@@ -93,6 +93,7 @@
}
});
} else {
+ lnk = null;
Label l = new Label(parent, SWT.NONE);
l.setText(Messages.DirectToolItemEditor_ClassURI);
l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
@@ -105,7 +106,9 @@
@Override
public void modifyText(ModifyEvent e) {
- lnk.setToolTipText(((Text) (e.getSource())).getText());
+ if (lnk != null) {
+ lnk.setToolTipText(((Text) (e.getSource())).getText());
+ }
}
});
Binding binding = context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(master), new UpdateValueStrategy().setAfterConvertValidator(new ContributionURIValidator()), new UpdateValueStrategy());
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DynamicMenuContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DynamicMenuContributionEditor.java
index 4cb2cf5..3d56e40 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DynamicMenuContributionEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DynamicMenuContributionEditor.java
@@ -154,11 +154,11 @@
ControlFactory.createTranslatedTextField(parent, Messages.DynamicMenuContributionEditor_LabelLabel, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL), resourcePool, project);
// ------------------------------------------------------------
- final Link lnk = new Link(parent, SWT.NONE);
+ final Link lnk;
{
final IContributionClassCreator c = getEditor().getContributionCreator(MenuPackageImpl.Literals.DYNAMIC_MENU_CONTRIBUTION);
if (project != null && c != null) {
-
+ lnk = new Link(parent, SWT.NONE);
lnk.setText("<A>" + Messages.DynamicMenuContributionEditor_ClassURI + "</A>"); //$NON-NLS-1$//$NON-NLS-2$
lnk.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
lnk.addSelectionListener(new SelectionAdapter() {
@@ -168,6 +168,7 @@
}
});
} else {
+ lnk = null;
Label l = new Label(parent, SWT.NONE);
l.setText(Messages.DynamicMenuContributionEditor_ClassURI);
l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
@@ -180,7 +181,9 @@
@Override
public void modifyText(ModifyEvent e) {
- lnk.setToolTipText(((Text) (e.getSource())).getText());
+ if (lnk != null) {
+ lnk.setToolTipText(((Text) (e.getSource())).getText());
+ }
}
});
Binding binding = context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(getMaster()), new UpdateValueStrategy().setAfterConvertValidator(new ContributionURIValidator()), new UpdateValueStrategy());
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java
index cd50f0e..97f961a 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandlerEditor.java
@@ -172,11 +172,11 @@
}
// ------------------------------------------------------------
- final Link lnk = new Link(parent, SWT.NONE);
+ final Link lnk;
{
final IContributionClassCreator c = getEditor().getContributionCreator(CommandsPackageImpl.Literals.HANDLER);
if (project != null && c != null) {
-
+ lnk = new Link(parent, SWT.NONE);
lnk.setText("<A>" + Messages.HandlerEditor_ClassURI + "</A>"); //$NON-NLS-1$//$NON-NLS-2$
lnk.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
lnk.addSelectionListener(new SelectionAdapter() {
@@ -186,6 +186,7 @@
}
});
} else {
+ lnk = null;
Label l = new Label(parent, SWT.NONE);
l.setText(Messages.HandlerEditor_ClassURI);
l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
@@ -198,7 +199,9 @@
@Override
public void modifyText(ModifyEvent e) {
- lnk.setToolTipText(((Text) (e.getSource())).getText());
+ if (lnk != null) {
+ lnk.setToolTipText(((Text) (e.getSource())).getText());
+ }
}
});
Binding binding = context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(getMaster()), new UpdateValueStrategy().setAfterConvertValidator(new ContributionURIValidator()), new UpdateValueStrategy());
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java
index 4c58069..e215abf 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java
@@ -220,11 +220,11 @@
}
// ------------------------------------------------------------
- final Link lnk = new Link(parent, SWT.NONE);
+ final Link lnk;
{
final IContributionClassCreator c = getEditor().getContributionCreator(BasicPackageImpl.Literals.PART);
if (project != null && c != null) {
-
+ lnk = new Link(parent, SWT.NONE);
lnk.setText("<A>" + Messages.PartEditor_ClassURI + "</A>"); //$NON-NLS-1$//$NON-NLS-2$
lnk.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
lnk.addSelectionListener(new SelectionAdapter() {
@@ -236,7 +236,7 @@
} else {
// Dispose the lnk widget, which is unused in this else branch
// and screws up the layout: see https://bugs.eclipse.org/421369
- lnk.dispose();
+ lnk = null;
Label l = new Label(parent, SWT.NONE);
l.setText(Messages.PartEditor_ClassURI);
@@ -251,7 +251,7 @@
@Override
public void modifyText(ModifyEvent e) {
// lnk might be disposed if else branch above taken
- if (!lnk.isDisposed()) {
+ if (lnk != null) {
lnk.setToolTipText(((Text) (e.getSource())).getText());
}
}