Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui')
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/AsyncContentProvider.java346
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/CDOEditorInputImpl.java302
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/CDOPropertyAdapterFactory.java96
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/ItemsProcessor.java218
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/LegacyModeRegistry.java90
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/AbstractContainerAction.java76
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/AbstractLockObjectsAction.java254
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/AbstractOpenViewAction.java68
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ChangePassiveUpdateAction.java180
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CloseSessionAction.java114
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CloseViewAction.java112
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CommitTransactionAction.java80
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CreateBranchAction.java252
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CreateResourceNodeAction.java238
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/DisableViewDurabilityAction.java78
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/EditingDomainAction.java150
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/EnableViewDurabilityAction.java108
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ExportResourceAction.java224
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ImportResourceAction.java218
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ImportRootsAction.java256
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/LoadResourceAction.java132
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ManagePackagesAction.java94
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenAuditAction.java114
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenDurableViewAction.java130
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenResourceEditorAction.java86
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenTransactionAction.java92
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenViewAction.java80
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenViewEditorAction.java80
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ReadLockObjectsAction.java76
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RegisterFilesystemPackagesAction.java166
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RegisterGeneratedPackagesAction.java188
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RegisterPackagesAction.java220
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RegisterSinglePackageAction.java154
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RegisterWorkspacePackagesAction.java150
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ReloadObjectsAction.java176
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ReloadViewAction.java86
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RemoveAllContainerItemAction.java84
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RemoveContainerItemAction.java138
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ResourceNodeAction.java76
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ResourceNodeNameInputValidator.java128
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RollbackTransactionAction.java106
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/SessionAction.java74
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/SwitchTargetAction.java178
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ToggleLegacyModeDefaultAction.java86
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ViewAction.java94
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/WriteLockObjectsAction.java76
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/OM.java148
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/BulkAddDialog.java370
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/ExportResourceDialog.java210
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/ImportResourceDialog.java210
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenAuditDialog.java204
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenDurableViewDialog.java178
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenResourcesDialog.java58
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenSessionDialog.java150
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/PackageRegistryDialog.java688
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/RollbackTransactionDialog.java230
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/SelectBranchPointDialog.java538
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/SelectPackageDialog.java394
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dnd/CDOObjectDropAdapter.java184
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOActionBarContributor.java1446
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/PluginDelegator.java234
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/filters/CDOObjectFilter.java96
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/filters/CDOStateFilter.java198
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/messages/Messages.java82
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/messages/messages.properties412
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/perspectives/CDOExplorerPerspective.java180
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/preferences/CDOPreferencePage.java254
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/preferences/CDOUIPreferencePage.java204
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDORemoteSessionsView.java354
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOWatchListView.java1948
70 files changed, 7747 insertions, 7747 deletions
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/AsyncContentProvider.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/AsyncContentProvider.java
index a9adbca767..0e6417d539 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/AsyncContentProvider.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/AsyncContentProvider.java
@@ -1,173 +1,173 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.emf.cdo.internal.ui;
-
-import org.eclipse.emf.cdo.CDOObject;
-import org.eclipse.emf.cdo.CDOState;
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.WeakHashMap;
-
-/**
- * @author Eike Stepper
- * @since 3.0
- */
-@Deprecated
-public class AsyncContentProvider implements ITreeContentProvider
-{
- private static final Object[] NO_CHILDREN = {};
-
- private ITreeContentProvider delegate;
-
- private WeakHashMap<Object, LoadJob> loadJobs = new WeakHashMap<Object, LoadJob>();
-
- public AsyncContentProvider(ITreeContentProvider delegate)
- {
- this.delegate = delegate;
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
- {
- delegate.inputChanged(viewer, oldInput, newInput);
- }
-
- public void dispose()
- {
- delegate.dispose();
- }
-
- public final Object[] getElements(Object inputElement)
- {
- return getChildren(inputElement);
- }
-
- public Object[] getChildren(Object parentElement)
- {
- if (parentElement instanceof LoadJob)
- {
- return NO_CHILDREN;
- }
-
- if (parentElement instanceof CDOObject)
- {
- CDOObject object = (CDOObject)parentElement;
- if (object.cdoState() == CDOState.PROXY)
- {
- LoadJob loadJob = getLoadJob(parentElement);
- return loadJob.getChildren();
- }
- }
-
- return delegate.getChildren(parentElement);
- }
-
- public boolean hasChildren(Object parentElement)
- {
- if (parentElement instanceof LoadJob)
- {
- return false;
- }
-
- if (parentElement instanceof CDOObject)
- {
- CDOObject object = (CDOObject)parentElement;
- if (object.cdoState() == CDOState.PROXY)
- {
- LoadJob loadJob = getLoadJob(parentElement);
- return loadJob.hasChildren();
- }
- }
-
- return delegate.hasChildren(parentElement);
- }
-
- public Object getParent(Object element)
- {
- if (element instanceof LoadJob)
- {
- LoadJob loadJob = (LoadJob)element;
- return loadJob.getParent();
- }
-
- if (element instanceof CDOObject)
- {
- CDOObject object = (CDOObject)element;
- if (object.cdoState() == CDOState.PROXY)
- {
- LoadJob loadJob = getLoadJob(element);
- return loadJob.getParent();
- }
- }
-
- return delegate.getParent(element);
- }
-
- private synchronized LoadJob getLoadJob(Object parentElement)
- {
- LoadJob loadJob = loadJobs.get(parentElement);
- if (loadJob == null)
- {
- loadJob = new LoadJob(parentElement);
- loadJobs.put(parentElement, loadJob);
- new Thread(loadJob).start();
- }
-
- return loadJob;
- }
-
- /**
- * @author Eike Stepper
- */
- private final class LoadJob implements Runnable
- {
- private Object parent;
-
- private List<Object> children = new ArrayList<Object>();
-
- public LoadJob(Object parent)
- {
- this.parent = parent;
- }
-
- public Object getParent()
- {
- return parent;
- }
-
- public Object[] getChildren()
- {
- synchronized (children)
- {
- return children.toArray(new Object[children.size()]);
- }
- }
-
- public boolean hasChildren()
- {
- return false;
- }
-
- public void run()
- {
- }
-
- @Override
- public String toString()
- {
- return Messages.getString("AsyncContentProvider_0"); //$NON-NLS-1$
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.internal.ui;
+
+import org.eclipse.emf.cdo.CDOObject;
+import org.eclipse.emf.cdo.CDOState;
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.WeakHashMap;
+
+/**
+ * @author Eike Stepper
+ * @since 3.0
+ */
+@Deprecated
+public class AsyncContentProvider implements ITreeContentProvider
+{
+ private static final Object[] NO_CHILDREN = {};
+
+ private ITreeContentProvider delegate;
+
+ private WeakHashMap<Object, LoadJob> loadJobs = new WeakHashMap<Object, LoadJob>();
+
+ public AsyncContentProvider(ITreeContentProvider delegate)
+ {
+ this.delegate = delegate;
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
+ {
+ delegate.inputChanged(viewer, oldInput, newInput);
+ }
+
+ public void dispose()
+ {
+ delegate.dispose();
+ }
+
+ public final Object[] getElements(Object inputElement)
+ {
+ return getChildren(inputElement);
+ }
+
+ public Object[] getChildren(Object parentElement)
+ {
+ if (parentElement instanceof LoadJob)
+ {
+ return NO_CHILDREN;
+ }
+
+ if (parentElement instanceof CDOObject)
+ {
+ CDOObject object = (CDOObject)parentElement;
+ if (object.cdoState() == CDOState.PROXY)
+ {
+ LoadJob loadJob = getLoadJob(parentElement);
+ return loadJob.getChildren();
+ }
+ }
+
+ return delegate.getChildren(parentElement);
+ }
+
+ public boolean hasChildren(Object parentElement)
+ {
+ if (parentElement instanceof LoadJob)
+ {
+ return false;
+ }
+
+ if (parentElement instanceof CDOObject)
+ {
+ CDOObject object = (CDOObject)parentElement;
+ if (object.cdoState() == CDOState.PROXY)
+ {
+ LoadJob loadJob = getLoadJob(parentElement);
+ return loadJob.hasChildren();
+ }
+ }
+
+ return delegate.hasChildren(parentElement);
+ }
+
+ public Object getParent(Object element)
+ {
+ if (element instanceof LoadJob)
+ {
+ LoadJob loadJob = (LoadJob)element;
+ return loadJob.getParent();
+ }
+
+ if (element instanceof CDOObject)
+ {
+ CDOObject object = (CDOObject)element;
+ if (object.cdoState() == CDOState.PROXY)
+ {
+ LoadJob loadJob = getLoadJob(element);
+ return loadJob.getParent();
+ }
+ }
+
+ return delegate.getParent(element);
+ }
+
+ private synchronized LoadJob getLoadJob(Object parentElement)
+ {
+ LoadJob loadJob = loadJobs.get(parentElement);
+ if (loadJob == null)
+ {
+ loadJob = new LoadJob(parentElement);
+ loadJobs.put(parentElement, loadJob);
+ new Thread(loadJob).start();
+ }
+
+ return loadJob;
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ private final class LoadJob implements Runnable
+ {
+ private Object parent;
+
+ private List<Object> children = new ArrayList<Object>();
+
+ public LoadJob(Object parent)
+ {
+ this.parent = parent;
+ }
+
+ public Object getParent()
+ {
+ return parent;
+ }
+
+ public Object[] getChildren()
+ {
+ synchronized (children)
+ {
+ return children.toArray(new Object[children.size()]);
+ }
+ }
+
+ public boolean hasChildren()
+ {
+ return false;
+ }
+
+ public void run()
+ {
+ }
+
+ @Override
+ public String toString()
+ {
+ return Messages.getString("AsyncContentProvider_0"); //$NON-NLS-1$
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/CDOEditorInputImpl.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/CDOEditorInputImpl.java
index 0a336f4f97..7f2bec8873 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/CDOEditorInputImpl.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/CDOEditorInputImpl.java
@@ -1,151 +1,151 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- * Victor Roldan Betancort - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui;
-
-import org.eclipse.emf.cdo.common.util.CDOCommonUtil;
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-import org.eclipse.emf.cdo.session.CDOSession;
-import org.eclipse.emf.cdo.ui.CDOEditorInput;
-import org.eclipse.emf.cdo.ui.CDOItemProvider;
-import org.eclipse.emf.cdo.view.CDOView;
-
-import org.eclipse.net4j.util.ObjectUtil;
-
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.IPersistableElement;
-
-/**
- * @author Eike Stepper
- * @since 2.0
- */
-public class CDOEditorInputImpl extends PlatformObject implements CDOEditorInput
-{
- private CDOView view;
-
- private boolean viewOwned;
-
- private String resourcePath;
-
- public CDOEditorInputImpl(CDOView view, String resourcePath)
- {
- this(view, resourcePath, false);
- }
-
- public CDOEditorInputImpl(CDOView view, String resourcePath, boolean viewOwned)
- {
- this.view = view;
- this.viewOwned = viewOwned;
- this.resourcePath = resourcePath;
- }
-
- public CDOView getView()
- {
- return view;
- }
-
- public boolean isViewOwned()
- {
- return viewOwned;
- }
-
- public String getResourcePath()
- {
- return resourcePath;
- }
-
- public boolean exists()
- {
- return true;
- }
-
- public ImageDescriptor getImageDescriptor()
- {
- return CDOItemProvider.getViewImageDescriptor(view);
- }
-
- public String getName()
- {
- if (resourcePath != null)
- {
- return new Path(resourcePath).lastSegment();
- }
-
- return view.getSession().getRepositoryInfo().getName();
- }
-
- public IPersistableElement getPersistable()
- {
- return null;
- }
-
- public String getToolTipText()
- {
- if (view.isClosed())
- {
- return Messages.getString("CDOEditorInputImpl.0"); //$NON-NLS-1$
- }
-
- CDOSession session = view.getSession();
- String repositoryName = session.getRepositoryInfo().getName();
-
- StringBuilder builder = new StringBuilder();
- builder.append(repositoryName);
- if (resourcePath != null)
- {
- builder.append(resourcePath);
- }
-
- builder.append(" ["); //$NON-NLS-1$
- builder.append(session.getSessionID());
- builder.append(":"); //$NON-NLS-1$
- builder.append(view.getViewID());
- builder.append("]"); //$NON-NLS-1$
-
- if (view.isReadOnly())
- {
- builder.append(" readonly"); //$NON-NLS-1$
- }
-
- long timeStamp = view.getTimeStamp();
- if (timeStamp != CDOView.UNSPECIFIED_DATE)
- {
- builder.append(CDOCommonUtil.formatTimeStamp(timeStamp));
- }
-
- return builder.toString();
- }
-
- @Override
- public int hashCode()
- {
- return ObjectUtil.hashCode(view) ^ ObjectUtil.hashCode(resourcePath);
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- {
- return true;
- }
-
- if (obj instanceof CDOEditorInputImpl)
- {
- CDOEditorInputImpl that = (CDOEditorInputImpl)obj;
- return ObjectUtil.equals(view, that.view) && ObjectUtil.equals(resourcePath, that.resourcePath);
- }
-
- return false;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ * Victor Roldan Betancort - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui;
+
+import org.eclipse.emf.cdo.common.util.CDOCommonUtil;
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.ui.CDOEditorInput;
+import org.eclipse.emf.cdo.ui.CDOItemProvider;
+import org.eclipse.emf.cdo.view.CDOView;
+
+import org.eclipse.net4j.util.ObjectUtil;
+
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.PlatformObject;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.IPersistableElement;
+
+/**
+ * @author Eike Stepper
+ * @since 2.0
+ */
+public class CDOEditorInputImpl extends PlatformObject implements CDOEditorInput
+{
+ private CDOView view;
+
+ private boolean viewOwned;
+
+ private String resourcePath;
+
+ public CDOEditorInputImpl(CDOView view, String resourcePath)
+ {
+ this(view, resourcePath, false);
+ }
+
+ public CDOEditorInputImpl(CDOView view, String resourcePath, boolean viewOwned)
+ {
+ this.view = view;
+ this.viewOwned = viewOwned;
+ this.resourcePath = resourcePath;
+ }
+
+ public CDOView getView()
+ {
+ return view;
+ }
+
+ public boolean isViewOwned()
+ {
+ return viewOwned;
+ }
+
+ public String getResourcePath()
+ {
+ return resourcePath;
+ }
+
+ public boolean exists()
+ {
+ return true;
+ }
+
+ public ImageDescriptor getImageDescriptor()
+ {
+ return CDOItemProvider.getViewImageDescriptor(view);
+ }
+
+ public String getName()
+ {
+ if (resourcePath != null)
+ {
+ return new Path(resourcePath).lastSegment();
+ }
+
+ return view.getSession().getRepositoryInfo().getName();
+ }
+
+ public IPersistableElement getPersistable()
+ {
+ return null;
+ }
+
+ public String getToolTipText()
+ {
+ if (view.isClosed())
+ {
+ return Messages.getString("CDOEditorInputImpl.0"); //$NON-NLS-1$
+ }
+
+ CDOSession session = view.getSession();
+ String repositoryName = session.getRepositoryInfo().getName();
+
+ StringBuilder builder = new StringBuilder();
+ builder.append(repositoryName);
+ if (resourcePath != null)
+ {
+ builder.append(resourcePath);
+ }
+
+ builder.append(" ["); //$NON-NLS-1$
+ builder.append(session.getSessionID());
+ builder.append(":"); //$NON-NLS-1$
+ builder.append(view.getViewID());
+ builder.append("]"); //$NON-NLS-1$
+
+ if (view.isReadOnly())
+ {
+ builder.append(" readonly"); //$NON-NLS-1$
+ }
+
+ long timeStamp = view.getTimeStamp();
+ if (timeStamp != CDOView.UNSPECIFIED_DATE)
+ {
+ builder.append(CDOCommonUtil.formatTimeStamp(timeStamp));
+ }
+
+ return builder.toString();
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return ObjectUtil.hashCode(view) ^ ObjectUtil.hashCode(resourcePath);
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+
+ if (obj instanceof CDOEditorInputImpl)
+ {
+ CDOEditorInputImpl that = (CDOEditorInputImpl)obj;
+ return ObjectUtil.equals(view, that.view) && ObjectUtil.equals(resourcePath, that.resourcePath);
+ }
+
+ return false;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/CDOPropertyAdapterFactory.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/CDOPropertyAdapterFactory.java
index 80c2e083cc..9b4802d42e 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/CDOPropertyAdapterFactory.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/CDOPropertyAdapterFactory.java
@@ -1,48 +1,48 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.emf.cdo.internal.ui;
-
-import org.eclipse.emf.cdo.session.CDOSession;
-import org.eclipse.emf.cdo.view.CDOView;
-
-import org.eclipse.emf.internal.cdo.session.SessionProperties;
-import org.eclipse.emf.internal.cdo.view.ViewProperties;
-
-import org.eclipse.net4j.util.ui.AbstractPropertyAdapterFactory;
-import org.eclipse.net4j.util.ui.DefaultPropertySource;
-
-import org.eclipse.ui.views.properties.IPropertySource;
-
-/**
- * @author Eike Stepper
- */
-public class CDOPropertyAdapterFactory extends AbstractPropertyAdapterFactory
-{
- public CDOPropertyAdapterFactory()
- {
- }
-
- @Override
- protected IPropertySource createPropertySource(Object object)
- {
- if (object instanceof CDOSession)
- {
- return new DefaultPropertySource<CDOSession>((CDOSession)object, SessionProperties.INSTANCE);
- }
-
- if (object instanceof CDOView)
- {
- return new DefaultPropertySource<CDOView>((CDOView)object, ViewProperties.INSTANCE);
- }
-
- return null;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.internal.ui;
+
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.view.CDOView;
+
+import org.eclipse.emf.internal.cdo.session.SessionProperties;
+import org.eclipse.emf.internal.cdo.view.ViewProperties;
+
+import org.eclipse.net4j.util.ui.AbstractPropertyAdapterFactory;
+import org.eclipse.net4j.util.ui.DefaultPropertySource;
+
+import org.eclipse.ui.views.properties.IPropertySource;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDOPropertyAdapterFactory extends AbstractPropertyAdapterFactory
+{
+ public CDOPropertyAdapterFactory()
+ {
+ }
+
+ @Override
+ protected IPropertySource createPropertySource(Object object)
+ {
+ if (object instanceof CDOSession)
+ {
+ return new DefaultPropertySource<CDOSession>((CDOSession)object, SessionProperties.INSTANCE);
+ }
+
+ if (object instanceof CDOView)
+ {
+ return new DefaultPropertySource<CDOView>((CDOView)object, ViewProperties.INSTANCE);
+ }
+
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/ItemsProcessor.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/ItemsProcessor.java
index 40be0b45cd..db013a24ca 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/ItemsProcessor.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/ItemsProcessor.java
@@ -1,109 +1,109 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- * Simon McDuff - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui;
-
-import org.eclipse.emf.cdo.CDOObject;
-import org.eclipse.emf.cdo.view.CDOView;
-
-import org.eclipse.emf.spi.cdo.FSMUtil;
-import org.eclipse.emf.spi.cdo.InternalCDOObject;
-
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.swt.widgets.TreeItem;
-
-import java.util.Set;
-
-/**
- * @author Eike Stepper
- */
-public abstract class ItemsProcessor
-{
- private CDOView view;
-
- public ItemsProcessor(CDOView view)
- {
- this.view = view;
- }
-
- public CDOView getView()
- {
- return view;
- }
-
- public void processCDOObjects(TreeViewer viewer)
- {
- processCDOObjects(viewer, null);
- }
-
- public void processCDOObjects(final TreeViewer viewer, final Set<? extends CDOObject> ids)
- {
- try
- {
- viewer.getControl().getDisplay().asyncExec(new Runnable()
- {
- public void run()
- {
- try
- {
- processObject(viewer, ids, viewer.getInput());
- processItems(viewer, ids, viewer.getTree().getItems());
- }
- catch (Exception ignore)
- {
- }
- }
- });
- }
- catch (Exception ignore)
- {
- }
- }
-
- protected InternalCDOObject getCDOObject(Object object)
- {
- if (object instanceof InternalCDOObject)
- {
- return (InternalCDOObject)object;
- }
-
- if (object != null && view != null)
- {
- return FSMUtil.adapt(object, view);
- }
-
- return null;
- }
-
- protected abstract void processCDOObject(TreeViewer viewer, InternalCDOObject cdoObject);
-
- private void processItems(TreeViewer viewer, Set<? extends CDOObject> ids, TreeItem[] items)
- {
- for (TreeItem item : items)
- {
- Object object = item.getData();
- processObject(viewer, ids, object);
- if (item.getItemCount() != 0)
- {
- processItems(viewer, ids, item.getItems());
- }
- }
- }
-
- private void processObject(TreeViewer viewer, Set<? extends CDOObject> ids, Object object)
- {
- InternalCDOObject cdoObject = getCDOObject(object);
- if (ids.contains(cdoObject))
- {
- processCDOObject(viewer, cdoObject);
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ * Simon McDuff - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui;
+
+import org.eclipse.emf.cdo.CDOObject;
+import org.eclipse.emf.cdo.view.CDOView;
+
+import org.eclipse.emf.spi.cdo.FSMUtil;
+import org.eclipse.emf.spi.cdo.InternalCDOObject;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.widgets.TreeItem;
+
+import java.util.Set;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class ItemsProcessor
+{
+ private CDOView view;
+
+ public ItemsProcessor(CDOView view)
+ {
+ this.view = view;
+ }
+
+ public CDOView getView()
+ {
+ return view;
+ }
+
+ public void processCDOObjects(TreeViewer viewer)
+ {
+ processCDOObjects(viewer, null);
+ }
+
+ public void processCDOObjects(final TreeViewer viewer, final Set<? extends CDOObject> ids)
+ {
+ try
+ {
+ viewer.getControl().getDisplay().asyncExec(new Runnable()
+ {
+ public void run()
+ {
+ try
+ {
+ processObject(viewer, ids, viewer.getInput());
+ processItems(viewer, ids, viewer.getTree().getItems());
+ }
+ catch (Exception ignore)
+ {
+ }
+ }
+ });
+ }
+ catch (Exception ignore)
+ {
+ }
+ }
+
+ protected InternalCDOObject getCDOObject(Object object)
+ {
+ if (object instanceof InternalCDOObject)
+ {
+ return (InternalCDOObject)object;
+ }
+
+ if (object != null && view != null)
+ {
+ return FSMUtil.adapt(object, view);
+ }
+
+ return null;
+ }
+
+ protected abstract void processCDOObject(TreeViewer viewer, InternalCDOObject cdoObject);
+
+ private void processItems(TreeViewer viewer, Set<? extends CDOObject> ids, TreeItem[] items)
+ {
+ for (TreeItem item : items)
+ {
+ Object object = item.getData();
+ processObject(viewer, ids, object);
+ if (item.getItemCount() != 0)
+ {
+ processItems(viewer, ids, item.getItems());
+ }
+ }
+ }
+
+ private void processObject(TreeViewer viewer, Set<? extends CDOObject> ids, Object object)
+ {
+ InternalCDOObject cdoObject = getCDOObject(object);
+ if (ids.contains(cdoObject))
+ {
+ processCDOObject(viewer, cdoObject);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/LegacyModeRegistry.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/LegacyModeRegistry.java
index 62b38683f4..750c96ce31 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/LegacyModeRegistry.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/LegacyModeRegistry.java
@@ -1,45 +1,45 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Victor Roldan Betancort - initial API and implementation
- * Eike Stepper - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui;
-
-import org.eclipse.emf.cdo.session.CDOSession;
-
-import java.util.Collections;
-import java.util.Map;
-import java.util.WeakHashMap;
-
-/**
- * Class to indicate if legacy is enabled or not for certain CDOSession
- *
- * @author Victor Roldan Betancort
- */
-public class LegacyModeRegistry
-{
- private static Map<CDOSession, Boolean> isLegacyEnabledForSession = Collections
- .synchronizedMap(new WeakHashMap<CDOSession, Boolean>());
-
- private LegacyModeRegistry()
- {
-
- }
-
- public static void setLegacyEnabled(CDOSession session, boolean isLegacyEnabled)
- {
- isLegacyEnabledForSession.put(session, isLegacyEnabled);
- }
-
- public static boolean isLegacyEnabled(CDOSession session)
- {
- Boolean status = isLegacyEnabledForSession.get(session);
- return status != null ? status : false;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Victor Roldan Betancort - initial API and implementation
+ * Eike Stepper - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui;
+
+import org.eclipse.emf.cdo.session.CDOSession;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.WeakHashMap;
+
+/**
+ * Class to indicate if legacy is enabled or not for certain CDOSession
+ *
+ * @author Victor Roldan Betancort
+ */
+public class LegacyModeRegistry
+{
+ private static Map<CDOSession, Boolean> isLegacyEnabledForSession = Collections
+ .synchronizedMap(new WeakHashMap<CDOSession, Boolean>());
+
+ private LegacyModeRegistry()
+ {
+
+ }
+
+ public static void setLegacyEnabled(CDOSession session, boolean isLegacyEnabled)
+ {
+ isLegacyEnabledForSession.put(session, isLegacyEnabled);
+ }
+
+ public static boolean isLegacyEnabled(CDOSession session)
+ {
+ Boolean status = isLegacyEnabledForSession.get(session);
+ return status != null ? status : false;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/AbstractContainerAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/AbstractContainerAction.java
index 0c3271c145..aade6a67b3 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/AbstractContainerAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/AbstractContainerAction.java
@@ -1,38 +1,38 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Victor Roldan Betancort - initial API and implementation
- * Eike Stepper - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui.actions;
-
-import org.eclipse.net4j.util.container.IContainer;
-import org.eclipse.net4j.util.ui.actions.LongRunningAction;
-
-/**
- * @author Victor Roldan Betancort
- */
-public abstract class AbstractContainerAction<E> extends LongRunningAction
-{
- private IContainer.Modifiable<E> container;
-
- public AbstractContainerAction(IContainer.Modifiable<E> container)
- {
- setContainer(container);
- }
-
- protected IContainer.Modifiable<E> getContainer()
- {
- return container;
- }
-
- protected void setContainer(IContainer.Modifiable<E> container)
- {
- this.container = container;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Victor Roldan Betancort - initial API and implementation
+ * Eike Stepper - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.net4j.util.container.IContainer;
+import org.eclipse.net4j.util.ui.actions.LongRunningAction;
+
+/**
+ * @author Victor Roldan Betancort
+ */
+public abstract class AbstractContainerAction<E> extends LongRunningAction
+{
+ private IContainer.Modifiable<E> container;
+
+ public AbstractContainerAction(IContainer.Modifiable<E> container)
+ {
+ setContainer(container);
+ }
+
+ protected IContainer.Modifiable<E> getContainer()
+ {
+ return container;
+ }
+
+ protected void setContainer(IContainer.Modifiable<E> container)
+ {
+ this.container = container;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/AbstractLockObjectsAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/AbstractLockObjectsAction.java
index 0553897d5e..0986cb1feb 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/AbstractLockObjectsAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/AbstractLockObjectsAction.java
@@ -1,127 +1,127 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Simon McDuff - initial API and implementation
- * Eike Stepper - maintenance
- * Victor Roldan Betancort - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui.actions;
-
-import org.eclipse.emf.cdo.CDOLock;
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-import org.eclipse.emf.cdo.ui.CDOEditorUtil;
-import org.eclipse.emf.cdo.view.CDOView;
-
-import org.eclipse.emf.spi.cdo.InternalCDOObject;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IWorkbenchPage;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * @author Simon McDuff
- */
-public abstract class AbstractLockObjectsAction extends EditingDomainAction
-{
- private List<InternalCDOObject> objects = new ArrayList<InternalCDOObject>();
-
- private List<InternalCDOObject> lockObjects = new ArrayList<InternalCDOObject>();
-
- private Boolean lock;
-
- public AbstractLockObjectsAction(String title)
- {
- super(title);
- }
-
- public void selectionChanged(IStructuredSelection selection)
- {
- objects.clear();
- lock = null;
- if (selection != null)
- {
- for (Iterator<?> it = selection.iterator(); it.hasNext();)
- {
- Object object = it.next();
- if (object instanceof InternalCDOObject)
- {
- objects.add((InternalCDOObject)object);
- }
- }
- }
- }
-
- @Override
- public void update()
- {
- updateLockInfo();
- setEnabled(!lockObjects.isEmpty() && lock != null);
- setChecked(lock != null && lock);
- }
-
- @Override
- protected void doRun(IProgressMonitor progressMonitor) throws Exception
- {
- if (!objects.isEmpty())
- {
- InternalCDOObject[] array = objects.toArray(new InternalCDOObject[objects.size()]);
- for (InternalCDOObject object : lockObjects)
- {
- CDOLock cdoLock = getLock(object);
- if (lock)
- {
- cdoLock.unlock();
- }
- else
- {
- if (!cdoLock.tryLock())
- {
- getDisplay().syncExec(new Runnable()
- {
- public void run()
- {
- MessageDialog.openError(
- getShell(),
- Messages.getString("AbstractLockObjectsAction.0"), Messages.getString("AbstractLockObjectsAction.1")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- });
- }
- }
- }
-
- IWorkbenchPage page = getPage();
- if (page != null)
- {
- CDOView view = array[0].cdoView();
- CDOEditorUtil.refreshEditors(page, view);
- }
- }
- }
-
- protected abstract CDOLock getLock(InternalCDOObject object);
-
- private void updateLockInfo()
- {
- lock = null;
- lockObjects.clear();
- for (InternalCDOObject object : objects)
- {
- boolean isLocked = getLock(object).isLocked();
- if (lock == null || isLocked == lock)
- {
- lock = isLocked;
- lockObjects.add(object);
- }
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Simon McDuff - initial API and implementation
+ * Eike Stepper - maintenance
+ * Victor Roldan Betancort - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.CDOLock;
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+import org.eclipse.emf.cdo.ui.CDOEditorUtil;
+import org.eclipse.emf.cdo.view.CDOView;
+
+import org.eclipse.emf.spi.cdo.InternalCDOObject;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IWorkbenchPage;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * @author Simon McDuff
+ */
+public abstract class AbstractLockObjectsAction extends EditingDomainAction
+{
+ private List<InternalCDOObject> objects = new ArrayList<InternalCDOObject>();
+
+ private List<InternalCDOObject> lockObjects = new ArrayList<InternalCDOObject>();
+
+ private Boolean lock;
+
+ public AbstractLockObjectsAction(String title)
+ {
+ super(title);
+ }
+
+ public void selectionChanged(IStructuredSelection selection)
+ {
+ objects.clear();
+ lock = null;
+ if (selection != null)
+ {
+ for (Iterator<?> it = selection.iterator(); it.hasNext();)
+ {
+ Object object = it.next();
+ if (object instanceof InternalCDOObject)
+ {
+ objects.add((InternalCDOObject)object);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void update()
+ {
+ updateLockInfo();
+ setEnabled(!lockObjects.isEmpty() && lock != null);
+ setChecked(lock != null && lock);
+ }
+
+ @Override
+ protected void doRun(IProgressMonitor progressMonitor) throws Exception
+ {
+ if (!objects.isEmpty())
+ {
+ InternalCDOObject[] array = objects.toArray(new InternalCDOObject[objects.size()]);
+ for (InternalCDOObject object : lockObjects)
+ {
+ CDOLock cdoLock = getLock(object);
+ if (lock)
+ {
+ cdoLock.unlock();
+ }
+ else
+ {
+ if (!cdoLock.tryLock())
+ {
+ getDisplay().syncExec(new Runnable()
+ {
+ public void run()
+ {
+ MessageDialog.openError(
+ getShell(),
+ Messages.getString("AbstractLockObjectsAction.0"), Messages.getString("AbstractLockObjectsAction.1")); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ });
+ }
+ }
+ }
+
+ IWorkbenchPage page = getPage();
+ if (page != null)
+ {
+ CDOView view = array[0].cdoView();
+ CDOEditorUtil.refreshEditors(page, view);
+ }
+ }
+ }
+
+ protected abstract CDOLock getLock(InternalCDOObject object);
+
+ private void updateLockInfo()
+ {
+ lock = null;
+ lockObjects.clear();
+ for (InternalCDOObject object : objects)
+ {
+ boolean isLocked = getLock(object).isLocked();
+ if (lock == null || isLocked == lock)
+ {
+ lock = isLocked;
+ lockObjects.add(object);
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/AbstractOpenViewAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/AbstractOpenViewAction.java
index b9a6132a08..eda04d090f 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/AbstractOpenViewAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/AbstractOpenViewAction.java
@@ -1,34 +1,34 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.emf.cdo.internal.ui.actions;
-
-import org.eclipse.emf.cdo.session.CDOSession;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.IWorkbenchPage;
-
-/**
- * @author Eike Stepper
- */
-public abstract class AbstractOpenViewAction extends SessionAction
-{
- public AbstractOpenViewAction(IWorkbenchPage page, String text, String toolTipText, ImageDescriptor image,
- CDOSession session)
- {
- super(page, text, toolTipText, image, session);
- }
-
- @Override
- public boolean isEnabled()
- {
- return !getSession().getPackageRegistry().isEmpty() && super.isEnabled();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.session.CDOSession;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class AbstractOpenViewAction extends SessionAction
+{
+ public AbstractOpenViewAction(IWorkbenchPage page, String text, String toolTipText, ImageDescriptor image,
+ CDOSession session)
+ {
+ super(page, text, toolTipText, image, session);
+ }
+
+ @Override
+ public boolean isEnabled()
+ {
+ return !getSession().getPackageRegistry().isEmpty() && super.isEnabled();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ChangePassiveUpdateAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ChangePassiveUpdateAction.java
index 6d88b9554e..53c6ea8bd3 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ChangePassiveUpdateAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ChangePassiveUpdateAction.java
@@ -1,90 +1,90 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Victor Roldan Betancort - initial API and implementation
- */
-package org.eclipse.emf.cdo.internal.ui.actions;
-
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-import org.eclipse.emf.cdo.session.CDOSession;
-import org.eclipse.emf.cdo.session.CDOSession.Options;
-
-import org.eclipse.net4j.util.event.IEvent;
-import org.eclipse.net4j.util.event.IListener;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-
-/**
- * Changes the state of the {@link Options#isPassiveUpdateEnabled() passive update} option for a given
- * {@link CDOSession session}.
- *
- * @author Victor Roldan Betancort
- */
-public class ChangePassiveUpdateAction extends EditingDomainAction
-{
- public static final String ID = "change-passiveupdate"; //$NON-NLS-1$
-
- private static final String TITLE = Messages.getString("ChangePassiveUpdateAction.1"); //$NON-NLS-1$
-
- private CDOSession session;
-
- private IListener passiveUpdateListener = new IListener()
- {
- public void notifyEvent(IEvent event)
- {
- if (session != null)
- {
- if (event instanceof CDOSession.Options.PassiveUpdateEvent)
- {
- setChecked(session.options().isPassiveUpdateEnabled());
- }
- }
- }
- };
-
- public ChangePassiveUpdateAction()
- {
- super(TITLE);
- setId(ID);
- }
-
- @Override
- protected void doRun(IProgressMonitor progressMonitor) throws Exception
- {
- if (session != null)
- {
- session.options().setPassiveUpdateEnabled(!session.options().isPassiveUpdateEnabled());
- }
-
- update();
- }
-
- @Override
- public void update()
- {
- super.update();
- setChecked(session != null ? session.options().isPassiveUpdateEnabled() : false);
- }
-
- /**
- * Sets the {@link CDOSession session} to be associated with this action.
- */
- public void setSession(CDOSession session)
- {
- if (this.session != null)
- {
- session.options().removeListener(passiveUpdateListener);
- }
-
- this.session = session;
- if (this.session != null)
- {
- session.options().addListener(passiveUpdateListener);
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Victor Roldan Betancort - initial API and implementation
+ */
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.session.CDOSession.Options;
+
+import org.eclipse.net4j.util.event.IEvent;
+import org.eclipse.net4j.util.event.IListener;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+
+/**
+ * Changes the state of the {@link Options#isPassiveUpdateEnabled() passive update} option for a given
+ * {@link CDOSession session}.
+ *
+ * @author Victor Roldan Betancort
+ */
+public class ChangePassiveUpdateAction extends EditingDomainAction
+{
+ public static final String ID = "change-passiveupdate"; //$NON-NLS-1$
+
+ private static final String TITLE = Messages.getString("ChangePassiveUpdateAction.1"); //$NON-NLS-1$
+
+ private CDOSession session;
+
+ private IListener passiveUpdateListener = new IListener()
+ {
+ public void notifyEvent(IEvent event)
+ {
+ if (session != null)
+ {
+ if (event instanceof CDOSession.Options.PassiveUpdateEvent)
+ {
+ setChecked(session.options().isPassiveUpdateEnabled());
+ }
+ }
+ }
+ };
+
+ public ChangePassiveUpdateAction()
+ {
+ super(TITLE);
+ setId(ID);
+ }
+
+ @Override
+ protected void doRun(IProgressMonitor progressMonitor) throws Exception
+ {
+ if (session != null)
+ {
+ session.options().setPassiveUpdateEnabled(!session.options().isPassiveUpdateEnabled());
+ }
+
+ update();
+ }
+
+ @Override
+ public void update()
+ {
+ super.update();
+ setChecked(session != null ? session.options().isPassiveUpdateEnabled() : false);
+ }
+
+ /**
+ * Sets the {@link CDOSession session} to be associated with this action.
+ */
+ public void setSession(CDOSession session)
+ {
+ if (this.session != null)
+ {
+ session.options().removeListener(passiveUpdateListener);
+ }
+
+ this.session = session;
+ if (this.session != null)
+ {
+ session.options().addListener(passiveUpdateListener);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CloseSessionAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CloseSessionAction.java
index fc3d7ec3a0..d2a660a325 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CloseSessionAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CloseSessionAction.java
@@ -1,57 +1,57 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- * Victor Roldan Betancort - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui.actions;
-
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-import org.eclipse.emf.cdo.session.CDOSession;
-import org.eclipse.emf.cdo.util.CDOUtil;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.ui.IWorkbenchPage;
-
-/**
- * @author Eike Stepper
- */
-public final class CloseSessionAction extends SessionAction
-{
- private static final String TITLE = Messages.getString("CloseSessionAction.0"); //$NON-NLS-1$
-
- private static final String TOOL_TIP = Messages.getString("CloseSessionAction.1"); //$NON-NLS-1$
-
- public CloseSessionAction(IWorkbenchPage page, CDOSession session)
- {
- super(page, TITLE, TOOL_TIP, null, session);
- }
-
- @Override
- protected void preRun() throws Exception
- {
- if (CDOUtil.isSessionDirty(getSession()))
- {
- MessageDialog dialog = new MessageDialog(getShell(), TITLE, null,
- Messages.getString("CloseSessionAction.2"), MessageDialog.QUESTION, new String[] { //$NON-NLS-1$
- IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 0);
- if (dialog.open() != MessageDialog.OK)
- {
- cancel();
- }
- }
- }
-
- @Override
- protected void doRun(IProgressMonitor progressMonitor) throws Exception
- {
- getSession().close();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ * Victor Roldan Betancort - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.util.CDOUtil;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * @author Eike Stepper
+ */
+public final class CloseSessionAction extends SessionAction
+{
+ private static final String TITLE = Messages.getString("CloseSessionAction.0"); //$NON-NLS-1$
+
+ private static final String TOOL_TIP = Messages.getString("CloseSessionAction.1"); //$NON-NLS-1$
+
+ public CloseSessionAction(IWorkbenchPage page, CDOSession session)
+ {
+ super(page, TITLE, TOOL_TIP, null, session);
+ }
+
+ @Override
+ protected void preRun() throws Exception
+ {
+ if (CDOUtil.isSessionDirty(getSession()))
+ {
+ MessageDialog dialog = new MessageDialog(getShell(), TITLE, null,
+ Messages.getString("CloseSessionAction.2"), MessageDialog.QUESTION, new String[] { //$NON-NLS-1$
+ IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 0);
+ if (dialog.open() != MessageDialog.OK)
+ {
+ cancel();
+ }
+ }
+ }
+
+ @Override
+ protected void doRun(IProgressMonitor progressMonitor) throws Exception
+ {
+ getSession().close();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CloseViewAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CloseViewAction.java
index 27b5bbb3b1..73d4c7dfc9 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CloseViewAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CloseViewAction.java
@@ -1,56 +1,56 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- * Victor Roldan Betancort - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui.actions;
-
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-import org.eclipse.emf.cdo.view.CDOView;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.ui.IWorkbenchPage;
-
-/**
- * @author Eike Stepper
- */
-public final class CloseViewAction extends ViewAction
-{
- private static final String TITLE = Messages.getString("CloseViewAction.0"); //$NON-NLS-1$
-
- private static final String TOOL_TIP = Messages.getString("CloseViewAction.1"); //$NON-NLS-1$
-
- public CloseViewAction(IWorkbenchPage page, CDOView view)
- {
- super(page, TITLE, TOOL_TIP, null, view);
- }
-
- @Override
- protected void preRun() throws Exception
- {
- if (getView().isDirty())
- {
- MessageDialog dialog = new MessageDialog(getShell(), TITLE, null,
- Messages.getString("CloseViewAction.2"), MessageDialog.QUESTION, new String[] { //$NON-NLS-1$
- IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 0);
- if (dialog.open() != MessageDialog.OK)
- {
- cancel();
- }
- }
- }
-
- @Override
- protected void doRun(IProgressMonitor progressMonitor) throws Exception
- {
- getView().close();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ * Victor Roldan Betancort - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+import org.eclipse.emf.cdo.view.CDOView;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * @author Eike Stepper
+ */
+public final class CloseViewAction extends ViewAction
+{
+ private static final String TITLE = Messages.getString("CloseViewAction.0"); //$NON-NLS-1$
+
+ private static final String TOOL_TIP = Messages.getString("CloseViewAction.1"); //$NON-NLS-1$
+
+ public CloseViewAction(IWorkbenchPage page, CDOView view)
+ {
+ super(page, TITLE, TOOL_TIP, null, view);
+ }
+
+ @Override
+ protected void preRun() throws Exception
+ {
+ if (getView().isDirty())
+ {
+ MessageDialog dialog = new MessageDialog(getShell(), TITLE, null,
+ Messages.getString("CloseViewAction.2"), MessageDialog.QUESTION, new String[] { //$NON-NLS-1$
+ IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 0);
+ if (dialog.open() != MessageDialog.OK)
+ {
+ cancel();
+ }
+ }
+ }
+
+ @Override
+ protected void doRun(IProgressMonitor progressMonitor) throws Exception
+ {
+ getView().close();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CommitTransactionAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CommitTransactionAction.java
index 79cd506780..f82ea660f4 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CommitTransactionAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CommitTransactionAction.java
@@ -1,40 +1,40 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- * Victor Roldan Betancort - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui.actions;
-
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-import org.eclipse.emf.cdo.view.CDOView;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.ui.IWorkbenchPage;
-
-/**
- * @author Eike Stepper
- */
-public final class CommitTransactionAction extends ViewAction
-{
- private static final String TITLE = Messages.getString("CommitTransactionAction.0"); //$NON-NLS-1$
-
- private static final String TOOL_TIP = Messages.getString("CommitTransactionAction.1"); //$NON-NLS-1$
-
- public CommitTransactionAction(IWorkbenchPage page, CDOView view)
- {
- super(page, TITLE, TOOL_TIP, null, view);
- setEnabled(getTransaction().isDirty());
- }
-
- @Override
- protected void doRun(IProgressMonitor progressMonitor) throws Exception
- {
- getTransaction().commit();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ * Victor Roldan Betancort - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+import org.eclipse.emf.cdo.view.CDOView;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * @author Eike Stepper
+ */
+public final class CommitTransactionAction extends ViewAction
+{
+ private static final String TITLE = Messages.getString("CommitTransactionAction.0"); //$NON-NLS-1$
+
+ private static final String TOOL_TIP = Messages.getString("CommitTransactionAction.1"); //$NON-NLS-1$
+
+ public CommitTransactionAction(IWorkbenchPage page, CDOView view)
+ {
+ super(page, TITLE, TOOL_TIP, null, view);
+ setEnabled(getTransaction().isDirty());
+ }
+
+ @Override
+ protected void doRun(IProgressMonitor progressMonitor) throws Exception
+ {
+ getTransaction().commit();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CreateBranchAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CreateBranchAction.java
index 83d6d81037..81d9e0748b 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CreateBranchAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CreateBranchAction.java
@@ -1,126 +1,126 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- * Victor Roldan Betancort - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui.actions;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.internal.ui.dialogs.SelectBranchPointDialog;
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-import org.eclipse.emf.cdo.session.CDOSession;
-import org.eclipse.emf.cdo.ui.shared.SharedIcons;
-
-import org.eclipse.net4j.util.StringUtil;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.IWorkbenchPage;
-
-/**
- * @author Eike Stepper
- */
-public class CreateBranchAction extends SessionAction
-{
- public static final String ID = "create-branch"; //$NON-NLS-1$
-
- private static final String TITLE = Messages.getString("CreateBranchAction.0"); //$NON-NLS-1$
-
- private static final String TOOL_TIP = Messages.getString("CreateBranchAction.1"); //$NON-NLS-1$
-
- private String name;
-
- private CDOBranchPoint base;
-
- public CreateBranchAction(IWorkbenchPage page, CDOSession session)
- {
- super(page, TITLE + INTERACTIVE, TOOL_TIP, null, session);
- setId(ID);
- }
-
- @Override
- protected void preRun() throws Exception
- {
- SelectBranchPointDialog.WithName dialog = new SelectBranchPointDialog.WithName(getPage(), getSession(), null, true,
- null)
- {
- @Override
- protected Control createDialogArea(Composite parent)
- {
- getShell().setText(TITLE);
- setTitle(TITLE);
- setTitleImage(SharedIcons.getImage(SharedIcons.WIZBAN_TARGET_SELECTION));
- setMessage("Enter the name of the new branch and compose a valid base point.\nYou may also choose a base point from existing commits, tags or views.");
- return super.createDialogArea(parent);
- }
-
- @Override
- protected String getComposeTabTitle()
- {
- return "Base Point";
- }
-
- @Override
- protected void validate()
- {
- super.validate();
- String name = getName();
- if (StringUtil.isEmpty(name))
- {
- aggregator.setValidationError(getNameText(), "Branch name is empty.");
- return;
- }
-
- CDOBranchPoint branchPoint = getBranchPoint();
- if (branchPoint != null)
- {
- CDOBranch branch = branchPoint.getBranch().getBranch(name);
- if (branch != null)
- {
- aggregator.setValidationError(getNameText(), "Branch " + branch.getPathName() + " does already exist.");
- return;
- }
- }
-
- aggregator.setValidationError(getNameText(), null);
- }
- };
-
- if (dialog.open() == Dialog.OK)
- {
- name = dialog.getName();
- base = dialog.getBranchPoint();
- if (StringUtil.isEmpty(name) || base == null)
- {
- cancel();
- }
- }
- else
- {
- cancel();
- }
-
- super.preRun();
- }
-
- @Override
- protected void doRun(IProgressMonitor progressMonitor) throws Exception
- {
- long timeStamp = base.getTimeStamp();
- if (timeStamp == CDOBranchPoint.UNSPECIFIED_DATE || timeStamp == CDOBranchPoint.INVALID_DATE)
- {
- timeStamp = getSession().getRepositoryInfo().getTimeStamp();
- }
-
- base.getBranch().createBranch(name, timeStamp);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ * Victor Roldan Betancort - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.internal.ui.dialogs.SelectBranchPointDialog;
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.ui.shared.SharedIcons;
+
+import org.eclipse.net4j.util.StringUtil;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * @author Eike Stepper
+ */
+public class CreateBranchAction extends SessionAction
+{
+ public static final String ID = "create-branch"; //$NON-NLS-1$
+
+ private static final String TITLE = Messages.getString("CreateBranchAction.0"); //$NON-NLS-1$
+
+ private static final String TOOL_TIP = Messages.getString("CreateBranchAction.1"); //$NON-NLS-1$
+
+ private String name;
+
+ private CDOBranchPoint base;
+
+ public CreateBranchAction(IWorkbenchPage page, CDOSession session)
+ {
+ super(page, TITLE + INTERACTIVE, TOOL_TIP, null, session);
+ setId(ID);
+ }
+
+ @Override
+ protected void preRun() throws Exception
+ {
+ SelectBranchPointDialog.WithName dialog = new SelectBranchPointDialog.WithName(getPage(), getSession(), null, true,
+ null)
+ {
+ @Override
+ protected Control createDialogArea(Composite parent)
+ {
+ getShell().setText(TITLE);
+ setTitle(TITLE);
+ setTitleImage(SharedIcons.getImage(SharedIcons.WIZBAN_TARGET_SELECTION));
+ setMessage("Enter the name of the new branch and compose a valid base point.\nYou may also choose a base point from existing commits, tags or views.");
+ return super.createDialogArea(parent);
+ }
+
+ @Override
+ protected String getComposeTabTitle()
+ {
+ return "Base Point";
+ }
+
+ @Override
+ protected void validate()
+ {
+ super.validate();
+ String name = getName();
+ if (StringUtil.isEmpty(name))
+ {
+ aggregator.setValidationError(getNameText(), "Branch name is empty.");
+ return;
+ }
+
+ CDOBranchPoint branchPoint = getBranchPoint();
+ if (branchPoint != null)
+ {
+ CDOBranch branch = branchPoint.getBranch().getBranch(name);
+ if (branch != null)
+ {
+ aggregator.setValidationError(getNameText(), "Branch " + branch.getPathName() + " does already exist.");
+ return;
+ }
+ }
+
+ aggregator.setValidationError(getNameText(), null);
+ }
+ };
+
+ if (dialog.open() == Dialog.OK)
+ {
+ name = dialog.getName();
+ base = dialog.getBranchPoint();
+ if (StringUtil.isEmpty(name) || base == null)
+ {
+ cancel();
+ }
+ }
+ else
+ {
+ cancel();
+ }
+
+ super.preRun();
+ }
+
+ @Override
+ protected void doRun(IProgressMonitor progressMonitor) throws Exception
+ {
+ long timeStamp = base.getTimeStamp();
+ if (timeStamp == CDOBranchPoint.UNSPECIFIED_DATE || timeStamp == CDOBranchPoint.INVALID_DATE)
+ {
+ timeStamp = getSession().getRepositoryInfo().getTimeStamp();
+ }
+
+ base.getBranch().createBranch(name, timeStamp);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CreateResourceNodeAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CreateResourceNodeAction.java
index d33e2b697a..c1780ff876 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CreateResourceNodeAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/CreateResourceNodeAction.java
@@ -1,119 +1,119 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- * Victor Roldan Betancort - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui.actions;
-
-import org.eclipse.emf.cdo.eresource.CDOResource;
-import org.eclipse.emf.cdo.eresource.CDOResourceFolder;
-import org.eclipse.emf.cdo.eresource.CDOResourceNode;
-import org.eclipse.emf.cdo.eresource.EresourceFactory;
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-import org.eclipse.emf.cdo.transaction.CDOTransaction;
-import org.eclipse.emf.cdo.ui.CDOEditorUtil;
-import org.eclipse.emf.cdo.ui.CDOItemProvider;
-import org.eclipse.emf.cdo.view.CDOView;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.InputDialog;
-import org.eclipse.ui.IWorkbenchPage;
-
-/**
- * @author Eike Stepper
- */
-public class CreateResourceNodeAction extends ViewAction
-{
- private static final String TITLE_RESOURCE = Messages.getString("CreateResourceAction.0"); //$NON-NLS-1$
-
- private static final String TITLE_FOLDER = Messages.getString("CreateResourceNodeAction.0"); //$NON-NLS-1$
-
- private static final String TOOL_TIP_RESOURCE = Messages.getString("CreateResourceAction.1"); //$NON-NLS-1$
-
- private static final String TOOL_TIP_FOLDER = Messages.getString("CreateResourceNodeAction.1"); //$NON-NLS-1$
-
- private CDOItemProvider itemProvider;
-
- private CDOResourceNode selectedNode;
-
- private boolean createFolder;
-
- private String resourceNodeName;
-
- public CreateResourceNodeAction(CDOItemProvider itemProvider, IWorkbenchPage page, CDOView view,
- CDOResourceNode node, boolean createFolder)
- {
- super(page, createFolder ? TITLE_FOLDER + INTERACTIVE : TITLE_RESOURCE + INTERACTIVE,
- createFolder ? TOOL_TIP_FOLDER : TOOL_TIP_RESOURCE, null, view);
- selectedNode = node;
- this.itemProvider = itemProvider;
- this.createFolder = createFolder;
- }
-
- @Override
- protected void preRun() throws Exception
- {
- InputDialog dialog = new InputDialog(getShell(), createFolder ? TITLE_FOLDER : TITLE_RESOURCE,
- createFolder ? "Enter folder name" : Messages.getString("CreateResourceAction.2"), "res" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- + (ViewAction.lastResourceNumber + 1), new ResourceNodeNameInputValidator(selectedNode));
-
- if (dialog.open() == InputDialog.OK)
- {
- ++ViewAction.lastResourceNumber;
- resourceNodeName = dialog.getValue();
- }
- else
- {
- cancel();
- }
- }
-
- @Override
- protected void doRun(IProgressMonitor progressMonitor) throws Exception
- {
- CDOTransaction transaction = getTransaction();
- CDOResourceNode node = null;
-
- if (createFolder)
- {
- node = EresourceFactory.eINSTANCE.createCDOResourceFolder();
- node.setName(resourceNodeName);
- if (selectedNode instanceof CDOResourceFolder)
- {
- ((CDOResourceFolder)selectedNode).getNodes().add(node);
- }
- else
- {
- ((CDOResource)selectedNode).getContents().add(node);
- }
- }
- else
- {
- if (selectedNode instanceof CDOResourceFolder)
- {
- node = transaction.createResource(selectedNode.getPath() + "/" + resourceNodeName); //$NON-NLS-1$
- }
- else
- {
- node = transaction.createResource(resourceNodeName);
- }
- }
-
- transaction.commit();
-
- itemProvider.refreshViewer(true);
- itemProvider.selectElement(node, true);
-
- if (!createFolder)
- {
- String resourcePath = node.getPath();
- CDOEditorUtil.openEditor(getPage(), transaction, resourcePath);
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ * Victor Roldan Betancort - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.emf.cdo.eresource.CDOResourceFolder;
+import org.eclipse.emf.cdo.eresource.CDOResourceNode;
+import org.eclipse.emf.cdo.eresource.EresourceFactory;
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.ui.CDOEditorUtil;
+import org.eclipse.emf.cdo.ui.CDOItemProvider;
+import org.eclipse.emf.cdo.view.CDOView;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * @author Eike Stepper
+ */
+public class CreateResourceNodeAction extends ViewAction
+{
+ private static final String TITLE_RESOURCE = Messages.getString("CreateResourceAction.0"); //$NON-NLS-1$
+
+ private static final String TITLE_FOLDER = Messages.getString("CreateResourceNodeAction.0"); //$NON-NLS-1$
+
+ private static final String TOOL_TIP_RESOURCE = Messages.getString("CreateResourceAction.1"); //$NON-NLS-1$
+
+ private static final String TOOL_TIP_FOLDER = Messages.getString("CreateResourceNodeAction.1"); //$NON-NLS-1$
+
+ private CDOItemProvider itemProvider;
+
+ private CDOResourceNode selectedNode;
+
+ private boolean createFolder;
+
+ private String resourceNodeName;
+
+ public CreateResourceNodeAction(CDOItemProvider itemProvider, IWorkbenchPage page, CDOView view,
+ CDOResourceNode node, boolean createFolder)
+ {
+ super(page, createFolder ? TITLE_FOLDER + INTERACTIVE : TITLE_RESOURCE + INTERACTIVE,
+ createFolder ? TOOL_TIP_FOLDER : TOOL_TIP_RESOURCE, null, view);
+ selectedNode = node;
+ this.itemProvider = itemProvider;
+ this.createFolder = createFolder;
+ }
+
+ @Override
+ protected void preRun() throws Exception
+ {
+ InputDialog dialog = new InputDialog(getShell(), createFolder ? TITLE_FOLDER : TITLE_RESOURCE,
+ createFolder ? "Enter folder name" : Messages.getString("CreateResourceAction.2"), "res" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ + (ViewAction.lastResourceNumber + 1), new ResourceNodeNameInputValidator(selectedNode));
+
+ if (dialog.open() == InputDialog.OK)
+ {
+ ++ViewAction.lastResourceNumber;
+ resourceNodeName = dialog.getValue();
+ }
+ else
+ {
+ cancel();
+ }
+ }
+
+ @Override
+ protected void doRun(IProgressMonitor progressMonitor) throws Exception
+ {
+ CDOTransaction transaction = getTransaction();
+ CDOResourceNode node = null;
+
+ if (createFolder)
+ {
+ node = EresourceFactory.eINSTANCE.createCDOResourceFolder();
+ node.setName(resourceNodeName);
+ if (selectedNode instanceof CDOResourceFolder)
+ {
+ ((CDOResourceFolder)selectedNode).getNodes().add(node);
+ }
+ else
+ {
+ ((CDOResource)selectedNode).getContents().add(node);
+ }
+ }
+ else
+ {
+ if (selectedNode instanceof CDOResourceFolder)
+ {
+ node = transaction.createResource(selectedNode.getPath() + "/" + resourceNodeName); //$NON-NLS-1$
+ }
+ else
+ {
+ node = transaction.createResource(resourceNodeName);
+ }
+ }
+
+ transaction.commit();
+
+ itemProvider.refreshViewer(true);
+ itemProvider.selectElement(node, true);
+
+ if (!createFolder)
+ {
+ String resourcePath = node.getPath();
+ CDOEditorUtil.openEditor(getPage(), transaction, resourcePath);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/DisableViewDurabilityAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/DisableViewDurabilityAction.java
index 7c0014facc..470c55db22 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/DisableViewDurabilityAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/DisableViewDurabilityAction.java
@@ -1,39 +1,39 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- * Victor Roldan Betancort - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui.actions;
-
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-import org.eclipse.emf.cdo.view.CDOView;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.ui.IWorkbenchPage;
-
-/**
- * @author Eike Stepper
- */
-public final class DisableViewDurabilityAction extends ViewAction
-{
- private static final String TITLE = Messages.getString("DisableViewDurabilityAction.0"); //$NON-NLS-1$
-
- private static final String TOOL_TIP = Messages.getString("DisableViewDurabilityAction.1"); //$NON-NLS-1$
-
- public DisableViewDurabilityAction(IWorkbenchPage page, CDOView view)
- {
- super(page, TITLE, TOOL_TIP, null, view);
- }
-
- @Override
- protected void doRun(IProgressMonitor progressMonitor) throws Exception
- {
- getView().disableDurableLocking(false);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ * Victor Roldan Betancort - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+import org.eclipse.emf.cdo.view.CDOView;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * @author Eike Stepper
+ */
+public final class DisableViewDurabilityAction extends ViewAction
+{
+ private static final String TITLE = Messages.getString("DisableViewDurabilityAction.0"); //$NON-NLS-1$
+
+ private static final String TOOL_TIP = Messages.getString("DisableViewDurabilityAction.1"); //$NON-NLS-1$
+
+ public DisableViewDurabilityAction(IWorkbenchPage page, CDOView view)
+ {
+ super(page, TITLE, TOOL_TIP, null, view);
+ }
+
+ @Override
+ protected void doRun(IProgressMonitor progressMonitor) throws Exception
+ {
+ getView().disableDurableLocking(false);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/EditingDomainAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/EditingDomainAction.java
index 4948f75715..5debfe3ab6 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/EditingDomainAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/EditingDomainAction.java
@@ -1,75 +1,75 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.emf.cdo.internal.ui.actions;
-
-import org.eclipse.net4j.util.ui.actions.LongRunningAction;
-
-import org.eclipse.emf.edit.domain.EditingDomain;
-import org.eclipse.emf.edit.domain.IEditingDomainProvider;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * @author Eike Stepper
- * @ADDED
- */
-public abstract class EditingDomainAction extends LongRunningAction
-{
- protected EditingDomain editingDomain;
-
- public EditingDomainAction(String text, ImageDescriptor image)
- {
- super(text, image);
- }
-
- public EditingDomainAction(String text, int style)
- {
- super(text, style);
- }
-
- public EditingDomainAction(String text, String toolTipText, ImageDescriptor image)
- {
- super(text, toolTipText, image);
- }
-
- public EditingDomainAction(String text, String toolTipText)
- {
- super(text, toolTipText);
- }
-
- public EditingDomainAction(String text)
- {
- super(text);
- }
-
- public EditingDomain getEditingDomain()
- {
- return editingDomain;
- }
-
- public void setEditingDomain(EditingDomain editingDomain)
- {
- this.editingDomain = editingDomain;
- }
-
- public void setActiveWorkbenchPart(IWorkbenchPart workbenchPart)
- {
- setPage(workbenchPart == null ? null : workbenchPart.getSite().getPage());
- setEditingDomain(workbenchPart instanceof IEditingDomainProvider ? ((IEditingDomainProvider)workbenchPart)
- .getEditingDomain() : null);
- }
-
- public void update()
- {
- setEnabled(editingDomain != null);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.net4j.util.ui.actions.LongRunningAction;
+
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.edit.domain.IEditingDomainProvider;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * @author Eike Stepper
+ * @ADDED
+ */
+public abstract class EditingDomainAction extends LongRunningAction
+{
+ protected EditingDomain editingDomain;
+
+ public EditingDomainAction(String text, ImageDescriptor image)
+ {
+ super(text, image);
+ }
+
+ public EditingDomainAction(String text, int style)
+ {
+ super(text, style);
+ }
+
+ public EditingDomainAction(String text, String toolTipText, ImageDescriptor image)
+ {
+ super(text, toolTipText, image);
+ }
+
+ public EditingDomainAction(String text, String toolTipText)
+ {
+ super(text, toolTipText);
+ }
+
+ public EditingDomainAction(String text)
+ {
+ super(text);
+ }
+
+ public EditingDomain getEditingDomain()
+ {
+ return editingDomain;
+ }
+
+ public void setEditingDomain(EditingDomain editingDomain)
+ {
+ this.editingDomain = editingDomain;
+ }
+
+ public void setActiveWorkbenchPart(IWorkbenchPart workbenchPart)
+ {
+ setPage(workbenchPart == null ? null : workbenchPart.getSite().getPage());
+ setEditingDomain(workbenchPart instanceof IEditingDomainProvider ? ((IEditingDomainProvider)workbenchPart)
+ .getEditingDomain() : null);
+ }
+
+ public void update()
+ {
+ setEnabled(editingDomain != null);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/EnableViewDurabilityAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/EnableViewDurabilityAction.java
index 4a35798653..3a10c964df 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/EnableViewDurabilityAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/EnableViewDurabilityAction.java
@@ -1,54 +1,54 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- * Victor Roldan Betancort - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui.actions;
-
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-import org.eclipse.emf.cdo.view.CDOView;
-
-import org.eclipse.net4j.util.ui.UIUtil;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IWorkbenchPage;
-
-/**
- * @author Eike Stepper
- */
-public final class EnableViewDurabilityAction extends ViewAction
-{
- private static final String TITLE = Messages.getString("EnableViewDurabilityAction.0"); //$NON-NLS-1$
-
- private static final String TOOL_TIP = Messages.getString("EnableViewDurabilityAction.1"); //$NON-NLS-1$
-
- public EnableViewDurabilityAction(IWorkbenchPage page, CDOView view)
- {
- super(page, TITLE, TOOL_TIP, null, view);
- }
-
- @Override
- protected void doRun(IProgressMonitor progressMonitor) throws Exception
- {
- final String durableLockingID = getView().enableDurableLocking();
-
- final Display display = getDisplay();
- display.syncExec(new Runnable()
- {
- public void run()
- {
- UIUtil.copyToClipboard(display, durableLockingID);
- MessageDialog.openInformation(getShell(), TITLE, "The following area ID has been copied to the clipboard:\n"
- + durableLockingID);
- }
- });
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ * Victor Roldan Betancort - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+import org.eclipse.emf.cdo.view.CDOView;
+
+import org.eclipse.net4j.util.ui.UIUtil;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * @author Eike Stepper
+ */
+public final class EnableViewDurabilityAction extends ViewAction
+{
+ private static final String TITLE = Messages.getString("EnableViewDurabilityAction.0"); //$NON-NLS-1$
+
+ private static final String TOOL_TIP = Messages.getString("EnableViewDurabilityAction.1"); //$NON-NLS-1$
+
+ public EnableViewDurabilityAction(IWorkbenchPage page, CDOView view)
+ {
+ super(page, TITLE, TOOL_TIP, null, view);
+ }
+
+ @Override
+ protected void doRun(IProgressMonitor progressMonitor) throws Exception
+ {
+ final String durableLockingID = getView().enableDurableLocking();
+
+ final Display display = getDisplay();
+ display.syncExec(new Runnable()
+ {
+ public void run()
+ {
+ UIUtil.copyToClipboard(display, durableLockingID);
+ MessageDialog.openInformation(getShell(), TITLE, "The following area ID has been copied to the clipboard:\n"
+ + durableLockingID);
+ }
+ });
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ExportResourceAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ExportResourceAction.java
index 543d897750..29f8911974 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ExportResourceAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ExportResourceAction.java
@@ -1,112 +1,112 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- * Victor Roldan Betancort - bug 244801
- */
-package org.eclipse.emf.cdo.internal.ui.actions;
-
-import org.eclipse.emf.cdo.internal.ui.dialogs.ExportResourceDialog;
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-import org.eclipse.emf.cdo.view.CDOView;
-
-import org.eclipse.net4j.util.io.IORuntimeException;
-
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.ui.IWorkbenchPage;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-/**
- * @author Eike Stepper
- */
-public class ExportResourceAction extends ViewAction
-{
- public static final String ID = "export-resource"; //$NON-NLS-1$
-
- private static final String TITLE = Messages.getString("ExportResourceAction.1"); //$NON-NLS-1$
-
- public ExportResourceAction(IWorkbenchPage page, CDOView view)
- {
- super(page, TITLE + INTERACTIVE, Messages.getString("ExportResourceAction.2"), null, view); //$NON-NLS-1$
- setId(ID);
- }
-
- private URI sourceURI;
-
- private String targetPath;
-
- @Override
- protected void preRun() throws Exception
- {
- ExportResourceDialog dialog = new ExportResourceDialog(getShell(), TITLE, SWT.OPEN);
- if (dialog.open() == ExportResourceDialog.OK)
- {
- List<URI> uris = dialog.getURIs();
- if (uris.size() == 1)
- {
- sourceURI = uris.get(0);
- targetPath = dialog.getTargetPath();
- }
- else
- {
- MessageDialog.openError(getShell(), TITLE, Messages.getString("ExportResourceAction.3")); //$NON-NLS-1$
- cancel();
- }
- }
- else
- {
- cancel();
- }
- }
-
- @Override
- protected void doRun(IProgressMonitor progressMonitor) throws Exception
- {
- CDOView view = getView();
-
- // Source Resource
- Resource source = view.getResource(targetPath);
- List<EObject> sourceContents = new ArrayList<EObject>(source.getContents());
- exportObjects(sourceContents);
- }
-
- private void exportObjects(List<EObject> sourceContents)
- {
- // Target Resource
- ResourceSet resourceSet = new ResourceSetImpl();
- resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap()
- .put(Resource.Factory.Registry.DEFAULT_EXTENSION, new XMIResourceFactoryImpl());
- Resource resource = resourceSet.createResource(sourceURI);
-
- Collection<EObject> copiedRoots = EcoreUtil.copyAll(sourceContents);
- resource.getContents().addAll(copiedRoots);
-
- try
- {
- resource.save(null);
- }
- catch (IOException ex)
- {
- throw new IORuntimeException(ex);
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ * Victor Roldan Betancort - bug 244801
+ */
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.internal.ui.dialogs.ExportResourceDialog;
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+import org.eclipse.emf.cdo.view.CDOView;
+
+import org.eclipse.net4j.util.io.IORuntimeException;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.ui.IWorkbenchPage;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ */
+public class ExportResourceAction extends ViewAction
+{
+ public static final String ID = "export-resource"; //$NON-NLS-1$
+
+ private static final String TITLE = Messages.getString("ExportResourceAction.1"); //$NON-NLS-1$
+
+ public ExportResourceAction(IWorkbenchPage page, CDOView view)
+ {
+ super(page, TITLE + INTERACTIVE, Messages.getString("ExportResourceAction.2"), null, view); //$NON-NLS-1$
+ setId(ID);
+ }
+
+ private URI sourceURI;
+
+ private String targetPath;
+
+ @Override
+ protected void preRun() throws Exception
+ {
+ ExportResourceDialog dialog = new ExportResourceDialog(getShell(), TITLE, SWT.OPEN);
+ if (dialog.open() == ExportResourceDialog.OK)
+ {
+ List<URI> uris = dialog.getURIs();
+ if (uris.size() == 1)
+ {
+ sourceURI = uris.get(0);
+ targetPath = dialog.getTargetPath();
+ }
+ else
+ {
+ MessageDialog.openError(getShell(), TITLE, Messages.getString("ExportResourceAction.3")); //$NON-NLS-1$
+ cancel();
+ }
+ }
+ else
+ {
+ cancel();
+ }
+ }
+
+ @Override
+ protected void doRun(IProgressMonitor progressMonitor) throws Exception
+ {
+ CDOView view = getView();
+
+ // Source Resource
+ Resource source = view.getResource(targetPath);
+ List<EObject> sourceContents = new ArrayList<EObject>(source.getContents());
+ exportObjects(sourceContents);
+ }
+
+ private void exportObjects(List<EObject> sourceContents)
+ {
+ // Target Resource
+ ResourceSet resourceSet = new ResourceSetImpl();
+ resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap()
+ .put(Resource.Factory.Registry.DEFAULT_EXTENSION, new XMIResourceFactoryImpl());
+ Resource resource = resourceSet.createResource(sourceURI);
+
+ Collection<EObject> copiedRoots = EcoreUtil.copyAll(sourceContents);
+ resource.getContents().addAll(copiedRoots);
+
+ try
+ {
+ resource.save(null);
+ }
+ catch (IOException ex)
+ {
+ throw new IORuntimeException(ex);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ImportResourceAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ImportResourceAction.java
index 39b3d1acab..6217de18ae 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ImportResourceAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ImportResourceAction.java
@@ -1,109 +1,109 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- * Victor Roldan Betancort - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui.actions;
-
-import org.eclipse.emf.cdo.internal.ui.dialogs.ImportResourceDialog;
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-import org.eclipse.emf.cdo.transaction.CDOTransaction;
-import org.eclipse.emf.cdo.ui.CDOEditorUtil;
-import org.eclipse.emf.cdo.view.CDOView;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.ui.IWorkbenchPage;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Eike Stepper
- */
-public class ImportResourceAction extends ViewAction
-{
- public static final String ID = "import-resource"; //$NON-NLS-1$
-
- private static final String TITLE = Messages.getString("ImportResourceAction.1"); //$NON-NLS-1$
-
- private URI sourceURI;
-
- private String targetPath;
-
- public ImportResourceAction(IWorkbenchPage page, CDOView view)
- {
- super(page, TITLE + INTERACTIVE, Messages.getString("ImportResourceAction.2"), null, view); //$NON-NLS-1$
- setId(ID);
- }
-
- @Override
- protected void preRun() throws Exception
- {
- ImportResourceDialog dialog = new ImportResourceDialog(getShell(), TITLE, SWT.OPEN);
- if (dialog.open() == ImportResourceDialog.OK)
- {
- List<URI> uris = dialog.getURIs();
- if (uris.size() == 1)
- {
- sourceURI = uris.get(0);
- targetPath = dialog.getTargetPath();
- }
- else
- {
- MessageDialog.openError(getShell(), TITLE, Messages.getString("ImportResourceAction.3")); //$NON-NLS-1$
- cancel();
- }
- }
- else
- {
- cancel();
- }
- }
-
- @Override
- protected void doRun(IProgressMonitor progressMonitor) throws Exception
- {
- CDOTransaction transaction = getTransaction();
-
- // Source ResourceSet
- ResourceSet sourceSet = new ResourceSetImpl();
- sourceSet.setPackageRegistry(transaction.getSession().getPackageRegistry());
-
- // Source Resource
- Resource source = sourceSet.getResource(sourceURI, true);
- List<EObject> sourceContents = new ArrayList<EObject>(source.getContents());
-
- // Target Resource
- Resource target = transaction.createResource(targetPath);
- EList<EObject> targetContents = target.getContents();
-
- // Move contents over
- for (EObject root : sourceContents)
- {
- targetContents.add(root);
- }
-
- getDisplay().asyncExec(new Runnable()
- {
- public void run()
- {
- CDOEditorUtil.openEditor(getPage(), getView(), targetPath);
- }
- });
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ * Victor Roldan Betancort - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.internal.ui.dialogs.ImportResourceDialog;
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.ui.CDOEditorUtil;
+import org.eclipse.emf.cdo.view.CDOView;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.ui.IWorkbenchPage;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ */
+public class ImportResourceAction extends ViewAction
+{
+ public static final String ID = "import-resource"; //$NON-NLS-1$
+
+ private static final String TITLE = Messages.getString("ImportResourceAction.1"); //$NON-NLS-1$
+
+ private URI sourceURI;
+
+ private String targetPath;
+
+ public ImportResourceAction(IWorkbenchPage page, CDOView view)
+ {
+ super(page, TITLE + INTERACTIVE, Messages.getString("ImportResourceAction.2"), null, view); //$NON-NLS-1$
+ setId(ID);
+ }
+
+ @Override
+ protected void preRun() throws Exception
+ {
+ ImportResourceDialog dialog = new ImportResourceDialog(getShell(), TITLE, SWT.OPEN);
+ if (dialog.open() == ImportResourceDialog.OK)
+ {
+ List<URI> uris = dialog.getURIs();
+ if (uris.size() == 1)
+ {
+ sourceURI = uris.get(0);
+ targetPath = dialog.getTargetPath();
+ }
+ else
+ {
+ MessageDialog.openError(getShell(), TITLE, Messages.getString("ImportResourceAction.3")); //$NON-NLS-1$
+ cancel();
+ }
+ }
+ else
+ {
+ cancel();
+ }
+ }
+
+ @Override
+ protected void doRun(IProgressMonitor progressMonitor) throws Exception
+ {
+ CDOTransaction transaction = getTransaction();
+
+ // Source ResourceSet
+ ResourceSet sourceSet = new ResourceSetImpl();
+ sourceSet.setPackageRegistry(transaction.getSession().getPackageRegistry());
+
+ // Source Resource
+ Resource source = sourceSet.getResource(sourceURI, true);
+ List<EObject> sourceContents = new ArrayList<EObject>(source.getContents());
+
+ // Target Resource
+ Resource target = transaction.createResource(targetPath);
+ EList<EObject> targetContents = target.getContents();
+
+ // Move contents over
+ for (EObject root : sourceContents)
+ {
+ targetContents.add(root);
+ }
+
+ getDisplay().asyncExec(new Runnable()
+ {
+ public void run()
+ {
+ CDOEditorUtil.openEditor(getPage(), getView(), targetPath);
+ }
+ });
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ImportRootsAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ImportRootsAction.java
index dc56e32f27..7039004f38 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ImportRootsAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ImportRootsAction.java
@@ -1,128 +1,128 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- * Victor Roldan Betancort - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui.actions;
-
-import org.eclipse.emf.cdo.common.model.CDOPackageRegistry;
-import org.eclipse.emf.cdo.eresource.CDOResource;
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-import org.eclipse.emf.cdo.session.CDOSession;
-import org.eclipse.emf.cdo.view.CDOView;
-
-import org.eclipse.emf.common.ui.dialogs.ResourceDialog;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.swt.SWT;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Eike Stepper
- */
-public class ImportRootsAction extends EditingDomainAction
-{
- public static final String ID = "import-roots"; //$NON-NLS-1$
-
- private static final String TITLE = Messages.getString("ImportRootsAction.1"); //$NON-NLS-1$
-
- private CDOResource targetResource;
-
- private transient List<URI> uris;
-
- public ImportRootsAction()
- {
- super(TITLE + INTERACTIVE);
- setId(ID);
- }
-
- public CDOResource getTargetResource()
- {
- return targetResource;
- }
-
- public void setTargetResource(CDOResource targetResource)
- {
- this.targetResource = targetResource;
- }
-
- @Override
- public boolean isEnabled()
- {
- return targetResource != null && super.isEnabled();
- }
-
- @Override
- protected void preRun() throws Exception
- {
- ResourceDialog dialog = new ResourceDialog(getShell(), TITLE, SWT.OPEN | SWT.MULTI)
- {
- @Override
- protected boolean processResources()
- {
- return true;
- }
- };
-
- if (dialog.open() == ResourceDialog.OK)
- {
- uris = dialog.getURIs();
- }
- else
- {
- cancel();
- }
- }
-
- @Override
- protected void doRun(IProgressMonitor progressMonitor) throws Exception
- {
- EList<EObject> targetContents = targetResource.getContents();
- List<Resource> resources = getSourceResources();
- for (Resource resource : resources)
- {
- List<EObject> contents = new ArrayList<EObject>(resource.getContents());
- for (EObject root : contents)
- {
- targetContents.add(root);
- }
- }
- }
-
- protected List<Resource> getSourceResources()
- {
- ResourceSetImpl resourceSet = createSourceResourceSet();
- List<Resource> resources = new ArrayList<Resource>(uris.size());
- for (URI uri : uris)
- {
- Resource resource = resourceSet.getResource(uri, true);
- resources.add(resource);
- }
-
- return resources;
- }
-
- protected ResourceSetImpl createSourceResourceSet()
- {
- CDOView view = targetResource.cdoView();
- CDOSession session = view.getSession();
- CDOPackageRegistry packageRegistry = session.getPackageRegistry();
-
- ResourceSetImpl resourceSet = new ResourceSetImpl();
- resourceSet.setPackageRegistry(packageRegistry);
- return resourceSet;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ * Victor Roldan Betancort - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.common.model.CDOPackageRegistry;
+import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.view.CDOView;
+
+import org.eclipse.emf.common.ui.dialogs.ResourceDialog;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.swt.SWT;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ */
+public class ImportRootsAction extends EditingDomainAction
+{
+ public static final String ID = "import-roots"; //$NON-NLS-1$
+
+ private static final String TITLE = Messages.getString("ImportRootsAction.1"); //$NON-NLS-1$
+
+ private CDOResource targetResource;
+
+ private transient List<URI> uris;
+
+ public ImportRootsAction()
+ {
+ super(TITLE + INTERACTIVE);
+ setId(ID);
+ }
+
+ public CDOResource getTargetResource()
+ {
+ return targetResource;
+ }
+
+ public void setTargetResource(CDOResource targetResource)
+ {
+ this.targetResource = targetResource;
+ }
+
+ @Override
+ public boolean isEnabled()
+ {
+ return targetResource != null && super.isEnabled();
+ }
+
+ @Override
+ protected void preRun() throws Exception
+ {
+ ResourceDialog dialog = new ResourceDialog(getShell(), TITLE, SWT.OPEN | SWT.MULTI)
+ {
+ @Override
+ protected boolean processResources()
+ {
+ return true;
+ }
+ };
+
+ if (dialog.open() == ResourceDialog.OK)
+ {
+ uris = dialog.getURIs();
+ }
+ else
+ {
+ cancel();
+ }
+ }
+
+ @Override
+ protected void doRun(IProgressMonitor progressMonitor) throws Exception
+ {
+ EList<EObject> targetContents = targetResource.getContents();
+ List<Resource> resources = getSourceResources();
+ for (Resource resource : resources)
+ {
+ List<EObject> contents = new ArrayList<EObject>(resource.getContents());
+ for (EObject root : contents)
+ {
+ targetContents.add(root);
+ }
+ }
+ }
+
+ protected List<Resource> getSourceResources()
+ {
+ ResourceSetImpl resourceSet = createSourceResourceSet();
+ List<Resource> resources = new ArrayList<Resource>(uris.size());
+ for (URI uri : uris)
+ {
+ Resource resource = resourceSet.getResource(uri, true);
+ resources.add(resource);
+ }
+
+ return resources;
+ }
+
+ protected ResourceSetImpl createSourceResourceSet()
+ {
+ CDOView view = targetResource.cdoView();
+ CDOSession session = view.getSession();
+ CDOPackageRegistry packageRegistry = session.getPackageRegistry();
+
+ ResourceSetImpl resourceSet = new ResourceSetImpl();
+ resourceSet.setPackageRegistry(packageRegistry);
+ return resourceSet;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/LoadResourceAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/LoadResourceAction.java
index de17e9807e..46832672d7 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/LoadResourceAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/LoadResourceAction.java
@@ -1,66 +1,66 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- * Victor Roldan Betancort - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui.actions;
-
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-import org.eclipse.emf.cdo.ui.CDOEditorUtil;
-import org.eclipse.emf.cdo.view.CDOView;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.InputDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbenchPage;
-
-import java.text.MessageFormat;
-
-/**
- * @author Eike Stepper
- */
-public final class LoadResourceAction extends ViewAction
-{
- private static final String TITLE = Messages.getString("LoadResourceAction.0"); //$NON-NLS-1$
-
- private String resourcePath;
-
- public LoadResourceAction(IWorkbenchPage page, CDOView view)
- {
- super(page, TITLE + INTERACTIVE, Messages.getString("LoadResourceAction.1"), null, view); //$NON-NLS-1$
- }
-
- @Override
- protected void preRun() throws Exception
- {
- String uri = ViewAction.lastResourceNumber == 0 ? "" : "/res" + ViewAction.lastResourceNumber; //$NON-NLS-1$ //$NON-NLS-2$
- InputDialog dialog = new InputDialog(getShell(), TITLE, Messages.getString("LoadResourceAction.4"), uri, null); //$NON-NLS-1$
- if (dialog.open() == InputDialog.OK)
- {
- resourcePath = dialog.getValue();
- if (!getView().hasResource(resourcePath))
- {
- MessageDialog.openError(new Shell(), Messages.getString("LoadResourceAction.2"), MessageFormat.format( //$NON-NLS-1$
- Messages.getString("LoadResourceAction.3"), resourcePath)); //$NON-NLS-1$
- cancel();
- }
- }
- else
- {
- cancel();
- }
- }
-
- @Override
- protected void doRun(IProgressMonitor progressMonitor) throws Exception
- {
- CDOEditorUtil.openEditor(getPage(), getView(), resourcePath);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ * Victor Roldan Betancort - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+import org.eclipse.emf.cdo.ui.CDOEditorUtil;
+import org.eclipse.emf.cdo.view.CDOView;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchPage;
+
+import java.text.MessageFormat;
+
+/**
+ * @author Eike Stepper
+ */
+public final class LoadResourceAction extends ViewAction
+{
+ private static final String TITLE = Messages.getString("LoadResourceAction.0"); //$NON-NLS-1$
+
+ private String resourcePath;
+
+ public LoadResourceAction(IWorkbenchPage page, CDOView view)
+ {
+ super(page, TITLE + INTERACTIVE, Messages.getString("LoadResourceAction.1"), null, view); //$NON-NLS-1$
+ }
+
+ @Override
+ protected void preRun() throws Exception
+ {
+ String uri = ViewAction.lastResourceNumber == 0 ? "" : "/res" + ViewAction.lastResourceNumber; //$NON-NLS-1$ //$NON-NLS-2$
+ InputDialog dialog = new InputDialog(getShell(), TITLE, Messages.getString("LoadResourceAction.4"), uri, null); //$NON-NLS-1$
+ if (dialog.open() == InputDialog.OK)
+ {
+ resourcePath = dialog.getValue();
+ if (!getView().hasResource(resourcePath))
+ {
+ MessageDialog.openError(new Shell(), Messages.getString("LoadResourceAction.2"), MessageFormat.format( //$NON-NLS-1$
+ Messages.getString("LoadResourceAction.3"), resourcePath)); //$NON-NLS-1$
+ cancel();
+ }
+ }
+ else
+ {
+ cancel();
+ }
+ }
+
+ @Override
+ protected void doRun(IProgressMonitor progressMonitor) throws Exception
+ {
+ CDOEditorUtil.openEditor(getPage(), getView(), resourcePath);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ManagePackagesAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ManagePackagesAction.java
index 6f26125a37..87653fa239 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ManagePackagesAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ManagePackagesAction.java
@@ -1,47 +1,47 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- * Victor Roldan Betancort - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui.actions;
-
-import org.eclipse.emf.cdo.internal.ui.dialogs.PackageRegistryDialog;
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-import org.eclipse.emf.cdo.session.CDOSession;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.ui.IWorkbenchPage;
-
-/**
- * @author Eike Stepper
- */
-public class ManagePackagesAction extends SessionAction
-{
- private static final String TITLE = Messages.getString("ManagePackagesAction.0"); //$NON-NLS-1$
-
- private static final String TOOL_TIP = Messages.getString("ManagePackagesAction.1"); //$NON-NLS-1$
-
- public ManagePackagesAction(IWorkbenchPage page, CDOSession session)
- {
- super(page, TITLE + INTERACTIVE, TOOL_TIP, null, session);
- }
-
- @Override
- protected void preRun() throws Exception
- {
- PackageRegistryDialog dialog = new PackageRegistryDialog(getPage(), getSession());
- dialog.open();
- cancel();
- }
-
- @Override
- protected void doRun(IProgressMonitor progressMonitor) throws Exception
- {
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ * Victor Roldan Betancort - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.internal.ui.dialogs.PackageRegistryDialog;
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+import org.eclipse.emf.cdo.session.CDOSession;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * @author Eike Stepper
+ */
+public class ManagePackagesAction extends SessionAction
+{
+ private static final String TITLE = Messages.getString("ManagePackagesAction.0"); //$NON-NLS-1$
+
+ private static final String TOOL_TIP = Messages.getString("ManagePackagesAction.1"); //$NON-NLS-1$
+
+ public ManagePackagesAction(IWorkbenchPage page, CDOSession session)
+ {
+ super(page, TITLE + INTERACTIVE, TOOL_TIP, null, session);
+ }
+
+ @Override
+ protected void preRun() throws Exception
+ {
+ PackageRegistryDialog dialog = new PackageRegistryDialog(getPage(), getSession());
+ dialog.open();
+ cancel();
+ }
+
+ @Override
+ protected void doRun(IProgressMonitor progressMonitor) throws Exception
+ {
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenAuditAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenAuditAction.java
index b3a2db7ab4..81da748574 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenAuditAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenAuditAction.java
@@ -1,57 +1,57 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- * Victor Roldan Betancort - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui.actions;
-
-import org.eclipse.emf.cdo.internal.ui.dialogs.OpenAuditDialog;
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-import org.eclipse.emf.cdo.session.CDOSession;
-import org.eclipse.emf.cdo.ui.shared.SharedIcons;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.ui.IWorkbenchPage;
-
-/**
- * @author Eike Stepper
- */
-public final class OpenAuditAction extends AbstractOpenViewAction
-{
- private static final String TITLE = Messages.getString("OpenAuditAction.0"); //$NON-NLS-1$
-
- private static final String TOOL_TIP = Messages.getString("OpenAuditAction.1"); //$NON-NLS-1$
-
- private long timeStamp;
-
- public OpenAuditAction(IWorkbenchPage page, CDOSession session)
- {
- super(page, TITLE + INTERACTIVE, TOOL_TIP, SharedIcons.getDescriptor(SharedIcons.ETOOL_OPEN_EDITOR), session);
- }
-
- @Override
- protected void preRun() throws Exception
- {
- OpenAuditDialog dialog = new OpenAuditDialog(getPage());
- if (dialog.open() == OpenAuditDialog.OK)
- {
- timeStamp = dialog.getTimeStamp();
- }
- else
- {
- cancel();
- }
- }
-
- @Override
- protected void doRun(IProgressMonitor progressMonitor) throws Exception
- {
- getSession().openView(timeStamp);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ * Victor Roldan Betancort - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.internal.ui.dialogs.OpenAuditDialog;
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.ui.shared.SharedIcons;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * @author Eike Stepper
+ */
+public final class OpenAuditAction extends AbstractOpenViewAction
+{
+ private static final String TITLE = Messages.getString("OpenAuditAction.0"); //$NON-NLS-1$
+
+ private static final String TOOL_TIP = Messages.getString("OpenAuditAction.1"); //$NON-NLS-1$
+
+ private long timeStamp;
+
+ public OpenAuditAction(IWorkbenchPage page, CDOSession session)
+ {
+ super(page, TITLE + INTERACTIVE, TOOL_TIP, SharedIcons.getDescriptor(SharedIcons.ETOOL_OPEN_EDITOR), session);
+ }
+
+ @Override
+ protected void preRun() throws Exception
+ {
+ OpenAuditDialog dialog = new OpenAuditDialog(getPage());
+ if (dialog.open() == OpenAuditDialog.OK)
+ {
+ timeStamp = dialog.getTimeStamp();
+ }
+ else
+ {
+ cancel();
+ }
+ }
+
+ @Override
+ protected void doRun(IProgressMonitor progressMonitor) throws Exception
+ {
+ getSession().openView(timeStamp);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenDurableViewAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenDurableViewAction.java
index 2e08a4bbc9..e63e951a18 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenDurableViewAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenDurableViewAction.java
@@ -1,65 +1,65 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- * Victor Roldan Betancort - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui.actions;
-
-import org.eclipse.emf.cdo.internal.ui.dialogs.OpenAuditDialog;
-import org.eclipse.emf.cdo.internal.ui.dialogs.OpenDurableViewDialog;
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-import org.eclipse.emf.cdo.session.CDOSession;
-import org.eclipse.emf.cdo.ui.shared.SharedIcons;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.ui.IWorkbenchPage;
-
-/**
- * @author Eike Stepper
- */
-public final class OpenDurableViewAction extends AbstractOpenViewAction
-{
- private static final String TITLE = Messages.getString("OpenDurableViewAction.0"); //$NON-NLS-1$
-
- private static final String TOOL_TIP = Messages.getString("OpenDurableViewAction.1"); //$NON-NLS-1$
-
- private String areaID;
-
- public OpenDurableViewAction(IWorkbenchPage page, CDOSession session)
- {
- super(page, TITLE + INTERACTIVE, TOOL_TIP, SharedIcons.getDescriptor(SharedIcons.ETOOL_OPEN_EDITOR), session);
- }
-
- @Override
- protected void preRun() throws Exception
- {
- OpenDurableViewDialog dialog = new OpenDurableViewDialog(getPage());
- if (dialog.open() == OpenAuditDialog.OK)
- {
- areaID = dialog.getAreaID();
- }
- else
- {
- cancel();
- }
- }
-
- @Override
- protected void doRun(IProgressMonitor progressMonitor) throws Exception
- {
- try
- {
- getSession().openTransaction(areaID);
- }
- catch (IllegalStateException ex)
- {
- getSession().openView(areaID);
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ * Victor Roldan Betancort - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.internal.ui.dialogs.OpenAuditDialog;
+import org.eclipse.emf.cdo.internal.ui.dialogs.OpenDurableViewDialog;
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.ui.shared.SharedIcons;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * @author Eike Stepper
+ */
+public final class OpenDurableViewAction extends AbstractOpenViewAction
+{
+ private static final String TITLE = Messages.getString("OpenDurableViewAction.0"); //$NON-NLS-1$
+
+ private static final String TOOL_TIP = Messages.getString("OpenDurableViewAction.1"); //$NON-NLS-1$
+
+ private String areaID;
+
+ public OpenDurableViewAction(IWorkbenchPage page, CDOSession session)
+ {
+ super(page, TITLE + INTERACTIVE, TOOL_TIP, SharedIcons.getDescriptor(SharedIcons.ETOOL_OPEN_EDITOR), session);
+ }
+
+ @Override
+ protected void preRun() throws Exception
+ {
+ OpenDurableViewDialog dialog = new OpenDurableViewDialog(getPage());
+ if (dialog.open() == OpenAuditDialog.OK)
+ {
+ areaID = dialog.getAreaID();
+ }
+ else
+ {
+ cancel();
+ }
+ }
+
+ @Override
+ protected void doRun(IProgressMonitor progressMonitor) throws Exception
+ {
+ try
+ {
+ getSession().openTransaction(areaID);
+ }
+ catch (IllegalStateException ex)
+ {
+ getSession().openView(areaID);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenResourceEditorAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenResourceEditorAction.java
index 4ddf6168b3..7ee21afd0a 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenResourceEditorAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenResourceEditorAction.java
@@ -1,43 +1,43 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- * Victor Roldan Betancort - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui.actions;
-
-import org.eclipse.emf.cdo.eresource.CDOResourceNode;
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-import org.eclipse.emf.cdo.ui.CDOEditorUtil;
-import org.eclipse.emf.cdo.view.CDOView;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.ui.IWorkbenchPage;
-
-/**
- * @author Eike Stepper
- */
-public final class OpenResourceEditorAction extends ResourceNodeAction
-{
- private static final String TITLE = Messages.getString("OpenResourceEditorAction.0"); //$NON-NLS-1$
-
- private static final String TOOL_TIP = Messages.getString("OpenResourceEditorAction.1"); //$NON-NLS-1$
-
- public OpenResourceEditorAction(IWorkbenchPage page, CDOResourceNode resourceNode)
- {
- super(page, TITLE, TOOL_TIP, null, resourceNode);
- }
-
- @Override
- protected void doRun(IProgressMonitor progressMonitor) throws Exception
- {
- CDOView view = getResourceNode().cdoView();
- String resourcePath = getResourceNode().getPath();
- CDOEditorUtil.openEditor(getPage(), view, resourcePath);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ * Victor Roldan Betancort - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.eresource.CDOResourceNode;
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+import org.eclipse.emf.cdo.ui.CDOEditorUtil;
+import org.eclipse.emf.cdo.view.CDOView;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * @author Eike Stepper
+ */
+public final class OpenResourceEditorAction extends ResourceNodeAction
+{
+ private static final String TITLE = Messages.getString("OpenResourceEditorAction.0"); //$NON-NLS-1$
+
+ private static final String TOOL_TIP = Messages.getString("OpenResourceEditorAction.1"); //$NON-NLS-1$
+
+ public OpenResourceEditorAction(IWorkbenchPage page, CDOResourceNode resourceNode)
+ {
+ super(page, TITLE, TOOL_TIP, null, resourceNode);
+ }
+
+ @Override
+ protected void doRun(IProgressMonitor progressMonitor) throws Exception
+ {
+ CDOView view = getResourceNode().cdoView();
+ String resourcePath = getResourceNode().getPath();
+ CDOEditorUtil.openEditor(getPage(), view, resourcePath);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenTransactionAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenTransactionAction.java
index 7cc454d3bd..83a111bfea 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenTransactionAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenTransactionAction.java
@@ -1,46 +1,46 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- * Victor Roldan Betancort - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui.actions;
-
-import org.eclipse.emf.cdo.internal.ui.LegacyModeRegistry;
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-import org.eclipse.emf.cdo.session.CDOSession;
-import org.eclipse.emf.cdo.ui.shared.SharedIcons;
-import org.eclipse.emf.cdo.util.CDOUtil;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.ui.IWorkbenchPage;
-
-/**
- * @author Eike Stepper
- */
-public final class OpenTransactionAction extends AbstractOpenViewAction
-{
- private static final String TITLE = Messages.getString("OpenTransactionAction.0"); //$NON-NLS-1$
-
- private static final String TOOL_TIP = Messages.getString("OpenTransactionAction.1"); //$NON-NLS-1$
-
- public OpenTransactionAction(IWorkbenchPage page, CDOSession session)
- {
- super(page, TITLE, TOOL_TIP, SharedIcons.getDescriptor(SharedIcons.ETOOL_OPEN_EDITOR), session);
- }
-
- @Override
- protected void doRun(IProgressMonitor progressMonitor) throws Exception
- {
- CDOUtil.setLegacyModeDefault(LegacyModeRegistry.isLegacyEnabled(getSession()));
- getSession().openTransaction();
-
- // CDOTransaction transaction = getSession().openTransaction();
- // transaction.options().getConflictResolvers().add(new CDOObjectConflictResolver.MergeLocalChangesPerFeature());
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ * Victor Roldan Betancort - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.internal.ui.LegacyModeRegistry;
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.ui.shared.SharedIcons;
+import org.eclipse.emf.cdo.util.CDOUtil;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * @author Eike Stepper
+ */
+public final class OpenTransactionAction extends AbstractOpenViewAction
+{
+ private static final String TITLE = Messages.getString("OpenTransactionAction.0"); //$NON-NLS-1$
+
+ private static final String TOOL_TIP = Messages.getString("OpenTransactionAction.1"); //$NON-NLS-1$
+
+ public OpenTransactionAction(IWorkbenchPage page, CDOSession session)
+ {
+ super(page, TITLE, TOOL_TIP, SharedIcons.getDescriptor(SharedIcons.ETOOL_OPEN_EDITOR), session);
+ }
+
+ @Override
+ protected void doRun(IProgressMonitor progressMonitor) throws Exception
+ {
+ CDOUtil.setLegacyModeDefault(LegacyModeRegistry.isLegacyEnabled(getSession()));
+ getSession().openTransaction();
+
+ // CDOTransaction transaction = getSession().openTransaction();
+ // transaction.options().getConflictResolvers().add(new CDOObjectConflictResolver.MergeLocalChangesPerFeature());
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenViewAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenViewAction.java
index e936daa47c..7b7b9eaa01 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenViewAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenViewAction.java
@@ -1,40 +1,40 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- * Victor Roldan Betancort - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui.actions;
-
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-import org.eclipse.emf.cdo.session.CDOSession;
-import org.eclipse.emf.cdo.ui.shared.SharedIcons;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.ui.IWorkbenchPage;
-
-/**
- * @author Eike Stepper
- */
-public final class OpenViewAction extends AbstractOpenViewAction
-{
- private static final String TITLE = Messages.getString("OpenViewAction.0"); //$NON-NLS-1$
-
- private static final String TOOL_TIP = Messages.getString("OpenViewAction.1"); //$NON-NLS-1$
-
- public OpenViewAction(IWorkbenchPage page, CDOSession session)
- {
- super(page, TITLE, TOOL_TIP, SharedIcons.getDescriptor(SharedIcons.ETOOL_OPEN_EDITOR), session);
- }
-
- @Override
- protected void doRun(IProgressMonitor progressMonitor) throws Exception
- {
- getSession().openView();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ * Victor Roldan Betancort - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.ui.shared.SharedIcons;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * @author Eike Stepper
+ */
+public final class OpenViewAction extends AbstractOpenViewAction
+{
+ private static final String TITLE = Messages.getString("OpenViewAction.0"); //$NON-NLS-1$
+
+ private static final String TOOL_TIP = Messages.getString("OpenViewAction.1"); //$NON-NLS-1$
+
+ public OpenViewAction(IWorkbenchPage page, CDOSession session)
+ {
+ super(page, TITLE, TOOL_TIP, SharedIcons.getDescriptor(SharedIcons.ETOOL_OPEN_EDITOR), session);
+ }
+
+ @Override
+ protected void doRun(IProgressMonitor progressMonitor) throws Exception
+ {
+ getSession().openView();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenViewEditorAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenViewEditorAction.java
index 70cdd7dd1e..1681bd662a 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenViewEditorAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenViewEditorAction.java
@@ -1,40 +1,40 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- * Victor Roldan Betancort - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui.actions;
-
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-import org.eclipse.emf.cdo.ui.CDOEditorUtil;
-import org.eclipse.emf.cdo.view.CDOView;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.ui.IWorkbenchPage;
-
-/**
- * @author Eike Stepper
- */
-public final class OpenViewEditorAction extends ViewAction
-{
- private static final String TITLE = Messages.getString("OpenViewEditorAction.0"); //$NON-NLS-1$
-
- private static final String TOOL_TIP = Messages.getString("OpenViewEditorAction.1"); //$NON-NLS-1$
-
- public OpenViewEditorAction(IWorkbenchPage page, CDOView view)
- {
- super(page, TITLE, TOOL_TIP, null, view);
- }
-
- @Override
- protected void doRun(IProgressMonitor progressMonitor) throws Exception
- {
- CDOEditorUtil.openEditor(getPage(), getView(), null);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ * Victor Roldan Betancort - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+import org.eclipse.emf.cdo.ui.CDOEditorUtil;
+import org.eclipse.emf.cdo.view.CDOView;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * @author Eike Stepper
+ */
+public final class OpenViewEditorAction extends ViewAction
+{
+ private static final String TITLE = Messages.getString("OpenViewEditorAction.0"); //$NON-NLS-1$
+
+ private static final String TOOL_TIP = Messages.getString("OpenViewEditorAction.1"); //$NON-NLS-1$
+
+ public OpenViewEditorAction(IWorkbenchPage page, CDOView view)
+ {
+ super(page, TITLE, TOOL_TIP, null, view);
+ }
+
+ @Override
+ protected void doRun(IProgressMonitor progressMonitor) throws Exception
+ {
+ CDOEditorUtil.openEditor(getPage(), getView(), null);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ReadLockObjectsAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ReadLockObjectsAction.java
index ebe40fb348..ec78c7ab8b 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ReadLockObjectsAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ReadLockObjectsAction.java
@@ -1,38 +1,38 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Simon McDuff - initial API and implementation
- * Eike Stepper - maintenance
- * Victor Roldan Betancort - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui.actions;
-
-import org.eclipse.emf.cdo.CDOLock;
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-
-import org.eclipse.emf.spi.cdo.InternalCDOObject;
-
-/**
- * @author Simon McDuff
- */
-public class ReadLockObjectsAction extends AbstractLockObjectsAction
-{
- public static final String ID = "readlock-objects"; //$NON-NLS-1$
-
- public ReadLockObjectsAction()
- {
- super(Messages.getString("ReadLockObjectsAction.1")); //$NON-NLS-1$
- setId(ID);
- }
-
- @Override
- protected CDOLock getLock(InternalCDOObject object)
- {
- return object.cdoReadLock();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Simon McDuff - initial API and implementation
+ * Eike Stepper - maintenance
+ * Victor Roldan Betancort - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.CDOLock;
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+
+import org.eclipse.emf.spi.cdo.InternalCDOObject;
+
+/**
+ * @author Simon McDuff
+ */
+public class ReadLockObjectsAction extends AbstractLockObjectsAction
+{
+ public static final String ID = "readlock-objects"; //$NON-NLS-1$
+
+ public ReadLockObjectsAction()
+ {
+ super(Messages.getString("ReadLockObjectsAction.1")); //$NON-NLS-1$
+ setId(ID);
+ }
+
+ @Override
+ protected CDOLock getLock(InternalCDOObject object)
+ {
+ return object.cdoReadLock();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RegisterFilesystemPackagesAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RegisterFilesystemPackagesAction.java
index e268bd6e4f..58bb905820 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RegisterFilesystemPackagesAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RegisterFilesystemPackagesAction.java
@@ -1,83 +1,83 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- * Victor Roldan Betancort - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui.actions;
-
-import org.eclipse.emf.cdo.common.model.EMFUtil;
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-import org.eclipse.emf.cdo.session.CDOSession;
-
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbenchPage;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Eike Stepper
- */
-public class RegisterFilesystemPackagesAction extends RegisterPackagesAction
-{
- private static final String TITLE = Messages.getString("RegisterFilesystemPackagesAction.0"); //$NON-NLS-1$
-
- private static final String TOOL_TIP = Messages.getString("RegisterFilesystemPackagesAction.1"); //$NON-NLS-1$
-
- private static final String[] FILTER_NAMES = {
- Messages.getString("RegisterFilesystemPackagesAction.2"), Messages.getString("RegisterFilesystemPackagesAction.3"), Messages.getString("RegisterFilesystemPackagesAction.4"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- Messages.getString("RegisterFilesystemPackagesAction.5") }; //$NON-NLS-1$
-
- private static final String[] FILTER_EXTENSIONS = { "ecore", "xmi", "xml", null }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
- public RegisterFilesystemPackagesAction(IWorkbenchPage page, CDOSession session)
- {
- super(page, TITLE, TOOL_TIP, null, session);
- }
-
- @Override
- protected List<EPackage> getEPackages(IWorkbenchPage page, CDOSession session)
- {
- Shell shell = page.getWorkbenchWindow().getShell();
- FileDialog dialog = new FileDialog(shell, SWT.OPEN | SWT.MULTI);
- dialog.setFileName("*.ecore"); //$NON-NLS-1$
- dialog.setFilterNames(FILTER_NAMES);
- dialog.setFilterExtensions(FILTER_EXTENSIONS);
- if (dialog.open() != null)
- {
- String filterPath = dialog.getFilterPath();
- String[] fileNames = dialog.getFileNames();
- if (fileNames != null && fileNames.length != 0)
- {
- ResourceSet resourceSet = EMFUtil.newEcoreResourceSet();
- List<EPackage> ePackages = new ArrayList<EPackage>(fileNames.length);
- for (String fileName : fileNames)
- {
- String path = filterPath + File.separator + fileName;
- URI uri = URI.createFileURI(path);
- Resource resource = resourceSet.getResource(uri, true);
- EPackage ePackage = (EPackage)resource.getContents().get(0);
- ePackages.add(ePackage);
- }
-
- return ePackages;
- }
- }
-
- return null;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ * Victor Roldan Betancort - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.common.model.EMFUtil;
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+import org.eclipse.emf.cdo.session.CDOSession;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchPage;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ */
+public class RegisterFilesystemPackagesAction extends RegisterPackagesAction
+{
+ private static final String TITLE = Messages.getString("RegisterFilesystemPackagesAction.0"); //$NON-NLS-1$
+
+ private static final String TOOL_TIP = Messages.getString("RegisterFilesystemPackagesAction.1"); //$NON-NLS-1$
+
+ private static final String[] FILTER_NAMES = {
+ Messages.getString("RegisterFilesystemPackagesAction.2"), Messages.getString("RegisterFilesystemPackagesAction.3"), Messages.getString("RegisterFilesystemPackagesAction.4"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ Messages.getString("RegisterFilesystemPackagesAction.5") }; //$NON-NLS-1$
+
+ private static final String[] FILTER_EXTENSIONS = { "ecore", "xmi", "xml", null }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+ public RegisterFilesystemPackagesAction(IWorkbenchPage page, CDOSession session)
+ {
+ super(page, TITLE, TOOL_TIP, null, session);
+ }
+
+ @Override
+ protected List<EPackage> getEPackages(IWorkbenchPage page, CDOSession session)
+ {
+ Shell shell = page.getWorkbenchWindow().getShell();
+ FileDialog dialog = new FileDialog(shell, SWT.OPEN | SWT.MULTI);
+ dialog.setFileName("*.ecore"); //$NON-NLS-1$
+ dialog.setFilterNames(FILTER_NAMES);
+ dialog.setFilterExtensions(FILTER_EXTENSIONS);
+ if (dialog.open() != null)
+ {
+ String filterPath = dialog.getFilterPath();
+ String[] fileNames = dialog.getFileNames();
+ if (fileNames != null && fileNames.length != 0)
+ {
+ ResourceSet resourceSet = EMFUtil.newEcoreResourceSet();
+ List<EPackage> ePackages = new ArrayList<EPackage>(fileNames.length);
+ for (String fileName : fileNames)
+ {
+ String path = filterPath + File.separator + fileName;
+ URI uri = URI.createFileURI(path);
+ Resource resource = resourceSet.getResource(uri, true);
+ EPackage ePackage = (EPackage)resource.getContents().get(0);
+ ePackages.add(ePackage);
+ }
+
+ return ePackages;
+ }
+ }
+
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RegisterGeneratedPackagesAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RegisterGeneratedPackagesAction.java
index 97ef287e1f..9064522c7c 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RegisterGeneratedPackagesAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RegisterGeneratedPackagesAction.java
@@ -1,94 +1,94 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- * Victor Roldan Betancort - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui.actions;
-
-import org.eclipse.emf.cdo.internal.ui.bundle.OM;
-import org.eclipse.emf.cdo.internal.ui.dialogs.SelectPackageDialog;
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-import org.eclipse.emf.cdo.session.CDOSession;
-
-import org.eclipse.emf.ecore.EPackage;
-
-import org.eclipse.jface.dialogs.IInputValidator;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbenchPage;
-
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-/**
- * @author Eike Stepper
- */
-public class RegisterGeneratedPackagesAction extends RegisterPackagesAction
-{
- private static final String TITLE = Messages.getString("RegisterGeneratedPackagesAction.0"); //$NON-NLS-1$
-
- private static final String TOOL_TIP = Messages.getString("RegisterGeneratedPackagesAction.1"); //$NON-NLS-1$
-
- private EPackage.Registry registry = EPackage.Registry.INSTANCE;
-
- public RegisterGeneratedPackagesAction(IWorkbenchPage page, CDOSession session)
- {
- super(page, TITLE, TOOL_TIP, null, session);
- }
-
- @Override
- protected List<EPackage> getEPackages(IWorkbenchPage page, CDOSession session)
- {
- Shell shell = page.getWorkbenchWindow().getShell();
- SelectPackageDialog dialog = new SelectPackageDialog(shell,
- Messages.getString("RegisterGeneratedPackagesAction.2"), //$NON-NLS-1$
- Messages.getString("RegisterGeneratedPackagesAction.3"), session.getPackageRegistry() //$NON-NLS-1$
- .keySet());
-
- if (dialog.open() == SelectPackageDialog.OK)
- {
- Set<String> checkedURIs = dialog.getCheckedURIs();
- List<EPackage> ePackages = new ArrayList<EPackage>(checkedURIs.size());
- for (String uri : checkedURIs)
- {
- try
- {
- EPackage ePackage = registry.getEPackage(uri);
- ePackages.add(ePackage);
- }
- catch (RuntimeException ex)
- {
- OM.LOG.error(ex);
- }
- }
-
- return ePackages;
- }
-
- return null;
- }
-
- /**
- * @author Eike Stepper
- */
- public class EPackageFactoryValidator implements IInputValidator
- {
- public String isValid(String uri)
- {
- if (uri == null || uri.length() == 0)
- {
- return ""; //$NON-NLS-1$
- }
-
- return registry.containsKey(uri) ? null : MessageFormat.format(
- Messages.getString("RegisterGeneratedPackagesAction.5"), uri); //$NON-NLS-1$
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ * Victor Roldan Betancort - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.internal.ui.bundle.OM;
+import org.eclipse.emf.cdo.internal.ui.dialogs.SelectPackageDialog;
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+import org.eclipse.emf.cdo.session.CDOSession;
+
+import org.eclipse.emf.ecore.EPackage;
+
+import org.eclipse.jface.dialogs.IInputValidator;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchPage;
+
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @author Eike Stepper
+ */
+public class RegisterGeneratedPackagesAction extends RegisterPackagesAction
+{
+ private static final String TITLE = Messages.getString("RegisterGeneratedPackagesAction.0"); //$NON-NLS-1$
+
+ private static final String TOOL_TIP = Messages.getString("RegisterGeneratedPackagesAction.1"); //$NON-NLS-1$
+
+ private EPackage.Registry registry = EPackage.Registry.INSTANCE;
+
+ public RegisterGeneratedPackagesAction(IWorkbenchPage page, CDOSession session)
+ {
+ super(page, TITLE, TOOL_TIP, null, session);
+ }
+
+ @Override
+ protected List<EPackage> getEPackages(IWorkbenchPage page, CDOSession session)
+ {
+ Shell shell = page.getWorkbenchWindow().getShell();
+ SelectPackageDialog dialog = new SelectPackageDialog(shell,
+ Messages.getString("RegisterGeneratedPackagesAction.2"), //$NON-NLS-1$
+ Messages.getString("RegisterGeneratedPackagesAction.3"), session.getPackageRegistry() //$NON-NLS-1$
+ .keySet());
+
+ if (dialog.open() == SelectPackageDialog.OK)
+ {
+ Set<String> checkedURIs = dialog.getCheckedURIs();
+ List<EPackage> ePackages = new ArrayList<EPackage>(checkedURIs.size());
+ for (String uri : checkedURIs)
+ {
+ try
+ {
+ EPackage ePackage = registry.getEPackage(uri);
+ ePackages.add(ePackage);
+ }
+ catch (RuntimeException ex)
+ {
+ OM.LOG.error(ex);
+ }
+ }
+
+ return ePackages;
+ }
+
+ return null;
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public class EPackageFactoryValidator implements IInputValidator
+ {
+ public String isValid(String uri)
+ {
+ if (uri == null || uri.length() == 0)
+ {
+ return ""; //$NON-NLS-1$
+ }
+
+ return registry.containsKey(uri) ? null : MessageFormat.format(
+ Messages.getString("RegisterGeneratedPackagesAction.5"), uri); //$NON-NLS-1$
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RegisterPackagesAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RegisterPackagesAction.java
index 5465e5e7ae..59f0dcaea0 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RegisterPackagesAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RegisterPackagesAction.java
@@ -1,110 +1,110 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- * Victor Roldan Betancort - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui.actions;
-
-import org.eclipse.emf.cdo.common.model.CDOPackageRegistry;
-import org.eclipse.emf.cdo.internal.ui.bundle.OM;
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-import org.eclipse.emf.cdo.session.CDOSession;
-
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbenchPage;
-
-import java.text.MessageFormat;
-import java.util.List;
-
-/**
- * @author Eike Stepper
- */
-public abstract class RegisterPackagesAction extends SessionAction
-{
- private List<EPackage> ePackages;
-
- private int errors;
-
- public RegisterPackagesAction(IWorkbenchPage page, String text, String toolTipText, ImageDescriptor image,
- CDOSession session)
- {
- super(page, text, toolTipText, image, session);
- }
-
- @Override
- protected void preRun() throws Exception
- {
- ePackages = getEPackages(getPage(), getSession());
- if (ePackages == null)
- {
- cancel();
- }
- }
-
- @Override
- protected void doRun(IProgressMonitor progressMonitor) throws Exception
- {
- errors = 0;
- CDOPackageRegistry packageRegistry = getSession().getPackageRegistry();
- for (EPackage ePackage : ePackages)
- {
- EcoreUtil.freeze(ePackage);
- Resource resource = ePackage.eResource();
- URI uri = resource == null ? null : resource.getURI();
-
- try
- {
- packageRegistry.putEPackage(ePackage);
- }
- catch (RuntimeException ex)
- {
- ++errors;
- if (uri == null)
- {
- OM.LOG.error(ex);
- }
- else
- {
- OM.LOG.error(MessageFormat.format(Messages.getString("RegisterPackagesAction.0"), uri), ex); //$NON-NLS-1$
- }
- }
- }
-
- postRegistration(ePackages);
- if (errors != 0)
- {
- final String label = errors == 1 ? MessageFormat.format(Messages.getString("RegisterPackagesAction.1"), errors) : MessageFormat.format(Messages.getString("RegisterPackagesAction.2"), errors); //$NON-NLS-1$ //$NON-NLS-2$
- getDisplay().asyncExec(new Runnable()
- {
- public void run()
- {
- Shell shell = getShell();
- if (!shell.isDisposed())
- {
- MessageDialog.openError(shell, getText(), label);
- }
- }
- });
- }
- }
-
- protected void postRegistration(List<EPackage> ePackages)
- {
- }
-
- protected abstract List<EPackage> getEPackages(IWorkbenchPage page, CDOSession session);
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ * Victor Roldan Betancort - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.common.model.CDOPackageRegistry;
+import org.eclipse.emf.cdo.internal.ui.bundle.OM;
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+import org.eclipse.emf.cdo.session.CDOSession;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchPage;
+
+import java.text.MessageFormat;
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class RegisterPackagesAction extends SessionAction
+{
+ private List<EPackage> ePackages;
+
+ private int errors;
+
+ public RegisterPackagesAction(IWorkbenchPage page, String text, String toolTipText, ImageDescriptor image,
+ CDOSession session)
+ {
+ super(page, text, toolTipText, image, session);
+ }
+
+ @Override
+ protected void preRun() throws Exception
+ {
+ ePackages = getEPackages(getPage(), getSession());
+ if (ePackages == null)
+ {
+ cancel();
+ }
+ }
+
+ @Override
+ protected void doRun(IProgressMonitor progressMonitor) throws Exception
+ {
+ errors = 0;
+ CDOPackageRegistry packageRegistry = getSession().getPackageRegistry();
+ for (EPackage ePackage : ePackages)
+ {
+ EcoreUtil.freeze(ePackage);
+ Resource resource = ePackage.eResource();
+ URI uri = resource == null ? null : resource.getURI();
+
+ try
+ {
+ packageRegistry.putEPackage(ePackage);
+ }
+ catch (RuntimeException ex)
+ {
+ ++errors;
+ if (uri == null)
+ {
+ OM.LOG.error(ex);
+ }
+ else
+ {
+ OM.LOG.error(MessageFormat.format(Messages.getString("RegisterPackagesAction.0"), uri), ex); //$NON-NLS-1$
+ }
+ }
+ }
+
+ postRegistration(ePackages);
+ if (errors != 0)
+ {
+ final String label = errors == 1 ? MessageFormat.format(Messages.getString("RegisterPackagesAction.1"), errors) : MessageFormat.format(Messages.getString("RegisterPackagesAction.2"), errors); //$NON-NLS-1$ //$NON-NLS-2$
+ getDisplay().asyncExec(new Runnable()
+ {
+ public void run()
+ {
+ Shell shell = getShell();
+ if (!shell.isDisposed())
+ {
+ MessageDialog.openError(shell, getText(), label);
+ }
+ }
+ });
+ }
+ }
+
+ protected void postRegistration(List<EPackage> ePackages)
+ {
+ }
+
+ protected abstract List<EPackage> getEPackages(IWorkbenchPage page, CDOSession session);
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RegisterSinglePackageAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RegisterSinglePackageAction.java
index bc9482a805..e5da70ff34 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RegisterSinglePackageAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RegisterSinglePackageAction.java
@@ -1,77 +1,77 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- * Victor Roldan Betancort - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui.actions;
-
-import org.eclipse.emf.cdo.common.model.CDOPackageTypeRegistry;
-import org.eclipse.emf.cdo.common.model.CDOPackageUnit.Type;
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-import org.eclipse.emf.cdo.session.CDOSession;
-import org.eclipse.emf.cdo.ui.shared.SharedIcons;
-
-import org.eclipse.emf.ecore.EPackage;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.IWorkbenchPage;
-
-import java.util.Collections;
-import java.util.List;
-
-/**
- * @author Eike Stepper
- */
-public class RegisterSinglePackageAction extends RegisterPackagesAction
-{
- private String packageURI;
-
- private EPackage.Registry registry = EPackage.Registry.INSTANCE;
-
- public RegisterSinglePackageAction(IWorkbenchPage page, CDOSession session, String packageURI)
- {
- super(page, packageURI,
- Messages.getString("RegisterSinglePackageAction.0") + packageURI, getDescriptor(packageURI), session); //$NON-NLS-1$
- this.packageURI = packageURI;
- }
-
- @Override
- protected List<EPackage> getEPackages(IWorkbenchPage page, CDOSession session)
- {
- EPackage ePackage = registry.getEPackage(packageURI);
- if (ePackage != null)
- {
- return Collections.singletonList(ePackage);
- }
-
- return Collections.emptyList();
- }
-
- private static ImageDescriptor getDescriptor(String nsURI)
- {
- Type type = CDOPackageTypeRegistry.INSTANCE.lookup(nsURI);
- switch (type)
- {
- case LEGACY:
- return SharedIcons.getDescriptor(SharedIcons.OBJ_EPACKAGE_LEGACY);
-
- case NATIVE:
- return SharedIcons.getDescriptor(SharedIcons.OBJ_EPACKAGE_NATIVE);
-
- case DYNAMIC:
- return SharedIcons.getDescriptor(SharedIcons.OBJ_EPACKAGE_DYNAMIC);
-
- case UNKNOWN:
- return SharedIcons.getDescriptor(SharedIcons.OBJ_EPACKAGE_UNKNOWN);
-
- default:
- return null;
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ * Victor Roldan Betancort - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.common.model.CDOPackageTypeRegistry;
+import org.eclipse.emf.cdo.common.model.CDOPackageUnit.Type;
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.ui.shared.SharedIcons;
+
+import org.eclipse.emf.ecore.EPackage;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.IWorkbenchPage;
+
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ */
+public class RegisterSinglePackageAction extends RegisterPackagesAction
+{
+ private String packageURI;
+
+ private EPackage.Registry registry = EPackage.Registry.INSTANCE;
+
+ public RegisterSinglePackageAction(IWorkbenchPage page, CDOSession session, String packageURI)
+ {
+ super(page, packageURI,
+ Messages.getString("RegisterSinglePackageAction.0") + packageURI, getDescriptor(packageURI), session); //$NON-NLS-1$
+ this.packageURI = packageURI;
+ }
+
+ @Override
+ protected List<EPackage> getEPackages(IWorkbenchPage page, CDOSession session)
+ {
+ EPackage ePackage = registry.getEPackage(packageURI);
+ if (ePackage != null)
+ {
+ return Collections.singletonList(ePackage);
+ }
+
+ return Collections.emptyList();
+ }
+
+ private static ImageDescriptor getDescriptor(String nsURI)
+ {
+ Type type = CDOPackageTypeRegistry.INSTANCE.lookup(nsURI);
+ switch (type)
+ {
+ case LEGACY:
+ return SharedIcons.getDescriptor(SharedIcons.OBJ_EPACKAGE_LEGACY);
+
+ case NATIVE:
+ return SharedIcons.getDescriptor(SharedIcons.OBJ_EPACKAGE_NATIVE);
+
+ case DYNAMIC:
+ return SharedIcons.getDescriptor(SharedIcons.OBJ_EPACKAGE_DYNAMIC);
+
+ case UNKNOWN:
+ return SharedIcons.getDescriptor(SharedIcons.OBJ_EPACKAGE_UNKNOWN);
+
+ default:
+ return null;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RegisterWorkspacePackagesAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RegisterWorkspacePackagesAction.java
index 93ac4636b8..b81d2e2fad 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RegisterWorkspacePackagesAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RegisterWorkspacePackagesAction.java
@@ -1,75 +1,75 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- * Victor Roldan Betancort - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui.actions;
-
-import org.eclipse.emf.cdo.common.model.EMFUtil;
-import org.eclipse.emf.cdo.internal.ui.dialogs.OpenResourcesDialog;
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-import org.eclipse.emf.cdo.session.CDOSession;
-
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbenchPage;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Eike Stepper
- */
-public class RegisterWorkspacePackagesAction extends RegisterPackagesAction
-{
- private static final String TITLE = Messages.getString("RegisterWorkspacePackagesAction.0"); //$NON-NLS-1$
-
- private static final String TOOL_TIP = Messages.getString("RegisterWorkspacePackagesAction.1"); //$NON-NLS-1$
-
- public RegisterWorkspacePackagesAction(IWorkbenchPage page, CDOSession session)
- {
- super(page, TITLE, TOOL_TIP, null, session);
- }
-
- @Override
- protected List<EPackage> getEPackages(IWorkbenchPage page, CDOSession session)
- {
- Shell shell = page.getWorkbenchWindow().getShell();
- OpenResourcesDialog dialog = new OpenResourcesDialog(shell);
- if (dialog.open() == OpenResourcesDialog.OK)
- {
- Object[] result = dialog.getResult();
- if (result != null && result.length != 0)
- {
- ResourceSet resourceSet = EMFUtil.newEcoreResourceSet();
- List<EPackage> ePackages = new ArrayList<EPackage>(result.length);
- for (Object object : result)
- {
- if (object instanceof IFile)
- {
- IFile file = (IFile)object;
- URI uri = URI.createPlatformResourceURI(file.getFullPath().toString(), true);
- Resource resource = resourceSet.getResource(uri, true);
- EPackage ePackage = (EPackage)resource.getContents().get(0);
- ePackages.add(ePackage);
- }
- }
-
- return ePackages;
- }
- }
-
- return null;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ * Victor Roldan Betancort - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.common.model.EMFUtil;
+import org.eclipse.emf.cdo.internal.ui.dialogs.OpenResourcesDialog;
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+import org.eclipse.emf.cdo.session.CDOSession;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchPage;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ */
+public class RegisterWorkspacePackagesAction extends RegisterPackagesAction
+{
+ private static final String TITLE = Messages.getString("RegisterWorkspacePackagesAction.0"); //$NON-NLS-1$
+
+ private static final String TOOL_TIP = Messages.getString("RegisterWorkspacePackagesAction.1"); //$NON-NLS-1$
+
+ public RegisterWorkspacePackagesAction(IWorkbenchPage page, CDOSession session)
+ {
+ super(page, TITLE, TOOL_TIP, null, session);
+ }
+
+ @Override
+ protected List<EPackage> getEPackages(IWorkbenchPage page, CDOSession session)
+ {
+ Shell shell = page.getWorkbenchWindow().getShell();
+ OpenResourcesDialog dialog = new OpenResourcesDialog(shell);
+ if (dialog.open() == OpenResourcesDialog.OK)
+ {
+ Object[] result = dialog.getResult();
+ if (result != null && result.length != 0)
+ {
+ ResourceSet resourceSet = EMFUtil.newEcoreResourceSet();
+ List<EPackage> ePackages = new ArrayList<EPackage>(result.length);
+ for (Object object : result)
+ {
+ if (object instanceof IFile)
+ {
+ IFile file = (IFile)object;
+ URI uri = URI.createPlatformResourceURI(file.getFullPath().toString(), true);
+ Resource resource = resourceSet.getResource(uri, true);
+ EPackage ePackage = (EPackage)resource.getContents().get(0);
+ ePackages.add(ePackage);
+ }
+ }
+
+ return ePackages;
+ }
+ }
+
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ReloadObjectsAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ReloadObjectsAction.java
index 48283ad289..004a82a7ba 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ReloadObjectsAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ReloadObjectsAction.java
@@ -1,88 +1,88 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- * Victor Roldan Betancort - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui.actions;
-
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-import org.eclipse.emf.cdo.ui.CDOEditorUtil;
-import org.eclipse.emf.cdo.view.CDOView;
-
-import org.eclipse.emf.internal.cdo.view.CDOStateMachine;
-
-import org.eclipse.emf.spi.cdo.InternalCDOObject;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IWorkbenchPage;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * @author Eike Stepper
- */
-public class ReloadObjectsAction extends EditingDomainAction
-{
- public static final String ID = "reload-objects"; //$NON-NLS-1$
-
- private static final String TITLE = Messages.getString("ReloadObjectsAction.1"); //$NON-NLS-1$
-
- private List<InternalCDOObject> objects = new ArrayList<InternalCDOObject>();
-
- public ReloadObjectsAction()
- {
- super(TITLE);
- setId(ID);
- }
-
- public void selectionChanged(IStructuredSelection selection)
- {
- objects.clear();
- if (selection != null)
- {
- for (Iterator<?> it = selection.iterator(); it.hasNext();)
- {
- Object object = it.next();
- if (object instanceof InternalCDOObject)
- {
- objects.add((InternalCDOObject)object);
- }
- }
- }
-
- update();
- }
-
- @Override
- public void update()
- {
- setEnabled(!objects.isEmpty());
- }
-
- @Override
- protected void doRun(IProgressMonitor progressMonitor) throws Exception
- {
- if (!objects.isEmpty())
- {
- InternalCDOObject[] array = objects.toArray(new InternalCDOObject[objects.size()]);
-
- CDOStateMachine.INSTANCE.reload(array);
-
- IWorkbenchPage page = getPage();
- if (page != null)
- {
- CDOView view = array[0].cdoView();
- CDOEditorUtil.refreshEditors(page, view);
- }
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ * Victor Roldan Betancort - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+import org.eclipse.emf.cdo.ui.CDOEditorUtil;
+import org.eclipse.emf.cdo.view.CDOView;
+
+import org.eclipse.emf.internal.cdo.view.CDOStateMachine;
+
+import org.eclipse.emf.spi.cdo.InternalCDOObject;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IWorkbenchPage;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ */
+public class ReloadObjectsAction extends EditingDomainAction
+{
+ public static final String ID = "reload-objects"; //$NON-NLS-1$
+
+ private static final String TITLE = Messages.getString("ReloadObjectsAction.1"); //$NON-NLS-1$
+
+ private List<InternalCDOObject> objects = new ArrayList<InternalCDOObject>();
+
+ public ReloadObjectsAction()
+ {
+ super(TITLE);
+ setId(ID);
+ }
+
+ public void selectionChanged(IStructuredSelection selection)
+ {
+ objects.clear();
+ if (selection != null)
+ {
+ for (Iterator<?> it = selection.iterator(); it.hasNext();)
+ {
+ Object object = it.next();
+ if (object instanceof InternalCDOObject)
+ {
+ objects.add((InternalCDOObject)object);
+ }
+ }
+ }
+
+ update();
+ }
+
+ @Override
+ public void update()
+ {
+ setEnabled(!objects.isEmpty());
+ }
+
+ @Override
+ protected void doRun(IProgressMonitor progressMonitor) throws Exception
+ {
+ if (!objects.isEmpty())
+ {
+ InternalCDOObject[] array = objects.toArray(new InternalCDOObject[objects.size()]);
+
+ CDOStateMachine.INSTANCE.reload(array);
+
+ IWorkbenchPage page = getPage();
+ if (page != null)
+ {
+ CDOView view = array[0].cdoView();
+ CDOEditorUtil.refreshEditors(page, view);
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ReloadViewAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ReloadViewAction.java
index 434076c3f9..1a6dd2f20a 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ReloadViewAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ReloadViewAction.java
@@ -1,43 +1,43 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- * Victor Roldan Betancort - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui.actions;
-
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-import org.eclipse.emf.cdo.ui.CDOEditorUtil;
-import org.eclipse.emf.cdo.view.CDOView;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.ui.IWorkbenchPage;
-
-/**
- * @author Eike Stepper
- */
-public final class ReloadViewAction extends ViewAction
-{
- private static final String TITLE = Messages.getString("ReloadViewAction.0"); //$NON-NLS-1$
-
- private static final String TOOL_TIP = Messages.getString("ReloadViewAction.1"); //$NON-NLS-1$
-
- public ReloadViewAction(IWorkbenchPage page, CDOView view)
- {
- super(page, TITLE, TOOL_TIP, null, view);
- }
-
- @Override
- protected void doRun(IProgressMonitor progressMonitor) throws Exception
- {
- if (getView().reload() != 0)
- {
- CDOEditorUtil.refreshEditors(getPage(), getView());
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ * Victor Roldan Betancort - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+import org.eclipse.emf.cdo.ui.CDOEditorUtil;
+import org.eclipse.emf.cdo.view.CDOView;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * @author Eike Stepper
+ */
+public final class ReloadViewAction extends ViewAction
+{
+ private static final String TITLE = Messages.getString("ReloadViewAction.0"); //$NON-NLS-1$
+
+ private static final String TOOL_TIP = Messages.getString("ReloadViewAction.1"); //$NON-NLS-1$
+
+ public ReloadViewAction(IWorkbenchPage page, CDOView view)
+ {
+ super(page, TITLE, TOOL_TIP, null, view);
+ }
+
+ @Override
+ protected void doRun(IProgressMonitor progressMonitor) throws Exception
+ {
+ if (getView().reload() != 0)
+ {
+ CDOEditorUtil.refreshEditors(getPage(), getView());
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RemoveAllContainerItemAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RemoveAllContainerItemAction.java
index 2f043875df..758e27e903 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RemoveAllContainerItemAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RemoveAllContainerItemAction.java
@@ -1,42 +1,42 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.emf.cdo.internal.ui.actions;
-
-import org.eclipse.net4j.util.container.IContainer;
-import org.eclipse.net4j.util.container.IContainer.Modifiable;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-
-import java.util.ArrayList;
-
-/**
- * @author Victor Roldan Betancort
- */
-public class RemoveAllContainerItemAction<E> extends AbstractContainerAction<E>
-{
- public RemoveAllContainerItemAction(IContainer.Modifiable<E> container)
- {
- super(container);
- }
-
- @Override
- protected void doRun(IProgressMonitor progressMonitor) throws Exception
- {
- Modifiable<E> container = getContainer();
- ArrayList<E> elementsToRemove = new ArrayList<E>();
- for (E element : container.getElements())
- {
- elementsToRemove.add(element);
- }
-
- container.removeAllElements(elementsToRemove);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.net4j.util.container.IContainer;
+import org.eclipse.net4j.util.container.IContainer.Modifiable;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+
+import java.util.ArrayList;
+
+/**
+ * @author Victor Roldan Betancort
+ */
+public class RemoveAllContainerItemAction<E> extends AbstractContainerAction<E>
+{
+ public RemoveAllContainerItemAction(IContainer.Modifiable<E> container)
+ {
+ super(container);
+ }
+
+ @Override
+ protected void doRun(IProgressMonitor progressMonitor) throws Exception
+ {
+ Modifiable<E> container = getContainer();
+ ArrayList<E> elementsToRemove = new ArrayList<E>();
+ for (E element : container.getElements())
+ {
+ elementsToRemove.add(element);
+ }
+
+ container.removeAllElements(elementsToRemove);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RemoveContainerItemAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RemoveContainerItemAction.java
index 9f618b2f61..f01a6b7b21 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RemoveContainerItemAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RemoveContainerItemAction.java
@@ -1,69 +1,69 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Victor Roldan Betancort - initial API and implementation
- * Eike Stepper - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui.actions;
-
-import org.eclipse.net4j.util.container.IContainer;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-
-import java.util.List;
-
-/**
- * @author Victor Roldan Betancort
- */
-public class RemoveContainerItemAction<E> extends AbstractContainerAction<E>
-{
- private ISelectionProvider selectionProvider;
-
- private transient List<E> targets;
-
- public RemoveContainerItemAction(IContainer.Modifiable<E> container, ISelectionProvider selectionProvider)
- {
- super(container);
- this.selectionProvider = selectionProvider;
- }
-
- @Override
- protected void preRun() throws Exception
- {
- ISelection selection = selectionProvider.getSelection();
- if (selection instanceof IStructuredSelection)
- {
- IStructuredSelection ssel = (IStructuredSelection)selection;
- if (!ssel.isEmpty())
- {
- @SuppressWarnings("unchecked")
- List<E> cast = ssel.toList();
- targets = cast;
- return;
- }
- }
-
- cancel();
- }
-
- @Override
- protected void doRun(IProgressMonitor progressMonitor) throws Exception
- {
- if (targets != null)
- {
- List<E> useTargets = targets;
- targets = null;
-
- IContainer.Modifiable<E> container = getContainer();
- container.removeAllElements(useTargets);
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Victor Roldan Betancort - initial API and implementation
+ * Eike Stepper - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.net4j.util.container.IContainer;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+
+import java.util.List;
+
+/**
+ * @author Victor Roldan Betancort
+ */
+public class RemoveContainerItemAction<E> extends AbstractContainerAction<E>
+{
+ private ISelectionProvider selectionProvider;
+
+ private transient List<E> targets;
+
+ public RemoveContainerItemAction(IContainer.Modifiable<E> container, ISelectionProvider selectionProvider)
+ {
+ super(container);
+ this.selectionProvider = selectionProvider;
+ }
+
+ @Override
+ protected void preRun() throws Exception
+ {
+ ISelection selection = selectionProvider.getSelection();
+ if (selection instanceof IStructuredSelection)
+ {
+ IStructuredSelection ssel = (IStructuredSelection)selection;
+ if (!ssel.isEmpty())
+ {
+ @SuppressWarnings("unchecked")
+ List<E> cast = ssel.toList();
+ targets = cast;
+ return;
+ }
+ }
+
+ cancel();
+ }
+
+ @Override
+ protected void doRun(IProgressMonitor progressMonitor) throws Exception
+ {
+ if (targets != null)
+ {
+ List<E> useTargets = targets;
+ targets = null;
+
+ IContainer.Modifiable<E> container = getContainer();
+ container.removeAllElements(useTargets);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ResourceNodeAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ResourceNodeAction.java
index 9e94dbfe94..967cef79b6 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ResourceNodeAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ResourceNodeAction.java
@@ -1,38 +1,38 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.emf.cdo.internal.ui.actions;
-
-import org.eclipse.emf.cdo.eresource.CDOResourceNode;
-
-import org.eclipse.net4j.util.ui.actions.LongRunningAction;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.IWorkbenchPage;
-
-/**
- * @author Eike Stepper
- */
-public abstract class ResourceNodeAction extends LongRunningAction
-{
- private CDOResourceNode resourceNode;
-
- public ResourceNodeAction(IWorkbenchPage page, String text, String toolTipText, ImageDescriptor image,
- CDOResourceNode resourceNode)
- {
- super(page, text, toolTipText, image);
- this.resourceNode = resourceNode;
- }
-
- public CDOResourceNode getResourceNode()
- {
- return resourceNode;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.eresource.CDOResourceNode;
+
+import org.eclipse.net4j.util.ui.actions.LongRunningAction;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class ResourceNodeAction extends LongRunningAction
+{
+ private CDOResourceNode resourceNode;
+
+ public ResourceNodeAction(IWorkbenchPage page, String text, String toolTipText, ImageDescriptor image,
+ CDOResourceNode resourceNode)
+ {
+ super(page, text, toolTipText, image);
+ this.resourceNode = resourceNode;
+ }
+
+ public CDOResourceNode getResourceNode()
+ {
+ return resourceNode;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ResourceNodeNameInputValidator.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ResourceNodeNameInputValidator.java
index 3fee598298..7a7f20e3b9 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ResourceNodeNameInputValidator.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ResourceNodeNameInputValidator.java
@@ -1,64 +1,64 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Victor Roldan Betancort - initial API and implementation
- */
-package org.eclipse.emf.cdo.internal.ui.actions;
-
-import org.eclipse.emf.cdo.eresource.CDOResourceFolder;
-import org.eclipse.emf.cdo.eresource.CDOResourceNode;
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-
-import org.eclipse.net4j.util.StringUtil;
-
-import org.eclipse.emf.ecore.EObject;
-
-import org.eclipse.jface.dialogs.IInputValidator;
-
-/**
- * @author Victor Roldan Betancort
- */
-public class ResourceNodeNameInputValidator implements IInputValidator
-{
- private CDOResourceNode node;
-
- private boolean isFolder;
-
- public ResourceNodeNameInputValidator(CDOResourceNode node)
- {
- this.node = node;
- isFolder = node instanceof CDOResourceFolder;
- }
-
- public String isValid(String newText)
- {
- // Do not allow empty names
- if (StringUtil.isEmpty(newText))
- {
- return isFolder ? Messages.getString("CreateResourceNodeAction.3") : Messages.getString("CreateResourceNodeAction.4"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- // Do not allow "/"
- if (newText.contains("/") || newText.contains("\\")) //$NON-NLS-1$ //$NON-NLS-2$
- {
- return Messages.getString("CreateResourceNodeAction.2"); //$NON-NLS-1$
- }
-
- for (EObject nodeObject : node.eContents())
- {
- CDOResourceNode node = (CDOResourceNode)nodeObject;
- if (node.getName().equals(newText))
- {
- return isFolder ? Messages.getString("CreateResourceNodeAction.5") + newText : Messages.getString("CreateResourceNodeAction.6") //$NON-NLS-1$ //$NON-NLS-2$
- + newText;
- }
- }
-
- return null;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Victor Roldan Betancort - initial API and implementation
+ */
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.eresource.CDOResourceFolder;
+import org.eclipse.emf.cdo.eresource.CDOResourceNode;
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+
+import org.eclipse.net4j.util.StringUtil;
+
+import org.eclipse.emf.ecore.EObject;
+
+import org.eclipse.jface.dialogs.IInputValidator;
+
+/**
+ * @author Victor Roldan Betancort
+ */
+public class ResourceNodeNameInputValidator implements IInputValidator
+{
+ private CDOResourceNode node;
+
+ private boolean isFolder;
+
+ public ResourceNodeNameInputValidator(CDOResourceNode node)
+ {
+ this.node = node;
+ isFolder = node instanceof CDOResourceFolder;
+ }
+
+ public String isValid(String newText)
+ {
+ // Do not allow empty names
+ if (StringUtil.isEmpty(newText))
+ {
+ return isFolder ? Messages.getString("CreateResourceNodeAction.3") : Messages.getString("CreateResourceNodeAction.4"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ // Do not allow "/"
+ if (newText.contains("/") || newText.contains("\\")) //$NON-NLS-1$ //$NON-NLS-2$
+ {
+ return Messages.getString("CreateResourceNodeAction.2"); //$NON-NLS-1$
+ }
+
+ for (EObject nodeObject : node.eContents())
+ {
+ CDOResourceNode node = (CDOResourceNode)nodeObject;
+ if (node.getName().equals(newText))
+ {
+ return isFolder ? Messages.getString("CreateResourceNodeAction.5") + newText : Messages.getString("CreateResourceNodeAction.6") //$NON-NLS-1$ //$NON-NLS-2$
+ + newText;
+ }
+ }
+
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RollbackTransactionAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RollbackTransactionAction.java
index 10afef5264..e371342bd2 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RollbackTransactionAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/RollbackTransactionAction.java
@@ -1,53 +1,53 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- * Victor Roldan Betancort - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui.actions;
-
-import org.eclipse.emf.cdo.internal.ui.dialogs.RollbackTransactionDialog;
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-import org.eclipse.emf.cdo.transaction.CDOTransaction;
-import org.eclipse.emf.cdo.view.CDOView;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.ui.IWorkbenchPage;
-
-/**
- * @author Eike Stepper
- */
-public final class RollbackTransactionAction extends ViewAction
-{
- private static final String TITLE = Messages.getString("RollbackTransactionAction.0"); //$NON-NLS-1$
-
- private static final String TOOL_TIP = Messages.getString("RollbackTransactionAction.1"); //$NON-NLS-1$
-
- public RollbackTransactionAction(IWorkbenchPage page, CDOView view)
- {
- super(page, TITLE + INTERACTIVE, TOOL_TIP, null, view);
- setEnabled(getTransaction().isDirty());
- }
-
- @Override
- protected void preRun() throws Exception
- {
- CDOTransaction transaction = (CDOTransaction)getView();
- RollbackTransactionDialog dialog = new RollbackTransactionDialog(getPage(), TITLE, TOOL_TIP, transaction);
- if (dialog.open() != RollbackTransactionDialog.OK)
- {
- cancel();
- }
- }
-
- @Override
- protected void doRun(IProgressMonitor progressMonitor) throws Exception
- {
- getTransaction().rollback();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ * Victor Roldan Betancort - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.internal.ui.dialogs.RollbackTransactionDialog;
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.view.CDOView;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * @author Eike Stepper
+ */
+public final class RollbackTransactionAction extends ViewAction
+{
+ private static final String TITLE = Messages.getString("RollbackTransactionAction.0"); //$NON-NLS-1$
+
+ private static final String TOOL_TIP = Messages.getString("RollbackTransactionAction.1"); //$NON-NLS-1$
+
+ public RollbackTransactionAction(IWorkbenchPage page, CDOView view)
+ {
+ super(page, TITLE + INTERACTIVE, TOOL_TIP, null, view);
+ setEnabled(getTransaction().isDirty());
+ }
+
+ @Override
+ protected void preRun() throws Exception
+ {
+ CDOTransaction transaction = (CDOTransaction)getView();
+ RollbackTransactionDialog dialog = new RollbackTransactionDialog(getPage(), TITLE, TOOL_TIP, transaction);
+ if (dialog.open() != RollbackTransactionDialog.OK)
+ {
+ cancel();
+ }
+ }
+
+ @Override
+ protected void doRun(IProgressMonitor progressMonitor) throws Exception
+ {
+ getTransaction().rollback();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/SessionAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/SessionAction.java
index f0749f83bc..4e07dc0d56 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/SessionAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/SessionAction.java
@@ -1,37 +1,37 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.emf.cdo.internal.ui.actions;
-
-import org.eclipse.emf.cdo.session.CDOSession;
-
-import org.eclipse.net4j.util.ui.actions.LongRunningAction;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.IWorkbenchPage;
-
-/**
- * @author Eike Stepper
- */
-public abstract class SessionAction extends LongRunningAction
-{
- private CDOSession session;
-
- public SessionAction(IWorkbenchPage page, String text, String toolTipText, ImageDescriptor image, CDOSession session)
- {
- super(page, text, toolTipText, image);
- this.session = session;
- }
-
- public CDOSession getSession()
- {
- return session;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.session.CDOSession;
+
+import org.eclipse.net4j.util.ui.actions.LongRunningAction;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class SessionAction extends LongRunningAction
+{
+ private CDOSession session;
+
+ public SessionAction(IWorkbenchPage page, String text, String toolTipText, ImageDescriptor image, CDOSession session)
+ {
+ super(page, text, toolTipText, image);
+ this.session = session;
+ }
+
+ public CDOSession getSession()
+ {
+ return session;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/SwitchTargetAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/SwitchTargetAction.java
index efb57fb498..e3768cf74d 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/SwitchTargetAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/SwitchTargetAction.java
@@ -1,89 +1,89 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Victor Roldan Betancort - initial API and implementation
- */
-package org.eclipse.emf.cdo.internal.ui.actions;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.internal.ui.dialogs.SelectBranchPointDialog;
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-import org.eclipse.emf.cdo.ui.shared.SharedIcons;
-import org.eclipse.emf.cdo.view.CDOView;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.IWorkbenchPage;
-
-/**
- * @author Victor Roldan Betancort
- */
-public class SwitchTargetAction extends ViewAction
-{
- public static final String ID = "switch-target"; //$NON-NLS-1$
-
- private static final String TITLE = Messages.getString("SwitchTargetAction.0"); //$NON-NLS-1$
-
- private static final String TOOL_TIP = Messages.getString("SwitchTargetAction.1"); //$NON-NLS-1$
-
- private CDOBranchPoint target;
-
- public SwitchTargetAction(IWorkbenchPage page, CDOView view)
- {
- super(page, TITLE + INTERACTIVE, TOOL_TIP, null, view);
- setId(ID);
- }
-
- @Override
- protected void preRun() throws Exception
- {
- CDOView view = getView();
- SelectBranchPointDialog dialog = new SelectBranchPointDialog(getPage(), view.getSession(), view, view.isReadOnly())
- {
- @Override
- protected Control createDialogArea(Composite parent)
- {
- getShell().setText(TITLE);
- setTitle(TITLE);
- setTitleImage(SharedIcons.getImage(SharedIcons.WIZBAN_TARGET_SELECTION));
- setMessage("Compose a valid target point or select one from commits, tags or views.");
- return super.createDialogArea(parent);
- }
-
- @Override
- protected String getComposeTabTitle()
- {
- return "Target Point";
- }
- };
-
- if (dialog.open() == Dialog.OK)
- {
- target = dialog.getBranchPoint();
- if (target == null)
- {
- cancel();
- }
- }
- else
- {
- cancel();
- }
-
- super.preRun();
- }
-
- @Override
- protected void doRun(IProgressMonitor progressMonitor) throws Exception
- {
- CDOView view = getView();
- view.setBranchPoint(target);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Victor Roldan Betancort - initial API and implementation
+ */
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.internal.ui.dialogs.SelectBranchPointDialog;
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+import org.eclipse.emf.cdo.ui.shared.SharedIcons;
+import org.eclipse.emf.cdo.view.CDOView;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * @author Victor Roldan Betancort
+ */
+public class SwitchTargetAction extends ViewAction
+{
+ public static final String ID = "switch-target"; //$NON-NLS-1$
+
+ private static final String TITLE = Messages.getString("SwitchTargetAction.0"); //$NON-NLS-1$
+
+ private static final String TOOL_TIP = Messages.getString("SwitchTargetAction.1"); //$NON-NLS-1$
+
+ private CDOBranchPoint target;
+
+ public SwitchTargetAction(IWorkbenchPage page, CDOView view)
+ {
+ super(page, TITLE + INTERACTIVE, TOOL_TIP, null, view);
+ setId(ID);
+ }
+
+ @Override
+ protected void preRun() throws Exception
+ {
+ CDOView view = getView();
+ SelectBranchPointDialog dialog = new SelectBranchPointDialog(getPage(), view.getSession(), view, view.isReadOnly())
+ {
+ @Override
+ protected Control createDialogArea(Composite parent)
+ {
+ getShell().setText(TITLE);
+ setTitle(TITLE);
+ setTitleImage(SharedIcons.getImage(SharedIcons.WIZBAN_TARGET_SELECTION));
+ setMessage("Compose a valid target point or select one from commits, tags or views.");
+ return super.createDialogArea(parent);
+ }
+
+ @Override
+ protected String getComposeTabTitle()
+ {
+ return "Target Point";
+ }
+ };
+
+ if (dialog.open() == Dialog.OK)
+ {
+ target = dialog.getBranchPoint();
+ if (target == null)
+ {
+ cancel();
+ }
+ }
+ else
+ {
+ cancel();
+ }
+
+ super.preRun();
+ }
+
+ @Override
+ protected void doRun(IProgressMonitor progressMonitor) throws Exception
+ {
+ CDOView view = getView();
+ view.setBranchPoint(target);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ToggleLegacyModeDefaultAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ToggleLegacyModeDefaultAction.java
index 650aa00e94..453463abfc 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ToggleLegacyModeDefaultAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ToggleLegacyModeDefaultAction.java
@@ -1,43 +1,43 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Victor Roldan Betancort - initial API and implementation
- * Eike Stepper - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui.actions;
-
-import org.eclipse.emf.cdo.internal.ui.LegacyModeRegistry;
-import org.eclipse.emf.cdo.session.CDOSession;
-
-import org.eclipse.net4j.util.ui.actions.SafeAction;
-
-/**
- * @author Victor Roldan Betancort
- */
-public class ToggleLegacyModeDefaultAction extends SafeAction
-{
- private static final String TITLE = "Legacy Mode";
-
- private static final String TOOL_TIP = "Toggles the default for legacy mode";
-
- private CDOSession session;
-
- public ToggleLegacyModeDefaultAction(CDOSession session)
- {
- super(TITLE, AS_CHECK_BOX);
- setToolTipText(TOOL_TIP);
- this.session = session;
- setChecked(LegacyModeRegistry.isLegacyEnabled(session));
- }
-
- @Override
- protected void safeRun() throws Exception
- {
- LegacyModeRegistry.setLegacyEnabled(session, !LegacyModeRegistry.isLegacyEnabled(session));
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Victor Roldan Betancort - initial API and implementation
+ * Eike Stepper - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.internal.ui.LegacyModeRegistry;
+import org.eclipse.emf.cdo.session.CDOSession;
+
+import org.eclipse.net4j.util.ui.actions.SafeAction;
+
+/**
+ * @author Victor Roldan Betancort
+ */
+public class ToggleLegacyModeDefaultAction extends SafeAction
+{
+ private static final String TITLE = "Legacy Mode";
+
+ private static final String TOOL_TIP = "Toggles the default for legacy mode";
+
+ private CDOSession session;
+
+ public ToggleLegacyModeDefaultAction(CDOSession session)
+ {
+ super(TITLE, AS_CHECK_BOX);
+ setToolTipText(TOOL_TIP);
+ this.session = session;
+ setChecked(LegacyModeRegistry.isLegacyEnabled(session));
+ }
+
+ @Override
+ protected void safeRun() throws Exception
+ {
+ LegacyModeRegistry.setLegacyEnabled(session, !LegacyModeRegistry.isLegacyEnabled(session));
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ViewAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ViewAction.java
index 1159b9630f..5ec4de16c6 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ViewAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/ViewAction.java
@@ -1,47 +1,47 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.emf.cdo.internal.ui.actions;
-
-import org.eclipse.emf.cdo.transaction.CDOTransaction;
-import org.eclipse.emf.cdo.view.CDOView;
-
-import org.eclipse.net4j.util.ui.actions.LongRunningAction;
-
-import org.eclipse.emf.spi.cdo.InternalCDOView;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.IWorkbenchPage;
-
-/**
- * @author Eike Stepper
- */
-public abstract class ViewAction extends LongRunningAction
-{
- protected static int lastResourceNumber = 0;
-
- private CDOView view;
-
- public ViewAction(IWorkbenchPage page, String text, String toolTipText, ImageDescriptor image, CDOView view)
- {
- super(page, text, toolTipText, image);
- this.view = view;
- }
-
- public CDOView getView()
- {
- return view;
- }
-
- public CDOTransaction getTransaction()
- {
- return ((InternalCDOView)view).toTransaction();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.view.CDOView;
+
+import org.eclipse.net4j.util.ui.actions.LongRunningAction;
+
+import org.eclipse.emf.spi.cdo.InternalCDOView;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class ViewAction extends LongRunningAction
+{
+ protected static int lastResourceNumber = 0;
+
+ private CDOView view;
+
+ public ViewAction(IWorkbenchPage page, String text, String toolTipText, ImageDescriptor image, CDOView view)
+ {
+ super(page, text, toolTipText, image);
+ this.view = view;
+ }
+
+ public CDOView getView()
+ {
+ return view;
+ }
+
+ public CDOTransaction getTransaction()
+ {
+ return ((InternalCDOView)view).toTransaction();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/WriteLockObjectsAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/WriteLockObjectsAction.java
index 58698cd315..1ab40b66c0 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/WriteLockObjectsAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/WriteLockObjectsAction.java
@@ -1,38 +1,38 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Simon McDuff - initial API and implementation
- * Eike Stepper - maintenance
- * Victor Roldan Betancort - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui.actions;
-
-import org.eclipse.emf.cdo.CDOLock;
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-
-import org.eclipse.emf.spi.cdo.InternalCDOObject;
-
-/**
- * @author Simon McDuff
- */
-public class WriteLockObjectsAction extends AbstractLockObjectsAction
-{
- public static final String ID = "writelock-objects"; //$NON-NLS-1$
-
- public WriteLockObjectsAction()
- {
- super(Messages.getString("WriteLockObjectsAction.1")); //$NON-NLS-1$
- setId(ID);
- }
-
- @Override
- protected CDOLock getLock(InternalCDOObject object)
- {
- return object.cdoWriteLock();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Simon McDuff - initial API and implementation
+ * Eike Stepper - maintenance
+ * Victor Roldan Betancort - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui.actions;
+
+import org.eclipse.emf.cdo.CDOLock;
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+
+import org.eclipse.emf.spi.cdo.InternalCDOObject;
+
+/**
+ * @author Simon McDuff
+ */
+public class WriteLockObjectsAction extends AbstractLockObjectsAction
+{
+ public static final String ID = "writelock-objects"; //$NON-NLS-1$
+
+ public WriteLockObjectsAction()
+ {
+ super(Messages.getString("WriteLockObjectsAction.1")); //$NON-NLS-1$
+ setId(ID);
+ }
+
+ @Override
+ protected CDOLock getLock(InternalCDOObject object)
+ {
+ return object.cdoWriteLock();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/OM.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/OM.java
index 015567ce34..3f6c73d863 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/OM.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/bundle/OM.java
@@ -1,74 +1,74 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- * Victor Roldan Betancort - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui.bundle;
-
-import org.eclipse.emf.cdo.ui.CDOLabelDecorator;
-
-import org.eclipse.net4j.util.om.OMBundle;
-import org.eclipse.net4j.util.om.OMPlatform;
-import org.eclipse.net4j.util.om.log.OMLogger;
-import org.eclipse.net4j.util.om.pref.OMPreference;
-import org.eclipse.net4j.util.om.pref.OMPreferences;
-import org.eclipse.net4j.util.om.trace.OMTracer;
-import org.eclipse.net4j.util.ui.UIActivator;
-
-/**
- * The <em>Operations & Maintenance</em> class of this bundle.
- *
- * @author Eike Stepper
- */
-public abstract class OM
-{
- public static final String BUNDLE_ID = "org.eclipse.emf.cdo.ui"; //$NON-NLS-1$
-
- public static final OMBundle BUNDLE = OMPlatform.INSTANCE.bundle(BUNDLE_ID, OM.class);
-
- public static final OMTracer DEBUG = BUNDLE.tracer("debug"); //$NON-NLS-1$
-
- public static final OMTracer TEST = BUNDLE.tracer("test"); //$NON-NLS-1$
-
- public static final OMLogger LOG = BUNDLE.logger();
-
- public static final OMPreferences PREFS = BUNDLE.preferences();
-
- public static final OMPreference<String> PREF_LABEL_DECORATION = //
- PREFS.init("PREF_LABEL_DECORATION", CDOLabelDecorator.DEFAULT_DECORATION); //$NON-NLS-1$
-
- public static final OMPreference<String[]> PREF_HISTORY_SELECT_PACKAGES = //
- PREFS.initArray("PREF_HISTORY_SELECT_PACKAGES"); //$NON-NLS-1$
-
- public static final OMPreference<String[]> PREF_HISTORY_CONNECTORS = //
- PREFS.init("PREF_HISTORY_CONNECTORS", new String[] { "tcp://localhost" }); //$NON-NLS-1$
-
- public static final OMPreference<String[]> PREF_HISTORY_REPOSITORIES = //
- PREFS.init("PREF_HISTORY_REPOSITORIES", new String[] { "repo1" }); //$NON-NLS-1$
-
- public static final OMPreference<Boolean> PREF_AUTOMATIC_PACKAGE_REGISTRY = //
- PREFS.init("PREF_AUTOMATIC_PACKAGE_REGISTRY", true); //$NON-NLS-1$
-
- public static final OMPreference<Boolean> PREF_EDITOR_AUTO_RELOAD = //
- PREFS.init("PREF_EDITOR_AUTO_RELOAD", true); //$NON-NLS-1$
-
- /**
- * @author Eike Stepper
- */
- public static final class Activator extends UIActivator
- {
- public static Activator INSTANCE;
-
- public Activator()
- {
- super(BUNDLE);
- INSTANCE = this;
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ * Victor Roldan Betancort - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui.bundle;
+
+import org.eclipse.emf.cdo.ui.CDOLabelDecorator;
+
+import org.eclipse.net4j.util.om.OMBundle;
+import org.eclipse.net4j.util.om.OMPlatform;
+import org.eclipse.net4j.util.om.log.OMLogger;
+import org.eclipse.net4j.util.om.pref.OMPreference;
+import org.eclipse.net4j.util.om.pref.OMPreferences;
+import org.eclipse.net4j.util.om.trace.OMTracer;
+import org.eclipse.net4j.util.ui.UIActivator;
+
+/**
+ * The <em>Operations & Maintenance</em> class of this bundle.
+ *
+ * @author Eike Stepper
+ */
+public abstract class OM
+{
+ public static final String BUNDLE_ID = "org.eclipse.emf.cdo.ui"; //$NON-NLS-1$
+
+ public static final OMBundle BUNDLE = OMPlatform.INSTANCE.bundle(BUNDLE_ID, OM.class);
+
+ public static final OMTracer DEBUG = BUNDLE.tracer("debug"); //$NON-NLS-1$
+
+ public static final OMTracer TEST = BUNDLE.tracer("test"); //$NON-NLS-1$
+
+ public static final OMLogger LOG = BUNDLE.logger();
+
+ public static final OMPreferences PREFS = BUNDLE.preferences();
+
+ public static final OMPreference<String> PREF_LABEL_DECORATION = //
+ PREFS.init("PREF_LABEL_DECORATION", CDOLabelDecorator.DEFAULT_DECORATION); //$NON-NLS-1$
+
+ public static final OMPreference<String[]> PREF_HISTORY_SELECT_PACKAGES = //
+ PREFS.initArray("PREF_HISTORY_SELECT_PACKAGES"); //$NON-NLS-1$
+
+ public static final OMPreference<String[]> PREF_HISTORY_CONNECTORS = //
+ PREFS.init("PREF_HISTORY_CONNECTORS", new String[] { "tcp://localhost" }); //$NON-NLS-1$
+
+ public static final OMPreference<String[]> PREF_HISTORY_REPOSITORIES = //
+ PREFS.init("PREF_HISTORY_REPOSITORIES", new String[] { "repo1" }); //$NON-NLS-1$
+
+ public static final OMPreference<Boolean> PREF_AUTOMATIC_PACKAGE_REGISTRY = //
+ PREFS.init("PREF_AUTOMATIC_PACKAGE_REGISTRY", true); //$NON-NLS-1$
+
+ public static final OMPreference<Boolean> PREF_EDITOR_AUTO_RELOAD = //
+ PREFS.init("PREF_EDITOR_AUTO_RELOAD", true); //$NON-NLS-1$
+
+ /**
+ * @author Eike Stepper
+ */
+ public static final class Activator extends UIActivator
+ {
+ public static Activator INSTANCE;
+
+ public Activator()
+ {
+ super(BUNDLE);
+ INSTANCE = this;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/BulkAddDialog.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/BulkAddDialog.java
index 1f5d622241..90a9562e9d 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/BulkAddDialog.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/BulkAddDialog.java
@@ -1,185 +1,185 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- * Victor Roldan Betancort - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui.dialogs;
-
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-
-import org.eclipse.net4j.util.ui.StaticContentProvider;
-import org.eclipse.net4j.util.ui.UIUtil;
-
-import org.eclipse.emf.ecore.EReference;
-
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.TitleAreaDialog;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IWorkbenchPage;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Eike Stepper
- */
-public class BulkAddDialog extends TitleAreaDialog
-{
- public static final String TITLE = Messages.getString("BulkAddDialog.0"); //$NON-NLS-1$
-
- private IWorkbenchPage page;
-
- private List<EReference> features = new ArrayList<EReference>();
-
- private EReference feature;
-
- private int instances = 100;
-
- public BulkAddDialog(IWorkbenchPage page, List<EReference> features)
- {
- super(new Shell(page.getWorkbenchWindow().getShell()));
- setShellStyle(getShellStyle() | SWT.APPLICATION_MODAL | SWT.MAX | SWT.TITLE | SWT.RESIZE);
- this.page = page;
- this.features = features;
- }
-
- public IWorkbenchPage getPage()
- {
- return page;
- }
-
- public List<EReference> getFeatures()
- {
- return features;
- }
-
- public EReference getFeature()
- {
- return feature;
- }
-
- public int getInstances()
- {
- return instances;
- }
-
- @Override
- protected void configureShell(Shell newShell)
- {
- super.configureShell(newShell);
- newShell.setText(TITLE);
- }
-
- @Override
- protected Control createDialogArea(Composite parent)
- {
- Composite composite = new Composite((Composite)super.createDialogArea(parent), SWT.NONE);
- composite.setLayoutData(UIUtil.createGridData());
- composite.setLayout(new GridLayout(2, false));
-
- setTitle(Messages.getString("BulkAddDialog.1")); //$NON-NLS-1$
-
- Label label = new Label(composite, SWT.NONE);
- label.setText(Messages.getString("BulkAddDialog.2")); //$NON-NLS-1$
- label.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));
-
- final TableViewer featureViewer = new TableViewer(composite, SWT.BORDER | SWT.SINGLE);
- featureViewer.getTable().setLayoutData(UIUtil.createGridData(true, true));
- featureViewer.setContentProvider(new StaticContentProvider(features));
- featureViewer.setLabelProvider(new LabelProvider()
- {
- @Override
- public String getText(Object element)
- {
- return ((EReference)element).getName();
- }
- });
-
- featureViewer.setInput(features);
- featureViewer.addSelectionChangedListener(new ISelectionChangedListener()
- {
- public void selectionChanged(SelectionChangedEvent event)
- {
- IStructuredSelection selection = (IStructuredSelection)featureViewer.getSelection();
- feature = selection.isEmpty() ? null : (EReference)selection.getFirstElement();
- dialogChanged();
- }
- });
-
- new Label(composite, SWT.NONE).setText(Messages.getString("BulkAddDialog.3")); //$NON-NLS-1$
- final Text instancesText = new Text(composite, SWT.BORDER);
- instancesText.setLayoutData(UIUtil.createGridData(true, false));
- instancesText.setText(String.valueOf(instances));
- instancesText.addModifyListener(new ModifyListener()
- {
- public void modifyText(ModifyEvent e)
- {
- try
- {
- String text = instancesText.getText();
- instances = Integer.parseInt(text);
- }
- catch (NumberFormatException ex)
- {
- instances = 0;
- }
-
- dialogChanged();
- }
- });
-
- return composite;
- }
-
- @Override
- protected Control createButtonBar(Composite parent)
- {
- try
- {
- return super.createButtonBar(parent);
- }
- finally
- {
- dialogChanged();
- }
- }
-
- protected void dialogChanged()
- {
- getButton(IDialogConstants.OK_ID).setEnabled(false);
- if (feature == null)
- {
- setErrorMessage(Messages.getString("BulkAddDialog.4")); //$NON-NLS-1$
- return;
- }
-
- if (instances == 0)
- {
- setErrorMessage(Messages.getString("BulkAddDialog.5")); //$NON-NLS-1$
- return;
- }
-
- getButton(IDialogConstants.OK_ID).setEnabled(true);
- setErrorMessage(null);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ * Victor Roldan Betancort - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui.dialogs;
+
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+
+import org.eclipse.net4j.util.ui.StaticContentProvider;
+import org.eclipse.net4j.util.ui.UIUtil;
+
+import org.eclipse.emf.ecore.EReference;
+
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.TitleAreaDialog;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IWorkbenchPage;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ */
+public class BulkAddDialog extends TitleAreaDialog
+{
+ public static final String TITLE = Messages.getString("BulkAddDialog.0"); //$NON-NLS-1$
+
+ private IWorkbenchPage page;
+
+ private List<EReference> features = new ArrayList<EReference>();
+
+ private EReference feature;
+
+ private int instances = 100;
+
+ public BulkAddDialog(IWorkbenchPage page, List<EReference> features)
+ {
+ super(new Shell(page.getWorkbenchWindow().getShell()));
+ setShellStyle(getShellStyle() | SWT.APPLICATION_MODAL | SWT.MAX | SWT.TITLE | SWT.RESIZE);
+ this.page = page;
+ this.features = features;
+ }
+
+ public IWorkbenchPage getPage()
+ {
+ return page;
+ }
+
+ public List<EReference> getFeatures()
+ {
+ return features;
+ }
+
+ public EReference getFeature()
+ {
+ return feature;
+ }
+
+ public int getInstances()
+ {
+ return instances;
+ }
+
+ @Override
+ protected void configureShell(Shell newShell)
+ {
+ super.configureShell(newShell);
+ newShell.setText(TITLE);
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent)
+ {
+ Composite composite = new Composite((Composite)super.createDialogArea(parent), SWT.NONE);
+ composite.setLayoutData(UIUtil.createGridData());
+ composite.setLayout(new GridLayout(2, false));
+
+ setTitle(Messages.getString("BulkAddDialog.1")); //$NON-NLS-1$
+
+ Label label = new Label(composite, SWT.NONE);
+ label.setText(Messages.getString("BulkAddDialog.2")); //$NON-NLS-1$
+ label.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));
+
+ final TableViewer featureViewer = new TableViewer(composite, SWT.BORDER | SWT.SINGLE);
+ featureViewer.getTable().setLayoutData(UIUtil.createGridData(true, true));
+ featureViewer.setContentProvider(new StaticContentProvider(features));
+ featureViewer.setLabelProvider(new LabelProvider()
+ {
+ @Override
+ public String getText(Object element)
+ {
+ return ((EReference)element).getName();
+ }
+ });
+
+ featureViewer.setInput(features);
+ featureViewer.addSelectionChangedListener(new ISelectionChangedListener()
+ {
+ public void selectionChanged(SelectionChangedEvent event)
+ {
+ IStructuredSelection selection = (IStructuredSelection)featureViewer.getSelection();
+ feature = selection.isEmpty() ? null : (EReference)selection.getFirstElement();
+ dialogChanged();
+ }
+ });
+
+ new Label(composite, SWT.NONE).setText(Messages.getString("BulkAddDialog.3")); //$NON-NLS-1$
+ final Text instancesText = new Text(composite, SWT.BORDER);
+ instancesText.setLayoutData(UIUtil.createGridData(true, false));
+ instancesText.setText(String.valueOf(instances));
+ instancesText.addModifyListener(new ModifyListener()
+ {
+ public void modifyText(ModifyEvent e)
+ {
+ try
+ {
+ String text = instancesText.getText();
+ instances = Integer.parseInt(text);
+ }
+ catch (NumberFormatException ex)
+ {
+ instances = 0;
+ }
+
+ dialogChanged();
+ }
+ });
+
+ return composite;
+ }
+
+ @Override
+ protected Control createButtonBar(Composite parent)
+ {
+ try
+ {
+ return super.createButtonBar(parent);
+ }
+ finally
+ {
+ dialogChanged();
+ }
+ }
+
+ protected void dialogChanged()
+ {
+ getButton(IDialogConstants.OK_ID).setEnabled(false);
+ if (feature == null)
+ {
+ setErrorMessage(Messages.getString("BulkAddDialog.4")); //$NON-NLS-1$
+ return;
+ }
+
+ if (instances == 0)
+ {
+ setErrorMessage(Messages.getString("BulkAddDialog.5")); //$NON-NLS-1$
+ return;
+ }
+
+ getButton(IDialogConstants.OK_ID).setEnabled(true);
+ setErrorMessage(null);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/ExportResourceDialog.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/ExportResourceDialog.java
index a05c0402c2..9f67801f3b 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/ExportResourceDialog.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/ExportResourceDialog.java
@@ -1,105 +1,105 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- * Victor Roldan Betancort - bug 244801
- */
-package org.eclipse.emf.cdo.internal.ui.dialogs;
-
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-
-import org.eclipse.emf.common.ui.dialogs.ResourceDialog;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * @author Eike Stepper
- */
-public class ExportResourceDialog extends ResourceDialog
-{
- private String targetPath = "/"; //$NON-NLS-1$
-
- private Text targetText;
-
- public ExportResourceDialog(Shell parent, String title, int style)
- {
- super(parent, title, style);
- }
-
- public String getTargetPath()
- {
- return targetPath;
- }
-
- public void setTargetPath(String targetPath)
- {
- this.targetPath = targetPath;
- }
-
- @Override
- protected Control createDialogArea(Composite parent)
- {
- Composite composite = (Composite)super.createDialogArea(parent);
-
- Label separatorLabel1 = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
- {
- FormData data = new FormData();
- data.top = new FormAttachment(uriField, (int)(1.5 * CONTROL_OFFSET));
- data.left = new FormAttachment(0, -CONTROL_OFFSET);
- data.right = new FormAttachment(100, CONTROL_OFFSET);
- separatorLabel1.setLayoutData(data);
- }
-
- Label label = new Label(composite, SWT.NONE);
- label.setText(Messages.getString("ExportResourceDialog.1")); //$NON-NLS-1$
- {
- FormData data = new FormData();
- data.top = new FormAttachment(separatorLabel1, CONTROL_OFFSET);
- data.left = new FormAttachment(0, CONTROL_OFFSET);
- data.right = new FormAttachment(100, -CONTROL_OFFSET);
- label.setLayoutData(data);
- }
-
- targetText = new Text(composite, SWT.BORDER);
- {
- FormData data = new FormData();
- data.top = new FormAttachment(label, CONTROL_OFFSET);
- data.left = new FormAttachment(0, CONTROL_OFFSET);
- data.right = new FormAttachment(100, -CONTROL_OFFSET);
- targetText.setLayoutData(data);
- targetText.setText(targetPath);
- targetText.addModifyListener(new ModifyListener()
- {
- public void modifyText(ModifyEvent e)
- {
- targetPath = targetText.getText();
- }
- });
- }
-
- Label separatorLabel2 = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
- {
- FormData data = new FormData();
- data.top = new FormAttachment(targetText, (int)(1.5 * CONTROL_OFFSET));
- data.left = new FormAttachment(0, -CONTROL_OFFSET);
- data.right = new FormAttachment(100, CONTROL_OFFSET);
- separatorLabel2.setLayoutData(data);
- }
-
- return composite;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ * Victor Roldan Betancort - bug 244801
+ */
+package org.eclipse.emf.cdo.internal.ui.dialogs;
+
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+
+import org.eclipse.emf.common.ui.dialogs.ResourceDialog;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * @author Eike Stepper
+ */
+public class ExportResourceDialog extends ResourceDialog
+{
+ private String targetPath = "/"; //$NON-NLS-1$
+
+ private Text targetText;
+
+ public ExportResourceDialog(Shell parent, String title, int style)
+ {
+ super(parent, title, style);
+ }
+
+ public String getTargetPath()
+ {
+ return targetPath;
+ }
+
+ public void setTargetPath(String targetPath)
+ {
+ this.targetPath = targetPath;
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent)
+ {
+ Composite composite = (Composite)super.createDialogArea(parent);
+
+ Label separatorLabel1 = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
+ {
+ FormData data = new FormData();
+ data.top = new FormAttachment(uriField, (int)(1.5 * CONTROL_OFFSET));
+ data.left = new FormAttachment(0, -CONTROL_OFFSET);
+ data.right = new FormAttachment(100, CONTROL_OFFSET);
+ separatorLabel1.setLayoutData(data);
+ }
+
+ Label label = new Label(composite, SWT.NONE);
+ label.setText(Messages.getString("ExportResourceDialog.1")); //$NON-NLS-1$
+ {
+ FormData data = new FormData();
+ data.top = new FormAttachment(separatorLabel1, CONTROL_OFFSET);
+ data.left = new FormAttachment(0, CONTROL_OFFSET);
+ data.right = new FormAttachment(100, -CONTROL_OFFSET);
+ label.setLayoutData(data);
+ }
+
+ targetText = new Text(composite, SWT.BORDER);
+ {
+ FormData data = new FormData();
+ data.top = new FormAttachment(label, CONTROL_OFFSET);
+ data.left = new FormAttachment(0, CONTROL_OFFSET);
+ data.right = new FormAttachment(100, -CONTROL_OFFSET);
+ targetText.setLayoutData(data);
+ targetText.setText(targetPath);
+ targetText.addModifyListener(new ModifyListener()
+ {
+ public void modifyText(ModifyEvent e)
+ {
+ targetPath = targetText.getText();
+ }
+ });
+ }
+
+ Label separatorLabel2 = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
+ {
+ FormData data = new FormData();
+ data.top = new FormAttachment(targetText, (int)(1.5 * CONTROL_OFFSET));
+ data.left = new FormAttachment(0, -CONTROL_OFFSET);
+ data.right = new FormAttachment(100, CONTROL_OFFSET);
+ separatorLabel2.setLayoutData(data);
+ }
+
+ return composite;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/ImportResourceDialog.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/ImportResourceDialog.java
index 0cec21122a..bddfb68b05 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/ImportResourceDialog.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/ImportResourceDialog.java
@@ -1,105 +1,105 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- * Victor Roldan Betancort - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui.dialogs;
-
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-
-import org.eclipse.emf.common.ui.dialogs.ResourceDialog;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * @author Eike Stepper
- */
-public class ImportResourceDialog extends ResourceDialog
-{
- private String targetPath = "/"; //$NON-NLS-1$
-
- private Text targetText;
-
- public ImportResourceDialog(Shell parent, String title, int style)
- {
- super(parent, title, style);
- }
-
- public String getTargetPath()
- {
- return targetPath;
- }
-
- public void setTargetPath(String targetPath)
- {
- this.targetPath = targetPath;
- }
-
- @Override
- protected Control createDialogArea(Composite parent)
- {
- Composite composite = (Composite)super.createDialogArea(parent);
-
- Label separatorLabel1 = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
- {
- FormData data = new FormData();
- data.top = new FormAttachment(uriField, (int)(1.5 * CONTROL_OFFSET));
- data.left = new FormAttachment(0, -CONTROL_OFFSET);
- data.right = new FormAttachment(100, CONTROL_OFFSET);
- separatorLabel1.setLayoutData(data);
- }
-
- Label label = new Label(composite, SWT.NONE);
- label.setText(Messages.getString("ImportResourceDialog.1")); //$NON-NLS-1$
- {
- FormData data = new FormData();
- data.top = new FormAttachment(separatorLabel1, CONTROL_OFFSET);
- data.left = new FormAttachment(0, CONTROL_OFFSET);
- data.right = new FormAttachment(100, -CONTROL_OFFSET);
- label.setLayoutData(data);
- }
-
- targetText = new Text(composite, SWT.BORDER);
- {
- FormData data = new FormData();
- data.top = new FormAttachment(label, CONTROL_OFFSET);
- data.left = new FormAttachment(0, CONTROL_OFFSET);
- data.right = new FormAttachment(100, -CONTROL_OFFSET);
- targetText.setLayoutData(data);
- targetText.setText(targetPath);
- targetText.addModifyListener(new ModifyListener()
- {
- public void modifyText(ModifyEvent e)
- {
- targetPath = targetText.getText();
- }
- });
- }
-
- Label separatorLabel2 = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
- {
- FormData data = new FormData();
- data.top = new FormAttachment(targetText, (int)(1.5 * CONTROL_OFFSET));
- data.left = new FormAttachment(0, -CONTROL_OFFSET);
- data.right = new FormAttachment(100, CONTROL_OFFSET);
- separatorLabel2.setLayoutData(data);
- }
-
- return composite;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ * Victor Roldan Betancort - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui.dialogs;
+
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+
+import org.eclipse.emf.common.ui.dialogs.ResourceDialog;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * @author Eike Stepper
+ */
+public class ImportResourceDialog extends ResourceDialog
+{
+ private String targetPath = "/"; //$NON-NLS-1$
+
+ private Text targetText;
+
+ public ImportResourceDialog(Shell parent, String title, int style)
+ {
+ super(parent, title, style);
+ }
+
+ public String getTargetPath()
+ {
+ return targetPath;
+ }
+
+ public void setTargetPath(String targetPath)
+ {
+ this.targetPath = targetPath;
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent)
+ {
+ Composite composite = (Composite)super.createDialogArea(parent);
+
+ Label separatorLabel1 = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
+ {
+ FormData data = new FormData();
+ data.top = new FormAttachment(uriField, (int)(1.5 * CONTROL_OFFSET));
+ data.left = new FormAttachment(0, -CONTROL_OFFSET);
+ data.right = new FormAttachment(100, CONTROL_OFFSET);
+ separatorLabel1.setLayoutData(data);
+ }
+
+ Label label = new Label(composite, SWT.NONE);
+ label.setText(Messages.getString("ImportResourceDialog.1")); //$NON-NLS-1$
+ {
+ FormData data = new FormData();
+ data.top = new FormAttachment(separatorLabel1, CONTROL_OFFSET);
+ data.left = new FormAttachment(0, CONTROL_OFFSET);
+ data.right = new FormAttachment(100, -CONTROL_OFFSET);
+ label.setLayoutData(data);
+ }
+
+ targetText = new Text(composite, SWT.BORDER);
+ {
+ FormData data = new FormData();
+ data.top = new FormAttachment(label, CONTROL_OFFSET);
+ data.left = new FormAttachment(0, CONTROL_OFFSET);
+ data.right = new FormAttachment(100, -CONTROL_OFFSET);
+ targetText.setLayoutData(data);
+ targetText.setText(targetPath);
+ targetText.addModifyListener(new ModifyListener()
+ {
+ public void modifyText(ModifyEvent e)
+ {
+ targetPath = targetText.getText();
+ }
+ });
+ }
+
+ Label separatorLabel2 = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
+ {
+ FormData data = new FormData();
+ data.top = new FormAttachment(targetText, (int)(1.5 * CONTROL_OFFSET));
+ data.left = new FormAttachment(0, -CONTROL_OFFSET);
+ data.right = new FormAttachment(100, CONTROL_OFFSET);
+ separatorLabel2.setLayoutData(data);
+ }
+
+ return composite;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenAuditDialog.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenAuditDialog.java
index 1c9c1809e8..957dbf7b7a 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenAuditDialog.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenAuditDialog.java
@@ -1,102 +1,102 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- * Victor Roldan Betancort - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui.dialogs;
-
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-import org.eclipse.emf.cdo.ui.shared.SharedIcons;
-
-import org.eclipse.net4j.util.ui.UIUtil;
-
-import org.eclipse.jface.dialogs.TitleAreaDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.DateTime;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbenchPage;
-
-import java.util.Calendar;
-import java.util.GregorianCalendar;
-
-/**
- * @author Eike Stepper
- */
-public class OpenAuditDialog extends TitleAreaDialog
-{
- public static final String TITLE = Messages.getString("OpenAuditDialog.0"); //$NON-NLS-1$
-
- private IWorkbenchPage page;
-
- private DateTime dateControl;
-
- private DateTime timeControl;
-
- private long timeStamp;
-
- public OpenAuditDialog(IWorkbenchPage page)
- {
- super(new Shell(page.getWorkbenchWindow().getShell()));
- this.page = page;
- setShellStyle(getShellStyle() | SWT.APPLICATION_MODAL | SWT.MAX | SWT.TITLE | SWT.RESIZE);
- }
-
- public IWorkbenchPage getPage()
- {
- return page;
- }
-
- public long getTimeStamp()
- {
- return timeStamp;
- }
-
- @Override
- protected void configureShell(Shell newShell)
- {
- super.configureShell(newShell);
- newShell.setText(TITLE);
- }
-
- @Override
- protected Control createDialogArea(Composite parent)
- {
- Composite composite = new Composite((Composite)super.createDialogArea(parent), SWT.NONE);
- composite.setLayoutData(UIUtil.createGridData());
- composite.setLayout(new GridLayout(3, false));
-
- setTitle(TITLE);
- setTitleImage(SharedIcons.getImage(SharedIcons.WIZBAN_TIME_SELECTION));
-
- new Label(composite, SWT.NONE).setText(Messages.getString("OpenAuditDialog.1")); //$NON-NLS-1$
- dateControl = new DateTime(composite, SWT.DATE | SWT.BORDER);
- timeControl = new DateTime(composite, SWT.TIME | SWT.BORDER);
-
- return composite;
- }
-
- @Override
- protected void okPressed()
- {
- GregorianCalendar calendar = new GregorianCalendar();
- calendar.set(Calendar.YEAR, dateControl.getYear());
- calendar.set(Calendar.MONTH, dateControl.getMonth());
- calendar.set(Calendar.DATE, dateControl.getDay());
- calendar.set(Calendar.HOUR_OF_DAY, timeControl.getHours());
- calendar.set(Calendar.MINUTE, timeControl.getMinutes());
- calendar.set(Calendar.SECOND, timeControl.getSeconds());
-
- timeStamp = calendar.getTimeInMillis();
- super.okPressed();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ * Victor Roldan Betancort - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui.dialogs;
+
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+import org.eclipse.emf.cdo.ui.shared.SharedIcons;
+
+import org.eclipse.net4j.util.ui.UIUtil;
+
+import org.eclipse.jface.dialogs.TitleAreaDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.DateTime;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchPage;
+
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+
+/**
+ * @author Eike Stepper
+ */
+public class OpenAuditDialog extends TitleAreaDialog
+{
+ public static final String TITLE = Messages.getString("OpenAuditDialog.0"); //$NON-NLS-1$
+
+ private IWorkbenchPage page;
+
+ private DateTime dateControl;
+
+ private DateTime timeControl;
+
+ private long timeStamp;
+
+ public OpenAuditDialog(IWorkbenchPage page)
+ {
+ super(new Shell(page.getWorkbenchWindow().getShell()));
+ this.page = page;
+ setShellStyle(getShellStyle() | SWT.APPLICATION_MODAL | SWT.MAX | SWT.TITLE | SWT.RESIZE);
+ }
+
+ public IWorkbenchPage getPage()
+ {
+ return page;
+ }
+
+ public long getTimeStamp()
+ {
+ return timeStamp;
+ }
+
+ @Override
+ protected void configureShell(Shell newShell)
+ {
+ super.configureShell(newShell);
+ newShell.setText(TITLE);
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent)
+ {
+ Composite composite = new Composite((Composite)super.createDialogArea(parent), SWT.NONE);
+ composite.setLayoutData(UIUtil.createGridData());
+ composite.setLayout(new GridLayout(3, false));
+
+ setTitle(TITLE);
+ setTitleImage(SharedIcons.getImage(SharedIcons.WIZBAN_TIME_SELECTION));
+
+ new Label(composite, SWT.NONE).setText(Messages.getString("OpenAuditDialog.1")); //$NON-NLS-1$
+ dateControl = new DateTime(composite, SWT.DATE | SWT.BORDER);
+ timeControl = new DateTime(composite, SWT.TIME | SWT.BORDER);
+
+ return composite;
+ }
+
+ @Override
+ protected void okPressed()
+ {
+ GregorianCalendar calendar = new GregorianCalendar();
+ calendar.set(Calendar.YEAR, dateControl.getYear());
+ calendar.set(Calendar.MONTH, dateControl.getMonth());
+ calendar.set(Calendar.DATE, dateControl.getDay());
+ calendar.set(Calendar.HOUR_OF_DAY, timeControl.getHours());
+ calendar.set(Calendar.MINUTE, timeControl.getMinutes());
+ calendar.set(Calendar.SECOND, timeControl.getSeconds());
+
+ timeStamp = calendar.getTimeInMillis();
+ super.okPressed();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenDurableViewDialog.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenDurableViewDialog.java
index 55ff7be344..3440b4969f 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenDurableViewDialog.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenDurableViewDialog.java
@@ -1,89 +1,89 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- * Victor Roldan Betancort - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui.dialogs;
-
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-import org.eclipse.emf.cdo.ui.shared.SharedIcons;
-
-import org.eclipse.net4j.util.ui.UIUtil;
-
-import org.eclipse.jface.dialogs.TitleAreaDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IWorkbenchPage;
-
-/**
- * @author Eike Stepper
- */
-public class OpenDurableViewDialog extends TitleAreaDialog
-{
- public static final String TITLE = Messages.getString("OpenDurableViewDialog.0"); //$NON-NLS-1$
-
- private IWorkbenchPage page;
-
- private Text idControl;
-
- private String areaID;
-
- public OpenDurableViewDialog(IWorkbenchPage page)
- {
- super(new Shell(page.getWorkbenchWindow().getShell()));
- this.page = page;
- setShellStyle(getShellStyle() | SWT.APPLICATION_MODAL | SWT.MAX | SWT.TITLE | SWT.RESIZE);
- }
-
- public IWorkbenchPage getPage()
- {
- return page;
- }
-
- public String getAreaID()
- {
- return areaID;
- }
-
- @Override
- protected void configureShell(Shell newShell)
- {
- super.configureShell(newShell);
- newShell.setText(TITLE);
- }
-
- @Override
- protected Control createDialogArea(Composite parent)
- {
- Composite composite = new Composite((Composite)super.createDialogArea(parent), SWT.NONE);
- composite.setLayoutData(UIUtil.createGridData());
- composite.setLayout(new GridLayout(3, false));
-
- setTitle(TITLE);
- setTitleImage(SharedIcons.getImage(SharedIcons.WIZBAN_TIME_SELECTION));
-
- new Label(composite, SWT.NONE).setText(Messages.getString("OpenDurableViewDialog.1")); //$NON-NLS-1$
- idControl = new Text(composite, SWT.BORDER);
- idControl.setLayoutData(UIUtil.createGridData(true, false));
-
- return composite;
- }
-
- @Override
- protected void okPressed()
- {
- areaID = idControl.getText();
- super.okPressed();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ * Victor Roldan Betancort - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui.dialogs;
+
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+import org.eclipse.emf.cdo.ui.shared.SharedIcons;
+
+import org.eclipse.net4j.util.ui.UIUtil;
+
+import org.eclipse.jface.dialogs.TitleAreaDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * @author Eike Stepper
+ */
+public class OpenDurableViewDialog extends TitleAreaDialog
+{
+ public static final String TITLE = Messages.getString("OpenDurableViewDialog.0"); //$NON-NLS-1$
+
+ private IWorkbenchPage page;
+
+ private Text idControl;
+
+ private String areaID;
+
+ public OpenDurableViewDialog(IWorkbenchPage page)
+ {
+ super(new Shell(page.getWorkbenchWindow().getShell()));
+ this.page = page;
+ setShellStyle(getShellStyle() | SWT.APPLICATION_MODAL | SWT.MAX | SWT.TITLE | SWT.RESIZE);
+ }
+
+ public IWorkbenchPage getPage()
+ {
+ return page;
+ }
+
+ public String getAreaID()
+ {
+ return areaID;
+ }
+
+ @Override
+ protected void configureShell(Shell newShell)
+ {
+ super.configureShell(newShell);
+ newShell.setText(TITLE);
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent)
+ {
+ Composite composite = new Composite((Composite)super.createDialogArea(parent), SWT.NONE);
+ composite.setLayoutData(UIUtil.createGridData());
+ composite.setLayout(new GridLayout(3, false));
+
+ setTitle(TITLE);
+ setTitleImage(SharedIcons.getImage(SharedIcons.WIZBAN_TIME_SELECTION));
+
+ new Label(composite, SWT.NONE).setText(Messages.getString("OpenDurableViewDialog.1")); //$NON-NLS-1$
+ idControl = new Text(composite, SWT.BORDER);
+ idControl.setLayoutData(UIUtil.createGridData(true, false));
+
+ return composite;
+ }
+
+ @Override
+ protected void okPressed()
+ {
+ areaID = idControl.getText();
+ super.okPressed();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenResourcesDialog.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenResourcesDialog.java
index 37661e87eb..52e9a00487 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenResourcesDialog.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenResourcesDialog.java
@@ -1,29 +1,29 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- * Victor Roldan Betancort - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui.dialogs;
-
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.dialogs.FilteredResourcesSelectionDialog;
-
-public class OpenResourcesDialog extends FilteredResourcesSelectionDialog
-{
- public OpenResourcesDialog(Shell parentShell)
- {
- super(parentShell, true, ResourcesPlugin.getWorkspace().getRoot(), IResource.FILE);
- setTitle(Messages.getString("OpenResourcesDialog.0")); //$NON-NLS-1$
- setInitialPattern("*.ecore"); //$NON-NLS-1$
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ * Victor Roldan Betancort - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui.dialogs;
+
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.dialogs.FilteredResourcesSelectionDialog;
+
+public class OpenResourcesDialog extends FilteredResourcesSelectionDialog
+{
+ public OpenResourcesDialog(Shell parentShell)
+ {
+ super(parentShell, true, ResourcesPlugin.getWorkspace().getRoot(), IResource.FILE);
+ setTitle(Messages.getString("OpenResourcesDialog.0")); //$NON-NLS-1$
+ setInitialPattern("*.ecore"); //$NON-NLS-1$
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenSessionDialog.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenSessionDialog.java
index 6ff14c91a0..d0cc7c627c 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenSessionDialog.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenSessionDialog.java
@@ -1,75 +1,75 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- * Victor Roldan Betancort - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui.dialogs;
-
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-import org.eclipse.emf.cdo.ui.shared.SharedIcons;
-import org.eclipse.emf.cdo.ui.widgets.SessionComposite;
-
-import org.eclipse.jface.dialogs.TitleAreaDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbenchPage;
-
-/**
- * @author Eike Stepper
- */
-public class OpenSessionDialog extends TitleAreaDialog
-{
- public static final String TITLE = Messages.getString("OpenSessionDialog.0"); //$NON-NLS-1$
-
- private IWorkbenchPage page;
-
- private SessionComposite sessionComposite;
-
- public OpenSessionDialog(IWorkbenchPage page)
- {
- super(new Shell(page.getWorkbenchWindow().getShell()));
- this.page = page;
- setShellStyle(getShellStyle() | SWT.APPLICATION_MODAL | SWT.MAX | SWT.TITLE | SWT.RESIZE);
- }
-
- public IWorkbenchPage getPage()
- {
- return page;
- }
-
- public SessionComposite getSessionComposite()
- {
- return sessionComposite;
- }
-
- @Override
- protected void configureShell(Shell newShell)
- {
- super.configureShell(newShell);
- newShell.setText(TITLE);
- }
-
- @Override
- protected Control createDialogArea(Composite parent)
- {
- setTitle(TITLE);
- setTitleImage(SharedIcons.getImage(SharedIcons.WIZBAN_PACKAGE_MANAGER));
- sessionComposite = new SessionComposite(parent, SWT.NONE);
- return sessionComposite;
- }
-
- @Override
- protected void okPressed()
- {
- sessionComposite.rememberSettings();
- super.okPressed();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ * Victor Roldan Betancort - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui.dialogs;
+
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+import org.eclipse.emf.cdo.ui.shared.SharedIcons;
+import org.eclipse.emf.cdo.ui.widgets.SessionComposite;
+
+import org.eclipse.jface.dialogs.TitleAreaDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * @author Eike Stepper
+ */
+public class OpenSessionDialog extends TitleAreaDialog
+{
+ public static final String TITLE = Messages.getString("OpenSessionDialog.0"); //$NON-NLS-1$
+
+ private IWorkbenchPage page;
+
+ private SessionComposite sessionComposite;
+
+ public OpenSessionDialog(IWorkbenchPage page)
+ {
+ super(new Shell(page.getWorkbenchWindow().getShell()));
+ this.page = page;
+ setShellStyle(getShellStyle() | SWT.APPLICATION_MODAL | SWT.MAX | SWT.TITLE | SWT.RESIZE);
+ }
+
+ public IWorkbenchPage getPage()
+ {
+ return page;
+ }
+
+ public SessionComposite getSessionComposite()
+ {
+ return sessionComposite;
+ }
+
+ @Override
+ protected void configureShell(Shell newShell)
+ {
+ super.configureShell(newShell);
+ newShell.setText(TITLE);
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent)
+ {
+ setTitle(TITLE);
+ setTitleImage(SharedIcons.getImage(SharedIcons.WIZBAN_PACKAGE_MANAGER));
+ sessionComposite = new SessionComposite(parent, SWT.NONE);
+ return sessionComposite;
+ }
+
+ @Override
+ protected void okPressed()
+ {
+ sessionComposite.rememberSettings();
+ super.okPressed();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/PackageRegistryDialog.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/PackageRegistryDialog.java
index cb9f76a4af..117a4a8f43 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/PackageRegistryDialog.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/PackageRegistryDialog.java
@@ -1,344 +1,344 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- * Victor Roldan Betancort - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui.dialogs;
-
-import org.eclipse.emf.cdo.common.model.CDOModelUtil;
-import org.eclipse.emf.cdo.common.model.CDOPackageInfo;
-import org.eclipse.emf.cdo.common.model.CDOPackageUnit.Type;
-import org.eclipse.emf.cdo.common.model.EMFUtil;
-import org.eclipse.emf.cdo.internal.ui.actions.RegisterFilesystemPackagesAction;
-import org.eclipse.emf.cdo.internal.ui.actions.RegisterGeneratedPackagesAction;
-import org.eclipse.emf.cdo.internal.ui.actions.RegisterWorkspacePackagesAction;
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-import org.eclipse.emf.cdo.session.CDOSession;
-import org.eclipse.emf.cdo.ui.shared.SharedIcons;
-
-import org.eclipse.net4j.util.ObjectUtil;
-import org.eclipse.net4j.util.ui.UIUtil;
-
-import org.eclipse.emf.ecore.EPackage;
-
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.TitleAreaDialog;
-import org.eclipse.jface.viewers.BaseLabelProvider;
-import org.eclipse.jface.viewers.IColorProvider;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.ui.IWorkbenchPage;
-
-import javax.swing.text.AbstractDocument.Content;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-
-/**
- * @author Eike Stepper
- */
-public class PackageRegistryDialog extends TitleAreaDialog
-{
- private static final int REGISTER_GENERATED_PACKAGES_ID = IDialogConstants.CLIENT_ID + 1;
-
- private static final int REGISTER_WORKSPACE_PACKAGES_ID = IDialogConstants.CLIENT_ID + 2;
-
- private static final int REGISTER_FILESYSTEM_PACKAGES_ID = IDialogConstants.CLIENT_ID + 3;
-
- private static final String TITLE = Messages.getString("PackageRegistryDialog.0"); //$NON-NLS-1$
-
- private static final Color GRAY = UIUtil.getDisplay().getSystemColor(SWT.COLOR_GRAY);
-
- private IWorkbenchPage page;
-
- private CDOSession session;
-
- private TableViewer viewer;
-
- public PackageRegistryDialog(IWorkbenchPage page, CDOSession session)
- {
- super(new Shell(page.getWorkbenchWindow().getShell()));
- this.page = page;
- this.session = session;
- setShellStyle(getShellStyle() | SWT.APPLICATION_MODAL | SWT.MAX | SWT.TITLE | SWT.RESIZE);
- }
-
- @Override
- protected void configureShell(Shell newShell)
- {
- super.configureShell(newShell);
- newShell.setText(TITLE);
- }
-
- @Override
- protected Control createDialogArea(Composite parent)
- {
- Composite composite = (Composite)super.createDialogArea(parent);
- setTitle(session.toString());
- setTitleImage(SharedIcons.getImage(SharedIcons.WIZBAN_PACKAGE_MANAGER));
-
- viewer = new TableViewer(composite, SWT.NONE);
- Table table = viewer.getTable();
-
- table.setHeaderVisible(true);
- table.setLayoutData(UIUtil.createGridData());
- addColumn(table, Messages.getString("PackageRegistryDialog.1"), 450, SWT.LEFT); //$NON-NLS-1$
- addColumn(table, Messages.getString("PackageRegistryDialog.2"), 80, SWT.CENTER); //$NON-NLS-1$
- addColumn(table, Messages.getString("PackageRegistryDialog.3"), 80, SWT.CENTER); //$NON-NLS-1$
- addColumn(table, Messages.getString("PackageRegistryDialog.4"), 80, SWT.CENTER); //$NON-NLS-1$
-
- viewer.setContentProvider(new EPackageContentProvider());
- viewer.setLabelProvider(new EPackageLabelProvider());
- viewer.setInput(session);
-
- return composite;
- }
-
- @Override
- protected void createButtonsForButtonBar(Composite parent)
- {
- Button button = createButton(parent, REGISTER_GENERATED_PACKAGES_ID,
- Messages.getString("PackageRegistryDialog.5"), false); //$NON-NLS-1$
- button.setEnabled(isGlobalPackageAvaliable());
-
- createButton(parent, REGISTER_WORKSPACE_PACKAGES_ID, Messages.getString("PackageRegistryDialog.6"), false); //$NON-NLS-1$
- createButton(parent, REGISTER_FILESYSTEM_PACKAGES_ID, Messages.getString("PackageRegistryDialog.7"), false); //$NON-NLS-1$
- createButton(parent, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL, false);
- }
-
- private boolean isGlobalPackageAvaliable()
- {
- Set<String> uris = new HashSet<String>(EPackage.Registry.INSTANCE.keySet());
- uris.removeAll(session.getPackageRegistry().keySet());
- return !uris.isEmpty();
- }
-
- @Override
- protected void buttonPressed(int buttonId)
- {
- switch (buttonId)
- {
- case REGISTER_GENERATED_PACKAGES_ID:
- new RegisterGeneratedPackagesAction(page, session)
- {
- @Override
- protected void postRegistration(List<EPackage> ePackages)
- {
- refreshViewer();
- }
- }.run();
-
- break;
-
- case REGISTER_WORKSPACE_PACKAGES_ID:
- new RegisterWorkspacePackagesAction(page, session)
- {
- @Override
- protected void postRegistration(List<EPackage> ePackages)
- {
- refreshViewer();
- }
- }.run();
-
- break;
-
- case REGISTER_FILESYSTEM_PACKAGES_ID:
- new RegisterFilesystemPackagesAction(page, session)
- {
- @Override
- protected void postRegistration(List<EPackage> ePackages)
- {
- refreshViewer();
- }
- }.run();
-
- break;
-
- case IDialogConstants.CLOSE_ID:
- close();
- break;
- }
- }
-
- private void addColumn(Table table, String title, int width, int alignment)
- {
- TableColumn column = new TableColumn(table, alignment);
- column.setText(title);
- column.setWidth(width);
- }
-
- protected Image getContentIcon(Content content)
- {
- return null;
- }
-
- protected void refreshViewer()
- {
- page.getWorkbenchWindow().getShell().getDisplay().asyncExec(new Runnable()
- {
- public void run()
- {
- try
- {
- viewer.refresh();
- }
- catch (RuntimeException ignore)
- {
- }
- }
- });
- }
-
- /**
- * @author Eike Stepper
- */
- public class EPackageLabelProvider extends BaseLabelProvider implements ITableLabelProvider, IColorProvider
- {
- public EPackageLabelProvider()
- {
- }
-
- public String getColumnText(Object element, int columnIndex)
- {
- @SuppressWarnings("unchecked")
- Map.Entry<String, Object> entry = (Entry<String, Object>)element;
- CDOPackageInfo packageInfo = CDOModelUtil.getPackageInfo(entry.getValue(), session.getPackageRegistry());
- if (packageInfo != null)
- {
- switch (columnIndex)
- {
- case 0:
- return packageInfo.getPackageURI();
-
- case 1:
- return packageInfo.getPackageUnit().getState().toString();
-
- case 2:
- if (packageInfo.getPackageUnit().getType() == Type.UNKNOWN)
- {
- return Messages.getString("PackageRegistryDialog.8"); //$NON-NLS-1$
- }
-
- return packageInfo.getPackageUnit().getType().toString();
-
- case 3:
- return packageInfo.getPackageUnit().getOriginalType().toString();
- }
- }
-
- switch (columnIndex)
- {
- case 0:
- return entry.getKey();
-
- default:
- return ""; //$NON-NLS-1$
- }
- }
-
- public Image getColumnImage(Object element, int columnIndex)
- {
- if (columnIndex == 0)
- {
- @SuppressWarnings("unchecked")
- Map.Entry<String, Object> entry = (Entry<String, Object>)element;
- CDOPackageInfo packageInfo = CDOModelUtil.getPackageInfo(entry.getValue(), session.getPackageRegistry());
- if (packageInfo != null)
- {
- switch (packageInfo.getPackageUnit().getType())
- {
- case LEGACY:
- return SharedIcons.getDescriptor(SharedIcons.OBJ_EPACKAGE_LEGACY).createImage();
-
- case NATIVE:
- return SharedIcons.getDescriptor(SharedIcons.OBJ_EPACKAGE_NATIVE).createImage();
-
- case DYNAMIC:
- return SharedIcons.getDescriptor(SharedIcons.OBJ_EPACKAGE_DYNAMIC).createImage();
- }
- }
-
- return SharedIcons.getDescriptor(SharedIcons.OBJ_EPACKAGE_UNKNOWN).createImage();
- }
-
- return null;
- }
-
- public Color getBackground(Object element)
- {
- return null;
- }
-
- public Color getForeground(Object element)
- {
- @SuppressWarnings("unchecked")
- Map.Entry<String, Object> entry = (Entry<String, Object>)element;
- CDOPackageInfo packageInfo = CDOModelUtil.getPackageInfo(entry.getValue(), session.getPackageRegistry());
- if (packageInfo != null)
- {
- return null;
- }
-
- return GRAY;
- }
- }
-
- /**
- * @author Eike Stepper
- */
- public static class EPackageContentProvider implements IStructuredContentProvider
- {
- private static final Object[] NO_ELEMENTS = {};
-
- private CDOSession session;
-
- public EPackageContentProvider()
- {
- }
-
- public void dispose()
- {
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
- {
- if (newInput instanceof CDOSession)
- {
- if (!ObjectUtil.equals(session, newInput))
- {
- session = (CDOSession)newInput;
- }
- }
- }
-
- public Object[] getElements(Object inputElement)
- {
- if (inputElement != session)
- {
- return NO_ELEMENTS;
- }
-
- return EMFUtil.getSortedRegistryEntries(session.getPackageRegistry());
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ * Victor Roldan Betancort - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui.dialogs;
+
+import org.eclipse.emf.cdo.common.model.CDOModelUtil;
+import org.eclipse.emf.cdo.common.model.CDOPackageInfo;
+import org.eclipse.emf.cdo.common.model.CDOPackageUnit.Type;
+import org.eclipse.emf.cdo.common.model.EMFUtil;
+import org.eclipse.emf.cdo.internal.ui.actions.RegisterFilesystemPackagesAction;
+import org.eclipse.emf.cdo.internal.ui.actions.RegisterGeneratedPackagesAction;
+import org.eclipse.emf.cdo.internal.ui.actions.RegisterWorkspacePackagesAction;
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.ui.shared.SharedIcons;
+
+import org.eclipse.net4j.util.ObjectUtil;
+import org.eclipse.net4j.util.ui.UIUtil;
+
+import org.eclipse.emf.ecore.EPackage;
+
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.TitleAreaDialog;
+import org.eclipse.jface.viewers.BaseLabelProvider;
+import org.eclipse.jface.viewers.IColorProvider;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.ui.IWorkbenchPage;
+
+import javax.swing.text.AbstractDocument.Content;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+/**
+ * @author Eike Stepper
+ */
+public class PackageRegistryDialog extends TitleAreaDialog
+{
+ private static final int REGISTER_GENERATED_PACKAGES_ID = IDialogConstants.CLIENT_ID + 1;
+
+ private static final int REGISTER_WORKSPACE_PACKAGES_ID = IDialogConstants.CLIENT_ID + 2;
+
+ private static final int REGISTER_FILESYSTEM_PACKAGES_ID = IDialogConstants.CLIENT_ID + 3;
+
+ private static final String TITLE = Messages.getString("PackageRegistryDialog.0"); //$NON-NLS-1$
+
+ private static final Color GRAY = UIUtil.getDisplay().getSystemColor(SWT.COLOR_GRAY);
+
+ private IWorkbenchPage page;
+
+ private CDOSession session;
+
+ private TableViewer viewer;
+
+ public PackageRegistryDialog(IWorkbenchPage page, CDOSession session)
+ {
+ super(new Shell(page.getWorkbenchWindow().getShell()));
+ this.page = page;
+ this.session = session;
+ setShellStyle(getShellStyle() | SWT.APPLICATION_MODAL | SWT.MAX | SWT.TITLE | SWT.RESIZE);
+ }
+
+ @Override
+ protected void configureShell(Shell newShell)
+ {
+ super.configureShell(newShell);
+ newShell.setText(TITLE);
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent)
+ {
+ Composite composite = (Composite)super.createDialogArea(parent);
+ setTitle(session.toString());
+ setTitleImage(SharedIcons.getImage(SharedIcons.WIZBAN_PACKAGE_MANAGER));
+
+ viewer = new TableViewer(composite, SWT.NONE);
+ Table table = viewer.getTable();
+
+ table.setHeaderVisible(true);
+ table.setLayoutData(UIUtil.createGridData());
+ addColumn(table, Messages.getString("PackageRegistryDialog.1"), 450, SWT.LEFT); //$NON-NLS-1$
+ addColumn(table, Messages.getString("PackageRegistryDialog.2"), 80, SWT.CENTER); //$NON-NLS-1$
+ addColumn(table, Messages.getString("PackageRegistryDialog.3"), 80, SWT.CENTER); //$NON-NLS-1$
+ addColumn(table, Messages.getString("PackageRegistryDialog.4"), 80, SWT.CENTER); //$NON-NLS-1$
+
+ viewer.setContentProvider(new EPackageContentProvider());
+ viewer.setLabelProvider(new EPackageLabelProvider());
+ viewer.setInput(session);
+
+ return composite;
+ }
+
+ @Override
+ protected void createButtonsForButtonBar(Composite parent)
+ {
+ Button button = createButton(parent, REGISTER_GENERATED_PACKAGES_ID,
+ Messages.getString("PackageRegistryDialog.5"), false); //$NON-NLS-1$
+ button.setEnabled(isGlobalPackageAvaliable());
+
+ createButton(parent, REGISTER_WORKSPACE_PACKAGES_ID, Messages.getString("PackageRegistryDialog.6"), false); //$NON-NLS-1$
+ createButton(parent, REGISTER_FILESYSTEM_PACKAGES_ID, Messages.getString("PackageRegistryDialog.7"), false); //$NON-NLS-1$
+ createButton(parent, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL, false);
+ }
+
+ private boolean isGlobalPackageAvaliable()
+ {
+ Set<String> uris = new HashSet<String>(EPackage.Registry.INSTANCE.keySet());
+ uris.removeAll(session.getPackageRegistry().keySet());
+ return !uris.isEmpty();
+ }
+
+ @Override
+ protected void buttonPressed(int buttonId)
+ {
+ switch (buttonId)
+ {
+ case REGISTER_GENERATED_PACKAGES_ID:
+ new RegisterGeneratedPackagesAction(page, session)
+ {
+ @Override
+ protected void postRegistration(List<EPackage> ePackages)
+ {
+ refreshViewer();
+ }
+ }.run();
+
+ break;
+
+ case REGISTER_WORKSPACE_PACKAGES_ID:
+ new RegisterWorkspacePackagesAction(page, session)
+ {
+ @Override
+ protected void postRegistration(List<EPackage> ePackages)
+ {
+ refreshViewer();
+ }
+ }.run();
+
+ break;
+
+ case REGISTER_FILESYSTEM_PACKAGES_ID:
+ new RegisterFilesystemPackagesAction(page, session)
+ {
+ @Override
+ protected void postRegistration(List<EPackage> ePackages)
+ {
+ refreshViewer();
+ }
+ }.run();
+
+ break;
+
+ case IDialogConstants.CLOSE_ID:
+ close();
+ break;
+ }
+ }
+
+ private void addColumn(Table table, String title, int width, int alignment)
+ {
+ TableColumn column = new TableColumn(table, alignment);
+ column.setText(title);
+ column.setWidth(width);
+ }
+
+ protected Image getContentIcon(Content content)
+ {
+ return null;
+ }
+
+ protected void refreshViewer()
+ {
+ page.getWorkbenchWindow().getShell().getDisplay().asyncExec(new Runnable()
+ {
+ public void run()
+ {
+ try
+ {
+ viewer.refresh();
+ }
+ catch (RuntimeException ignore)
+ {
+ }
+ }
+ });
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public class EPackageLabelProvider extends BaseLabelProvider implements ITableLabelProvider, IColorProvider
+ {
+ public EPackageLabelProvider()
+ {
+ }
+
+ public String getColumnText(Object element, int columnIndex)
+ {
+ @SuppressWarnings("unchecked")
+ Map.Entry<String, Object> entry = (Entry<String, Object>)element;
+ CDOPackageInfo packageInfo = CDOModelUtil.getPackageInfo(entry.getValue(), session.getPackageRegistry());
+ if (packageInfo != null)
+ {
+ switch (columnIndex)
+ {
+ case 0:
+ return packageInfo.getPackageURI();
+
+ case 1:
+ return packageInfo.getPackageUnit().getState().toString();
+
+ case 2:
+ if (packageInfo.getPackageUnit().getType() == Type.UNKNOWN)
+ {
+ return Messages.getString("PackageRegistryDialog.8"); //$NON-NLS-1$
+ }
+
+ return packageInfo.getPackageUnit().getType().toString();
+
+ case 3:
+ return packageInfo.getPackageUnit().getOriginalType().toString();
+ }
+ }
+
+ switch (columnIndex)
+ {
+ case 0:
+ return entry.getKey();
+
+ default:
+ return ""; //$NON-NLS-1$
+ }
+ }
+
+ public Image getColumnImage(Object element, int columnIndex)
+ {
+ if (columnIndex == 0)
+ {
+ @SuppressWarnings("unchecked")
+ Map.Entry<String, Object> entry = (Entry<String, Object>)element;
+ CDOPackageInfo packageInfo = CDOModelUtil.getPackageInfo(entry.getValue(), session.getPackageRegistry());
+ if (packageInfo != null)
+ {
+ switch (packageInfo.getPackageUnit().getType())
+ {
+ case LEGACY:
+ return SharedIcons.getDescriptor(SharedIcons.OBJ_EPACKAGE_LEGACY).createImage();
+
+ case NATIVE:
+ return SharedIcons.getDescriptor(SharedIcons.OBJ_EPACKAGE_NATIVE).createImage();
+
+ case DYNAMIC:
+ return SharedIcons.getDescriptor(SharedIcons.OBJ_EPACKAGE_DYNAMIC).createImage();
+ }
+ }
+
+ return SharedIcons.getDescriptor(SharedIcons.OBJ_EPACKAGE_UNKNOWN).createImage();
+ }
+
+ return null;
+ }
+
+ public Color getBackground(Object element)
+ {
+ return null;
+ }
+
+ public Color getForeground(Object element)
+ {
+ @SuppressWarnings("unchecked")
+ Map.Entry<String, Object> entry = (Entry<String, Object>)element;
+ CDOPackageInfo packageInfo = CDOModelUtil.getPackageInfo(entry.getValue(), session.getPackageRegistry());
+ if (packageInfo != null)
+ {
+ return null;
+ }
+
+ return GRAY;
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static class EPackageContentProvider implements IStructuredContentProvider
+ {
+ private static final Object[] NO_ELEMENTS = {};
+
+ private CDOSession session;
+
+ public EPackageContentProvider()
+ {
+ }
+
+ public void dispose()
+ {
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
+ {
+ if (newInput instanceof CDOSession)
+ {
+ if (!ObjectUtil.equals(session, newInput))
+ {
+ session = (CDOSession)newInput;
+ }
+ }
+ }
+
+ public Object[] getElements(Object inputElement)
+ {
+ if (inputElement != session)
+ {
+ return NO_ELEMENTS;
+ }
+
+ return EMFUtil.getSortedRegistryEntries(session.getPackageRegistry());
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/RollbackTransactionDialog.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/RollbackTransactionDialog.java
index 7c7b9b37f7..169e1038a7 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/RollbackTransactionDialog.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/RollbackTransactionDialog.java
@@ -1,115 +1,115 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- * Victor Roldan Betancort - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui.dialogs;
-
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-import org.eclipse.emf.cdo.transaction.CDOTransaction;
-
-import org.eclipse.net4j.util.ui.UIUtil;
-
-import org.eclipse.jface.dialogs.TitleAreaDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbenchPage;
-
-/**
- * @author Eike Stepper
- */
-public class RollbackTransactionDialog extends TitleAreaDialog
-{
- private IWorkbenchPage page;
-
- private String title;
-
- private String description;
-
- private CDOTransaction transaction;
-
- public RollbackTransactionDialog(IWorkbenchPage page, String title, String description, CDOTransaction transaction)
- {
- super(new Shell(page.getWorkbenchWindow().getShell()));
- this.page = page;
- this.title = title;
- this.description = description;
- this.transaction = transaction;
- setShellStyle(getShellStyle() | SWT.APPLICATION_MODAL | SWT.MAX | SWT.TITLE | SWT.RESIZE);
- }
-
- public IWorkbenchPage getPage()
- {
- return page;
- }
-
- @Override
- protected void configureShell(Shell newShell)
- {
- super.configureShell(newShell);
- newShell.setText(title);
- }
-
- @Override
- protected Control createDialogArea(Composite parent)
- {
- Composite composite = new Composite((Composite)super.createDialogArea(parent), SWT.NONE);
- composite.setLayoutData(UIUtil.createGridData());
- composite.setLayout(new GridLayout(1, false));
-
- setTitle(description);
- setTitleImage(getShell().getDisplay().getSystemImage(SWT.ICON_QUESTION));
-
- Label label = new Label(composite, SWT.NONE);
- label.setText(formatMessage());
- label.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, true));
-
- return composite;
- }
-
- protected String formatMessage()
- {
- StringBuilder builder = new StringBuilder();
- builder.append(Messages.getString("RollbackTransactionDialog.0")); //$NON-NLS-1$
-
- append(builder, transaction.getNewObjects().size(),
- Messages.getString("RollbackTransactionDialog.4"), Messages.getString("RollbackTransactionDialog.5")); //$NON-NLS-1$ //$NON-NLS-2$
- append(builder, transaction.getDirtyObjects().size(),
- Messages.getString("RollbackTransactionDialog.6"), Messages.getString("RollbackTransactionDialog.7")); //$NON-NLS-1$ //$NON-NLS-2$
- append(builder, transaction.getDetachedObjects().size(),
- Messages.getString("RollbackTransactionDialog.8"), Messages.getString("RollbackTransactionDialog.9")); //$NON-NLS-1$ //$NON-NLS-2$
-
- builder.append("\n\n"); //$NON-NLS-1$
- builder.append(Messages.getString("RollbackTransactionDialog.11")); //$NON-NLS-1$
- return builder.toString();
- }
-
- private void append(StringBuilder builder, int count, String labelSingular, String labelPlural)
- {
- if (count > 0)
- {
- builder.append("\n- "); //$NON-NLS-1$
- builder.append(count);
- builder.append(" "); //$NON-NLS-1$
- if (count > 1)
- {
- builder.append(labelPlural);
- }
- else
- {
- builder.append(labelSingular);
- }
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ * Victor Roldan Betancort - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui.dialogs;
+
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+
+import org.eclipse.net4j.util.ui.UIUtil;
+
+import org.eclipse.jface.dialogs.TitleAreaDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * @author Eike Stepper
+ */
+public class RollbackTransactionDialog extends TitleAreaDialog
+{
+ private IWorkbenchPage page;
+
+ private String title;
+
+ private String description;
+
+ private CDOTransaction transaction;
+
+ public RollbackTransactionDialog(IWorkbenchPage page, String title, String description, CDOTransaction transaction)
+ {
+ super(new Shell(page.getWorkbenchWindow().getShell()));
+ this.page = page;
+ this.title = title;
+ this.description = description;
+ this.transaction = transaction;
+ setShellStyle(getShellStyle() | SWT.APPLICATION_MODAL | SWT.MAX | SWT.TITLE | SWT.RESIZE);
+ }
+
+ public IWorkbenchPage getPage()
+ {
+ return page;
+ }
+
+ @Override
+ protected void configureShell(Shell newShell)
+ {
+ super.configureShell(newShell);
+ newShell.setText(title);
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent)
+ {
+ Composite composite = new Composite((Composite)super.createDialogArea(parent), SWT.NONE);
+ composite.setLayoutData(UIUtil.createGridData());
+ composite.setLayout(new GridLayout(1, false));
+
+ setTitle(description);
+ setTitleImage(getShell().getDisplay().getSystemImage(SWT.ICON_QUESTION));
+
+ Label label = new Label(composite, SWT.NONE);
+ label.setText(formatMessage());
+ label.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, true));
+
+ return composite;
+ }
+
+ protected String formatMessage()
+ {
+ StringBuilder builder = new StringBuilder();
+ builder.append(Messages.getString("RollbackTransactionDialog.0")); //$NON-NLS-1$
+
+ append(builder, transaction.getNewObjects().size(),
+ Messages.getString("RollbackTransactionDialog.4"), Messages.getString("RollbackTransactionDialog.5")); //$NON-NLS-1$ //$NON-NLS-2$
+ append(builder, transaction.getDirtyObjects().size(),
+ Messages.getString("RollbackTransactionDialog.6"), Messages.getString("RollbackTransactionDialog.7")); //$NON-NLS-1$ //$NON-NLS-2$
+ append(builder, transaction.getDetachedObjects().size(),
+ Messages.getString("RollbackTransactionDialog.8"), Messages.getString("RollbackTransactionDialog.9")); //$NON-NLS-1$ //$NON-NLS-2$
+
+ builder.append("\n\n"); //$NON-NLS-1$
+ builder.append(Messages.getString("RollbackTransactionDialog.11")); //$NON-NLS-1$
+ return builder.toString();
+ }
+
+ private void append(StringBuilder builder, int count, String labelSingular, String labelPlural)
+ {
+ if (count > 0)
+ {
+ builder.append("\n- "); //$NON-NLS-1$
+ builder.append(count);
+ builder.append(" "); //$NON-NLS-1$
+ if (count > 1)
+ {
+ builder.append(labelPlural);
+ }
+ else
+ {
+ builder.append(labelSingular);
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/SelectBranchPointDialog.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/SelectBranchPointDialog.java
index c1efdf4b7c..0b428d1713 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/SelectBranchPointDialog.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/SelectBranchPointDialog.java
@@ -1,269 +1,269 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.emf.cdo.internal.ui.dialogs;
-
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.session.CDOSession;
-import org.eclipse.emf.cdo.ui.widgets.ComposeBranchPointComposite;
-
-import org.eclipse.net4j.util.StringUtil;
-import org.eclipse.net4j.util.ui.UIUtil;
-import org.eclipse.net4j.util.ui.ValidationContext;
-
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jface.dialogs.TitleAreaDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CTabFolder;
-import org.eclipse.swt.custom.CTabItem;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IWorkbenchPage;
-
-/**
- * @author Eike Stepper
- */
-public class SelectBranchPointDialog extends TitleAreaDialog implements ValidationContext
-{
- protected final ValidationContext aggregator = new ValidationContext.Aggregator(this);
-
- private CDOSession session;
-
- private CDOBranchPoint branchPoint;
-
- private boolean allowTimeStamp;
-
- private CTabItem composeTab;
-
- private CTabItem commitsTab;
-
- private CTabItem tagsTab;
-
- private CTabItem viewsTab;
-
- public SelectBranchPointDialog(IWorkbenchPage page, CDOSession session, CDOBranchPoint branchPoint,
- boolean allowTimeStamp)
- {
- super(page.getWorkbenchWindow().getShell());
- setShellStyle(getShellStyle() | SWT.APPLICATION_MODAL | SWT.MAX | SWT.TITLE | SWT.RESIZE);
-
- this.session = session;
- this.branchPoint = branchPoint;
- this.allowTimeStamp = allowTimeStamp;
- }
-
- public CDOSession getSession()
- {
- return session;
- }
-
- public boolean isAllowTimeStamp()
- {
- return allowTimeStamp;
- }
-
- public CTabItem getComposeTab()
- {
- return composeTab;
- }
-
- public CTabItem getCommitsTab()
- {
- return commitsTab;
- }
-
- public CTabItem getTagsTab()
- {
- return tagsTab;
- }
-
- public CTabItem getViewsTab()
- {
- return viewsTab;
- }
-
- public CDOBranchPoint getBranchPoint()
- {
- return branchPoint;
- }
-
- public void setBranchPoint(CDOBranchPoint branchPoint)
- {
- this.branchPoint = branchPoint;
- validate();
- }
-
- public void setValidationError(Object source, String message)
- {
- setMessage(message, IMessageProvider.ERROR);
- }
-
- @Override
- protected void configureShell(Shell newShell)
- {
- super.configureShell(newShell);
- newShell.setSize(500, 500);
- }
-
- @Override
- protected Control createDialogArea(Composite parent)
- {
- Composite composite = (Composite)super.createDialogArea(parent);
- composite.setLayoutData(UIUtil.createGridData());
- composite.setLayout(new GridLayout(1, false));
-
- createBranchPointArea(composite);
- UIUtil.setValidationContext(composite, aggregator);
-
- return composite;
- }
-
- protected void createBranchPointArea(Composite parent)
- {
- CTabFolder tabFolder = new CTabFolder(parent, SWT.BORDER);
- tabFolder.setSimple(false);
- tabFolder.setLayoutData(UIUtil.createGridData());
- tabFolder.setSelectionBackground(Display.getCurrent().getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT));
-
- composeTab = new CTabItem(tabFolder, SWT.NONE);
- composeTab.setText(getComposeTabTitle());
- Composite composite_0 = new Composite(tabFolder, SWT.NONE);
- composite_0.setLayout(new GridLayout(1, false));
- createComposeTab(composite_0);
- composeTab.setControl(composite_0);
-
- commitsTab = new CTabItem(tabFolder, SWT.NONE);
- commitsTab.setText("Commits");
- Composite composite_1 = new Composite(tabFolder, SWT.NONE);
- composite_1.setLayout(new GridLayout(1, false));
- createCommitsTab(composite_1);
- commitsTab.setControl(composite_1);
-
- tagsTab = new CTabItem(tabFolder, SWT.NONE);
- tagsTab.setText("Tags");
- Composite composite_2 = new Composite(tabFolder, SWT.NONE);
- composite_2.setLayout(new GridLayout(1, false));
- createTagsTab(composite_2);
- tagsTab.setControl(composite_2);
-
- viewsTab = new CTabItem(tabFolder, SWT.NONE);
- viewsTab.setText("Views");
- Composite composite_3 = new Composite(tabFolder, SWT.NONE);
- composite_3.setLayout(new GridLayout(1, false));
- createViewsTab(composite_3);
- viewsTab.setControl(composite_3);
-
- tabFolder.setSelection(composeTab);
- }
-
- protected void createComposeTab(Composite parent)
- {
- Control control = new ComposeBranchPointComposite(parent, SWT.NONE, session, null, allowTimeStamp)
- {
- @Override
- protected void branchPointChanged(CDOBranchPoint newBranchPoint)
- {
- setBranchPoint(newBranchPoint);
- }
- };
-
- control.setLayoutData(UIUtil.createGridData());
- }
-
- protected void createCommitsTab(Composite parent)
- {
- }
-
- protected void createTagsTab(Composite parent)
- {
- }
-
- protected void createViewsTab(Composite parent)
- {
- }
-
- protected String getComposeTabTitle()
- {
- return "Compose";
- }
-
- protected void validate()
- {
- }
-
- /**
- * @author Eike Stepper
- */
- public static class WithName extends SelectBranchPointDialog
- {
- private String name;
-
- private Text nameText;
-
- public WithName(IWorkbenchPage page, CDOSession session, CDOBranchPoint branchPoint, boolean allowTimeStamp,
- String name)
- {
- super(page, session, branchPoint, allowTimeStamp);
- this.name = StringUtil.safe(name);
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setName(String name)
- {
- this.name = name;
- validate();
- }
-
- public Text getNameText()
- {
- return nameText;
- }
-
- @Override
- protected void createBranchPointArea(Composite parent)
- {
- GridLayout gridLayout = UIUtil.createGridLayout(2);
- gridLayout.marginHeight = 5;
- gridLayout.horizontalSpacing = 5;
-
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayoutData(UIUtil.createGridData(true, false));
- composite.setLayout(gridLayout);
-
- Label label = new Label(composite, SWT.NONE);
- label.setLayoutData(UIUtil.createGridData(false, false));
- label.setText("Name:");
-
- nameText = new Text(composite, SWT.BORDER);
- nameText.setLayoutData(UIUtil.createGridData(true, false));
- nameText.setText(name);
- nameText.addModifyListener(new ModifyListener()
- {
- public void modifyText(ModifyEvent e)
- {
- setName(nameText.getText());
- }
- });
-
- super.createBranchPointArea(parent);
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.internal.ui.dialogs;
+
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.ui.widgets.ComposeBranchPointComposite;
+
+import org.eclipse.net4j.util.StringUtil;
+import org.eclipse.net4j.util.ui.UIUtil;
+import org.eclipse.net4j.util.ui.ValidationContext;
+
+import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.jface.dialogs.TitleAreaDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CTabFolder;
+import org.eclipse.swt.custom.CTabItem;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * @author Eike Stepper
+ */
+public class SelectBranchPointDialog extends TitleAreaDialog implements ValidationContext
+{
+ protected final ValidationContext aggregator = new ValidationContext.Aggregator(this);
+
+ private CDOSession session;
+
+ private CDOBranchPoint branchPoint;
+
+ private boolean allowTimeStamp;
+
+ private CTabItem composeTab;
+
+ private CTabItem commitsTab;
+
+ private CTabItem tagsTab;
+
+ private CTabItem viewsTab;
+
+ public SelectBranchPointDialog(IWorkbenchPage page, CDOSession session, CDOBranchPoint branchPoint,
+ boolean allowTimeStamp)
+ {
+ super(page.getWorkbenchWindow().getShell());
+ setShellStyle(getShellStyle() | SWT.APPLICATION_MODAL | SWT.MAX | SWT.TITLE | SWT.RESIZE);
+
+ this.session = session;
+ this.branchPoint = branchPoint;
+ this.allowTimeStamp = allowTimeStamp;
+ }
+
+ public CDOSession getSession()
+ {
+ return session;
+ }
+
+ public boolean isAllowTimeStamp()
+ {
+ return allowTimeStamp;
+ }
+
+ public CTabItem getComposeTab()
+ {
+ return composeTab;
+ }
+
+ public CTabItem getCommitsTab()
+ {
+ return commitsTab;
+ }
+
+ public CTabItem getTagsTab()
+ {
+ return tagsTab;
+ }
+
+ public CTabItem getViewsTab()
+ {
+ return viewsTab;
+ }
+
+ public CDOBranchPoint getBranchPoint()
+ {
+ return branchPoint;
+ }
+
+ public void setBranchPoint(CDOBranchPoint branchPoint)
+ {
+ this.branchPoint = branchPoint;
+ validate();
+ }
+
+ public void setValidationError(Object source, String message)
+ {
+ setMessage(message, IMessageProvider.ERROR);
+ }
+
+ @Override
+ protected void configureShell(Shell newShell)
+ {
+ super.configureShell(newShell);
+ newShell.setSize(500, 500);
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent)
+ {
+ Composite composite = (Composite)super.createDialogArea(parent);
+ composite.setLayoutData(UIUtil.createGridData());
+ composite.setLayout(new GridLayout(1, false));
+
+ createBranchPointArea(composite);
+ UIUtil.setValidationContext(composite, aggregator);
+
+ return composite;
+ }
+
+ protected void createBranchPointArea(Composite parent)
+ {
+ CTabFolder tabFolder = new CTabFolder(parent, SWT.BORDER);
+ tabFolder.setSimple(false);
+ tabFolder.setLayoutData(UIUtil.createGridData());
+ tabFolder.setSelectionBackground(Display.getCurrent().getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT));
+
+ composeTab = new CTabItem(tabFolder, SWT.NONE);
+ composeTab.setText(getComposeTabTitle());
+ Composite composite_0 = new Composite(tabFolder, SWT.NONE);
+ composite_0.setLayout(new GridLayout(1, false));
+ createComposeTab(composite_0);
+ composeTab.setControl(composite_0);
+
+ commitsTab = new CTabItem(tabFolder, SWT.NONE);
+ commitsTab.setText("Commits");
+ Composite composite_1 = new Composite(tabFolder, SWT.NONE);
+ composite_1.setLayout(new GridLayout(1, false));
+ createCommitsTab(composite_1);
+ commitsTab.setControl(composite_1);
+
+ tagsTab = new CTabItem(tabFolder, SWT.NONE);
+ tagsTab.setText("Tags");
+ Composite composite_2 = new Composite(tabFolder, SWT.NONE);
+ composite_2.setLayout(new GridLayout(1, false));
+ createTagsTab(composite_2);
+ tagsTab.setControl(composite_2);
+
+ viewsTab = new CTabItem(tabFolder, SWT.NONE);
+ viewsTab.setText("Views");
+ Composite composite_3 = new Composite(tabFolder, SWT.NONE);
+ composite_3.setLayout(new GridLayout(1, false));
+ createViewsTab(composite_3);
+ viewsTab.setControl(composite_3);
+
+ tabFolder.setSelection(composeTab);
+ }
+
+ protected void createComposeTab(Composite parent)
+ {
+ Control control = new ComposeBranchPointComposite(parent, SWT.NONE, session, null, allowTimeStamp)
+ {
+ @Override
+ protected void branchPointChanged(CDOBranchPoint newBranchPoint)
+ {
+ setBranchPoint(newBranchPoint);
+ }
+ };
+
+ control.setLayoutData(UIUtil.createGridData());
+ }
+
+ protected void createCommitsTab(Composite parent)
+ {
+ }
+
+ protected void createTagsTab(Composite parent)
+ {
+ }
+
+ protected void createViewsTab(Composite parent)
+ {
+ }
+
+ protected String getComposeTabTitle()
+ {
+ return "Compose";
+ }
+
+ protected void validate()
+ {
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static class WithName extends SelectBranchPointDialog
+ {
+ private String name;
+
+ private Text nameText;
+
+ public WithName(IWorkbenchPage page, CDOSession session, CDOBranchPoint branchPoint, boolean allowTimeStamp,
+ String name)
+ {
+ super(page, session, branchPoint, allowTimeStamp);
+ this.name = StringUtil.safe(name);
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ validate();
+ }
+
+ public Text getNameText()
+ {
+ return nameText;
+ }
+
+ @Override
+ protected void createBranchPointArea(Composite parent)
+ {
+ GridLayout gridLayout = UIUtil.createGridLayout(2);
+ gridLayout.marginHeight = 5;
+ gridLayout.horizontalSpacing = 5;
+
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayoutData(UIUtil.createGridData(true, false));
+ composite.setLayout(gridLayout);
+
+ Label label = new Label(composite, SWT.NONE);
+ label.setLayoutData(UIUtil.createGridData(false, false));
+ label.setText("Name:");
+
+ nameText = new Text(composite, SWT.BORDER);
+ nameText.setLayoutData(UIUtil.createGridData(true, false));
+ nameText.setText(name);
+ nameText.addModifyListener(new ModifyListener()
+ {
+ public void modifyText(ModifyEvent e)
+ {
+ setName(nameText.getText());
+ }
+ });
+
+ super.createBranchPointArea(parent);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/SelectPackageDialog.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/SelectPackageDialog.java
index a9540fe25d..be004593c9 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/SelectPackageDialog.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/SelectPackageDialog.java
@@ -1,197 +1,197 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- * Victor Roldan Betancort - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui.dialogs;
-
-import org.eclipse.emf.cdo.common.model.CDOPackageTypeRegistry;
-import org.eclipse.emf.cdo.common.model.CDOPackageUnit.Type;
-import org.eclipse.emf.cdo.internal.ui.bundle.OM;
-import org.eclipse.emf.cdo.ui.shared.SharedIcons;
-
-import org.eclipse.net4j.util.ui.UIUtil;
-import org.eclipse.net4j.util.ui.widgets.BaseDialog;
-
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.EcorePackage;
-
-import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.ITableColorProvider;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-/**
- * @author Eike Stepper
- */
-public class SelectPackageDialog extends BaseDialog<CheckboxTableViewer>
-{
- private static final Set<String> NO_URIS = Collections.emptySet();
-
- private Set<String> excludedURIs = new HashSet<String>();
-
- private Set<String> checkedURIs = new HashSet<String>();
-
- public SelectPackageDialog(Shell shell, String title, String message, Set<String> excludedURIs)
- {
- super(shell, DEFAULT_SHELL_STYLE | SWT.APPLICATION_MODAL, title, message, OM.Activator.INSTANCE.getDialogSettings());
- this.excludedURIs = excludedURIs;
- }
-
- public SelectPackageDialog(Shell shell, String title, String message)
- {
- this(shell, title, message, NO_URIS);
- }
-
- public Set<String> getCheckedURIs()
- {
- return checkedURIs;
- }
-
- @Override
- protected void createUI(Composite parent)
- {
- CheckboxTableViewer viewer = CheckboxTableViewer.newCheckList(parent, SWT.SINGLE | SWT.BORDER);
- viewer.getTable().setLayoutData(UIUtil.createGridData());
- viewer.setContentProvider(new PackageContentProvider());
- viewer.setLabelProvider(new PackageLabelProvider());
- viewer.setInput(EPackage.Registry.INSTANCE);
-
- String[] uris = OM.PREF_HISTORY_SELECT_PACKAGES.getValue();
- if (uris != null)
- {
- viewer.setCheckedElements(uris);
- }
-
- setCurrentViewer(viewer);
- }
-
- @Override
- protected void okPressed()
- {
- Object[] checkedElements = getCurrentViewer().getCheckedElements();
- for (Object checkedElement : checkedElements)
- {
- checkedURIs.add((String)checkedElement);
- }
-
- OM.PREF_HISTORY_SELECT_PACKAGES.setValue(checkedURIs.toArray(new String[checkedURIs.size()]));
- super.okPressed();
- }
-
- /**
- * @author Eike Stepper
- */
- private class PackageContentProvider implements IStructuredContentProvider
- {
- public PackageContentProvider()
- {
- }
-
- public void dispose()
- {
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
- {
- }
-
- public Object[] getElements(Object inputElement)
- {
- Set<String> uris = new HashSet<String>(EPackage.Registry.INSTANCE.keySet());
- uris.removeAll(excludedURIs);
-
- List<String> elements = new ArrayList<String>(uris);
- Collections.sort(elements);
- return elements.toArray();
- }
- }
-
- /**
- * @author Eike Stepper
- */
- private class PackageLabelProvider extends LabelProvider implements ITableLabelProvider, ITableColorProvider
- {
- private final Color red = Display.getCurrent().getSystemColor(SWT.COLOR_DARK_MAGENTA);
-
- public PackageLabelProvider()
- {
- }
-
- @Override
- public String getText(Object element)
- {
- return element.toString();
- }
-
- @Override
- public Image getImage(Object element)
- {
- if (element instanceof String)
- {
- Type type = CDOPackageTypeRegistry.INSTANCE.lookup((String)element);
- switch (type)
- {
- case LEGACY:
- return SharedIcons.getImage(SharedIcons.OBJ_EPACKAGE_LEGACY);
-
- case NATIVE:
- return SharedIcons.getImage(SharedIcons.OBJ_EPACKAGE_NATIVE);
-
- case DYNAMIC:
- return SharedIcons.getImage(SharedIcons.OBJ_EPACKAGE_DYNAMIC);
-
- case UNKNOWN:
- return SharedIcons.getImage(SharedIcons.OBJ_EPACKAGE_UNKNOWN);
- }
- }
-
- return null;
- }
-
- public String getColumnText(Object element, int columnIndex)
- {
- return getText(element);
- }
-
- public Image getColumnImage(Object element, int columnIndex)
- {
- return getImage(element);
- }
-
- public Color getBackground(Object element, int columnIndex)
- {
- return null;
- }
-
- public Color getForeground(Object element, int columnIndex)
- {
- if (EcorePackage.eINSTANCE.getNsURI().equals(element))
- {
- return red;
- }
-
- return null;
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ * Victor Roldan Betancort - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui.dialogs;
+
+import org.eclipse.emf.cdo.common.model.CDOPackageTypeRegistry;
+import org.eclipse.emf.cdo.common.model.CDOPackageUnit.Type;
+import org.eclipse.emf.cdo.internal.ui.bundle.OM;
+import org.eclipse.emf.cdo.ui.shared.SharedIcons;
+
+import org.eclipse.net4j.util.ui.UIUtil;
+import org.eclipse.net4j.util.ui.widgets.BaseDialog;
+
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EcorePackage;
+
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITableColorProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @author Eike Stepper
+ */
+public class SelectPackageDialog extends BaseDialog<CheckboxTableViewer>
+{
+ private static final Set<String> NO_URIS = Collections.emptySet();
+
+ private Set<String> excludedURIs = new HashSet<String>();
+
+ private Set<String> checkedURIs = new HashSet<String>();
+
+ public SelectPackageDialog(Shell shell, String title, String message, Set<String> excludedURIs)
+ {
+ super(shell, DEFAULT_SHELL_STYLE | SWT.APPLICATION_MODAL, title, message, OM.Activator.INSTANCE.getDialogSettings());
+ this.excludedURIs = excludedURIs;
+ }
+
+ public SelectPackageDialog(Shell shell, String title, String message)
+ {
+ this(shell, title, message, NO_URIS);
+ }
+
+ public Set<String> getCheckedURIs()
+ {
+ return checkedURIs;
+ }
+
+ @Override
+ protected void createUI(Composite parent)
+ {
+ CheckboxTableViewer viewer = CheckboxTableViewer.newCheckList(parent, SWT.SINGLE | SWT.BORDER);
+ viewer.getTable().setLayoutData(UIUtil.createGridData());
+ viewer.setContentProvider(new PackageContentProvider());
+ viewer.setLabelProvider(new PackageLabelProvider());
+ viewer.setInput(EPackage.Registry.INSTANCE);
+
+ String[] uris = OM.PREF_HISTORY_SELECT_PACKAGES.getValue();
+ if (uris != null)
+ {
+ viewer.setCheckedElements(uris);
+ }
+
+ setCurrentViewer(viewer);
+ }
+
+ @Override
+ protected void okPressed()
+ {
+ Object[] checkedElements = getCurrentViewer().getCheckedElements();
+ for (Object checkedElement : checkedElements)
+ {
+ checkedURIs.add((String)checkedElement);
+ }
+
+ OM.PREF_HISTORY_SELECT_PACKAGES.setValue(checkedURIs.toArray(new String[checkedURIs.size()]));
+ super.okPressed();
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ private class PackageContentProvider implements IStructuredContentProvider
+ {
+ public PackageContentProvider()
+ {
+ }
+
+ public void dispose()
+ {
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
+ {
+ }
+
+ public Object[] getElements(Object inputElement)
+ {
+ Set<String> uris = new HashSet<String>(EPackage.Registry.INSTANCE.keySet());
+ uris.removeAll(excludedURIs);
+
+ List<String> elements = new ArrayList<String>(uris);
+ Collections.sort(elements);
+ return elements.toArray();
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ private class PackageLabelProvider extends LabelProvider implements ITableLabelProvider, ITableColorProvider
+ {
+ private final Color red = Display.getCurrent().getSystemColor(SWT.COLOR_DARK_MAGENTA);
+
+ public PackageLabelProvider()
+ {
+ }
+
+ @Override
+ public String getText(Object element)
+ {
+ return element.toString();
+ }
+
+ @Override
+ public Image getImage(Object element)
+ {
+ if (element instanceof String)
+ {
+ Type type = CDOPackageTypeRegistry.INSTANCE.lookup((String)element);
+ switch (type)
+ {
+ case LEGACY:
+ return SharedIcons.getImage(SharedIcons.OBJ_EPACKAGE_LEGACY);
+
+ case NATIVE:
+ return SharedIcons.getImage(SharedIcons.OBJ_EPACKAGE_NATIVE);
+
+ case DYNAMIC:
+ return SharedIcons.getImage(SharedIcons.OBJ_EPACKAGE_DYNAMIC);
+
+ case UNKNOWN:
+ return SharedIcons.getImage(SharedIcons.OBJ_EPACKAGE_UNKNOWN);
+ }
+ }
+
+ return null;
+ }
+
+ public String getColumnText(Object element, int columnIndex)
+ {
+ return getText(element);
+ }
+
+ public Image getColumnImage(Object element, int columnIndex)
+ {
+ return getImage(element);
+ }
+
+ public Color getBackground(Object element, int columnIndex)
+ {
+ return null;
+ }
+
+ public Color getForeground(Object element, int columnIndex)
+ {
+ if (EcorePackage.eINSTANCE.getNsURI().equals(element))
+ {
+ return red;
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dnd/CDOObjectDropAdapter.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dnd/CDOObjectDropAdapter.java
index 2ece0142f5..247b20c379 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dnd/CDOObjectDropAdapter.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dnd/CDOObjectDropAdapter.java
@@ -1,92 +1,92 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Victor Roldan Betancort - initial API and implementation
- * Eike Stepper - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui.dnd;
-
-import org.eclipse.emf.cdo.CDOObject;
-import org.eclipse.emf.cdo.CDOState;
-import org.eclipse.emf.cdo.util.CDOUtil;
-
-import org.eclipse.net4j.util.container.IContainer;
-import org.eclipse.net4j.util.ui.dnd.DNDDropAdapter;
-
-import org.eclipse.emf.ecore.EObject;
-
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.TreeSelection;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.Transfer;
-
-import java.util.ArrayList;
-
-/**
- * @author Victor Roldan Betancort
- */
-public class CDOObjectDropAdapter extends DNDDropAdapter<TreeSelection>
-{
- public static final Transfer[] TRANSFERS = new Transfer[] { org.eclipse.emf.edit.ui.dnd.LocalTransfer.getInstance() };
-
- protected CDOObjectDropAdapter(StructuredViewer viewer)
- {
- super(TRANSFERS, viewer);
- setExpandEnabled(false);
- }
-
- @SuppressWarnings("unchecked")
- @Override
- protected boolean performDrop(TreeSelection data, Object target)
- {
- if (target instanceof IContainer.Modifiable<?>)
- {
- IContainer.Modifiable<CDOObject> objectContainer = (IContainer.Modifiable<CDOObject>)target;
- ArrayList<CDOObject> elementsToAdd = new ArrayList<CDOObject>();
- for (Object obj : data.toArray())
- {
- if (isWatchable(obj))
- {
- elementsToAdd.add(CDOUtil.getCDOObject((EObject)obj));
- }
- }
-
- objectContainer.addAllElements(elementsToAdd);
- return true;
- }
-
- return false;
- }
-
- @Override
- protected boolean validateTarget(Object target, int operation)
- {
- return true;
- }
-
- public static void support(StructuredViewer viewer)
- {
- int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
- viewer.addDropSupport(dndOperations, TRANSFERS, new CDOObjectDropAdapter(viewer));
- }
-
- public static boolean isWatchable(Object obj)
- {
- // Only CLEAN and DIRTY CDOObjects are watchable
- if (obj instanceof EObject)
- {
- CDOObject cdoObject = CDOUtil.getCDOObject((EObject)obj);
- if (cdoObject != null)
- {
- return cdoObject.cdoState() == CDOState.CLEAN || cdoObject.cdoState() == CDOState.DIRTY;
- }
- }
-
- return false;
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Victor Roldan Betancort - initial API and implementation
+ * Eike Stepper - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui.dnd;
+
+import org.eclipse.emf.cdo.CDOObject;
+import org.eclipse.emf.cdo.CDOState;
+import org.eclipse.emf.cdo.util.CDOUtil;
+
+import org.eclipse.net4j.util.container.IContainer;
+import org.eclipse.net4j.util.ui.dnd.DNDDropAdapter;
+
+import org.eclipse.emf.ecore.EObject;
+
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.Transfer;
+
+import java.util.ArrayList;
+
+/**
+ * @author Victor Roldan Betancort
+ */
+public class CDOObjectDropAdapter extends DNDDropAdapter<TreeSelection>
+{
+ public static final Transfer[] TRANSFERS = new Transfer[] { org.eclipse.emf.edit.ui.dnd.LocalTransfer.getInstance() };
+
+ protected CDOObjectDropAdapter(StructuredViewer viewer)
+ {
+ super(TRANSFERS, viewer);
+ setExpandEnabled(false);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected boolean performDrop(TreeSelection data, Object target)
+ {
+ if (target instanceof IContainer.Modifiable<?>)
+ {
+ IContainer.Modifiable<CDOObject> objectContainer = (IContainer.Modifiable<CDOObject>)target;
+ ArrayList<CDOObject> elementsToAdd = new ArrayList<CDOObject>();
+ for (Object obj : data.toArray())
+ {
+ if (isWatchable(obj))
+ {
+ elementsToAdd.add(CDOUtil.getCDOObject((EObject)obj));
+ }
+ }
+
+ objectContainer.addAllElements(elementsToAdd);
+ return true;
+ }
+
+ return false;
+ }
+
+ @Override
+ protected boolean validateTarget(Object target, int operation)
+ {
+ return true;
+ }
+
+ public static void support(StructuredViewer viewer)
+ {
+ int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
+ viewer.addDropSupport(dndOperations, TRANSFERS, new CDOObjectDropAdapter(viewer));
+ }
+
+ public static boolean isWatchable(Object obj)
+ {
+ // Only CLEAN and DIRTY CDOObjects are watchable
+ if (obj instanceof EObject)
+ {
+ CDOObject cdoObject = CDOUtil.getCDOObject((EObject)obj);
+ if (cdoObject != null)
+ {
+ return cdoObject.cdoState() == CDOState.CLEAN || cdoObject.cdoState() == CDOState.DIRTY;
+ }
+ }
+
+ return false;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOActionBarContributor.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOActionBarContributor.java
index d8ca8d1364..2791d0a6cd 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOActionBarContributor.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOActionBarContributor.java
@@ -1,723 +1,723 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- * Victor Roldan Betancort - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui.editor;
-
-import org.eclipse.emf.cdo.eresource.CDOResource;
-import org.eclipse.emf.cdo.internal.ui.actions.ChangePassiveUpdateAction;
-import org.eclipse.emf.cdo.internal.ui.actions.ImportRootsAction;
-import org.eclipse.emf.cdo.internal.ui.actions.ReadLockObjectsAction;
-import org.eclipse.emf.cdo.internal.ui.actions.ReloadObjectsAction;
-import org.eclipse.emf.cdo.internal.ui.actions.WriteLockObjectsAction;
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-import org.eclipse.emf.cdo.view.CDOView;
-
-import org.eclipse.emf.common.ui.viewer.IViewerProvider;
-import org.eclipse.emf.edit.domain.EditingDomain;
-import org.eclipse.emf.edit.domain.IEditingDomainProvider;
-import org.eclipse.emf.edit.ui.action.ControlAction;
-import org.eclipse.emf.edit.ui.action.CreateChildAction;
-import org.eclipse.emf.edit.ui.action.CreateSiblingAction;
-import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor;
-import org.eclipse.emf.edit.ui.action.LoadResourceAction;
-import org.eclipse.emf.edit.ui.action.ValidateAction;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.action.IContributionManager;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.action.SubContributionItem;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.PartInitException;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-/**
- * @author Eike Stepper
- * @generated
- */
-public class CDOActionBarContributor extends EditingDomainActionBarContributor implements ISelectionChangedListener
-{
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- public static final String copyright = "Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Eike Stepper - initial API and implementation"; //$NON-NLS-1$
-
- /**
- * @ADDED
- */
- public static final String LOAD_RESOURCE_ID = "load-resource"; //$NON-NLS-1$
-
- /**
- * @ADDED
- */
- public static final String REFRESH_VIEWER_ID = "refresh-viewer"; //$NON-NLS-1$
-
- /**
- * @ADDED
- */
- protected ImportRootsAction importRootsAction;
-
- /**
- * @ADDED
- */
- protected ReloadObjectsAction reloadObjectsAction;
-
- /**
- * @ADDED
- */
- protected ReadLockObjectsAction readLockObjectsAction;
-
- /**
- * @ADDED
- */
- protected WriteLockObjectsAction writeLockObjectsAction;
-
- /**
- * @ADDED
- */
- protected ChangePassiveUpdateAction changePassiveUpdateAction;
-
- /**
- * This keeps track of the active editor. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected IEditorPart activeEditorPart;
-
- /**
- * This keeps track of the current selection provider. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected ISelectionProvider selectionProvider;
-
- /**
- * This action opens the Properties view. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected IAction showPropertiesViewAction = new Action(
- PluginDelegator.INSTANCE.getString("_UI_ShowPropertiesView_menu_item"))
- {
- @Override
- public void run()
- {
- try
- {
- getPage().showView("org.eclipse.ui.views.PropertySheet");
- }
- catch (PartInitException exception)
- {
- PluginDelegator.INSTANCE.log(exception);
- }
- }
- };
-
- /**
- * This action refreshes the viewer of the current editor if the editor implements
- * {@link org.eclipse.emf.common.ui.viewer.IViewerProvider}. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected IAction refreshViewerAction = new Action(PluginDelegator.INSTANCE.getString("_UI_RefreshViewer_menu_item"))
- {
- @Override
- public boolean isEnabled()
- {
- return activeEditorPart instanceof IViewerProvider;
- }
-
- @Override
- public void run()
- {
- if (activeEditorPart instanceof IViewerProvider)
- {
- Viewer viewer = ((IViewerProvider)activeEditorPart).getViewer();
- if (viewer != null)
- {
- viewer.refresh();
- }
- }
- }
- };
-
- /**
- * This will contain one {@link org.eclipse.emf.edit.ui.action.CreateChildAction} corresponding to each descriptor
- * generated for the current selection by the item provider. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected Collection<IAction> createChildActions;
-
- /**
- * This is the menu manager into which menu contribution items should be added for CreateChild actions. <!--
- * begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected IMenuManager createChildMenuManager;
-
- /**
- * This will contain one {@link org.eclipse.emf.edit.ui.action.CreateSiblingAction} corresponding to each descriptor
- * generated for the current selection by the item provider. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected Collection<IAction> createSiblingActions;
-
- /**
- * This is the menu manager into which menu contribution items should be added for CreateSibling actions. <!--
- * begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected IMenuManager createSiblingMenuManager;
-
- /**
- * This creates an instance of the contributor. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated NOT
- */
- public CDOActionBarContributor()
- {
- super(ADDITIONS_LAST_STYLE);
- loadResourceAction = new LoadResourceAction();
- loadResourceAction.setId(LOAD_RESOURCE_ID);
-
- importRootsAction = new ImportRootsAction();
- importRootsAction.setId(ImportRootsAction.ID);
-
- reloadObjectsAction = new ReloadObjectsAction();
- changePassiveUpdateAction = new ChangePassiveUpdateAction();
-
- readLockObjectsAction = new ReadLockObjectsAction();
- writeLockObjectsAction = new WriteLockObjectsAction();
-
- validateAction = new ValidateAction();
- controlAction = new ControlAction();
- }
-
- /**
- * This adds Separators for editor additions to the tool bar. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- @Override
- public void contributeToToolBar(IToolBarManager toolBarManager)
- {
- toolBarManager.add(new Separator("cdo-settings"));
- toolBarManager.add(new Separator("cdo-additions"));
- }
-
- /**
- * This adds to the menu bar a menu and some separators for editor additions, as well as the sub-menus for object
- * creation items. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- @Override
- public void contributeToMenu(IMenuManager menuManager)
- {
- super.contributeToMenu(menuManager);
-
- IMenuManager submenuManager = new MenuManager(PluginDelegator.INSTANCE.getString("_UI_CDOEditor_menu"),
- "org.eclipse.emf.cdo.internal.ui.editorMenuID");
- menuManager.insertAfter("additions", submenuManager);
- submenuManager.add(new Separator("settings"));
- submenuManager.add(new Separator("actions"));
- submenuManager.add(new Separator("additions"));
- submenuManager.add(new Separator("additions-end"));
-
- // Prepare for CreateChild item addition or removal.
- //
- createChildMenuManager = new MenuManager(PluginDelegator.INSTANCE.getString("_UI_CreateChild_menu_item"));
- submenuManager.insertBefore("additions", createChildMenuManager);
-
- // Prepare for CreateSibling item addition or removal.
- //
- createSiblingMenuManager = new MenuManager(PluginDelegator.INSTANCE.getString("_UI_CreateSibling_menu_item"));
- submenuManager.insertBefore("additions", createSiblingMenuManager);
-
- // Force an update because Eclipse hides empty menus now.
- //
- submenuManager.addMenuListener(new IMenuListener()
- {
- public void menuAboutToShow(IMenuManager menuManager)
- {
- menuManager.updateAll(true);
- }
- });
-
- addGlobalActions(submenuManager);
- }
-
- /**
- * When the active editor changes, this remembers the change and registers with it as a selection provider. <!--
- * begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- @Override
- public void setActiveEditor(IEditorPart part)
- {
- super.setActiveEditor(part);
- activeEditorPart = part;
-
- // Switch to the new selection provider.
- //
- if (selectionProvider != null)
- {
- selectionProvider.removeSelectionChangedListener(this);
- }
- if (part == null)
- {
- selectionProvider = null;
- }
- else
- {
- selectionProvider = part.getSite().getSelectionProvider();
- selectionProvider.addSelectionChangedListener(this);
-
- // Fake a selection changed event to update the menus.
- //
- if (selectionProvider.getSelection() != null)
- {
- selectionChanged(new SelectionChangedEvent(selectionProvider, selectionProvider.getSelection()));
- }
- }
- }
-
- /**
- * This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener}, handling
- * {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings that can be
- * added to the selected object and updating the menus accordingly. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- public void selectionChangedGen(SelectionChangedEvent event)
- {
- // Remove any menu items for old selection.
- //
- if (createChildMenuManager != null)
- {
- depopulateManager(createChildMenuManager, createChildActions);
- }
- if (createSiblingMenuManager != null)
- {
- depopulateManager(createSiblingMenuManager, createSiblingActions);
- }
-
- // Query the new selection for appropriate new child/sibling descriptors
- //
- Collection<?> newChildDescriptors = null;
- Collection<?> newSiblingDescriptors = null;
-
- ISelection selection = event.getSelection();
- if (selection instanceof IStructuredSelection && ((IStructuredSelection)selection).size() == 1)
- {
- Object object = ((IStructuredSelection)selection).getFirstElement();
-
- EditingDomain domain = ((IEditingDomainProvider)activeEditorPart).getEditingDomain();
-
- newChildDescriptors = domain.getNewChildDescriptors(object, null);
- newSiblingDescriptors = domain.getNewChildDescriptors(null, object);
- }
-
- // Generate actions for selection; populate and redraw the menus.
- //
- createChildActions = generateCreateChildActions(newChildDescriptors, selection);
- createSiblingActions = generateCreateSiblingActions(newSiblingDescriptors, selection);
-
- if (createChildMenuManager != null)
- {
- populateManager(createChildMenuManager, createChildActions, null);
- createChildMenuManager.update(true);
- }
- if (createSiblingMenuManager != null)
- {
- populateManager(createSiblingMenuManager, createSiblingActions, null);
- createSiblingMenuManager.update(true);
- }
- }
-
- /**
- * @ADDED
- */
- public void selectionChanged(SelectionChangedEvent event)
- {
- // Remove any menu items for old selection.
- //
- if (createChildMenuManager != null)
- {
- depopulateManager(createChildMenuManager, createChildActions);
- }
-
- if (createSiblingMenuManager != null)
- {
- depopulateManager(createSiblingMenuManager, createSiblingActions);
- }
-
- // Query the new selection for appropriate new child/sibling descriptors
- //
- Collection<?> newChildDescriptors = null;
- Collection<?> newSiblingDescriptors = null;
-
- ISelection selection = event.getSelection();
- if (selection instanceof IStructuredSelection)
- {
- if (reloadObjectsAction != null)
- {
- reloadObjectsAction.selectionChanged((IStructuredSelection)selection);
- }
-
- if (readLockObjectsAction != null)
- {
- readLockObjectsAction.selectionChanged((IStructuredSelection)selection);
- }
-
- if (writeLockObjectsAction != null)
- {
- writeLockObjectsAction.selectionChanged((IStructuredSelection)selection);
- }
-
- if (((IStructuredSelection)selection).size() == 1)
- {
- Object object = ((IStructuredSelection)selection).getFirstElement();
-
- EditingDomain domain = ((IEditingDomainProvider)activeEditorPart).getEditingDomain();
-
- newChildDescriptors = domain.getNewChildDescriptors(object, null);
- newSiblingDescriptors = domain.getNewChildDescriptors(null, object);
-
- if (importRootsAction != null)
- {
- if (object instanceof CDOResource)
- {
- importRootsAction.setTargetResource((CDOResource)object);
- }
- else
- {
- importRootsAction.setTargetResource(null);
- }
- }
- }
- }
-
- // Generate actions for selection; populate and redraw the menus.
- //
- createChildActions = generateCreateChildActions(newChildDescriptors, selection);
- createSiblingActions = generateCreateSiblingActions(newSiblingDescriptors, selection);
-
- if (createChildMenuManager != null)
- {
- populateManager(createChildMenuManager, createChildActions, null);
- createChildMenuManager.update(true);
- }
-
- if (createSiblingMenuManager != null)
- {
- populateManager(createSiblingMenuManager, createSiblingActions, null);
- createSiblingMenuManager.update(true);
- }
- }
-
- /**
- * This generates a {@link org.eclipse.emf.edit.ui.action.CreateChildAction} for each object in
- * <code>descriptors</code>, and returns the collection of these actions. <!-- begin-user-doc --> <!-- end-user-doc
- * -->
- *
- * @generated
- */
- protected Collection<IAction> generateCreateChildActions(Collection<?> descriptors, ISelection selection)
- {
- Collection<IAction> actions = new ArrayList<IAction>();
- if (descriptors != null)
- {
- for (Object descriptor : descriptors)
- {
- actions.add(new CreateChildAction(activeEditorPart, selection, descriptor));
- }
- }
- return actions;
- }
-
- /**
- * This generates a {@link org.eclipse.emf.edit.ui.action.CreateSiblingAction} for each object in
- * <code>descriptors</code>, and returns the collection of these actions. <!-- begin-user-doc --> <!-- end-user-doc
- * -->
- *
- * @generated
- */
- protected Collection<IAction> generateCreateSiblingActions(Collection<?> descriptors, ISelection selection)
- {
- Collection<IAction> actions = new ArrayList<IAction>();
- if (descriptors != null)
- {
- for (Object descriptor : descriptors)
- {
- actions.add(new CreateSiblingAction(activeEditorPart, selection, descriptor));
- }
- }
- return actions;
- }
-
- /**
- * This populates the specified <code>manager</code> with {@link org.eclipse.jface.action.ActionContributionItem}s
- * based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection, by
- * inserting them before the specified contribution item <code>contributionID</code>. If <code>contributionID</code>
- * is <code>null</code>, they are simply added. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected void populateManager(IContributionManager manager, Collection<? extends IAction> actions,
- String contributionID)
- {
- if (actions != null)
- {
- for (IAction action : actions)
- {
- if (contributionID != null)
- {
- manager.insertBefore(contributionID, action);
- }
- else
- {
- manager.add(action);
- }
- }
- }
- }
-
- /**
- * This removes from the specified <code>manager</code> all {@link org.eclipse.jface.action.ActionContributionItem}s
- * based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection. <!--
- * begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected void depopulateManager(IContributionManager manager, Collection<? extends IAction> actions)
- {
- if (actions != null)
- {
- IContributionItem[] items = manager.getItems();
- for (int i = 0; i < items.length; i++)
- {
- // Look into SubContributionItems
- //
- IContributionItem contributionItem = items[i];
- while (contributionItem instanceof SubContributionItem)
- {
- contributionItem = ((SubContributionItem)contributionItem).getInnerItem();
- }
-
- // Delete the ActionContributionItems with matching action.
- //
- if (contributionItem instanceof ActionContributionItem)
- {
- IAction action = ((ActionContributionItem)contributionItem).getAction();
- if (actions.contains(action))
- {
- manager.remove(contributionItem);
- }
- }
- }
- }
- }
-
- /**
- * This populates the pop-up menu before it appears. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- @Override
- public void menuAboutToShow(IMenuManager menuManager)
- {
- super.menuAboutToShow(menuManager);
- MenuManager submenuManager = null;
-
- submenuManager = new MenuManager(PluginDelegator.INSTANCE.getString("_UI_CreateChild_menu_item"));
- populateManager(submenuManager, createChildActions, null);
- menuManager.insertBefore("edit", submenuManager);
-
- submenuManager = new MenuManager(PluginDelegator.INSTANCE.getString("_UI_CreateSibling_menu_item"));
- populateManager(submenuManager, createSiblingActions, null);
- menuManager.insertBefore("edit", submenuManager);
- }
-
- /**
- * This inserts global actions before the "additions-end" separator. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected void addGlobalActionsGen(IMenuManager menuManager)
- {
- menuManager.insertAfter("additions-end", new Separator("ui-actions"));
- menuManager.insertAfter("ui-actions", showPropertiesViewAction);
-
- refreshViewerAction.setEnabled(refreshViewerAction.isEnabled());
- menuManager.insertAfter("ui-actions", refreshViewerAction);
-
- super.addGlobalActions(menuManager);
- }
-
- /**
- * @ADDED
- */
- @Override
- protected void addGlobalActions(IMenuManager menuManager)
- {
- menuManager.insertAfter("additions-end", new Separator("ui-actions")); //$NON-NLS-1$ //$NON-NLS-2$
- menuManager.insertAfter("ui-actions", showPropertiesViewAction); //$NON-NLS-1$
-
- refreshViewerAction.setEnabled(refreshViewerAction.isEnabled());
- refreshViewerAction.setId(REFRESH_VIEWER_ID);
- menuManager.insertAfter("ui-actions", refreshViewerAction); //$NON-NLS-1$
- menuManager.insertBefore(refreshViewerAction.getId(), reloadObjectsAction);
-
- MenuManager lockingSubMenu = new MenuManager(Messages.getString("CDOActionBarContributor_0")); //$NON-NLS-1$
- lockingSubMenu.add(new Separator("ui-actions")); //$NON-NLS-1$
-
- lockingSubMenu.insertAfter("ui-actions", writeLockObjectsAction); //$NON-NLS-1$
- writeLockObjectsAction.update();
-
- lockingSubMenu.insertAfter("ui-actions", readLockObjectsAction); //$NON-NLS-1$
- readLockObjectsAction.update();
-
- menuManager.insertAfter("ui-actions", lockingSubMenu); //$NON-NLS-1$
-
- menuManager.insertAfter("ui-actions", changePassiveUpdateAction); //$NON-NLS-1$
- changePassiveUpdateAction.update();
- changePassiveUpdateAction.setEnabled(true);
-
- super.addGlobalActions(menuManager);
-
- if (loadResourceAction != null)
- {
- if (importRootsAction != null)
- {
- menuManager.insertAfter(loadResourceAction.getId(), importRootsAction);
- }
- }
- else
- {
- if (importRootsAction != null)
- {
- menuManager.insertBefore("additions-end", importRootsAction); //$NON-NLS-1$
- }
-
- menuManager.insertBefore("additions-end", new Separator()); //$NON-NLS-1$
- }
- }
-
- /**
- * This ensures that a delete action will clean up all references to deleted objects. <!-- begin-user-doc --> <!--
- * end-user-doc -->
- *
- * @generated
- */
- @Override
- protected boolean removeAllReferencesOnDelete()
- {
- return true;
- }
-
- /**
- * @ADDED
- */
- @Override
- public void activate()
- {
- if (importRootsAction != null)
- {
- importRootsAction.setActiveWorkbenchPart(activeEditor);
- Object input = ((CDOEditor)getActiveEditor()).getViewer().getInput();
- if (input instanceof CDOResource)
- {
- importRootsAction.setTargetResource((CDOResource)input);
- }
- else
- {
- importRootsAction.setTargetResource(null);
- }
- }
-
- if (reloadObjectsAction != null)
- {
- reloadObjectsAction.setActiveWorkbenchPart(activeEditor);
- }
-
- if (changePassiveUpdateAction != null)
- {
- Object input = ((CDOEditor)getActiveEditor()).getViewer().getInput();
- if (input instanceof CDOResource)
- {
- CDOView view = ((CDOResource)input).cdoView();
- changePassiveUpdateAction.setSession(view.getSession());
- }
- }
-
- super.activate();
- }
-
- /**
- * @ADDED
- */
- @Override
- public void deactivate()
- {
- if (importRootsAction != null)
- {
- importRootsAction.setActiveWorkbenchPart(null);
- importRootsAction.setTargetResource(null);
- }
-
- if (reloadObjectsAction != null)
- {
- reloadObjectsAction.setActiveWorkbenchPart(null);
- }
-
- super.deactivate();
- }
-
- /**
- * @ADDED
- */
- @Override
- public void update()
- {
- super.update();
- if (importRootsAction != null)
- {
- importRootsAction.update();
- }
-
- if (reloadObjectsAction != null)
- {
- reloadObjectsAction.update();
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ * Victor Roldan Betancort - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui.editor;
+
+import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.emf.cdo.internal.ui.actions.ChangePassiveUpdateAction;
+import org.eclipse.emf.cdo.internal.ui.actions.ImportRootsAction;
+import org.eclipse.emf.cdo.internal.ui.actions.ReadLockObjectsAction;
+import org.eclipse.emf.cdo.internal.ui.actions.ReloadObjectsAction;
+import org.eclipse.emf.cdo.internal.ui.actions.WriteLockObjectsAction;
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+import org.eclipse.emf.cdo.view.CDOView;
+
+import org.eclipse.emf.common.ui.viewer.IViewerProvider;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.edit.domain.IEditingDomainProvider;
+import org.eclipse.emf.edit.ui.action.ControlAction;
+import org.eclipse.emf.edit.ui.action.CreateChildAction;
+import org.eclipse.emf.edit.ui.action.CreateSiblingAction;
+import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor;
+import org.eclipse.emf.edit.ui.action.LoadResourceAction;
+import org.eclipse.emf.edit.ui.action.ValidateAction;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.action.IContributionManager;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.action.SubContributionItem;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PartInitException;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+/**
+ * @author Eike Stepper
+ * @generated
+ */
+public class CDOActionBarContributor extends EditingDomainActionBarContributor implements ISelectionChangedListener
+{
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public static final String copyright = "Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Eike Stepper - initial API and implementation"; //$NON-NLS-1$
+
+ /**
+ * @ADDED
+ */
+ public static final String LOAD_RESOURCE_ID = "load-resource"; //$NON-NLS-1$
+
+ /**
+ * @ADDED
+ */
+ public static final String REFRESH_VIEWER_ID = "refresh-viewer"; //$NON-NLS-1$
+
+ /**
+ * @ADDED
+ */
+ protected ImportRootsAction importRootsAction;
+
+ /**
+ * @ADDED
+ */
+ protected ReloadObjectsAction reloadObjectsAction;
+
+ /**
+ * @ADDED
+ */
+ protected ReadLockObjectsAction readLockObjectsAction;
+
+ /**
+ * @ADDED
+ */
+ protected WriteLockObjectsAction writeLockObjectsAction;
+
+ /**
+ * @ADDED
+ */
+ protected ChangePassiveUpdateAction changePassiveUpdateAction;
+
+ /**
+ * This keeps track of the active editor. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected IEditorPart activeEditorPart;
+
+ /**
+ * This keeps track of the current selection provider. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected ISelectionProvider selectionProvider;
+
+ /**
+ * This action opens the Properties view. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected IAction showPropertiesViewAction = new Action(
+ PluginDelegator.INSTANCE.getString("_UI_ShowPropertiesView_menu_item"))
+ {
+ @Override
+ public void run()
+ {
+ try
+ {
+ getPage().showView("org.eclipse.ui.views.PropertySheet");
+ }
+ catch (PartInitException exception)
+ {
+ PluginDelegator.INSTANCE.log(exception);
+ }
+ }
+ };
+
+ /**
+ * This action refreshes the viewer of the current editor if the editor implements
+ * {@link org.eclipse.emf.common.ui.viewer.IViewerProvider}. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected IAction refreshViewerAction = new Action(PluginDelegator.INSTANCE.getString("_UI_RefreshViewer_menu_item"))
+ {
+ @Override
+ public boolean isEnabled()
+ {
+ return activeEditorPart instanceof IViewerProvider;
+ }
+
+ @Override
+ public void run()
+ {
+ if (activeEditorPart instanceof IViewerProvider)
+ {
+ Viewer viewer = ((IViewerProvider)activeEditorPart).getViewer();
+ if (viewer != null)
+ {
+ viewer.refresh();
+ }
+ }
+ }
+ };
+
+ /**
+ * This will contain one {@link org.eclipse.emf.edit.ui.action.CreateChildAction} corresponding to each descriptor
+ * generated for the current selection by the item provider. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected Collection<IAction> createChildActions;
+
+ /**
+ * This is the menu manager into which menu contribution items should be added for CreateChild actions. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected IMenuManager createChildMenuManager;
+
+ /**
+ * This will contain one {@link org.eclipse.emf.edit.ui.action.CreateSiblingAction} corresponding to each descriptor
+ * generated for the current selection by the item provider. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected Collection<IAction> createSiblingActions;
+
+ /**
+ * This is the menu manager into which menu contribution items should be added for CreateSibling actions. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected IMenuManager createSiblingMenuManager;
+
+ /**
+ * This creates an instance of the contributor. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated NOT
+ */
+ public CDOActionBarContributor()
+ {
+ super(ADDITIONS_LAST_STYLE);
+ loadResourceAction = new LoadResourceAction();
+ loadResourceAction.setId(LOAD_RESOURCE_ID);
+
+ importRootsAction = new ImportRootsAction();
+ importRootsAction.setId(ImportRootsAction.ID);
+
+ reloadObjectsAction = new ReloadObjectsAction();
+ changePassiveUpdateAction = new ChangePassiveUpdateAction();
+
+ readLockObjectsAction = new ReadLockObjectsAction();
+ writeLockObjectsAction = new WriteLockObjectsAction();
+
+ validateAction = new ValidateAction();
+ controlAction = new ControlAction();
+ }
+
+ /**
+ * This adds Separators for editor additions to the tool bar. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void contributeToToolBar(IToolBarManager toolBarManager)
+ {
+ toolBarManager.add(new Separator("cdo-settings"));
+ toolBarManager.add(new Separator("cdo-additions"));
+ }
+
+ /**
+ * This adds to the menu bar a menu and some separators for editor additions, as well as the sub-menus for object
+ * creation items. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void contributeToMenu(IMenuManager menuManager)
+ {
+ super.contributeToMenu(menuManager);
+
+ IMenuManager submenuManager = new MenuManager(PluginDelegator.INSTANCE.getString("_UI_CDOEditor_menu"),
+ "org.eclipse.emf.cdo.internal.ui.editorMenuID");
+ menuManager.insertAfter("additions", submenuManager);
+ submenuManager.add(new Separator("settings"));
+ submenuManager.add(new Separator("actions"));
+ submenuManager.add(new Separator("additions"));
+ submenuManager.add(new Separator("additions-end"));
+
+ // Prepare for CreateChild item addition or removal.
+ //
+ createChildMenuManager = new MenuManager(PluginDelegator.INSTANCE.getString("_UI_CreateChild_menu_item"));
+ submenuManager.insertBefore("additions", createChildMenuManager);
+
+ // Prepare for CreateSibling item addition or removal.
+ //
+ createSiblingMenuManager = new MenuManager(PluginDelegator.INSTANCE.getString("_UI_CreateSibling_menu_item"));
+ submenuManager.insertBefore("additions", createSiblingMenuManager);
+
+ // Force an update because Eclipse hides empty menus now.
+ //
+ submenuManager.addMenuListener(new IMenuListener()
+ {
+ public void menuAboutToShow(IMenuManager menuManager)
+ {
+ menuManager.updateAll(true);
+ }
+ });
+
+ addGlobalActions(submenuManager);
+ }
+
+ /**
+ * When the active editor changes, this remembers the change and registers with it as a selection provider. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void setActiveEditor(IEditorPart part)
+ {
+ super.setActiveEditor(part);
+ activeEditorPart = part;
+
+ // Switch to the new selection provider.
+ //
+ if (selectionProvider != null)
+ {
+ selectionProvider.removeSelectionChangedListener(this);
+ }
+ if (part == null)
+ {
+ selectionProvider = null;
+ }
+ else
+ {
+ selectionProvider = part.getSite().getSelectionProvider();
+ selectionProvider.addSelectionChangedListener(this);
+
+ // Fake a selection changed event to update the menus.
+ //
+ if (selectionProvider.getSelection() != null)
+ {
+ selectionChanged(new SelectionChangedEvent(selectionProvider, selectionProvider.getSelection()));
+ }
+ }
+ }
+
+ /**
+ * This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener}, handling
+ * {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings that can be
+ * added to the selected object and updating the menus accordingly. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void selectionChangedGen(SelectionChangedEvent event)
+ {
+ // Remove any menu items for old selection.
+ //
+ if (createChildMenuManager != null)
+ {
+ depopulateManager(createChildMenuManager, createChildActions);
+ }
+ if (createSiblingMenuManager != null)
+ {
+ depopulateManager(createSiblingMenuManager, createSiblingActions);
+ }
+
+ // Query the new selection for appropriate new child/sibling descriptors
+ //
+ Collection<?> newChildDescriptors = null;
+ Collection<?> newSiblingDescriptors = null;
+
+ ISelection selection = event.getSelection();
+ if (selection instanceof IStructuredSelection && ((IStructuredSelection)selection).size() == 1)
+ {
+ Object object = ((IStructuredSelection)selection).getFirstElement();
+
+ EditingDomain domain = ((IEditingDomainProvider)activeEditorPart).getEditingDomain();
+
+ newChildDescriptors = domain.getNewChildDescriptors(object, null);
+ newSiblingDescriptors = domain.getNewChildDescriptors(null, object);
+ }
+
+ // Generate actions for selection; populate and redraw the menus.
+ //
+ createChildActions = generateCreateChildActions(newChildDescriptors, selection);
+ createSiblingActions = generateCreateSiblingActions(newSiblingDescriptors, selection);
+
+ if (createChildMenuManager != null)
+ {
+ populateManager(createChildMenuManager, createChildActions, null);
+ createChildMenuManager.update(true);
+ }
+ if (createSiblingMenuManager != null)
+ {
+ populateManager(createSiblingMenuManager, createSiblingActions, null);
+ createSiblingMenuManager.update(true);
+ }
+ }
+
+ /**
+ * @ADDED
+ */
+ public void selectionChanged(SelectionChangedEvent event)
+ {
+ // Remove any menu items for old selection.
+ //
+ if (createChildMenuManager != null)
+ {
+ depopulateManager(createChildMenuManager, createChildActions);
+ }
+
+ if (createSiblingMenuManager != null)
+ {
+ depopulateManager(createSiblingMenuManager, createSiblingActions);
+ }
+
+ // Query the new selection for appropriate new child/sibling descriptors
+ //
+ Collection<?> newChildDescriptors = null;
+ Collection<?> newSiblingDescriptors = null;
+
+ ISelection selection = event.getSelection();
+ if (selection instanceof IStructuredSelection)
+ {
+ if (reloadObjectsAction != null)
+ {
+ reloadObjectsAction.selectionChanged((IStructuredSelection)selection);
+ }
+
+ if (readLockObjectsAction != null)
+ {
+ readLockObjectsAction.selectionChanged((IStructuredSelection)selection);
+ }
+
+ if (writeLockObjectsAction != null)
+ {
+ writeLockObjectsAction.selectionChanged((IStructuredSelection)selection);
+ }
+
+ if (((IStructuredSelection)selection).size() == 1)
+ {
+ Object object = ((IStructuredSelection)selection).getFirstElement();
+
+ EditingDomain domain = ((IEditingDomainProvider)activeEditorPart).getEditingDomain();
+
+ newChildDescriptors = domain.getNewChildDescriptors(object, null);
+ newSiblingDescriptors = domain.getNewChildDescriptors(null, object);
+
+ if (importRootsAction != null)
+ {
+ if (object instanceof CDOResource)
+ {
+ importRootsAction.setTargetResource((CDOResource)object);
+ }
+ else
+ {
+ importRootsAction.setTargetResource(null);
+ }
+ }
+ }
+ }
+
+ // Generate actions for selection; populate and redraw the menus.
+ //
+ createChildActions = generateCreateChildActions(newChildDescriptors, selection);
+ createSiblingActions = generateCreateSiblingActions(newSiblingDescriptors, selection);
+
+ if (createChildMenuManager != null)
+ {
+ populateManager(createChildMenuManager, createChildActions, null);
+ createChildMenuManager.update(true);
+ }
+
+ if (createSiblingMenuManager != null)
+ {
+ populateManager(createSiblingMenuManager, createSiblingActions, null);
+ createSiblingMenuManager.update(true);
+ }
+ }
+
+ /**
+ * This generates a {@link org.eclipse.emf.edit.ui.action.CreateChildAction} for each object in
+ * <code>descriptors</code>, and returns the collection of these actions. <!-- begin-user-doc --> <!-- end-user-doc
+ * -->
+ *
+ * @generated
+ */
+ protected Collection<IAction> generateCreateChildActions(Collection<?> descriptors, ISelection selection)
+ {
+ Collection<IAction> actions = new ArrayList<IAction>();
+ if (descriptors != null)
+ {
+ for (Object descriptor : descriptors)
+ {
+ actions.add(new CreateChildAction(activeEditorPart, selection, descriptor));
+ }
+ }
+ return actions;
+ }
+
+ /**
+ * This generates a {@link org.eclipse.emf.edit.ui.action.CreateSiblingAction} for each object in
+ * <code>descriptors</code>, and returns the collection of these actions. <!-- begin-user-doc --> <!-- end-user-doc
+ * -->
+ *
+ * @generated
+ */
+ protected Collection<IAction> generateCreateSiblingActions(Collection<?> descriptors, ISelection selection)
+ {
+ Collection<IAction> actions = new ArrayList<IAction>();
+ if (descriptors != null)
+ {
+ for (Object descriptor : descriptors)
+ {
+ actions.add(new CreateSiblingAction(activeEditorPart, selection, descriptor));
+ }
+ }
+ return actions;
+ }
+
+ /**
+ * This populates the specified <code>manager</code> with {@link org.eclipse.jface.action.ActionContributionItem}s
+ * based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection, by
+ * inserting them before the specified contribution item <code>contributionID</code>. If <code>contributionID</code>
+ * is <code>null</code>, they are simply added. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected void populateManager(IContributionManager manager, Collection<? extends IAction> actions,
+ String contributionID)
+ {
+ if (actions != null)
+ {
+ for (IAction action : actions)
+ {
+ if (contributionID != null)
+ {
+ manager.insertBefore(contributionID, action);
+ }
+ else
+ {
+ manager.add(action);
+ }
+ }
+ }
+ }
+
+ /**
+ * This removes from the specified <code>manager</code> all {@link org.eclipse.jface.action.ActionContributionItem}s
+ * based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected void depopulateManager(IContributionManager manager, Collection<? extends IAction> actions)
+ {
+ if (actions != null)
+ {
+ IContributionItem[] items = manager.getItems();
+ for (int i = 0; i < items.length; i++)
+ {
+ // Look into SubContributionItems
+ //
+ IContributionItem contributionItem = items[i];
+ while (contributionItem instanceof SubContributionItem)
+ {
+ contributionItem = ((SubContributionItem)contributionItem).getInnerItem();
+ }
+
+ // Delete the ActionContributionItems with matching action.
+ //
+ if (contributionItem instanceof ActionContributionItem)
+ {
+ IAction action = ((ActionContributionItem)contributionItem).getAction();
+ if (actions.contains(action))
+ {
+ manager.remove(contributionItem);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * This populates the pop-up menu before it appears. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void menuAboutToShow(IMenuManager menuManager)
+ {
+ super.menuAboutToShow(menuManager);
+ MenuManager submenuManager = null;
+
+ submenuManager = new MenuManager(PluginDelegator.INSTANCE.getString("_UI_CreateChild_menu_item"));
+ populateManager(submenuManager, createChildActions, null);
+ menuManager.insertBefore("edit", submenuManager);
+
+ submenuManager = new MenuManager(PluginDelegator.INSTANCE.getString("_UI_CreateSibling_menu_item"));
+ populateManager(submenuManager, createSiblingActions, null);
+ menuManager.insertBefore("edit", submenuManager);
+ }
+
+ /**
+ * This inserts global actions before the "additions-end" separator. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected void addGlobalActionsGen(IMenuManager menuManager)
+ {
+ menuManager.insertAfter("additions-end", new Separator("ui-actions"));
+ menuManager.insertAfter("ui-actions", showPropertiesViewAction);
+
+ refreshViewerAction.setEnabled(refreshViewerAction.isEnabled());
+ menuManager.insertAfter("ui-actions", refreshViewerAction);
+
+ super.addGlobalActions(menuManager);
+ }
+
+ /**
+ * @ADDED
+ */
+ @Override
+ protected void addGlobalActions(IMenuManager menuManager)
+ {
+ menuManager.insertAfter("additions-end", new Separator("ui-actions")); //$NON-NLS-1$ //$NON-NLS-2$
+ menuManager.insertAfter("ui-actions", showPropertiesViewAction); //$NON-NLS-1$
+
+ refreshViewerAction.setEnabled(refreshViewerAction.isEnabled());
+ refreshViewerAction.setId(REFRESH_VIEWER_ID);
+ menuManager.insertAfter("ui-actions", refreshViewerAction); //$NON-NLS-1$
+ menuManager.insertBefore(refreshViewerAction.getId(), reloadObjectsAction);
+
+ MenuManager lockingSubMenu = new MenuManager(Messages.getString("CDOActionBarContributor_0")); //$NON-NLS-1$
+ lockingSubMenu.add(new Separator("ui-actions")); //$NON-NLS-1$
+
+ lockingSubMenu.insertAfter("ui-actions", writeLockObjectsAction); //$NON-NLS-1$
+ writeLockObjectsAction.update();
+
+ lockingSubMenu.insertAfter("ui-actions", readLockObjectsAction); //$NON-NLS-1$
+ readLockObjectsAction.update();
+
+ menuManager.insertAfter("ui-actions", lockingSubMenu); //$NON-NLS-1$
+
+ menuManager.insertAfter("ui-actions", changePassiveUpdateAction); //$NON-NLS-1$
+ changePassiveUpdateAction.update();
+ changePassiveUpdateAction.setEnabled(true);
+
+ super.addGlobalActions(menuManager);
+
+ if (loadResourceAction != null)
+ {
+ if (importRootsAction != null)
+ {
+ menuManager.insertAfter(loadResourceAction.getId(), importRootsAction);
+ }
+ }
+ else
+ {
+ if (importRootsAction != null)
+ {
+ menuManager.insertBefore("additions-end", importRootsAction); //$NON-NLS-1$
+ }
+
+ menuManager.insertBefore("additions-end", new Separator()); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * This ensures that a delete action will clean up all references to deleted objects. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected boolean removeAllReferencesOnDelete()
+ {
+ return true;
+ }
+
+ /**
+ * @ADDED
+ */
+ @Override
+ public void activate()
+ {
+ if (importRootsAction != null)
+ {
+ importRootsAction.setActiveWorkbenchPart(activeEditor);
+ Object input = ((CDOEditor)getActiveEditor()).getViewer().getInput();
+ if (input instanceof CDOResource)
+ {
+ importRootsAction.setTargetResource((CDOResource)input);
+ }
+ else
+ {
+ importRootsAction.setTargetResource(null);
+ }
+ }
+
+ if (reloadObjectsAction != null)
+ {
+ reloadObjectsAction.setActiveWorkbenchPart(activeEditor);
+ }
+
+ if (changePassiveUpdateAction != null)
+ {
+ Object input = ((CDOEditor)getActiveEditor()).getViewer().getInput();
+ if (input instanceof CDOResource)
+ {
+ CDOView view = ((CDOResource)input).cdoView();
+ changePassiveUpdateAction.setSession(view.getSession());
+ }
+ }
+
+ super.activate();
+ }
+
+ /**
+ * @ADDED
+ */
+ @Override
+ public void deactivate()
+ {
+ if (importRootsAction != null)
+ {
+ importRootsAction.setActiveWorkbenchPart(null);
+ importRootsAction.setTargetResource(null);
+ }
+
+ if (reloadObjectsAction != null)
+ {
+ reloadObjectsAction.setActiveWorkbenchPart(null);
+ }
+
+ super.deactivate();
+ }
+
+ /**
+ * @ADDED
+ */
+ @Override
+ public void update()
+ {
+ super.update();
+ if (importRootsAction != null)
+ {
+ importRootsAction.update();
+ }
+
+ if (reloadObjectsAction != null)
+ {
+ reloadObjectsAction.update();
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/PluginDelegator.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/PluginDelegator.java
index f0d22229db..ee46be8be0 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/PluginDelegator.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/PluginDelegator.java
@@ -1,117 +1,117 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.emf.cdo.internal.ui.editor;
-
-import org.eclipse.emf.cdo.internal.ui.bundle.OM;
-
-import org.eclipse.emf.common.EMFPlugin;
-import org.eclipse.emf.common.ui.EclipseUIPlugin;
-import org.eclipse.emf.common.util.ResourceLocator;
-
-/**
- * @author Eike Stepper
- * @generated
- */
-public final class PluginDelegator extends EMFPlugin
-{
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- public static final String copyright = "Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Eike Stepper - initial API and implementation"; //$NON-NLS-1$
-
- /**
- * Keep track of the singleton. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- public static final PluginDelegator INSTANCE = new PluginDelegator();
-
- /**
- * Keep track of the singleton. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- private static Implementation plugin;
-
- /**
- * Create the instance. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- public PluginDelegator()
- {
- super(new ResourceLocator[] {});
- }
-
- /**
- * @ADDED
- */
- @Override
- public void log(Object logEntry)
- {
- if (logEntry instanceof Throwable)
- {
- OM.LOG.error((Throwable)logEntry);
- }
- else
- {
- OM.LOG.info(logEntry.toString());
- }
- }
-
- /**
- * Returns the singleton instance of the Eclipse plugin. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @return the singleton instance.
- * @generated
- */
- @Override
- public ResourceLocator getPluginResourceLocator()
- {
- return plugin;
- }
-
- /**
- * Returns the singleton instance of the Eclipse plugin. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @return the singleton instance.
- * @generated
- */
- public static Implementation getPlugin()
- {
- return plugin;
- }
-
- /**
- * The actual implementation of the Eclipse <b>Plugin</b>. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- public static class Implementation extends EclipseUIPlugin
- {
- /**
- * Creates an instance. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- public Implementation()
- {
- super();
-
- // Remember the static instance.
- //
- plugin = this;
- }
- }
-
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.internal.ui.editor;
+
+import org.eclipse.emf.cdo.internal.ui.bundle.OM;
+
+import org.eclipse.emf.common.EMFPlugin;
+import org.eclipse.emf.common.ui.EclipseUIPlugin;
+import org.eclipse.emf.common.util.ResourceLocator;
+
+/**
+ * @author Eike Stepper
+ * @generated
+ */
+public final class PluginDelegator extends EMFPlugin
+{
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public static final String copyright = "Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v1.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v10.html\r\n\r\nContributors:\r\n Eike Stepper - initial API and implementation"; //$NON-NLS-1$
+
+ /**
+ * Keep track of the singleton. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public static final PluginDelegator INSTANCE = new PluginDelegator();
+
+ /**
+ * Keep track of the singleton. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private static Implementation plugin;
+
+ /**
+ * Create the instance. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public PluginDelegator()
+ {
+ super(new ResourceLocator[] {});
+ }
+
+ /**
+ * @ADDED
+ */
+ @Override
+ public void log(Object logEntry)
+ {
+ if (logEntry instanceof Throwable)
+ {
+ OM.LOG.error((Throwable)logEntry);
+ }
+ else
+ {
+ OM.LOG.info(logEntry.toString());
+ }
+ }
+
+ /**
+ * Returns the singleton instance of the Eclipse plugin. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the singleton instance.
+ * @generated
+ */
+ @Override
+ public ResourceLocator getPluginResourceLocator()
+ {
+ return plugin;
+ }
+
+ /**
+ * Returns the singleton instance of the Eclipse plugin. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @return the singleton instance.
+ * @generated
+ */
+ public static Implementation getPlugin()
+ {
+ return plugin;
+ }
+
+ /**
+ * The actual implementation of the Eclipse <b>Plugin</b>. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public static class Implementation extends EclipseUIPlugin
+ {
+ /**
+ * Creates an instance. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public Implementation()
+ {
+ super();
+
+ // Remember the static instance.
+ //
+ plugin = this;
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/filters/CDOObjectFilter.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/filters/CDOObjectFilter.java
index c392056da3..25c2d6e852 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/filters/CDOObjectFilter.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/filters/CDOObjectFilter.java
@@ -1,48 +1,48 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.emf.cdo.internal.ui.filters;
-
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-
-/**
- * @author Victor Roldan Betancort
- */
-public abstract class CDOObjectFilter extends ViewerFilter
-{
- private StructuredViewer viewer;
-
- private String pattern = ""; //$NON-NLS-1$
-
- public CDOObjectFilter(StructuredViewer viewer)
- {
- this.viewer = viewer;
- viewer.addFilter(this);
- }
-
- public String getPattern()
- {
- return pattern;
- }
-
- public void setPattern(String pattern)
- {
- parsePattern(pattern);
- this.pattern = pattern;
- viewer.refresh();
- }
-
- protected abstract void parsePattern(String pattern);
-
- public abstract String getDescription();
-
- public abstract String getTitle();
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.internal.ui.filters;
+
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+
+/**
+ * @author Victor Roldan Betancort
+ */
+public abstract class CDOObjectFilter extends ViewerFilter
+{
+ private StructuredViewer viewer;
+
+ private String pattern = ""; //$NON-NLS-1$
+
+ public CDOObjectFilter(StructuredViewer viewer)
+ {
+ this.viewer = viewer;
+ viewer.addFilter(this);
+ }
+
+ public String getPattern()
+ {
+ return pattern;
+ }
+
+ public void setPattern(String pattern)
+ {
+ parsePattern(pattern);
+ this.pattern = pattern;
+ viewer.refresh();
+ }
+
+ protected abstract void parsePattern(String pattern);
+
+ public abstract String getDescription();
+
+ public abstract String getTitle();
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/filters/CDOStateFilter.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/filters/CDOStateFilter.java
index 14d38248b6..936d7ab5ef 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/filters/CDOStateFilter.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/filters/CDOStateFilter.java
@@ -1,99 +1,99 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Victor Roldan Betancort - initial API and implementation
- * Eike Stepper - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui.filters;
-
-import org.eclipse.emf.cdo.CDOState;
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-import org.eclipse.emf.cdo.util.CDOUtil;
-
-import org.eclipse.emf.ecore.EObject;
-
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.Viewer;
-
-import java.text.MessageFormat;
-
-/**
- * @author Victor Roldan Betancort
- */
-public class CDOStateFilter extends CDOObjectFilter
-{
- private static final String STATE_CONFLICT = Messages.getString("CDOStateFilter.0"); //$NON-NLS-1$
-
- private static final String STATE_TRANSIENT = Messages.getString("CDOStateFilter.1"); //$NON-NLS-1$
-
- private static final String STATE_NEW = Messages.getString("CDOStateFilter.2"); //$NON-NLS-1$
-
- private static final String STATE_CLEAN = Messages.getString("CDOStateFilter.3"); //$NON-NLS-1$
-
- private static final String STATE_DIRTY = Messages.getString("CDOStateFilter.4"); //$NON-NLS-1$
-
- private CDOState stateFilter;
-
- public CDOStateFilter(StructuredViewer viewer)
- {
- super(viewer);
- }
-
- @Override
- protected void parsePattern(String pattern)
- {
- if (pattern.compareToIgnoreCase(STATE_DIRTY) == 0)
- {
- stateFilter = CDOState.DIRTY;
- }
- else if (pattern.compareToIgnoreCase(STATE_CLEAN) == 0)
- {
- stateFilter = CDOState.CLEAN;
- }
- else if (pattern.compareToIgnoreCase(STATE_NEW) == 0)
- {
- stateFilter = CDOState.NEW;
- }
- else if (pattern.compareToIgnoreCase(STATE_TRANSIENT) == 0)
- {
- stateFilter = CDOState.TRANSIENT;
- }
- else if (pattern.compareToIgnoreCase(STATE_CONFLICT) == 0)
- {
- stateFilter = CDOState.CONFLICT;
- }
- else
- {
- stateFilter = null;
- }
- }
-
- @Override
- public boolean select(Viewer viewer, Object parentElement, Object element)
- {
- if (stateFilter != null)
- {
- return CDOUtil.getCDOObject((EObject)element).cdoState() == stateFilter;
- }
-
- return true;
- }
-
- @Override
- public String getDescription()
- {
- return MessageFormat.format(Messages.getString("CDOStateFilter.5"), STATE_DIRTY, STATE_CLEAN, //$NON-NLS-1$
- STATE_TRANSIENT, STATE_NEW, STATE_CONFLICT);
- }
-
- @Override
- public String getTitle()
- {
- return Messages.getString("CDOStateFilter.6"); //$NON-NLS-1$
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Victor Roldan Betancort - initial API and implementation
+ * Eike Stepper - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui.filters;
+
+import org.eclipse.emf.cdo.CDOState;
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+import org.eclipse.emf.cdo.util.CDOUtil;
+
+import org.eclipse.emf.ecore.EObject;
+
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.jface.viewers.Viewer;
+
+import java.text.MessageFormat;
+
+/**
+ * @author Victor Roldan Betancort
+ */
+public class CDOStateFilter extends CDOObjectFilter
+{
+ private static final String STATE_CONFLICT = Messages.getString("CDOStateFilter.0"); //$NON-NLS-1$
+
+ private static final String STATE_TRANSIENT = Messages.getString("CDOStateFilter.1"); //$NON-NLS-1$
+
+ private static final String STATE_NEW = Messages.getString("CDOStateFilter.2"); //$NON-NLS-1$
+
+ private static final String STATE_CLEAN = Messages.getString("CDOStateFilter.3"); //$NON-NLS-1$
+
+ private static final String STATE_DIRTY = Messages.getString("CDOStateFilter.4"); //$NON-NLS-1$
+
+ private CDOState stateFilter;
+
+ public CDOStateFilter(StructuredViewer viewer)
+ {
+ super(viewer);
+ }
+
+ @Override
+ protected void parsePattern(String pattern)
+ {
+ if (pattern.compareToIgnoreCase(STATE_DIRTY) == 0)
+ {
+ stateFilter = CDOState.DIRTY;
+ }
+ else if (pattern.compareToIgnoreCase(STATE_CLEAN) == 0)
+ {
+ stateFilter = CDOState.CLEAN;
+ }
+ else if (pattern.compareToIgnoreCase(STATE_NEW) == 0)
+ {
+ stateFilter = CDOState.NEW;
+ }
+ else if (pattern.compareToIgnoreCase(STATE_TRANSIENT) == 0)
+ {
+ stateFilter = CDOState.TRANSIENT;
+ }
+ else if (pattern.compareToIgnoreCase(STATE_CONFLICT) == 0)
+ {
+ stateFilter = CDOState.CONFLICT;
+ }
+ else
+ {
+ stateFilter = null;
+ }
+ }
+
+ @Override
+ public boolean select(Viewer viewer, Object parentElement, Object element)
+ {
+ if (stateFilter != null)
+ {
+ return CDOUtil.getCDOObject((EObject)element).cdoState() == stateFilter;
+ }
+
+ return true;
+ }
+
+ @Override
+ public String getDescription()
+ {
+ return MessageFormat.format(Messages.getString("CDOStateFilter.5"), STATE_DIRTY, STATE_CLEAN, //$NON-NLS-1$
+ STATE_TRANSIENT, STATE_NEW, STATE_CONFLICT);
+ }
+
+ @Override
+ public String getTitle()
+ {
+ return Messages.getString("CDOStateFilter.6"); //$NON-NLS-1$
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/messages/Messages.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/messages/Messages.java
index 2f4051f37c..701baa7bd6 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/messages/Messages.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/messages/Messages.java
@@ -1,41 +1,41 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Victor Roldan Betancort - initial API and implementation
- * Eike Stepper - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui.messages;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-/**
- * @author Victor Roldan Betancort
- */
-public class Messages
-{
- private static final String BUNDLE_NAME = "org.eclipse.emf.cdo.internal.ui.messages.messages"; //$NON-NLS-1$
-
- private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
-
- private Messages()
- {
- }
-
- public static String getString(String key)
- {
- try
- {
- return RESOURCE_BUNDLE.getString(key);
- }
- catch (MissingResourceException e)
- {
- return '!' + key + '!';
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Victor Roldan Betancort - initial API and implementation
+ * Eike Stepper - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui.messages;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * @author Victor Roldan Betancort
+ */
+public class Messages
+{
+ private static final String BUNDLE_NAME = "org.eclipse.emf.cdo.internal.ui.messages.messages"; //$NON-NLS-1$
+
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
+
+ private Messages()
+ {
+ }
+
+ public static String getString(String key)
+ {
+ try
+ {
+ return RESOURCE_BUNDLE.getString(key);
+ }
+ catch (MissingResourceException e)
+ {
+ return '!' + key + '!';
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/messages/messages.properties b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/messages/messages.properties
index 4a7eec1fac..3930a453ec 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/messages/messages.properties
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/messages/messages.properties
@@ -1,206 +1,206 @@
-# ==============================================================================
-# Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
-# All rights reserved. This program and the accompanying materials
-# 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:
-# Victor Roldan Betancort - initial API and implementation
-# Eike Stepper - maintenance
-# ==============================================================================
-
-# ==============================================================================
-# This properties file contains all strings subject to be shown in the UI.
-# ==============================================================================
-
-AbstractLockObjectsAction.0=Error
-AbstractLockObjectsAction.1=Cannot obtain locks
-AsyncContentProvider_0=Pending...
-BranchSelectionDialog_0=Switch Target
-BranchSelectionDialog_1=Please choose the target branch
-BranchSelectionDialog_2=The selected branch point is current
-BranchSelectionDialog.0=Branch Point
-BranchSelectionDialog.1=Head
-BranchSelectionDialog.2=Base
-BranchSelectionDialog.3=Time
-BranchSelectionDialog.4=Commit Point
-BranchSelectionDialog.5=Cannot select base point for the main branch
-BulkAddDialog.0=Bulk Add
-BulkAddDialog.1=Select a child type and number of child instances
-BulkAddDialog.2=Type:
-BulkAddDialog.3=Instances:
-BulkAddDialog.4=Select a feature
-BulkAddDialog.5=Enter a valid number of instances (>0)
-CDOActionBarContributor_0=Lock
-CDOEditor.1=Open Target Time Slider
-CDOEditor.17=Transaction error
-CDOEditor.18=A commit error occured. See error log for details.
-CDOEditor.23=New Root
-CDOEditor.26=Bulk Add
-CDOEditor.27=Calculating...
-CDOEditor.28=Can't find {0} in CDOPackageRegistry
-CDOEditorInputImpl.0=View closed
-CDOInteractiveExceptionHandler.0=CDO Session Protocol Problem
-CDOInteractiveExceptionHandler.1=attempt
-CDOInteractiveExceptionHandler.2=attempts
-CDOInteractiveExceptionHandler.3=A protocol problem occurred in {0} after {1} {2}.\n\nRetry or abort the operation?
-CDOInteractiveExceptionHandler.4=Retry
-CDOInteractiveExceptionHandler.5=Abort
-CDOItemProvider.0=Session {0} [{1}]
-CDOItemProvider.3=Transaction
-CDOItemProvider.7=View
-CDOItemProvider.8=Register Generated Package
-CDOPreferencePage.0=Session Defaults
-CDOPreferencePage.1=Repository name:
-CDOPreferencePage.2=User name:
-CDOPreferencePage.3=Connector description:
-CDOPreferencePage.4=Reference chunk size:
-CDOPreferencePage.5=View Defaults
-CDOPreferencePage.6=Preload chunk size:
-CDOPreferencePage.7=EMF invalidation notifications:
-CDORemoteSessionsView_0=Message from {0}
-CDORemoteSessionsView_1=Message to {0}
-CDORemoteSessionsView_2=Message:
-CDOStateFilter.0=conflict
-CDOStateFilter.1=transient
-CDOStateFilter.2=new
-CDOStateFilter.3=clean
-CDOStateFilter.4=dirty
-CDOStateFilter.5=Specify a state to filter: {0} | {1} | {2} | {3} | {4}
-CDOStateFilter.6=CDOState filter
-CDOUIPreferencePage.0=Label decoration:
-CDOUIPreferencePage.1=Enable CDOEditor Auto-Reload
-CDOUIPreferencePage.2=Available tags:
-CDOWatchListView.0=Object
-CDOWatchListView.1=Resource
-CDOWatchListView.10=Reset All Changes
-CDOWatchListView.11=Reset all change notifications of the subscriptions in the view
-CDOWatchListView.12=CREATE
-CDOWatchListView.2=Time
-CDOWatchListView.25=SET
-CDOWatchListView.26=UNSET
-CDOWatchListView.27=ADD
-CDOWatchListView.28=REMOVE
-CDOWatchListView.29=ADD MANY
-CDOWatchListView.3=Changes
-CDOWatchListView.30=REMOVE MANY
-CDOWatchListView.31=MOVE
-CDOWatchListView.32=REMOVING ADAPTER
-CDOWatchListView.33=RESOLVE
-CDOWatchListView.4=Remove
-CDOWatchListView.5=Remove selected subscriptions
-CDOWatchListView.6=Remove All
-CDOWatchListView.7=Remove all subscriptions
-CDOWatchListView.8=Reset Changes
-CDOWatchListView.9=Reset all change notifications from the selected subscriptions
-ChangePassiveUpdateAction.1=Passive Updates
-SwitchTargetAction.0=Switch Target
-SwitchTargetAction.1=Switch the target branch point
-CloseSessionAction.0=Close
-CloseSessionAction.1=Close the CDO session
-CloseSessionAction.2=You have uncommitted changes. Do you want to discard them?
-CloseViewAction.0=Close
-CloseViewAction.1=Close the CDO view
-CloseViewAction.2=You have uncommitted changes. Do you want to discard them?
-CommitTransactionAction.0=Commit
-CommitTransactionAction.1=Commit this transaction
-CreateResourceAction.0=Create Resource
-CreateResourceAction.1=Create a CDO resource
-CreateResourceAction.2=Enter resource name:
-CreateResourceAction.4=Resource already exists
-CreateResourceAction.5=There already exists a resource with path "{0}". Do you want to edit the resource?
-CreateResourceNodeAction.0=Create Folder
-CreateResourceNodeAction.1=Create a new CDOResourceFolder
-CreateResourceNodeAction.2=Relative names not allowed
-CreateResourceNodeAction.3=Folder name cannot be empty
-CreateResourceNodeAction.4=Resource name cannot be empty
-CreateResourceNodeAction.5=There exist a folder with name
-CreateResourceNodeAction.6=There exist a resource with name
-ExportResourceAction.1=Export Resource
-ExportResourceAction.2=Export a CDO resource
-ExportResourceAction.3=A single URI must be entered\!
-ExportResourceDialog.1=Source path:
-ImportResourceAction.1=Import Resource
-ImportResourceAction.2=Import a CDO resource
-ImportResourceAction.3=A single URI must be entered\!
-ImportResourceDialog.1=Target path:
-ImportRootsAction.1=Import Roots
-LoadResourceAction.0=Load Resource
-LoadResourceAction.1=Load a CDO resource
-LoadResourceAction.2=Error while opening CDOEditor
-LoadResourceAction.3=The specified resource {0} does not exist
-LoadResourceAction.4=Enter resource path:
-ManagePackagesAction.0=Package Registry
-ManagePackagesAction.1=Browse and register model packages
-CreateBranchAction.0=Create Branch
-CreateBranchAction.1=Create a new branch
-OpenAuditAction.0=Open Audit
-OpenAuditAction.1=Open a historical CDO view
-OpenAuditDialog.0=Open Audit
-OpenAuditDialog.1=Target Time:
-OpenDurableViewAction.0=Open Durable View
-OpenDurableViewAction.1=Open a durable CDO view
-OpenDurableViewDialog.0=Open Durable View
-OpenDurableViewDialog.1=Area ID:
-OpenResourceEditorAction.0=Open Editor
-OpenResourceEditorAction.1=Open a CDO editor for this resource
-OpenResourcesDialog.0=Open Resources
-OpenSessionAction.0=Open a new CDO session
-OpenSessionAction.3=Unable to open a session on the specified repository.\n\n
-OpenSessionDialog.0=Open Session
-OpenTransactionAction.0=Open Transaction
-OpenTransactionAction.1=Open a read-write CDO view
-OpenViewAction.0=Open View
-OpenViewAction.1=Open a read-only CDO view
-OpenViewEditorAction.0=Open Editor
-OpenViewEditorAction.1=Open a CDO editor for this view
-PackageRegistryDialog.0=CDO Package Registry
-PackageRegistryDialog.1=Package
-PackageRegistryDialog.2=State
-PackageRegistryDialog.3=Type
-PackageRegistryDialog.4=Original
-PackageRegistryDialog.5=Generated...
-PackageRegistryDialog.6=Workspace...
-PackageRegistryDialog.7=Filesystem...
-PackageRegistryDialog.8=?
-ReadLockObjectsAction.1=Read Lock
-RegisterFilesystemPackagesAction.0=Register Filesystem Packages
-RegisterFilesystemPackagesAction.1=Register dynamic packages from the filesystem
-RegisterFilesystemPackagesAction.2=Ecore models (*.ecore)
-RegisterFilesystemPackagesAction.3=XMI files (*.xmi)
-RegisterFilesystemPackagesAction.4=XML files (*.xml)
-RegisterFilesystemPackagesAction.5=All files (*.*)
-RegisterGeneratedPackagesAction.0=Register Generated Packages
-RegisterGeneratedPackagesAction.1=Register native and legacy packages
-RegisterGeneratedPackagesAction.2=Generated Packages
-RegisterGeneratedPackagesAction.3=Select one or more packages for registration with the CDO package registry
-RegisterGeneratedPackagesAction.5=Package {0} not found.
-RegisterPackagesAction.0=Failed to register package {0}
-RegisterPackagesAction.1=\ {0} package has not been registered due to errors.\nSee the log for details.
-RegisterPackagesAction.2=\ {0} packages have not been registered due to errors.\nSee the log for details.
-RegisterSinglePackageAction.0=Register the package
-RegisterWorkspacePackagesAction.0=Register Workspace Packages
-RegisterWorkspacePackagesAction.1=Register dynamic packages from the workspace
-ReloadObjectsAction.1=Reload
-ReloadViewAction.0=Reload
-ReloadViewAction.1=Reload this view
-EnableViewDurabilityAction.0=Make Durable
-EnableViewDurabilityAction.1=Make this view durable
-DisableViewDurabilityAction.0=Make Not Durable
-DisableViewDurabilityAction.1=Make this view not durable
-RollbackTransactionAction.0=Rollback
-RollbackTransactionAction.1=Rollback this transaction
-RollbackTransactionDialog.0=This transaction contains:
-RollbackTransactionDialog.11=Are you sure to rollback this transaction?
-RollbackTransactionDialog.4=new object
-RollbackTransactionDialog.5=new objects
-RollbackTransactionDialog.6=dirty object
-RollbackTransactionDialog.7=dirty objects
-RollbackTransactionDialog.8=detached object
-RollbackTransactionDialog.9=detached objects
-SessionComposite.0=Server Description:
-SessionComposite.1=for example 'tcp://dev.eclipse.org:2036'
-SessionComposite.2=Repository Name:
-SessionComposite.3=Automatic Package Registry
-WriteLockObjectsAction.1=Write Lock
+# ==============================================================================
+# Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+# All rights reserved. This program and the accompanying materials
+# 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:
+# Victor Roldan Betancort - initial API and implementation
+# Eike Stepper - maintenance
+# ==============================================================================
+
+# ==============================================================================
+# This properties file contains all strings subject to be shown in the UI.
+# ==============================================================================
+
+AbstractLockObjectsAction.0=Error
+AbstractLockObjectsAction.1=Cannot obtain locks
+AsyncContentProvider_0=Pending...
+BranchSelectionDialog_0=Switch Target
+BranchSelectionDialog_1=Please choose the target branch
+BranchSelectionDialog_2=The selected branch point is current
+BranchSelectionDialog.0=Branch Point
+BranchSelectionDialog.1=Head
+BranchSelectionDialog.2=Base
+BranchSelectionDialog.3=Time
+BranchSelectionDialog.4=Commit Point
+BranchSelectionDialog.5=Cannot select base point for the main branch
+BulkAddDialog.0=Bulk Add
+BulkAddDialog.1=Select a child type and number of child instances
+BulkAddDialog.2=Type:
+BulkAddDialog.3=Instances:
+BulkAddDialog.4=Select a feature
+BulkAddDialog.5=Enter a valid number of instances (>0)
+CDOActionBarContributor_0=Lock
+CDOEditor.1=Open Target Time Slider
+CDOEditor.17=Transaction error
+CDOEditor.18=A commit error occured. See error log for details.
+CDOEditor.23=New Root
+CDOEditor.26=Bulk Add
+CDOEditor.27=Calculating...
+CDOEditor.28=Can't find {0} in CDOPackageRegistry
+CDOEditorInputImpl.0=View closed
+CDOInteractiveExceptionHandler.0=CDO Session Protocol Problem
+CDOInteractiveExceptionHandler.1=attempt
+CDOInteractiveExceptionHandler.2=attempts
+CDOInteractiveExceptionHandler.3=A protocol problem occurred in {0} after {1} {2}.\n\nRetry or abort the operation?
+CDOInteractiveExceptionHandler.4=Retry
+CDOInteractiveExceptionHandler.5=Abort
+CDOItemProvider.0=Session {0} [{1}]
+CDOItemProvider.3=Transaction
+CDOItemProvider.7=View
+CDOItemProvider.8=Register Generated Package
+CDOPreferencePage.0=Session Defaults
+CDOPreferencePage.1=Repository name:
+CDOPreferencePage.2=User name:
+CDOPreferencePage.3=Connector description:
+CDOPreferencePage.4=Reference chunk size:
+CDOPreferencePage.5=View Defaults
+CDOPreferencePage.6=Preload chunk size:
+CDOPreferencePage.7=EMF invalidation notifications:
+CDORemoteSessionsView_0=Message from {0}
+CDORemoteSessionsView_1=Message to {0}
+CDORemoteSessionsView_2=Message:
+CDOStateFilter.0=conflict
+CDOStateFilter.1=transient
+CDOStateFilter.2=new
+CDOStateFilter.3=clean
+CDOStateFilter.4=dirty
+CDOStateFilter.5=Specify a state to filter: {0} | {1} | {2} | {3} | {4}
+CDOStateFilter.6=CDOState filter
+CDOUIPreferencePage.0=Label decoration:
+CDOUIPreferencePage.1=Enable CDOEditor Auto-Reload
+CDOUIPreferencePage.2=Available tags:
+CDOWatchListView.0=Object
+CDOWatchListView.1=Resource
+CDOWatchListView.10=Reset All Changes
+CDOWatchListView.11=Reset all change notifications of the subscriptions in the view
+CDOWatchListView.12=CREATE
+CDOWatchListView.2=Time
+CDOWatchListView.25=SET
+CDOWatchListView.26=UNSET
+CDOWatchListView.27=ADD
+CDOWatchListView.28=REMOVE
+CDOWatchListView.29=ADD MANY
+CDOWatchListView.3=Changes
+CDOWatchListView.30=REMOVE MANY
+CDOWatchListView.31=MOVE
+CDOWatchListView.32=REMOVING ADAPTER
+CDOWatchListView.33=RESOLVE
+CDOWatchListView.4=Remove
+CDOWatchListView.5=Remove selected subscriptions
+CDOWatchListView.6=Remove All
+CDOWatchListView.7=Remove all subscriptions
+CDOWatchListView.8=Reset Changes
+CDOWatchListView.9=Reset all change notifications from the selected subscriptions
+ChangePassiveUpdateAction.1=Passive Updates
+SwitchTargetAction.0=Switch Target
+SwitchTargetAction.1=Switch the target branch point
+CloseSessionAction.0=Close
+CloseSessionAction.1=Close the CDO session
+CloseSessionAction.2=You have uncommitted changes. Do you want to discard them?
+CloseViewAction.0=Close
+CloseViewAction.1=Close the CDO view
+CloseViewAction.2=You have uncommitted changes. Do you want to discard them?
+CommitTransactionAction.0=Commit
+CommitTransactionAction.1=Commit this transaction
+CreateResourceAction.0=Create Resource
+CreateResourceAction.1=Create a CDO resource
+CreateResourceAction.2=Enter resource name:
+CreateResourceAction.4=Resource already exists
+CreateResourceAction.5=There already exists a resource with path "{0}". Do you want to edit the resource?
+CreateResourceNodeAction.0=Create Folder
+CreateResourceNodeAction.1=Create a new CDOResourceFolder
+CreateResourceNodeAction.2=Relative names not allowed
+CreateResourceNodeAction.3=Folder name cannot be empty
+CreateResourceNodeAction.4=Resource name cannot be empty
+CreateResourceNodeAction.5=There exist a folder with name
+CreateResourceNodeAction.6=There exist a resource with name
+ExportResourceAction.1=Export Resource
+ExportResourceAction.2=Export a CDO resource
+ExportResourceAction.3=A single URI must be entered\!
+ExportResourceDialog.1=Source path:
+ImportResourceAction.1=Import Resource
+ImportResourceAction.2=Import a CDO resource
+ImportResourceAction.3=A single URI must be entered\!
+ImportResourceDialog.1=Target path:
+ImportRootsAction.1=Import Roots
+LoadResourceAction.0=Load Resource
+LoadResourceAction.1=Load a CDO resource
+LoadResourceAction.2=Error while opening CDOEditor
+LoadResourceAction.3=The specified resource {0} does not exist
+LoadResourceAction.4=Enter resource path:
+ManagePackagesAction.0=Package Registry
+ManagePackagesAction.1=Browse and register model packages
+CreateBranchAction.0=Create Branch
+CreateBranchAction.1=Create a new branch
+OpenAuditAction.0=Open Audit
+OpenAuditAction.1=Open a historical CDO view
+OpenAuditDialog.0=Open Audit
+OpenAuditDialog.1=Target Time:
+OpenDurableViewAction.0=Open Durable View
+OpenDurableViewAction.1=Open a durable CDO view
+OpenDurableViewDialog.0=Open Durable View
+OpenDurableViewDialog.1=Area ID:
+OpenResourceEditorAction.0=Open Editor
+OpenResourceEditorAction.1=Open a CDO editor for this resource
+OpenResourcesDialog.0=Open Resources
+OpenSessionAction.0=Open a new CDO session
+OpenSessionAction.3=Unable to open a session on the specified repository.\n\n
+OpenSessionDialog.0=Open Session
+OpenTransactionAction.0=Open Transaction
+OpenTransactionAction.1=Open a read-write CDO view
+OpenViewAction.0=Open View
+OpenViewAction.1=Open a read-only CDO view
+OpenViewEditorAction.0=Open Editor
+OpenViewEditorAction.1=Open a CDO editor for this view
+PackageRegistryDialog.0=CDO Package Registry
+PackageRegistryDialog.1=Package
+PackageRegistryDialog.2=State
+PackageRegistryDialog.3=Type
+PackageRegistryDialog.4=Original
+PackageRegistryDialog.5=Generated...
+PackageRegistryDialog.6=Workspace...
+PackageRegistryDialog.7=Filesystem...
+PackageRegistryDialog.8=?
+ReadLockObjectsAction.1=Read Lock
+RegisterFilesystemPackagesAction.0=Register Filesystem Packages
+RegisterFilesystemPackagesAction.1=Register dynamic packages from the filesystem
+RegisterFilesystemPackagesAction.2=Ecore models (*.ecore)
+RegisterFilesystemPackagesAction.3=XMI files (*.xmi)
+RegisterFilesystemPackagesAction.4=XML files (*.xml)
+RegisterFilesystemPackagesAction.5=All files (*.*)
+RegisterGeneratedPackagesAction.0=Register Generated Packages
+RegisterGeneratedPackagesAction.1=Register native and legacy packages
+RegisterGeneratedPackagesAction.2=Generated Packages
+RegisterGeneratedPackagesAction.3=Select one or more packages for registration with the CDO package registry
+RegisterGeneratedPackagesAction.5=Package {0} not found.
+RegisterPackagesAction.0=Failed to register package {0}
+RegisterPackagesAction.1=\ {0} package has not been registered due to errors.\nSee the log for details.
+RegisterPackagesAction.2=\ {0} packages have not been registered due to errors.\nSee the log for details.
+RegisterSinglePackageAction.0=Register the package
+RegisterWorkspacePackagesAction.0=Register Workspace Packages
+RegisterWorkspacePackagesAction.1=Register dynamic packages from the workspace
+ReloadObjectsAction.1=Reload
+ReloadViewAction.0=Reload
+ReloadViewAction.1=Reload this view
+EnableViewDurabilityAction.0=Make Durable
+EnableViewDurabilityAction.1=Make this view durable
+DisableViewDurabilityAction.0=Make Not Durable
+DisableViewDurabilityAction.1=Make this view not durable
+RollbackTransactionAction.0=Rollback
+RollbackTransactionAction.1=Rollback this transaction
+RollbackTransactionDialog.0=This transaction contains:
+RollbackTransactionDialog.11=Are you sure to rollback this transaction?
+RollbackTransactionDialog.4=new object
+RollbackTransactionDialog.5=new objects
+RollbackTransactionDialog.6=dirty object
+RollbackTransactionDialog.7=dirty objects
+RollbackTransactionDialog.8=detached object
+RollbackTransactionDialog.9=detached objects
+SessionComposite.0=Server Description:
+SessionComposite.1=for example 'tcp://dev.eclipse.org:2036'
+SessionComposite.2=Repository Name:
+SessionComposite.3=Automatic Package Registry
+WriteLockObjectsAction.1=Write Lock
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/perspectives/CDOExplorerPerspective.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/perspectives/CDOExplorerPerspective.java
index 3816e49ad4..128a323e44 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/perspectives/CDOExplorerPerspective.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/perspectives/CDOExplorerPerspective.java
@@ -1,90 +1,90 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Victor Roldan Betancort - initial API and implementation
- * Eike Stepper - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui.perspectives;
-
-import org.eclipse.emf.cdo.internal.ui.views.CDORemoteSessionsView;
-import org.eclipse.emf.cdo.internal.ui.views.CDOSessionsView;
-import org.eclipse.emf.cdo.internal.ui.views.CDOWatchListView;
-
-import org.eclipse.ui.IFolderLayout;
-import org.eclipse.ui.IPageLayout;
-import org.eclipse.ui.IPerspectiveFactory;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * @author Victor Roldan Betancort
- */
-public class CDOExplorerPerspective implements IPerspectiveFactory
-{
- public static final String ID = "org.eclipse.emf.cdo.ui.CDOExplorerPerspective"; //$NON-NLS-1$
-
- private IPageLayout pageLayout;
-
- public CDOExplorerPerspective()
- {
- }
-
- public IPageLayout getPageLayout()
- {
- return pageLayout;
- }
-
- public void createInitialLayout(IPageLayout pageLayout)
- {
- this.pageLayout = pageLayout;
- addViews();
- addPerspectiveShortcuts();
- addViewShortcuts();
- }
-
- protected void addViews()
- {
- IFolderLayout navigationPane = pageLayout.createFolder("navigationPane", IPageLayout.LEFT, 0.30f, //$NON-NLS-1$
- pageLayout.getEditorArea());
- navigationPane.addView(IPageLayout.ID_PROJECT_EXPLORER);
-
- IFolderLayout sessionsPane = pageLayout.createFolder("sessionsPane", IPageLayout.BOTTOM, 0.70f, //$NON-NLS-1$
- IPageLayout.ID_PROJECT_EXPLORER);
- sessionsPane.addView(CDOSessionsView.ID);
-
- IFolderLayout propertiesPane = pageLayout.createFolder("propertiesPane", IPageLayout.BOTTOM, 0.70f, //$NON-NLS-1$
- pageLayout.getEditorArea());
- propertiesPane.addView(IPageLayout.ID_PROP_SHEET);
- propertiesPane.addView(CDOWatchListView.ID);
- propertiesPane.addView(CDORemoteSessionsView.ID);
-
- IFolderLayout outlinePane = pageLayout.createFolder("outlinePane", IPageLayout.RIGHT, 0.70f, //$NON-NLS-1$
- pageLayout.getEditorArea());
- outlinePane.addView(IPageLayout.ID_OUTLINE);
- }
-
- protected void addViewShortcuts()
- {
- pageLayout.addShowViewShortcut(CDOSessionsView.ID);
- pageLayout.addShowViewShortcut(CDOWatchListView.ID);
- pageLayout.addShowViewShortcut(CDORemoteSessionsView.ID);
- pageLayout.addShowViewShortcut(IPageLayout.ID_OUTLINE);
- pageLayout.addShowViewShortcut(IPageLayout.ID_PROP_SHEET);
- pageLayout.addShowViewShortcut(IPageLayout.ID_PROJECT_EXPLORER);
- }
-
- protected void addPerspectiveShortcuts()
- {
- pageLayout.addPerspectiveShortcut(ID);
- }
-
- static public boolean isCurrent()
- {
- return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getPerspective().getId()
- .equals(CDOExplorerPerspective.ID);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Victor Roldan Betancort - initial API and implementation
+ * Eike Stepper - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui.perspectives;
+
+import org.eclipse.emf.cdo.internal.ui.views.CDORemoteSessionsView;
+import org.eclipse.emf.cdo.internal.ui.views.CDOSessionsView;
+import org.eclipse.emf.cdo.internal.ui.views.CDOWatchListView;
+
+import org.eclipse.ui.IFolderLayout;
+import org.eclipse.ui.IPageLayout;
+import org.eclipse.ui.IPerspectiveFactory;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @author Victor Roldan Betancort
+ */
+public class CDOExplorerPerspective implements IPerspectiveFactory
+{
+ public static final String ID = "org.eclipse.emf.cdo.ui.CDOExplorerPerspective"; //$NON-NLS-1$
+
+ private IPageLayout pageLayout;
+
+ public CDOExplorerPerspective()
+ {
+ }
+
+ public IPageLayout getPageLayout()
+ {
+ return pageLayout;
+ }
+
+ public void createInitialLayout(IPageLayout pageLayout)
+ {
+ this.pageLayout = pageLayout;
+ addViews();
+ addPerspectiveShortcuts();
+ addViewShortcuts();
+ }
+
+ protected void addViews()
+ {
+ IFolderLayout navigationPane = pageLayout.createFolder("navigationPane", IPageLayout.LEFT, 0.30f, //$NON-NLS-1$
+ pageLayout.getEditorArea());
+ navigationPane.addView(IPageLayout.ID_PROJECT_EXPLORER);
+
+ IFolderLayout sessionsPane = pageLayout.createFolder("sessionsPane", IPageLayout.BOTTOM, 0.70f, //$NON-NLS-1$
+ IPageLayout.ID_PROJECT_EXPLORER);
+ sessionsPane.addView(CDOSessionsView.ID);
+
+ IFolderLayout propertiesPane = pageLayout.createFolder("propertiesPane", IPageLayout.BOTTOM, 0.70f, //$NON-NLS-1$
+ pageLayout.getEditorArea());
+ propertiesPane.addView(IPageLayout.ID_PROP_SHEET);
+ propertiesPane.addView(CDOWatchListView.ID);
+ propertiesPane.addView(CDORemoteSessionsView.ID);
+
+ IFolderLayout outlinePane = pageLayout.createFolder("outlinePane", IPageLayout.RIGHT, 0.70f, //$NON-NLS-1$
+ pageLayout.getEditorArea());
+ outlinePane.addView(IPageLayout.ID_OUTLINE);
+ }
+
+ protected void addViewShortcuts()
+ {
+ pageLayout.addShowViewShortcut(CDOSessionsView.ID);
+ pageLayout.addShowViewShortcut(CDOWatchListView.ID);
+ pageLayout.addShowViewShortcut(CDORemoteSessionsView.ID);
+ pageLayout.addShowViewShortcut(IPageLayout.ID_OUTLINE);
+ pageLayout.addShowViewShortcut(IPageLayout.ID_PROP_SHEET);
+ pageLayout.addShowViewShortcut(IPageLayout.ID_PROJECT_EXPLORER);
+ }
+
+ protected void addPerspectiveShortcuts()
+ {
+ pageLayout.addPerspectiveShortcut(ID);
+ }
+
+ static public boolean isCurrent()
+ {
+ return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getPerspective().getId()
+ .equals(CDOExplorerPerspective.ID);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/preferences/CDOPreferencePage.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/preferences/CDOPreferencePage.java
index b766d41a45..c6380c6b87 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/preferences/CDOPreferencePage.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/preferences/CDOPreferencePage.java
@@ -1,127 +1,127 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- * Victor Roldan Betancort - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui.preferences;
-
-import org.eclipse.emf.cdo.common.revision.CDORevision;
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-import org.eclipse.emf.cdo.view.CDOView;
-
-import org.eclipse.net4j.util.ui.UIUtil;
-import org.eclipse.net4j.util.ui.prefs.OMPreferencePage;
-import org.eclipse.net4j.util.ui.widgets.TextAndDisable;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * @author Eike Stepper
- */
-public class CDOPreferencePage extends OMPreferencePage
-{
- private Text repositoryName;
-
- private Text userName;
-
- private Text connectorDescription;
-
- private TextAndDisable referenceChunkSize;
-
- private TextAndDisable preloadChunkSize;
-
- private Button invalidationNotifications;
-
- public CDOPreferencePage()
- {
- super(org.eclipse.emf.internal.cdo.bundle.OM.PREFS);
- }
-
- @Override
- protected Control createUI(Composite parent)
- {
- Composite composite = UIUtil.createGridComposite(parent, 1);
- ((GridLayout)composite.getLayout()).verticalSpacing = 5;
- composite.setLayoutData(UIUtil.createGridData());
-
- Group sessionGroup = new Group(composite, SWT.NONE);
- sessionGroup.setLayout(new GridLayout(2, false));
- sessionGroup.setText(Messages.getString("CDOPreferencePage.0")); //$NON-NLS-1$
- sessionGroup.setLayoutData(UIUtil.createGridData(true, false));
-
- new Label(sessionGroup, SWT.NONE).setText(Messages.getString("CDOPreferencePage.1")); //$NON-NLS-1$
- repositoryName = new Text(sessionGroup, SWT.BORDER);
- repositoryName.setLayoutData(UIUtil.createGridData(true, false));
-
- new Label(sessionGroup, SWT.NONE).setText(Messages.getString("CDOPreferencePage.2")); //$NON-NLS-1$
- userName = new Text(sessionGroup, SWT.BORDER);
- userName.setLayoutData(UIUtil.createGridData(true, false));
-
- new Label(sessionGroup, SWT.NONE).setText(Messages.getString("CDOPreferencePage.3")); //$NON-NLS-1$
- connectorDescription = new Text(sessionGroup, SWT.BORDER);
- connectorDescription.setLayoutData(UIUtil.createGridData(true, false));
-
- new Label(sessionGroup, SWT.NONE).setText(Messages.getString("CDOPreferencePage.4")); //$NON-NLS-1$
- referenceChunkSize = new TextAndDisable(sessionGroup, SWT.BORDER, String.valueOf(CDORevision.UNCHUNKED));
- referenceChunkSize.setLayoutData(UIUtil.createGridData(true, false));
-
- Group viewGroup = new Group(composite, SWT.NONE);
- viewGroup.setLayout(new GridLayout(2, false));
- viewGroup.setText(Messages.getString("CDOPreferencePage.5")); //$NON-NLS-1$
- viewGroup.setLayoutData(UIUtil.createGridData(true, false));
-
- new Label(viewGroup, SWT.NONE).setText(Messages.getString("CDOPreferencePage.6")); //$NON-NLS-1$
- preloadChunkSize = new TextAndDisable(viewGroup, SWT.BORDER,
- String.valueOf(CDOView.Options.NO_REVISION_PREFETCHING));
- preloadChunkSize.setLayoutData(UIUtil.createGridData(true, false));
-
- new Label(viewGroup, SWT.NONE).setText(Messages.getString("CDOPreferencePage.7")); //$NON-NLS-1$
- invalidationNotifications = new Button(viewGroup, SWT.CHECK);
-
- initValues();
- return composite;
- }
-
- protected void initValues()
- {
- // TODO Move all preferences from core to UI!
- repositoryName.setText(org.eclipse.emf.internal.cdo.bundle.OM.PREF_REPOSITORY_NAME.getValue());
- userName.setText(org.eclipse.emf.internal.cdo.bundle.OM.PREF_USER_NAME.getValue());
- connectorDescription.setText(org.eclipse.emf.internal.cdo.bundle.OM.PREF_CONNECTOR_DESCRIPTION.getValue());
- referenceChunkSize.setValue(String
- .valueOf(org.eclipse.emf.internal.cdo.bundle.OM.PREF_COLLECTION_LOADING_CHUNK_SIZE.getValue()));
- preloadChunkSize.setValue(String.valueOf(org.eclipse.emf.internal.cdo.bundle.OM.PREF_REVISION_LOADING_CHUNK_SIZE
- .getValue()));
- invalidationNotifications.setSelection(org.eclipse.emf.internal.cdo.bundle.OM.PREF_ENABLE_INVALIDATION_NOTIFICATION
- .getValue());
- }
-
- @Override
- public boolean performOk()
- {
- // TODO Move all preferences from core to UI!
- org.eclipse.emf.internal.cdo.bundle.OM.PREF_REPOSITORY_NAME.setValue(repositoryName.getText());
- org.eclipse.emf.internal.cdo.bundle.OM.PREF_USER_NAME.setValue(userName.getText());
- org.eclipse.emf.internal.cdo.bundle.OM.PREF_CONNECTOR_DESCRIPTION.setValue(connectorDescription.getText());
- org.eclipse.emf.internal.cdo.bundle.OM.PREF_COLLECTION_LOADING_CHUNK_SIZE.setValue(Integer
- .parseInt(referenceChunkSize.getValue()));
- org.eclipse.emf.internal.cdo.bundle.OM.PREF_REVISION_LOADING_CHUNK_SIZE.setValue(Integer.parseInt(preloadChunkSize
- .getValue()));
- org.eclipse.emf.internal.cdo.bundle.OM.PREF_ENABLE_INVALIDATION_NOTIFICATION.setValue(invalidationNotifications
- .getSelection());
- return super.performOk();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ * Victor Roldan Betancort - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui.preferences;
+
+import org.eclipse.emf.cdo.common.revision.CDORevision;
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+import org.eclipse.emf.cdo.view.CDOView;
+
+import org.eclipse.net4j.util.ui.UIUtil;
+import org.eclipse.net4j.util.ui.prefs.OMPreferencePage;
+import org.eclipse.net4j.util.ui.widgets.TextAndDisable;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDOPreferencePage extends OMPreferencePage
+{
+ private Text repositoryName;
+
+ private Text userName;
+
+ private Text connectorDescription;
+
+ private TextAndDisable referenceChunkSize;
+
+ private TextAndDisable preloadChunkSize;
+
+ private Button invalidationNotifications;
+
+ public CDOPreferencePage()
+ {
+ super(org.eclipse.emf.internal.cdo.bundle.OM.PREFS);
+ }
+
+ @Override
+ protected Control createUI(Composite parent)
+ {
+ Composite composite = UIUtil.createGridComposite(parent, 1);
+ ((GridLayout)composite.getLayout()).verticalSpacing = 5;
+ composite.setLayoutData(UIUtil.createGridData());
+
+ Group sessionGroup = new Group(composite, SWT.NONE);
+ sessionGroup.setLayout(new GridLayout(2, false));
+ sessionGroup.setText(Messages.getString("CDOPreferencePage.0")); //$NON-NLS-1$
+ sessionGroup.setLayoutData(UIUtil.createGridData(true, false));
+
+ new Label(sessionGroup, SWT.NONE).setText(Messages.getString("CDOPreferencePage.1")); //$NON-NLS-1$
+ repositoryName = new Text(sessionGroup, SWT.BORDER);
+ repositoryName.setLayoutData(UIUtil.createGridData(true, false));
+
+ new Label(sessionGroup, SWT.NONE).setText(Messages.getString("CDOPreferencePage.2")); //$NON-NLS-1$
+ userName = new Text(sessionGroup, SWT.BORDER);
+ userName.setLayoutData(UIUtil.createGridData(true, false));
+
+ new Label(sessionGroup, SWT.NONE).setText(Messages.getString("CDOPreferencePage.3")); //$NON-NLS-1$
+ connectorDescription = new Text(sessionGroup, SWT.BORDER);
+ connectorDescription.setLayoutData(UIUtil.createGridData(true, false));
+
+ new Label(sessionGroup, SWT.NONE).setText(Messages.getString("CDOPreferencePage.4")); //$NON-NLS-1$
+ referenceChunkSize = new TextAndDisable(sessionGroup, SWT.BORDER, String.valueOf(CDORevision.UNCHUNKED));
+ referenceChunkSize.setLayoutData(UIUtil.createGridData(true, false));
+
+ Group viewGroup = new Group(composite, SWT.NONE);
+ viewGroup.setLayout(new GridLayout(2, false));
+ viewGroup.setText(Messages.getString("CDOPreferencePage.5")); //$NON-NLS-1$
+ viewGroup.setLayoutData(UIUtil.createGridData(true, false));
+
+ new Label(viewGroup, SWT.NONE).setText(Messages.getString("CDOPreferencePage.6")); //$NON-NLS-1$
+ preloadChunkSize = new TextAndDisable(viewGroup, SWT.BORDER,
+ String.valueOf(CDOView.Options.NO_REVISION_PREFETCHING));
+ preloadChunkSize.setLayoutData(UIUtil.createGridData(true, false));
+
+ new Label(viewGroup, SWT.NONE).setText(Messages.getString("CDOPreferencePage.7")); //$NON-NLS-1$
+ invalidationNotifications = new Button(viewGroup, SWT.CHECK);
+
+ initValues();
+ return composite;
+ }
+
+ protected void initValues()
+ {
+ // TODO Move all preferences from core to UI!
+ repositoryName.setText(org.eclipse.emf.internal.cdo.bundle.OM.PREF_REPOSITORY_NAME.getValue());
+ userName.setText(org.eclipse.emf.internal.cdo.bundle.OM.PREF_USER_NAME.getValue());
+ connectorDescription.setText(org.eclipse.emf.internal.cdo.bundle.OM.PREF_CONNECTOR_DESCRIPTION.getValue());
+ referenceChunkSize.setValue(String
+ .valueOf(org.eclipse.emf.internal.cdo.bundle.OM.PREF_COLLECTION_LOADING_CHUNK_SIZE.getValue()));
+ preloadChunkSize.setValue(String.valueOf(org.eclipse.emf.internal.cdo.bundle.OM.PREF_REVISION_LOADING_CHUNK_SIZE
+ .getValue()));
+ invalidationNotifications.setSelection(org.eclipse.emf.internal.cdo.bundle.OM.PREF_ENABLE_INVALIDATION_NOTIFICATION
+ .getValue());
+ }
+
+ @Override
+ public boolean performOk()
+ {
+ // TODO Move all preferences from core to UI!
+ org.eclipse.emf.internal.cdo.bundle.OM.PREF_REPOSITORY_NAME.setValue(repositoryName.getText());
+ org.eclipse.emf.internal.cdo.bundle.OM.PREF_USER_NAME.setValue(userName.getText());
+ org.eclipse.emf.internal.cdo.bundle.OM.PREF_CONNECTOR_DESCRIPTION.setValue(connectorDescription.getText());
+ org.eclipse.emf.internal.cdo.bundle.OM.PREF_COLLECTION_LOADING_CHUNK_SIZE.setValue(Integer
+ .parseInt(referenceChunkSize.getValue()));
+ org.eclipse.emf.internal.cdo.bundle.OM.PREF_REVISION_LOADING_CHUNK_SIZE.setValue(Integer.parseInt(preloadChunkSize
+ .getValue()));
+ org.eclipse.emf.internal.cdo.bundle.OM.PREF_ENABLE_INVALIDATION_NOTIFICATION.setValue(invalidationNotifications
+ .getSelection());
+ return super.performOk();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/preferences/CDOUIPreferencePage.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/preferences/CDOUIPreferencePage.java
index 3b481d74db..6ff5e4a3fa 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/preferences/CDOUIPreferencePage.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/preferences/CDOUIPreferencePage.java
@@ -1,102 +1,102 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- * Victor Roldan Betancort - maintenance
- */
-package org.eclipse.emf.cdo.internal.ui.preferences;
-
-import org.eclipse.emf.cdo.internal.ui.bundle.OM;
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-import org.eclipse.emf.cdo.ui.CDOLabelDecorator;
-
-import org.eclipse.net4j.util.ui.UIUtil;
-import org.eclipse.net4j.util.ui.prefs.OMPreferencePage;
-import org.eclipse.net4j.util.ui.widgets.TextAndDisable;
-
-import org.eclipse.jface.fieldassist.IContentProposalProvider;
-import org.eclipse.jface.fieldassist.IControlContentAdapter;
-import org.eclipse.jface.fieldassist.SimpleContentProposalProvider;
-import org.eclipse.jface.fieldassist.TextContentAdapter;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.fieldassist.ContentAssistCommandAdapter;
-
-/**
- * @author Eike Stepper
- */
-public class CDOUIPreferencePage extends OMPreferencePage
-{
- private TextAndDisable decoration;
-
- private Button autoReload;
-
- public CDOUIPreferencePage()
- {
- super(OM.PREFS);
- }
-
- @Override
- protected Control createUI(Composite parent)
- {
- Composite composite = UIUtil.createGridComposite(parent, 2);
- composite.setLayoutData(UIUtil.createGridData());
-
- new Label(composite, SWT.NONE).setText(Messages.getString("CDOUIPreferencePage.0")); //$NON-NLS-1$
- decoration = new TextAndDisable(composite, SWT.BORDER, CDOLabelDecorator.NO_DECORATION)
- {
- @Override
- protected GridData createTextLayoutData()
- {
- return UIUtil.createGridData(true, false);
- }
- };
-
- decoration.setLayoutData(UIUtil.createGridData(true, false));
-
- Text text = decoration.getText();
- StringBuffer tags = new StringBuffer();
- for (String tag : CDOLabelDecorator.DECORATION_PROPOSALS)
- {
- tags.append(tag + " "); //$NON-NLS-1$
- }
-
- text.setToolTipText(Messages.getString("CDOUIPreferencePage.2") + tags.toString()); //$NON-NLS-1$
- IControlContentAdapter contentAdapter = new TextContentAdapter();
- IContentProposalProvider provider = new SimpleContentProposalProvider(CDOLabelDecorator.DECORATION_PROPOSALS);
- new ContentAssistCommandAdapter(text, contentAdapter, provider, null, new char[] { '$' }, true);
- UIUtil.addDecorationMargin(text);
-
- autoReload = new Button(composite, SWT.CHECK);
- autoReload.setText(Messages.getString("CDOUIPreferencePage.1")); //$NON-NLS-1$
- autoReload.setLayoutData(UIUtil.createGridData(false, false));
- UIUtil.setIndentation(autoReload, -1, 10);
-
- initValues();
- return composite;
- }
-
- protected void initValues()
- {
- decoration.setValue(OM.PREF_LABEL_DECORATION.getValue());
- autoReload.setSelection(OM.PREF_EDITOR_AUTO_RELOAD.getValue());
- }
-
- @Override
- public boolean performOk()
- {
- OM.PREF_LABEL_DECORATION.setValue(decoration.getValue());
- OM.PREF_EDITOR_AUTO_RELOAD.setValue(autoReload.getSelection());
- return super.performOk();
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ * Victor Roldan Betancort - maintenance
+ */
+package org.eclipse.emf.cdo.internal.ui.preferences;
+
+import org.eclipse.emf.cdo.internal.ui.bundle.OM;
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+import org.eclipse.emf.cdo.ui.CDOLabelDecorator;
+
+import org.eclipse.net4j.util.ui.UIUtil;
+import org.eclipse.net4j.util.ui.prefs.OMPreferencePage;
+import org.eclipse.net4j.util.ui.widgets.TextAndDisable;
+
+import org.eclipse.jface.fieldassist.IContentProposalProvider;
+import org.eclipse.jface.fieldassist.IControlContentAdapter;
+import org.eclipse.jface.fieldassist.SimpleContentProposalProvider;
+import org.eclipse.jface.fieldassist.TextContentAdapter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.fieldassist.ContentAssistCommandAdapter;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDOUIPreferencePage extends OMPreferencePage
+{
+ private TextAndDisable decoration;
+
+ private Button autoReload;
+
+ public CDOUIPreferencePage()
+ {
+ super(OM.PREFS);
+ }
+
+ @Override
+ protected Control createUI(Composite parent)
+ {
+ Composite composite = UIUtil.createGridComposite(parent, 2);
+ composite.setLayoutData(UIUtil.createGridData());
+
+ new Label(composite, SWT.NONE).setText(Messages.getString("CDOUIPreferencePage.0")); //$NON-NLS-1$
+ decoration = new TextAndDisable(composite, SWT.BORDER, CDOLabelDecorator.NO_DECORATION)
+ {
+ @Override
+ protected GridData createTextLayoutData()
+ {
+ return UIUtil.createGridData(true, false);
+ }
+ };
+
+ decoration.setLayoutData(UIUtil.createGridData(true, false));
+
+ Text text = decoration.getText();
+ StringBuffer tags = new StringBuffer();
+ for (String tag : CDOLabelDecorator.DECORATION_PROPOSALS)
+ {
+ tags.append(tag + " "); //$NON-NLS-1$
+ }
+
+ text.setToolTipText(Messages.getString("CDOUIPreferencePage.2") + tags.toString()); //$NON-NLS-1$
+ IControlContentAdapter contentAdapter = new TextContentAdapter();
+ IContentProposalProvider provider = new SimpleContentProposalProvider(CDOLabelDecorator.DECORATION_PROPOSALS);
+ new ContentAssistCommandAdapter(text, contentAdapter, provider, null, new char[] { '$' }, true);
+ UIUtil.addDecorationMargin(text);
+
+ autoReload = new Button(composite, SWT.CHECK);
+ autoReload.setText(Messages.getString("CDOUIPreferencePage.1")); //$NON-NLS-1$
+ autoReload.setLayoutData(UIUtil.createGridData(false, false));
+ UIUtil.setIndentation(autoReload, -1, 10);
+
+ initValues();
+ return composite;
+ }
+
+ protected void initValues()
+ {
+ decoration.setValue(OM.PREF_LABEL_DECORATION.getValue());
+ autoReload.setSelection(OM.PREF_EDITOR_AUTO_RELOAD.getValue());
+ }
+
+ @Override
+ public boolean performOk()
+ {
+ OM.PREF_LABEL_DECORATION.setValue(decoration.getValue());
+ OM.PREF_EDITOR_AUTO_RELOAD.setValue(autoReload.getSelection());
+ return super.performOk();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDORemoteSessionsView.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDORemoteSessionsView.java
index c3ec7fc27c..c08157b8a8 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDORemoteSessionsView.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDORemoteSessionsView.java
@@ -1,177 +1,177 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.emf.cdo.internal.ui.views;
-
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-import org.eclipse.emf.cdo.session.CDOSession;
-import org.eclipse.emf.cdo.session.remote.CDORemoteSession;
-import org.eclipse.emf.cdo.session.remote.CDORemoteSessionManager;
-import org.eclipse.emf.cdo.session.remote.CDORemoteSessionMessage;
-import org.eclipse.emf.cdo.util.CDOUtil;
-
-import org.eclipse.net4j.util.event.IListener;
-import org.eclipse.net4j.util.ui.UIUtil;
-import org.eclipse.net4j.util.ui.views.ContainerView;
-
-import org.eclipse.jface.dialogs.InputDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.ISelectionListener;
-import org.eclipse.ui.IWorkbenchPart;
-
-import java.text.MessageFormat;
-
-/**
- * @author Eike Stepper
- */
-public class CDORemoteSessionsView extends ContainerView.Default<CDORemoteSessionManager>
-{
- public static final String ID = "org.eclipse.emf.cdo.ui.CDORemoteSessionsView"; //$NON-NLS-1$
-
- private static final String TYPE_TEXT_MESSAGE = "org.eclipse.emf.cdo.ui.TextMessage"; //$NON-NLS-1$
-
- private ISelectionListener selectionListener = new ISelectionListener()
- {
- public void selectionChanged(IWorkbenchPart part, ISelection selection)
- {
- if (part != CDORemoteSessionsView.this)
- {
- Object object = UIUtil.getElementIfOne(selection);
- CDOSession session = CDOUtil.getSession(object);
- if (session != null)
- {
- setContainer(session.getRemoteSessionManager());
- }
- }
- }
- };
-
- private IListener containerListener = new CDORemoteSessionManager.EventAdapter()
- {
- @Override
- protected void onLocalSubscriptionChanged(boolean subscribed)
- {
- getViewer().getControl().setEnabled(subscribed);
- }
-
- @Override
- protected void onSubscribed(CDORemoteSession remoteSession)
- {
- refreshElement(remoteSession, true);
- }
-
- @Override
- protected void onUnsubscribed(CDORemoteSession remoteSession)
- {
- refreshElement(remoteSession, true);
- }
-
- @Override
- protected void onMessageReceived(final CDORemoteSession remoteSession, final CDORemoteSessionMessage message)
- {
- if (TYPE_TEXT_MESSAGE.equals(message.getType()))
- {
- try
- {
- getDisplay().asyncExec(new Runnable()
- {
- public void run()
- {
- try
- {
- MessageDialog.openInformation(getShell(),
- MessageFormat.format(Messages.getString("CDORemoteSessionsView_0"), remoteSession), //$NON-NLS-1$
- new String(message.getData()));
- }
- catch (RuntimeException ignore)
- {
- // ignore
- }
- }
- });
- }
- catch (RuntimeException ignore)
- {
- // ignore
- }
- }
- }
- };
-
- public CDORemoteSessionsView()
- {
- }
-
- @Override
- public void dispose()
- {
- getSite().getWorkbenchWindow().getSelectionService().removePostSelectionListener(selectionListener);
- super.dispose();
- }
-
- @Override
- protected Control createUI(Composite parent)
- {
- Control control = super.createUI(parent);
- getViewer().getControl().setEnabled(false);
- getSite().getWorkbenchWindow().getSelectionService().addPostSelectionListener(selectionListener);
- return control;
- }
-
- @Override
- protected IListener getContainerListener()
- {
- return containerListener;
- }
-
- @Override
- protected Color getElementForeground(Object element)
- {
- if (element instanceof CDORemoteSession)
- {
- CDORemoteSession remoteSession = (CDORemoteSession)element;
- if (!remoteSession.isSubscribed())
- {
- return getDisplay().getSystemColor(SWT.COLOR_GRAY);
- }
- }
-
- return null;
- }
-
- @Override
- protected void doubleClicked(Object element)
- {
- if (element instanceof CDORemoteSession)
- {
- CDORemoteSession remoteSession = (CDORemoteSession)element;
- if (remoteSession.isSubscribed())
- {
- InputDialog dlg = new InputDialog(getShell(), MessageFormat.format(
- Messages.getString("CDORemoteSessionsView_1"), remoteSession), //$NON-NLS-1$
- Messages.getString("CDORemoteSessionsView_2"), "", null); //$NON-NLS-1$ //$NON-NLS-2$
- if (dlg.open() == InputDialog.OK)
- {
- String message = dlg.getValue();
- remoteSession.sendMessage(new CDORemoteSessionMessage(TYPE_TEXT_MESSAGE, message.getBytes()));
- }
-
- return;
- }
- }
-
- super.doubleClicked(element);
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.internal.ui.views;
+
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.session.remote.CDORemoteSession;
+import org.eclipse.emf.cdo.session.remote.CDORemoteSessionManager;
+import org.eclipse.emf.cdo.session.remote.CDORemoteSessionMessage;
+import org.eclipse.emf.cdo.util.CDOUtil;
+
+import org.eclipse.net4j.util.event.IListener;
+import org.eclipse.net4j.util.ui.UIUtil;
+import org.eclipse.net4j.util.ui.views.ContainerView;
+
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.ISelectionListener;
+import org.eclipse.ui.IWorkbenchPart;
+
+import java.text.MessageFormat;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDORemoteSessionsView extends ContainerView.Default<CDORemoteSessionManager>
+{
+ public static final String ID = "org.eclipse.emf.cdo.ui.CDORemoteSessionsView"; //$NON-NLS-1$
+
+ private static final String TYPE_TEXT_MESSAGE = "org.eclipse.emf.cdo.ui.TextMessage"; //$NON-NLS-1$
+
+ private ISelectionListener selectionListener = new ISelectionListener()
+ {
+ public void selectionChanged(IWorkbenchPart part, ISelection selection)
+ {
+ if (part != CDORemoteSessionsView.this)
+ {
+ Object object = UIUtil.getElementIfOne(selection);
+ CDOSession session = CDOUtil.getSession(object);
+ if (session != null)
+ {
+ setContainer(session.getRemoteSessionManager());
+ }
+ }
+ }
+ };
+
+ private IListener containerListener = new CDORemoteSessionManager.EventAdapter()
+ {
+ @Override
+ protected void onLocalSubscriptionChanged(boolean subscribed)
+ {
+ getViewer().getControl().setEnabled(subscribed);
+ }
+
+ @Override
+ protected void onSubscribed(CDORemoteSession remoteSession)
+ {
+ refreshElement(remoteSession, true);
+ }
+
+ @Override
+ protected void onUnsubscribed(CDORemoteSession remoteSession)
+ {
+ refreshElement(remoteSession, true);
+ }
+
+ @Override
+ protected void onMessageReceived(final CDORemoteSession remoteSession, final CDORemoteSessionMessage message)
+ {
+ if (TYPE_TEXT_MESSAGE.equals(message.getType()))
+ {
+ try
+ {
+ getDisplay().asyncExec(new Runnable()
+ {
+ public void run()
+ {
+ try
+ {
+ MessageDialog.openInformation(getShell(),
+ MessageFormat.format(Messages.getString("CDORemoteSessionsView_0"), remoteSession), //$NON-NLS-1$
+ new String(message.getData()));
+ }
+ catch (RuntimeException ignore)
+ {
+ // ignore
+ }
+ }
+ });
+ }
+ catch (RuntimeException ignore)
+ {
+ // ignore
+ }
+ }
+ }
+ };
+
+ public CDORemoteSessionsView()
+ {
+ }
+
+ @Override
+ public void dispose()
+ {
+ getSite().getWorkbenchWindow().getSelectionService().removePostSelectionListener(selectionListener);
+ super.dispose();
+ }
+
+ @Override
+ protected Control createUI(Composite parent)
+ {
+ Control control = super.createUI(parent);
+ getViewer().getControl().setEnabled(false);
+ getSite().getWorkbenchWindow().getSelectionService().addPostSelectionListener(selectionListener);
+ return control;
+ }
+
+ @Override
+ protected IListener getContainerListener()
+ {
+ return containerListener;
+ }
+
+ @Override
+ protected Color getElementForeground(Object element)
+ {
+ if (element instanceof CDORemoteSession)
+ {
+ CDORemoteSession remoteSession = (CDORemoteSession)element;
+ if (!remoteSession.isSubscribed())
+ {
+ return getDisplay().getSystemColor(SWT.COLOR_GRAY);
+ }
+ }
+
+ return null;
+ }
+
+ @Override
+ protected void doubleClicked(Object element)
+ {
+ if (element instanceof CDORemoteSession)
+ {
+ CDORemoteSession remoteSession = (CDORemoteSession)element;
+ if (remoteSession.isSubscribed())
+ {
+ InputDialog dlg = new InputDialog(getShell(), MessageFormat.format(
+ Messages.getString("CDORemoteSessionsView_1"), remoteSession), //$NON-NLS-1$
+ Messages.getString("CDORemoteSessionsView_2"), "", null); //$NON-NLS-1$ //$NON-NLS-2$
+ if (dlg.open() == InputDialog.OK)
+ {
+ String message = dlg.getValue();
+ remoteSession.sendMessage(new CDORemoteSessionMessage(TYPE_TEXT_MESSAGE, message.getBytes()));
+ }
+
+ return;
+ }
+ }
+
+ super.doubleClicked(element);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOWatchListView.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOWatchListView.java
index bdeb4d5901..309f963722 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOWatchListView.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOWatchListView.java
@@ -1,974 +1,974 @@
-/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * 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:
- * Victor Roldan Betancort - initial API and implementation
- */
-package org.eclipse.emf.cdo.internal.ui.views;
-
-import org.eclipse.emf.cdo.CDODeltaNotification;
-import org.eclipse.emf.cdo.CDOObject;
-import org.eclipse.emf.cdo.internal.ui.actions.RemoveAllContainerItemAction;
-import org.eclipse.emf.cdo.internal.ui.actions.RemoveContainerItemAction;
-import org.eclipse.emf.cdo.internal.ui.dnd.CDOObjectDropAdapter;
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-import org.eclipse.emf.cdo.transaction.CDOCommitContext;
-import org.eclipse.emf.cdo.transaction.CDODefaultTransactionHandler2;
-import org.eclipse.emf.cdo.transaction.CDOTransaction;
-import org.eclipse.emf.cdo.util.CDOUtil;
-import org.eclipse.emf.cdo.view.CDOAdapterPolicy;
-import org.eclipse.emf.cdo.view.CDOView;
-
-import org.eclipse.net4j.util.container.Container;
-import org.eclipse.net4j.util.container.ContainerEvent;
-import org.eclipse.net4j.util.container.IContainer;
-import org.eclipse.net4j.util.container.IContainerDelta;
-import org.eclipse.net4j.util.event.IEvent;
-import org.eclipse.net4j.util.event.IListener;
-import org.eclipse.net4j.util.event.INotifier;
-import org.eclipse.net4j.util.lifecycle.ILifecycleEvent;
-import org.eclipse.net4j.util.ui.UIUtil;
-import org.eclipse.net4j.util.ui.actions.LongRunningAction;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.edit.EMFEditPlugin;
-import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
-import org.eclipse.emf.edit.provider.IItemLabelProvider;
-import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
-import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;
-import org.eclipse.emf.spi.cdo.FSMUtil;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.viewers.IColorProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.part.ViewPart;
-import org.eclipse.ui.views.properties.IPropertySheetPage;
-import org.eclipse.ui.views.properties.PropertySheetPage;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicLong;
-
-/**
- * @author Victor Roldan Betancort
- */
-public class CDOWatchListView extends ViewPart implements ISelectionProvider
-{
- private static final String[] columnNames = {
- Messages.getString("CDOWatchListView.0"), Messages.getString("CDOWatchListView.1"), Messages.getString("CDOWatchListView.2"), Messages.getString("CDOWatchListView.3") }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-
- private static final int[] columnWidths = { 110, 280, 170, 230 };
-
- public static final String ID = "org.eclipse.emf.cdo.ui.CDOWatchListView"; //$NON-NLS-1$
-
- private WatchedObjectsDataRegistry dataRegistry = new WatchedObjectsDataRegistry();
-
- private TableViewer viewer;
-
- private CDOObjectContainer container = new CDOObjectContainer();
-
- private ComposedAdapterFactory adapterFactory;
-
- private IPropertySheetPage propertySheetPage;
-
- private IAction removeAction;
-
- private IAction removeAllAction;
-
- private IAction resetNotificationAction;
-
- private IAction resetAllNotificationAction;
-
- public CDOWatchListView()
- {
- adapterFactory = new ComposedAdapterFactory(EMFEditPlugin.getComposedAdapterFactoryDescriptorRegistry());
- container.addListener(getDataRegistry());
- }
-
- public WatchedObjectsDataRegistry getDataRegistry()
- {
- return dataRegistry;
- }
-
- @Override
- public void createPartControl(Composite parent)
- {
- // Create Viewer
- viewer = createViewer(parent);
-
- // This listener always refreshes viewer upon notification
- IListener refreshListener = new IListener()
- {
- public void notifyEvent(IEvent event)
- {
- UIUtil.refreshViewer(viewer);
- }
- };
-
- container.addListener(refreshListener);
- getDataRegistry().addListener(refreshListener);
-
- // Configure ViewPart
- createActions();
- createToolbarButtons();
- createContextMenu();
- hookKeyboardActions();
- createViewPulldownMenu();
- getSite().setSelectionProvider(this);
- }
-
- private void createActions()
- {
- ISharedImages platformImages = PlatformUI.getWorkbench().getSharedImages();
- removeAction = new RemoveContainerItemAction<CDOObject>(container, viewer);
- removeAction.setText(Messages.getString("CDOWatchListView.4")); //$NON-NLS-1$
- removeAction.setImageDescriptor(platformImages.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
- removeAction.setDisabledImageDescriptor(platformImages.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_DISABLED));
- removeAction.setToolTipText(Messages.getString("CDOWatchListView.5")); //$NON-NLS-1$
-
- removeAllAction = new RemoveAllContainerItemAction<CDOObject>(container);
- removeAllAction.setText(Messages.getString("CDOWatchListView.6")); //$NON-NLS-1$
- removeAllAction.setImageDescriptor(platformImages.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
- removeAllAction.setToolTipText(Messages.getString("CDOWatchListView.7")); //$NON-NLS-1$
-
- resetNotificationAction = new ResetNotificationAction();
- resetNotificationAction.setText(Messages.getString("CDOWatchListView.8")); //$NON-NLS-1$
- resetNotificationAction.setImageDescriptor(platformImages.getImageDescriptor(ISharedImages.IMG_TOOL_UNDO));
- resetNotificationAction.setDisabledImageDescriptor(platformImages
- .getImageDescriptor(ISharedImages.IMG_TOOL_UNDO_DISABLED));
- resetNotificationAction.setToolTipText(Messages.getString("CDOWatchListView.9")); //$NON-NLS-1$
-
- resetAllNotificationAction = new ResetAllNotificationAction();
- resetAllNotificationAction.setText(Messages.getString("CDOWatchListView.10")); //$NON-NLS-1$
- resetAllNotificationAction.setImageDescriptor(platformImages.getImageDescriptor(ISharedImages.IMG_TOOL_UNDO));
- resetAllNotificationAction.setDisabledImageDescriptor(platformImages
- .getImageDescriptor(ISharedImages.IMG_TOOL_UNDO_DISABLED));
- resetAllNotificationAction.setToolTipText(Messages.getString("CDOWatchListView.11")); //$NON-NLS-1$
- }
-
- private void createToolbarButtons()
- {
- getViewSite().getActionBars().getToolBarManager().add(resetAllNotificationAction);
- }
-
- private void createViewPulldownMenu()
- {
- IMenuManager menu = getViewSite().getActionBars().getMenuManager();
- menu.add(removeAllAction);
- }
-
- private void createContextMenu()
- {
- MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
- menuMgr.setRemoveAllWhenShown(true);
- menuMgr.addMenuListener(new IMenuListener()
- {
- public void menuAboutToShow(IMenuManager m)
- {
- CDOWatchListView.this.fillContextMenu(m);
- }
- });
-
- Menu menu = menuMgr.createContextMenu(viewer.getControl());
- viewer.getControl().setMenu(menu);
- getSite().registerContextMenu(menuMgr, viewer);
- }
-
- private void fillContextMenu(IMenuManager menuMgr)
- {
- boolean isEmpty = viewer.getSelection().isEmpty();
- removeAction.setEnabled(!isEmpty);
- menuMgr.add(removeAction);
- resetNotificationAction.setEnabled(!isEmpty);
- menuMgr.add(resetNotificationAction);
- menuMgr.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- }
-
- private void hookKeyboardActions()
- {
- viewer.getControl().addKeyListener(new KeyAdapter()
- {
- @Override
- public void keyReleased(KeyEvent event)
- {
- handleKeyReleased(event);
- }
- });
- }
-
- protected void handleKeyReleased(KeyEvent event)
- {
- if (event.character == SWT.DEL && event.stateMask == 0)
- {
- removeAction.run();
- }
- }
-
- @Override
- public void setFocus()
- {
- viewer.getControl().setFocus();
- }
-
- public ISelection getSelection()
- {
- if (viewer != null)
- {
- return viewer.getSelection();
- }
-
- return StructuredSelection.EMPTY;
- }
-
- public void setSelection(ISelection selection)
- {
- // Doesn't need to set viewer.setSelection(). Already done with user event.
- }
-
- public void addSelectionChangedListener(ISelectionChangedListener listener)
- {
- if (viewer != null)
- {
- viewer.addSelectionChangedListener(listener);
- }
- }
-
- public void removeSelectionChangedListener(ISelectionChangedListener listener)
- {
- if (viewer != null)
- {
- viewer.removeSelectionChangedListener(listener);
- }
- }
-
- @SuppressWarnings("rawtypes")
- @Override
- public Object getAdapter(Class adapter)
- {
- if (adapter.equals(IPropertySheetPage.class))
- {
- return getPropertySheetPage();
- }
-
- return super.getAdapter(adapter);
- }
-
- public IPropertySheetPage getPropertySheetPage()
- {
- if (propertySheetPage == null)
- {
- PropertySheetPage page = new PropertySheetPage();
- page.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory));
- propertySheetPage = page;
- }
-
- return propertySheetPage;
- }
-
- private TableViewer createViewer(Composite parent)
- {
- TableViewer viewer = new TableViewer(parent, SWT.FULL_SELECTION | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
- viewer.getTable().setLayoutData(UIUtil.createGridData());
- viewer.getTable().setHeaderVisible(true);
- viewer.getTable().setLinesVisible(true);
- createColumns(viewer.getTable());
-
- viewer.setContentProvider(new CDOObjectContainerContentProvider());
- viewer.setLabelProvider(new CDOSubscriptionViewLabelProvider(adapterFactory));
- viewer.setInput(container);
-
- CDOObjectDropAdapter.support(viewer);
- return viewer;
- }
-
- private void createColumns(Table table)
- {
- TableColumn[] columns = new TableColumn[columnNames.length];
- for (int i = 0; i < columns.length; i++)
- {
- TableColumn column = new TableColumn(table, SWT.LEFT, i);
- column.setText(columnNames[i]);
- column.setWidth(columnWidths[i]);
- column.setMoveable(true);
- column.setResizable(true);
- }
- }
-
- /**
- * @author Victor Roldan Betancort
- */
- private final class TransactionHandler extends CDODefaultTransactionHandler2
- {
- public TransactionHandler()
- {
- }
-
- @Override
- public void committedTransaction(CDOTransaction transaction, CDOCommitContext commitContext)
- {
- container.removeAllElements(commitContext.getDetachedObjects().values());
- UIUtil.refreshViewer(viewer);
- }
- }
-
- /**
- * @author Victor Roldan Betancort
- */
- private final class CDOSubscriptionAdapter extends AdapterImpl implements CDOAdapterPolicy
- {
- public CDOSubscriptionAdapter()
- {
- }
-
- @Override
- public void notifyChanged(Notification msg)
- {
- if (msg instanceof CDODeltaNotification)
- {
- checkDetached(msg);
- // TODO how to retrieve remote commit timestamp?
- getDataRegistry().addNotification(msg);
- }
- }
-
- private void checkDetached(Notification msg)
- {
- // TODO Remote detach won't be shown in the UI, the object will be just removed from the viewer
- if (((CDODeltaNotification)msg).getEventType() == CDODeltaNotification.DETACH_OBJECT)
- {
- Object obj = msg.getNotifier();
- container.removeElement(CDOUtil.getCDOObject((EObject)obj));
- getDataRegistry().removeData(obj);
- }
- }
-
- public boolean isValid(EObject object, Adapter adapter)
- {
- return adapter instanceof CDOSubscriptionAdapter;
- }
- }
-
- /**
- * @author Victor Roldan Betancort
- */
- private final class CDOObjectContainer extends Container<CDOObject> implements IContainer.Modifiable<CDOObject>
- {
- private Set<CDOObject> watchedObjects = new HashSet<CDOObject>();
-
- private CDOSubscriptionAdapter subscriptionAdapter = new CDOSubscriptionAdapter();
-
- private ViewDeactivationListener viewDeactivationListener = new ViewDeactivationListener();
-
- private TransactionHandler transactionHandler = new TransactionHandler();
-
- private CDOViewReferenceCounterManager counterManager = new CDOViewReferenceCounterManager();
-
- public CDOObjectContainer()
- {
- }
-
- public CDOObject[] getElements()
- {
- return watchedObjects.toArray(new CDOObject[watchedObjects.size()]);
- }
-
- @Override
- public boolean isEmpty()
- {
- return watchedObjects.isEmpty();
- }
-
- /**
- * @returns true if the element was added successfully to the container
- */
- public boolean addElement(CDOObject element)
- {
- if (watchedObjects.add(element))
- {
- postAdd(element);
- fireElementAddedEvent(element);
- return true;
- }
-
- return false;
- }
-
- /**
- * @returns true if the element was removed successfully from the container
- */
- public boolean removeElement(CDOObject element)
- {
- if (watchedObjects.remove(element))
- {
- postRemove(element);
- fireElementRemovedEvent(element);
- return true;
- }
-
- return false;
- }
-
- /**
- * @returns true if at least one element was added. False otherwise.
- */
- public boolean addAllElements(Collection<CDOObject> elements)
- {
- ArrayList<CDOObject> addedElements = new ArrayList<CDOObject>();
- for (CDOObject cdoObject : elements)
- {
- if (watchedObjects.add(cdoObject))
- {
- postAdd(cdoObject);
- addedElements.add(cdoObject);
- }
- }
-
- if (!addedElements.isEmpty())
- {
- fireElementsAddedEvent(addedElements.toArray(new CDOObject[addedElements.size()]));
- return true;
- }
-
- return false;
- }
-
- /**
- * @returns true if at least one element was removed. False otherwise.
- */
- public boolean removeAllElements(Collection<CDOObject> elements)
- {
- ArrayList<CDOObject> removedElements = new ArrayList<CDOObject>();
- for (CDOObject cdoObject : elements)
- {
- if (watchedObjects.remove(cdoObject))
- {
- postRemove(cdoObject);
- removedElements.add(cdoObject);
- }
- }
-
- if (!removedElements.isEmpty())
- {
- fireElementsRemovedEvent(removedElements.toArray(new CDOObject[removedElements.size()]));
- return true;
- }
-
- return false;
- }
-
- private void postAdd(CDOObject element)
- {
- element.cdoView().options().addChangeSubscriptionPolicy(subscriptionAdapter);
- element.eAdapters().add(subscriptionAdapter);
- increaseViewReference(element);
- }
-
- private void postRemove(CDOObject element)
- {
- decreaseViewReference(element);
- CDOView view = element.cdoView();
- if (view != null && !view.isClosed())
- {
- element.eAdapters().remove(subscriptionAdapter);
- }
- }
-
- private void increaseViewReference(CDOObject referrer)
- {
- CDOViewReferenceCounterManager.CDOViewReferenceCounter counter = counterManager.getCounter(referrer);
- if (counter.increase() == 1)
- {
- CDOView view = referrer.cdoView();
- view.addListener(viewDeactivationListener);
- if (view instanceof CDOTransaction)
- {
- ((CDOTransaction)view).addTransactionHandler(transactionHandler);
- }
- }
- }
-
- private void decreaseViewReference(CDOObject referrer)
- {
- CDOViewReferenceCounterManager.CDOViewReferenceCounter counter = counterManager.getCounter(referrer);
-
- // CDOObject might be detached, and so CDOView will be null
- if (counter.decrease() == 0 && referrer.cdoView() != null)
- {
- CDOView view = referrer.cdoView();
- view.removeListener(viewDeactivationListener);
- if (view instanceof CDOTransaction)
- {
- ((CDOTransaction)view).removeTransactionHandler(transactionHandler);
- }
- }
- }
-
- /**
- * @author Victor Roldan Betancort
- */
- private final class ViewDeactivationListener implements IListener
- {
- public void notifyEvent(IEvent event)
- {
- if (event instanceof ILifecycleEvent)
- {
- if (((ILifecycleEvent)event).getKind() == ILifecycleEvent.Kind.ABOUT_TO_DEACTIVATE)
- {
- List<CDOObject> aboutToRemove = new ArrayList<CDOObject>();
- for (CDOObject object : getElements())
- {
- if (object.cdoView().equals(event.getSource()))
- {
- aboutToRemove.add(object);
- }
- }
-
- removeAllElements(aboutToRemove);
- }
- }
- }
- }
- }
-
- /**
- * @author Victor Roldan Betancort
- */
- private final class CDOViewReferenceCounterManager
- {
- private List<CDOViewReferenceCounter> viewReferences = new ArrayList<CDOViewReferenceCounter>();
-
- public CDOViewReferenceCounterManager()
- {
- }
-
- private class CDOViewReferenceCounter
- {
- private final CDOView view;
-
- private AtomicLong referenceCount = new AtomicLong();
-
- public CDOViewReferenceCounter(CDOObject cdoObject)
- {
- view = cdoObject.cdoView();
- referenceCount.set(0);
- }
-
- public long increase()
- {
- return referenceCount.incrementAndGet();
- }
-
- public synchronized long decrease()
- {
- Long value = referenceCount.decrementAndGet();
- if (value == 0)
- {
- viewReferences.remove(this);
- }
-
- return value;
- }
-
- public CDOView getReferencedView()
- {
- return view;
- }
- }
-
- public CDOViewReferenceCounter getCounter(CDOObject cdoObject)
- {
- synchronized (viewReferences)
- {
- for (CDOViewReferenceCounter counter : viewReferences)
- {
- if (counter.getReferencedView().equals(cdoObject.cdoView()))
- {
- return counter;
- }
- }
- }
-
- CDOViewReferenceCounter counter = new CDOViewReferenceCounter(cdoObject);
- viewReferences.add(counter);
- return counter;
- }
- }
-
- /**
- * @author Victor Roldan Betancort
- */
- private final class WatchedObjectsDataRegistry extends org.eclipse.net4j.util.event.Notifier implements IListener
- {
- private Map<Object, WatchedObjectData> registry = new HashMap<Object, WatchedObjectData>();
-
- private final IEvent dataRegistryEvent = new IEvent()
- {
- public INotifier getSource()
- {
- return WatchedObjectsDataRegistry.this;
- }
- };
-
- public WatchedObjectsDataRegistry()
- {
- }
-
- public WatchedObjectData getData(Object object)
- {
- WatchedObjectData data = registry.get(object);
- if (data == null)
- {
- data = new WatchedObjectData();
- registry.put(object, data);
- }
-
- return data;
- }
-
- public void addNotification(Notification msg)
- {
- getData(msg.getNotifier()).setNotification(msg);
- IListener[] listeners = getListeners();
- if (listeners != null)
- {
- fireEvent(dataRegistryEvent, listeners);
- }
- }
-
- public void removeNotification(Object object)
- {
- getData(object).deleteNotification();
- IListener[] listeners = getListeners();
- if (listeners != null)
- {
- fireEvent(dataRegistryEvent, listeners);
- }
- }
-
- public void removeData(Object object)
- {
- registry.remove(object);
- }
-
- public void removeAllNotification(Collection<Object> objects)
- {
- for (WatchedObjectData data : registry.values())
- {
- data.deleteNotification();
- }
-
- IListener[] listeners = getListeners();
- if (listeners != null)
- {
- fireEvent(dataRegistryEvent, listeners);
- }
- }
-
- public Notification getNotification(Object object)
- {
- return getData(object).getNotification();
- }
-
- public void notifyEvent(IEvent event)
- {
- if (event instanceof ContainerEvent<?>)
- {
- ContainerEvent<?> containerEvent = (ContainerEvent<?>)event;
- for (IContainerDelta<?> delta : containerEvent.getDeltas())
- {
- if (delta.getKind().equals(IContainerDelta.Kind.REMOVED))
- {
- removeData(delta.getElement());
- }
- }
- }
- }
-
- /**
- * @author Victor Roldan Betancort
- */
- private final class WatchedObjectData
- {
- private Notification notification;
-
- public WatchedObjectData()
- {
- }
-
- public void setNotification(Notification notification)
- {
- this.notification = notification;
- }
-
- public void deleteNotification()
- {
- notification = null;
- }
-
- public Notification getNotification()
- {
- return notification;
- }
- }
- }
-
- /**
- * @author Victor Roldan Betancort
- */
- private final class CDOSubscriptionViewLabelProvider extends LabelProvider implements ITableLabelProvider,
- IColorProvider
- {
- private final Color YELLOW = UIUtil.getDisplay().getSystemColor(SWT.COLOR_YELLOW);
-
- private final String[] eventTypes = {
- Messages.getString("CDOWatchListView.12"), Messages.getString("CDOWatchListView.25"), Messages.getString("CDOWatchListView.26"), Messages.getString("CDOWatchListView.27"), Messages.getString("CDOWatchListView.28"), Messages.getString("CDOWatchListView.29"), Messages.getString("CDOWatchListView.30"), Messages.getString("CDOWatchListView.31"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
- Messages.getString("CDOWatchListView.32"), Messages.getString("CDOWatchListView.33") }; //$NON-NLS-1$ //$NON-NLS-2$
-
- private AdapterFactory adapterFactory;
-
- public CDOSubscriptionViewLabelProvider(AdapterFactory adapterFactory)
- {
- this.adapterFactory = adapterFactory;
- }
-
- public Image getColumnImage(Object object, int columnIndex)
- {
- // In case an invalid object arrives (i.e., detached), return CDOState
- if (FSMUtil.isInvalid(CDOUtil.getCDOObject((EObject)object)))
- {
- return null;
- }
-
- switch (columnIndex)
- {
- case 0:
- IItemLabelProvider labelProvider = (IItemLabelProvider)adapterFactory.adapt(object, IItemLabelProvider.class);
- if (labelProvider != null)
- {
- return ExtendedImageRegistry.getInstance().getImage(labelProvider.getImage(object));
- }
- }
-
- return null;
- }
-
- public String getColumnText(Object element, int columnIndex)
- {
- CDOObject object = CDOUtil.getCDOObject((EObject)element);
-
- // In case an invalid object arrives (i.e., detached), return CDOState
- if (FSMUtil.isInvalid(object))
- {
- return object.cdoState().toString();
- }
-
- switch (columnIndex)
- {
- case 0:
- IItemLabelProvider labelProvider = (IItemLabelProvider)adapterFactory.adapt(object, IItemLabelProvider.class);
- if (labelProvider != null)
- {
- return labelProvider.getText(object);
- }
-
- return null;
-
- case 1:
- return object.cdoResource().getURI().toString();
-
- case 2:
- // XXX CDOView view = object.cdoView();
- // if (view instanceof CDOTransaction)
- // {
- // long time = ((CDOTransaction)view).getLastCommitTime();
- // if (time != CDORevision.UNSPECIFIED_DATE)
- // {
- // return new Date(time).toString();
- // }
- // }
-
- return "?"; //$NON-NLS-1$
-
- case 3:
- Notification notification = getDataRegistry().getNotification(element);
- return createEventLabel(notification);
- }
-
- return element.toString();
- }
-
- public Color getBackground(Object element)
- {
- if (element instanceof CDOObject)
- {
- if (getDataRegistry().getNotification(element) != null)
- {
- return YELLOW;
- }
- }
-
- return null;
- }
-
- public Color getForeground(Object element)
- {
- return null;
- }
-
- private String createEventLabel(Notification notification)
- {
- if (notification == null)
- {
- return null;
- }
-
- StringBuilder builder = new StringBuilder();
- int event = notification.getEventType();
- if (event < Notification.EVENT_TYPE_COUNT)
- {
- builder.append(eventTypes[event]);
- }
-
- builder.append(": "); //$NON-NLS-1$
- builder.append(((EStructuralFeature)notification.getFeature()).getName());
- builder.append(" = "); //$NON-NLS-1$
- builder.append(notification.getNewValue().toString());
- return builder.toString();
- }
- }
-
- /**
- * @author Victor Roldan Betancort
- */
- private final class CDOObjectContainerContentProvider implements IStructuredContentProvider
- {
- public CDOObjectContainerContentProvider()
- {
- }
-
- @SuppressWarnings("unchecked")
- public Object[] getElements(Object object)
- {
- return ((IContainer<Object>)object).getElements();
- }
-
- public void dispose()
- {
- // do nothing
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
- {
- // do nothing
- }
- }
-
- /**
- * @author Victor Roldan Betancort
- */
- private final class ResetNotificationAction extends LongRunningAction
- {
- private transient List<?> targets;
-
- public ResetNotificationAction()
- {
- }
-
- @Override
- protected void preRun() throws Exception
- {
- ISelection selection = getSelection();
- if (selection instanceof IStructuredSelection)
- {
- IStructuredSelection ssel = (IStructuredSelection)selection;
- if (!ssel.isEmpty())
- {
- targets = ssel.toList();
- return;
- }
- }
-
- cancel();
- }
-
- @Override
- protected void doRun(IProgressMonitor progressMonitor) throws Exception
- {
- if (targets != null)
- {
- List<?> useTargets = targets;
- targets = null;
-
- for (Object object : useTargets)
- {
- if (object instanceof CDOObject)
- {
- getDataRegistry().removeNotification(object);
- }
- }
- }
- }
- }
-
- /**
- * @author Victor Roldan Betancort
- */
- private final class ResetAllNotificationAction extends LongRunningAction
- {
- public ResetAllNotificationAction()
- {
- }
-
- @Override
- protected void doRun(IProgressMonitor progressMonitor) throws Exception
- {
- ArrayList<Object> aboutToReset = new ArrayList<Object>();
- for (CDOObject cdoObject : container.getElements())
- {
- aboutToReset.add(cdoObject);
- }
-
- getDataRegistry().removeAllNotification(aboutToReset);
- }
- }
-}
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Victor Roldan Betancort - initial API and implementation
+ */
+package org.eclipse.emf.cdo.internal.ui.views;
+
+import org.eclipse.emf.cdo.CDODeltaNotification;
+import org.eclipse.emf.cdo.CDOObject;
+import org.eclipse.emf.cdo.internal.ui.actions.RemoveAllContainerItemAction;
+import org.eclipse.emf.cdo.internal.ui.actions.RemoveContainerItemAction;
+import org.eclipse.emf.cdo.internal.ui.dnd.CDOObjectDropAdapter;
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+import org.eclipse.emf.cdo.transaction.CDOCommitContext;
+import org.eclipse.emf.cdo.transaction.CDODefaultTransactionHandler2;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.util.CDOUtil;
+import org.eclipse.emf.cdo.view.CDOAdapterPolicy;
+import org.eclipse.emf.cdo.view.CDOView;
+
+import org.eclipse.net4j.util.container.Container;
+import org.eclipse.net4j.util.container.ContainerEvent;
+import org.eclipse.net4j.util.container.IContainer;
+import org.eclipse.net4j.util.container.IContainerDelta;
+import org.eclipse.net4j.util.event.IEvent;
+import org.eclipse.net4j.util.event.IListener;
+import org.eclipse.net4j.util.event.INotifier;
+import org.eclipse.net4j.util.lifecycle.ILifecycleEvent;
+import org.eclipse.net4j.util.ui.UIUtil;
+import org.eclipse.net4j.util.ui.actions.LongRunningAction;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.EMFEditPlugin;
+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
+import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;
+import org.eclipse.emf.spi.cdo.FSMUtil;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.viewers.IColorProvider;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.ViewPart;
+import org.eclipse.ui.views.properties.IPropertySheetPage;
+import org.eclipse.ui.views.properties.PropertySheetPage;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicLong;
+
+/**
+ * @author Victor Roldan Betancort
+ */
+public class CDOWatchListView extends ViewPart implements ISelectionProvider
+{
+ private static final String[] columnNames = {
+ Messages.getString("CDOWatchListView.0"), Messages.getString("CDOWatchListView.1"), Messages.getString("CDOWatchListView.2"), Messages.getString("CDOWatchListView.3") }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+
+ private static final int[] columnWidths = { 110, 280, 170, 230 };
+
+ public static final String ID = "org.eclipse.emf.cdo.ui.CDOWatchListView"; //$NON-NLS-1$
+
+ private WatchedObjectsDataRegistry dataRegistry = new WatchedObjectsDataRegistry();
+
+ private TableViewer viewer;
+
+ private CDOObjectContainer container = new CDOObjectContainer();
+
+ private ComposedAdapterFactory adapterFactory;
+
+ private IPropertySheetPage propertySheetPage;
+
+ private IAction removeAction;
+
+ private IAction removeAllAction;
+
+ private IAction resetNotificationAction;
+
+ private IAction resetAllNotificationAction;
+
+ public CDOWatchListView()
+ {
+ adapterFactory = new ComposedAdapterFactory(EMFEditPlugin.getComposedAdapterFactoryDescriptorRegistry());
+ container.addListener(getDataRegistry());
+ }
+
+ public WatchedObjectsDataRegistry getDataRegistry()
+ {
+ return dataRegistry;
+ }
+
+ @Override
+ public void createPartControl(Composite parent)
+ {
+ // Create Viewer
+ viewer = createViewer(parent);
+
+ // This listener always refreshes viewer upon notification
+ IListener refreshListener = new IListener()
+ {
+ public void notifyEvent(IEvent event)
+ {
+ UIUtil.refreshViewer(viewer);
+ }
+ };
+
+ container.addListener(refreshListener);
+ getDataRegistry().addListener(refreshListener);
+
+ // Configure ViewPart
+ createActions();
+ createToolbarButtons();
+ createContextMenu();
+ hookKeyboardActions();
+ createViewPulldownMenu();
+ getSite().setSelectionProvider(this);
+ }
+
+ private void createActions()
+ {
+ ISharedImages platformImages = PlatformUI.getWorkbench().getSharedImages();
+ removeAction = new RemoveContainerItemAction<CDOObject>(container, viewer);
+ removeAction.setText(Messages.getString("CDOWatchListView.4")); //$NON-NLS-1$
+ removeAction.setImageDescriptor(platformImages.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
+ removeAction.setDisabledImageDescriptor(platformImages.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_DISABLED));
+ removeAction.setToolTipText(Messages.getString("CDOWatchListView.5")); //$NON-NLS-1$
+
+ removeAllAction = new RemoveAllContainerItemAction<CDOObject>(container);
+ removeAllAction.setText(Messages.getString("CDOWatchListView.6")); //$NON-NLS-1$
+ removeAllAction.setImageDescriptor(platformImages.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
+ removeAllAction.setToolTipText(Messages.getString("CDOWatchListView.7")); //$NON-NLS-1$
+
+ resetNotificationAction = new ResetNotificationAction();
+ resetNotificationAction.setText(Messages.getString("CDOWatchListView.8")); //$NON-NLS-1$
+ resetNotificationAction.setImageDescriptor(platformImages.getImageDescriptor(ISharedImages.IMG_TOOL_UNDO));
+ resetNotificationAction.setDisabledImageDescriptor(platformImages
+ .getImageDescriptor(ISharedImages.IMG_TOOL_UNDO_DISABLED));
+ resetNotificationAction.setToolTipText(Messages.getString("CDOWatchListView.9")); //$NON-NLS-1$
+
+ resetAllNotificationAction = new ResetAllNotificationAction();
+ resetAllNotificationAction.setText(Messages.getString("CDOWatchListView.10")); //$NON-NLS-1$
+ resetAllNotificationAction.setImageDescriptor(platformImages.getImageDescriptor(ISharedImages.IMG_TOOL_UNDO));
+ resetAllNotificationAction.setDisabledImageDescriptor(platformImages
+ .getImageDescriptor(ISharedImages.IMG_TOOL_UNDO_DISABLED));
+ resetAllNotificationAction.setToolTipText(Messages.getString("CDOWatchListView.11")); //$NON-NLS-1$
+ }
+
+ private void createToolbarButtons()
+ {
+ getViewSite().getActionBars().getToolBarManager().add(resetAllNotificationAction);
+ }
+
+ private void createViewPulldownMenu()
+ {
+ IMenuManager menu = getViewSite().getActionBars().getMenuManager();
+ menu.add(removeAllAction);
+ }
+
+ private void createContextMenu()
+ {
+ MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
+ menuMgr.setRemoveAllWhenShown(true);
+ menuMgr.addMenuListener(new IMenuListener()
+ {
+ public void menuAboutToShow(IMenuManager m)
+ {
+ CDOWatchListView.this.fillContextMenu(m);
+ }
+ });
+
+ Menu menu = menuMgr.createContextMenu(viewer.getControl());
+ viewer.getControl().setMenu(menu);
+ getSite().registerContextMenu(menuMgr, viewer);
+ }
+
+ private void fillContextMenu(IMenuManager menuMgr)
+ {
+ boolean isEmpty = viewer.getSelection().isEmpty();
+ removeAction.setEnabled(!isEmpty);
+ menuMgr.add(removeAction);
+ resetNotificationAction.setEnabled(!isEmpty);
+ menuMgr.add(resetNotificationAction);
+ menuMgr.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+ }
+
+ private void hookKeyboardActions()
+ {
+ viewer.getControl().addKeyListener(new KeyAdapter()
+ {
+ @Override
+ public void keyReleased(KeyEvent event)
+ {
+ handleKeyReleased(event);
+ }
+ });
+ }
+
+ protected void handleKeyReleased(KeyEvent event)
+ {
+ if (event.character == SWT.DEL && event.stateMask == 0)
+ {
+ removeAction.run();
+ }
+ }
+
+ @Override
+ public void setFocus()
+ {
+ viewer.getControl().setFocus();
+ }
+
+ public ISelection getSelection()
+ {
+ if (viewer != null)
+ {
+ return viewer.getSelection();
+ }
+
+ return StructuredSelection.EMPTY;
+ }
+
+ public void setSelection(ISelection selection)
+ {
+ // Doesn't need to set viewer.setSelection(). Already done with user event.
+ }
+
+ public void addSelectionChangedListener(ISelectionChangedListener listener)
+ {
+ if (viewer != null)
+ {
+ viewer.addSelectionChangedListener(listener);
+ }
+ }
+
+ public void removeSelectionChangedListener(ISelectionChangedListener listener)
+ {
+ if (viewer != null)
+ {
+ viewer.removeSelectionChangedListener(listener);
+ }
+ }
+
+ @SuppressWarnings("rawtypes")
+ @Override
+ public Object getAdapter(Class adapter)
+ {
+ if (adapter.equals(IPropertySheetPage.class))
+ {
+ return getPropertySheetPage();
+ }
+
+ return super.getAdapter(adapter);
+ }
+
+ public IPropertySheetPage getPropertySheetPage()
+ {
+ if (propertySheetPage == null)
+ {
+ PropertySheetPage page = new PropertySheetPage();
+ page.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory));
+ propertySheetPage = page;
+ }
+
+ return propertySheetPage;
+ }
+
+ private TableViewer createViewer(Composite parent)
+ {
+ TableViewer viewer = new TableViewer(parent, SWT.FULL_SELECTION | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
+ viewer.getTable().setLayoutData(UIUtil.createGridData());
+ viewer.getTable().setHeaderVisible(true);
+ viewer.getTable().setLinesVisible(true);
+ createColumns(viewer.getTable());
+
+ viewer.setContentProvider(new CDOObjectContainerContentProvider());
+ viewer.setLabelProvider(new CDOSubscriptionViewLabelProvider(adapterFactory));
+ viewer.setInput(container);
+
+ CDOObjectDropAdapter.support(viewer);
+ return viewer;
+ }
+
+ private void createColumns(Table table)
+ {
+ TableColumn[] columns = new TableColumn[columnNames.length];
+ for (int i = 0; i < columns.length; i++)
+ {
+ TableColumn column = new TableColumn(table, SWT.LEFT, i);
+ column.setText(columnNames[i]);
+ column.setWidth(columnWidths[i]);
+ column.setMoveable(true);
+ column.setResizable(true);
+ }
+ }
+
+ /**
+ * @author Victor Roldan Betancort
+ */
+ private final class TransactionHandler extends CDODefaultTransactionHandler2
+ {
+ public TransactionHandler()
+ {
+ }
+
+ @Override
+ public void committedTransaction(CDOTransaction transaction, CDOCommitContext commitContext)
+ {
+ container.removeAllElements(commitContext.getDetachedObjects().values());
+ UIUtil.refreshViewer(viewer);
+ }
+ }
+
+ /**
+ * @author Victor Roldan Betancort
+ */
+ private final class CDOSubscriptionAdapter extends AdapterImpl implements CDOAdapterPolicy
+ {
+ public CDOSubscriptionAdapter()
+ {
+ }
+
+ @Override
+ public void notifyChanged(Notification msg)
+ {
+ if (msg instanceof CDODeltaNotification)
+ {
+ checkDetached(msg);
+ // TODO how to retrieve remote commit timestamp?
+ getDataRegistry().addNotification(msg);
+ }
+ }
+
+ private void checkDetached(Notification msg)
+ {
+ // TODO Remote detach won't be shown in the UI, the object will be just removed from the viewer
+ if (((CDODeltaNotification)msg).getEventType() == CDODeltaNotification.DETACH_OBJECT)
+ {
+ Object obj = msg.getNotifier();
+ container.removeElement(CDOUtil.getCDOObject((EObject)obj));
+ getDataRegistry().removeData(obj);
+ }
+ }
+
+ public boolean isValid(EObject object, Adapter adapter)
+ {
+ return adapter instanceof CDOSubscriptionAdapter;
+ }
+ }
+
+ /**
+ * @author Victor Roldan Betancort
+ */
+ private final class CDOObjectContainer extends Container<CDOObject> implements IContainer.Modifiable<CDOObject>
+ {
+ private Set<CDOObject> watchedObjects = new HashSet<CDOObject>();
+
+ private CDOSubscriptionAdapter subscriptionAdapter = new CDOSubscriptionAdapter();
+
+ private ViewDeactivationListener viewDeactivationListener = new ViewDeactivationListener();
+
+ private TransactionHandler transactionHandler = new TransactionHandler();
+
+ private CDOViewReferenceCounterManager counterManager = new CDOViewReferenceCounterManager();
+
+ public CDOObjectContainer()
+ {
+ }
+
+ public CDOObject[] getElements()
+ {
+ return watchedObjects.toArray(new CDOObject[watchedObjects.size()]);
+ }
+
+ @Override
+ public boolean isEmpty()
+ {
+ return watchedObjects.isEmpty();
+ }
+
+ /**
+ * @returns true if the element was added successfully to the container
+ */
+ public boolean addElement(CDOObject element)
+ {
+ if (watchedObjects.add(element))
+ {
+ postAdd(element);
+ fireElementAddedEvent(element);
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * @returns true if the element was removed successfully from the container
+ */
+ public boolean removeElement(CDOObject element)
+ {
+ if (watchedObjects.remove(element))
+ {
+ postRemove(element);
+ fireElementRemovedEvent(element);
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * @returns true if at least one element was added. False otherwise.
+ */
+ public boolean addAllElements(Collection<CDOObject> elements)
+ {
+ ArrayList<CDOObject> addedElements = new ArrayList<CDOObject>();
+ for (CDOObject cdoObject : elements)
+ {
+ if (watchedObjects.add(cdoObject))
+ {
+ postAdd(cdoObject);
+ addedElements.add(cdoObject);
+ }
+ }
+
+ if (!addedElements.isEmpty())
+ {
+ fireElementsAddedEvent(addedElements.toArray(new CDOObject[addedElements.size()]));
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * @returns true if at least one element was removed. False otherwise.
+ */
+ public boolean removeAllElements(Collection<CDOObject> elements)
+ {
+ ArrayList<CDOObject> removedElements = new ArrayList<CDOObject>();
+ for (CDOObject cdoObject : elements)
+ {
+ if (watchedObjects.remove(cdoObject))
+ {
+ postRemove(cdoObject);
+ removedElements.add(cdoObject);
+ }
+ }
+
+ if (!removedElements.isEmpty())
+ {
+ fireElementsRemovedEvent(removedElements.toArray(new CDOObject[removedElements.size()]));
+ return true;
+ }
+
+ return false;
+ }
+
+ private void postAdd(CDOObject element)
+ {
+ element.cdoView().options().addChangeSubscriptionPolicy(subscriptionAdapter);
+ element.eAdapters().add(subscriptionAdapter);
+ increaseViewReference(element);
+ }
+
+ private void postRemove(CDOObject element)
+ {
+ decreaseViewReference(element);
+ CDOView view = element.cdoView();
+ if (view != null && !view.isClosed())
+ {
+ element.eAdapters().remove(subscriptionAdapter);
+ }
+ }
+
+ private void increaseViewReference(CDOObject referrer)
+ {
+ CDOViewReferenceCounterManager.CDOViewReferenceCounter counter = counterManager.getCounter(referrer);
+ if (counter.increase() == 1)
+ {
+ CDOView view = referrer.cdoView();
+ view.addListener(viewDeactivationListener);
+ if (view instanceof CDOTransaction)
+ {
+ ((CDOTransaction)view).addTransactionHandler(transactionHandler);
+ }
+ }
+ }
+
+ private void decreaseViewReference(CDOObject referrer)
+ {
+ CDOViewReferenceCounterManager.CDOViewReferenceCounter counter = counterManager.getCounter(referrer);
+
+ // CDOObject might be detached, and so CDOView will be null
+ if (counter.decrease() == 0 && referrer.cdoView() != null)
+ {
+ CDOView view = referrer.cdoView();
+ view.removeListener(viewDeactivationListener);
+ if (view instanceof CDOTransaction)
+ {
+ ((CDOTransaction)view).removeTransactionHandler(transactionHandler);
+ }
+ }
+ }
+
+ /**
+ * @author Victor Roldan Betancort
+ */
+ private final class ViewDeactivationListener implements IListener
+ {
+ public void notifyEvent(IEvent event)
+ {
+ if (event instanceof ILifecycleEvent)
+ {
+ if (((ILifecycleEvent)event).getKind() == ILifecycleEvent.Kind.ABOUT_TO_DEACTIVATE)
+ {
+ List<CDOObject> aboutToRemove = new ArrayList<CDOObject>();
+ for (CDOObject object : getElements())
+ {
+ if (object.cdoView().equals(event.getSource()))
+ {
+ aboutToRemove.add(object);
+ }
+ }
+
+ removeAllElements(aboutToRemove);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * @author Victor Roldan Betancort
+ */
+ private final class CDOViewReferenceCounterManager
+ {
+ private List<CDOViewReferenceCounter> viewReferences = new ArrayList<CDOViewReferenceCounter>();
+
+ public CDOViewReferenceCounterManager()
+ {
+ }
+
+ private class CDOViewReferenceCounter
+ {
+ private final CDOView view;
+
+ private AtomicLong referenceCount = new AtomicLong();
+
+ public CDOViewReferenceCounter(CDOObject cdoObject)
+ {
+ view = cdoObject.cdoView();
+ referenceCount.set(0);
+ }
+
+ public long increase()
+ {
+ return referenceCount.incrementAndGet();
+ }
+
+ public synchronized long decrease()
+ {
+ Long value = referenceCount.decrementAndGet();
+ if (value == 0)
+ {
+ viewReferences.remove(this);
+ }
+
+ return value;
+ }
+
+ public CDOView getReferencedView()
+ {
+ return view;
+ }
+ }
+
+ public CDOViewReferenceCounter getCounter(CDOObject cdoObject)
+ {
+ synchronized (viewReferences)
+ {
+ for (CDOViewReferenceCounter counter : viewReferences)
+ {
+ if (counter.getReferencedView().equals(cdoObject.cdoView()))
+ {
+ return counter;
+ }
+ }
+ }
+
+ CDOViewReferenceCounter counter = new CDOViewReferenceCounter(cdoObject);
+ viewReferences.add(counter);
+ return counter;
+ }
+ }
+
+ /**
+ * @author Victor Roldan Betancort
+ */
+ private final class WatchedObjectsDataRegistry extends org.eclipse.net4j.util.event.Notifier implements IListener
+ {
+ private Map<Object, WatchedObjectData> registry = new HashMap<Object, WatchedObjectData>();
+
+ private final IEvent dataRegistryEvent = new IEvent()
+ {
+ public INotifier getSource()
+ {
+ return WatchedObjectsDataRegistry.this;
+ }
+ };
+
+ public WatchedObjectsDataRegistry()
+ {
+ }
+
+ public WatchedObjectData getData(Object object)
+ {
+ WatchedObjectData data = registry.get(object);
+ if (data == null)
+ {
+ data = new WatchedObjectData();
+ registry.put(object, data);
+ }
+
+ return data;
+ }
+
+ public void addNotification(Notification msg)
+ {
+ getData(msg.getNotifier()).setNotification(msg);
+ IListener[] listeners = getListeners();
+ if (listeners != null)
+ {
+ fireEvent(dataRegistryEvent, listeners);
+ }
+ }
+
+ public void removeNotification(Object object)
+ {
+ getData(object).deleteNotification();
+ IListener[] listeners = getListeners();
+ if (listeners != null)
+ {
+ fireEvent(dataRegistryEvent, listeners);
+ }
+ }
+
+ public void removeData(Object object)
+ {
+ registry.remove(object);
+ }
+
+ public void removeAllNotification(Collection<Object> objects)
+ {
+ for (WatchedObjectData data : registry.values())
+ {
+ data.deleteNotification();
+ }
+
+ IListener[] listeners = getListeners();
+ if (listeners != null)
+ {
+ fireEvent(dataRegistryEvent, listeners);
+ }
+ }
+
+ public Notification getNotification(Object object)
+ {
+ return getData(object).getNotification();
+ }
+
+ public void notifyEvent(IEvent event)
+ {
+ if (event instanceof ContainerEvent<?>)
+ {
+ ContainerEvent<?> containerEvent = (ContainerEvent<?>)event;
+ for (IContainerDelta<?> delta : containerEvent.getDeltas())
+ {
+ if (delta.getKind().equals(IContainerDelta.Kind.REMOVED))
+ {
+ removeData(delta.getElement());
+ }
+ }
+ }
+ }
+
+ /**
+ * @author Victor Roldan Betancort
+ */
+ private final class WatchedObjectData
+ {
+ private Notification notification;
+
+ public WatchedObjectData()
+ {
+ }
+
+ public void setNotification(Notification notification)
+ {
+ this.notification = notification;
+ }
+
+ public void deleteNotification()
+ {
+ notification = null;
+ }
+
+ public Notification getNotification()
+ {
+ return notification;
+ }
+ }
+ }
+
+ /**
+ * @author Victor Roldan Betancort
+ */
+ private final class CDOSubscriptionViewLabelProvider extends LabelProvider implements ITableLabelProvider,
+ IColorProvider
+ {
+ private final Color YELLOW = UIUtil.getDisplay().getSystemColor(SWT.COLOR_YELLOW);
+
+ private final String[] eventTypes = {
+ Messages.getString("CDOWatchListView.12"), Messages.getString("CDOWatchListView.25"), Messages.getString("CDOWatchListView.26"), Messages.getString("CDOWatchListView.27"), Messages.getString("CDOWatchListView.28"), Messages.getString("CDOWatchListView.29"), Messages.getString("CDOWatchListView.30"), Messages.getString("CDOWatchListView.31"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
+ Messages.getString("CDOWatchListView.32"), Messages.getString("CDOWatchListView.33") }; //$NON-NLS-1$ //$NON-NLS-2$
+
+ private AdapterFactory adapterFactory;
+
+ public CDOSubscriptionViewLabelProvider(AdapterFactory adapterFactory)
+ {
+ this.adapterFactory = adapterFactory;
+ }
+
+ public Image getColumnImage(Object object, int columnIndex)
+ {
+ // In case an invalid object arrives (i.e., detached), return CDOState
+ if (FSMUtil.isInvalid(CDOUtil.getCDOObject((EObject)object)))
+ {
+ return null;
+ }
+
+ switch (columnIndex)
+ {
+ case 0:
+ IItemLabelProvider labelProvider = (IItemLabelProvider)adapterFactory.adapt(object, IItemLabelProvider.class);
+ if (labelProvider != null)
+ {
+ return ExtendedImageRegistry.getInstance().getImage(labelProvider.getImage(object));
+ }
+ }
+
+ return null;
+ }
+
+ public String getColumnText(Object element, int columnIndex)
+ {
+ CDOObject object = CDOUtil.getCDOObject((EObject)element);
+
+ // In case an invalid object arrives (i.e., detached), return CDOState
+ if (FSMUtil.isInvalid(object))
+ {
+ return object.cdoState().toString();
+ }
+
+ switch (columnIndex)
+ {
+ case 0:
+ IItemLabelProvider labelProvider = (IItemLabelProvider)adapterFactory.adapt(object, IItemLabelProvider.class);
+ if (labelProvider != null)
+ {
+ return labelProvider.getText(object);
+ }
+
+ return null;
+
+ case 1:
+ return object.cdoResource().getURI().toString();
+
+ case 2:
+ // XXX CDOView view = object.cdoView();
+ // if (view instanceof CDOTransaction)
+ // {
+ // long time = ((CDOTransaction)view).getLastCommitTime();
+ // if (time != CDORevision.UNSPECIFIED_DATE)
+ // {
+ // return new Date(time).toString();
+ // }
+ // }
+
+ return "?"; //$NON-NLS-1$
+
+ case 3:
+ Notification notification = getDataRegistry().getNotification(element);
+ return createEventLabel(notification);
+ }
+
+ return element.toString();
+ }
+
+ public Color getBackground(Object element)
+ {
+ if (element instanceof CDOObject)
+ {
+ if (getDataRegistry().getNotification(element) != null)
+ {
+ return YELLOW;
+ }
+ }
+
+ return null;
+ }
+
+ public Color getForeground(Object element)
+ {
+ return null;
+ }
+
+ private String createEventLabel(Notification notification)
+ {
+ if (notification == null)
+ {
+ return null;
+ }
+
+ StringBuilder builder = new StringBuilder();
+ int event = notification.getEventType();
+ if (event < Notification.EVENT_TYPE_COUNT)
+ {
+ builder.append(eventTypes[event]);
+ }
+
+ builder.append(": "); //$NON-NLS-1$
+ builder.append(((EStructuralFeature)notification.getFeature()).getName());
+ builder.append(" = "); //$NON-NLS-1$
+ builder.append(notification.getNewValue().toString());
+ return builder.toString();
+ }
+ }
+
+ /**
+ * @author Victor Roldan Betancort
+ */
+ private final class CDOObjectContainerContentProvider implements IStructuredContentProvider
+ {
+ public CDOObjectContainerContentProvider()
+ {
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object[] getElements(Object object)
+ {
+ return ((IContainer<Object>)object).getElements();
+ }
+
+ public void dispose()
+ {
+ // do nothing
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
+ {
+ // do nothing
+ }
+ }
+
+ /**
+ * @author Victor Roldan Betancort
+ */
+ private final class ResetNotificationAction extends LongRunningAction
+ {
+ private transient List<?> targets;
+
+ public ResetNotificationAction()
+ {
+ }
+
+ @Override
+ protected void preRun() throws Exception
+ {
+ ISelection selection = getSelection();
+ if (selection instanceof IStructuredSelection)
+ {
+ IStructuredSelection ssel = (IStructuredSelection)selection;
+ if (!ssel.isEmpty())
+ {
+ targets = ssel.toList();
+ return;
+ }
+ }
+
+ cancel();
+ }
+
+ @Override
+ protected void doRun(IProgressMonitor progressMonitor) throws Exception
+ {
+ if (targets != null)
+ {
+ List<?> useTargets = targets;
+ targets = null;
+
+ for (Object object : useTargets)
+ {
+ if (object instanceof CDOObject)
+ {
+ getDataRegistry().removeNotification(object);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * @author Victor Roldan Betancort
+ */
+ private final class ResetAllNotificationAction extends LongRunningAction
+ {
+ public ResetAllNotificationAction()
+ {
+ }
+
+ @Override
+ protected void doRun(IProgressMonitor progressMonitor) throws Exception
+ {
+ ArrayList<Object> aboutToReset = new ArrayList<Object>();
+ for (CDOObject cdoObject : container.getElements())
+ {
+ aboutToReset.add(cdoObject);
+ }
+
+ getDataRegistry().removeAllNotification(aboutToReset);
+ }
+ }
+}

Back to the top