Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2015-01-14 11:51:05 +0000
committerEike Stepper2015-01-14 12:07:49 +0000
commit5240ed791d602787fb60449708fbe9e565eec93e (patch)
tree5019fe1f3d4123ef6ab2808fd874be4e645392ae /plugins
parenta60b8034899dda3ef4be961842e8bf86c1505e83 (diff)
downloadcdo-5240ed791d602787fb60449708fbe9e565eec93e.tar.gz
cdo-5240ed791d602787fb60449708fbe9e565eec93e.tar.xz
cdo-5240ed791d602787fb60449708fbe9e565eec93e.zip
457437: Security Editor uses deprecated databinding API
https://bugs.eclipse.org/bugs/show_bug.cgi?id=457437 Change-Id: Ib8776b3907864a5caa023795c16da4e886d1f7a7 Signed-off-by: Eike Stepper <stepper@esc-net.de>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.emf.cdo.security.ui/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/AbstractDetailsPage.java12
-rw-r--r--plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/AbstractSectionPart.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/TableSection.java126
-rw-r--r--plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/util/OneToManyBlock.java140
5 files changed, 142 insertions, 141 deletions
diff --git a/plugins/org.eclipse.emf.cdo.security.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.security.ui/META-INF/MANIFEST.MF
index 1c0a772c43..d1144c8665 100644
--- a/plugins/org.eclipse.emf.cdo.security.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.security.ui/META-INF/MANIFEST.MF
@@ -24,6 +24,7 @@ Require-Bundle: org.eclipse.emf.cdo.security;bundle-version="[4.3.0,5.0.0)",
org.eclipse.emf.databinding.edit;bundle-version="[1.2.0,2.0.0)",
org.eclipse.jface.databinding;bundle-version="[1.6.0,2.0.0)",
org.eclipse.core.databinding.beans;bundle-version="[1.2.0,2.0.0)",
+ org.eclipse.core.databinding.property;bundle-version="[1.2.0,2.0.0)",
org.eclipse.emf.cdo.admin;bundle-version="[4.1.0,5.0.0)"
Bundle-ActivationPolicy: lazy
Bundle-Activator: org.eclipse.emf.cdo.security.internal.ui.bundle.OM$Activator
diff --git a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/AbstractDetailsPage.java b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/AbstractDetailsPage.java
index 9524c03970..c68b0398b2 100644
--- a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/AbstractDetailsPage.java
+++ b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/AbstractDetailsPage.java
@@ -31,7 +31,7 @@ import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;
-import org.eclipse.jface.databinding.swt.SWTObservables;
+import org.eclipse.jface.databinding.swt.WidgetProperties;
import org.eclipse.jface.databinding.viewers.ViewersObservables;
import org.eclipse.jface.fieldassist.ControlDecoration;
import org.eclipse.jface.viewers.ArrayContentProvider;
@@ -108,7 +108,7 @@ public abstract class AbstractDetailsPage<T extends EObject> extends AbstractSec
createDecorationComposite(parent, toolkit, layoutData(parent, SWT.FILL, false, 1)), ""); //$NON-NLS-1$
getContext().bindValue(observeText(result),
EMFEditObservables.observeDetailValue(getRealm(), getEditingDomain(), getValue(), attribute));
- getContext().bindValue(SWTObservables.observeEnabled(result), getValue(), null,
+ getContext().bindValue(WidgetProperties.enabled().observe(result), getValue(), null,
ObjectWritableConverter.createUpdateValueStrategy(attribute));
addRevertDecoration(result, attribute);
@@ -269,9 +269,9 @@ public abstract class AbstractDetailsPage<T extends EObject> extends AbstractSec
{
Button result = toolkit.createButton(
createDecorationComposite(parent, toolkit, layoutData(parent, SWT.LEFT, false, 2)), label, SWT.CHECK);
- getContext().bindValue(SWTObservables.observeSelection(result),
+ getContext().bindValue(WidgetProperties.enabled().observe(result),
EMFEditObservables.observeDetailValue(getRealm(), getEditingDomain(), getValue(), attribute));
- getContext().bindValue(SWTObservables.observeEnabled(result), getValue(), null,
+ getContext().bindValue(WidgetProperties.enabled().observe(result), getValue(), null,
ObjectWritableConverter.createUpdateValueStrategy(attribute));
addRevertDecoration(result, attribute);
@@ -283,7 +283,7 @@ public abstract class AbstractDetailsPage<T extends EObject> extends AbstractSec
Button result = toolkit.createButton(parent, label, SWT.PUSH);
result.setLayoutData(layoutData(parent, SWT.LEFT, false, 2));
- getContext().bindValue(SWTObservables.observeEnabled(result), getValue(), null,
+ getContext().bindValue(WidgetProperties.enabled().observe(result), getValue(), null,
ObjectWritableConverter.createUpdateValueStrategy());
result.addSelectionListener(selectionListener);
@@ -301,7 +301,7 @@ public abstract class AbstractDetailsPage<T extends EObject> extends AbstractSec
getContext().bindValue(ViewersObservables.observeSingleSelection(result),
EMFEditObservables.observeDetailValue(getRealm(), getEditingDomain(), getValue(), attribute));
- getContext().bindValue(SWTObservables.observeEnabled(result.getControl()), getValue(), null,
+ getContext().bindValue(WidgetProperties.enabled().observe(result.getControl()), getValue(), null,
ObjectWritableConverter.createUpdateValueStrategy(attribute));
addRevertDecoration(result.getControl(), attribute);
diff --git a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/AbstractSectionPart.java b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/AbstractSectionPart.java
index be8cb1ba2e..67b14889de 100644
--- a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/AbstractSectionPart.java
+++ b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/AbstractSectionPart.java
@@ -21,7 +21,7 @@ import org.eclipse.core.databinding.observable.Realm;
import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.core.databinding.observable.value.WritableValue;
import org.eclipse.jface.databinding.swt.ISWTObservableValue;
-import org.eclipse.jface.databinding.swt.SWTObservables;
+import org.eclipse.jface.databinding.swt.WidgetProperties;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.SWT;
@@ -174,7 +174,7 @@ public abstract class AbstractSectionPart<T extends EObject> extends AbstractFor
protected ISWTObservableValue observeText(Text text)
{
- return SWTObservables.observeText(text, new int[] { SWT.DefaultSelection, SWT.FocusOut });
+ return WidgetProperties.text(new int[] { SWT.DefaultSelection, SWT.FocusOut }).observe(text);
}
public void createContents(Composite parent)
diff --git a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/TableSection.java b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/TableSection.java
index 3fc426c09f..3a97a25e8c 100644
--- a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/TableSection.java
+++ b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/TableSection.java
@@ -39,7 +39,7 @@ import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;
-import org.eclipse.core.databinding.beans.PojoObservables;
+import org.eclipse.core.databinding.beans.PojoProperties;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
@@ -219,7 +219,7 @@ public abstract class TableSection<T extends EObject> extends AbstractSectionPar
}
};
- getContext().bindValue(PojoObservables.observeValue(getContext().getValidationRealm(), result, "enabled"), //$NON-NLS-1$
+ getContext().bindValue(PojoProperties.value("enabled").observe(getContext().getValidationRealm(), result), //$NON-NLS-1$
getValue(), null, ObjectWritableConverter.createUpdateValueStrategy());
return result;
@@ -239,7 +239,7 @@ public abstract class TableSection<T extends EObject> extends AbstractSectionPar
Command dummy = createDeleteCommand(EcoreUtil.create(elementEClass));
return new SelectionListenerAction<EObject>(dummy.getLabel(), SharedIcons.getDescriptor("etool16/delete.gif")) //$NON-NLS-1$
- {
+ {
@Override
public void run()
{
@@ -261,7 +261,7 @@ public abstract class TableSection<T extends EObject> extends AbstractSectionPar
{
return EObject.class;
}
- };
+ };
}
protected Command createDeleteCommand(EObject toDelete)
@@ -288,85 +288,85 @@ public abstract class TableSection<T extends EObject> extends AbstractSectionPar
{
viewer.addDragSupport(DND.DROP_LINK | DND.DROP_MOVE | DND.DROP_COPY,
new Transfer[] { LocalSelectionTransfer.getTransfer() }, new DragSourceAdapter()
- {
+ {
private long lastDragTime;
- @Override
- public void dragStart(DragSourceEvent event)
- {
- lastDragTime = System.currentTimeMillis();
- LocalSelectionTransfer.getTransfer().setSelection(viewer.getSelection());
- LocalSelectionTransfer.getTransfer().setSelectionSetTime(lastDragTime);
- }
+ @Override
+ public void dragStart(DragSourceEvent event)
+ {
+ lastDragTime = System.currentTimeMillis();
+ LocalSelectionTransfer.getTransfer().setSelection(viewer.getSelection());
+ LocalSelectionTransfer.getTransfer().setSelectionSetTime(lastDragTime);
+ }
- @Override
- public void dragFinished(DragSourceEvent event)
- {
- if (LocalSelectionTransfer.getTransfer().getSelectionSetTime() == lastDragTime)
- {
- LocalSelectionTransfer.getTransfer().setSelection(null);
- }
- }
- });
+ @Override
+ public void dragFinished(DragSourceEvent event)
+ {
+ if (LocalSelectionTransfer.getTransfer().getSelectionSetTime() == lastDragTime)
+ {
+ LocalSelectionTransfer.getTransfer().setSelection(null);
+ }
+ }
+ });
}
protected void configureDropSupport(final TableViewer viewer)
{
viewer.addDropSupport(DND.DROP_LINK | DND.DROP_MOVE | DND.DROP_COPY,
new Transfer[] { LocalSelectionTransfer.getTransfer() }, new ViewerDropAdapter(viewer)
- {
- {
- // We don't want it to look like you can insert new elements, only drop onto existing elements
- setFeedbackEnabled(false);
- }
+ {
+ {
+ // We don't want it to look like you can insert new elements, only drop onto existing elements
+ setFeedbackEnabled(false);
+ }
+
+ @Override
+ public boolean validateDrop(Object target, int operation, TransferData transferType)
+ {
+ boolean result = false;
- @Override
- public boolean validateDrop(Object target, int operation, TransferData transferType)
+ if (target instanceof EObject && LocalSelectionTransfer.getTransfer().isSupportedType(transferType))
+ {
+ EObject objectToDrop = getObjectToDrop(transferType);
+ if (objectToDrop != null)
{
- boolean result = false;
+ result = getDropReference((EObject)target, objectToDrop) != null;
- if (target instanceof EObject && LocalSelectionTransfer.getTransfer().isSupportedType(transferType))
+ if (result && (getCurrentEvent().operations | DND.DROP_COPY) != 0)
{
- EObject objectToDrop = getObjectToDrop(transferType);
- if (objectToDrop != null)
- {
- result = getDropReference((EObject)target, objectToDrop) != null;
-
- if (result && (getCurrentEvent().operations | DND.DROP_COPY) != 0)
- {
- overrideOperation(DND.DROP_COPY);
- }
- }
+ overrideOperation(DND.DROP_COPY);
}
-
- return result;
}
+ }
- @Override
- public boolean performDrop(Object data)
- {
- IStructuredSelection selection = (IStructuredSelection)data;
- EObject objectToDrop = UIUtil.getElement(selection, EObject.class);
- EObject target = (EObject)getCurrentTarget();
+ return result;
+ }
- Command command = AddCommand.create(getEditingDomain(), target, getDropReference(target, objectToDrop),
- selection.toList());
+ @Override
+ public boolean performDrop(Object data)
+ {
+ IStructuredSelection selection = (IStructuredSelection)data;
+ EObject objectToDrop = UIUtil.getElement(selection, EObject.class);
+ EObject target = (EObject)getCurrentTarget();
- boolean result = execute(command);
- if (result)
- {
- viewer.getControl().setFocus();
- viewer.setSelection(new StructuredSelection(target));
- }
+ Command command = AddCommand.create(getEditingDomain(), target, getDropReference(target, objectToDrop),
+ selection.toList());
- return result;
- }
+ boolean result = execute(command);
+ if (result)
+ {
+ viewer.getControl().setFocus();
+ viewer.setSelection(new StructuredSelection(target));
+ }
- private EObject getObjectToDrop(TransferData transferType)
- {
- return UIUtil.getElement(LocalSelectionTransfer.getTransfer().getSelection(), EObject.class);
- }
- });
+ return result;
+ }
+
+ private EObject getObjectToDrop(TransferData transferType)
+ {
+ return UIUtil.getElement(LocalSelectionTransfer.getTransfer().getSelection(), EObject.class);
+ }
+ });
}
protected EReference getDropReference(EObject target, EObject objectToDrop)
diff --git a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/util/OneToManyBlock.java b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/util/OneToManyBlock.java
index 7e33068e66..391b71a479 100644
--- a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/util/OneToManyBlock.java
+++ b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/util/OneToManyBlock.java
@@ -50,7 +50,7 @@ import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.core.databinding.observable.value.WritableValue;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.databinding.swt.SWTObservables;
+import org.eclipse.jface.databinding.swt.WidgetProperties;
import org.eclipse.jface.databinding.viewers.ObservableListContentProvider;
import org.eclipse.jface.databinding.viewers.ViewersObservables;
import org.eclipse.jface.layout.TableColumnLayout;
@@ -207,7 +207,7 @@ public class OneToManyBlock
configureDropSupport(viewer);
}
- context.bindValue(SWTObservables.observeEnabled(viewer.getControl()), input, null,
+ context.bindValue(WidgetProperties.enabled().observe(viewer.getControl()), input, null,
ObjectWritableConverter.createUpdateValueStrategy());
Composite buttons = toolkit.createComposite(parent);
@@ -230,15 +230,15 @@ public class OneToManyBlock
final IObservableValue selection = ViewersObservables.observeSingleSelection(viewer);
- context.bindValue(SWTObservables.observeEnabled(newButton), input, null,
+ context.bindValue(WidgetProperties.enabled().observe(newButton), input, null,
ObjectWritableConverter.createUpdateValueStrategy());
if (addButton != null)
{
- context.bindValue(SWTObservables.observeEnabled(addButton), input, null,
+ context.bindValue(WidgetProperties.enabled().observe(addButton), input, null,
ObjectWritableConverter.createUpdateValueStrategy());
}
- context.bindValue(SWTObservables.observeEnabled(removeButton), selection, null,
+ context.bindValue(WidgetProperties.enabled().observe(removeButton), selection, null,
ObjectWritableConverter.createUpdateValueStrategy());
newButton.addSelectionListener(new SelectionAdapter()
@@ -335,7 +335,7 @@ public class OneToManyBlock
final SelectionListenerAction<EObject> removeAction = new SelectionListenerAction<EObject>(
Messages.OneToManyBlock_2, SharedIcons.getDescriptor("etool16/delete.gif")) //$NON-NLS-1$
- {
+ {
@Override
public void run()
{
@@ -368,23 +368,23 @@ public class OneToManyBlock
{
return EObject.class;
}
- };
+ };
- removeButton.addSelectionListener(new SelectionAdapter()
- {
- @Override
- public void widgetSelected(SelectionEvent e)
- {
- if (removeAction.isEnabled())
+ removeButton.addSelectionListener(new SelectionAdapter()
{
- removeAction.run();
- }
- }
- });
+ @Override
+ public void widgetSelected(SelectionEvent e)
+ {
+ if (removeAction.isEnabled())
+ {
+ removeAction.run();
+ }
+ }
+ });
- viewer.addSelectionChangedListener(removeAction);
+ viewer.addSelectionChangedListener(removeAction);
- new ActionBarsHelper(editorActionBars).addGlobalAction(ActionFactory.DELETE.getId(), removeAction).install(viewer);
+ new ActionBarsHelper(editorActionBars).addGlobalAction(ActionFactory.DELETE.getId(), removeAction).install(viewer);
}
public void setInput(IObservableValue input)
@@ -479,64 +479,64 @@ public class OneToManyBlock
{
viewer.addDropSupport(DND.DROP_LINK | DND.DROP_MOVE | DND.DROP_COPY,
new Transfer[] { LocalSelectionTransfer.getTransfer() }, new DropTargetAdapter()
+ {
+ @Override
+ public void dragEnter(DropTargetEvent event)
+ {
+ if (!canDrop(event))
{
- @Override
- public void dragEnter(DropTargetEvent event)
- {
- if (!canDrop(event))
- {
- // Reject this drop
- event.detail = DND.DROP_NONE;
- }
- else if ((event.operations | DND.DROP_COPY) != 0)
- {
- event.detail = DND.DROP_COPY;
- }
- }
+ // Reject this drop
+ event.detail = DND.DROP_NONE;
+ }
+ else if ((event.operations | DND.DROP_COPY) != 0)
+ {
+ event.detail = DND.DROP_COPY;
+ }
+ }
- private boolean canDrop(DropTargetEvent event)
- {
- boolean result = false;
+ private boolean canDrop(DropTargetEvent event)
+ {
+ boolean result = false;
- if (LocalSelectionTransfer.getTransfer().isSupportedType(event.currentDataType))
- {
- result = canPresentAll(LocalSelectionTransfer.getTransfer().getSelection());
- }
+ if (LocalSelectionTransfer.getTransfer().isSupportedType(event.currentDataType))
+ {
+ result = canPresentAll(LocalSelectionTransfer.getTransfer().getSelection());
+ }
- return result;
- }
+ return result;
+ }
- @Override
- public void dropAccept(DropTargetEvent event)
- {
- if (!canDrop(event))
- {
- // Reject this drop
- event.detail = DND.DROP_NONE;
- }
- else if ((event.operations | DND.DROP_COPY) != 0)
- {
- event.detail = DND.DROP_COPY;
- }
- }
+ @Override
+ public void dropAccept(DropTargetEvent event)
+ {
+ if (!canDrop(event))
+ {
+ // Reject this drop
+ event.detail = DND.DROP_NONE;
+ }
+ else if ((event.operations | DND.DROP_COPY) != 0)
+ {
+ event.detail = DND.DROP_COPY;
+ }
+ }
- @Override
- public void drop(DropTargetEvent event)
+ @Override
+ public void drop(DropTargetEvent event)
+ {
+ if (canDrop(event))
+ {
+ IStructuredSelection selection = (IStructuredSelection)LocalSelectionTransfer.getTransfer()
+ .getSelection();
+ Command command = AddCommand.create(domain, input.getValue(), getConfiguration().getModelReference(),
+ selection.toList());
+ if (execute(command))
{
- if (canDrop(event))
- {
- IStructuredSelection selection = (IStructuredSelection)LocalSelectionTransfer.getTransfer()
- .getSelection();
- Command command = AddCommand.create(domain, input.getValue(), getConfiguration().getModelReference(),
- selection.toList());
- if (execute(command))
- {
- viewer.setSelection(selection);
- viewer.getControl().setFocus();
- }
- }
+ viewer.setSelection(selection);
+ viewer.getControl().setFocus();
}
- });
+ }
+ }
+ });
}
protected void hookUnsupportedModelContentValidation(IObservableList observableList)
@@ -566,7 +566,7 @@ public class OneToManyBlock
if (!supportedContentFilter.select(element))
{
configuration.getManagedForm().getMessageManager()
- .addMessage(this, Messages.TableSection_3, null, IStatus.WARNING, viewer.getControl());
+ .addMessage(this, Messages.TableSection_3, null, IStatus.WARNING, viewer.getControl());
return;
}
}

Back to the top