Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/EditingContextAdapter.java22
-rw-r--r--plugins/org.eclipse.eef.ide.ui.ext.widgets.reference/src/org/eclipse/eef/ide/ui/ext/widgets/reference/internal/EEFExtMultipleReferenceLifecycleManager.java44
-rw-r--r--plugins/org.eclipse.eef.ide.ui.ext.widgets.reference/src/org/eclipse/eef/ide/ui/ext/widgets/reference/internal/EEFExtSingleReferenceLifecycleManager.java39
-rw-r--r--plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFTextLifecycleManager.java18
4 files changed, 23 insertions, 100 deletions
diff --git a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/EditingContextAdapter.java b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/EditingContextAdapter.java
index a7178f609..5c0b7ab2e 100644
--- a/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/EditingContextAdapter.java
+++ b/plugins/org.eclipse.eef.core/src/org/eclipse/eef/core/api/EditingContextAdapter.java
@@ -87,26 +87,4 @@ public interface EditingContextAdapter {
* @return the current lock status of the element.
*/
LockStatus getLockStatus(EObject obj);
-
- /**
- * Attempts to take an exclusive lock on the specified elements. Callers should not assume the elements are actually
- * locked until they receive the corresponding {@link LockStatusChangeEvent} notification through the
- * {@link #onLockStatusChanged(IConsumer)} callback. There is no guarantee such a notification will be sent, if for
- * example an element was already locked by some other context.
- *
- * @param elements
- * the elements to lock.
- */
- void lock(Collection<EObject> elements);
-
- /**
- * Attempts to release the locks on the specified elements. Callers should not assume the elements are actually
- * locked until they receive the corresponding {@link LockStatusChangeEvent} notification through the
- * {@link #onLockStatusChanged(IConsumer)} callback. There is no guarantee such a notification will be sent, if for
- * example this editing context did not have a lock on a given element.
- *
- * @param elements
- * the elements to unlock.
- */
- void unlock(Collection<EObject> elements);
}
diff --git a/plugins/org.eclipse.eef.ide.ui.ext.widgets.reference/src/org/eclipse/eef/ide/ui/ext/widgets/reference/internal/EEFExtMultipleReferenceLifecycleManager.java b/plugins/org.eclipse.eef.ide.ui.ext.widgets.reference/src/org/eclipse/eef/ide/ui/ext/widgets/reference/internal/EEFExtMultipleReferenceLifecycleManager.java
index ec3ef5a5d..a0296ecc7 100644
--- a/plugins/org.eclipse.eef.ide.ui.ext.widgets.reference/src/org/eclipse/eef/ide/ui/ext/widgets/reference/internal/EEFExtMultipleReferenceLifecycleManager.java
+++ b/plugins/org.eclipse.eef.ide.ui.ext.widgets.reference/src/org/eclipse/eef/ide/ui/ext/widgets/reference/internal/EEFExtMultipleReferenceLifecycleManager.java
@@ -134,19 +134,19 @@ public class EEFExtMultipleReferenceLifecycleManager extends AbstractEEFExtRefer
buttonsComposite.setLayout(buttonCompositeGridLayout);
if (!this.eReference.isContainment()) {
- Image browseImage = ExtendedImageRegistry.INSTANCE.getImage(EEFExtReferenceUIPlugin.getPlugin().getImage(
- EEFExtReferenceUIPlugin.Implementation.BROWSE_ICON_PATH));
+ Image browseImage = ExtendedImageRegistry.INSTANCE
+ .getImage(EEFExtReferenceUIPlugin.getPlugin().getImage(EEFExtReferenceUIPlugin.Implementation.BROWSE_ICON_PATH));
this.browseButton = this.createButton(buttonsComposite, browseImage);
}
- Image addImage = ExtendedImageRegistry.INSTANCE.getImage(EEFExtReferenceUIPlugin.getPlugin().getImage(
- EEFExtReferenceUIPlugin.Implementation.ADD_ICON_PATH));
- Image removeImage = ExtendedImageRegistry.INSTANCE.getImage(EEFExtReferenceUIPlugin.getPlugin().getImage(
- EEFExtReferenceUIPlugin.Implementation.REMOVE_ICON_PATH));
- Image upImage = ExtendedImageRegistry.INSTANCE.getImage(EEFExtReferenceUIPlugin.getPlugin().getImage(
- EEFExtReferenceUIPlugin.Implementation.UP_ICON_PATH));
- Image downImage = ExtendedImageRegistry.INSTANCE.getImage(EEFExtReferenceUIPlugin.getPlugin().getImage(
- EEFExtReferenceUIPlugin.Implementation.DOWN_ICON_PATH));
+ Image addImage = ExtendedImageRegistry.INSTANCE
+ .getImage(EEFExtReferenceUIPlugin.getPlugin().getImage(EEFExtReferenceUIPlugin.Implementation.ADD_ICON_PATH));
+ Image removeImage = ExtendedImageRegistry.INSTANCE
+ .getImage(EEFExtReferenceUIPlugin.getPlugin().getImage(EEFExtReferenceUIPlugin.Implementation.REMOVE_ICON_PATH));
+ Image upImage = ExtendedImageRegistry.INSTANCE
+ .getImage(EEFExtReferenceUIPlugin.getPlugin().getImage(EEFExtReferenceUIPlugin.Implementation.UP_ICON_PATH));
+ Image downImage = ExtendedImageRegistry.INSTANCE
+ .getImage(EEFExtReferenceUIPlugin.getPlugin().getImage(EEFExtReferenceUIPlugin.Implementation.DOWN_ICON_PATH));
this.addButton = this.createButton(buttonsComposite, addImage);
this.removeButton = this.createButton(buttonsComposite, removeImage);
@@ -182,8 +182,8 @@ public class EEFExtMultipleReferenceLifecycleManager extends AbstractEEFExtRefer
this.composedAdapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());
this.tableViewer.setContentProvider(new EReferenceContentProvider(this.eReference));
- this.tableViewer.setLabelProvider(new DelegatingStyledCellLabelProvider(new AdapterFactoryLabelProvider.StyledLabelProvider(
- this.composedAdapterFactory, this.tableViewer)));
+ this.tableViewer.setLabelProvider(new DelegatingStyledCellLabelProvider(
+ new AdapterFactoryLabelProvider.StyledLabelProvider(this.composedAdapterFactory, this.tableViewer)));
scrolledComposite.setContent(table);
@@ -219,24 +219,16 @@ public class EEFExtMultipleReferenceLifecycleManager extends AbstractEEFExtRefer
IItemPropertySource propertySource = (IItemPropertySource) adapter;
IItemPropertyDescriptor propertyDescriptor = propertySource.getPropertyDescriptor(this.target, this.eReference);
if (propertyDescriptor != null) {
- List<EObject> elements = new ArrayList<>();
- elements.add(this.target);
- this.contextAdapter.lock(elements);
-
ArrayList<Object> choiceOfValues = new ArrayList<Object>(propertyDescriptor.getChoiceOfValues(this.target));
- FeatureEditorDialog dialog = new FeatureEditorDialog(this.tableViewer.getTable().getShell(), new AdapterFactoryLabelProvider(
- this.composedAdapterFactory), this.target, this.eReference, propertyDescriptor.getDisplayName(this.target), choiceOfValues);
+ FeatureEditorDialog dialog = new FeatureEditorDialog(this.tableViewer.getTable().getShell(),
+ new AdapterFactoryLabelProvider(this.composedAdapterFactory), this.target, this.eReference,
+ propertyDescriptor.getDisplayName(this.target), choiceOfValues);
dialog.open();
- Object value = this.target.eGet(this.eReference);
EList<?> result = dialog.getResult();
if (result != null) {
this.target.eSet(this.eReference, result);
}
- if (value == null || value.equals(this.target.eGet(this.eReference))) {
- this.contextAdapter.unlock(elements);
- }
-
}
}
}
@@ -248,15 +240,9 @@ public class EEFExtMultipleReferenceLifecycleManager extends AbstractEEFExtRefer
*/
@Override
protected void addButtonCallback() {
- List<EObject> elements = new ArrayList<>();
- elements.add(this.target);
- this.contextAdapter.lock(elements);
-
IWizard wizard = new EEFExtEObjectCreationWizard(this.target, this.eReference, this.contextAdapter);
WizardDialog wizardDialog = new WizardDialog(this.tableViewer.getTable().getShell(), wizard);
wizardDialog.open();
-
- this.contextAdapter.unlock(elements);
}
/**
diff --git a/plugins/org.eclipse.eef.ide.ui.ext.widgets.reference/src/org/eclipse/eef/ide/ui/ext/widgets/reference/internal/EEFExtSingleReferenceLifecycleManager.java b/plugins/org.eclipse.eef.ide.ui.ext.widgets.reference/src/org/eclipse/eef/ide/ui/ext/widgets/reference/internal/EEFExtSingleReferenceLifecycleManager.java
index 2c005d320..b191a5360 100644
--- a/plugins/org.eclipse.eef.ide.ui.ext.widgets.reference/src/org/eclipse/eef/ide/ui/ext/widgets/reference/internal/EEFExtSingleReferenceLifecycleManager.java
+++ b/plugins/org.eclipse.eef.ide.ui.ext.widgets.reference/src/org/eclipse/eef/ide/ui/ext/widgets/reference/internal/EEFExtSingleReferenceLifecycleManager.java
@@ -10,9 +10,6 @@
*******************************************************************************/
package org.eclipse.eef.ide.ui.ext.widgets.reference.internal;
-import java.util.ArrayList;
-import java.util.List;
-
import org.eclipse.eef.common.ui.api.IEEFFormContainer;
import org.eclipse.eef.core.api.EditingContextAdapter;
import org.eclipse.eef.core.ext.widgets.reference.internal.EEFExtReferenceController;
@@ -105,17 +102,17 @@ public class EEFExtSingleReferenceLifecycleManager extends AbstractEEFExtReferen
if (!this.eReference.isContainment()) {
buttonsComposite.setLayout(new GridLayout(3, true));
- Image browseImage = ExtendedImageRegistry.INSTANCE.getImage(EEFExtReferenceUIPlugin.getPlugin().getImage(
- EEFExtReferenceUIPlugin.Implementation.BROWSE_ICON_PATH));
+ Image browseImage = ExtendedImageRegistry.INSTANCE
+ .getImage(EEFExtReferenceUIPlugin.getPlugin().getImage(EEFExtReferenceUIPlugin.Implementation.BROWSE_ICON_PATH));
this.browseButton = this.createButton(buttonsComposite, browseImage);
} else {
buttonsComposite.setLayout(new GridLayout(2, true));
}
- Image addImage = ExtendedImageRegistry.INSTANCE.getImage(EEFExtReferenceUIPlugin.getPlugin().getImage(
- EEFExtReferenceUIPlugin.Implementation.ADD_ICON_PATH));
- Image removeImage = ExtendedImageRegistry.INSTANCE.getImage(EEFExtReferenceUIPlugin.getPlugin().getImage(
- EEFExtReferenceUIPlugin.Implementation.REMOVE_ICON_PATH));
+ Image addImage = ExtendedImageRegistry.INSTANCE
+ .getImage(EEFExtReferenceUIPlugin.getPlugin().getImage(EEFExtReferenceUIPlugin.Implementation.ADD_ICON_PATH));
+ Image removeImage = ExtendedImageRegistry.INSTANCE
+ .getImage(EEFExtReferenceUIPlugin.getPlugin().getImage(EEFExtReferenceUIPlugin.Implementation.REMOVE_ICON_PATH));
this.addButton = this.createButton(buttonsComposite, addImage);
this.removeButton = this.createButton(buttonsComposite, removeImage);
@@ -158,21 +155,9 @@ public class EEFExtSingleReferenceLifecycleManager extends AbstractEEFExtReferen
*/
@Override
protected void browseButtonCallback() {
- List<EObject> elements = new ArrayList<>();
- elements.add(this.target);
- this.contextAdapter.lock(elements);
-
- Object value = this.target.eGet(this.eReference);
-
IWizard wizard = new EEFExtEObjectSelectionWizard(this.target, this.eReference, this.contextAdapter);
WizardDialog wizardDialog = new WizardDialog(this.text.getShell(), wizard);
-
- // Only unlock if nothing has changed or if the user has cancelled the dialog
- int result = wizardDialog.open();
- if (result == WizardDialog.CANCEL || (value != null && value.equals(this.target.eGet(this.eReference)))) {
- this.contextAdapter.unlock(elements);
- }
-
+ wizardDialog.open();
}
/**
@@ -182,17 +167,9 @@ public class EEFExtSingleReferenceLifecycleManager extends AbstractEEFExtReferen
*/
@Override
protected void addButtonCallback() {
- List<EObject> elements = new ArrayList<>();
- elements.add(this.target);
- this.contextAdapter.lock(elements);
-
IWizard wizard = new EEFExtEObjectCreationWizard(this.target, this.eReference, this.contextAdapter);
WizardDialog wizardDialog = new WizardDialog(this.text.getShell(), wizard);
-
- int result = wizardDialog.open();
- if (result == WizardDialog.CANCEL) {
- this.contextAdapter.unlock(elements);
- }
+ wizardDialog.open();
}
/**
diff --git a/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFTextLifecycleManager.java b/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFTextLifecycleManager.java
index f057488ba..21682b6b0 100644
--- a/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFTextLifecycleManager.java
+++ b/plugins/org.eclipse.eef.ide.ui/src/org/eclipse/eef/ide/ui/internal/widgets/EEFTextLifecycleManager.java
@@ -10,8 +10,6 @@
*******************************************************************************/
package org.eclipse.eef.ide.ui.internal.widgets;
-import java.util.ArrayList;
-import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import org.eclipse.core.runtime.IStatus;
@@ -22,7 +20,6 @@ import org.eclipse.eef.EEFWidgetStyle;
import org.eclipse.eef.common.api.utils.Util;
import org.eclipse.eef.common.ui.api.EEFWidgetFactory;
import org.eclipse.eef.common.ui.api.IEEFFormContainer;
-import org.eclipse.eef.core.api.EEFExpressionUtils;
import org.eclipse.eef.core.api.EditingContextAdapter;
import org.eclipse.eef.core.api.controllers.EEFControllersFactory;
import org.eclipse.eef.core.api.controllers.IConsumer;
@@ -33,7 +30,6 @@ import org.eclipse.eef.ide.ui.api.widgets.EEFStyleHelper;
import org.eclipse.eef.ide.ui.api.widgets.EEFStyleHelper.IEEFTextStyleCallback;
import org.eclipse.eef.ide.ui.internal.EEFIdeUiPlugin;
import org.eclipse.eef.ide.ui.internal.widgets.styles.EEFColor;
-import org.eclipse.emf.ecore.EObject;
import org.eclipse.sirius.common.interpreter.api.IInterpreter;
import org.eclipse.sirius.common.interpreter.api.IVariableManager;
import org.eclipse.swt.SWT;
@@ -121,11 +117,6 @@ public class EEFTextLifecycleManager extends AbstractEEFWidgetLifecycleManager {
private boolean isDirty;
/**
- * The list of the elements to be locked and unlocked.
- */
- private List<EObject> elementsToLock = new ArrayList<EObject>();
-
- /**
* The constructor.
*
* @param description
@@ -226,13 +217,6 @@ public class EEFTextLifecycleManager extends AbstractEEFWidgetLifecycleManager {
public void modifyText(ModifyEvent e) {
if (!EEFTextLifecycleManager.this.container.isRenderingInProgress() && !updateInProgress.get()) {
EEFTextLifecycleManager.this.isDirty = true;
-
- EEFTextLifecycleManager.this.elementsToLock.clear();
- Object object = EEFTextLifecycleManager.this.variableManager.getVariables().get(EEFExpressionUtils.SELF);
- if (object instanceof EObject) {
- EEFTextLifecycleManager.this.elementsToLock.add((EObject) object);
- }
- EEFTextLifecycleManager.this.contextAdapter.lock(EEFTextLifecycleManager.this.elementsToLock);
}
}
};
@@ -351,8 +335,6 @@ public class EEFTextLifecycleManager extends AbstractEEFWidgetLifecycleManager {
public void aboutToBeHidden() {
if (this.isDirty) {
this.updateValue(true);
- } else {
- this.contextAdapter.unlock(EEFTextLifecycleManager.this.elementsToLock);
}
super.aboutToBeHidden();

Back to the top