Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2012-01-14 10:27:01 +0000
committerEike Stepper2012-01-14 10:27:01 +0000
commit0266166cb9ff9535c150250073ea1e57b42d2693 (patch)
treec006a3bc0ba1f6e1d8a2bc032eedc346f71eab0d /plugins/org.eclipse.emf.cdo.ui/src
parent7416443692cdda72d1f704ea4fc5ececcc669df7 (diff)
downloadcdo-0266166cb9ff9535c150250073ea1e57b42d2693.tar.gz
cdo-0266166cb9ff9535c150250073ea1e57b42d2693.tar.xz
cdo-0266166cb9ff9535c150250073ea1e57b42d2693.zip
Adjusted copyrights to 2012
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.ui/src')
-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/OpenSessionAction.java188
-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/CDOEditor.java5528
-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/CDOSessionsView.java170
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/views/CDOWatchListView.java1948
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOEditorInput.java96
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOEditorUtil.java306
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOEventHandler.java660
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOInteractiveExceptionHandler.java384
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOItemProvider.java1018
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOLabelDecorator.java272
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOLabelProvider.java322
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/package-info.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/widgets/AuditScale.java288
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/widgets/ComposeBranchPointComposite.java290
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/widgets/SelectBranchComposite.java418
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/widgets/SelectTimeStampComposite.java586
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/widgets/SessionComposite.java446
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/widgets/package-info.java2
87 files changed, 13235 insertions, 13235 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 50f905d561..a9adbca767 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 - 2011 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 87d4c8f516..0a336f4f97 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 - 2011 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 a3909c8af0..80c2e083cc 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 - 2011 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 da4979573d..40be0b45cd 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 - 2011 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 365f457f23..62b38683f4 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 - 2011 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 b3e260677b..0c3271c145 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 - 2011 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 fe9939a940..0553897d5e 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 - 2011 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 af77293a49..b9a6132a08 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 - 2011 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 ced0829858..6d88b9554e 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 - 2011 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 8b04cbbacb..fc3d7ec3a0 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 - 2011 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 188f1acf3b..27b5bbb3b1 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 - 2011 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 a5c1bb47eb..79cd506780 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 - 2011 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 33176718e3..83d6d81037 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 - 2011 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 423e0c25ed..d33e2b697a 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 - 2011 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 3676cb7448..7c0014facc 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 - 2011 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 6da5f7c3cc..4948f75715 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 - 2011 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 3f657c5e69..4a35798653 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 - 2011 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 a6bd158684..543d897750 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 - 2011 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 eb1f8391bf..39b3d1acab 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 - 2011 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 09ff7df707..dc56e32f27 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 - 2011 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 026ccc4d51..de17e9807e 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 - 2011 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 f223911b06..6f26125a37 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 - 2011 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 1d164ccdf0..b3a2db7ab4 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 - 2011 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 55bf00d97c..2e08a4bbc9 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 - 2011 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 c36ef2326b..4ddf6168b3 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 - 2011 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/OpenSessionAction.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenSessionAction.java
index 35ee3e6e05..13630b1358 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenSessionAction.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/actions/OpenSessionAction.java
@@ -1,94 +1,94 @@
-/*
- * Copyright (c) 2004 - 2011 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.CDOPackageRegistryPopulator;
-import org.eclipse.emf.cdo.internal.ui.bundle.OM;
-import org.eclipse.emf.cdo.internal.ui.dialogs.OpenSessionDialog;
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-import org.eclipse.emf.cdo.internal.ui.views.CDOSessionsView;
-import org.eclipse.emf.cdo.ui.widgets.SessionComposite;
-
-import org.eclipse.net4j.util.container.IManagedContainer;
-import org.eclipse.net4j.util.container.IPluginContainer;
-import org.eclipse.net4j.util.ui.actions.LongRunningAction;
-
-import org.eclipse.emf.spi.cdo.InternalCDOSession;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.ui.IWorkbenchPage;
-
-/**
- * @author Eike Stepper
- */
-public final class OpenSessionAction extends LongRunningAction
-{
- private static final String TITLE = OpenSessionDialog.TITLE;
-
- private static final String TOOL_TIP = Messages.getString("OpenSessionAction.0"); //$NON-NLS-1$
-
- private SessionComposite sessionComposite;
-
- public OpenSessionAction(IWorkbenchPage page)
- {
- super(page, TITLE + INTERACTIVE, TOOL_TIP, CDOSessionsView.getAddImageDescriptor());
- }
-
- @Override
- protected void preRun() throws Exception
- {
- OpenSessionDialog dialog = new OpenSessionDialog(getPage());
- if (dialog.open() == OpenSessionDialog.OK)
- {
- sessionComposite = dialog.getSessionComposite();
- sessionComposite.rememberSettings();
- }
- else
- {
- cancel();
- }
- }
-
- @Override
- protected void doRun(IProgressMonitor progressMonitor) throws Exception
- {
- try
- {
- String description = sessionComposite.getSessionDescription();
- final InternalCDOSession session = (InternalCDOSession)getContainer().getElement("org.eclipse.emf.cdo.sessions", //$NON-NLS-1$
- "cdo", description); //$NON-NLS-1$
-
- if (sessionComposite.isAutomaticRegistry())
- {
- CDOPackageRegistryPopulator.populate(session.getPackageRegistry());
- }
- }
- catch (final RuntimeException ex)
- {
- OM.LOG.error(ex);
- getDisplay().asyncExec(new Runnable()
- {
- public void run()
- {
- MessageDialog.openError(getShell(), getText(), Messages.getString("OpenSessionAction.3") //$NON-NLS-1$
- + ex.getMessage());
- }
- });
- }
- }
-
- protected IManagedContainer getContainer()
- {
- return IPluginContainer.INSTANCE;
- }
-}
+/*
+ * 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.CDOPackageRegistryPopulator;
+import org.eclipse.emf.cdo.internal.ui.bundle.OM;
+import org.eclipse.emf.cdo.internal.ui.dialogs.OpenSessionDialog;
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+import org.eclipse.emf.cdo.internal.ui.views.CDOSessionsView;
+import org.eclipse.emf.cdo.ui.widgets.SessionComposite;
+
+import org.eclipse.net4j.util.container.IManagedContainer;
+import org.eclipse.net4j.util.container.IPluginContainer;
+import org.eclipse.net4j.util.ui.actions.LongRunningAction;
+
+import org.eclipse.emf.spi.cdo.InternalCDOSession;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * @author Eike Stepper
+ */
+public final class OpenSessionAction extends LongRunningAction
+{
+ private static final String TITLE = OpenSessionDialog.TITLE;
+
+ private static final String TOOL_TIP = Messages.getString("OpenSessionAction.0"); //$NON-NLS-1$
+
+ private SessionComposite sessionComposite;
+
+ public OpenSessionAction(IWorkbenchPage page)
+ {
+ super(page, TITLE + INTERACTIVE, TOOL_TIP, CDOSessionsView.getAddImageDescriptor());
+ }
+
+ @Override
+ protected void preRun() throws Exception
+ {
+ OpenSessionDialog dialog = new OpenSessionDialog(getPage());
+ if (dialog.open() == OpenSessionDialog.OK)
+ {
+ sessionComposite = dialog.getSessionComposite();
+ sessionComposite.rememberSettings();
+ }
+ else
+ {
+ cancel();
+ }
+ }
+
+ @Override
+ protected void doRun(IProgressMonitor progressMonitor) throws Exception
+ {
+ try
+ {
+ String description = sessionComposite.getSessionDescription();
+ final InternalCDOSession session = (InternalCDOSession)getContainer().getElement("org.eclipse.emf.cdo.sessions", //$NON-NLS-1$
+ "cdo", description); //$NON-NLS-1$
+
+ if (sessionComposite.isAutomaticRegistry())
+ {
+ CDOPackageRegistryPopulator.populate(session.getPackageRegistry());
+ }
+ }
+ catch (final RuntimeException ex)
+ {
+ OM.LOG.error(ex);
+ getDisplay().asyncExec(new Runnable()
+ {
+ public void run()
+ {
+ MessageDialog.openError(getShell(), getText(), Messages.getString("OpenSessionAction.3") //$NON-NLS-1$
+ + ex.getMessage());
+ }
+ });
+ }
+ }
+
+ protected IManagedContainer getContainer()
+ {
+ return IPluginContainer.INSTANCE;
+ }
+}
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 30733f2451..7cc454d3bd 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 - 2011 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 d6252d08b4..e936daa47c 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 - 2011 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 47c2fb1caf..70cdd7dd1e 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 - 2011 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 b00cb6b9e0..ebe40fb348 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 - 2011 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 1e63a345c1..e268bd6e4f 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 - 2011 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 2205b9cfd7..97ef287e1f 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 - 2011 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 6d0cc89aa0..5465e5e7ae 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 - 2011 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 2a747bb392..bc9482a805 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 - 2011 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 81474d5b6d..93ac4636b8 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 - 2011 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 dbc088eb65..48283ad289 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 - 2011 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 bd7b9210ea..434076c3f9 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 - 2011 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 5d5ea1c598..2f043875df 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 - 2011 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 1d40512887..9f618b2f61 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 - 2011 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 52e63734b0..9e94dbfe94 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 - 2011 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 a3766d6adf..3fee598298 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 - 2011 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 557da8087d..10afef5264 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 - 2011 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 c9b951f1de..f0749f83bc 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 - 2011 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 30d7710c23..efb57fb498 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 - 2011 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 8bf042eb31..650aa00e94 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 - 2011 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 50dc33512c..1159b9630f 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 - 2011 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 6e839c09c3..58698cd315 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 - 2011 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 8ead3dad91..015567ce34 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 - 2011 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 01d4c40feb..1f5d622241 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 - 2011 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 ca538da716..a05c0402c2 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 - 2011 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 5a2124f164..0cec21122a 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 - 2011 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 7841e8bf3c..1c9c1809e8 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 - 2011 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 8dc7462ea3..55ff7be344 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 - 2011 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 a37cd9f18a..37661e87eb 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 - 2011 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 b1df0f8f94..6ff14c91a0 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 - 2011 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 32486937dc..cb9f76a4af 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 - 2011 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 d32930167d..7c7b9b37f7 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 - 2011 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 98b1ee76ed..c1efdf4b7c 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 - 2011 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 196679545e..a9540fe25d 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 - 2011 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 e986089078..2ece0142f5 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 - 2011 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 c278e58399..d8ca8d1364 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 - 2011 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 - 2011 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/CDOEditor.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java
index dffe1cf69d..6841ef37b1 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java
@@ -1,2764 +1,2764 @@
-/*
- * Copyright (c) 2004 - 2011 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.CDOObject;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.common.model.CDOPackageInfo;
-import org.eclipse.emf.cdo.common.model.CDOPackageRegistry;
-import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
-import org.eclipse.emf.cdo.common.model.EMFUtil;
-import org.eclipse.emf.cdo.common.util.CDOCommonUtil;
-import org.eclipse.emf.cdo.eresource.CDOResource;
-import org.eclipse.emf.cdo.internal.ui.bundle.OM;
-import org.eclipse.emf.cdo.internal.ui.dialogs.BulkAddDialog;
-import org.eclipse.emf.cdo.internal.ui.dialogs.RollbackTransactionDialog;
-import org.eclipse.emf.cdo.internal.ui.messages.Messages;
-import org.eclipse.emf.cdo.session.CDOSession;
-import org.eclipse.emf.cdo.transaction.CDOTransaction;
-import org.eclipse.emf.cdo.ui.CDOEditorInput;
-import org.eclipse.emf.cdo.ui.CDOEventHandler;
-import org.eclipse.emf.cdo.ui.CDOLabelProvider;
-import org.eclipse.emf.cdo.ui.shared.SharedIcons;
-import org.eclipse.emf.cdo.util.CDOURIUtil;
-import org.eclipse.emf.cdo.util.CDOUtil;
-import org.eclipse.emf.cdo.view.CDOView;
-import org.eclipse.emf.cdo.view.CDOViewTargetChangedEvent;
-
-import org.eclipse.emf.internal.cdo.view.CDOStateMachine;
-
-import org.eclipse.net4j.util.event.IEvent;
-import org.eclipse.net4j.util.event.IListener;
-import org.eclipse.net4j.util.transaction.TransactionException;
-import org.eclipse.net4j.util.ui.UIUtil;
-import org.eclipse.net4j.util.ui.actions.LongRunningAction;
-import org.eclipse.net4j.util.ui.actions.SafeAction;
-
-import org.eclipse.emf.common.command.BasicCommandStack;
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.command.CommandStackListener;
-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.Notifier;
-import org.eclipse.emf.common.ui.MarkerHelper;
-import org.eclipse.emf.common.ui.editor.ProblemEditorPart;
-import org.eclipse.emf.common.ui.viewer.IViewerProvider;
-import org.eclipse.emf.common.util.BasicDiagnostic;
-import org.eclipse.emf.common.util.Diagnostic;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.EValidator;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.util.EContentAdapter;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.edit.EMFEditPlugin;
-import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
-import org.eclipse.emf.edit.domain.EditingDomain;
-import org.eclipse.emf.edit.domain.IEditingDomainProvider;
-import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator;
-import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
-import org.eclipse.emf.edit.provider.IItemLabelProvider;
-import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;
-import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory;
-import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor;
-import org.eclipse.emf.edit.ui.celleditor.AdapterFactoryTreeEditor;
-import org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter;
-import org.eclipse.emf.edit.ui.dnd.LocalTransfer;
-import org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter;
-import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
-import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
-import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;
-import org.eclipse.emf.edit.ui.provider.UnwrappingSelectionProvider;
-import org.eclipse.emf.edit.ui.util.EditUIMarkerHelper;
-import org.eclipse.emf.edit.ui.util.EditUIUtil;
-import org.eclipse.emf.edit.ui.view.ExtendedPropertySheetPage;
-import org.eclipse.emf.spi.cdo.InternalCDOObject;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.resources.IResourceDeltaVisitor;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IStatusLineManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.DecoratingLabelProvider;
-import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.jface.viewers.ILabelDecorator;
-import org.eclipse.jface.viewers.ILabelProvider;
-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.ITreeViewerListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.TreeExpansionEvent;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CTabFolder;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.events.ControlAdapter;
-import org.eclipse.swt.events.ControlEvent;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Scale;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.IPartListener;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-import org.eclipse.ui.dialogs.SaveAsDialog;
-import org.eclipse.ui.ide.IGotoMarker;
-import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.ui.part.MultiPageEditorPart;
-import org.eclipse.ui.views.contentoutline.ContentOutline;
-import org.eclipse.ui.views.contentoutline.ContentOutlinePage;
-import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
-import org.eclipse.ui.views.properties.IPropertySheetPage;
-import org.eclipse.ui.views.properties.PropertySheet;
-import org.eclipse.ui.views.properties.PropertySheetPage;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.InvocationTargetException;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.EventObject;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * @author Eike Stepper
- * @generated
- */
-public class CDOEditor extends MultiPageEditorPart implements IEditingDomainProvider, ISelectionProvider,
- IMenuListener, IViewerProvider, IGotoMarker
-{
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- public static final String copyright = "Copyright (c) 2004 - 2011 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 EDITOR_ID = "org.eclipse.emf.cdo.ui.CDOEditor"; //$NON-NLS-1$
-
- /**
- * @ADDED
- */
- private static final Object EMPTY_INPUT = new Object();
-
- /**
- * @ADDED
- */
- protected CDOView view;
-
- /**
- * @ADDED
- */
- protected Object viewerInput;
-
- /**
- * @ADDED
- */
- protected CDOEventHandler eventHandler;
-
- /**
- * This keeps track of the editing domain that is used to track all changes to the model. <!-- begin-user-doc --> <!--
- * end-user-doc -->
- *
- * @generated
- */
- protected AdapterFactoryEditingDomain editingDomain;
-
- /**
- * This is the one adapter factory used for providing views of the model. <!-- begin-user-doc --> <!-- end-user-doc
- * -->
- *
- * @generated
- */
- protected ComposedAdapterFactory adapterFactory;
-
- /**
- * This is the content outline page. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected IContentOutlinePage contentOutlinePage;
-
- /**
- * This is a kludge... <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected IStatusLineManager contentOutlineStatusLineManager;
-
- /**
- * This is the content outline page's viewer. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected TreeViewer contentOutlineViewer;
-
- /**
- * This is the property sheet page. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected PropertySheetPage propertySheetPage;
-
- /**
- * This is the viewer that shadows the selection in the content outline. The parent relation must be correctly defined
- * for this to work. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected TreeViewer selectionViewer;
-
- /**
- * This keeps track of the active content viewer, which may be either one of the viewers in the pages or the content
- * outline viewer. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected Viewer currentViewer;
-
- /**
- * This listens to which ever viewer is active. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected ISelectionChangedListener selectionChangedListener;
-
- /**
- * This keeps track of all the {@link org.eclipse.jface.viewers.ISelectionChangedListener}s that are listening to this
- * editor. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected Collection<ISelectionChangedListener> selectionChangedListeners = new ArrayList<ISelectionChangedListener>();
-
- /**
- * This keeps track of the selection of the editor as a whole. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected ISelection editorSelection = StructuredSelection.EMPTY;
-
- /**
- * The MarkerHelper is responsible for creating workspace resource markers presented in Eclipse's Problems View. <!--
- * begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected MarkerHelper markerHelper = new EditUIMarkerHelper();
-
- /**
- * This listens for when the outline becomes active <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected IPartListener partListener = new IPartListener()
- {
- public void partActivated(IWorkbenchPart p)
- {
- if (p instanceof ContentOutline)
- {
- if (((ContentOutline)p).getCurrentPage() == contentOutlinePage)
- {
- getActionBarContributor().setActiveEditor(CDOEditor.this);
-
- setCurrentViewer(contentOutlineViewer);
- }
- }
- else if (p instanceof PropertySheet)
- {
- if (((PropertySheet)p).getCurrentPage() == propertySheetPage)
- {
- getActionBarContributor().setActiveEditor(CDOEditor.this);
- handleActivate();
- }
- }
- else if (p == CDOEditor.this)
- {
- handleActivate();
- }
- }
-
- public void partBroughtToTop(IWorkbenchPart p)
- {
- // Ignore.
- }
-
- public void partClosed(IWorkbenchPart p)
- {
- // Ignore.
- }
-
- public void partDeactivated(IWorkbenchPart p)
- {
- // Ignore.
- }
-
- public void partOpened(IWorkbenchPart p)
- {
- // Ignore.
- }
- };
-
- /**
- * Resources that have been removed since last activation. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected Collection<Resource> removedResources = new ArrayList<Resource>();
-
- /**
- * Resources that have been changed since last activation. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected Collection<Resource> changedResources = new ArrayList<Resource>();
-
- /**
- * Resources that have been saved. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected Collection<Resource> savedResources = new ArrayList<Resource>();
-
- /**
- * Map to store the diagnostic associated with a resource. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected Map<Resource, Diagnostic> resourceToDiagnosticMap = new LinkedHashMap<Resource, Diagnostic>();
-
- /**
- * Controls whether the problem indication should be updated. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected boolean updateProblemIndication = true;
-
- /**
- * Adapter used to update the problem indication when resources are demanded loaded. <!-- begin-user-doc --> <!--
- * end-user-doc -->
- *
- * @generated
- */
- protected EContentAdapter problemIndicationAdapter = new EContentAdapter()
- {
- @Override
- public void notifyChanged(Notification notification)
- {
- if (notification.getNotifier() instanceof Resource)
- {
- switch (notification.getFeatureID(Resource.class))
- {
- case Resource.RESOURCE__IS_LOADED:
- case Resource.RESOURCE__ERRORS:
- case Resource.RESOURCE__WARNINGS:
- {
- Resource resource = (Resource)notification.getNotifier();
- Diagnostic diagnostic = analyzeResourceProblems(resource, null);
- if (diagnostic.getSeverity() != Diagnostic.OK)
- {
- resourceToDiagnosticMap.put(resource, diagnostic);
- }
- else
- {
- resourceToDiagnosticMap.remove(resource);
- }
-
- if (updateProblemIndication)
- {
- getSite().getShell().getDisplay().asyncExec(new Runnable()
- {
- public void run()
- {
- updateProblemIndication();
- }
- });
- }
- break;
- }
- }
- }
- else
- {
- super.notifyChanged(notification);
- }
- }
-
- @Override
- protected void setTarget(Resource target)
- {
- basicSetTarget(target);
- }
-
- @Override
- protected void unsetTarget(Resource target)
- {
- basicUnsetTarget(target);
- }
- };
-
- /**
- * This listens for workspace changes. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected IResourceChangeListener resourceChangeListener = new IResourceChangeListener()
- {
- public void resourceChanged(IResourceChangeEvent event)
- {
- IResourceDelta delta = event.getDelta();
- try
- {
- class ResourceDeltaVisitor implements IResourceDeltaVisitor
- {
- protected ResourceSet resourceSet = editingDomain.getResourceSet();
-
- protected Collection<Resource> changedResources = new ArrayList<Resource>();
-
- protected Collection<Resource> removedResources = new ArrayList<Resource>();
-
- public boolean visit(IResourceDelta delta)
- {
- if (delta.getResource().getType() == IResource.FILE)
- {
- if (delta.getKind() == IResourceDelta.REMOVED || delta.getKind() == IResourceDelta.CHANGED
- && delta.getFlags() != IResourceDelta.MARKERS)
- {
- Resource resource = resourceSet.getResource(
- URI.createPlatformResourceURI(delta.getFullPath().toString(), true), false);
- if (resource != null)
- {
- if (delta.getKind() == IResourceDelta.REMOVED)
- {
- removedResources.add(resource);
- }
- else if (!savedResources.remove(resource))
- {
- changedResources.add(resource);
- }
- }
- }
- }
-
- return true;
- }
-
- public Collection<Resource> getChangedResources()
- {
- return changedResources;
- }
-
- public Collection<Resource> getRemovedResources()
- {
- return removedResources;
- }
- }
-
- final ResourceDeltaVisitor visitor = new ResourceDeltaVisitor();
- delta.accept(visitor);
-
- if (!visitor.getRemovedResources().isEmpty())
- {
- getSite().getShell().getDisplay().asyncExec(new Runnable()
- {
- public void run()
- {
- removedResources.addAll(visitor.getRemovedResources());
- if (!isDirty())
- {
- getSite().getPage().closeEditor(CDOEditor.this, false);
- }
- }
- });
- }
-
- if (!visitor.getChangedResources().isEmpty())
- {
- getSite().getShell().getDisplay().asyncExec(new Runnable()
- {
- public void run()
- {
- changedResources.addAll(visitor.getChangedResources());
- if (getSite().getPage().getActiveEditor() == CDOEditor.this)
- {
- handleActivate();
- }
- }
- });
- }
- }
- catch (CoreException exception)
- {
- PluginDelegator.INSTANCE.log(exception);
- }
- }
- };
-
- private IListener viewTargetListener = new IListener()
- {
- private CDOID inputID;
-
- public void notifyEvent(IEvent event)
- {
- if (event instanceof CDOViewTargetChangedEvent)
- {
- Object input = selectionViewer.getInput();
- if (input == EMPTY_INPUT)
- {
- if (inputID != null)
- {
- try
- {
- CDOObject object = view.getObject(inputID);
- selectionViewer.setInput(object);
- inputID = null;
- }
- catch (Exception ex)
- {
- // Ignore
- }
- }
- }
- else if (input instanceof EObject)
- {
- CDOObject object = CDOUtil.getCDOObject((EObject)input);
- if (object.cdoInvalid())
- {
- inputID = object.cdoID();
- selectionViewer.setInput(EMPTY_INPUT);
- }
- }
- }
- }
- };
-
- /**
- * Handles activation of the editor or it's associated views. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected void handleActivateGen()
- {
- // Recompute the read only state.
- //
- if (editingDomain.getResourceToReadOnlyMap() != null)
- {
- editingDomain.getResourceToReadOnlyMap().clear();
-
- // Refresh any actions that may become enabled or disabled.
- //
- setSelection(getSelection());
- }
-
- if (!removedResources.isEmpty())
- {
- if (handleDirtyConflict())
- {
- getSite().getPage().closeEditor(CDOEditor.this, false);
- }
- else
- {
- removedResources.clear();
- changedResources.clear();
- savedResources.clear();
- }
- }
- else if (!changedResources.isEmpty())
- {
- changedResources.removeAll(savedResources);
- handleChangedResources();
- changedResources.clear();
- savedResources.clear();
- }
- }
-
- /**
- * Handles activation of the editor or it's associated views. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated NOT
- */
- protected void handleActivate()
- {
- handleActivateGen();
- setCurrentViewer(selectionViewer);
- }
-
- /**
- * Handles what to do with changed resources on activation. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected void handleChangedResources()
- {
- if (!changedResources.isEmpty() && (!isDirty() || handleDirtyConflict()))
- {
- if (isDirty())
- {
- changedResources.addAll(editingDomain.getResourceSet().getResources());
- }
- editingDomain.getCommandStack().flush();
-
- updateProblemIndication = false;
- for (Resource resource : changedResources)
- {
- if (resource.isLoaded())
- {
- resource.unload();
- try
- {
- resource.load(Collections.EMPTY_MAP);
- }
- catch (IOException exception)
- {
- if (!resourceToDiagnosticMap.containsKey(resource))
- {
- resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception));
- }
- }
- }
- }
-
- if (AdapterFactoryEditingDomain.isStale(editorSelection))
- {
- setSelection(StructuredSelection.EMPTY);
- }
-
- updateProblemIndication = true;
- updateProblemIndication();
- }
- }
-
- /**
- * Updates the problems indication with the information described in the specified diagnostic. <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- *
- * @generated
- */
- protected void updateProblemIndication()
- {
- if (updateProblemIndication)
- {
- BasicDiagnostic diagnostic = new BasicDiagnostic(Diagnostic.OK, "org.eclipse.emf.cdo.ui", 0, null,
- new Object[] { editingDomain.getResourceSet() });
- for (Diagnostic childDiagnostic : resourceToDiagnosticMap.values())
- {
- if (childDiagnostic.getSeverity() != Diagnostic.OK)
- {
- diagnostic.add(childDiagnostic);
- }
- }
-
- int lastEditorPage = getPageCount() - 1;
- if (lastEditorPage >= 0 && getEditor(lastEditorPage) instanceof ProblemEditorPart)
- {
- ((ProblemEditorPart)getEditor(lastEditorPage)).setDiagnostic(diagnostic);
- if (diagnostic.getSeverity() != Diagnostic.OK)
- {
- setActivePage(lastEditorPage);
- }
- }
- else if (diagnostic.getSeverity() != Diagnostic.OK)
- {
- ProblemEditorPart problemEditorPart = new ProblemEditorPart();
- problemEditorPart.setDiagnostic(diagnostic);
- problemEditorPart.setMarkerHelper(markerHelper);
- try
- {
- addPage(++lastEditorPage, problemEditorPart, getEditorInput());
- setPageText(lastEditorPage, problemEditorPart.getPartName());
- setActivePage(lastEditorPage);
- showTabs();
- }
- catch (PartInitException exception)
- {
- PluginDelegator.INSTANCE.log(exception);
- }
- }
-
- if (markerHelper.hasMarkers(editingDomain.getResourceSet()))
- {
- markerHelper.deleteMarkers(editingDomain.getResourceSet());
- if (diagnostic.getSeverity() != Diagnostic.OK)
- {
- try
- {
- markerHelper.createMarkers(diagnostic);
- }
- catch (CoreException exception)
- {
- PluginDelegator.INSTANCE.log(exception);
- }
- }
- }
- }
- }
-
- /**
- * Shows a dialog that asks if conflicting changes should be discarded. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected boolean handleDirtyConflict()
- {
- return MessageDialog.openQuestion(getSite().getShell(), getString("_UI_FileConflict_label"),
- getString("_WARN_FileConflict"));
- }
-
- /**
- * This creates a model editor. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- public CDOEditor()
- {
- super();
- initializeEditingDomain();
- }
-
- /**
- * This sets up the editing domain for the model editor. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected void initializeEditingDomainGen()
- {
- // Create an adapter factory that yields item providers.
- //
- adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
-
- adapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory());
- adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());
-
- // Create the command stack that will notify this editor as commands are executed.
- //
- BasicCommandStack commandStack = new BasicCommandStack();
-
- // Add a listener to set the most recent command's affected objects to be the selection of the viewer with focus.
- //
- commandStack.addCommandStackListener(new CommandStackListener()
- {
- public void commandStackChanged(final EventObject event)
- {
- getContainer().getDisplay().asyncExec(new Runnable()
- {
- public void run()
- {
- firePropertyChange(IEditorPart.PROP_DIRTY);
-
- // Try to select the affected objects.
- //
- Command mostRecentCommand = ((CommandStack)event.getSource()).getMostRecentCommand();
- if (mostRecentCommand != null)
- {
- setSelectionToViewer(mostRecentCommand.getAffectedObjects());
- }
- if (propertySheetPage != null && !propertySheetPage.getControl().isDisposed())
- {
- propertySheetPage.refresh();
- }
- }
- });
- }
- });
-
- // Create the editing domain with a special command stack.
- //
- editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, new HashMap<Resource, Boolean>());
- }
-
- /**
- * @ADDED
- */
- protected void initializeEditingDomain()
- {
- ComposedAdapterFactory.Descriptor.Registry registry = EMFEditPlugin.getComposedAdapterFactoryDescriptorRegistry();
- adapterFactory = new ComposedAdapterFactory(registry);
- adapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory());
- adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());
- }
-
- /**
- * This is here for the listener to be able to call it. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- @Override
- protected void firePropertyChange(int action)
- {
- super.firePropertyChange(action);
- }
-
- /**
- * This sets the selection into whichever viewer is active. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- public void setSelectionToViewer(Collection<?> collection)
- {
- final Collection<?> theSelection = collection;
- // Make sure it's okay.
- //
- if (theSelection != null && !theSelection.isEmpty())
- {
- Runnable runnable = new Runnable()
- {
- public void run()
- {
- // Try to select the items in the current content viewer of the editor.
- //
- if (currentViewer != null)
- {
- currentViewer.setSelection(new StructuredSelection(theSelection.toArray()), true);
- }
- }
- };
- getSite().getShell().getDisplay().asyncExec(runnable);
- }
- }
-
- /**
- * This returns the editing domain as required by the {@link IEditingDomainProvider} interface. This is important for
- * implementing the static methods of {@link AdapterFactoryEditingDomain} and for supporting
- * {@link org.eclipse.emf.edit.ui.action.CommandAction}. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- public EditingDomain getEditingDomain()
- {
- return editingDomain;
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- public class ReverseAdapterFactoryContentProvider extends AdapterFactoryContentProvider
- {
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- public ReverseAdapterFactoryContentProvider(AdapterFactory adapterFactory)
- {
- super(adapterFactory);
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- @Override
- public Object[] getElements(Object object)
- {
- Object parent = super.getParent(object);
- return (parent == null ? Collections.EMPTY_SET : Collections.singleton(parent)).toArray();
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- @Override
- public Object[] getChildren(Object object)
- {
- Object parent = super.getParent(object);
- return (parent == null ? Collections.EMPTY_SET : Collections.singleton(parent)).toArray();
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- @Override
- public boolean hasChildren(Object object)
- {
- Object parent = super.getParent(object);
- return parent != null;
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- @Override
- public Object getParent(Object object)
- {
- return null;
- }
- }
-
- /**
- * This makes sure that one content viewer, either for the current page or the outline view, if it has focus, is the
- * current one. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- public void setCurrentViewer(Viewer viewer)
- {
- // If it is changing...
- //
- if (currentViewer != viewer)
- {
- if (selectionChangedListener == null)
- {
- // Create the listener on demand.
- //
- selectionChangedListener = new ISelectionChangedListener()
- {
- // This just notifies those things that are affected by the section.
- //
- public void selectionChanged(SelectionChangedEvent selectionChangedEvent)
- {
- setSelection(selectionChangedEvent.getSelection());
- }
- };
- }
-
- // Stop listening to the old one.
- //
- if (currentViewer != null)
- {
- currentViewer.removeSelectionChangedListener(selectionChangedListener);
- }
-
- // Start listening to the new one.
- //
- if (viewer != null)
- {
- viewer.addSelectionChangedListener(selectionChangedListener);
- }
-
- // Remember it.
- //
- currentViewer = viewer;
-
- // Set the editors selection based on the current viewer's selection.
- //
- setSelection(currentViewer == null ? StructuredSelection.EMPTY : currentViewer.getSelection());
- }
- }
-
- /**
- * This returns the viewer as required by the {@link IViewerProvider} interface. <!-- begin-user-doc --> <!--
- * end-user-doc -->
- *
- * @generated
- */
- public Viewer getViewer()
- {
- return currentViewer;
- }
-
- /**
- * This creates a context menu for the viewer and adds a listener as well registering the menu for extension. <!--
- * begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected void createContextMenuFor(StructuredViewer viewer)
- {
- MenuManager contextMenu = new MenuManager("#PopUp");
- contextMenu.add(new Separator("additions"));
- contextMenu.setRemoveAllWhenShown(true);
- contextMenu.addMenuListener(this);
- Menu menu = contextMenu.createContextMenu(viewer.getControl());
- viewer.getControl().setMenu(menu);
- getSite().registerContextMenu(contextMenu, new UnwrappingSelectionProvider(viewer));
-
- int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
- Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance() };
- viewer.addDragSupport(dndOperations, transfers, new ViewerDragAdapter(viewer));
- viewer.addDropSupport(dndOperations, transfers, new EditingDomainViewerDropAdapter(editingDomain, viewer));
- }
-
- /**
- * @ADDED
- */
- public CDOView getView()
- {
- return view;
- }
-
- /**
- * This is the method called to load a resource into the editing domain's resource set based on the editor's input.
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- public void createModelGen()
- {
- URI resourceURI = EditUIUtil.getURI(getEditorInput());
- Exception exception = null;
- Resource resource = null;
- try
- {
- // Load the resource through the editing domain.
- //
- resource = editingDomain.getResourceSet().getResource(resourceURI, true);
- }
- catch (Exception e)
- {
- exception = e;
- resource = editingDomain.getResourceSet().getResource(resourceURI, false);
- }
-
- Diagnostic diagnostic = analyzeResourceProblems(resource, exception);
- if (diagnostic.getSeverity() != Diagnostic.OK)
- {
- resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception));
- }
- editingDomain.getResourceSet().eAdapters().add(problemIndicationAdapter);
- }
-
- /**
- * @ADDED
- */
- public void createModel()
- {
- try
- {
- CDOEditorInput editorInput = (CDOEditorInput)getEditorInput();
- view = editorInput.getView();
- view.addListener(viewTargetListener);
-
- // TODO Check if a CommandStack is needed
- BasicCommandStack commandStack = new BasicCommandStack();
- commandStack.addCommandStackListener(new CommandStackListener()
- {
- public void commandStackChanged(final EventObject event)
- {
- try
- {
- if (getContainer() != null && !getContainer().isDisposed())
- {
- getContainer().getDisplay().asyncExec(new Runnable()
- {
- public void run()
- {
- Command mostRecentCommand = ((CommandStack)event.getSource()).getMostRecentCommand();
- if (mostRecentCommand != null)
- {
- setSelectionToViewer(mostRecentCommand.getAffectedObjects());
- }
-
- if (propertySheetPage != null && !propertySheetPage.getControl().isDisposed())
- {
- propertySheetPage.refresh();
- }
- }
- });
- }
- }
- catch (RuntimeException ex)
- {
- OM.LOG.error(ex);
- }
- }
- });
-
- ResourceSet resourceSet = view.getResourceSet();
- editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, resourceSet);
-
- // This adapter provides the EditingDomain of the Editor
- resourceSet.eAdapters().add(new EditingDomainProviderAdapter());
-
- String resourcePath = editorInput.getResourcePath();
- if (resourcePath == null)
- {
- viewerInput = resourceSet;
- }
- else
- {
- URI resourceURI = CDOURIUtil.createResourceURI(view, resourcePath);
- viewerInput = resourceSet.getResource(resourceURI, true);
- }
-
- // resourceSet.eAdapters().add(problemIndicationAdapter);
- }
- catch (RuntimeException ex)
- {
- OM.LOG.error(ex);
- throw ex;
- }
- }
-
- /**
- * Returns a diagnostic describing the errors and warnings listed in the resource and the specified exception (if
- * any). <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- public Diagnostic analyzeResourceProblems(Resource resource, Exception exception)
- {
- if (!resource.getErrors().isEmpty() || !resource.getWarnings().isEmpty())
- {
- BasicDiagnostic basicDiagnostic = new BasicDiagnostic(Diagnostic.ERROR, "org.eclipse.emf.cdo.ui", 0, getString(
- "_UI_CreateModelError_message", resource.getURI()), new Object[] { exception == null ? (Object)resource
- : exception });
- basicDiagnostic.merge(EcoreUtil.computeDiagnostic(resource, true));
- return basicDiagnostic;
- }
- else if (exception != null)
- {
- return new BasicDiagnostic(Diagnostic.ERROR, "org.eclipse.emf.cdo.ui", 0, getString(
- "_UI_CreateModelError_message", resource.getURI()), new Object[] { exception });
- }
- else
- {
- return Diagnostic.OK_INSTANCE;
- }
- }
-
- /**
- * This is the method used by the framework to install your own controls. <!-- begin-user-doc --> <!-- end-user-doc
- * -->
- *
- * @generated
- */
- public void createPagesGen()
- {
- // Creates the model from the editor input
- //
- createModel();
-
- // Only creates the other pages if there is something that can be edited
- //
- if (!getEditingDomain().getResourceSet().getResources().isEmpty())
- {
- // Create a page for the selection tree view.
- //
- Tree tree = new Tree(getContainer(), SWT.MULTI);
- selectionViewer = new TreeViewer(tree);
- setCurrentViewer(selectionViewer);
-
- selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
- selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
- selectionViewer.setInput(editingDomain.getResourceSet());
- selectionViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true);
-
- new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory);
-
- createContextMenuFor(selectionViewer);
- int pageIndex = addPage(tree);
- setPageText(pageIndex, getString("_UI_SelectionPage_label"));
-
- getSite().getShell().getDisplay().asyncExec(new Runnable()
- {
- public void run()
- {
- setActivePage(0);
- }
- });
- }
-
- // Ensures that this editor will only display the page's tab
- // area if there are more than one page
- //
- getContainer().addControlListener(new ControlAdapter()
- {
- boolean guard = false;
-
- @Override
- public void controlResized(ControlEvent event)
- {
- if (!guard)
- {
- guard = true;
- hideTabs();
- guard = false;
- }
- }
- });
-
- getSite().getShell().getDisplay().asyncExec(new Runnable()
- {
- public void run()
- {
- updateProblemIndication();
- }
- });
- }
-
- /**
- * @ADDED
- */
- @Override
- public void createPages()
- {
- try
- {
- // Creates the model from the editor input
- createModel();
-
- // Create a page for the selection tree view.
- getContainer().setLayoutData(UIUtil.createGridData());
- getContainer().setLayout(UIUtil.createGridLayout(1));
- Composite composite = UIUtil.createGridComposite(getContainer(), 1);
- composite.setLayoutData(UIUtil.createGridData());
- composite.setLayout(UIUtil.createGridLayout(1));
- Tree tree = new Tree(composite, SWT.MULTI | SWT.BORDER);
- tree.setLayoutData(UIUtil.createGridData());
-
- final Set<CDOID> expandedIDs = new HashSet<CDOID>();
- final boolean sliderAllowed = view.isReadOnly() && view.getSession().getRepositoryInfo().isSupportingAudits();
- if (sliderAllowed)
- {
- createTimeSlider(composite, expandedIDs);
- }
-
- selectionViewer = new TreeViewer(tree)
- {
- @Override
- public void setSelection(ISelection selection, boolean reveal)
- {
- if (sliderAllowed && selection instanceof IStructuredSelection)
- {
- IStructuredSelection ssel = (IStructuredSelection)selection;
- for (Iterator<?> it = ssel.iterator(); it.hasNext();)
- {
- Object object = it.next();
- if (object instanceof EObject)
- {
- CDOObject cdoObject = CDOUtil.getCDOObject((EObject)object);
- switch (cdoObject.cdoState())
- {
- case TRANSIENT:
- case PREPARED:
- case INVALID:
- case INVALID_CONFLICT:
- it.remove();
- }
- }
- }
- }
-
- super.setSelection(selection, reveal);
- }
- };
-
- selectionViewer.addTreeListener(new ITreeViewerListener()
- {
- public void treeExpanded(TreeExpansionEvent event)
- {
- CDOID id = getID(event.getElement());
- if (id != null)
- {
- expandedIDs.add(id);
- }
- }
-
- public void treeCollapsed(TreeExpansionEvent event)
- {
- CDOID id = getID(event.getElement());
- if (id != null)
- {
- expandedIDs.remove(id);
- }
- }
-
- private CDOID getID(Object element)
- {
- if (element instanceof EObject)
- {
- CDOObject object = CDOUtil.getCDOObject((EObject)element);
- return object.cdoID();
- }
-
- return null;
- }
- });
-
- setCurrentViewer(selectionViewer);
-
- selectionViewer.setContentProvider(createContentProvider());
- selectionViewer.setLabelProvider(createLabelProvider());
- selectionViewer.setInput(viewerInput);
-
- new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory);
-
- createContextMenuFor(selectionViewer);
- int pageIndex = addPage(composite);
- setPageText(pageIndex, getString("_UI_SelectionPage_label")); //$NON-NLS-1$
-
- setActivePage(0);
-
- // Ensures that this editor will only display the page's tab
- // area if there are more than one page
- getContainer().addControlListener(new ControlAdapter()
- {
- boolean guard = false;
-
- @Override
- public void controlResized(ControlEvent event)
- {
- if (!guard)
- {
- guard = true;
- hideTabs();
- guard = false;
- }
- }
- });
-
- updateProblemIndication();
- eventHandler = new CDOEventHandler(view, selectionViewer)
- {
- @Override
- protected void objectInvalidated(InternalCDOObject cdoObject)
- {
- if (CDOUtil.isLegacyObject(cdoObject))
- {
- CDOStateMachine.INSTANCE.read(cdoObject);
- }
- }
-
- @Override
- protected void viewConflict(final CDOObject conflictingObject, boolean firstConflict)
- {
- refreshViewer(conflictingObject);
- }
-
- @Override
- protected void viewClosed()
- {
- closeEditor();
- }
-
- @Override
- protected void viewDirtyStateChanged()
- {
- if (viewerInput instanceof CDOResource)
- {
- CDOResource resource = (CDOResource)viewerInput;
- if (!view.isObjectRegistered(resource.cdoID()))
- {
- closeEditor();
- return;
- }
- }
-
- fireDirtyPropertyChange();
- }
- };
- }
- catch (RuntimeException ex)
- {
- OM.LOG.error(ex);
- throw ex;
- }
-
- getViewer().getControl().addMouseListener(new MouseListener()
- {
- public void mouseDoubleClick(MouseEvent e)
- {
- try
- {
- getSite().getPage().showView("org.eclipse.ui.views.PropertySheet"); //$NON-NLS-1$
- }
- catch (PartInitException ex)
- {
- OM.LOG.error(ex);
- }
- }
-
- public void mouseDown(MouseEvent e)
- {
- // do nothing
- }
-
- public void mouseUp(MouseEvent e)
- {
- // do nothing
- }
- });
- }
-
- /**
- * @ADDED
- */
- protected void createTimeSlider(final Composite composite, final Set<CDOID> expandedIDs)
- {
- final CDOSession session = view.getSession();
- final long startTimeStamp = session.getRepositoryInfo().getCreationTime();
- final long endTimeStamp = session.getLastUpdateTime();
-
- final int MIN = 0;
- final int MAX = 100000;
- final long absoluteTimeWindowLength = endTimeStamp - startTimeStamp;
- final long scaleFactor = MAX - MIN;
- final double stepSize = (double)absoluteTimeWindowLength / (double)scaleFactor;
-
- final Group group = new Group(composite, SWT.NONE);
- group.setLayoutData(UIUtil.createEmptyGridData());
- group.setLayout(new FillLayout());
- group.setText(CDOCommonUtil.formatTimeStamp(endTimeStamp));
- group.setVisible(false);
-
- final Scale scale = new Scale(group, SWT.HORIZONTAL);
- scale.setMinimum(MIN);
- scale.setMaximum(MAX);
- scale.setSelection(MAX);
-
- scale.addSelectionListener(new SelectionAdapter()
- {
- @Override
- public void widgetSelected(SelectionEvent e)
- {
- long value = scale.getSelection();
- long timeStamp = startTimeStamp + Math.round(stepSize * value);
-
- group.setText(CDOCommonUtil.formatTimeStamp(timeStamp));
-
- view.setTimeStamp(timeStamp);
- selectionViewer.refresh();
- setExpandedStates();
- }
-
- private void setExpandedStates()
- {
- for (CDOID id : expandedIDs)
- {
- try
- {
- CDOObject object = view.getObject(id);
- selectionViewer.setExpandedState(object, true);
- }
- catch (Exception ex)
- {
- // Ignore
- }
- }
- }
- });
-
- IAction action = new Action()
- {
- @Override
- public void run()
- {
- if (group.isVisible())
- {
- group.setVisible(false);
- group.setLayoutData(UIUtil.createEmptyGridData());
- composite.layout();
- }
- else
- {
- group.setVisible(true);
- group.setLayoutData(new GridData(SWT.FILL, 50, true, false));
- composite.layout();
- }
- }
- };
-
- action.setEnabled(true);
- action.setChecked(false);
- action.setImageDescriptor(SharedIcons.getDescriptor(SharedIcons.ETOOL_SLIDER_ICON));
- action.setToolTipText(Messages.getString("CDOEditor.1")); //$NON-NLS-1$
- getActionBars().getToolBarManager().add(action);
- }
-
- /**
- * @ADDED
- */
- protected IContentProvider createContentProvider()
- {
- return new AdapterFactoryContentProvider(adapterFactory);
- }
-
- /**
- * @ADDED
- */
- protected ILabelProvider createLabelProvider()
- {
- return new DecoratingLabelProvider(new CDOLabelProvider(adapterFactory, view, selectionViewer),
- createLabelDecorator());
- }
-
- /**
- * @ADDED
- */
- protected ILabelDecorator createLabelDecorator()
- {
- return PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator();
- }
-
- /**
- * If there is just one page in the multi-page editor part, this hides the single tab at the bottom. <!--
- * begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated NOT
- */
- protected void hideTabs()
- {
- if (getPageCount() <= 1)
- {
- setPageText(0, ""); //$NON-NLS-1$
- if (getContainer() != null && !getContainer().isDisposed() && getContainer() instanceof CTabFolder)
- {
- ((CTabFolder)getContainer()).setTabHeight(1);
- Point point = getContainer().getSize();
- getContainer().setSize(point.x, point.y + 6);
- }
- }
- }
-
- /**
- * If there is more than one page in the multi-page editor part, this shows the tabs at the bottom. <!--
- * begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated NOT
- */
- protected void showTabs()
- {
- if (getPageCount() > 1)
- {
- setPageText(0, getString("_UI_SelectionPage_label")); //$NON-NLS-1$
- if (getContainer() != null && !getContainer().isDisposed() && getContainer() instanceof CTabFolder)
- {
- ((CTabFolder)getContainer()).setTabHeight(SWT.DEFAULT);
- Point point = getContainer().getSize();
- getContainer().setSize(point.x, point.y - 6);
- }
- }
- }
-
- /**
- * This is used to track the active viewer. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- @Override
- protected void pageChange(int pageIndex)
- {
- super.pageChange(pageIndex);
-
- if (contentOutlinePage != null)
- {
- handleContentOutlineSelection(contentOutlinePage.getSelection());
- }
- }
-
- /**
- * This is how the framework determines which interfaces we implement. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- @SuppressWarnings("rawtypes")
- @Override
- public Object getAdapter(Class key)
- {
- if (key.equals(IContentOutlinePage.class))
- {
- return showOutlineView() ? getContentOutlinePage() : null;
- }
- else if (key.equals(IPropertySheetPage.class))
- {
- return getPropertySheetPage();
- }
- else if (key.equals(IGotoMarker.class))
- {
- return this;
- }
- else
- {
- return super.getAdapter(key);
- }
- }
-
- /**
- * This accesses a cached version of the content outliner. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated NOT
- */
- public IContentOutlinePage getContentOutlinePage()
- {
- if (contentOutlinePage == null)
- {
- // The content outline is just a tree.
- //
- class MyContentOutlinePage extends ContentOutlinePage
- {
- @Override
- public void createControl(Composite parent)
- {
- super.createControl(parent);
- contentOutlineViewer = getTreeViewer();
- contentOutlineViewer.addSelectionChangedListener(this);
-
- // Set up the tree viewer.
- //
- contentOutlineViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
- contentOutlineViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
- contentOutlineViewer.setInput(viewerInput);
-
- // Make sure our popups work.
- //
- createContextMenuFor(contentOutlineViewer);
-
- if (!CDOUtil.getResources(editingDomain.getResourceSet()).isEmpty())
- {
- // Select the root object in the view.
- //
- contentOutlineViewer.setSelection(
- new StructuredSelection(CDOUtil.getResources(editingDomain.getResourceSet()).get(0)), true);
- }
- }
-
- @Override
- public void makeContributions(IMenuManager menuManager, IToolBarManager toolBarManager,
- IStatusLineManager statusLineManager)
- {
- super.makeContributions(menuManager, toolBarManager, statusLineManager);
- contentOutlineStatusLineManager = statusLineManager;
- }
-
- @Override
- public void setActionBars(IActionBars actionBars)
- {
- super.setActionBars(actionBars);
- getActionBarContributor().shareGlobalActions(this, actionBars);
- }
- }
-
- contentOutlinePage = new MyContentOutlinePage();
-
- // Listen to selection so that we can handle it is a special way.
- //
- contentOutlinePage.addSelectionChangedListener(new ISelectionChangedListener()
- {
- // This ensures that we handle selections correctly.
- //
- public void selectionChanged(SelectionChangedEvent event)
- {
- handleContentOutlineSelection(event.getSelection());
- }
- });
- }
-
- return contentOutlinePage;
- }
-
- /**
- * This accesses a cached version of the property sheet. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- public IPropertySheetPage getPropertySheetPage()
- {
- if (propertySheetPage == null)
- {
- propertySheetPage = new ExtendedPropertySheetPage(editingDomain)
- {
- @Override
- public void setSelectionToViewer(List<?> selection)
- {
- CDOEditor.this.setSelectionToViewer(selection);
- CDOEditor.this.setFocus();
- }
-
- @Override
- public void setActionBars(IActionBars actionBars)
- {
- super.setActionBars(actionBars);
- getActionBarContributor().shareGlobalActions(this, actionBars);
- }
- };
- propertySheetPage.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory));
- }
-
- return propertySheetPage;
- }
-
- /**
- * This deals with how we want selection in the outliner to affect the other views. <!-- begin-user-doc --> <!--
- * end-user-doc -->
- *
- * @generated
- */
- public void handleContentOutlineSelection(ISelection selection)
- {
- if (selectionViewer != null && !selection.isEmpty() && selection instanceof IStructuredSelection)
- {
- Iterator<?> selectedElements = ((IStructuredSelection)selection).iterator();
- if (selectedElements.hasNext())
- {
- // Get the first selected element.
- //
- Object selectedElement = selectedElements.next();
-
- ArrayList<Object> selectionList = new ArrayList<Object>();
- selectionList.add(selectedElement);
- while (selectedElements.hasNext())
- {
- selectionList.add(selectedElements.next());
- }
-
- // Set the selection to the widget.
- //
- selectionViewer.setSelection(new StructuredSelection(selectionList));
- }
- }
- }
-
- /**
- * This is for implementing {@link IEditorPart} and simply tests the command stack. <!-- begin-user-doc --> <!--
- * end-user-doc -->
- *
- * @generated NOT
- */
- @Override
- public boolean isDirty()
- {
- return view.isDirty();
- }
-
- /**
- * This is for implementing {@link IEditorPart} and simply saves the model file. <!-- begin-user-doc --> <!--
- * end-user-doc -->
- *
- * @generated
- */
- public void doSaveGen(IProgressMonitor progressMonitor)
- {
- // Save only resources that have actually changed.
- //
- final Map<Object, Object> saveOptions = new HashMap<Object, Object>();
- saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER);
-
- // Do the work within an operation because this is a long running activity that modifies the workbench.
- //
- WorkspaceModifyOperation operation = new WorkspaceModifyOperation()
- {
- // This is the method that gets invoked when the operation runs.
- //
- @Override
- public void execute(IProgressMonitor monitor)
- {
- // Save the resources to the file system.
- //
- boolean first = true;
- for (Resource resource : editingDomain.getResourceSet().getResources())
- {
- if ((first || !resource.getContents().isEmpty() || isPersisted(resource))
- && !editingDomain.isReadOnly(resource))
- {
- try
- {
- long timeStamp = resource.getTimeStamp();
- resource.save(saveOptions);
- if (resource.getTimeStamp() != timeStamp)
- {
- savedResources.add(resource);
- }
- }
- catch (Exception exception)
- {
- resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception));
- }
- first = false;
- }
- }
- }
- };
-
- updateProblemIndication = false;
- try
- {
- // This runs the options, and shows progress.
- //
- new ProgressMonitorDialog(getSite().getShell()).run(true, false, operation);
-
- // Refresh the necessary state.
- //
- ((BasicCommandStack)editingDomain.getCommandStack()).saveIsDone();
- firePropertyChange(IEditorPart.PROP_DIRTY);
- }
- catch (Exception exception)
- {
- // Something went wrong that shouldn't.
- //
- PluginDelegator.INSTANCE.log(exception);
- }
- updateProblemIndication = true;
- updateProblemIndication();
- }
-
- /**
- * @ADDED
- */
- @Override
- public void doSave(IProgressMonitor progressMonitor)
- {
- Display.getCurrent().asyncExec(null);
- // Save only resources that have actually changed.
- //
- final Map<Object, Object> saveOptions = new HashMap<Object, Object>();
- saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER);
-
- IRunnableWithProgress operation = new IRunnableWithProgress()
- {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException
- {
- boolean first = true;
- EList<Resource> resources = CDOUtil.getResources(editingDomain.getResourceSet());
- monitor.beginTask("", resources.size()); //$NON-NLS-1$
- try
- {
- for (Resource resource : resources)
- {
- if ((first || !resource.getContents().isEmpty() || isPersisted(resource))
- && !editingDomain.isReadOnly(resource))
- {
- try
- {
- savedResources.add(resource);
- saveOptions.put(CDOResource.OPTION_SAVE_PROGRESS_MONITOR, new SubProgressMonitor(monitor, 1));
- saveOptions.put(CDOResource.OPTION_SAVE_OVERRIDE_TRANSACTION, view);
- resource.save(saveOptions);
- }
- catch (TransactionException exception)
- {
- OM.LOG.error(exception);
- final Shell shell = getSite().getShell();
- shell.getDisplay().syncExec(new Runnable()
- {
- public void run()
- {
- CDOTransaction transaction = (CDOTransaction)view;
- String title = Messages.getString("CDOEditor.17"); //$NON-NLS-1$
- String message = Messages.getString("CDOEditor.18"); //$NON-NLS-1$
- RollbackTransactionDialog dialog = new RollbackTransactionDialog(getEditorSite().getPage(), title,
- message, transaction);
- if (dialog.open() == RollbackTransactionDialog.OK)
- {
- transaction.rollback();
- }
- }
- });
- }
- catch (Exception exception)
- {
- OM.LOG.error(exception);
- resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception));
- }
-
- first = false;
- }
- else
- {
- monitor.worked(1);
- }
- }
- }
- finally
- {
- monitor.done();
- }
- }
- };
-
- updateProblemIndication = false;
-
- try
- {
- // This runs the options, and shows progress.
- //
- new ProgressMonitorDialog(getSite().getShell()).run(true, true, operation);
-
- // Refresh the necessary state.
- //
- ((BasicCommandStack)editingDomain.getCommandStack()).saveIsDone();
- }
- catch (Exception exception)
- {
- // Something went wrong that shouldn't.
- //
- PluginDelegator.INSTANCE.log(exception);
- }
-
- updateProblemIndication = true;
- updateProblemIndication();
- }
-
- /**
- * This returns whether something has been persisted to the URI of the specified resource. The implementation uses the
- * URI converter from the editor's resource set to try to open an input stream. <!-- begin-user-doc --> <!--
- * end-user-doc -->
- *
- * @generated
- */
- protected boolean isPersisted(Resource resource)
- {
- boolean result = false;
- try
- {
- InputStream stream = editingDomain.getResourceSet().getURIConverter().createInputStream(resource.getURI());
- if (stream != null)
- {
- result = true;
- stream.close();
- }
- }
- catch (IOException e)
- {
- // Ignore
- }
- return result;
- }
-
- /**
- * This always returns true because it is not currently supported. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- public boolean isSaveAsAllowedGen()
- {
- return true;
- }
-
- /**
- * @ADDED
- */
- @Override
- public boolean isSaveAsAllowed()
- {
- return false;
- }
-
- /**
- * This also changes the editor's input. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- @Override
- public void doSaveAs()
- {
- SaveAsDialog saveAsDialog = new SaveAsDialog(getSite().getShell());
- saveAsDialog.open();
- IPath path = saveAsDialog.getResult();
- if (path != null)
- {
- IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
- if (file != null)
- {
- doSaveAs(URI.createPlatformResourceURI(file.getFullPath().toString(), true), new FileEditorInput(file));
- }
- }
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated NOT
- */
- protected void doSaveAs(URI uri, IEditorInput editorInput)
- {
- throw new UnsupportedOperationException();
-
- // CDONet4jUtil.getResources(editingDomain.getResourceSet()).get(0).setURI(uri);
- // setInputWithNotify(editorInput);
- // setPartName(editorInput.getName());
- // IProgressMonitor progressMonitor = getActionBars().getStatusLineManager() != null ? getActionBars()
- // .getStatusLineManager().getProgressMonitor() : new NullProgressMonitor();
- // doSave(progressMonitor);
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- public void gotoMarker(IMarker marker)
- {
- try
- {
- if (marker.getType().equals(EValidator.MARKER))
- {
- String uriAttribute = marker.getAttribute(EValidator.URI_ATTRIBUTE, null);
- if (uriAttribute != null)
- {
- URI uri = URI.createURI(uriAttribute);
- EObject eObject = editingDomain.getResourceSet().getEObject(uri, true);
- if (eObject != null)
- {
- setSelectionToViewer(Collections.singleton(editingDomain.getWrapper(eObject)));
- }
- }
- }
- }
- catch (CoreException exception)
- {
- PluginDelegator.INSTANCE.log(exception);
- }
- }
-
- /**
- * This is called during startup. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- public void initGen(IEditorSite site, IEditorInput editorInput)
- {
- setSite(site);
- setInputWithNotify(editorInput);
- setPartName(editorInput.getName());
- site.setSelectionProvider(this);
- site.getPage().addPartListener(partListener);
- ResourcesPlugin.getWorkspace().addResourceChangeListener(resourceChangeListener, IResourceChangeEvent.POST_CHANGE);
- }
-
- /**
- * @ADDED
- */
- @Override
- public void init(IEditorSite site, IEditorInput editorInput)
- {
- setSite(site);
- setPartName(editorInput.getName());
- site.setSelectionProvider(this);
- site.getPage().addPartListener(partListener);
- setInputWithNotify(editorInput);
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- @Override
- public void setFocus()
- {
- getControl(getActivePage()).setFocus();
- }
-
- /**
- * This implements {@link org.eclipse.jface.viewers.ISelectionProvider}. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- public void addSelectionChangedListener(ISelectionChangedListener listener)
- {
- selectionChangedListeners.add(listener);
- }
-
- /**
- * This implements {@link org.eclipse.jface.viewers.ISelectionProvider}. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- public void removeSelectionChangedListener(ISelectionChangedListener listener)
- {
- selectionChangedListeners.remove(listener);
- }
-
- /**
- * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to return this editor's overall selection.
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- public ISelection getSelection()
- {
- return editorSelection;
- }
-
- /**
- * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection.
- * Calling this result will notify the listeners. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- public void setSelection(ISelection selection)
- {
- editorSelection = selection;
-
- for (ISelectionChangedListener listener : selectionChangedListeners)
- {
- listener.selectionChanged(new SelectionChangedEvent(this, selection));
- }
- setStatusLineManager(selection);
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- public void setStatusLineManager(ISelection selection)
- {
- IStatusLineManager statusLineManager = currentViewer != null && currentViewer == contentOutlineViewer ? contentOutlineStatusLineManager
- : getActionBars().getStatusLineManager();
-
- if (statusLineManager != null)
- {
- if (selection instanceof IStructuredSelection)
- {
- Collection<?> collection = ((IStructuredSelection)selection).toList();
- switch (collection.size())
- {
- case 0:
- {
- statusLineManager.setMessage(getString("_UI_NoObjectSelected"));
- break;
- }
- case 1:
- {
- String text = new AdapterFactoryItemDelegator(adapterFactory).getText(collection.iterator().next());
- statusLineManager.setMessage(getString("_UI_SingleObjectSelected", text));
- break;
- }
- default:
- {
- statusLineManager.setMessage(getString("_UI_MultiObjectSelected", Integer.toString(collection.size())));
- break;
- }
- }
- }
- else
- {
- statusLineManager.setMessage("");
- }
- }
- }
-
- /**
- * This looks up a string in the plugin's plugin.properties file. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- private static String getString(String key)
- {
- return PluginDelegator.INSTANCE.getString(key);
- }
-
- /**
- * This looks up a string in plugin.properties, making a substitution. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- private static String getString(String key, Object s1)
- {
- return PluginDelegator.INSTANCE.getString(key, new Object[] { s1 });
- }
-
- /**
- * This implements {@link org.eclipse.jface.action.IMenuListener} to help fill the context menus with contributions
- * from the Edit menu. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- public void menuAboutToShowGen(IMenuManager menuManager)
- {
- ((IMenuListener)getEditorSite().getActionBarContributor()).menuAboutToShow(menuManager);
- }
-
- /**
- * @ADDED
- */
- public void menuAboutToShow(IMenuManager menuManager)
- {
- menuAboutToShowGen(menuManager);
- MenuManager submenuManager = new MenuManager(Messages.getString("CDOEditor.23")); //$NON-NLS-1$
- if (populateNewRoot(submenuManager))
- {
- menuManager.insertBefore("edit", submenuManager); //$NON-NLS-1$
- }
-
- IStructuredSelection sel = (IStructuredSelection)editorSelection;
- if (sel.size() == 1)
- {
- Object element = sel.getFirstElement();
- if (element instanceof EObject)
- {
- final EObject object = (EObject)element;
- final List<EReference> features = new ArrayList<EReference>();
- for (EReference containment : object.eClass().getEAllContainments())
- {
- if (containment.isMany())
- {
- features.add(containment);
- }
- }
-
- if (!features.isEmpty())
- {
- final IWorkbenchPage page = getSite().getPage();
- menuManager.insertBefore(
- "edit", new LongRunningAction(page, Messages.getString("CDOEditor.26") + SafeAction.INTERACTIVE) //$NON-NLS-1$ //$NON-NLS-2$
- {
- private EReference feature;
-
- private int instances;
-
- @Override
- protected void preRun() throws Exception
- {
- BulkAddDialog dialog = new BulkAddDialog(page, features);
- if (dialog.open() == BulkAddDialog.OK)
- {
- feature = dialog.getFeature();
- instances = dialog.getInstances();
- }
- else
- {
- cancel();
- }
- }
-
- @SuppressWarnings("unchecked")
- @Override
- protected void doRun(IProgressMonitor progressMonitor) throws Exception
- {
- List<EObject> children = new ArrayList<EObject>();
- for (int i = 0; i < instances; i++)
- {
- EObject child = EcoreUtil.create(feature.getEReferenceType());
- children.add(child);
- }
-
- List<EObject> list = (EList<EObject>)object.eGet(feature);
- list.addAll(children);
- }
- });
- }
- }
- }
- }
-
- /**
- * @ADDED
- */
- protected boolean populateNewRoot(MenuManager menuManager)
- {
- boolean populated = false;
- CDOPackageRegistry packageRegistry = view.getSession().getPackageRegistry();
- for (Map.Entry<String, Object> entry : EMFUtil.getSortedRegistryEntries(packageRegistry))
- {
- IContributionItem item = populateSubMenu(entry.getKey(), entry.getValue(), packageRegistry);
- if (item != null)
- {
- menuManager.add(item);
- populated = true;
- }
- }
-
- return populated;
- }
-
- /**
- * @ADDED
- */
- private IContributionItem populateSubMenu(String nsURI, Object value, final CDOPackageRegistry packageRegistry)
- {
- if (value instanceof EPackage)
- {
- EPackage ePackage = (EPackage)value;
- CDOPackageInfo packageInfo = packageRegistry.getPackageInfo(ePackage);
- CDOPackageUnit packageUnit = packageInfo.getPackageUnit();
- if (packageUnit.isResource())
- {
- return null;
- }
-
- ImageDescriptor imageDescriptor = SharedIcons.getDescriptor(SharedIcons.OBJ_EPACKAGE);
- MenuManager submenuManager = new MenuManager(nsURI, imageDescriptor, nsURI);
- populateSubMenu(ePackage, submenuManager);
- return submenuManager;
- }
-
- ImageDescriptor imageDescriptor = SharedIcons.getDescriptor(SharedIcons.OBJ_EPACKAGE_UNKNOWN);
- final MenuManager submenuManager = new MenuManager(nsURI, imageDescriptor, nsURI);
- submenuManager.setRemoveAllWhenShown(true);
- submenuManager.add(new Action(Messages.getString("CDOEditor.27")) //$NON-NLS-1$
- {
- });
-
- submenuManager.addMenuListener(new IMenuListener()
- {
- public void menuAboutToShow(IMenuManager manager)
- {
- String nsURI = submenuManager.getMenuText();
- EPackage ePackage = packageRegistry.getEPackage(nsURI);
-
- if (ePackage != null)
- {
- populateSubMenu(ePackage, submenuManager);
- }
- else
- {
- OM.LOG.warn(MessageFormat.format(Messages.getString("CDOEditor.28"), nsURI)); //$NON-NLS-1$
- }
- }
- });
-
- return submenuManager;
- }
-
- /**
- * @ADDED
- */
- private void populateSubMenu(EPackage ePackage, final MenuManager submenuManager)
- {
- List<EObject> objects = new ArrayList<EObject>();
- for (EClassifier eClassifier : ePackage.getEClassifiers())
- {
- if (eClassifier instanceof EClass)
- {
- EClass eClass = (EClass)eClassifier;
- if (!eClass.isAbstract() && !eClass.isInterface())
- {
- objects.add(EcoreUtil.create(eClass));
- }
- }
- }
-
- if (!objects.isEmpty())
- {
- Collections.sort(objects, new Comparator<EObject>()
- {
- public int compare(EObject o1, EObject o2)
- {
- return o1.eClass().getName().compareTo(o2.eClass().getName());
- }
- });
-
- for (EObject object : objects)
- {
- CreateRootAction action = new CreateRootAction(object);
- submenuManager.add(action);
- }
- }
- }
-
- /**
- * @ADDED
- */
- protected String getLabelText(Object object)
- {
- try
- {
- IItemLabelProvider labelProvider = (IItemLabelProvider)adapterFactory.adapt(object, IItemLabelProvider.class);
- if (labelProvider != null)
- {
- String text = labelProvider.getText(object);
- if (text != null)
- {
- return text;
- }
- }
- }
- catch (Exception ignore)
- {
- ignore.printStackTrace();
- }
-
- return ""; //$NON-NLS-1$
- }
-
- /**
- * @ADDED
- */
- protected Object getLabelImage(Object object)
- {
- try
- {
- IItemLabelProvider labelProvider = (IItemLabelProvider)adapterFactory.adapt(object, IItemLabelProvider.class);
- if (labelProvider != null)
- {
- return labelProvider.getImage(object);
- }
- }
- catch (Exception ignore)
- {
- ignore.printStackTrace();
- }
-
- return null;
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- public EditingDomainActionBarContributor getActionBarContributor()
- {
- return (EditingDomainActionBarContributor)getEditorSite().getActionBarContributor();
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- public IActionBars getActionBars()
- {
- return getActionBarContributor().getActionBars();
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- public AdapterFactory getAdapterFactory()
- {
- return adapterFactory;
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- public void disposeGen()
- {
- updateProblemIndication = false;
-
- ResourcesPlugin.getWorkspace().removeResourceChangeListener(resourceChangeListener);
-
- getSite().getPage().removePartListener(partListener);
-
- adapterFactory.dispose();
-
- if (getActionBarContributor().getActiveEditor() == this)
- {
- getActionBarContributor().setActiveEditor(null);
- }
-
- if (propertySheetPage != null)
- {
- propertySheetPage.dispose();
- }
-
- if (contentOutlinePage != null)
- {
- contentOutlinePage.dispose();
- }
-
- super.dispose();
- }
-
- /**
- * @ADDED
- */
- @Override
- public void dispose()
- {
- updateProblemIndication = false;
- view.removeListener(viewTargetListener);
-
- if (!view.isClosed())
- {
- try
- {
- if (eventHandler != null)
- {
- eventHandler.dispose();
- }
- }
- catch (Exception ex)
- {
- OM.LOG.error(ex);
- }
-
- try
- {
- if (adapterFactory != null)
- {
- adapterFactory.dispose();
- }
- }
- catch (Exception ex)
- {
- OM.LOG.error(ex);
- }
- }
-
- getSite().getPage().removePartListener(partListener);
-
- if (getActionBarContributor().getActiveEditor() == this)
- {
- getActionBarContributor().setActiveEditor(null);
- }
-
- if (propertySheetPage != null)
- {
- propertySheetPage.dispose();
- }
-
- if (contentOutlinePage != null)
- {
- contentOutlinePage.dispose();
- }
-
- if (((CDOEditorInput)getEditorInput()).isViewOwned())
- {
- view.close();
- }
-
- super.dispose();
- }
-
- /**
- * Returns whether the outline view should be presented to the user. <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated NOT
- */
- protected boolean showOutlineView()
- {
- return true;
- }
-
- /**
- * @ADDED
- */
- protected void fireDirtyPropertyChange()
- {
- try
- {
- getSite().getShell().getDisplay().asyncExec(new Runnable()
- {
- public void run()
- {
- try
- {
- firePropertyChange(IEditorPart.PROP_DIRTY);
- }
- catch (Exception ignore)
- {
- }
- }
- });
- }
- catch (Exception ignore)
- {
- }
- }
-
- /**
- * @ADDED
- */
- protected void closeEditor()
- {
- try
- {
- getSite().getShell().getDisplay().asyncExec(new Runnable()
- {
- public void run()
- {
- try
- {
- getSite().getPage().closeEditor(CDOEditor.this, false);
- CDOEditor.this.dispose();
- }
- catch (RuntimeException ignore)
- {
- // Do nothing
- }
- }
- });
- }
- catch (RuntimeException ignore)
- {
- // Do nothing
- }
- }
-
- /**
- * @ADDED
- */
- public void refreshViewer(final Object element)
- {
- try
- {
- selectionViewer.getControl().getDisplay().asyncExec(new Runnable()
- {
- public void run()
- {
- try
- {
- if (element == null)
- {
- selectionViewer.refresh(true);
- }
- else
- {
- selectionViewer.refresh(element, true);
- }
- }
- catch (RuntimeException ignore)
- {
- // Do nothing
- }
- }
- });
- }
- catch (RuntimeException ignore)
- {
- // Do nothing
- }
- }
-
- /**
- * @author Eike Stepper
- * @ADDED
- */
- private final class CreateRootAction extends LongRunningAction
- {
- private EObject object;
-
- private CreateRootAction(EObject object)
- {
- super(getEditorSite().getPage(), object.eClass().getName(), ExtendedImageRegistry.getInstance()
- .getImageDescriptor(getLabelImage(object)));
- this.object = object;
- }
-
- @Override
- protected void doRun(IProgressMonitor progressMonitor) throws Exception
- {
- Resource resource = null;
- IStructuredSelection ssel = (IStructuredSelection)editorSelection;
- if (ssel.isEmpty())
- {
- if (viewerInput instanceof Resource)
- {
- resource = (Resource)viewerInput;
- }
- }
- else if (ssel.size() == 1)
- {
- Object element = ssel.getFirstElement();
- if (element instanceof Resource)
- {
- resource = (Resource)element;
- }
- else if (element instanceof EObject)
- {
- resource = ((EObject)element).eResource();
- }
- }
-
- if (resource != null)
- {
- if (object instanceof InternalCDOObject)
- {
- object = ((InternalCDOObject)object).cdoInternalInstance();
- }
-
- resource.getContents().add(object);
- }
- }
- }
-
- /**
- * Adapter that provides the current EditingDomain
- *
- * @since 2.0
- */
- private class EditingDomainProviderAdapter implements Adapter, IEditingDomainProvider
- {
- public boolean isAdapterForType(Object type)
- {
- return type == IEditingDomainProvider.class;
- }
-
- public EditingDomain getEditingDomain()
- {
- return editingDomain;
- }
-
- public Notifier getTarget()
- {
- return null;
- }
-
- public void notifyChanged(Notification notification)
- {
- }
-
- public void setTarget(Notifier newTarget)
- {
- }
- }
-}
+/*
+ * 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.CDOObject;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.common.model.CDOPackageInfo;
+import org.eclipse.emf.cdo.common.model.CDOPackageRegistry;
+import org.eclipse.emf.cdo.common.model.CDOPackageUnit;
+import org.eclipse.emf.cdo.common.model.EMFUtil;
+import org.eclipse.emf.cdo.common.util.CDOCommonUtil;
+import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.emf.cdo.internal.ui.bundle.OM;
+import org.eclipse.emf.cdo.internal.ui.dialogs.BulkAddDialog;
+import org.eclipse.emf.cdo.internal.ui.dialogs.RollbackTransactionDialog;
+import org.eclipse.emf.cdo.internal.ui.messages.Messages;
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.ui.CDOEditorInput;
+import org.eclipse.emf.cdo.ui.CDOEventHandler;
+import org.eclipse.emf.cdo.ui.CDOLabelProvider;
+import org.eclipse.emf.cdo.ui.shared.SharedIcons;
+import org.eclipse.emf.cdo.util.CDOURIUtil;
+import org.eclipse.emf.cdo.util.CDOUtil;
+import org.eclipse.emf.cdo.view.CDOView;
+import org.eclipse.emf.cdo.view.CDOViewTargetChangedEvent;
+
+import org.eclipse.emf.internal.cdo.view.CDOStateMachine;
+
+import org.eclipse.net4j.util.event.IEvent;
+import org.eclipse.net4j.util.event.IListener;
+import org.eclipse.net4j.util.transaction.TransactionException;
+import org.eclipse.net4j.util.ui.UIUtil;
+import org.eclipse.net4j.util.ui.actions.LongRunningAction;
+import org.eclipse.net4j.util.ui.actions.SafeAction;
+
+import org.eclipse.emf.common.command.BasicCommandStack;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CommandStack;
+import org.eclipse.emf.common.command.CommandStackListener;
+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.Notifier;
+import org.eclipse.emf.common.ui.MarkerHelper;
+import org.eclipse.emf.common.ui.editor.ProblemEditorPart;
+import org.eclipse.emf.common.ui.viewer.IViewerProvider;
+import org.eclipse.emf.common.util.BasicDiagnostic;
+import org.eclipse.emf.common.util.Diagnostic;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EValidator;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.util.EContentAdapter;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.edit.EMFEditPlugin;
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.edit.domain.IEditingDomainProvider;
+import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator;
+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;
+import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory;
+import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor;
+import org.eclipse.emf.edit.ui.celleditor.AdapterFactoryTreeEditor;
+import org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter;
+import org.eclipse.emf.edit.ui.dnd.LocalTransfer;
+import org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;
+import org.eclipse.emf.edit.ui.provider.UnwrappingSelectionProvider;
+import org.eclipse.emf.edit.ui.util.EditUIMarkerHelper;
+import org.eclipse.emf.edit.ui.util.EditUIUtil;
+import org.eclipse.emf.edit.ui.view.ExtendedPropertySheetPage;
+import org.eclipse.emf.spi.cdo.InternalCDOObject;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IResourceDeltaVisitor;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IStatusLineManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.DecoratingLabelProvider;
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.jface.viewers.ILabelDecorator;
+import org.eclipse.jface.viewers.ILabelProvider;
+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.ITreeViewerListener;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.jface.viewers.TreeExpansionEvent;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CTabFolder;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.events.ControlAdapter;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Scale;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.IPartListener;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.WorkspaceModifyOperation;
+import org.eclipse.ui.dialogs.SaveAsDialog;
+import org.eclipse.ui.ide.IGotoMarker;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.part.MultiPageEditorPart;
+import org.eclipse.ui.views.contentoutline.ContentOutline;
+import org.eclipse.ui.views.contentoutline.ContentOutlinePage;
+import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
+import org.eclipse.ui.views.properties.IPropertySheetPage;
+import org.eclipse.ui.views.properties.PropertySheet;
+import org.eclipse.ui.views.properties.PropertySheetPage;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.InvocationTargetException;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.EventObject;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author Eike Stepper
+ * @generated
+ */
+public class CDOEditor extends MultiPageEditorPart implements IEditingDomainProvider, ISelectionProvider,
+ IMenuListener, IViewerProvider, IGotoMarker
+{
+ /**
+ * <!-- 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 EDITOR_ID = "org.eclipse.emf.cdo.ui.CDOEditor"; //$NON-NLS-1$
+
+ /**
+ * @ADDED
+ */
+ private static final Object EMPTY_INPUT = new Object();
+
+ /**
+ * @ADDED
+ */
+ protected CDOView view;
+
+ /**
+ * @ADDED
+ */
+ protected Object viewerInput;
+
+ /**
+ * @ADDED
+ */
+ protected CDOEventHandler eventHandler;
+
+ /**
+ * This keeps track of the editing domain that is used to track all changes to the model. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected AdapterFactoryEditingDomain editingDomain;
+
+ /**
+ * This is the one adapter factory used for providing views of the model. <!-- begin-user-doc --> <!-- end-user-doc
+ * -->
+ *
+ * @generated
+ */
+ protected ComposedAdapterFactory adapterFactory;
+
+ /**
+ * This is the content outline page. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected IContentOutlinePage contentOutlinePage;
+
+ /**
+ * This is a kludge... <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected IStatusLineManager contentOutlineStatusLineManager;
+
+ /**
+ * This is the content outline page's viewer. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected TreeViewer contentOutlineViewer;
+
+ /**
+ * This is the property sheet page. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected PropertySheetPage propertySheetPage;
+
+ /**
+ * This is the viewer that shadows the selection in the content outline. The parent relation must be correctly defined
+ * for this to work. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected TreeViewer selectionViewer;
+
+ /**
+ * This keeps track of the active content viewer, which may be either one of the viewers in the pages or the content
+ * outline viewer. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected Viewer currentViewer;
+
+ /**
+ * This listens to which ever viewer is active. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected ISelectionChangedListener selectionChangedListener;
+
+ /**
+ * This keeps track of all the {@link org.eclipse.jface.viewers.ISelectionChangedListener}s that are listening to this
+ * editor. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected Collection<ISelectionChangedListener> selectionChangedListeners = new ArrayList<ISelectionChangedListener>();
+
+ /**
+ * This keeps track of the selection of the editor as a whole. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected ISelection editorSelection = StructuredSelection.EMPTY;
+
+ /**
+ * The MarkerHelper is responsible for creating workspace resource markers presented in Eclipse's Problems View. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected MarkerHelper markerHelper = new EditUIMarkerHelper();
+
+ /**
+ * This listens for when the outline becomes active <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected IPartListener partListener = new IPartListener()
+ {
+ public void partActivated(IWorkbenchPart p)
+ {
+ if (p instanceof ContentOutline)
+ {
+ if (((ContentOutline)p).getCurrentPage() == contentOutlinePage)
+ {
+ getActionBarContributor().setActiveEditor(CDOEditor.this);
+
+ setCurrentViewer(contentOutlineViewer);
+ }
+ }
+ else if (p instanceof PropertySheet)
+ {
+ if (((PropertySheet)p).getCurrentPage() == propertySheetPage)
+ {
+ getActionBarContributor().setActiveEditor(CDOEditor.this);
+ handleActivate();
+ }
+ }
+ else if (p == CDOEditor.this)
+ {
+ handleActivate();
+ }
+ }
+
+ public void partBroughtToTop(IWorkbenchPart p)
+ {
+ // Ignore.
+ }
+
+ public void partClosed(IWorkbenchPart p)
+ {
+ // Ignore.
+ }
+
+ public void partDeactivated(IWorkbenchPart p)
+ {
+ // Ignore.
+ }
+
+ public void partOpened(IWorkbenchPart p)
+ {
+ // Ignore.
+ }
+ };
+
+ /**
+ * Resources that have been removed since last activation. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected Collection<Resource> removedResources = new ArrayList<Resource>();
+
+ /**
+ * Resources that have been changed since last activation. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected Collection<Resource> changedResources = new ArrayList<Resource>();
+
+ /**
+ * Resources that have been saved. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected Collection<Resource> savedResources = new ArrayList<Resource>();
+
+ /**
+ * Map to store the diagnostic associated with a resource. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected Map<Resource, Diagnostic> resourceToDiagnosticMap = new LinkedHashMap<Resource, Diagnostic>();
+
+ /**
+ * Controls whether the problem indication should be updated. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected boolean updateProblemIndication = true;
+
+ /**
+ * Adapter used to update the problem indication when resources are demanded loaded. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected EContentAdapter problemIndicationAdapter = new EContentAdapter()
+ {
+ @Override
+ public void notifyChanged(Notification notification)
+ {
+ if (notification.getNotifier() instanceof Resource)
+ {
+ switch (notification.getFeatureID(Resource.class))
+ {
+ case Resource.RESOURCE__IS_LOADED:
+ case Resource.RESOURCE__ERRORS:
+ case Resource.RESOURCE__WARNINGS:
+ {
+ Resource resource = (Resource)notification.getNotifier();
+ Diagnostic diagnostic = analyzeResourceProblems(resource, null);
+ if (diagnostic.getSeverity() != Diagnostic.OK)
+ {
+ resourceToDiagnosticMap.put(resource, diagnostic);
+ }
+ else
+ {
+ resourceToDiagnosticMap.remove(resource);
+ }
+
+ if (updateProblemIndication)
+ {
+ getSite().getShell().getDisplay().asyncExec(new Runnable()
+ {
+ public void run()
+ {
+ updateProblemIndication();
+ }
+ });
+ }
+ break;
+ }
+ }
+ }
+ else
+ {
+ super.notifyChanged(notification);
+ }
+ }
+
+ @Override
+ protected void setTarget(Resource target)
+ {
+ basicSetTarget(target);
+ }
+
+ @Override
+ protected void unsetTarget(Resource target)
+ {
+ basicUnsetTarget(target);
+ }
+ };
+
+ /**
+ * This listens for workspace changes. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected IResourceChangeListener resourceChangeListener = new IResourceChangeListener()
+ {
+ public void resourceChanged(IResourceChangeEvent event)
+ {
+ IResourceDelta delta = event.getDelta();
+ try
+ {
+ class ResourceDeltaVisitor implements IResourceDeltaVisitor
+ {
+ protected ResourceSet resourceSet = editingDomain.getResourceSet();
+
+ protected Collection<Resource> changedResources = new ArrayList<Resource>();
+
+ protected Collection<Resource> removedResources = new ArrayList<Resource>();
+
+ public boolean visit(IResourceDelta delta)
+ {
+ if (delta.getResource().getType() == IResource.FILE)
+ {
+ if (delta.getKind() == IResourceDelta.REMOVED || delta.getKind() == IResourceDelta.CHANGED
+ && delta.getFlags() != IResourceDelta.MARKERS)
+ {
+ Resource resource = resourceSet.getResource(
+ URI.createPlatformResourceURI(delta.getFullPath().toString(), true), false);
+ if (resource != null)
+ {
+ if (delta.getKind() == IResourceDelta.REMOVED)
+ {
+ removedResources.add(resource);
+ }
+ else if (!savedResources.remove(resource))
+ {
+ changedResources.add(resource);
+ }
+ }
+ }
+ }
+
+ return true;
+ }
+
+ public Collection<Resource> getChangedResources()
+ {
+ return changedResources;
+ }
+
+ public Collection<Resource> getRemovedResources()
+ {
+ return removedResources;
+ }
+ }
+
+ final ResourceDeltaVisitor visitor = new ResourceDeltaVisitor();
+ delta.accept(visitor);
+
+ if (!visitor.getRemovedResources().isEmpty())
+ {
+ getSite().getShell().getDisplay().asyncExec(new Runnable()
+ {
+ public void run()
+ {
+ removedResources.addAll(visitor.getRemovedResources());
+ if (!isDirty())
+ {
+ getSite().getPage().closeEditor(CDOEditor.this, false);
+ }
+ }
+ });
+ }
+
+ if (!visitor.getChangedResources().isEmpty())
+ {
+ getSite().getShell().getDisplay().asyncExec(new Runnable()
+ {
+ public void run()
+ {
+ changedResources.addAll(visitor.getChangedResources());
+ if (getSite().getPage().getActiveEditor() == CDOEditor.this)
+ {
+ handleActivate();
+ }
+ }
+ });
+ }
+ }
+ catch (CoreException exception)
+ {
+ PluginDelegator.INSTANCE.log(exception);
+ }
+ }
+ };
+
+ private IListener viewTargetListener = new IListener()
+ {
+ private CDOID inputID;
+
+ public void notifyEvent(IEvent event)
+ {
+ if (event instanceof CDOViewTargetChangedEvent)
+ {
+ Object input = selectionViewer.getInput();
+ if (input == EMPTY_INPUT)
+ {
+ if (inputID != null)
+ {
+ try
+ {
+ CDOObject object = view.getObject(inputID);
+ selectionViewer.setInput(object);
+ inputID = null;
+ }
+ catch (Exception ex)
+ {
+ // Ignore
+ }
+ }
+ }
+ else if (input instanceof EObject)
+ {
+ CDOObject object = CDOUtil.getCDOObject((EObject)input);
+ if (object.cdoInvalid())
+ {
+ inputID = object.cdoID();
+ selectionViewer.setInput(EMPTY_INPUT);
+ }
+ }
+ }
+ }
+ };
+
+ /**
+ * Handles activation of the editor or it's associated views. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected void handleActivateGen()
+ {
+ // Recompute the read only state.
+ //
+ if (editingDomain.getResourceToReadOnlyMap() != null)
+ {
+ editingDomain.getResourceToReadOnlyMap().clear();
+
+ // Refresh any actions that may become enabled or disabled.
+ //
+ setSelection(getSelection());
+ }
+
+ if (!removedResources.isEmpty())
+ {
+ if (handleDirtyConflict())
+ {
+ getSite().getPage().closeEditor(CDOEditor.this, false);
+ }
+ else
+ {
+ removedResources.clear();
+ changedResources.clear();
+ savedResources.clear();
+ }
+ }
+ else if (!changedResources.isEmpty())
+ {
+ changedResources.removeAll(savedResources);
+ handleChangedResources();
+ changedResources.clear();
+ savedResources.clear();
+ }
+ }
+
+ /**
+ * Handles activation of the editor or it's associated views. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated NOT
+ */
+ protected void handleActivate()
+ {
+ handleActivateGen();
+ setCurrentViewer(selectionViewer);
+ }
+
+ /**
+ * Handles what to do with changed resources on activation. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected void handleChangedResources()
+ {
+ if (!changedResources.isEmpty() && (!isDirty() || handleDirtyConflict()))
+ {
+ if (isDirty())
+ {
+ changedResources.addAll(editingDomain.getResourceSet().getResources());
+ }
+ editingDomain.getCommandStack().flush();
+
+ updateProblemIndication = false;
+ for (Resource resource : changedResources)
+ {
+ if (resource.isLoaded())
+ {
+ resource.unload();
+ try
+ {
+ resource.load(Collections.EMPTY_MAP);
+ }
+ catch (IOException exception)
+ {
+ if (!resourceToDiagnosticMap.containsKey(resource))
+ {
+ resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception));
+ }
+ }
+ }
+ }
+
+ if (AdapterFactoryEditingDomain.isStale(editorSelection))
+ {
+ setSelection(StructuredSelection.EMPTY);
+ }
+
+ updateProblemIndication = true;
+ updateProblemIndication();
+ }
+ }
+
+ /**
+ * Updates the problems indication with the information described in the specified diagnostic. <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected void updateProblemIndication()
+ {
+ if (updateProblemIndication)
+ {
+ BasicDiagnostic diagnostic = new BasicDiagnostic(Diagnostic.OK, "org.eclipse.emf.cdo.ui", 0, null,
+ new Object[] { editingDomain.getResourceSet() });
+ for (Diagnostic childDiagnostic : resourceToDiagnosticMap.values())
+ {
+ if (childDiagnostic.getSeverity() != Diagnostic.OK)
+ {
+ diagnostic.add(childDiagnostic);
+ }
+ }
+
+ int lastEditorPage = getPageCount() - 1;
+ if (lastEditorPage >= 0 && getEditor(lastEditorPage) instanceof ProblemEditorPart)
+ {
+ ((ProblemEditorPart)getEditor(lastEditorPage)).setDiagnostic(diagnostic);
+ if (diagnostic.getSeverity() != Diagnostic.OK)
+ {
+ setActivePage(lastEditorPage);
+ }
+ }
+ else if (diagnostic.getSeverity() != Diagnostic.OK)
+ {
+ ProblemEditorPart problemEditorPart = new ProblemEditorPart();
+ problemEditorPart.setDiagnostic(diagnostic);
+ problemEditorPart.setMarkerHelper(markerHelper);
+ try
+ {
+ addPage(++lastEditorPage, problemEditorPart, getEditorInput());
+ setPageText(lastEditorPage, problemEditorPart.getPartName());
+ setActivePage(lastEditorPage);
+ showTabs();
+ }
+ catch (PartInitException exception)
+ {
+ PluginDelegator.INSTANCE.log(exception);
+ }
+ }
+
+ if (markerHelper.hasMarkers(editingDomain.getResourceSet()))
+ {
+ markerHelper.deleteMarkers(editingDomain.getResourceSet());
+ if (diagnostic.getSeverity() != Diagnostic.OK)
+ {
+ try
+ {
+ markerHelper.createMarkers(diagnostic);
+ }
+ catch (CoreException exception)
+ {
+ PluginDelegator.INSTANCE.log(exception);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Shows a dialog that asks if conflicting changes should be discarded. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected boolean handleDirtyConflict()
+ {
+ return MessageDialog.openQuestion(getSite().getShell(), getString("_UI_FileConflict_label"),
+ getString("_WARN_FileConflict"));
+ }
+
+ /**
+ * This creates a model editor. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public CDOEditor()
+ {
+ super();
+ initializeEditingDomain();
+ }
+
+ /**
+ * This sets up the editing domain for the model editor. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected void initializeEditingDomainGen()
+ {
+ // Create an adapter factory that yields item providers.
+ //
+ adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
+
+ adapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory());
+ adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());
+
+ // Create the command stack that will notify this editor as commands are executed.
+ //
+ BasicCommandStack commandStack = new BasicCommandStack();
+
+ // Add a listener to set the most recent command's affected objects to be the selection of the viewer with focus.
+ //
+ commandStack.addCommandStackListener(new CommandStackListener()
+ {
+ public void commandStackChanged(final EventObject event)
+ {
+ getContainer().getDisplay().asyncExec(new Runnable()
+ {
+ public void run()
+ {
+ firePropertyChange(IEditorPart.PROP_DIRTY);
+
+ // Try to select the affected objects.
+ //
+ Command mostRecentCommand = ((CommandStack)event.getSource()).getMostRecentCommand();
+ if (mostRecentCommand != null)
+ {
+ setSelectionToViewer(mostRecentCommand.getAffectedObjects());
+ }
+ if (propertySheetPage != null && !propertySheetPage.getControl().isDisposed())
+ {
+ propertySheetPage.refresh();
+ }
+ }
+ });
+ }
+ });
+
+ // Create the editing domain with a special command stack.
+ //
+ editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, new HashMap<Resource, Boolean>());
+ }
+
+ /**
+ * @ADDED
+ */
+ protected void initializeEditingDomain()
+ {
+ ComposedAdapterFactory.Descriptor.Registry registry = EMFEditPlugin.getComposedAdapterFactoryDescriptorRegistry();
+ adapterFactory = new ComposedAdapterFactory(registry);
+ adapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory());
+ adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());
+ }
+
+ /**
+ * This is here for the listener to be able to call it. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected void firePropertyChange(int action)
+ {
+ super.firePropertyChange(action);
+ }
+
+ /**
+ * This sets the selection into whichever viewer is active. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void setSelectionToViewer(Collection<?> collection)
+ {
+ final Collection<?> theSelection = collection;
+ // Make sure it's okay.
+ //
+ if (theSelection != null && !theSelection.isEmpty())
+ {
+ Runnable runnable = new Runnable()
+ {
+ public void run()
+ {
+ // Try to select the items in the current content viewer of the editor.
+ //
+ if (currentViewer != null)
+ {
+ currentViewer.setSelection(new StructuredSelection(theSelection.toArray()), true);
+ }
+ }
+ };
+ getSite().getShell().getDisplay().asyncExec(runnable);
+ }
+ }
+
+ /**
+ * This returns the editing domain as required by the {@link IEditingDomainProvider} interface. This is important for
+ * implementing the static methods of {@link AdapterFactoryEditingDomain} and for supporting
+ * {@link org.eclipse.emf.edit.ui.action.CommandAction}. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EditingDomain getEditingDomain()
+ {
+ return editingDomain;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public class ReverseAdapterFactoryContentProvider extends AdapterFactoryContentProvider
+ {
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public ReverseAdapterFactoryContentProvider(AdapterFactory adapterFactory)
+ {
+ super(adapterFactory);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public Object[] getElements(Object object)
+ {
+ Object parent = super.getParent(object);
+ return (parent == null ? Collections.EMPTY_SET : Collections.singleton(parent)).toArray();
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public Object[] getChildren(Object object)
+ {
+ Object parent = super.getParent(object);
+ return (parent == null ? Collections.EMPTY_SET : Collections.singleton(parent)).toArray();
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public boolean hasChildren(Object object)
+ {
+ Object parent = super.getParent(object);
+ return parent != null;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public Object getParent(Object object)
+ {
+ return null;
+ }
+ }
+
+ /**
+ * This makes sure that one content viewer, either for the current page or the outline view, if it has focus, is the
+ * current one. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void setCurrentViewer(Viewer viewer)
+ {
+ // If it is changing...
+ //
+ if (currentViewer != viewer)
+ {
+ if (selectionChangedListener == null)
+ {
+ // Create the listener on demand.
+ //
+ selectionChangedListener = new ISelectionChangedListener()
+ {
+ // This just notifies those things that are affected by the section.
+ //
+ public void selectionChanged(SelectionChangedEvent selectionChangedEvent)
+ {
+ setSelection(selectionChangedEvent.getSelection());
+ }
+ };
+ }
+
+ // Stop listening to the old one.
+ //
+ if (currentViewer != null)
+ {
+ currentViewer.removeSelectionChangedListener(selectionChangedListener);
+ }
+
+ // Start listening to the new one.
+ //
+ if (viewer != null)
+ {
+ viewer.addSelectionChangedListener(selectionChangedListener);
+ }
+
+ // Remember it.
+ //
+ currentViewer = viewer;
+
+ // Set the editors selection based on the current viewer's selection.
+ //
+ setSelection(currentViewer == null ? StructuredSelection.EMPTY : currentViewer.getSelection());
+ }
+ }
+
+ /**
+ * This returns the viewer as required by the {@link IViewerProvider} interface. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ public Viewer getViewer()
+ {
+ return currentViewer;
+ }
+
+ /**
+ * This creates a context menu for the viewer and adds a listener as well registering the menu for extension. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected void createContextMenuFor(StructuredViewer viewer)
+ {
+ MenuManager contextMenu = new MenuManager("#PopUp");
+ contextMenu.add(new Separator("additions"));
+ contextMenu.setRemoveAllWhenShown(true);
+ contextMenu.addMenuListener(this);
+ Menu menu = contextMenu.createContextMenu(viewer.getControl());
+ viewer.getControl().setMenu(menu);
+ getSite().registerContextMenu(contextMenu, new UnwrappingSelectionProvider(viewer));
+
+ int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
+ Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance() };
+ viewer.addDragSupport(dndOperations, transfers, new ViewerDragAdapter(viewer));
+ viewer.addDropSupport(dndOperations, transfers, new EditingDomainViewerDropAdapter(editingDomain, viewer));
+ }
+
+ /**
+ * @ADDED
+ */
+ public CDOView getView()
+ {
+ return view;
+ }
+
+ /**
+ * This is the method called to load a resource into the editing domain's resource set based on the editor's input.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void createModelGen()
+ {
+ URI resourceURI = EditUIUtil.getURI(getEditorInput());
+ Exception exception = null;
+ Resource resource = null;
+ try
+ {
+ // Load the resource through the editing domain.
+ //
+ resource = editingDomain.getResourceSet().getResource(resourceURI, true);
+ }
+ catch (Exception e)
+ {
+ exception = e;
+ resource = editingDomain.getResourceSet().getResource(resourceURI, false);
+ }
+
+ Diagnostic diagnostic = analyzeResourceProblems(resource, exception);
+ if (diagnostic.getSeverity() != Diagnostic.OK)
+ {
+ resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception));
+ }
+ editingDomain.getResourceSet().eAdapters().add(problemIndicationAdapter);
+ }
+
+ /**
+ * @ADDED
+ */
+ public void createModel()
+ {
+ try
+ {
+ CDOEditorInput editorInput = (CDOEditorInput)getEditorInput();
+ view = editorInput.getView();
+ view.addListener(viewTargetListener);
+
+ // TODO Check if a CommandStack is needed
+ BasicCommandStack commandStack = new BasicCommandStack();
+ commandStack.addCommandStackListener(new CommandStackListener()
+ {
+ public void commandStackChanged(final EventObject event)
+ {
+ try
+ {
+ if (getContainer() != null && !getContainer().isDisposed())
+ {
+ getContainer().getDisplay().asyncExec(new Runnable()
+ {
+ public void run()
+ {
+ Command mostRecentCommand = ((CommandStack)event.getSource()).getMostRecentCommand();
+ if (mostRecentCommand != null)
+ {
+ setSelectionToViewer(mostRecentCommand.getAffectedObjects());
+ }
+
+ if (propertySheetPage != null && !propertySheetPage.getControl().isDisposed())
+ {
+ propertySheetPage.refresh();
+ }
+ }
+ });
+ }
+ }
+ catch (RuntimeException ex)
+ {
+ OM.LOG.error(ex);
+ }
+ }
+ });
+
+ ResourceSet resourceSet = view.getResourceSet();
+ editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, resourceSet);
+
+ // This adapter provides the EditingDomain of the Editor
+ resourceSet.eAdapters().add(new EditingDomainProviderAdapter());
+
+ String resourcePath = editorInput.getResourcePath();
+ if (resourcePath == null)
+ {
+ viewerInput = resourceSet;
+ }
+ else
+ {
+ URI resourceURI = CDOURIUtil.createResourceURI(view, resourcePath);
+ viewerInput = resourceSet.getResource(resourceURI, true);
+ }
+
+ // resourceSet.eAdapters().add(problemIndicationAdapter);
+ }
+ catch (RuntimeException ex)
+ {
+ OM.LOG.error(ex);
+ throw ex;
+ }
+ }
+
+ /**
+ * Returns a diagnostic describing the errors and warnings listed in the resource and the specified exception (if
+ * any). <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public Diagnostic analyzeResourceProblems(Resource resource, Exception exception)
+ {
+ if (!resource.getErrors().isEmpty() || !resource.getWarnings().isEmpty())
+ {
+ BasicDiagnostic basicDiagnostic = new BasicDiagnostic(Diagnostic.ERROR, "org.eclipse.emf.cdo.ui", 0, getString(
+ "_UI_CreateModelError_message", resource.getURI()), new Object[] { exception == null ? (Object)resource
+ : exception });
+ basicDiagnostic.merge(EcoreUtil.computeDiagnostic(resource, true));
+ return basicDiagnostic;
+ }
+ else if (exception != null)
+ {
+ return new BasicDiagnostic(Diagnostic.ERROR, "org.eclipse.emf.cdo.ui", 0, getString(
+ "_UI_CreateModelError_message", resource.getURI()), new Object[] { exception });
+ }
+ else
+ {
+ return Diagnostic.OK_INSTANCE;
+ }
+ }
+
+ /**
+ * This is the method used by the framework to install your own controls. <!-- begin-user-doc --> <!-- end-user-doc
+ * -->
+ *
+ * @generated
+ */
+ public void createPagesGen()
+ {
+ // Creates the model from the editor input
+ //
+ createModel();
+
+ // Only creates the other pages if there is something that can be edited
+ //
+ if (!getEditingDomain().getResourceSet().getResources().isEmpty())
+ {
+ // Create a page for the selection tree view.
+ //
+ Tree tree = new Tree(getContainer(), SWT.MULTI);
+ selectionViewer = new TreeViewer(tree);
+ setCurrentViewer(selectionViewer);
+
+ selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
+ selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
+ selectionViewer.setInput(editingDomain.getResourceSet());
+ selectionViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true);
+
+ new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory);
+
+ createContextMenuFor(selectionViewer);
+ int pageIndex = addPage(tree);
+ setPageText(pageIndex, getString("_UI_SelectionPage_label"));
+
+ getSite().getShell().getDisplay().asyncExec(new Runnable()
+ {
+ public void run()
+ {
+ setActivePage(0);
+ }
+ });
+ }
+
+ // Ensures that this editor will only display the page's tab
+ // area if there are more than one page
+ //
+ getContainer().addControlListener(new ControlAdapter()
+ {
+ boolean guard = false;
+
+ @Override
+ public void controlResized(ControlEvent event)
+ {
+ if (!guard)
+ {
+ guard = true;
+ hideTabs();
+ guard = false;
+ }
+ }
+ });
+
+ getSite().getShell().getDisplay().asyncExec(new Runnable()
+ {
+ public void run()
+ {
+ updateProblemIndication();
+ }
+ });
+ }
+
+ /**
+ * @ADDED
+ */
+ @Override
+ public void createPages()
+ {
+ try
+ {
+ // Creates the model from the editor input
+ createModel();
+
+ // Create a page for the selection tree view.
+ getContainer().setLayoutData(UIUtil.createGridData());
+ getContainer().setLayout(UIUtil.createGridLayout(1));
+ Composite composite = UIUtil.createGridComposite(getContainer(), 1);
+ composite.setLayoutData(UIUtil.createGridData());
+ composite.setLayout(UIUtil.createGridLayout(1));
+ Tree tree = new Tree(composite, SWT.MULTI | SWT.BORDER);
+ tree.setLayoutData(UIUtil.createGridData());
+
+ final Set<CDOID> expandedIDs = new HashSet<CDOID>();
+ final boolean sliderAllowed = view.isReadOnly() && view.getSession().getRepositoryInfo().isSupportingAudits();
+ if (sliderAllowed)
+ {
+ createTimeSlider(composite, expandedIDs);
+ }
+
+ selectionViewer = new TreeViewer(tree)
+ {
+ @Override
+ public void setSelection(ISelection selection, boolean reveal)
+ {
+ if (sliderAllowed && selection instanceof IStructuredSelection)
+ {
+ IStructuredSelection ssel = (IStructuredSelection)selection;
+ for (Iterator<?> it = ssel.iterator(); it.hasNext();)
+ {
+ Object object = it.next();
+ if (object instanceof EObject)
+ {
+ CDOObject cdoObject = CDOUtil.getCDOObject((EObject)object);
+ switch (cdoObject.cdoState())
+ {
+ case TRANSIENT:
+ case PREPARED:
+ case INVALID:
+ case INVALID_CONFLICT:
+ it.remove();
+ }
+ }
+ }
+ }
+
+ super.setSelection(selection, reveal);
+ }
+ };
+
+ selectionViewer.addTreeListener(new ITreeViewerListener()
+ {
+ public void treeExpanded(TreeExpansionEvent event)
+ {
+ CDOID id = getID(event.getElement());
+ if (id != null)
+ {
+ expandedIDs.add(id);
+ }
+ }
+
+ public void treeCollapsed(TreeExpansionEvent event)
+ {
+ CDOID id = getID(event.getElement());
+ if (id != null)
+ {
+ expandedIDs.remove(id);
+ }
+ }
+
+ private CDOID getID(Object element)
+ {
+ if (element instanceof EObject)
+ {
+ CDOObject object = CDOUtil.getCDOObject((EObject)element);
+ return object.cdoID();
+ }
+
+ return null;
+ }
+ });
+
+ setCurrentViewer(selectionViewer);
+
+ selectionViewer.setContentProvider(createContentProvider());
+ selectionViewer.setLabelProvider(createLabelProvider());
+ selectionViewer.setInput(viewerInput);
+
+ new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory);
+
+ createContextMenuFor(selectionViewer);
+ int pageIndex = addPage(composite);
+ setPageText(pageIndex, getString("_UI_SelectionPage_label")); //$NON-NLS-1$
+
+ setActivePage(0);
+
+ // Ensures that this editor will only display the page's tab
+ // area if there are more than one page
+ getContainer().addControlListener(new ControlAdapter()
+ {
+ boolean guard = false;
+
+ @Override
+ public void controlResized(ControlEvent event)
+ {
+ if (!guard)
+ {
+ guard = true;
+ hideTabs();
+ guard = false;
+ }
+ }
+ });
+
+ updateProblemIndication();
+ eventHandler = new CDOEventHandler(view, selectionViewer)
+ {
+ @Override
+ protected void objectInvalidated(InternalCDOObject cdoObject)
+ {
+ if (CDOUtil.isLegacyObject(cdoObject))
+ {
+ CDOStateMachine.INSTANCE.read(cdoObject);
+ }
+ }
+
+ @Override
+ protected void viewConflict(final CDOObject conflictingObject, boolean firstConflict)
+ {
+ refreshViewer(conflictingObject);
+ }
+
+ @Override
+ protected void viewClosed()
+ {
+ closeEditor();
+ }
+
+ @Override
+ protected void viewDirtyStateChanged()
+ {
+ if (viewerInput instanceof CDOResource)
+ {
+ CDOResource resource = (CDOResource)viewerInput;
+ if (!view.isObjectRegistered(resource.cdoID()))
+ {
+ closeEditor();
+ return;
+ }
+ }
+
+ fireDirtyPropertyChange();
+ }
+ };
+ }
+ catch (RuntimeException ex)
+ {
+ OM.LOG.error(ex);
+ throw ex;
+ }
+
+ getViewer().getControl().addMouseListener(new MouseListener()
+ {
+ public void mouseDoubleClick(MouseEvent e)
+ {
+ try
+ {
+ getSite().getPage().showView("org.eclipse.ui.views.PropertySheet"); //$NON-NLS-1$
+ }
+ catch (PartInitException ex)
+ {
+ OM.LOG.error(ex);
+ }
+ }
+
+ public void mouseDown(MouseEvent e)
+ {
+ // do nothing
+ }
+
+ public void mouseUp(MouseEvent e)
+ {
+ // do nothing
+ }
+ });
+ }
+
+ /**
+ * @ADDED
+ */
+ protected void createTimeSlider(final Composite composite, final Set<CDOID> expandedIDs)
+ {
+ final CDOSession session = view.getSession();
+ final long startTimeStamp = session.getRepositoryInfo().getCreationTime();
+ final long endTimeStamp = session.getLastUpdateTime();
+
+ final int MIN = 0;
+ final int MAX = 100000;
+ final long absoluteTimeWindowLength = endTimeStamp - startTimeStamp;
+ final long scaleFactor = MAX - MIN;
+ final double stepSize = (double)absoluteTimeWindowLength / (double)scaleFactor;
+
+ final Group group = new Group(composite, SWT.NONE);
+ group.setLayoutData(UIUtil.createEmptyGridData());
+ group.setLayout(new FillLayout());
+ group.setText(CDOCommonUtil.formatTimeStamp(endTimeStamp));
+ group.setVisible(false);
+
+ final Scale scale = new Scale(group, SWT.HORIZONTAL);
+ scale.setMinimum(MIN);
+ scale.setMaximum(MAX);
+ scale.setSelection(MAX);
+
+ scale.addSelectionListener(new SelectionAdapter()
+ {
+ @Override
+ public void widgetSelected(SelectionEvent e)
+ {
+ long value = scale.getSelection();
+ long timeStamp = startTimeStamp + Math.round(stepSize * value);
+
+ group.setText(CDOCommonUtil.formatTimeStamp(timeStamp));
+
+ view.setTimeStamp(timeStamp);
+ selectionViewer.refresh();
+ setExpandedStates();
+ }
+
+ private void setExpandedStates()
+ {
+ for (CDOID id : expandedIDs)
+ {
+ try
+ {
+ CDOObject object = view.getObject(id);
+ selectionViewer.setExpandedState(object, true);
+ }
+ catch (Exception ex)
+ {
+ // Ignore
+ }
+ }
+ }
+ });
+
+ IAction action = new Action()
+ {
+ @Override
+ public void run()
+ {
+ if (group.isVisible())
+ {
+ group.setVisible(false);
+ group.setLayoutData(UIUtil.createEmptyGridData());
+ composite.layout();
+ }
+ else
+ {
+ group.setVisible(true);
+ group.setLayoutData(new GridData(SWT.FILL, 50, true, false));
+ composite.layout();
+ }
+ }
+ };
+
+ action.setEnabled(true);
+ action.setChecked(false);
+ action.setImageDescriptor(SharedIcons.getDescriptor(SharedIcons.ETOOL_SLIDER_ICON));
+ action.setToolTipText(Messages.getString("CDOEditor.1")); //$NON-NLS-1$
+ getActionBars().getToolBarManager().add(action);
+ }
+
+ /**
+ * @ADDED
+ */
+ protected IContentProvider createContentProvider()
+ {
+ return new AdapterFactoryContentProvider(adapterFactory);
+ }
+
+ /**
+ * @ADDED
+ */
+ protected ILabelProvider createLabelProvider()
+ {
+ return new DecoratingLabelProvider(new CDOLabelProvider(adapterFactory, view, selectionViewer),
+ createLabelDecorator());
+ }
+
+ /**
+ * @ADDED
+ */
+ protected ILabelDecorator createLabelDecorator()
+ {
+ return PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator();
+ }
+
+ /**
+ * If there is just one page in the multi-page editor part, this hides the single tab at the bottom. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated NOT
+ */
+ protected void hideTabs()
+ {
+ if (getPageCount() <= 1)
+ {
+ setPageText(0, ""); //$NON-NLS-1$
+ if (getContainer() != null && !getContainer().isDisposed() && getContainer() instanceof CTabFolder)
+ {
+ ((CTabFolder)getContainer()).setTabHeight(1);
+ Point point = getContainer().getSize();
+ getContainer().setSize(point.x, point.y + 6);
+ }
+ }
+ }
+
+ /**
+ * If there is more than one page in the multi-page editor part, this shows the tabs at the bottom. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated NOT
+ */
+ protected void showTabs()
+ {
+ if (getPageCount() > 1)
+ {
+ setPageText(0, getString("_UI_SelectionPage_label")); //$NON-NLS-1$
+ if (getContainer() != null && !getContainer().isDisposed() && getContainer() instanceof CTabFolder)
+ {
+ ((CTabFolder)getContainer()).setTabHeight(SWT.DEFAULT);
+ Point point = getContainer().getSize();
+ getContainer().setSize(point.x, point.y - 6);
+ }
+ }
+ }
+
+ /**
+ * This is used to track the active viewer. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected void pageChange(int pageIndex)
+ {
+ super.pageChange(pageIndex);
+
+ if (contentOutlinePage != null)
+ {
+ handleContentOutlineSelection(contentOutlinePage.getSelection());
+ }
+ }
+
+ /**
+ * This is how the framework determines which interfaces we implement. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @SuppressWarnings("rawtypes")
+ @Override
+ public Object getAdapter(Class key)
+ {
+ if (key.equals(IContentOutlinePage.class))
+ {
+ return showOutlineView() ? getContentOutlinePage() : null;
+ }
+ else if (key.equals(IPropertySheetPage.class))
+ {
+ return getPropertySheetPage();
+ }
+ else if (key.equals(IGotoMarker.class))
+ {
+ return this;
+ }
+ else
+ {
+ return super.getAdapter(key);
+ }
+ }
+
+ /**
+ * This accesses a cached version of the content outliner. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated NOT
+ */
+ public IContentOutlinePage getContentOutlinePage()
+ {
+ if (contentOutlinePage == null)
+ {
+ // The content outline is just a tree.
+ //
+ class MyContentOutlinePage extends ContentOutlinePage
+ {
+ @Override
+ public void createControl(Composite parent)
+ {
+ super.createControl(parent);
+ contentOutlineViewer = getTreeViewer();
+ contentOutlineViewer.addSelectionChangedListener(this);
+
+ // Set up the tree viewer.
+ //
+ contentOutlineViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
+ contentOutlineViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
+ contentOutlineViewer.setInput(viewerInput);
+
+ // Make sure our popups work.
+ //
+ createContextMenuFor(contentOutlineViewer);
+
+ if (!CDOUtil.getResources(editingDomain.getResourceSet()).isEmpty())
+ {
+ // Select the root object in the view.
+ //
+ contentOutlineViewer.setSelection(
+ new StructuredSelection(CDOUtil.getResources(editingDomain.getResourceSet()).get(0)), true);
+ }
+ }
+
+ @Override
+ public void makeContributions(IMenuManager menuManager, IToolBarManager toolBarManager,
+ IStatusLineManager statusLineManager)
+ {
+ super.makeContributions(menuManager, toolBarManager, statusLineManager);
+ contentOutlineStatusLineManager = statusLineManager;
+ }
+
+ @Override
+ public void setActionBars(IActionBars actionBars)
+ {
+ super.setActionBars(actionBars);
+ getActionBarContributor().shareGlobalActions(this, actionBars);
+ }
+ }
+
+ contentOutlinePage = new MyContentOutlinePage();
+
+ // Listen to selection so that we can handle it is a special way.
+ //
+ contentOutlinePage.addSelectionChangedListener(new ISelectionChangedListener()
+ {
+ // This ensures that we handle selections correctly.
+ //
+ public void selectionChanged(SelectionChangedEvent event)
+ {
+ handleContentOutlineSelection(event.getSelection());
+ }
+ });
+ }
+
+ return contentOutlinePage;
+ }
+
+ /**
+ * This accesses a cached version of the property sheet. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public IPropertySheetPage getPropertySheetPage()
+ {
+ if (propertySheetPage == null)
+ {
+ propertySheetPage = new ExtendedPropertySheetPage(editingDomain)
+ {
+ @Override
+ public void setSelectionToViewer(List<?> selection)
+ {
+ CDOEditor.this.setSelectionToViewer(selection);
+ CDOEditor.this.setFocus();
+ }
+
+ @Override
+ public void setActionBars(IActionBars actionBars)
+ {
+ super.setActionBars(actionBars);
+ getActionBarContributor().shareGlobalActions(this, actionBars);
+ }
+ };
+ propertySheetPage.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory));
+ }
+
+ return propertySheetPage;
+ }
+
+ /**
+ * This deals with how we want selection in the outliner to affect the other views. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ public void handleContentOutlineSelection(ISelection selection)
+ {
+ if (selectionViewer != null && !selection.isEmpty() && selection instanceof IStructuredSelection)
+ {
+ Iterator<?> selectedElements = ((IStructuredSelection)selection).iterator();
+ if (selectedElements.hasNext())
+ {
+ // Get the first selected element.
+ //
+ Object selectedElement = selectedElements.next();
+
+ ArrayList<Object> selectionList = new ArrayList<Object>();
+ selectionList.add(selectedElement);
+ while (selectedElements.hasNext())
+ {
+ selectionList.add(selectedElements.next());
+ }
+
+ // Set the selection to the widget.
+ //
+ selectionViewer.setSelection(new StructuredSelection(selectionList));
+ }
+ }
+ }
+
+ /**
+ * This is for implementing {@link IEditorPart} and simply tests the command stack. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated NOT
+ */
+ @Override
+ public boolean isDirty()
+ {
+ return view.isDirty();
+ }
+
+ /**
+ * This is for implementing {@link IEditorPart} and simply saves the model file. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ public void doSaveGen(IProgressMonitor progressMonitor)
+ {
+ // Save only resources that have actually changed.
+ //
+ final Map<Object, Object> saveOptions = new HashMap<Object, Object>();
+ saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER);
+
+ // Do the work within an operation because this is a long running activity that modifies the workbench.
+ //
+ WorkspaceModifyOperation operation = new WorkspaceModifyOperation()
+ {
+ // This is the method that gets invoked when the operation runs.
+ //
+ @Override
+ public void execute(IProgressMonitor monitor)
+ {
+ // Save the resources to the file system.
+ //
+ boolean first = true;
+ for (Resource resource : editingDomain.getResourceSet().getResources())
+ {
+ if ((first || !resource.getContents().isEmpty() || isPersisted(resource))
+ && !editingDomain.isReadOnly(resource))
+ {
+ try
+ {
+ long timeStamp = resource.getTimeStamp();
+ resource.save(saveOptions);
+ if (resource.getTimeStamp() != timeStamp)
+ {
+ savedResources.add(resource);
+ }
+ }
+ catch (Exception exception)
+ {
+ resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception));
+ }
+ first = false;
+ }
+ }
+ }
+ };
+
+ updateProblemIndication = false;
+ try
+ {
+ // This runs the options, and shows progress.
+ //
+ new ProgressMonitorDialog(getSite().getShell()).run(true, false, operation);
+
+ // Refresh the necessary state.
+ //
+ ((BasicCommandStack)editingDomain.getCommandStack()).saveIsDone();
+ firePropertyChange(IEditorPart.PROP_DIRTY);
+ }
+ catch (Exception exception)
+ {
+ // Something went wrong that shouldn't.
+ //
+ PluginDelegator.INSTANCE.log(exception);
+ }
+ updateProblemIndication = true;
+ updateProblemIndication();
+ }
+
+ /**
+ * @ADDED
+ */
+ @Override
+ public void doSave(IProgressMonitor progressMonitor)
+ {
+ Display.getCurrent().asyncExec(null);
+ // Save only resources that have actually changed.
+ //
+ final Map<Object, Object> saveOptions = new HashMap<Object, Object>();
+ saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER);
+
+ IRunnableWithProgress operation = new IRunnableWithProgress()
+ {
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException
+ {
+ boolean first = true;
+ EList<Resource> resources = CDOUtil.getResources(editingDomain.getResourceSet());
+ monitor.beginTask("", resources.size()); //$NON-NLS-1$
+ try
+ {
+ for (Resource resource : resources)
+ {
+ if ((first || !resource.getContents().isEmpty() || isPersisted(resource))
+ && !editingDomain.isReadOnly(resource))
+ {
+ try
+ {
+ savedResources.add(resource);
+ saveOptions.put(CDOResource.OPTION_SAVE_PROGRESS_MONITOR, new SubProgressMonitor(monitor, 1));
+ saveOptions.put(CDOResource.OPTION_SAVE_OVERRIDE_TRANSACTION, view);
+ resource.save(saveOptions);
+ }
+ catch (TransactionException exception)
+ {
+ OM.LOG.error(exception);
+ final Shell shell = getSite().getShell();
+ shell.getDisplay().syncExec(new Runnable()
+ {
+ public void run()
+ {
+ CDOTransaction transaction = (CDOTransaction)view;
+ String title = Messages.getString("CDOEditor.17"); //$NON-NLS-1$
+ String message = Messages.getString("CDOEditor.18"); //$NON-NLS-1$
+ RollbackTransactionDialog dialog = new RollbackTransactionDialog(getEditorSite().getPage(), title,
+ message, transaction);
+ if (dialog.open() == RollbackTransactionDialog.OK)
+ {
+ transaction.rollback();
+ }
+ }
+ });
+ }
+ catch (Exception exception)
+ {
+ OM.LOG.error(exception);
+ resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception));
+ }
+
+ first = false;
+ }
+ else
+ {
+ monitor.worked(1);
+ }
+ }
+ }
+ finally
+ {
+ monitor.done();
+ }
+ }
+ };
+
+ updateProblemIndication = false;
+
+ try
+ {
+ // This runs the options, and shows progress.
+ //
+ new ProgressMonitorDialog(getSite().getShell()).run(true, true, operation);
+
+ // Refresh the necessary state.
+ //
+ ((BasicCommandStack)editingDomain.getCommandStack()).saveIsDone();
+ }
+ catch (Exception exception)
+ {
+ // Something went wrong that shouldn't.
+ //
+ PluginDelegator.INSTANCE.log(exception);
+ }
+
+ updateProblemIndication = true;
+ updateProblemIndication();
+ }
+
+ /**
+ * This returns whether something has been persisted to the URI of the specified resource. The implementation uses the
+ * URI converter from the editor's resource set to try to open an input stream. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ protected boolean isPersisted(Resource resource)
+ {
+ boolean result = false;
+ try
+ {
+ InputStream stream = editingDomain.getResourceSet().getURIConverter().createInputStream(resource.getURI());
+ if (stream != null)
+ {
+ result = true;
+ stream.close();
+ }
+ }
+ catch (IOException e)
+ {
+ // Ignore
+ }
+ return result;
+ }
+
+ /**
+ * This always returns true because it is not currently supported. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public boolean isSaveAsAllowedGen()
+ {
+ return true;
+ }
+
+ /**
+ * @ADDED
+ */
+ @Override
+ public boolean isSaveAsAllowed()
+ {
+ return false;
+ }
+
+ /**
+ * This also changes the editor's input. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void doSaveAs()
+ {
+ SaveAsDialog saveAsDialog = new SaveAsDialog(getSite().getShell());
+ saveAsDialog.open();
+ IPath path = saveAsDialog.getResult();
+ if (path != null)
+ {
+ IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
+ if (file != null)
+ {
+ doSaveAs(URI.createPlatformResourceURI(file.getFullPath().toString(), true), new FileEditorInput(file));
+ }
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated NOT
+ */
+ protected void doSaveAs(URI uri, IEditorInput editorInput)
+ {
+ throw new UnsupportedOperationException();
+
+ // CDONet4jUtil.getResources(editingDomain.getResourceSet()).get(0).setURI(uri);
+ // setInputWithNotify(editorInput);
+ // setPartName(editorInput.getName());
+ // IProgressMonitor progressMonitor = getActionBars().getStatusLineManager() != null ? getActionBars()
+ // .getStatusLineManager().getProgressMonitor() : new NullProgressMonitor();
+ // doSave(progressMonitor);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void gotoMarker(IMarker marker)
+ {
+ try
+ {
+ if (marker.getType().equals(EValidator.MARKER))
+ {
+ String uriAttribute = marker.getAttribute(EValidator.URI_ATTRIBUTE, null);
+ if (uriAttribute != null)
+ {
+ URI uri = URI.createURI(uriAttribute);
+ EObject eObject = editingDomain.getResourceSet().getEObject(uri, true);
+ if (eObject != null)
+ {
+ setSelectionToViewer(Collections.singleton(editingDomain.getWrapper(eObject)));
+ }
+ }
+ }
+ }
+ catch (CoreException exception)
+ {
+ PluginDelegator.INSTANCE.log(exception);
+ }
+ }
+
+ /**
+ * This is called during startup. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void initGen(IEditorSite site, IEditorInput editorInput)
+ {
+ setSite(site);
+ setInputWithNotify(editorInput);
+ setPartName(editorInput.getName());
+ site.setSelectionProvider(this);
+ site.getPage().addPartListener(partListener);
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(resourceChangeListener, IResourceChangeEvent.POST_CHANGE);
+ }
+
+ /**
+ * @ADDED
+ */
+ @Override
+ public void init(IEditorSite site, IEditorInput editorInput)
+ {
+ setSite(site);
+ setPartName(editorInput.getName());
+ site.setSelectionProvider(this);
+ site.getPage().addPartListener(partListener);
+ setInputWithNotify(editorInput);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void setFocus()
+ {
+ getControl(getActivePage()).setFocus();
+ }
+
+ /**
+ * This implements {@link org.eclipse.jface.viewers.ISelectionProvider}. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void addSelectionChangedListener(ISelectionChangedListener listener)
+ {
+ selectionChangedListeners.add(listener);
+ }
+
+ /**
+ * This implements {@link org.eclipse.jface.viewers.ISelectionProvider}. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void removeSelectionChangedListener(ISelectionChangedListener listener)
+ {
+ selectionChangedListeners.remove(listener);
+ }
+
+ /**
+ * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to return this editor's overall selection.
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public ISelection getSelection()
+ {
+ return editorSelection;
+ }
+
+ /**
+ * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection.
+ * Calling this result will notify the listeners. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void setSelection(ISelection selection)
+ {
+ editorSelection = selection;
+
+ for (ISelectionChangedListener listener : selectionChangedListeners)
+ {
+ listener.selectionChanged(new SelectionChangedEvent(this, selection));
+ }
+ setStatusLineManager(selection);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void setStatusLineManager(ISelection selection)
+ {
+ IStatusLineManager statusLineManager = currentViewer != null && currentViewer == contentOutlineViewer ? contentOutlineStatusLineManager
+ : getActionBars().getStatusLineManager();
+
+ if (statusLineManager != null)
+ {
+ if (selection instanceof IStructuredSelection)
+ {
+ Collection<?> collection = ((IStructuredSelection)selection).toList();
+ switch (collection.size())
+ {
+ case 0:
+ {
+ statusLineManager.setMessage(getString("_UI_NoObjectSelected"));
+ break;
+ }
+ case 1:
+ {
+ String text = new AdapterFactoryItemDelegator(adapterFactory).getText(collection.iterator().next());
+ statusLineManager.setMessage(getString("_UI_SingleObjectSelected", text));
+ break;
+ }
+ default:
+ {
+ statusLineManager.setMessage(getString("_UI_MultiObjectSelected", Integer.toString(collection.size())));
+ break;
+ }
+ }
+ }
+ else
+ {
+ statusLineManager.setMessage("");
+ }
+ }
+ }
+
+ /**
+ * This looks up a string in the plugin's plugin.properties file. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private static String getString(String key)
+ {
+ return PluginDelegator.INSTANCE.getString(key);
+ }
+
+ /**
+ * This looks up a string in plugin.properties, making a substitution. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private static String getString(String key, Object s1)
+ {
+ return PluginDelegator.INSTANCE.getString(key, new Object[] { s1 });
+ }
+
+ /**
+ * This implements {@link org.eclipse.jface.action.IMenuListener} to help fill the context menus with contributions
+ * from the Edit menu. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void menuAboutToShowGen(IMenuManager menuManager)
+ {
+ ((IMenuListener)getEditorSite().getActionBarContributor()).menuAboutToShow(menuManager);
+ }
+
+ /**
+ * @ADDED
+ */
+ public void menuAboutToShow(IMenuManager menuManager)
+ {
+ menuAboutToShowGen(menuManager);
+ MenuManager submenuManager = new MenuManager(Messages.getString("CDOEditor.23")); //$NON-NLS-1$
+ if (populateNewRoot(submenuManager))
+ {
+ menuManager.insertBefore("edit", submenuManager); //$NON-NLS-1$
+ }
+
+ IStructuredSelection sel = (IStructuredSelection)editorSelection;
+ if (sel.size() == 1)
+ {
+ Object element = sel.getFirstElement();
+ if (element instanceof EObject)
+ {
+ final EObject object = (EObject)element;
+ final List<EReference> features = new ArrayList<EReference>();
+ for (EReference containment : object.eClass().getEAllContainments())
+ {
+ if (containment.isMany())
+ {
+ features.add(containment);
+ }
+ }
+
+ if (!features.isEmpty())
+ {
+ final IWorkbenchPage page = getSite().getPage();
+ menuManager.insertBefore(
+ "edit", new LongRunningAction(page, Messages.getString("CDOEditor.26") + SafeAction.INTERACTIVE) //$NON-NLS-1$ //$NON-NLS-2$
+ {
+ private EReference feature;
+
+ private int instances;
+
+ @Override
+ protected void preRun() throws Exception
+ {
+ BulkAddDialog dialog = new BulkAddDialog(page, features);
+ if (dialog.open() == BulkAddDialog.OK)
+ {
+ feature = dialog.getFeature();
+ instances = dialog.getInstances();
+ }
+ else
+ {
+ cancel();
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected void doRun(IProgressMonitor progressMonitor) throws Exception
+ {
+ List<EObject> children = new ArrayList<EObject>();
+ for (int i = 0; i < instances; i++)
+ {
+ EObject child = EcoreUtil.create(feature.getEReferenceType());
+ children.add(child);
+ }
+
+ List<EObject> list = (EList<EObject>)object.eGet(feature);
+ list.addAll(children);
+ }
+ });
+ }
+ }
+ }
+ }
+
+ /**
+ * @ADDED
+ */
+ protected boolean populateNewRoot(MenuManager menuManager)
+ {
+ boolean populated = false;
+ CDOPackageRegistry packageRegistry = view.getSession().getPackageRegistry();
+ for (Map.Entry<String, Object> entry : EMFUtil.getSortedRegistryEntries(packageRegistry))
+ {
+ IContributionItem item = populateSubMenu(entry.getKey(), entry.getValue(), packageRegistry);
+ if (item != null)
+ {
+ menuManager.add(item);
+ populated = true;
+ }
+ }
+
+ return populated;
+ }
+
+ /**
+ * @ADDED
+ */
+ private IContributionItem populateSubMenu(String nsURI, Object value, final CDOPackageRegistry packageRegistry)
+ {
+ if (value instanceof EPackage)
+ {
+ EPackage ePackage = (EPackage)value;
+ CDOPackageInfo packageInfo = packageRegistry.getPackageInfo(ePackage);
+ CDOPackageUnit packageUnit = packageInfo.getPackageUnit();
+ if (packageUnit.isResource())
+ {
+ return null;
+ }
+
+ ImageDescriptor imageDescriptor = SharedIcons.getDescriptor(SharedIcons.OBJ_EPACKAGE);
+ MenuManager submenuManager = new MenuManager(nsURI, imageDescriptor, nsURI);
+ populateSubMenu(ePackage, submenuManager);
+ return submenuManager;
+ }
+
+ ImageDescriptor imageDescriptor = SharedIcons.getDescriptor(SharedIcons.OBJ_EPACKAGE_UNKNOWN);
+ final MenuManager submenuManager = new MenuManager(nsURI, imageDescriptor, nsURI);
+ submenuManager.setRemoveAllWhenShown(true);
+ submenuManager.add(new Action(Messages.getString("CDOEditor.27")) //$NON-NLS-1$
+ {
+ });
+
+ submenuManager.addMenuListener(new IMenuListener()
+ {
+ public void menuAboutToShow(IMenuManager manager)
+ {
+ String nsURI = submenuManager.getMenuText();
+ EPackage ePackage = packageRegistry.getEPackage(nsURI);
+
+ if (ePackage != null)
+ {
+ populateSubMenu(ePackage, submenuManager);
+ }
+ else
+ {
+ OM.LOG.warn(MessageFormat.format(Messages.getString("CDOEditor.28"), nsURI)); //$NON-NLS-1$
+ }
+ }
+ });
+
+ return submenuManager;
+ }
+
+ /**
+ * @ADDED
+ */
+ private void populateSubMenu(EPackage ePackage, final MenuManager submenuManager)
+ {
+ List<EObject> objects = new ArrayList<EObject>();
+ for (EClassifier eClassifier : ePackage.getEClassifiers())
+ {
+ if (eClassifier instanceof EClass)
+ {
+ EClass eClass = (EClass)eClassifier;
+ if (!eClass.isAbstract() && !eClass.isInterface())
+ {
+ objects.add(EcoreUtil.create(eClass));
+ }
+ }
+ }
+
+ if (!objects.isEmpty())
+ {
+ Collections.sort(objects, new Comparator<EObject>()
+ {
+ public int compare(EObject o1, EObject o2)
+ {
+ return o1.eClass().getName().compareTo(o2.eClass().getName());
+ }
+ });
+
+ for (EObject object : objects)
+ {
+ CreateRootAction action = new CreateRootAction(object);
+ submenuManager.add(action);
+ }
+ }
+ }
+
+ /**
+ * @ADDED
+ */
+ protected String getLabelText(Object object)
+ {
+ try
+ {
+ IItemLabelProvider labelProvider = (IItemLabelProvider)adapterFactory.adapt(object, IItemLabelProvider.class);
+ if (labelProvider != null)
+ {
+ String text = labelProvider.getText(object);
+ if (text != null)
+ {
+ return text;
+ }
+ }
+ }
+ catch (Exception ignore)
+ {
+ ignore.printStackTrace();
+ }
+
+ return ""; //$NON-NLS-1$
+ }
+
+ /**
+ * @ADDED
+ */
+ protected Object getLabelImage(Object object)
+ {
+ try
+ {
+ IItemLabelProvider labelProvider = (IItemLabelProvider)adapterFactory.adapt(object, IItemLabelProvider.class);
+ if (labelProvider != null)
+ {
+ return labelProvider.getImage(object);
+ }
+ }
+ catch (Exception ignore)
+ {
+ ignore.printStackTrace();
+ }
+
+ return null;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public EditingDomainActionBarContributor getActionBarContributor()
+ {
+ return (EditingDomainActionBarContributor)getEditorSite().getActionBarContributor();
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public IActionBars getActionBars()
+ {
+ return getActionBarContributor().getActionBars();
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public AdapterFactory getAdapterFactory()
+ {
+ return adapterFactory;
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void disposeGen()
+ {
+ updateProblemIndication = false;
+
+ ResourcesPlugin.getWorkspace().removeResourceChangeListener(resourceChangeListener);
+
+ getSite().getPage().removePartListener(partListener);
+
+ adapterFactory.dispose();
+
+ if (getActionBarContributor().getActiveEditor() == this)
+ {
+ getActionBarContributor().setActiveEditor(null);
+ }
+
+ if (propertySheetPage != null)
+ {
+ propertySheetPage.dispose();
+ }
+
+ if (contentOutlinePage != null)
+ {
+ contentOutlinePage.dispose();
+ }
+
+ super.dispose();
+ }
+
+ /**
+ * @ADDED
+ */
+ @Override
+ public void dispose()
+ {
+ updateProblemIndication = false;
+ view.removeListener(viewTargetListener);
+
+ if (!view.isClosed())
+ {
+ try
+ {
+ if (eventHandler != null)
+ {
+ eventHandler.dispose();
+ }
+ }
+ catch (Exception ex)
+ {
+ OM.LOG.error(ex);
+ }
+
+ try
+ {
+ if (adapterFactory != null)
+ {
+ adapterFactory.dispose();
+ }
+ }
+ catch (Exception ex)
+ {
+ OM.LOG.error(ex);
+ }
+ }
+
+ getSite().getPage().removePartListener(partListener);
+
+ if (getActionBarContributor().getActiveEditor() == this)
+ {
+ getActionBarContributor().setActiveEditor(null);
+ }
+
+ if (propertySheetPage != null)
+ {
+ propertySheetPage.dispose();
+ }
+
+ if (contentOutlinePage != null)
+ {
+ contentOutlinePage.dispose();
+ }
+
+ if (((CDOEditorInput)getEditorInput()).isViewOwned())
+ {
+ view.close();
+ }
+
+ super.dispose();
+ }
+
+ /**
+ * Returns whether the outline view should be presented to the user. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated NOT
+ */
+ protected boolean showOutlineView()
+ {
+ return true;
+ }
+
+ /**
+ * @ADDED
+ */
+ protected void fireDirtyPropertyChange()
+ {
+ try
+ {
+ getSite().getShell().getDisplay().asyncExec(new Runnable()
+ {
+ public void run()
+ {
+ try
+ {
+ firePropertyChange(IEditorPart.PROP_DIRTY);
+ }
+ catch (Exception ignore)
+ {
+ }
+ }
+ });
+ }
+ catch (Exception ignore)
+ {
+ }
+ }
+
+ /**
+ * @ADDED
+ */
+ protected void closeEditor()
+ {
+ try
+ {
+ getSite().getShell().getDisplay().asyncExec(new Runnable()
+ {
+ public void run()
+ {
+ try
+ {
+ getSite().getPage().closeEditor(CDOEditor.this, false);
+ CDOEditor.this.dispose();
+ }
+ catch (RuntimeException ignore)
+ {
+ // Do nothing
+ }
+ }
+ });
+ }
+ catch (RuntimeException ignore)
+ {
+ // Do nothing
+ }
+ }
+
+ /**
+ * @ADDED
+ */
+ public void refreshViewer(final Object element)
+ {
+ try
+ {
+ selectionViewer.getControl().getDisplay().asyncExec(new Runnable()
+ {
+ public void run()
+ {
+ try
+ {
+ if (element == null)
+ {
+ selectionViewer.refresh(true);
+ }
+ else
+ {
+ selectionViewer.refresh(element, true);
+ }
+ }
+ catch (RuntimeException ignore)
+ {
+ // Do nothing
+ }
+ }
+ });
+ }
+ catch (RuntimeException ignore)
+ {
+ // Do nothing
+ }
+ }
+
+ /**
+ * @author Eike Stepper
+ * @ADDED
+ */
+ private final class CreateRootAction extends LongRunningAction
+ {
+ private EObject object;
+
+ private CreateRootAction(EObject object)
+ {
+ super(getEditorSite().getPage(), object.eClass().getName(), ExtendedImageRegistry.getInstance()
+ .getImageDescriptor(getLabelImage(object)));
+ this.object = object;
+ }
+
+ @Override
+ protected void doRun(IProgressMonitor progressMonitor) throws Exception
+ {
+ Resource resource = null;
+ IStructuredSelection ssel = (IStructuredSelection)editorSelection;
+ if (ssel.isEmpty())
+ {
+ if (viewerInput instanceof Resource)
+ {
+ resource = (Resource)viewerInput;
+ }
+ }
+ else if (ssel.size() == 1)
+ {
+ Object element = ssel.getFirstElement();
+ if (element instanceof Resource)
+ {
+ resource = (Resource)element;
+ }
+ else if (element instanceof EObject)
+ {
+ resource = ((EObject)element).eResource();
+ }
+ }
+
+ if (resource != null)
+ {
+ if (object instanceof InternalCDOObject)
+ {
+ object = ((InternalCDOObject)object).cdoInternalInstance();
+ }
+
+ resource.getContents().add(object);
+ }
+ }
+ }
+
+ /**
+ * Adapter that provides the current EditingDomain
+ *
+ * @since 2.0
+ */
+ private class EditingDomainProviderAdapter implements Adapter, IEditingDomainProvider
+ {
+ public boolean isAdapterForType(Object type)
+ {
+ return type == IEditingDomainProvider.class;
+ }
+
+ public EditingDomain getEditingDomain()
+ {
+ return editingDomain;
+ }
+
+ public Notifier getTarget()
+ {
+ return null;
+ }
+
+ public void notifyChanged(Notification notification)
+ {
+ }
+
+ public void setTarget(Notifier newTarget)
+ {
+ }
+ }
+}
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 0e030a3c07..f0d22229db 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 - 2011 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 - 2011 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 -->
- * <