Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2020-04-05 07:09:43 +0000
committerEike Stepper2020-04-05 07:09:43 +0000
commit855c42fbc7d74b46a86509c499eff4f486b92c13 (patch)
treef7ce962b082e01ce0de5d949a3c9c5b582b8fbeb
parent40498ab7e6f21bdfae1996731edb05aedcd0a9e6 (diff)
downloadcdo-855c42fbc7d74b46a86509c499eff4f486b92c13.tar.gz
cdo-855c42fbc7d74b46a86509c499eff4f486b92c13.tar.xz
cdo-855c42fbc7d74b46a86509c499eff4f486b92c13.zip
[544809] CDO opens ErrorEditPart instead of opened editors when we restart Eclipse
https://bugs.eclipse.org/bugs/show_bug.cgi?id=544809
-rw-r--r--features/org.eclipse.net4j.util.ui-feature/feature.xml2
-rw-r--r--features/org.eclipse.net4j.util.ui-feature/pom.xml2
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/.settings/.api_filters8
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/META-INF/MANIFEST.MF24
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/plugin.xml16
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/pom.xml2
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/bundle/OM.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/CDOModelEditorInput.java230
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/CDOModelEditorOpener.java124
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/properties/ExplorerPreferencePage.java10
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF36
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/pom.xml2
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/AbstractCDOEditorInput.java162
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/CDOEditorInputImpl.java133
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOEditorOpener.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOEditorUtil.java88
-rw-r--r--plugins/org.eclipse.net4j.util.ui/META-INF/MANIFEST.MF34
-rw-r--r--plugins/org.eclipse.net4j.util.ui/pom.xml2
-rw-r--r--plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/prefs/PrefBoolean.java60
19 files changed, 620 insertions, 320 deletions
diff --git a/features/org.eclipse.net4j.util.ui-feature/feature.xml b/features/org.eclipse.net4j.util.ui-feature/feature.xml
index 8536c8767a..771ec1f3fc 100644
--- a/features/org.eclipse.net4j.util.ui-feature/feature.xml
+++ b/features/org.eclipse.net4j.util.ui-feature/feature.xml
@@ -12,7 +12,7 @@
<feature
id="org.eclipse.net4j.util.ui"
label="%featureName"
- version="4.9.1.qualifier"
+ version="4.10.0.qualifier"
provider-name="%providerName"
image="eclipse_update_120.jpg"
license-feature="org.eclipse.emf.cdo.license"
diff --git a/features/org.eclipse.net4j.util.ui-feature/pom.xml b/features/org.eclipse.net4j.util.ui-feature/pom.xml
index ac9ecde33b..fefdf01042 100644
--- a/features/org.eclipse.net4j.util.ui-feature/pom.xml
+++ b/features/org.eclipse.net4j.util.ui-feature/pom.xml
@@ -25,7 +25,7 @@
<groupId>org.eclipse.emf.cdo.features</groupId>
<artifactId>org.eclipse.net4j.util.ui</artifactId>
- <version>4.9.1-SNAPSHOT</version>
+ <version>4.10.0-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
</project>
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/.settings/.api_filters b/plugins/org.eclipse.emf.cdo.explorer.ui/.settings/.api_filters
index 06b8f0cf25..042a1d5f8f 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/.settings/.api_filters
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/.settings/.api_filters
@@ -1,5 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<component id="org.eclipse.emf.cdo.explorer.ui" version="2">
+ <resource path="META-INF/MANIFEST.MF">
+ <filter id="926941240">
+ <message_arguments>
+ <message_argument value="4.6.0"/>
+ <message_argument value="4.5.0"/>
+ </message_arguments>
+ </filter>
+ </resource>
<resource path="src/org/eclipse/emf/cdo/explorer/ui/actions/CheckoutCommitInfoActionDelegate.java" type="org.eclipse.emf.cdo.explorer.ui.actions.CheckoutCommitInfoActionDelegate">
<filter id="574664731">
<message_arguments>
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.explorer.ui/META-INF/MANIFEST.MF
index ef18aa4453..362ab39966 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.emf.cdo.explorer.ui;singleton:=true
-Bundle-Version: 4.5.0.qualifier
+Bundle-Version: 4.6.0.qualifier
Bundle-Activator: org.eclipse.emf.cdo.explorer.ui.bundle.OM$Activator
Bundle-Vendor: %providerName
Bundle-ClassPath: .
@@ -24,16 +24,16 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)",
org.eclipse.emf.cdo.ui.shared;bundle-version="[4.0.0,5.0.0)",
org.eclipse.emf.cdo.ui.compare;bundle-version="[4.0.0,5.0.0)";resolution:=optional,
org.eclipse.emf.cdo.ui.team;bundle-version="[4.0.0,5.0.0)";resolution:=optional
-Export-Package: org.eclipse.emf.cdo.explorer.ui;version="4.5.0";x-internal:=true,
- org.eclipse.emf.cdo.explorer.ui.actions;version="4.5.0";x-internal:=true,
- org.eclipse.emf.cdo.explorer.ui.application;version="4.5.0";x-internal:=true,
- org.eclipse.emf.cdo.explorer.ui.bundle;version="4.5.0";x-internal:=true,
- org.eclipse.emf.cdo.explorer.ui.checkouts;version="4.5.0";x-internal:=true,
- org.eclipse.emf.cdo.explorer.ui.checkouts.actions;version="4.5.0";x-internal:=true,
- org.eclipse.emf.cdo.explorer.ui.checkouts.wizards;version="4.5.0";x-internal:=true,
- org.eclipse.emf.cdo.explorer.ui.handlers;version="4.5.0";x-internal:=true,
- org.eclipse.emf.cdo.explorer.ui.properties;version="4.5.0";x-internal:=true,
- org.eclipse.emf.cdo.explorer.ui.repositories;version="4.5.0";x-internal:=true,
- org.eclipse.emf.cdo.explorer.ui.repositories.wizards;version="4.5.0";x-internal:=true
+Export-Package: org.eclipse.emf.cdo.explorer.ui;version="4.6.0";x-internal:=true,
+ org.eclipse.emf.cdo.explorer.ui.actions;version="4.6.0";x-internal:=true,
+ org.eclipse.emf.cdo.explorer.ui.application;version="4.6.0";x-internal:=true,
+ org.eclipse.emf.cdo.explorer.ui.bundle;version="4.6.0";x-internal:=true,
+ org.eclipse.emf.cdo.explorer.ui.checkouts;version="4.6.0";x-internal:=true,
+ org.eclipse.emf.cdo.explorer.ui.checkouts.actions;version="4.6.0";x-internal:=true,
+ org.eclipse.emf.cdo.explorer.ui.checkouts.wizards;version="4.6.0";x-internal:=true,
+ org.eclipse.emf.cdo.explorer.ui.handlers;version="4.6.0";x-internal:=true,
+ org.eclipse.emf.cdo.explorer.ui.properties;version="4.6.0";x-internal:=true,
+ org.eclipse.emf.cdo.explorer.ui.repositories;version="4.6.0";x-internal:=true,
+ org.eclipse.emf.cdo.explorer.ui.repositories.wizards;version="4.6.0";x-internal:=true
Eclipse-BuddyPolicy: registered
Automatic-Module-Name: org.eclipse.emf.cdo.explorer.ui
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/plugin.xml b/plugins/org.eclipse.emf.cdo.explorer.ui/plugin.xml
index 22ff7102b0..4bc15adfd0 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/plugin.xml
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/plugin.xml
@@ -815,16 +815,20 @@
</objectContribution>
</extension>
- <extension
- point="org.eclipse.emf.cdo.ui.editorOpeners">
- <editorOpener
+ <extension point="org.eclipse.ui.elementFactories">
+ <factory
+ id="org.eclipse.emf.cdo.explorer.ui.checkouts.CDOModelEditorInput.ElementFactory"
+ class="org.eclipse.emf.cdo.explorer.ui.checkouts.CDOModelEditorInput$ElementFactory"/>
+ </extension>
+
+ <extension point="org.eclipse.emf.cdo.ui.editorOpeners">
+ <editorOpener
class="org.eclipse.emf.cdo.explorer.ui.checkouts.CDOModelEditorOpener"
icon="icons/cdo_editor.gif"
id="org.eclipse.emf.cdo.explorer.ui.CDOModelEditorOpener"
name="CDO Editor"
priority="100"
- regex="cdo\.checkout://.*">
- </editorOpener>
- </extension>
+ regex="cdo\.checkout://.*"/>
+ </extension>
</plugin>
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/pom.xml b/plugins/org.eclipse.emf.cdo.explorer.ui/pom.xml
index 6569bf5967..030113929c 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/pom.xml
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/pom.xml
@@ -25,7 +25,7 @@
<groupId>org.eclipse.emf.cdo</groupId>
<artifactId>org.eclipse.emf.cdo.explorer.ui</artifactId>
- <version>4.5.0-SNAPSHOT</version>
+ <version>4.6.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/bundle/OM.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/bundle/OM.java
index 77b4e85502..0a2d70a253 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/bundle/OM.java
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/bundle/OM.java
@@ -51,6 +51,9 @@ public abstract class OM
public static final OMPreference<Boolean> PREF_REPOSITORY_TIMEOUT_DISABLED = //
PREFS.init("PREF_REPOSITORY_TIMEOUT_DISABLED", false); //$NON-NLS-1$
+ public static final OMPreference<Boolean> PREF_REMEMBER_OPEN_EDITORS = //
+ PREFS.init("PREF_REMEMBER_OPEN_EDITORS", false); //$NON-NLS-1$
+
public static final OMPreference<Integer> PREF_DASHBOARD_HEIGHT = //
PREFS.init("PREF_DASHBOARD_HEIGHT", 0); //$NON-NLS-1$
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/CDOModelEditorInput.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/CDOModelEditorInput.java
new file mode 100644
index 0000000000..7ea7602340
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/CDOModelEditorInput.java
@@ -0,0 +1,230 @@
+/*
+ * Copyright (c) 2020 Eike Stepper (Loehne, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms 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.explorer.ui.checkouts;
+
+import org.eclipse.emf.cdo.CDOObject;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.explorer.CDOExplorerUtil;
+import org.eclipse.emf.cdo.explorer.checkouts.CDOCheckout;
+import org.eclipse.emf.cdo.explorer.ui.bundle.OM;
+import org.eclipse.emf.cdo.internal.ui.AbstractCDOEditorInput;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.ui.CDOEditorInput2;
+import org.eclipse.emf.cdo.ui.CDOItemProvider;
+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.common.util.URI;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.PlatformObject;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.IElementFactory;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.IPersistableElement;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDOModelEditorInput extends PlatformObject implements CDOEditorInput2, IPersistableElement
+{
+ protected static final String URI_TAG = "uri";
+
+ private final URI uri;
+
+ private CDOCheckout checkout;
+
+ private CDOView view;
+
+ private String resourcePath;
+
+ private CDOID objectID;
+
+ public CDOModelEditorInput(URI uri)
+ {
+ this.uri = uri;
+ }
+
+ public URI getURI()
+ {
+ return uri;
+ }
+
+ public CDOCheckout getCheckout()
+ {
+ if (checkout == null)
+ {
+ checkout = CDOExplorerUtil.getCheckout(uri);
+ }
+
+ return checkout;
+ }
+
+ @Override
+ public CDOView getView()
+ {
+ if (view == null)
+ {
+ CDOCheckout checkout = getCheckout();
+ checkout.open();
+
+ view = checkout.openView();
+ configureView(view);
+ }
+
+ return view;
+ }
+
+ @Override
+ public boolean isViewOwned()
+ {
+ return true;
+ }
+
+ @Override
+ public String getResourcePath()
+ {
+ if (resourcePath == null)
+ {
+ resourcePath = CDOURIUtil.extractResourcePath(uri);
+ }
+
+ return resourcePath;
+ }
+
+ @Override
+ public CDOID getObjectID()
+ {
+ if (objectID == null)
+ {
+ objectID = CDOID.NULL;
+
+ if (uri.hasFragment())
+ {
+ CDOObject cdoObject = CDOUtil.getCDOObject(getView().getResourceSet().getEObject(uri, true));
+ if (cdoObject != null)
+ {
+ objectID = cdoObject.cdoID();
+ }
+ }
+ }
+
+ return objectID == CDOID.NULL ? null : objectID;
+ }
+
+ @Override
+ public void setObjectID(CDOID objectID)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public boolean exists()
+ {
+ return true;
+ }
+
+ @Override
+ public ImageDescriptor getImageDescriptor()
+ {
+ CDOView view = getView();
+ return CDOItemProvider.getViewImageDescriptor(view);
+ }
+
+ @Override
+ public String getName()
+ {
+ String resourcePath = getResourcePath();
+ if (resourcePath != null)
+ {
+ return new Path(resourcePath).lastSegment();
+ }
+
+ return getView().getSession().getRepositoryInfo().getName();
+ }
+
+ @Override
+ public String getToolTipText()
+ {
+ CDOView view = getView();
+ String resourcePath = getResourcePath();
+ return AbstractCDOEditorInput.formatToolTipText(view, resourcePath);
+ }
+
+ @Override
+ public IPersistableElement getPersistable()
+ {
+ if (OM.PREF_REMEMBER_OPEN_EDITORS.getValue() == Boolean.TRUE)
+ {
+ return this;
+ }
+
+ return null;
+ }
+
+ @Override
+ public void saveState(IMemento memento)
+ {
+ memento.putString(URI_TAG, uri.toString());
+ }
+
+ @Override
+ public String getFactoryId()
+ {
+ return ElementFactory.ID;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return uri.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object o)
+ {
+ return this == o || o instanceof CDOModelEditorInput && uri.equals(((CDOModelEditorInput)o).getURI());
+ }
+
+ protected void configureView(CDOView view)
+ {
+ if (view instanceof CDOTransaction)
+ {
+ configureTransaction((CDOTransaction)view);
+ }
+ }
+
+ protected void configureTransaction(CDOTransaction transaction)
+ {
+ CDOModelEditorOpener.addConflictResolver(transaction);
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static class ElementFactory implements IElementFactory
+ {
+ public static final String ID = "org.eclipse.emf.cdo.explorer.ui.checkouts.CDOModelEditorInput.ElementFactory";
+
+ public ElementFactory()
+ {
+ }
+
+ @Override
+ public IAdaptable createElement(IMemento memento)
+ {
+ URI uri = URI.createURI(memento.getString(URI_TAG));
+ return new CDOModelEditorInput(uri);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/CDOModelEditorOpener.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/CDOModelEditorOpener.java
index 7d4579b5d3..e19bc556cc 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/CDOModelEditorOpener.java
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/checkouts/CDOModelEditorOpener.java
@@ -10,19 +10,11 @@
*/
package org.eclipse.emf.cdo.explorer.ui.checkouts;
-import org.eclipse.emf.cdo.CDOObject;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.explorer.CDOExplorerUtil;
-import org.eclipse.emf.cdo.explorer.checkouts.CDOCheckout;
import org.eclipse.emf.cdo.explorer.ui.bundle.OM;
-import org.eclipse.emf.cdo.internal.ui.CDOEditorInputImpl;
import org.eclipse.emf.cdo.internal.ui.InteractiveConflictHandlerSelector;
import org.eclipse.emf.cdo.transaction.CDOTransaction;
import org.eclipse.emf.cdo.ui.CDOEditorOpener;
import org.eclipse.emf.cdo.ui.CDOEditorUtil;
-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.internal.cdo.transaction.CDOHandlingConflictResolver;
@@ -31,13 +23,9 @@ import org.eclipse.net4j.util.om.OMPlatform;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.spi.cdo.CDOMergingConflictResolver;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorReference;
-import org.eclipse.ui.IPartListener;
import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PartInitException;
/**
* @author Eike Stepper
@@ -51,117 +39,31 @@ public class CDOModelEditorOpener extends CDOEditorOpener.Default
}
@Override
- protected IEditorPart doOpenEditor(final IWorkbenchPage page, URI uri)
+ protected IEditorPart doOpenEditor(IWorkbenchPage page, URI uri)
{
- CDOCheckout checkout = CDOExplorerUtil.getCheckout(uri);
- if (checkout == null)
- {
- MessageDialog.openError(page.getWorkbenchWindow().getShell(), "Error", "The checkout for " + uri + " could not be found.");
- return null;
- }
-
- final CDOView view = checkout.openView();
+ CDOModelEditorInput editorInput = new CDOModelEditorInput(uri);
+ String editorID = CDOEditorUtil.getEditorID();
- if (view instanceof CDOTransaction)
+ try
{
- configureTransaction((CDOTransaction)view);
+ return page.openEditor(editorInput, editorID);
}
-
- CDOID objectID = null;
- if (uri.hasFragment())
+ catch (PartInitException ex)
{
- CDOObject cdoObject = CDOUtil.getCDOObject(view.getResourceSet().getEObject(uri, true));
- if (cdoObject != null)
- {
- objectID = cdoObject.cdoID();
- }
+ OM.LOG.error(ex);
+ return null;
}
-
- final IEditorPart editor = openEditor(page, view, CDOURIUtil.extractResourcePath(uri), objectID);
- page.addPartListener(new IPartListener()
- {
- @Override
- public void partClosed(IWorkbenchPart part)
- {
- if (part == editor)
- {
- try
- {
- view.close();
- }
- catch (Exception ex)
- {
- OM.LOG.error(ex);
- }
- finally
- {
- page.removePartListener(this);
- }
- }
- }
-
- @Override
- public void partOpened(IWorkbenchPart part)
- {
- // Do nothing.
- }
-
- @Override
- public void partDeactivated(IWorkbenchPart part)
- {
- // Do nothing.
- }
-
- @Override
- public void partBroughtToTop(IWorkbenchPart part)
- {
- // Do nothing.
- }
-
- @Override
- public void partActivated(IWorkbenchPart part)
- {
- // Do nothing.
- }
- });
-
- return editor;
}
+ /**
+ * @deprecated As of 4.6 no longer supported in favor of CDOModelEditorInput.configureTransaction().
+ */
+ @Deprecated
protected void configureTransaction(CDOTransaction transaction)
{
addConflictResolver(transaction);
}
- private IEditorPart openEditor(IWorkbenchPage page, CDOView view, String resourcePath, CDOID objectID)
- {
- try
- {
- String editorID = CDOEditorUtil.getEditorID();
-
- IEditorReference[] references = CDOEditorUtil.findEditor(page, view, resourcePath);
- for (IEditorReference reference : references)
- {
- if (editorID.equals(reference.getId()))
- {
- IEditorPart editor = references[0].getEditor(true);
- page.activate(editor);
- return editor;
- }
- }
-
- IEditorInput input = CDOEditorUtil.createCDOEditorInput(view, resourcePath, false);
- ((CDOEditorInputImpl)input).setObjectID(objectID);
- return page.openEditor(input, editorID);
- }
- catch (Exception ex)
- {
- OM.LOG.error(ex);
- }
-
- return null;
- }
-
public static void addConflictResolver(CDOTransaction transaction)
{
if (INTERACTIVE_CONFLICT_RESOLUTION)
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/properties/ExplorerPreferencePage.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/properties/ExplorerPreferencePage.java
index 3e078d0713..5bede50c35 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/properties/ExplorerPreferencePage.java
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/properties/ExplorerPreferencePage.java
@@ -14,6 +14,7 @@ import org.eclipse.emf.cdo.explorer.ui.bundle.OM;
import org.eclipse.net4j.util.ui.UIUtil;
import org.eclipse.net4j.util.ui.prefs.OMPreferencePage;
+import org.eclipse.net4j.util.ui.prefs.PrefBoolean;
import org.eclipse.net4j.util.ui.prefs.PrefIntegerAndDisable;
import org.eclipse.swt.SWT;
@@ -29,6 +30,8 @@ public class ExplorerPreferencePage extends OMPreferencePage
{
private PrefIntegerAndDisable repositoryTimeout;
+ private PrefBoolean rememberOpenEditors;
+
public ExplorerPreferencePage()
{
super(OM.PREFS);
@@ -52,6 +55,11 @@ public class ExplorerPreferencePage extends OMPreferencePage
repositoryTimeout.setLayoutData(UIUtil.createGridData(true, false));
+ rememberOpenEditors = new PrefBoolean(composite, SWT.CHECK, OM.PREF_REMEMBER_OPEN_EDITORS);
+ rememberOpenEditors.getButton().setText("Remember open model editors");
+ rememberOpenEditors.setLayoutData(UIUtil.createGridData(false, false));
+ UIUtil.setIndentation(rememberOpenEditors, -1, 10);
+
initValues();
return composite;
}
@@ -59,12 +67,14 @@ public class ExplorerPreferencePage extends OMPreferencePage
protected void initValues()
{
repositoryTimeout.loadPreferences();
+ rememberOpenEditors.loadPreferences();
}
@Override
public boolean performOk()
{
repositoryTimeout.savePreferences();
+ rememberOpenEditors.savePreferences();
return super.performOk();
}
}
diff --git a/plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF
index f80b33a288..7c17287423 100644
--- a/plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.emf.cdo.ui;singleton:=true
-Bundle-Version: 4.7.1.qualifier
+Bundle-Version: 4.8.0.qualifier
Bundle-Activator: org.eclipse.emf.cdo.internal.ui.bundle.OM$Activator
Bundle-Vendor: %providerName
Bundle-ClassPath: .
@@ -27,7 +27,7 @@ Require-Bundle: org.eclipse.core.expressions;bundle-version="[3.4.0,4.0.0)";reso
org.eclipse.emf.ecp.edit;bundle-version="[1.5.0,2.0.0)";resolution:=optional,
org.eclipse.emf.ecp.edit.swt;bundle-version="[1.5.0,2.0.0)";resolution:=optional,
org.eclipse.emf.ecp.ui.view.swt;bundle-version="[1.5.0,2.0.0)";resolution:=optional
-Export-Package: org.eclipse.emf.cdo.internal.ui;version="4.7.1";
+Export-Package: org.eclipse.emf.cdo.internal.ui;version="4.8.0";
x-friends:="org.eclipse.emf.cdo.ui.ide,
org.eclipse.emf.cdo.ui.location,
org.eclipse.emf.cdo.tests.ui,
@@ -36,7 +36,7 @@ Export-Package: org.eclipse.emf.cdo.internal.ui;version="4.7.1";
org.eclipse.emf.cdo.explorer.ui,
org.eclipse.emf.cdo.ui.team,
org.eclipse.emf.cdo.ui.compare",
- org.eclipse.emf.cdo.internal.ui.actions;version="4.7.1";
+ org.eclipse.emf.cdo.internal.ui.actions;version="4.8.0";
x-friends:="org.eclipse.emf.cdo.ui.ide,
org.eclipse.emf.cdo.ui.location,
org.eclipse.emf.cdo.tests.ui,
@@ -45,7 +45,7 @@ Export-Package: org.eclipse.emf.cdo.internal.ui;version="4.7.1";
org.eclipse.emf.cdo.explorer.ui,
org.eclipse.emf.cdo.ui.team,
org.eclipse.emf.cdo.ui.compare",
- org.eclipse.emf.cdo.internal.ui.handlers;version="4.7.1";
+ org.eclipse.emf.cdo.internal.ui.handlers;version="4.8.0";
x-friends:="org.eclipse.emf.cdo.ui.ide,
org.eclipse.emf.cdo.ui.location,
org.eclipse.emf.cdo.tests.ui,
@@ -54,9 +54,9 @@ Export-Package: org.eclipse.emf.cdo.internal.ui;version="4.7.1";
org.eclipse.emf.cdo.explorer.ui,
org.eclipse.emf.cdo.ui.team,
org.eclipse.emf.cdo.ui.compare",
- org.eclipse.emf.cdo.internal.ui.actions.delegates;version="4.7.1";x-internal:=true,
- org.eclipse.emf.cdo.internal.ui.bundle;version="4.7.1";x-internal:=true,
- org.eclipse.emf.cdo.internal.ui.dialogs;version="4.7.1";
+ org.eclipse.emf.cdo.internal.ui.actions.delegates;version="4.8.0";x-internal:=true,
+ org.eclipse.emf.cdo.internal.ui.bundle;version="4.8.0";x-internal:=true,
+ org.eclipse.emf.cdo.internal.ui.dialogs;version="4.8.0";
x-friends:="org.eclipse.emf.cdo.ui.ide,
org.eclipse.emf.cdo.ui.location,
org.eclipse.emf.cdo.tests.ui,
@@ -65,7 +65,7 @@ Export-Package: org.eclipse.emf.cdo.internal.ui;version="4.7.1";
org.eclipse.emf.cdo.explorer.ui,
org.eclipse.emf.cdo.ui.team,
org.eclipse.emf.cdo.ui.compare",
- org.eclipse.emf.cdo.internal.ui.dnd;version="4.7.1";
+ org.eclipse.emf.cdo.internal.ui.dnd;version="4.8.0";
x-friends:="org.eclipse.emf.cdo.ui.ide,
org.eclipse.emf.cdo.ui.location,
org.eclipse.emf.cdo.tests.ui,
@@ -74,7 +74,7 @@ Export-Package: org.eclipse.emf.cdo.internal.ui;version="4.7.1";
org.eclipse.emf.cdo.explorer.ui,
org.eclipse.emf.cdo.ui.team,
org.eclipse.emf.cdo.ui.compare",
- org.eclipse.emf.cdo.internal.ui.editor;version="4.7.1";
+ org.eclipse.emf.cdo.internal.ui.editor;version="4.8.0";
x-friends:="org.eclipse.emf.cdo.ui.ide,
org.eclipse.emf.cdo.ui.location,
org.eclipse.emf.cdo.tests.ui,
@@ -83,7 +83,7 @@ Export-Package: org.eclipse.emf.cdo.internal.ui;version="4.7.1";
org.eclipse.emf.cdo.explorer.ui,
org.eclipse.emf.cdo.ui.team,
org.eclipse.emf.cdo.ui.compare",
- org.eclipse.emf.cdo.internal.ui.filters;version="4.7.1";
+ org.eclipse.emf.cdo.internal.ui.filters;version="4.8.0";
x-friends:="org.eclipse.emf.cdo.ui.ide,
org.eclipse.emf.cdo.ui.location,
org.eclipse.emf.cdo.tests.ui,
@@ -92,7 +92,7 @@ Export-Package: org.eclipse.emf.cdo.internal.ui;version="4.7.1";
org.eclipse.emf.cdo.explorer.ui,
org.eclipse.emf.cdo.ui.team,
org.eclipse.emf.cdo.ui.compare",
- org.eclipse.emf.cdo.internal.ui.history;version="4.7.1";
+ org.eclipse.emf.cdo.internal.ui.history;version="4.8.0";
x-friends:="org.eclipse.emf.cdo.ui.ide,
org.eclipse.emf.cdo.ui.location,
org.eclipse.emf.cdo.tests.ui,
@@ -101,7 +101,7 @@ Export-Package: org.eclipse.emf.cdo.internal.ui;version="4.7.1";
org.eclipse.emf.cdo.explorer.ui,
org.eclipse.emf.cdo.ui.team,
org.eclipse.emf.cdo.ui.compare",
- org.eclipse.emf.cdo.internal.ui.messages;version="4.7.1";
+ org.eclipse.emf.cdo.internal.ui.messages;version="4.8.0";
x-friends:="org.eclipse.emf.cdo.ui.ide,
org.eclipse.emf.cdo.ui.location,
org.eclipse.emf.cdo.tests.ui,
@@ -110,7 +110,7 @@ Export-Package: org.eclipse.emf.cdo.internal.ui;version="4.7.1";
org.eclipse.emf.cdo.explorer.ui,
org.eclipse.emf.cdo.ui.team,
org.eclipse.emf.cdo.ui.compare",
- org.eclipse.emf.cdo.internal.ui.perspectives;version="4.7.1";
+ org.eclipse.emf.cdo.internal.ui.perspectives;version="4.8.0";
x-friends:="org.eclipse.emf.cdo.ui.ide,
org.eclipse.emf.cdo.ui.location,
org.eclipse.emf.cdo.tests.ui,
@@ -119,7 +119,7 @@ Export-Package: org.eclipse.emf.cdo.internal.ui;version="4.7.1";
org.eclipse.emf.cdo.explorer.ui,
org.eclipse.emf.cdo.ui.team,
org.eclipse.emf.cdo.ui.compare",
- org.eclipse.emf.cdo.internal.ui.preferences;version="4.7.1";
+ org.eclipse.emf.cdo.internal.ui.preferences;version="4.8.0";
x-friends:="org.eclipse.emf.cdo.ui.ide,
org.eclipse.emf.cdo.ui.location,
org.eclipse.emf.cdo.tests.ui,
@@ -128,7 +128,7 @@ Export-Package: org.eclipse.emf.cdo.internal.ui;version="4.7.1";
org.eclipse.emf.cdo.explorer.ui,
org.eclipse.emf.cdo.ui.team,
org.eclipse.emf.cdo.ui.compare",
- org.eclipse.emf.cdo.internal.ui.transfer;version="4.7.1";
+ org.eclipse.emf.cdo.internal.ui.transfer;version="4.8.0";
x-friends:="org.eclipse.emf.cdo.ui.ide,
org.eclipse.emf.cdo.ui.location,
org.eclipse.emf.cdo.tests.ui,
@@ -137,7 +137,7 @@ Export-Package: org.eclipse.emf.cdo.internal.ui;version="4.7.1";
org.eclipse.emf.cdo.explorer.ui,
org.eclipse.emf.cdo.ui.team,
org.eclipse.emf.cdo.ui.compare",
- org.eclipse.emf.cdo.internal.ui.views;version="4.7.1";
+ org.eclipse.emf.cdo.internal.ui.views;version="4.8.0";
x-friends:="org.eclipse.emf.cdo.ui.ide,
org.eclipse.emf.cdo.ui.location,
org.eclipse.emf.cdo.tests.ui,
@@ -146,6 +146,6 @@ Export-Package: org.eclipse.emf.cdo.internal.ui;version="4.7.1";
org.eclipse.emf.cdo.explorer.ui,
org.eclipse.emf.cdo.ui.team,
org.eclipse.emf.cdo.ui.compare",
- org.eclipse.emf.cdo.ui;version="4.7.1",
- org.eclipse.emf.cdo.ui.widgets;version="4.7.1"
+ org.eclipse.emf.cdo.ui;version="4.8.0",
+ org.eclipse.emf.cdo.ui.widgets;version="4.8.0"
Automatic-Module-Name: org.eclipse.emf.cdo.ui
diff --git a/plugins/org.eclipse.emf.cdo.ui/pom.xml b/plugins/org.eclipse.emf.cdo.ui/pom.xml
index d27289d42a..b6763e2b00 100644
--- a/plugins/org.eclipse.emf.cdo.ui/pom.xml
+++ b/plugins/org.eclipse.emf.cdo.ui/pom.xml
@@ -25,7 +25,7 @@
<groupId>org.eclipse.emf.cdo</groupId>
<artifactId>org.eclipse.emf.cdo.ui</artifactId>
- <version>4.7.1-SNAPSHOT</version>
+ <version>4.8.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/AbstractCDOEditorInput.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/AbstractCDOEditorInput.java
new file mode 100644
index 0000000000..85fee88a2b
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/AbstractCDOEditorInput.java
@@ -0,0 +1,162 @@
+/*
+ * Copyright (c) 2009-2012, 2016, 2019, 2020 Eike Stepper (Loehne, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms 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.common.id.CDOID;
+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.CDOEditorInput2;
+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
+ */
+public abstract class AbstractCDOEditorInput extends PlatformObject implements CDOEditorInput2
+{
+ private String resourcePath;
+
+ private CDOID objectID;
+
+ public AbstractCDOEditorInput(String resourcePath, CDOID objectID)
+ {
+ this.resourcePath = resourcePath;
+ this.objectID = objectID;
+ }
+
+ @Override
+ public String getResourcePath()
+ {
+ return resourcePath;
+ }
+
+ @Override
+ public CDOID getObjectID()
+ {
+ return objectID;
+ }
+
+ @Override
+ public void setObjectID(CDOID objectID)
+ {
+ this.objectID = objectID;
+ }
+
+ @Override
+ public boolean exists()
+ {
+ return true;
+ }
+
+ @Override
+ public ImageDescriptor getImageDescriptor()
+ {
+ CDOView view = getView();
+ return CDOItemProvider.getViewImageDescriptor(view);
+ }
+
+ @Override
+ public String getName()
+ {
+ if (resourcePath != null)
+ {
+ return new Path(resourcePath).lastSegment();
+ }
+
+ return getView().getSession().getRepositoryInfo().getName();
+ }
+
+ @Override
+ public IPersistableElement getPersistable()
+ {
+ return null;
+ }
+
+ @Override
+ public String getToolTipText()
+ {
+ CDOView view = getView();
+ String resourcePath = getResourcePath();
+ return formatToolTipText(view, resourcePath);
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return ObjectUtil.hashCode(getView()) ^ ObjectUtil.hashCode(resourcePath) ^ ObjectUtil.hashCode(objectID);
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+
+ if (obj instanceof AbstractCDOEditorInput)
+ {
+ AbstractCDOEditorInput that = (AbstractCDOEditorInput)obj;
+
+ return ObjectUtil.equals(getView(), that.getView()) //
+ && ObjectUtil.equals(resourcePath, that.resourcePath) //
+ && ObjectUtil.equals(objectID, that.objectID);
+ }
+
+ return false;
+ }
+
+ public static String formatToolTipText(CDOView view, String resourcePath)
+ {
+ 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();
+ }
+}
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 3a544ba284..5664cda256 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,5 +1,5 @@
/*
- * Copyright (c) 2009-2012, 2016, 2019 Eike Stepper (Loehne, Germany) and others.
+ * Copyright (c) 2009-2012, 2016, 2019, 2020 Eike Stepper (Loehne, Germany) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,39 +7,20 @@
*
* Contributors:
* Eike Stepper - initial API and implementation
- * Victor Roldan Betancort - maintenance
*/
package org.eclipse.emf.cdo.internal.ui;
-import org.eclipse.emf.cdo.common.id.CDOID;
-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.CDOEditorInput2;
-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 CDOEditorInput2
+public class CDOEditorInputImpl extends AbstractCDOEditorInput
{
private CDOView view;
private boolean viewOwned;
- private String resourcePath;
-
- private CDOID objectID;
-
public CDOEditorInputImpl(CDOView view, String resourcePath)
{
this(view, resourcePath, false);
@@ -47,9 +28,9 @@ public class CDOEditorInputImpl extends PlatformObject implements CDOEditorInput
public CDOEditorInputImpl(CDOView view, String resourcePath, boolean viewOwned)
{
+ super(resourcePath, null);
this.view = view;
this.viewOwned = viewOwned;
- this.resourcePath = resourcePath;
}
@Override
@@ -63,112 +44,4 @@ public class CDOEditorInputImpl extends PlatformObject implements CDOEditorInput
{
return viewOwned;
}
-
- @Override
- public String getResourcePath()
- {
- return resourcePath;
- }
-
- @Override
- public CDOID getObjectID()
- {
- return objectID;
- }
-
- @Override
- public void setObjectID(CDOID objectID)
- {
- this.objectID = objectID;
- }
-
- @Override
- public boolean exists()
- {
- return true;
- }
-
- @Override
- public ImageDescriptor getImageDescriptor()
- {
- return CDOItemProvider.getViewImageDescriptor(view);
- }
-
- @Override
- public String getName()
- {
- if (resourcePath != null)
- {
- return new Path(resourcePath).lastSegment();
- }
-
- return view.getSession().getRepositoryInfo().getName();
- }
-
- @Override
- public IPersistableElement getPersistable()
- {
- return null;
- }
-
- @Override
- 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/ui/CDOEditorOpener.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOEditorOpener.java
index 8dd8f20963..2bb1cb3182 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOEditorOpener.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOEditorOpener.java
@@ -207,7 +207,7 @@ public interface CDOEditorOpener
page.addPartListener(partListener);
editor[0] = doOpenEditor(page, uri);
- if (!editors.contains(editor))
+ if (!editors.contains(editor[0]))
{
// The editor must have been open already and someone else will handle close.
page.removePartListener(partListener);
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOEditorUtil.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOEditorUtil.java
index 936f28dc34..3df12d392f 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOEditorUtil.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/ui/CDOEditorUtil.java
@@ -12,6 +12,7 @@
*/
package org.eclipse.emf.cdo.ui;
+import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.eresource.CDOResource;
import org.eclipse.emf.cdo.eresource.CDOResourceLeaf;
import org.eclipse.emf.cdo.internal.ui.CDOEditorInputImpl;
@@ -21,6 +22,7 @@ import org.eclipse.emf.cdo.internal.ui.editor.CDOEditor;
import org.eclipse.emf.cdo.view.CDOView;
import org.eclipse.net4j.util.ObjectUtil;
+import org.eclipse.net4j.util.om.OMPlatform;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.edit.domain.IEditingDomainProvider;
@@ -66,7 +68,7 @@ public final class CDOEditorUtil
private static final Map<CDOResourceLeaf, String> EDITOR_OVERRIDES = new WeakHashMap<>();
- private static String editorID = EDITOR_ID;
+ private static String editorID = OMPlatform.INSTANCE.getProperty("org.eclipse.emf.cdo.ui.editorID", EDITOR_ID);
private CDOEditorUtil()
{
@@ -200,38 +202,69 @@ public final class CDOEditorUtil
}
/**
- * Returns references to possibly opened instances of CDOEditor with certain CDOView and resource
+ * Returns references to open instances of {@link CDOEditor} with given {@link CDOView}, resource path, and object ID.
*
* @param page
- * The page where to search for opened editors
+ * The {@link IWorkbenchPage page} on which to search for open editors.
* @param view
- * The editors to find are using the specified CDOView
+ * The CDOView that the editors are filtered for, or <code>null</code> if view filtering is not applicable.
* @param resourcePath
- * The editors are editing the CDOResource specified with this path
+ * The resource path that the editors are filtered for, or <code>null</code> if resource path filtering is not applicable.
+ * @param objectID
+ * The object ID that the editors are filtered for, or <code>null</code> if object ID filtering is not applicable.
+ * @since 4.8
*/
- public static IEditorReference[] findEditor(IWorkbenchPage page, CDOView view, String resourcePath)
+ public static IEditorReference[] findEditor(IWorkbenchPage page, CDOView view, String resourcePath, CDOID objectID)
{
List<IEditorReference> result = new ArrayList<>();
- IEditorReference[] editorReferences = page.getEditorReferences();
- for (IEditorReference editorReference : editorReferences)
+
+ for (IEditorReference editorReference : page.getEditorReferences())
{
try
{
- if (ObjectUtil.equals(editorReference.getId(), editorID))
+ if (!ObjectUtil.equals(editorReference.getId(), editorID))
+ {
+ continue;
+ }
+
+ IEditorInput editorInput = editorReference.getEditorInput();
+ if (!(editorInput instanceof CDOEditorInput))
+ {
+ continue;
+ }
+
+ CDOEditorInput cdoInput = (CDOEditorInput)editorInput;
+ if (view != null)
+ {
+ if (view != cdoInput.getView())
+ {
+ continue;
+ }
+ }
+
+ if (resourcePath != null)
+ {
+ if (!ObjectUtil.equals(resourcePath, cdoInput.getResourcePath()))
+ {
+ continue;
+ }
+ }
+
+ if (objectID != null)
{
- IEditorInput editorInput = editorReference.getEditorInput();
- if (editorInput instanceof CDOEditorInput)
+ if (!(cdoInput instanceof CDOEditorInput2))
+ {
+ continue;
+ }
+
+ CDOEditorInput2 cdoInput2 = (CDOEditorInput2)cdoInput;
+ if (!ObjectUtil.equals(objectID, cdoInput2.getObjectID()))
{
- CDOEditorInput cdoInput = (CDOEditorInput)editorInput;
- if (cdoInput.getView() == view)
- {
- if (resourcePath == null || ObjectUtil.equals(cdoInput.getResourcePath(), resourcePath))
- {
- result.add(editorReference);
- }
- }
+ continue;
}
}
+
+ result.add(editorReference);
}
catch (PartInitException ex)
{
@@ -243,6 +276,21 @@ public final class CDOEditorUtil
}
/**
+ * Returns references to open instances of {@link CDOEditor} with given {@link CDOView}, resource path, and object ID.
+ *
+ * @param page
+ * The {@link IWorkbenchPage page} on which to search for open editors.
+ * @param view
+ * The CDOView that the editors are filtered for, or <code>null</code> if view filtering is not applicable.
+ * @param resourcePath
+ * The resource path that the editors are filtered for, or <code>null</code> if resource path filtering is not applicable.
+ */
+ public static IEditorReference[] findEditor(IWorkbenchPage page, CDOView view, String resourcePath)
+ {
+ return findEditor(page, view, resourcePath, null);
+ }
+
+ /**
* @since 4.2
*/
public static void populateMenu(IMenuManager manager, CDOResourceLeaf resource, IWorkbenchPage page)
@@ -381,7 +429,7 @@ public final class CDOEditorUtil
* The page in which the editor will be opened
* @since 4.2
*/
- public static void openEditor(final IWorkbenchPage page, final String editorID, final CDOResourceLeaf resource)
+ public static void openEditor(IWorkbenchPage page, String editorID, CDOResourceLeaf resource)
{
Display display = page.getWorkbenchWindow().getShell().getDisplay();
display.asyncExec(new Runnable()
diff --git a/plugins/org.eclipse.net4j.util.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.net4j.util.ui/META-INF/MANIFEST.MF
index 5ca5f84a19..95558c99f0 100644
--- a/plugins/org.eclipse.net4j.util.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.net4j.util.ui/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.net4j.util.ui;singleton:=true
-Bundle-Version: 3.7.1.qualifier
+Bundle-Version: 3.8.0.qualifier
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
@@ -15,20 +15,20 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)",
org.eclipse.ui;bundle-version="[3.5.0,4.0.0)";visibility:=reexport,
org.eclipse.net4j.util;bundle-version="[3.0.0,4.0.0)";visibility:=reexport,
org.eclipse.net4j.ui.shared;bundle-version="[4.0.0,5.0.0)"
-Export-Package: org.eclipse.net4j.util.internal.ui;version="3.7.1";x-internal:=true,
- org.eclipse.net4j.util.internal.ui.actions;version="3.7.1";x-internal:=true,
- org.eclipse.net4j.util.internal.ui.bundle;version="3.7.1";x-internal:=true,
- org.eclipse.net4j.util.internal.ui.messages;version="3.7.1";x-internal:=true,
- org.eclipse.net4j.util.internal.ui.views;version="3.7.1";x-internal:=true,
- org.eclipse.net4j.util.ui;version="3.7.1",
- org.eclipse.net4j.util.ui.actions;version="3.7.1",
- org.eclipse.net4j.util.ui.confirmation;version="3.7.1",
- org.eclipse.net4j.util.ui.container;version="3.7.1",
- org.eclipse.net4j.util.ui.dnd;version="3.7.1",
- org.eclipse.net4j.util.ui.handlers;version="3.7.1",
- org.eclipse.net4j.util.ui.prefs;version="3.7.1",
- org.eclipse.net4j.util.ui.proposals;version="3.7.1",
- org.eclipse.net4j.util.ui.security;version="3.7.1",
- org.eclipse.net4j.util.ui.views;version="3.7.1",
- org.eclipse.net4j.util.ui.widgets;version="3.7.1"
+Export-Package: org.eclipse.net4j.util.internal.ui;version="3.8.0";x-internal:=true,
+ org.eclipse.net4j.util.internal.ui.actions;version="3.8.0";x-internal:=true,
+ org.eclipse.net4j.util.internal.ui.bundle;version="3.8.0";x-internal:=true,
+ org.eclipse.net4j.util.internal.ui.messages;version="3.8.0";x-internal:=true,
+ org.eclipse.net4j.util.internal.ui.views;version="3.8.0";x-internal:=true,
+ org.eclipse.net4j.util.ui;version="3.8.0",
+ org.eclipse.net4j.util.ui.actions;version="3.8.0",
+ org.eclipse.net4j.util.ui.confirmation;version="3.8.0",
+ org.eclipse.net4j.util.ui.container;version="3.8.0",
+ org.eclipse.net4j.util.ui.dnd;version="3.8.0",
+ org.eclipse.net4j.util.ui.handlers;version="3.8.0",
+ org.eclipse.net4j.util.ui.prefs;version="3.8.0",
+ org.eclipse.net4j.util.ui.proposals;version="3.8.0",
+ org.eclipse.net4j.util.ui.security;version="3.8.0",
+ org.eclipse.net4j.util.ui.views;version="3.8.0",
+ org.eclipse.net4j.util.ui.widgets;version="3.8.0"
Automatic-Module-Name: org.eclipse.net4j.util.ui
diff --git a/plugins/org.eclipse.net4j.util.ui/pom.xml b/plugins/org.eclipse.net4j.util.ui/pom.xml
index 866f1fbc29..e5dd1986e0 100644
--- a/plugins/org.eclipse.net4j.util.ui/pom.xml
+++ b/plugins/org.eclipse.net4j.util.ui/pom.xml
@@ -25,7 +25,7 @@
<groupId>org.eclipse.emf.cdo</groupId>
<artifactId>org.eclipse.net4j.util.ui</artifactId>
- <version>3.7.1-SNAPSHOT</version>
+ <version>3.8.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/prefs/PrefBoolean.java b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/prefs/PrefBoolean.java
new file mode 100644
index 0000000000..50c6da9440
--- /dev/null
+++ b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/prefs/PrefBoolean.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2015, 2019 Eike Stepper (Loehne, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms 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.net4j.util.ui.prefs;
+
+import org.eclipse.net4j.util.om.pref.OMPreference;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * @author Eike Stepper
+ * @since 3.8
+ */
+public class PrefBoolean extends Composite implements OMPreference.Participant
+{
+ private final OMPreference<Boolean> booleanPreference;
+
+ private final Button button;
+
+ public PrefBoolean(Composite parent, int buttonStyle, OMPreference<Boolean> booleanPreference)
+ {
+ super(parent, SWT.NONE);
+ this.booleanPreference = booleanPreference;
+
+ setLayout(new FillLayout());
+ button = new Button(this, buttonStyle);
+ }
+
+ public final OMPreference<Boolean> getBooleanPreference()
+ {
+ return booleanPreference;
+ }
+
+ public final Button getButton()
+ {
+ return button;
+ }
+
+ @Override
+ public void loadPreferences()
+ {
+ button.setSelection(booleanPreference.getValue());
+ }
+
+ @Override
+ public void savePreferences()
+ {
+ booleanPreference.setValue(button.getSelection());
+ }
+}

Back to the top