Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2013-10-26 07:00:36 +0000
committerEike Stepper2013-10-26 07:17:21 +0000
commit168480f024b1d66a920c99ca4ee92fb3ad81292d (patch)
treeccd0455745cf85a35a545425ef90d058ced28dfd /plugins/org.eclipse.emf.cdo.security.ui
parent8c172499327041793874799b48fb231961beee78 (diff)
downloadcdo-168480f024b1d66a920c99ca4ee92fb3ad81292d.tar.gz
cdo-168480f024b1d66a920c99ca4ee92fb3ad81292d.tar.xz
cdo-168480f024b1d66a920c99ca4ee92fb3ad81292d.zip
[418452] [Security] Simplified security model editor
https://bugs.eclipse.org/bugs/show_bug.cgi?id=418452
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.security.ui')
-rw-r--r--plugins/org.eclipse.emf.cdo.security.ui/plugin.xml1
-rw-r--r--plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/actions/SelectionListenerAction.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/dialogs/FilterTreeSelectionDialog.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/AbstractDetailsPage.java32
-rw-r--r--plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/AbstractSectionPart.java9
-rw-r--r--plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/CDOSecurityFormActionBarContributor.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/CDOSecurityFormEditor.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/CDOSecurityPage.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/EClassDetailsPageProvider.java15
-rw-r--r--plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/EmptyDetailsPage.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/GroupDetailsPage.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/GroupsSection.java16
-rw-r--r--plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/RoleDetailsPage.java11
-rw-r--r--plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/RolesSection.java11
-rw-r--r--plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/TableSection.java26
-rw-r--r--plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/UserDetailsPage.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/UsersSection.java16
-rw-r--r--plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/handlers/ManageSecurityHandler.java17
-rw-r--r--plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/handlers/ResetPasswordHandler.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/util/ActionBarsHelper.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/util/EditableDialogCellEditor.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/util/ObjectExistsConverter.java14
-rw-r--r--plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/util/OneToManyBlock.java38
-rw-r--r--plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/util/OneToManyTableBlock.java16
-rw-r--r--plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/util/ResourceBasedPermissionFilter.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/util/ResourceBasedRoleFilter.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/util/SecurityUIUtil.java (renamed from plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/util/SecurityModelUtil.java)56
-rw-r--r--plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/util/TableLabelProvider.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/ui/ISecurityManagementContext.java18
29 files changed, 156 insertions, 228 deletions
diff --git a/plugins/org.eclipse.emf.cdo.security.ui/plugin.xml b/plugins/org.eclipse.emf.cdo.security.ui/plugin.xml
index ac57e190e5..c538e9712b 100644
--- a/plugins/org.eclipse.emf.cdo.security.ui/plugin.xml
+++ b/plugins/org.eclipse.emf.cdo.security.ui/plugin.xml
@@ -93,4 +93,5 @@
defaultHandler="org.eclipse.emf.cdo.security.internal.ui.handlers.ManageSecurityHandler">
</command>
</extension>
+
</plugin>
diff --git a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/actions/SelectionListenerAction.java b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/actions/SelectionListenerAction.java
index e137bc66b7..b70e4c8e2a 100644
--- a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/actions/SelectionListenerAction.java
+++ b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/actions/SelectionListenerAction.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Christian W. Damus (CEA LIST) - initial API and implementation
*/
@@ -21,7 +21,6 @@ import org.eclipse.ui.actions.BaseSelectionListenerAction;
*/
public class SelectionListenerAction extends BaseSelectionListenerAction
{
-
private EObject selectedObject;
public SelectionListenerAction(String text)
@@ -32,7 +31,6 @@ public class SelectionListenerAction extends BaseSelectionListenerAction
public SelectionListenerAction(String text, ImageDescriptor imageDescriptor)
{
this(text);
-
setImageDescriptor(imageDescriptor);
}
diff --git a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/dialogs/FilterTreeSelectionDialog.java b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/dialogs/FilterTreeSelectionDialog.java
index d9c277801a..ec8c355df2 100644
--- a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/dialogs/FilterTreeSelectionDialog.java
+++ b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/dialogs/FilterTreeSelectionDialog.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Christian W. Damus (CEA LIST) - initial API and implementation
*/
@@ -22,12 +22,11 @@ import org.eclipse.ui.dialogs.PatternFilter;
/**
* A tree selection dialog that offers the user a filter field.
- *
+ *
* @author Christian W. Damus (CEA LIST)
*/
public class FilterTreeSelectionDialog extends ElementTreeSelectionDialog
{
-
private PatternFilter filter = new PatternFilter();
public FilterTreeSelectionDialog(Shell parent, ILabelProvider labelProvider, ITreeContentProvider contentProvider)
@@ -43,8 +42,6 @@ public class FilterTreeSelectionDialog extends ElementTreeSelectionDialog
tree.setQuickSelectionMode(false);
applyDialogFont(tree);
-
return tree.getViewer();
}
-
}
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 56fcc5a888..e30af1e6fb 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
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Christian W. Damus (CEA LIST) - initial API and implementation
*/
@@ -58,12 +58,11 @@ import org.eclipse.ui.forms.widgets.TableWrapData;
/**
* Common framework for the right-hand side object details pages of the
* master/detail form.
- *
+ *
* @author Christian W. Damus (CEA LIST)
*/
public abstract class AbstractDetailsPage<T extends EObject> extends AbstractSectionPart<T> implements IDetailsPage
{
-
public AbstractDetailsPage(Class<T> elementType, EClass elementEClass, EditingDomain domain,
AdapterFactory adapterFactory)
{
@@ -113,7 +112,6 @@ public abstract class AbstractDetailsPage<T extends EObject> extends AbstractSec
ObjectWritableConverter.createUpdateValueStrategy());
addRevertDecoration(result, attribute);
-
return result;
}
@@ -185,35 +183,23 @@ public abstract class AbstractDetailsPage<T extends EObject> extends AbstractSec
protected static Object layoutData(Composite parent, int horzAlign, boolean horzGrab, int horzSpan)
{
- Object result;
-
if (parent.getLayout() instanceof GridLayout)
{
- result = horzAlign(new GridData(), horzAlign, horzGrab, horzSpan);
- }
- else
- {
- result = horzAlign(new TableWrapData(), horzAlign, horzGrab, horzSpan);
+ return horzAlign(new GridData(), horzAlign, horzGrab, horzSpan);
}
- return result;
+ return horzAlign(new TableWrapData(), horzAlign, horzGrab, horzSpan);
}
protected static Object layoutData(Composite parent, int horzAlign, boolean horzGrab, int horzSpan, int vertAlign,
boolean vertGrab, int vertSpan)
{
- Object result;
-
if (parent.getLayout() instanceof GridLayout)
{
- result = vertAlign(horzAlign(new GridData(), horzAlign, horzGrab, horzSpan), vertAlign, vertGrab, vertSpan);
- }
- else
- {
- result = vertAlign(horzAlign(new TableWrapData(), horzAlign, horzGrab, horzSpan), vertAlign, vertGrab, vertSpan);
+ return vertAlign(horzAlign(new GridData(), horzAlign, horzGrab, horzSpan), vertAlign, vertGrab, vertSpan);
}
- return result;
+ return vertAlign(horzAlign(new TableWrapData(), horzAlign, horzGrab, horzSpan), vertAlign, vertGrab, vertSpan);
}
protected static <T> T heightHint(T layoutData, int hint)
@@ -289,7 +275,6 @@ public abstract class AbstractDetailsPage<T extends EObject> extends AbstractSec
ObjectWritableConverter.createUpdateValueStrategy());
addRevertDecoration(result, attribute);
-
return result;
}
@@ -302,7 +287,6 @@ public abstract class AbstractDetailsPage<T extends EObject> extends AbstractSec
ObjectWritableConverter.createUpdateValueStrategy());
result.addSelectionListener(selectionListener);
-
return result;
}
@@ -321,7 +305,6 @@ public abstract class AbstractDetailsPage<T extends EObject> extends AbstractSec
ObjectWritableConverter.createUpdateValueStrategy());
addRevertDecoration(result.getControl(), attribute);
-
return result;
}
@@ -390,11 +373,12 @@ public abstract class AbstractDetailsPage<T extends EObject> extends AbstractSec
}
}
};
+
control.getDisplay().timerExec(1000, hideRunnable);
}
};
+
control.addMouseTrackListener(showHideListener);
control.getParent().addMouseTrackListener(showHideListener);
}
-
}
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 07dbab277a..be8cb1ba2e 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
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Christian W. Damus (CEA LIST) - initial API and implementation
*/
@@ -41,12 +41,11 @@ import org.eclipse.ui.forms.widgets.TableWrapLayout;
/**
* Common framework for a part of a form page that is an SWT {@link Section}
* presenting some object, list/table of objects, or attributes of an object.
- *
+ *
* @author Christian W. Damus (CEA LIST)
*/
public abstract class AbstractSectionPart<T extends EObject> extends AbstractFormPart
{
-
private final EditingDomain domain;
private final AdapterFactory adapterFactory;
@@ -75,7 +74,6 @@ public abstract class AbstractSectionPart<T extends EObject> extends AbstractFor
public void initialize(IManagedForm form)
{
super.initialize(form);
-
initDatabindings();
}
@@ -110,7 +108,6 @@ public abstract class AbstractSectionPart<T extends EObject> extends AbstractFor
public boolean setFormInput(Object input)
{
boolean result = false;
-
this.input = null;
if (inputType.isInstance(input))
@@ -120,7 +117,6 @@ public abstract class AbstractSectionPart<T extends EObject> extends AbstractFor
}
value.setValue(this.input);
-
return result;
}
@@ -201,7 +197,6 @@ public abstract class AbstractSectionPart<T extends EObject> extends AbstractFor
section.setClient(body);
createContents(body, toolkit);
-
createActionToolbar(section, toolkit);
}
diff --git a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/CDOSecurityFormActionBarContributor.java b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/CDOSecurityFormActionBarContributor.java
index ea37d01101..3e97b344a8 100644
--- a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/CDOSecurityFormActionBarContributor.java
+++ b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/CDOSecurityFormActionBarContributor.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Christian W. Damus (CEA LIST) - initial API and implementation
*/
@@ -24,7 +24,7 @@ import org.eclipse.ui.part.EditorActionBarContributor;
/**
* The editor action-bar contributor for the Security Manager editor.
- *
+ *
* @author Christian W. Damus (CEA LIST)
*/
public class CDOSecurityFormActionBarContributor extends EditorActionBarContributor implements IPropertyListener
@@ -79,6 +79,7 @@ public class CDOSecurityFormActionBarContributor extends EditorActionBarContribu
{
undoAction.setActiveWorkbenchPart(activeEditor);
}
+
if (redoAction != null)
{
redoAction.setActiveWorkbenchPart(activeEditor);
@@ -95,6 +96,7 @@ public class CDOSecurityFormActionBarContributor extends EditorActionBarContribu
{
undoAction.setActiveWorkbenchPart(null);
}
+
if (redoAction != null)
{
redoAction.setActiveWorkbenchPart(null);
@@ -109,6 +111,7 @@ public class CDOSecurityFormActionBarContributor extends EditorActionBarContribu
{
undoAction.update();
}
+
if (redoAction != null)
{
redoAction.update();
diff --git a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/CDOSecurityFormEditor.java b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/CDOSecurityFormEditor.java
index 709a53a343..efdc7b558c 100644
--- a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/CDOSecurityFormEditor.java
+++ b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/CDOSecurityFormEditor.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Christian W. Damus (CEA LIST) - initial API and implementation
*/
@@ -51,12 +51,11 @@ import java.util.EventObject;
/**
* The "Security Manager" editor.
- *
+ *
* @author Christian W. Damus (CEA LIST)
*/
public class CDOSecurityFormEditor extends FormEditor implements IEditingDomainProvider
{
-
public static final String ID = "org.eclipse.emf.cdo.security.ui.CDOSecurityFormEditor"; //$NON-NLS-1$
private ComposedAdapterFactory adapterFactory;
@@ -152,7 +151,6 @@ public class CDOSecurityFormEditor extends FormEditor implements IEditingDomainP
public void init(IEditorSite site, IEditorInput input) throws PartInitException
{
super.init(site, input);
-
initializeEditingDomain();
}
@@ -201,7 +199,6 @@ public class CDOSecurityFormEditor extends FormEditor implements IEditingDomainP
CDOResource result = null;
IEditorInput input = getEditorInput();
-
if (input instanceof CDOEditorInput)
{
CDOEditorInput cdoInput = (CDOEditorInput)input;
diff --git a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/CDOSecurityPage.java b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/CDOSecurityPage.java
index 1d3bccfda8..944fdb8b83 100644
--- a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/CDOSecurityPage.java
+++ b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/CDOSecurityPage.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Christian W. Damus (CEA LIST) - initial API and implementation
*/
@@ -59,12 +59,11 @@ import org.eclipse.ui.forms.widgets.ScrolledForm;
/**
* The main page of the "Security Manager" form editor.
- *
+ *
* @author Christian W. Damus (CEA LIST)
*/
public class CDOSecurityPage extends FormPage
{
-
private static final Object NO_INPUT = new Object();
private IListener viewTargetListener;
@@ -197,7 +196,6 @@ public class CDOSecurityPage extends FormPage
// ensure the heading's summary of problems is up-to-date
Display.getCurrent().asyncExec(new Runnable()
{
-
public void run()
{
getManagedForm().getMessageManager().update();
diff --git a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/EClassDetailsPageProvider.java b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/EClassDetailsPageProvider.java
index a12eda7ab2..5a7f9d2e2d 100644
--- a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/EClassDetailsPageProvider.java
+++ b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/EClassDetailsPageProvider.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Christian W. Damus (CEA LIST) - initial API and implementation
*/
@@ -22,14 +22,13 @@ import java.util.Map;
/**
* A master/details-block details page provider that maps details pages
* simply by {@link EClass}.
- *
+ *
* @author Christian W. Damus (CEA LIST)
- *
+ *
* @see #builder(IActionBars)
*/
public class EClassDetailsPageProvider implements IDetailsPageProvider
{
-
private final Map<EClass, IDetailsPage> pages = new java.util.HashMap<EClass, IDetailsPage>();
private EClassDetailsPageProvider()
@@ -51,10 +50,9 @@ public class EClassDetailsPageProvider implements IDetailsPageProvider
return pages.get(key);
}
- //
- // Nested types
- //
-
+ /**
+ * @author Christian W. Damus (CEA LIST)
+ */
public static class Builder
{
private final Map<EClass, IDetailsPage> pages = new java.util.HashMap<EClass, IDetailsPage>();
@@ -74,7 +72,6 @@ public class EClassDetailsPageProvider implements IDetailsPageProvider
}
pages.put(eclass, page);
-
return this;
}
diff --git a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/EmptyDetailsPage.java b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/EmptyDetailsPage.java
index dde9cb923c..9a2a4f3f29 100644
--- a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/EmptyDetailsPage.java
+++ b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/EmptyDetailsPage.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Christian W. Damus (CEA LIST) - initial API and implementation
*/
@@ -25,12 +25,11 @@ import org.eclipse.ui.forms.widgets.TableWrapLayout;
/**
* The page presented when there is no selection for which to show details.
- *
+ *
* @author Christian W. Damus (CEA LIST)
*/
public class EmptyDetailsPage extends AbstractFormPart implements IDetailsPage
{
-
public EmptyDetailsPage()
{
}
@@ -52,5 +51,4 @@ public class EmptyDetailsPage extends AbstractFormPart implements IDetailsPage
{
// Pass
}
-
}
diff --git a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/GroupDetailsPage.java b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/GroupDetailsPage.java
index 8ebfed5163..fdb78e64f3 100644
--- a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/GroupDetailsPage.java
+++ b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/GroupDetailsPage.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Christian W. Damus (CEA LIST) - initial API and implementation
*/
@@ -22,12 +22,11 @@ import org.eclipse.ui.forms.widgets.FormToolkit;
/**
* The details page for a {@link Group} selection.
- *
+ *
* @author Christian W. Damus (CEA LIST)
*/
public class GroupDetailsPage extends AbstractDetailsPage<Group>
{
-
public GroupDetailsPage(EditingDomain domain, AdapterFactory adapterFactory)
{
super(Group.class, SecurityPackage.Literals.GROUP, domain, adapterFactory);
@@ -46,5 +45,4 @@ public class GroupDetailsPage extends AbstractDetailsPage<Group>
oneToMany(parent, toolkit, Messages.GroupDetailsPage_2, SecurityPackage.Literals.ASSIGNEE__ROLES);
}
-
}
diff --git a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/GroupsSection.java b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/GroupsSection.java
index 6d1ef1ac6a..981ec8ec15 100644
--- a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/GroupsSection.java
+++ b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/GroupsSection.java
@@ -4,14 +4,13 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Christian W. Damus (CEA LIST) - initial API and implementation
*/
package org.eclipse.emf.cdo.security.internal.ui.editor;
import org.eclipse.emf.cdo.security.Group;
-import org.eclipse.emf.cdo.security.Role;
import org.eclipse.emf.cdo.security.SecurityPackage;
import org.eclipse.emf.cdo.security.User;
import org.eclipse.emf.cdo.security.internal.ui.messages.Messages;
@@ -23,12 +22,11 @@ import org.eclipse.emf.edit.domain.EditingDomain;
/**
* The section presenting the {@link Group}s defined in the security realm.
- *
+ *
* @author Christian W. Damus (CEA LIST)
*/
public class GroupsSection extends TableSection<Group>
{
-
public GroupsSection(EditingDomain domain, AdapterFactory adapterFactory)
{
super(Group.class, SecurityPackage.Literals.GROUP, domain, adapterFactory);
@@ -43,17 +41,11 @@ public class GroupsSection extends TableSection<Group>
@Override
protected EReference getDropReference(EObject target, EObject objectToDrop)
{
- EReference result = null;
-
if (objectToDrop instanceof User)
{
- result = SecurityPackage.Literals.GROUP__USERS;
- }
- else if (objectToDrop instanceof Role)
- {
- result = SecurityPackage.Literals.ASSIGNEE__ROLES;
+ return SecurityPackage.Literals.GROUP__USERS;
}
- return result;
+ return SecurityPackage.Literals.ASSIGNEE__ROLES;
}
}
diff --git a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/RoleDetailsPage.java b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/RoleDetailsPage.java
index d4520b10e4..9240bf8e6a 100644
--- a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/RoleDetailsPage.java
+++ b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/RoleDetailsPage.java
@@ -4,14 +4,14 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Christian W. Damus (CEA LIST) - initial API and implementation
*/
package org.eclipse.emf.cdo.security.internal.ui.editor;
-import static org.eclipse.emf.cdo.security.internal.ui.util.SecurityModelUtil.getTypeFilter;
-import static org.eclipse.emf.cdo.security.internal.ui.util.SecurityModelUtil.viewerFilter;
+import static org.eclipse.emf.cdo.security.internal.ui.util.SecurityUIUtil.getTypeFilter;
+import static org.eclipse.emf.cdo.security.internal.ui.util.SecurityUIUtil.getViewerFilter;
import org.eclipse.emf.cdo.eresource.CDOResourceNode;
import org.eclipse.emf.cdo.eresource.EresourcePackage;
@@ -60,12 +60,11 @@ import java.util.Collections;
/**
* The details page for {@link Role} master selections. Includes a table
* that provides in-line editing of resource-based permissions.
- *
+ *
* @author Christian W. Damus (CEA LIST)
*/
public class RoleDetailsPage extends AbstractDetailsPage<Role>
{
-
public RoleDetailsPage(EditingDomain domain, AdapterFactory adapterFactory)
{
super(Role.class, SecurityPackage.Literals.ROLE, domain, adapterFactory);
@@ -356,7 +355,7 @@ public class RoleDetailsPage extends AbstractDetailsPage<Role>
dlg.setMessage(Messages.RoleDetailsPage_4);
dlg.setTitle(Messages.RoleDetailsPage_8);
dlg.setDoubleClickSelects(true);
- dlg.addFilter(viewerFilter(getTypeFilter(EresourcePackage.Literals.CDO_RESOURCE_NODE)));
+ dlg.addFilter(getViewerFilter(getTypeFilter(EresourcePackage.Literals.CDO_RESOURCE_NODE)));
dlg.setBlockOnOpen(true);
String current = (String)getValue();
diff --git a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/RolesSection.java b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/RolesSection.java
index d44831ebde..6664b1a1c3 100644
--- a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/RolesSection.java
+++ b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/RolesSection.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Christian W. Damus (CEA LIST) - initial API and implementation
*/
@@ -22,12 +22,11 @@ import org.eclipse.emf.edit.domain.EditingDomain;
/**
* The form section part presenting the {@link Role}s defined in the security realm.
- *
+ *
* @author Christian W. Damus (CEA LIST)
*/
public class RolesSection extends TableSection<Role>
{
-
public RolesSection(EditingDomain domain, AdapterFactory adapterFactory)
{
super(Role.class, SecurityPackage.Literals.ROLE, domain, adapterFactory);
@@ -42,13 +41,11 @@ public class RolesSection extends TableSection<Role>
@Override
protected EReference getDropReference(EObject target, EObject objectToDrop)
{
- EReference result = null;
-
if (objectToDrop instanceof Assignee)
{
- result = SecurityPackage.Literals.ROLE__ASSIGNEES;
+ return SecurityPackage.Literals.ROLE__ASSIGNEES;
}
- return result;
+ return null;
}
}
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 63229a8e0a..da8475fd22 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
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Christian W. Damus (CEA LIST) - initial API and implementation
*/
@@ -18,7 +18,7 @@ import org.eclipse.emf.cdo.security.internal.ui.actions.SelectionListenerAction;
import org.eclipse.emf.cdo.security.internal.ui.messages.Messages;
import org.eclipse.emf.cdo.security.internal.ui.util.ActionBarsHelper;
import org.eclipse.emf.cdo.security.internal.ui.util.ObjectExistsConverter.ObjectWritableConverter;
-import org.eclipse.emf.cdo.security.internal.ui.util.SecurityModelUtil;
+import org.eclipse.emf.cdo.security.internal.ui.util.SecurityUIUtil;
import org.eclipse.emf.cdo.security.internal.ui.util.TableLabelProvider;
import org.eclipse.emf.cdo.ui.shared.SharedIcons;
@@ -81,12 +81,11 @@ import java.util.Collections;
* objects in the list. The objects presented are the contents
* (of the appropriate type) of some {@link Directory} in the security
* realm model.
- *
+ *
* @author Christian W. Damus (CEA LIST)
*/
public abstract class TableSection<T extends EObject> extends AbstractSectionPart<Directory>
{
-
private final Class<T> elementType;
private final EClass elementEClass;
@@ -96,7 +95,6 @@ public abstract class TableSection<T extends EObject> extends AbstractSectionPar
public TableSection(Class<T> elementType, EClass elementEClass, EditingDomain domain, AdapterFactory adapterFactory)
{
super(Directory.class, SecurityPackage.Literals.DIRECTORY, domain, adapterFactory);
-
this.elementType = elementType;
this.elementEClass = elementEClass;
}
@@ -136,14 +134,13 @@ public abstract class TableSection<T extends EObject> extends AbstractSectionPar
protected void addFilters(TableViewer viewer)
{
viewer.addFilter(createTypeFilter(elementEClass));
- SecurityModelUtil.applyDefaultFilters(viewer, elementEClass);
+ SecurityUIUtil.applyDefaultFilters(viewer, elementEClass);
}
protected ViewerFilter createTypeFilter(final EClassifier type)
{
return new ViewerFilter()
{
-
@Override
public boolean select(Viewer viewer, Object parentElement, Object element)
{
@@ -164,9 +161,7 @@ public abstract class TableSection<T extends EObject> extends AbstractSectionPar
{
// It's my directory
boolean result = super.setFormInput(input);
-
checkForUnsupportedModelContent();
-
return result;
}
else if (input instanceof Realm)
@@ -179,7 +174,7 @@ public abstract class TableSection<T extends EObject> extends AbstractSectionPar
protected Directory getDirectory(Realm realm)
{
- return SecurityModelUtil.getDirectory(realm, elementEClass);
+ return SecurityUIUtil.getDirectory(realm, elementEClass);
}
@Override
@@ -203,8 +198,9 @@ public abstract class TableSection<T extends EObject> extends AbstractSectionPar
mgr.update(true);
section.setTextClient(toolbar);
- new ActionBarsHelper(getEditorActionBars()).addGlobalAction(ActionFactory.DELETE.getId(), deleteAction).install(
- viewer);
+ ActionBarsHelper actionBarsHelper = new ActionBarsHelper(getEditorActionBars());
+ ActionBarsHelper globalAction = actionBarsHelper.addGlobalAction(ActionFactory.DELETE.getId(), deleteAction);
+ globalAction.install(viewer);
}
protected IAction createAddNewAction()
@@ -228,7 +224,6 @@ public abstract class TableSection<T extends EObject> extends AbstractSectionPar
getEditingDomain().getCommandStack().execute(command);
viewer.getControl().getDisplay().asyncExec(new Runnable()
{
-
public void run()
{
viewer.getControl().setFocus();
@@ -273,7 +268,7 @@ public abstract class TableSection<T extends EObject> extends AbstractSectionPar
@Override
protected boolean updateSelection(IStructuredSelection selection)
{
- return super.updateSelection(selection) && SecurityModelUtil.isEditable(getInput());
+ return super.updateSelection(selection) && SecurityUIUtil.isEditable(getInput());
}
};
}
@@ -287,7 +282,6 @@ public abstract class TableSection<T extends EObject> extends AbstractSectionPar
{
viewer.addSelectionChangedListener(new ISelectionChangedListener()
{
-
public void selectionChanged(SelectionChangedEvent event)
{
IManagedForm form = getManagedForm();
@@ -330,7 +324,6 @@ public abstract class TableSection<T extends EObject> extends AbstractSectionPar
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);
@@ -393,7 +386,6 @@ public abstract class TableSection<T extends EObject> extends AbstractSectionPar
protected boolean execute(Command command)
{
boolean result = command.canExecute();
-
if (result)
{
getEditingDomain().getCommandStack().execute(command);
diff --git a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/UserDetailsPage.java b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/UserDetailsPage.java
index fc22b6af6f..b00d5af3c5 100644
--- a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/UserDetailsPage.java
+++ b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/UserDetailsPage.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Christian W. Damus (CEA LIST) - initial API and implementation
*/
@@ -30,12 +30,11 @@ import org.eclipse.ui.forms.widgets.FormToolkit;
/**
* Details page for selected {@link User} master objects.
- *
+ *
* @author Christian W. Damus (CEA LIST)
*/
public class UserDetailsPage extends AbstractDetailsPage<User>
{
-
public UserDetailsPage(EditingDomain domain, AdapterFactory adapterFactory)
{
super(User.class, SecurityPackage.Literals.USER, domain, adapterFactory);
@@ -80,7 +79,6 @@ public class UserDetailsPage extends AbstractDetailsPage<User>
{
new Job(Messages.UserDetailsPage_9)
{
-
@Override
public IStatus run(IProgressMonitor monitor)
{
diff --git a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/UsersSection.java b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/UsersSection.java
index 652cb9d7ed..191448184b 100644
--- a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/UsersSection.java
+++ b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/UsersSection.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Christian W. Damus (CEA LIST) - initial API and implementation
*/
@@ -23,12 +23,11 @@ import org.eclipse.emf.edit.domain.EditingDomain;
/**
* The section form part presenting the {@link User}s defined in the security realm.
- *
+ *
* @author Christian W. Damus (CEA LIST)
*/
public class UsersSection extends TableSection<User>
{
-
public UsersSection(EditingDomain domain, AdapterFactory adapterFactory)
{
super(User.class, SecurityPackage.Literals.USER, domain, adapterFactory);
@@ -43,17 +42,16 @@ public class UsersSection extends TableSection<User>
@Override
protected EReference getDropReference(EObject target, EObject objectToDrop)
{
- EReference result = null;
-
if (objectToDrop instanceof Group)
{
- result = SecurityPackage.Literals.USER__GROUPS;
+ return SecurityPackage.Literals.USER__GROUPS;
}
- else if (objectToDrop instanceof Role)
+
+ if (objectToDrop instanceof Role)
{
- result = SecurityPackage.Literals.ASSIGNEE__ROLES;
+ return SecurityPackage.Literals.ASSIGNEE__ROLES;
}
- return result;
+ return null;
}
}
diff --git a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/handlers/ManageSecurityHandler.java b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/handlers/ManageSecurityHandler.java
index b0e5cdf15c..e46f597376 100644
--- a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/handlers/ManageSecurityHandler.java
+++ b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/handlers/ManageSecurityHandler.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Christian W. Damus (CEA LIST) - initial API and implementation
*/
@@ -42,12 +42,11 @@ import java.util.Set;
* "Manage Security" command handler, which opens the Security Manager editor
* in the context of the currently selected {@link CDOSession}, with the help
* of an optional {@link ISecurityManagementContext} adapter.
- *
+ *
* @author Christian W. Damus (CEA LIST)
*/
public class ManageSecurityHandler extends AbstractHandler
{
-
public ManageSecurityHandler()
{
}
@@ -125,33 +124,27 @@ public class ManageSecurityHandler extends AbstractHandler
IEditorPart findEditor(IWorkbenchPage page, CDOSession session)
{
- IEditorPart result = null;
-
for (IEditorReference next : page.getEditorReferences())
{
if (CDOSecurityFormEditor.ID.equals(next.getId()))
{
IEditorPart candidate = next.getEditor(false);
-
if (candidate != null)
{
IEditorInput input = candidate.getEditorInput();
-
if (input instanceof CDOEditorInput)
{
CDOView view = ((CDOEditorInput)input).getView();
-
if (view != null && !view.isClosed() && session.equals(view.getSession()))
{
- result = candidate;
- break;
+ return candidate;
}
}
}
}
}
- return result;
+ return null;
}
ISecurityManagementContext getContext(ExecutionEvent event)
@@ -175,10 +168,8 @@ public class ManageSecurityHandler extends AbstractHandler
private void hookCloseListener(final IEditorPart editor, final ISecurityManagementContext context, final CDOView view)
{
final IWorkbenchPage page = editor.getSite().getPage();
-
page.addPartListener(new IPartListener()
{
-
private final IEditorInput input = editor.getEditorInput();
private final Set<IEditorPart> openEditors = new java.util.HashSet<IEditorPart>();
diff --git a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/handlers/ResetPasswordHandler.java b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/handlers/ResetPasswordHandler.java
index d3855de3b2..a3d316fc14 100644
--- a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/handlers/ResetPasswordHandler.java
+++ b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/handlers/ResetPasswordHandler.java
@@ -24,7 +24,7 @@ import org.eclipse.jface.viewers.ISelection;
/**
* Administrative password reset command handler on users in the security model.
- *
+ *
* @author Christian W. Damus (CEA LIST)
*/
public class ResetPasswordHandler extends LongRunningHandler
@@ -55,7 +55,6 @@ public class ResetPasswordHandler extends LongRunningHandler
private boolean canWrite(CDOObject object)
{
CDOView view = object.cdoView();
-
return (view == null || !view.isReadOnly()) && object.cdoPermission().isWritable();
}
}
diff --git a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/util/ActionBarsHelper.java b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/util/ActionBarsHelper.java
index a41bd111e7..9eaecb619e 100644
--- a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/util/ActionBarsHelper.java
+++ b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/util/ActionBarsHelper.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Christian W. Damus (CEA LIST) - initial API and implementation
*/
@@ -27,7 +27,7 @@ import java.util.Map;
/**
* A utility that manages the propagation of global actions from
* some nested part of an editor to the editor's action bars.
- *
+ *
* @author Christian W. Damus (CEA LIST)
*/
public class ActionBarsHelper
@@ -63,7 +63,6 @@ public class ActionBarsHelper
{
control.addFocusListener(new FocusListener()
{
-
public void focusLost(FocusEvent e)
{
unsetGlobalActions();
@@ -91,6 +90,7 @@ public class ActionBarsHelper
{
selectionEvent = new SelectionChangedEvent(selectionProvider, selectionProvider.getSelection());
}
+
((ISelectionChangedListener)next).selectionChanged(selectionEvent);
}
}
@@ -100,7 +100,6 @@ public class ActionBarsHelper
control.addDisposeListener(new DisposeListener()
{
-
public void widgetDisposed(DisposeEvent e)
{
globalActions.clear();
@@ -128,6 +127,7 @@ public class ActionBarsHelper
{
bars.setGlobalActionHandler(next.getKey(), next.getValue());
}
+
previousActions.clear();
}
}
diff --git a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/util/EditableDialogCellEditor.java b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/util/EditableDialogCellEditor.java
index 78610e928b..ab06c75dab 100644
--- a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/util/EditableDialogCellEditor.java
+++ b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/util/EditableDialogCellEditor.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Christian W. Damus (CEA LIST) - initial API and implementation
*/
@@ -23,12 +23,11 @@ import java.text.MessageFormat;
/**
* A dialog cell editor in which the text field is editable: the user
* can directly edit the value without opening the dialog.
- *
+ *
* @author Christian W. Damus (CEA LIST)
*/
public abstract class EditableDialogCellEditor extends DialogCellEditor
{
-
private Text text;
public EditableDialogCellEditor()
@@ -68,6 +67,7 @@ public abstract class EditableDialogCellEditor extends DialogCellEditor
{
setErrorMessage(MessageFormat.format(getErrorMessage(), new Object[] { newValue.toString() }));
}
+
fireApplyEditorValue();
deactivate();
}
@@ -87,5 +87,4 @@ public abstract class EditableDialogCellEditor extends DialogCellEditor
{
text.setFocus();
}
-
}
diff --git a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/util/ObjectExistsConverter.java b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/util/ObjectExistsConverter.java
index 7aa0566ccd..93be55d7d1 100644
--- a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/util/ObjectExistsConverter.java
+++ b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/util/ObjectExistsConverter.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Christian W. Damus (CEA LIST) - initial API and implementation
*/
@@ -17,12 +17,11 @@ import org.eclipse.core.databinding.conversion.Converter;
* A data-binding converter that converts an object (a reference or {@code null})
* to a boolean indicating the presence of the object ({@code true} for a present
* object, {@code false} for a {@code null}).
- *
+ *
* @author Christian W. Damus (CEA LIST)
*/
public class ObjectExistsConverter extends Converter
{
-
public ObjectExistsConverter()
{
super(Object.class, Boolean.class);
@@ -38,10 +37,6 @@ public class ObjectExistsConverter extends Converter
return fromObject != null;
}
- //
- // Nested types
- //
-
// public static UpdateValueStrategy createUpdateValueStrategy()
// {
// UpdateValueStrategy result = new UpdateValueStrategy();
@@ -49,12 +44,15 @@ public class ObjectExistsConverter extends Converter
// return result;
// }
+ /**
+ * @author Christian W. Damus (CEA LIST)
+ */
public static class ObjectWritableConverter extends ObjectExistsConverter
{
@Override
protected boolean doConvert(Object fromObject)
{
- return super.doConvert(fromObject) && SecurityModelUtil.isEditable(fromObject);
+ return super.doConvert(fromObject) && SecurityUIUtil.isEditable(fromObject);
}
public static UpdateValueStrategy createUpdateValueStrategy()
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 4f65c709e0..e4ecba0523 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
@@ -4,14 +4,14 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Christian W. Damus (CEA LIST) - initial API and implementation
*/
package org.eclipse.emf.cdo.security.internal.ui.util;
-import static org.eclipse.emf.cdo.security.internal.ui.util.SecurityModelUtil.applyTypeFilter;
-import static org.eclipse.emf.cdo.security.internal.ui.util.SecurityModelUtil.viewerFilter;
+import static org.eclipse.emf.cdo.security.internal.ui.util.SecurityUIUtil.applyTypeFilter;
+import static org.eclipse.emf.cdo.security.internal.ui.util.SecurityUIUtil.getViewerFilter;
import org.eclipse.emf.cdo.security.Directory;
import org.eclipse.emf.cdo.security.Realm;
@@ -81,12 +81,11 @@ import java.util.List;
/**
* An encapsulation of a block of controls in a form that edits a one-to-many
* reference in the security model.
- *
+ *
* @author Christian W. Damus (CEA LIST)
*/
public class OneToManyBlock
{
-
private final EditingDomain domain;
private final AdapterFactory adapterFactory;
@@ -114,7 +113,6 @@ public class OneToManyBlock
public OneToManyBlock(DataBindingContext context, EditingDomain domain, AdapterFactory adapterFactory,
EReference reference, EClass itemType)
{
-
this(context, domain, adapterFactory, new OneToManyConfiguration(reference, itemType));
}
@@ -180,14 +178,15 @@ public class OneToManyBlock
}
viewer.setContentProvider(new ObservableListContentProvider());
- SecurityModelUtil.applyDefaultFilters(viewer, itemType);
+ SecurityUIUtil.applyDefaultFilters(viewer, itemType);
if (itemType != reference.getEReferenceType())
{
applyTypeFilter(viewer, itemType);
}
+
if (getConfiguration().getItemFilter() != null)
{
- viewer.addFilter(viewerFilter(getConfiguration().getItemFilter()));
+ viewer.addFilter(getViewerFilter(getConfiguration().getItemFilter()));
}
viewer.setInput(value);
@@ -215,6 +214,7 @@ public class OneToManyBlock
{
addButton = toolkit.createButton(buttons, Messages.OneToManyBlock_1, SWT.PUSH);
}
+
removeButton = toolkit.createButton(buttons, Messages.OneToManyBlock_2, SWT.PUSH);
final IObservableValue selection = ViewersObservables.observeSingleSelection(viewer);
@@ -226,6 +226,7 @@ public class OneToManyBlock
context.bindValue(SWTObservables.observeEnabled(addButton), input, null,
ObjectWritableConverter.createUpdateValueStrategy());
}
+
context.bindValue(SWTObservables.observeEnabled(removeButton), selection, null,
ObjectWritableConverter.createUpdateValueStrategy());
@@ -243,7 +244,7 @@ public class OneToManyBlock
}
else
{
- owner = SecurityModelUtil.getDirectory(realm, itemType);
+ owner = SecurityUIUtil.getDirectory(realm, itemType);
}
if (owner != null)
@@ -292,20 +293,22 @@ public class OneToManyBlock
public void widgetSelected(SelectionEvent e)
{
Realm realm = ((SecurityItem)input.getValue()).getRealm();
- Directory directory = SecurityModelUtil.getDirectory(realm, itemType);
+ Directory directory = SecurityUIUtil.getDirectory(realm, itemType);
if (directory != null)
{
// Get the available items not already in our input's reference list
List<?> available = new java.util.ArrayList<Object>(EcoreUtil.getObjectsByType(directory.getItems(),
itemType));
available.removeAll(value);
- SecurityModelUtil.applyDefaultFilters(available, itemType);
+ SecurityUIUtil.applyDefaultFilters(available, itemType);
String label = NLS.bind(Messages.OneToManyBlock_3, SecurityEditPlugin.INSTANCE.getString(String.format(
"_UI_%s_%s_feature", reference.getEContainingClass().getName(), reference.getName()))); //$NON-NLS-1$
+
FeatureEditorDialog dlg = new FeatureEditorDialog(viewer.getControl().getShell(), new TableLabelProvider(
adapterFactory), input.getValue(), reference.getEContainingClass(), Collections.EMPTY_LIST, label,
available, false, true, true);
+
if (dlg.open() == Window.OK && !dlg.getResult().isEmpty())
{
Command command = AddCommand.create(domain, input.getValue(), reference, dlg.getResult());
@@ -347,9 +350,10 @@ public class OneToManyBlock
@Override
protected boolean updateSelection(IStructuredSelection selection)
{
- return super.updateSelection(selection) && SecurityModelUtil.isEditable(input.getValue());
+ return super.updateSelection(selection) && SecurityUIUtil.isEditable(input.getValue());
}
};
+
removeButton.addSelectionListener(new SelectionAdapter()
{
@Override
@@ -361,6 +365,7 @@ public class OneToManyBlock
}
}
});
+
viewer.addSelectionChangedListener(removeAction);
new ActionBarsHelper(editorActionBars).addGlobalAction(ActionFactory.DELETE.getId(), removeAction).install(viewer);
@@ -379,6 +384,7 @@ public class OneToManyBlock
{
viewer.setInput(null);
}
+
value.dispose();
}
@@ -516,13 +522,9 @@ public class OneToManyBlock
});
}
- //
- // Nested types
- //
-
/**
* Specification of the configuration of a one-to-many block's contents.
- *
+ *
* @author Christian W. Damus (CEA LIST)
*/
public static interface IOneToManyConfiguration
@@ -536,7 +538,7 @@ public class OneToManyBlock
/**
* Default one-to-many block configuration implementation.
- *
+ *
* @author Christian W. Damus (CEA LIST)
*/
public static class OneToManyConfiguration implements IOneToManyConfiguration
diff --git a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/util/OneToManyTableBlock.java b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/util/OneToManyTableBlock.java
index 64e1e39f82..747c4ed47e 100644
--- a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/util/OneToManyTableBlock.java
+++ b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/util/OneToManyTableBlock.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Christian W. Damus (CEA LIST) - initial API and implementation
*/
@@ -30,12 +30,11 @@ import org.eclipse.swt.SWT;
* A specialization of the encapsulated UI for one-to-many reference
* editing that presents a table with multiple columns and in-line
* editing support.
- *
+ *
* @author Christian W. Damus (CEA LIST)
*/
public class OneToManyTableBlock extends OneToManyBlock
{
-
public OneToManyTableBlock(DataBindingContext context, EditingDomain domain, AdapterFactory adapterFactory,
ITableConfiguration tableConfig)
{
@@ -81,7 +80,6 @@ public class OneToManyTableBlock extends OneToManyBlock
column.setEditingSupport(new EditingSupport(viewer)
{
-
@Override
protected void setValue(Object element, Object value)
{
@@ -109,14 +107,10 @@ public class OneToManyTableBlock extends OneToManyBlock
}
}
- //
- // Nested types
- //
-
/**
* Specialized one-to-many configuration that describes a multiple
* column presentation with in-line editing support.
- *
+ *
* @author Christian W. Damus (CEA LIST)
*/
public static interface ITableConfiguration extends IOneToManyConfiguration
@@ -142,12 +136,11 @@ public class OneToManyTableBlock extends OneToManyBlock
/**
* Partial implementation of the table configuration interface.
- *
+ *
* @author Christian W. Damus (CEA LIST)
*/
public static abstract class TableConfiguration extends OneToManyConfiguration implements ITableConfiguration
{
-
public TableConfiguration(EReference reference, EClass itemType, IFilter filter)
{
super(reference, itemType, filter);
@@ -167,6 +160,5 @@ public class OneToManyTableBlock extends OneToManyBlock
{
super(reference);
}
-
}
}
diff --git a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/util/ResourceBasedPermissionFilter.java b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/util/ResourceBasedPermissionFilter.java
index e39ef5602c..c0d9507e74 100644
--- a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/util/ResourceBasedPermissionFilter.java
+++ b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/util/ResourceBasedPermissionFilter.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Christian W. Damus (CEA LIST) - initial API and implementation
*/
@@ -21,12 +21,11 @@ import org.eclipse.jface.viewers.IFilter;
/**
* A UI filter that selects {@link Permission}s that are
* resource-based permissions.
- *
+ *
* @author Christian W. Damus (CEA LIST)
*/
public class ResourceBasedPermissionFilter implements IFilter
{
-
public ResourceBasedPermissionFilter()
{
}
@@ -34,7 +33,6 @@ public class ResourceBasedPermissionFilter implements IFilter
public boolean select(Object element)
{
boolean result = element instanceof FilterPermission;
-
if (result)
{
FilterPermission perm = (FilterPermission)element;
@@ -43,6 +41,7 @@ public class ResourceBasedPermissionFilter implements IFilter
if (!isResourceFilter(filter))
{
result = false;
+ // TODO Should we break here?
}
}
}
@@ -53,7 +52,6 @@ public class ResourceBasedPermissionFilter implements IFilter
protected boolean isResourceFilter(PermissionFilter filter)
{
boolean result = filter instanceof ResourceFilter;
-
if (!result && filter instanceof CombinedFilter)
{
result = true; // Assume all permission filters are OK
diff --git a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/util/ResourceBasedRoleFilter.java b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/util/ResourceBasedRoleFilter.java
index ab208187f2..0ebd83db88 100644
--- a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/util/ResourceBasedRoleFilter.java
+++ b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/util/ResourceBasedRoleFilter.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Christian W. Damus (CEA LIST) - initial API and implementation
*/
@@ -18,12 +18,11 @@ import org.eclipse.jface.viewers.IFilter;
/**
* A UI filter that selects {@link Role}s that have only
* {@linkplain ResourceBasedPermissionFilter resource-based} permissions.
- *
+ *
* @author Christian W. Damus (CEA LIST)
*/
public class ResourceBasedRoleFilter implements IFilter
{
-
private final ResourceBasedPermissionFilter permFilter = new ResourceBasedPermissionFilter();
public ResourceBasedRoleFilter()
@@ -33,7 +32,6 @@ public class ResourceBasedRoleFilter implements IFilter
public boolean select(Object element)
{
boolean result = element instanceof Role;
-
if (result)
{
Role role = (Role)element;
@@ -42,6 +40,7 @@ public class ResourceBasedRoleFilter implements IFilter
if (!permFilter.select(next))
{
result = false;
+ // TODO Should we break here?
}
}
}
diff --git a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/util/SecurityModelUtil.java b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/util/SecurityUIUtil.java
index e6a19a1f59..60bbca04bd 100644
--- a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/util/SecurityModelUtil.java
+++ b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/util/SecurityUIUtil.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Christian W. Damus (CEA LIST) - initial API and implementation
*/
@@ -31,14 +31,18 @@ import java.util.List;
/**
* Various static utilities for working with the security model.
- *
+ *
+ * TODO Are there methods in here that should be moved to, e.g., CDOUtil, SecurityManagerUtil, UIUtil, etc?
+ *
* @author Christian W. Damus (CEA LIST)
*/
-public class SecurityModelUtil
+public final class SecurityUIUtil
{
+ private static final IFilter[] RESOURCE_BASED_ROLE_FILTERS = { new ResourceBasedRoleFilter() };
- // Not instantiable by clients
- private SecurityModelUtil()
+ private static final IFilter[] NO_FILTERS = new IFilter[0];
+
+ private SecurityUIUtil()
{
}
@@ -77,18 +81,12 @@ public class SecurityModelUtil
private static IFilter[] getDefaultFilters(EClass itemType)
{
- IFilter[] result;
-
if (itemType == SecurityPackage.Literals.ROLE)
{
- result = new IFilter[] { new ResourceBasedRoleFilter() };
- }
- else
- {
- result = new IFilter[0];
+ return RESOURCE_BASED_ROLE_FILTERS;
}
- return result;
+ return NO_FILTERS;
}
private static IFilter filter(EClass itemType)
@@ -99,13 +97,25 @@ public class SecurityModelUtil
{
public boolean select(Object toTest)
{
- boolean result = true;
-
- for (int i = 0; i < filters.length && result; i++)
+ // boolean result = true;
+ //
+ // for (int i = 0; i < filters.length && result; i++)
+ // {
+ // result = filters[i].select(toTest);
+ // }
+ //
+ // return result;
+
+ // TODO I generally don't like array iterations with extra conditions. Isn't this easier to recognize?
+ for (int i = 0; i < filters.length; i++)
{
- result = filters[i].select(toTest);
+ if (!filters[i].select(toTest))
+ {
+ return false;
+ }
}
- return result;
+
+ return true;
}
};
}
@@ -117,17 +127,16 @@ public class SecurityModelUtil
ViewerFilter[] result = new ViewerFilter[filters.length];
for (int i = 0; i < filters.length; i++)
{
- result[i] = viewerFilter(filters[i]);
+ result[i] = getViewerFilter(filters[i]);
}
return Arrays.asList(result);
}
- public static ViewerFilter viewerFilter(final IFilter filter)
+ public static ViewerFilter getViewerFilter(final IFilter filter)
{
return new ViewerFilter()
{
-
@Override
public boolean select(Viewer viewer, Object parentElement, Object element)
{
@@ -166,7 +175,6 @@ public class SecurityModelUtil
{
viewer.addFilter(new ViewerFilter()
{
-
@Override
public boolean select(Viewer viewer, Object parentElement, Object element)
{
@@ -177,13 +185,15 @@ public class SecurityModelUtil
public static boolean isEditable(Object object)
{
+ // TODO What about "unmanaged" EObjects?
+ // TODO What about managed legacy objects? --> CDOUtil.getCDOObject()?
return object instanceof CDOObject && isEditable((CDOObject)object);
}
public static boolean isEditable(CDOObject object)
{
+ // TODO What about object.cdoPermission()?
CDOView view = object.cdoView();
return view == null || !view.isReadOnly();
}
-
}
diff --git a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/util/TableLabelProvider.java b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/util/TableLabelProvider.java
index 3e14b2544c..6a1728997a 100644
--- a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/util/TableLabelProvider.java
+++ b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/util/TableLabelProvider.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Christian W. Damus (CEA LIST) - initial API and implementation
*/
@@ -20,12 +20,11 @@ import org.eclipse.swt.graphics.Image;
* An {@link AdapterFactory}-based table label provider that defaults
* {@linkplain #defaultColumnIndex() some column}'s labels to the
* object's {@link IItemLabelProvider}.
- *
+ *
* @author Christian W. Damus (CEA LIST)
*/
public class TableLabelProvider extends AdapterFactoryLabelProvider
{
-
private int defaultColumnIndex;
public TableLabelProvider(AdapterFactory adapterFactory)
@@ -55,5 +54,4 @@ public class TableLabelProvider extends AdapterFactoryLabelProvider
{
return columnIndex == defaultColumnIndex ? getImage(object) : super.getColumnImage(object, columnIndex);
}
-
}
diff --git a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/ui/ISecurityManagementContext.java b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/ui/ISecurityManagementContext.java
index 492d95a16c..aa070035ce 100644
--- a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/ui/ISecurityManagementContext.java
+++ b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/ui/ISecurityManagementContext.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Christian W. Damus (CEA LIST) - initial API and implementation
*/
@@ -22,19 +22,18 @@ import org.eclipse.core.runtime.IAdaptable;
/**
* An optional security-management context that may be provided as an {@linkplain IAdaptable adapter}
* by the view part to which the "Manage Security" command is contributed.
- *
+ *
* @author Christian W. Damus (CEA LIST)
*/
public interface ISecurityManagementContext
{
-
public static final ISecurityManagementContext DEFAULT = new Default();
/**
* Obtains a view in which to open the security resource for editing. If at all possible, this
* should be a writable {@linkplain CDOTransaction transaction}. If necessary, implementors are
* welcome to open a new session logged in as the Administrator for this purpose.
- *
+ *
* @see #getSecurityResource(CDOView)
* @see #disconnect(CDOView)
*/
@@ -44,7 +43,7 @@ public interface ISecurityManagementContext
* Releases a {@code view} previously {@linkplain #connect(CDOSession) obtained} from this context.
* The caller must not attempt to use the {@code view} after this point because in all likelihood
* it will be closed.
- *
+ *
* @see #connect(CDOSession)
*/
public void disconnect(CDOView view);
@@ -55,10 +54,9 @@ public interface ISecurityManagementContext
*/
public CDOResource getSecurityResource(CDOView view);
- //
- // Nested types
- //
-
+ /**
+ * @author Christian W. Damus (CEA LIST)
+ */
public static class Default implements ISecurityManagementContext
{
public CDOView connect(CDOSession session)
@@ -67,10 +65,12 @@ public interface ISecurityManagementContext
{
return null;
}
+
if (User.ADMINISTRATOR.equals(session.getUserID()))
{
return session.openTransaction();
}
+
return session.openView();
}

Back to the top