Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.emf.cdo.admin/META-INF/MANIFEST.MF10
-rw-r--r--plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/CDOAdminClientRepositoryImpl.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/CDOBranch.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchImpl.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/META-INF/MANIFEST.MF4
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/commands.txt80
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/icons/connect.gifbin0 -> 202 bytes
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/icons/disconnect.gifbin0 -> 151 bytes
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/plugin.xml114
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/CDOCheckoutContentProvider.java38
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/CDOCheckoutLabelProvider.java17
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/CDORepositoriesView.java70
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/CDORepositoryItemProvider.java86
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/ViewerUtil.java3
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/handlers/BaseHandler.java62
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/handlers/RepositoryCheckoutHandler.java48
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/handlers/RepositoryConnectHandler.java54
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/handlers/RepositoryDisconnectHandler.java35
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/handlers/RepositoryHandler.java48
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/properties/ExplorerPropertiesAdapterFactory.java57
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer/META-INF/MANIFEST.MF4
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer/build.properties3
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer/plugin.xml34
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/CDOCheckoutSource.java31
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/CDORepository.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/CDOCheckoutImpl.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/CDOExplorerAdapterFactory.java90
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/CDORepositoryFactory.java31
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/CDORepositoryImpl.java44
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/CDORepositoryManagerImpl.java22
-rw-r--r--plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/properties/RepositoryProperties.java68
-rw-r--r--plugins/org.eclipse.emf.cdo.server.admin/META-INF/MANIFEST.MF18
-rw-r--r--plugins/org.eclipse.emf.cdo.server.admin/src/org/eclipse/emf/cdo/server/internal/admin/CDOAdminServerRepository.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java31
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/View.java8
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOPushTransaction.java7
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java8
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/SessionProperties.java7
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/AbstractCDOView.java9
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/META-INF/MANIFEST.MF12
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Buddy.java11
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Collaboration.java11
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Membership.java11
-rw-r--r--plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/spi/common/Facility.java11
-rw-r--r--plugins/org.eclipse.net4j.buddies.server/META-INF/MANIFEST.MF12
-rw-r--r--plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/ServerSession.java11
-rw-r--r--plugins/org.eclipse.net4j.buddies/META-INF/MANIFEST.MF10
-rw-r--r--plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/ClientSession.java11
-rw-r--r--plugins/org.eclipse.net4j.examples.installer/examples/org.eclipse.net4j.buddies.common/META-INF/MANIFEST.MF12
-rw-r--r--plugins/org.eclipse.net4j.examples.installer/examples/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Buddy.java11
-rw-r--r--plugins/org.eclipse.net4j.examples.installer/examples/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Collaboration.java11
-rw-r--r--plugins/org.eclipse.net4j.examples.installer/examples/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Membership.java11
-rw-r--r--plugins/org.eclipse.net4j.examples.installer/examples/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/spi/common/Facility.java11
-rw-r--r--plugins/org.eclipse.net4j.examples.installer/examples/org.eclipse.net4j.buddies.server/META-INF/MANIFEST.MF12
-rw-r--r--plugins/org.eclipse.net4j.examples.installer/examples/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/ServerSession.java11
-rw-r--r--plugins/org.eclipse.net4j.examples.installer/examples/org.eclipse.net4j.buddies/META-INF/MANIFEST.MF10
-rw-r--r--plugins/org.eclipse.net4j.examples.installer/examples/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/ClientSession.java11
-rw-r--r--plugins/org.eclipse.net4j.ui.shared/META-INF/MANIFEST.MF6
-rw-r--r--plugins/org.eclipse.net4j.ui.shared/icons/full/obj16/pending.gifbin643 -> 153 bytes
-rw-r--r--plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/UIUtil.java67
-rw-r--r--plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/actions/LongRunningAction.java55
-rw-r--r--plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/actions/LongRunningActionDelegate.java57
-rw-r--r--plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/handlers/LongRunningHandler.java79
-rw-r--r--plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/handlers/SafeHandler.java18
-rw-r--r--plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/views/ContainerItemProvider.java61
66 files changed, 1260 insertions, 469 deletions
diff --git a/plugins/org.eclipse.emf.cdo.admin/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.admin/META-INF/MANIFEST.MF
index d4750a057b..dbd9f48aee 100644
--- a/plugins/org.eclipse.emf.cdo.admin/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.admin/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.emf.cdo.admin; singleton:=true
-Bundle-Version: 4.1.200.qualifier
+Bundle-Version: 4.1.300.qualifier
Bundle-ClassPath: .
Bundle-Vendor: %providerName
Bundle-Localization: plugin
@@ -11,13 +11,13 @@ Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.eclipse.emf.cdo;bundle-version="[4.0.0,5.0.0)";visibility:=reexport,
org.eclipse.emf.cdo.net4j;bundle-version="[4.0.0,5.0.0)";visibility:=reexport,
org.eclipse.net4j;bundle-version="[4.0.0,5.0.0)";visibility:=reexport
-Export-Package: org.eclipse.emf.cdo.admin;version="4.1.200",
- org.eclipse.emf.cdo.internal.admin;version="4.1.200";
+Export-Package: org.eclipse.emf.cdo.admin;version="4.1.300",
+ org.eclipse.emf.cdo.internal.admin;version="4.1.300";
x-friends:="org.eclipse.emf.cdo.tests,
org.eclipse.emf.cdo.defs,
org.eclipse.emf.cdo.ui,
org.eclipse.emf.cdo.ui.admin,
org.eclipse.emf.cdo.examples",
- org.eclipse.emf.cdo.internal.admin.bundle;version="4.1.200";x-friends:="org.eclipse.emf.cdo.tests",
- org.eclipse.emf.cdo.internal.admin.protocol;version="4.1.200";x-internal:=true
+ org.eclipse.emf.cdo.internal.admin.bundle;version="4.1.300";x-friends:="org.eclipse.emf.cdo.tests",
+ org.eclipse.emf.cdo.internal.admin.protocol;version="4.1.300";x-internal:=true
Bundle-ActivationPolicy: lazy
diff --git a/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/CDOAdminClientRepositoryImpl.java b/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/CDOAdminClientRepositoryImpl.java
index f688ff9afe..86041baa01 100644
--- a/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/CDOAdminClientRepositoryImpl.java
+++ b/plugins/org.eclipse.emf.cdo.admin/src/org/eclipse/emf/cdo/internal/admin/CDOAdminClientRepositoryImpl.java
@@ -23,12 +23,12 @@ import org.eclipse.emf.cdo.net4j.CDONet4jUtil;
import org.eclipse.emf.cdo.spi.common.protocol.CDODataInputImpl;
import org.eclipse.net4j.connector.IConnector;
+import org.eclipse.net4j.util.AdapterUtil;
import org.eclipse.net4j.util.event.Notifier;
import org.eclipse.net4j.util.io.ExtendedDataInputStream;
import org.eclipse.net4j.util.om.monitor.NotifyingMonitor;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Platform;
import java.io.IOException;
import java.util.HashSet;
@@ -209,9 +209,10 @@ public class CDOAdminClientRepositoryImpl extends Notifier implements CDOAdminCl
return configuration.openNet4jSession();
}
- public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter)
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public Object getAdapter(Class adapter)
{
- return Platform.getAdapterManager().getAdapter(this, adapter);
+ return AdapterUtil.adapt(this, adapter);
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/CDOBranch.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/CDOBranch.java
index 52ec5f82e0..1477556452 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/CDOBranch.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/common/branch/CDOBranch.java
@@ -17,6 +17,8 @@ import org.eclipse.emf.cdo.common.util.CDOTimeProvider;
import org.eclipse.net4j.util.container.IContainer;
+import org.eclipse.core.runtime.IAdaptable;
+
/**
* Represents a <i>stream of changes</i> that is isolated from other streams of changes.
* <p>
@@ -36,7 +38,7 @@ import org.eclipse.net4j.util.container.IContainer;
* @apiviz.has {@link CDOBranchPoint} oneway - - base
* @apiviz.composedOf {@link CDOBranch} - - subBranches
*/
-public interface CDOBranch extends IContainer<CDOBranch>, Comparable<CDOBranch>
+public interface CDOBranch extends IContainer<CDOBranch>, Comparable<CDOBranch>, IAdaptable
{
/**
* The fixed ID of the {@link CDOBranchManager#getMainBranch() main branch}.
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchImpl.java
index 2073ef2d14..16038d98da 100644
--- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchImpl.java
+++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/branch/CDOBranchImpl.java
@@ -20,6 +20,7 @@ import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranchManager.BranchLoad
import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranchManager.BranchLoader.BranchInfo;
import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranchManager.BranchLoader.SubBranchInfo;
+import org.eclipse.net4j.util.AdapterUtil;
import org.eclipse.net4j.util.container.Container;
import java.text.MessageFormat;
@@ -289,6 +290,12 @@ public class CDOBranchImpl extends Container<CDOBranch> implements InternalCDOBr
fireElementAddedEvent(branch);
}
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public Object getAdapter(Class adapter)
+ {
+ return AdapterUtil.adapt(this, adapter);
+ }
+
public int compareTo(CDOBranch o)
{
int otherID = o.getID();
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 1ed45edeca..a3bbeebe48 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
@@ -17,5 +17,7 @@ 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)"
Export-Package: org.eclipse.emf.cdo.explorer.ui;version="4.4.0";x-internal:=true,
org.eclipse.emf.cdo.explorer.ui.application;version="4.4.0";x-internal:=true,
- org.eclipse.emf.cdo.explorer.ui.bundle;version="4.4.0";x-internal:=true
+ org.eclipse.emf.cdo.explorer.ui.bundle;version="4.4.0";x-internal:=true,
+ org.eclipse.emf.cdo.explorer.ui.handlers;version="4.4.0";x-internal:=true,
+ org.eclipse.emf.cdo.explorer.ui.properties;version="4.4.0";x-internal:=true
Eclipse-BuddyPolicy: registered
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/commands.txt b/plugins/org.eclipse.emf.cdo.explorer.ui/commands.txt
new file mode 100644
index 0000000000..20ce8c2920
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/commands.txt
@@ -0,0 +1,80 @@
+CDORepository (connected/disconnected)
+--------------------------------------------
+ Connect
+ ----------------------
+ New --> Branch...
+ Tag...
+ ----------------------
+ Show In --> History
+ CDO Administration
+ CDO Sessions
+ ----------------------
+ Checkout
+ Checkout As...
+ ----------------------
+ Delete...
+ Disconnect
+ ----------------------
+ Properties...
+
+
+CDOBranch | CDOTag
+--------------------------------------------
+ New --> Branch...
+ Tag...
+ ----------------------
+ Show In --> History
+ CDO Sessions
+ ----------------------
+ Checkout
+ Checkout As...
+ ----------------------
+ Rename...
+ Delete...
+ ----------------------
+ Properties...
+
+
+CDOCheckout (open/closed)
+--------------------------------------------
+ Open Checkout
+ ----------------------
+ New --> [allowed children...]
+ ----------------------
+ Open
+ Open With --> [applicable editors...]
+ Show In --> History
+ CDO Sessions
+ ----------------------
+ Compare With --> Each Other
+ ...
+ Switch To --> New Branch...
+ [branch history]
+ Other...
+ Merge...
+ ----------------------
+ Delete Checkout...
+ Close Checkout
+ ----------------------
+ Properties...
+
+
+EObject (including CDOResourceNodes)
+--------------------------------------------
+ New --> [allowed children...]
+ ----------------------
+ Open
+ Open With --> [applicable editors...]
+ Show In --> History
+ CDO Sessions
+ ----------------------
+ Compare With --> Each Other
+ ...
+ Switch To --> New Branch...
+ [branch history]
+ Other...
+ Merge...
+ ----------------------
+ Delete...
+ ----------------------
+ Properties...
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/icons/connect.gif b/plugins/org.eclipse.emf.cdo.explorer.ui/icons/connect.gif
new file mode 100644
index 0000000000..3b3ad7c16e
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/icons/connect.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/icons/disconnect.gif b/plugins/org.eclipse.emf.cdo.explorer.ui/icons/disconnect.gif
new file mode 100644
index 0000000000..ec8a8b01e4
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/icons/disconnect.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/plugin.xml b/plugins/org.eclipse.emf.cdo.explorer.ui/plugin.xml
index 85d5e43b6e..e41c68cc89 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/plugin.xml
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/plugin.xml
@@ -13,20 +13,30 @@
<plugin>
- <extension id="app" point="org.eclipse.core.runtime.applications" name="%app.name">
+ <extension id="app" point="org.eclipse.core.runtime.applications" name="%app.name">
<application>
<run class="org.eclipse.emf.cdo.explorer.ui.application.CDOExplorerApplication"/>
</application>
- </extension>
+ </extension>
- <extension id="product" point="org.eclipse.core.runtime.products">
- <product
- name="CDO Explorer"
- description="%product.description"
- application="org.eclipse.emf.cdo.explorer.app">
- <property name="appName" value="CDO Explorer"/>
- </product>
- </extension>
+ <extension id="product" point="org.eclipse.core.runtime.products">
+ <product
+ name="CDO Explorer"
+ description="%product.description"
+ application="org.eclipse.emf.cdo.explorer.app">
+ <property name="appName" value="CDO Explorer"/>
+ </product>
+ </extension>
+
+ <extension
+ point="org.eclipse.core.runtime.adapters">
+ <factory
+ adaptableType="org.eclipse.emf.cdo.explorer.CDORepository"
+ class="org.eclipse.emf.cdo.explorer.ui.properties.ExplorerPropertiesAdapterFactory">
+ <adapter type="org.eclipse.ui.views.properties.IPropertySourceProvider"/>
+ <adapter type="org.eclipse.ui.IActionFilter"/>
+ </factory>
+ </extension>
<extension
point="org.eclipse.ui.perspectives">
@@ -51,6 +61,90 @@
</extension>
<extension
+ point="org.eclipse.ui.commands">
+ <command
+ id="org.eclipse.emf.cdo.explorer.ui.RepositoryConnect"
+ name="Connect Repository"
+ defaultHandler="org.eclipse.emf.cdo.explorer.ui.handlers.RepositoryConnectHandler"/>
+ <command
+ id="org.eclipse.emf.cdo.explorer.ui.RepositoryDisconnect"
+ name="Connect Repository"
+ defaultHandler="org.eclipse.emf.cdo.explorer.ui.handlers.RepositoryDisconnectHandler"/>
+ <command
+ id="org.eclipse.emf.cdo.explorer.ui.RepositoryCheckout"
+ name="Checkout Repository"
+ defaultHandler="org.eclipse.emf.cdo.explorer.ui.handlers.RepositoryCheckoutHandler"/>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ allPopups="false"
+ locationURI="popup:org.eclipse.ui.popup.any?group=group.open">
+ <command
+ commandId="org.eclipse.emf.cdo.explorer.ui.RepositoryConnect"
+ icon="icons/connect.gif"
+ label="Connect"
+ style="push"
+ tooltip="Open a connection to the repository">
+ <visibleWhen checkEnabled="false">
+ <with variable="activeMenuSelection">
+ <iterate>
+ <and>
+ <adapt type="org.eclipse.emf.cdo.explorer.CDORepository"/>
+ <test property="org.eclipse.emf.cdo.explorer.repository.connected" value="false"/>
+ </and>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+ <menuContribution
+ allPopups="false"
+ locationURI="popup:org.eclipse.ui.popup.any?group=group.edit">
+ <command
+ commandId="org.eclipse.emf.cdo.explorer.ui.RepositoryDisconnect"
+ icon="icons/disconnect.gif"
+ label="Disconnect"
+ style="push"
+ tooltip="Close the connection to the repository">
+ <visibleWhen
+ checkEnabled="false">
+ <with
+ variable="activeMenuSelection">
+ <iterate>
+ <and>
+ <adapt type="org.eclipse.emf.cdo.explorer.CDORepository"/>
+ <test property="org.eclipse.emf.cdo.explorer.repository.connected" value="true"/>
+ </and>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+ <menuContribution
+ allPopups="false"
+ locationURI="popup:org.eclipse.ui.popup.any?group=group.checkout">
+ <command
+ commandId="org.eclipse.emf.cdo.explorer.ui.RepositoryCheckout"
+ icon="icons/checkout.gif"
+ label="Checkout"
+ style="push"
+ tooltip="Check the repository out">
+ <visibleWhen
+ checkEnabled="false">
+ <with
+ variable="activeMenuSelection">
+ <iterate>
+ <adapt type="org.eclipse.emf.cdo.explorer.CDOCheckoutSource"/>
+ </iterate>
+ </with>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+ </extension>
+
+ <extension
point="org.eclipse.ui.navigator.navigatorContent">
<navigatorContent
id="org.eclipse.emf.cdo.explorer.ui.CDOCheckouts"
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/CDOCheckoutContentProvider.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/CDOCheckoutContentProvider.java
index 5bf06a762c..793c10bce5 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/CDOCheckoutContentProvider.java
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/CDOCheckoutContentProvider.java
@@ -7,7 +7,6 @@
*
* Contributors:
* Eike Stepper - initial API and implementation
- * Victor Roldan Betancort - maintenance
*/
package org.eclipse.emf.cdo.explorer.ui;
@@ -58,8 +57,6 @@ import org.eclipse.jface.viewers.OpenEvent;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.events.TreeEvent;
-import org.eclipse.swt.events.TreeListener;
import org.eclipse.swt.widgets.TreeItem;
import java.lang.reflect.Method;
@@ -72,7 +69,7 @@ import java.util.concurrent.ConcurrentHashMap;
/**
* @author Eike Stepper
*/
-public class CDOCheckoutContentProvider extends AdapterFactoryContentProvider implements IOpenListener, TreeListener
+public class CDOCheckoutContentProvider extends AdapterFactoryContentProvider implements IOpenListener
{
private static final Method GET_CHILDREN_FEATURES_METHOD = getMethod(ItemProviderAdapter.class,
"getChildrenFeatures", Object.class);
@@ -155,14 +152,12 @@ public class CDOCheckoutContentProvider extends AdapterFactoryContentProvider im
if (viewer != null)
{
viewer.removeOpenListener(this);
- viewer.getTree().removeTreeListener(this);
}
viewer = newTreeViewer;
if (viewer != null)
{
- viewer.getTree().addTreeListener(this);
viewer.addOpenListener(this);
}
}
@@ -412,6 +407,19 @@ public class CDOCheckoutContentProvider extends AdapterFactoryContentProvider im
return ((ViewerUtil.Pending)object).getParent();
}
+ if (object instanceof EObject)
+ {
+ EObject eObject = (EObject)object;
+
+ {
+ Adapter adapter = EcoreUtil.getAdapter(eObject.eAdapters(), CDOCheckout.class);
+ if (adapter instanceof CDOCheckout)
+ {
+ return adapter;
+ }
+ }
+ }
+
return super.getParent(object);
}
@@ -445,24 +453,6 @@ public class CDOCheckoutContentProvider extends AdapterFactoryContentProvider im
super.notifyChanged(notification);
}
- public void treeCollapsed(TreeEvent e)
- {
- // TODO Check if this optimization is still needed!
- int xxx;
-
- // if (e.data instanceof EObject)
- // {
- // // Make sure that invisible children can be garbage collected.
- // // In getChildren() is a special check for collapsed parents that removes of the TreeItems from the Tree.
- // viewer.refresh(e.data, false);
- // }
- }
-
- public void treeExpanded(TreeEvent e)
- {
- // Do nothing.
- }
-
public void open(OpenEvent event)
{
ISelection selection = event.getSelection();
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/CDOCheckoutLabelProvider.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/CDOCheckoutLabelProvider.java
index 781c96c8a3..8b7bfbc253 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/CDOCheckoutLabelProvider.java
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/CDOCheckoutLabelProvider.java
@@ -22,6 +22,8 @@ import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;
import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.jface.viewers.IColorProvider;
+import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;
@@ -29,7 +31,7 @@ import org.eclipse.ui.PlatformUI;
/**
* @author Eike Stepper
*/
-public class CDOCheckoutLabelProvider extends AdapterFactoryLabelProvider
+public class CDOCheckoutLabelProvider extends AdapterFactoryLabelProvider implements IColorProvider
{
private final ComposedAdapterFactory adapterFactory;
@@ -112,7 +114,7 @@ public class CDOCheckoutLabelProvider extends AdapterFactoryLabelProvider
if (element instanceof ViewerUtil.Pending)
{
- return ContainerItemProvider.IMAGE_PENDING;
+ return ContainerItemProvider.PENDING_IMAGE;
}
try
@@ -124,4 +126,15 @@ public class CDOCheckoutLabelProvider extends AdapterFactoryLabelProvider
return errorImage;
}
}
+
+ @Override
+ public Color getForeground(Object object)
+ {
+ if (object instanceof ViewerUtil.Pending)
+ {
+ return ContainerItemProvider.PENDING_COLOR;
+ }
+
+ return super.getForeground(object);
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/CDORepositoriesView.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/CDORepositoriesView.java
index 87addb1cc3..bedaa82d1b 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/CDORepositoriesView.java
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/CDORepositoriesView.java
@@ -10,10 +10,6 @@
*/
package org.eclipse.emf.cdo.explorer.ui;
-import org.eclipse.emf.cdo.common.branch.CDOBranch;
-import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
-import org.eclipse.emf.cdo.common.id.CDOID;
-import org.eclipse.emf.cdo.explorer.CDOCheckoutManager;
import org.eclipse.emf.cdo.explorer.CDOExplorerUtil;
import org.eclipse.emf.cdo.explorer.CDORepository;
import org.eclipse.emf.cdo.explorer.CDORepositoryManager;
@@ -25,6 +21,7 @@ import org.eclipse.net4j.util.ui.views.ContainerItemProvider;
import org.eclipse.net4j.util.ui.views.ContainerView;
import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.GroupMarker;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.Separator;
@@ -103,7 +100,6 @@ public class CDORepositoriesView extends ContainerView
protected void fillLocalToolBar(IToolBarManager manager)
{
manager.add(newAction);
- manager.add(getRefreshAction());
super.fillLocalToolBar(manager);
}
@@ -112,11 +108,13 @@ public class CDORepositoriesView extends ContainerView
{
super.fillContextMenu(manager, selection);
- if (selection.size() == 1)
- {
- Object element = selection.getFirstElement();
- manager.add(new CheckoutAction(element));
- }
+ manager.add(new Separator("group.new"));
+ manager.add(new Separator("group.open"));
+ manager.add(new GroupMarker("group.openWith"));
+ manager.add(new Separator("group.checkout"));
+ manager.add(new Separator("group.edit"));
+ manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+ manager.add(new Separator("group.properties"));
}
@Override
@@ -124,14 +122,10 @@ public class CDORepositoriesView extends ContainerView
{
if (object instanceof CDORepository)
{
- CDORepository repository = (CDORepository)object;
+ final CDORepository repository = (CDORepository)object;
if (!repository.isConnected())
{
- int xxx;
- // TODO Make async!
- repository.connect();
-
- ViewerUtil.expand(getViewer(), repository, true);
+ connectRepository(repository);
return;
}
}
@@ -139,6 +133,11 @@ public class CDORepositoriesView extends ContainerView
super.doubleClicked(object);
}
+ public void connectRepository(CDORepository repository)
+ {
+ itemProvider.connectRepository(repository);
+ }
+
/**
* @author Eike Stepper
*/
@@ -251,43 +250,4 @@ public class CDORepositoriesView extends ContainerView
}
}
}
-
- /**
- * @author Eike Stepper
- */
- private final class CheckoutAction extends Action
- {
- private final Object element;
-
- public CheckoutAction(Object element)
- {
- this.element = element;
-
- setText("Checkout...");
- setToolTipText("Create an online checkout");
- setImageDescriptor(OM.getImageDescriptor("icons/add.gif"));
- }
-
- @Override
- public void run()
- {
- try
- {
- if (element instanceof CDORepository)
- {
- CDORepository repository = (CDORepository)element;
- CDOID rootID = repository.getSession().getRepositoryInfo().getRootResourceID();
-
- CDOCheckoutManager checkoutManager = CDOExplorerUtil.getCheckoutManager();
- checkoutManager.connect(repository.getLabel(), repository, CDOBranch.MAIN_BRANCH_NAME,
- CDOBranchPoint.UNSPECIFIED_DATE, false, rootID);
- }
- }
- catch (RuntimeException ex)
- {
- OM.LOG.error(ex);
- throw ex;
- }
- }
- }
}
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/CDORepositoryItemProvider.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/CDORepositoryItemProvider.java
index 4e0a5d535d..f63b049ce4 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/CDORepositoryItemProvider.java
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/CDORepositoryItemProvider.java
@@ -19,10 +19,8 @@ import org.eclipse.net4j.util.container.IContainer;
import org.eclipse.net4j.util.event.IEvent;
import org.eclipse.net4j.util.event.IListener;
import org.eclipse.net4j.util.ui.UIUtil;
-import org.eclipse.net4j.util.ui.actions.LongRunningAction;
import org.eclipse.net4j.util.ui.views.ContainerItemProvider;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.viewers.ITreeSelection;
import org.eclipse.jface.viewers.TreeViewer;
@@ -30,6 +28,9 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
/**
* @author Eike Stepper
*/
@@ -43,6 +44,8 @@ public class CDORepositoryItemProvider extends ContainerItemProvider<IContainer<
private final Image imageRepoDisconnected = new Image(UIUtil.getDisplay(), IMAGE_REPO, SWT.IMAGE_GRAY);
+ private final Map<CDORepository, CDORepository> connectingRepositories = new ConcurrentHashMap<CDORepository, CDORepository>();
+
private final IListener repositoryManagerListener = new IListener()
{
public void notifyEvent(IEvent event)
@@ -55,15 +58,13 @@ public class CDORepositoryItemProvider extends ContainerItemProvider<IContainer<
if (!e.isConnected())
{
+ Node node = getNode(repository);
+ node.disposeChildren();
+
ViewerUtil.expand(viewer, repository, false);
}
ViewerUtil.refresh(viewer, repository);
-
- // if (e.isConnected())
- // {
- // ViewerUtil.setExpandedState(viewer, repository, true);
- // }
}
}
};
@@ -85,6 +86,16 @@ public class CDORepositoryItemProvider extends ContainerItemProvider<IContainer<
return (TreeViewer)super.getViewer();
}
+ public void connectRepository(CDORepository repository)
+ {
+ // Mark this repository as connecting.
+ connectingRepositories.put(repository, repository);
+
+ TreeViewer viewer = getViewer();
+ ViewerUtil.refresh(viewer, repository); // Trigger hasChildren().
+ ViewerUtil.expand(viewer, repository, true); // Trigger getChildren().
+ }
+
@Override
public boolean hasChildren(Object element)
{
@@ -93,6 +104,12 @@ public class CDORepositoryItemProvider extends ContainerItemProvider<IContainer<
CDORepository repository = (CDORepository)element;
if (!repository.isConnected())
{
+ if (connectingRepositories.containsKey(repository))
+ {
+ // This must be the ContainerItemProvider.LazyElement.
+ return true;
+ }
+
return false;
}
}
@@ -108,7 +125,10 @@ public class CDORepositoryItemProvider extends ContainerItemProvider<IContainer<
CDORepository repository = (CDORepository)element;
if (!repository.isConnected())
{
- return ViewerUtil.NO_CHILDREN;
+ if (!connectingRepositories.containsKey(repository))
+ {
+ return ViewerUtil.NO_CHILDREN;
+ }
}
}
@@ -116,6 +136,21 @@ public class CDORepositoryItemProvider extends ContainerItemProvider<IContainer<
}
@Override
+ protected Object[] getContainerChildren(IContainer<?> container)
+ {
+ if (container instanceof CDORepository)
+ {
+ CDORepository repository = (CDORepository)container;
+ if (connectingRepositories.remove(repository) != null)
+ {
+ repository.connect();
+ }
+ }
+
+ return super.getContainerChildren(container);
+ }
+
+ @Override
public String getText(Object element)
{
if (element instanceof CDORepository)
@@ -174,14 +209,6 @@ public class CDORepositoryItemProvider extends ContainerItemProvider<IContainer<
public void fillContextMenu(IMenuManager manager, ITreeSelection selection)
{
super.fillContextMenu(manager, selection);
- if (selection.size() == 1)
- {
- Object obj = selection.getFirstElement();
- if (obj instanceof CDORepository)
- {
- manager.add(new DisconnectAction((CDORepository)obj));
- }
- }
}
@Override
@@ -201,13 +228,6 @@ public class CDORepositoryItemProvider extends ContainerItemProvider<IContainer<
return "Loading...";
}
- // @Override
- // protected void handleInactiveElement(Iterator<org.eclipse.net4j.util.ui.views.ContainerItemProvider.Node> it,
- // org.eclipse.net4j.util.ui.views.ContainerItemProvider.Node child)
- // {
- // // Do nothing.
- // }
-
@Override
protected void connectInput(IContainer<Object> input)
{
@@ -221,24 +241,4 @@ public class CDORepositoryItemProvider extends ContainerItemProvider<IContainer<
input.removeListener(repositoryManagerListener);
super.disconnectInput(input);
}
-
- /**
- * @author Eike Stepper
- */
- public static class DisconnectAction extends LongRunningAction
- {
- private CDORepository repository;
-
- public DisconnectAction(CDORepository repository)
- {
- super("Disconnect");
- this.repository = repository;
- }
-
- @Override
- protected void doRun(IProgressMonitor progressMonitor) throws Exception
- {
- repository.disconnect();
- }
- }
}
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/ViewerUtil.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/ViewerUtil.java
index 72b58a5973..95e3ba1c4b 100644
--- a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/ViewerUtil.java
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/ViewerUtil.java
@@ -7,7 +7,6 @@
*
* Contributors:
* Eike Stepper - initial API and implementation
- * Victor Roldan Betancort - maintenance
*/
package org.eclipse.emf.cdo.explorer.ui;
@@ -48,14 +47,12 @@ public final class ViewerUtil
}
else
{
- System.out.println("refreshViewer(" + element + ")");
viewer.refresh(element);
}
}
};
Display display = tree.getDisplay();
-
if (async)
{
display.asyncExec(runnable);
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/handlers/BaseHandler.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/handlers/BaseHandler.java
new file mode 100644
index 0000000000..4f4f0a4080
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/handlers/BaseHandler.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2009-2015 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms 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.handlers;
+
+import org.eclipse.net4j.util.ui.UIUtil;
+import org.eclipse.net4j.util.ui.handlers.LongRunningHandler;
+
+import org.eclipse.jface.viewers.ISelection;
+
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class BaseHandler<T> extends LongRunningHandler
+{
+ private final Class<T> type;
+
+ private final Boolean multi;
+
+ protected List<T> elements;
+
+ public BaseHandler(Class<T> type, Boolean multi)
+ {
+ this.type = type;
+ this.multi = multi;
+ }
+
+ @Override
+ protected boolean updateSelection(ISelection selection)
+ {
+ elements = UIUtil.adaptElements(getSelection(), type);
+ if (elements == null)
+ {
+ return false;
+ }
+
+ if (elements.isEmpty())
+ {
+ elements = null;
+ return false;
+ }
+
+ if (multi != null)
+ {
+ if (multi != elements.size() > 1)
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/handlers/RepositoryCheckoutHandler.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/handlers/RepositoryCheckoutHandler.java
new file mode 100644
index 0000000000..fa59b6c480
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/handlers/RepositoryCheckoutHandler.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2009-2015 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms 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.handlers;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.explorer.CDOCheckoutManager;
+import org.eclipse.emf.cdo.explorer.CDOCheckoutSource;
+import org.eclipse.emf.cdo.explorer.CDOExplorerUtil;
+import org.eclipse.emf.cdo.explorer.CDORepository;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+/**
+ * @author Eike Stepper
+ */
+public class RepositoryCheckoutHandler extends BaseHandler<CDOCheckoutSource>
+{
+ public RepositoryCheckoutHandler()
+ {
+ super(CDOCheckoutSource.class, null);
+ }
+
+ @Override
+ protected void doExecute(ExecutionEvent event, IProgressMonitor progressMonitor) throws Exception
+ {
+ for (CDOCheckoutSource checkoutSource : elements)
+ {
+ CDORepository repository = checkoutSource.getRepository();
+
+ String label = repository.getLabel();
+ String branchPath = checkoutSource.getBranchPath();
+ long timeStamp = checkoutSource.getTimeStamp();
+ CDOID rootID = checkoutSource.getRootID();
+
+ CDOCheckoutManager checkoutManager = CDOExplorerUtil.getCheckoutManager();
+ checkoutManager.connect(label, repository, branchPath, timeStamp, false, rootID);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/handlers/RepositoryConnectHandler.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/handlers/RepositoryConnectHandler.java
new file mode 100644
index 0000000000..8a6a92f99b
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/handlers/RepositoryConnectHandler.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2009-2015 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms 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.handlers;
+
+import org.eclipse.emf.cdo.explorer.CDORepository;
+import org.eclipse.emf.cdo.explorer.ui.CDORepositoriesView;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * @author Eike Stepper
+ */
+public class RepositoryConnectHandler extends RepositoryHandler
+{
+ public RepositoryConnectHandler()
+ {
+ super(null, false);
+ }
+
+ @Override
+ protected void doExecute(ExecutionEvent event, IProgressMonitor progressMonitor) throws Exception
+ {
+ CDORepositoriesView view = null;
+
+ IWorkbenchPart part = HandlerUtil.getActivePart(event);
+ if (part instanceof CDORepositoriesView)
+ {
+ view = (CDORepositoriesView)part;
+ }
+
+ for (CDORepository repository : elements)
+ {
+ if (view != null)
+ {
+ view.connectRepository(repository);
+ }
+ else
+ {
+ repository.connect();
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/handlers/RepositoryDisconnectHandler.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/handlers/RepositoryDisconnectHandler.java
new file mode 100644
index 0000000000..ff728e7e9b
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/handlers/RepositoryDisconnectHandler.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2009-2015 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms 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.handlers;
+
+import org.eclipse.emf.cdo.explorer.CDORepository;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+
+/**
+ * @author Eike Stepper
+ */
+public class RepositoryDisconnectHandler extends RepositoryHandler
+{
+ public RepositoryDisconnectHandler()
+ {
+ super(null, true);
+ }
+
+ @Override
+ protected void doExecute(IProgressMonitor progressMonitor) throws Exception
+ {
+ for (CDORepository repository : elements)
+ {
+ repository.disconnect();
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/handlers/RepositoryHandler.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/handlers/RepositoryHandler.java
new file mode 100644
index 0000000000..d96ba02fe0
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/handlers/RepositoryHandler.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2009-2015 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms 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.handlers;
+
+import org.eclipse.emf.cdo.explorer.CDORepository;
+
+import org.eclipse.jface.viewers.ISelection;
+
+/**
+ * @author Eike Stepper
+ */
+public abstract class RepositoryHandler extends BaseHandler<CDORepository>
+{
+ private final Boolean connected;
+
+ public RepositoryHandler(Boolean multi, Boolean connected)
+ {
+ super(CDORepository.class, multi);
+ this.connected = connected;
+ }
+
+ @Override
+ protected boolean updateSelection(ISelection selection)
+ {
+ boolean result = super.updateSelection(selection);
+
+ if (result && connected != null)
+ {
+ for (CDORepository repository : elements)
+ {
+ if (connected != repository.isConnected())
+ {
+ return false;
+ }
+ }
+ }
+
+ return result;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/properties/ExplorerPropertiesAdapterFactory.java b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/properties/ExplorerPropertiesAdapterFactory.java
new file mode 100644
index 0000000000..5b90203988
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.explorer.ui/src/org/eclipse/emf/cdo/explorer/ui/properties/ExplorerPropertiesAdapterFactory.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2011-2013 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms 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.properties;
+
+import org.eclipse.emf.cdo.explorer.CDORepository;
+import org.eclipse.emf.cdo.internal.explorer.properties.RepositoryProperties;
+import org.eclipse.emf.cdo.session.CDOSession;
+
+import org.eclipse.net4j.util.ui.AbstractPropertyAdapterFactory;
+import org.eclipse.net4j.util.ui.DefaultActionFilter;
+import org.eclipse.net4j.util.ui.DefaultPropertySource;
+
+import org.eclipse.ui.IActionFilter;
+import org.eclipse.ui.views.properties.IPropertySource;
+
+/**
+ * @author Eike Stepper
+ */
+public class ExplorerPropertiesAdapterFactory extends AbstractPropertyAdapterFactory
+{
+ private static final IActionFilter REPOSITORY_ACTION_FILTER = new DefaultActionFilter<CDORepository>(
+ RepositoryProperties.INSTANCE);
+
+ public ExplorerPropertiesAdapterFactory()
+ {
+ }
+
+ @Override
+ protected IPropertySource createPropertySource(Object object)
+ {
+ if (object instanceof CDORepository)
+ {
+ return new DefaultPropertySource<CDORepository>((CDORepository)object, RepositoryProperties.INSTANCE);
+ }
+
+ return null;
+ }
+
+ @Override
+ protected IActionFilter createActionFilter(Object object)
+ {
+ if (object instanceof CDOSession)
+ {
+ return REPOSITORY_ACTION_FILTER;
+ }
+
+ return super.createActionFilter(object);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.explorer/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.explorer/META-INF/MANIFEST.MF
index 90caed628d..0c7285ad36 100644
--- a/plugins/org.eclipse.emf.cdo.explorer/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.explorer/META-INF/MANIFEST.MF
@@ -10,8 +10,10 @@ Bundle-Localization: plugin
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)",
+ org.eclipse.core.expressions;bundle-version="[3.4.0,4.0.0)",
org.eclipse.emf.cdo.net4j;bundle-version="[4.0.0,5.0.0)";visibility:=reexport
Export-Package: org.eclipse.emf.cdo.explorer;version="4.4.0",
org.eclipse.emf.cdo.internal.explorer;version="4.4.0";x-friends:="org.eclipse.emf.cdo.explorer.ui",
- org.eclipse.emf.cdo.internal.explorer.bundle;version="4.4.0";x-internal:=true
+ org.eclipse.emf.cdo.internal.explorer.bundle;version="4.4.0";x-internal:=true,
+ org.eclipse.emf.cdo.internal.explorer.properties;version="4.4.0";x-friends:="org.eclipse.emf.cdo.explorer.ui"
Eclipse-BuddyPolicy: registered
diff --git a/plugins/org.eclipse.emf.cdo.explorer/build.properties b/plugins/org.eclipse.emf.cdo.explorer/build.properties
index fef2dbb588..ae28a2f2ec 100644
--- a/plugins/org.eclipse.emf.cdo.explorer/build.properties
+++ b/plugins/org.eclipse.emf.cdo.explorer/build.properties
@@ -15,7 +15,8 @@ bin.includes = META-INF/,\
.,\
plugin.properties,\
.options,\
- about.html
+ about.html,\
+ plugin.xml
src.includes = about.html
generateSourceReferences = true
diff --git a/plugins/org.eclipse.emf.cdo.explorer/plugin.xml b/plugins/org.eclipse.emf.cdo.explorer/plugin.xml
new file mode 100644
index 0000000000..d09d7a3945
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.explorer/plugin.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<!--
+ Copyright (c) 2011-2013 Eike Stepper (Berlin, Germany) and others.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms 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
+-->
+
+<plugin>
+
+ <extension
+ point="org.eclipse.core.runtime.adapters">
+ <factory
+ adaptableType="org.eclipse.emf.cdo.common.branch.CDOBranch"
+ class="org.eclipse.emf.cdo.internal.explorer.CDOExplorerAdapterFactory">
+ <adapter type="org.eclipse.emf.cdo.explorer.CDOCheckoutSource"/>
+ </factory>
+ </extension>
+
+ <extension point="org.eclipse.core.expressions.propertyTesters">
+ <propertyTester
+ id="org.eclipse.emf.cdo.explorer.repository.properties"
+ type="org.eclipse.emf.cdo.explorer.CDORepository"
+ namespace="org.eclipse.emf.cdo.explorer.repository"
+ properties="connected"
+ class="org.eclipse.emf.cdo.internal.explorer.properties.RepositoryProperties$Tester"/>
+ </extension>
+
+</plugin>
diff --git a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/CDOCheckoutSource.java b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/CDOCheckoutSource.java
new file mode 100644
index 0000000000..3c663deb44
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/CDOCheckoutSource.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2010-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.explorer;
+
+import org.eclipse.emf.cdo.common.id.CDOID;
+
+/**
+ * A source for CDO checkouts.
+ *
+ * @author Eike Stepper
+ * @since 4.4
+ * @apiviz.landmark
+ */
+public interface CDOCheckoutSource
+{
+ public CDORepository getRepository();
+
+ public String getBranchPath();
+
+ public long getTimeStamp();
+
+ public CDOID getRootID();
+}
diff --git a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/CDORepository.java b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/CDORepository.java
index f9ec7b6bee..5579fca279 100644
--- a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/CDORepository.java
+++ b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/explorer/CDORepository.java
@@ -15,6 +15,8 @@ import org.eclipse.emf.cdo.session.CDOSessionProvider;
import org.eclipse.net4j.util.container.IContainer;
+import org.eclipse.core.runtime.IAdaptable;
+
/**
* A CDO server independent representation of a repository.
*
@@ -22,7 +24,7 @@ import org.eclipse.net4j.util.container.IContainer;
* @since 4.4
* @apiviz.landmark
*/
-public interface CDORepository extends IContainer<CDOBranch>, CDOSessionProvider
+public interface CDORepository extends IContainer<CDOBranch>, CDOSessionProvider, IAdaptable
{
public String getLabel();
diff --git a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/CDOCheckoutImpl.java b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/CDOCheckoutImpl.java
index fdaf9f1083..860427a056 100644
--- a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/CDOCheckoutImpl.java
+++ b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/CDOCheckoutImpl.java
@@ -17,6 +17,7 @@ import org.eclipse.emf.cdo.explorer.CDORepository;
import org.eclipse.emf.cdo.session.CDOSession;
import org.eclipse.emf.cdo.view.CDOView;
+import org.eclipse.net4j.util.AdapterUtil;
import org.eclipse.net4j.util.event.IEvent;
import org.eclipse.net4j.util.event.IListener;
import org.eclipse.net4j.util.lifecycle.ILifecycleEvent;
@@ -25,8 +26,6 @@ import org.eclipse.net4j.util.lifecycle.ILifecycleEvent.Kind;
import org.eclipse.emf.common.notify.impl.AdapterImpl;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.core.runtime.Platform;
-
/**
* @author Eike Stepper
*/
@@ -211,14 +210,15 @@ public abstract class CDOCheckoutImpl extends AdapterImpl implements CDOCheckout
return super.isAdapterForType(type);
}
- public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter)
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public Object getAdapter(Class adapter)
{
if (adapter == EObject.class)
{
return rootObject;
}
- return Platform.getAdapterManager().getAdapter(this, adapter);
+ return AdapterUtil.adapt(this, adapter);
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/CDOExplorerAdapterFactory.java b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/CDOExplorerAdapterFactory.java
new file mode 100644
index 0000000000..6f30cde16d
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/CDOExplorerAdapterFactory.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2011-2013 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms 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.explorer;
+
+import org.eclipse.emf.cdo.common.CDOCommonRepository;
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.common.id.CDOID;
+import org.eclipse.emf.cdo.explorer.CDOCheckoutSource;
+import org.eclipse.emf.cdo.explorer.CDOExplorerUtil;
+import org.eclipse.emf.cdo.explorer.CDORepository;
+import org.eclipse.emf.cdo.session.CDORepositoryInfo;
+import org.eclipse.emf.cdo.session.CDOSession;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+
+/**
+ * @since 4.4
+ */
+@SuppressWarnings("rawtypes")
+public class CDOExplorerAdapterFactory implements IAdapterFactory
+{
+ private static final Class[] CLASSES = { CDOCheckoutSource.class };
+
+ public CDOExplorerAdapterFactory()
+ {
+ }
+
+ public Class[] getAdapterList()
+ {
+ return CLASSES;
+ }
+
+ public Object getAdapter(Object adaptableObject, Class adapterType)
+ {
+ if (adapterType == CLASSES[0])
+ {
+ if (adaptableObject instanceof CDOBranch)
+ {
+ final CDOBranch branch = (CDOBranch)adaptableObject;
+
+ CDOCommonRepository commonRepository = branch.getBranchManager().getRepository();
+ if (commonRepository instanceof CDORepositoryInfo)
+ {
+ final CDORepositoryInfo repositoryInfo = (CDORepositoryInfo)commonRepository;
+ CDOSession session = repositoryInfo.getSession();
+
+ CDORepositoryManagerImpl repositoryManager = (CDORepositoryManagerImpl)CDOExplorerUtil.getRepositoryManager();
+ final CDORepository repository = repositoryManager.getRepository(session);
+
+ if (repository != null)
+ {
+ return new CDOCheckoutSource()
+ {
+ public CDORepository getRepository()
+ {
+ return repository;
+ }
+
+ public String getBranchPath()
+ {
+ return branch.getPathName();
+ }
+
+ public long getTimeStamp()
+ {
+ return CDOBranchPoint.UNSPECIFIED_DATE;
+ }
+
+ public CDOID getRootID()
+ {
+ return repositoryInfo.getRootResourceID();
+ }
+ };
+ }
+ }
+ }
+ }
+
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/CDORepositoryFactory.java b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/CDORepositoryFactory.java
deleted file mode 100644
index a7f17b4596..0000000000
--- a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/CDORepositoryFactory.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2004-2014 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms 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.explorer;
-
-import org.eclipse.emf.cdo.explorer.CDORepository;
-
-import org.eclipse.net4j.util.factory.Factory;
-import org.eclipse.net4j.util.factory.ProductCreationException;
-
-/**
- * @author Eike Stepper
- */
-public abstract class CDORepositoryFactory extends Factory
-{
- public static final String PRODUCT_GROUP = "org.eclipse.emf.cdo.explorer.repositories";
-
- public CDORepositoryFactory(String type)
- {
- super(PRODUCT_GROUP, type);
- }
-
- public abstract CDORepository create(String description) throws ProductCreationException;
-}
diff --git a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/CDORepositoryImpl.java b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/CDORepositoryImpl.java
index 5d426245bc..393f7eef4d 100644
--- a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/CDORepositoryImpl.java
+++ b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/CDORepositoryImpl.java
@@ -12,7 +12,10 @@ package org.eclipse.emf.cdo.internal.explorer;
import org.eclipse.emf.cdo.common.CDOCommonSession.Options.PassiveUpdateMode;
import org.eclipse.emf.cdo.common.branch.CDOBranch;
+import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
+import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.explorer.CDOCheckout;
+import org.eclipse.emf.cdo.explorer.CDOCheckoutSource;
import org.eclipse.emf.cdo.explorer.CDORepository;
import org.eclipse.emf.cdo.explorer.CDORepositoryManager;
import org.eclipse.emf.cdo.net4j.CDONet4jSessionConfiguration;
@@ -22,6 +25,7 @@ import org.eclipse.emf.cdo.session.CDOSessionConfiguration;
import org.eclipse.net4j.Net4jUtil;
import org.eclipse.net4j.connector.IConnector;
+import org.eclipse.net4j.util.AdapterUtil;
import org.eclipse.net4j.util.ObjectUtil;
import org.eclipse.net4j.util.container.ContainerEvent;
import org.eclipse.net4j.util.container.IContainerEvent;
@@ -131,17 +135,21 @@ public abstract class CDORepositoryImpl extends Notifier implements CDORepositor
if (connected)
{
- ((CDORepositoryManagerImpl)repositoryManager).fireRepositoryConnectionEvent(this, true);
+ ((CDORepositoryManagerImpl)repositoryManager).fireRepositoryConnectionEvent(this, session, true);
}
}
public void disconnect()
{
boolean disconnected = false;
+ CDOSession oldSession = null;
+
synchronized (sessionListener)
{
if (isConnected())
{
+ oldSession = session;
+
session.close();
session = null;
@@ -151,7 +159,7 @@ public abstract class CDORepositoryImpl extends Notifier implements CDORepositor
if (disconnected)
{
- ((CDORepositoryManagerImpl)repositoryManager).fireRepositoryConnectionEvent(this, false);
+ ((CDORepositoryManagerImpl)repositoryManager).fireRepositoryConnectionEvent(this, oldSession, false);
}
}
@@ -222,6 +230,38 @@ public abstract class CDORepositoryImpl extends Notifier implements CDORepositor
return new CDOBranch[0];
}
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public Object getAdapter(Class adapter)
+ {
+ if (adapter == CDOCheckoutSource.class && isConnected())
+ {
+ return new CDOCheckoutSource()
+ {
+ public CDORepository getRepository()
+ {
+ return CDORepositoryImpl.this;
+ }
+
+ public String getBranchPath()
+ {
+ return CDOBranch.MAIN_BRANCH_NAME;
+ }
+
+ public long getTimeStamp()
+ {
+ return CDOBranchPoint.UNSPECIFIED_DATE;
+ }
+
+ public CDOID getRootID()
+ {
+ return session.getRepositoryInfo().getRootResourceID();
+ }
+ };
+ }
+
+ return AdapterUtil.adapt(this, adapter);
+ }
+
@Override
public boolean equals(Object obj)
{
diff --git a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/CDORepositoryManagerImpl.java b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/CDORepositoryManagerImpl.java
index 5d47707133..50be31cf24 100644
--- a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/CDORepositoryManagerImpl.java
+++ b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/CDORepositoryManagerImpl.java
@@ -12,15 +12,21 @@ package org.eclipse.emf.cdo.internal.explorer;
import org.eclipse.emf.cdo.explorer.CDORepository;
import org.eclipse.emf.cdo.explorer.CDORepositoryManager;
+import org.eclipse.emf.cdo.session.CDOSession;
import org.eclipse.net4j.util.container.SetContainer;
import org.eclipse.net4j.util.event.Event;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
/**
* @author Eike Stepper
*/
public class CDORepositoryManagerImpl extends SetContainer<CDORepository> implements CDORepositoryManager
{
+ private final Map<CDOSession, CDORepository> sessionMap = new ConcurrentHashMap<CDOSession, CDORepository>();
+
public CDORepositoryManagerImpl()
{
super(CDORepository.class);
@@ -48,8 +54,22 @@ public class CDORepositoryManagerImpl extends SetContainer<CDORepository> implem
}
}
- public void fireRepositoryConnectionEvent(CDORepository repository, boolean connected)
+ public CDORepository getRepository(CDOSession session)
+ {
+ return sessionMap.get(session);
+ }
+
+ public void fireRepositoryConnectionEvent(CDORepository repository, CDOSession session, boolean connected)
{
+ if (connected)
+ {
+ sessionMap.put(session, repository);
+ }
+ else
+ {
+ sessionMap.remove(session);
+ }
+
fireEvent(new RepositoryConnectionEventImpl(this, repository, connected));
}
diff --git a/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/properties/RepositoryProperties.java b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/properties/RepositoryProperties.java
new file mode 100644
index 0000000000..ac0c348fc0
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.explorer/src/org/eclipse/emf/cdo/internal/explorer/properties/RepositoryProperties.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2011-2013 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms 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.explorer.properties;
+
+import org.eclipse.emf.cdo.explorer.CDORepository;
+
+import org.eclipse.net4j.util.AdapterUtil;
+import org.eclipse.net4j.util.properties.DefaultPropertyTester;
+import org.eclipse.net4j.util.properties.IProperties;
+import org.eclipse.net4j.util.properties.Properties;
+import org.eclipse.net4j.util.properties.Property;
+
+/**
+ * @author Eike Stepper
+ */
+public class RepositoryProperties extends Properties<CDORepository>
+{
+ public static final IProperties<CDORepository> INSTANCE = new RepositoryProperties();
+
+ private static final String CATEGORY_REPOSITORY = "Repository"; //$NON-NLS-1$
+
+ private RepositoryProperties()
+ {
+ super(CDORepository.class);
+
+ add(new Property<CDORepository>("connected", "Connected", "Whether this repository is connected or not",
+ CATEGORY_REPOSITORY)
+ {
+ @Override
+ protected Object eval(CDORepository repository)
+ {
+ return repository.isConnected();
+ }
+ });
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ public Object getAdapter(Class adapter)
+ {
+ return AdapterUtil.adapt(this, adapter);
+ }
+
+ public static void main(String[] args)
+ {
+ new Tester().dumpContributionMarkup();
+ }
+
+ /**
+ * @author Eike Stepper
+ */
+ public static final class Tester extends DefaultPropertyTester<CDORepository>
+ {
+ public static final String NAMESPACE = "org.eclipse.emf.cdo.explorer.repository";
+
+ public Tester()
+ {
+ super(NAMESPACE, INSTANCE);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.server.admin/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.server.admin/META-INF/MANIFEST.MF
index e5c660271b..efcadded3f 100644
--- a/plugins/org.eclipse.emf.cdo.server.admin/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.server.admin/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.emf.cdo.server.admin;singleton:=true
-Bundle-Version: 4.2.0.qualifier
+Bundle-Version: 4.2.100.qualifier
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
@@ -17,11 +17,11 @@ Require-Bundle: org.eclipse.core.runtime;resolution:=optional;bundle-version="[3
org.eclipse.emf.cdo.server.security;bundle-version="[4.3.0,5.0.0)",
org.eclipse.emf.cdo.security;bundle-version="[4.3.0,5.0.0)",
org.eclipse.net4j.jvm;bundle-version="[4.1.100,5.0.0)";resolution:=optional
-Export-Package: org.eclipse.emf.cdo.server.admin;version="4.2.0",
- org.eclipse.emf.cdo.server.internal.admin;x-internal:=true;version="4.2.0",
- org.eclipse.emf.cdo.server.internal.admin.bundle;x-internal:=true;version="4.2.0",
- org.eclipse.emf.cdo.server.internal.admin.protocol;x-internal:=true;version="4.2.0",
- org.eclipse.emf.cdo.server.spi.admin;version="4.2.0",
- org.eclipse.emf.cdo.server.internal.admin.catalog;x-internal:=true;version="4.2.0",
- org.eclipse.emf.cdo.server.internal.admin.catalog.impl;x-internal:=true;version="4.2.0",
- org.eclipse.emf.cdo.server.internal.admin.catalog.util;x-internal:=true;version="4.2.0"
+Export-Package: org.eclipse.emf.cdo.server.admin;version="4.2.100",
+ org.eclipse.emf.cdo.server.internal.admin;x-internal:=true;version="4.2.100",
+ org.eclipse.emf.cdo.server.internal.admin.bundle;x-internal:=true;version="4.2.100",
+ org.eclipse.emf.cdo.server.internal.admin.protocol;x-internal:=true;version="4.2.100",
+ org.eclipse.emf.cdo.server.spi.admin;version="4.2.100",
+ org.eclipse.emf.cdo.server.internal.admin.catalog;x-internal:=true;version="4.2.100",
+ org.eclipse.emf.cdo.server.internal.admin.catalog.impl;x-internal:=true;version="4.2.100",
+ org.eclipse.emf.cdo.server.internal.admin.catalog.util;x-internal:=true;version="4.2.100"
diff --git a/plugins/org.eclipse.emf.cdo.server.admin/src/org/eclipse/emf/cdo/server/internal/admin/CDOAdminServerRepository.java b/plugins/org.eclipse.emf.cdo.server.admin/src/org/eclipse/emf/cdo/server/internal/admin/CDOAdminServerRepository.java
index 999a6aeec8..bfbad5e03d 100644
--- a/plugins/org.eclipse.emf.cdo.server.admin/src/org/eclipse/emf/cdo/server/internal/admin/CDOAdminServerRepository.java
+++ b/plugins/org.eclipse.emf.cdo.server.admin/src/org/eclipse/emf/cdo/server/internal/admin/CDOAdminServerRepository.java
@@ -21,6 +21,7 @@ import org.eclipse.emf.cdo.server.IRepositorySynchronizer;
import org.eclipse.emf.cdo.server.ISynchronizableRepository;
import org.eclipse.emf.cdo.spi.common.protocol.CDODataOutputImpl;
+import org.eclipse.net4j.util.AdapterUtil;
import org.eclipse.net4j.util.event.IEvent;
import org.eclipse.net4j.util.event.IListener;
import org.eclipse.net4j.util.event.Notifier;
@@ -29,7 +30,6 @@ import org.eclipse.net4j.util.om.monitor.NotifyingMonitor;
import org.eclipse.net4j.util.om.monitor.OMMonitorProgress;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Platform;
import java.io.IOException;
import java.util.Set;
@@ -193,9 +193,10 @@ public class CDOAdminServerRepository extends Notifier implements CDOAdminReposi
return delegate.getTimeStamp();
}
- public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter)
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public Object getAdapter(Class adapter)
{
- return Platform.getAdapterManager().getAdapter(this, adapter);
+ return AdapterUtil.adapt(this, adapter);
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java
index 3c22add177..018308cbca 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Repository.java
@@ -97,6 +97,7 @@ import org.eclipse.emf.internal.cdo.object.CDOFactoryImpl;
import org.eclipse.emf.internal.cdo.util.CompletePackageClosure;
import org.eclipse.emf.internal.cdo.util.IPackageClosure;
+import org.eclipse.net4j.util.AdapterUtil;
import org.eclipse.net4j.util.ReflectUtil.ExcludeFromDump;
import org.eclipse.net4j.util.StringUtil;
import org.eclipse.net4j.util.WrappedException;
@@ -122,7 +123,6 @@ import org.eclipse.emf.spi.cdo.CDOSessionProtocol.LockObjectsResult;
import org.eclipse.emf.spi.cdo.CDOSessionProtocol.UnlockObjectsResult;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Platform;
import java.io.IOException;
import java.io.OutputStream;
@@ -480,9 +480,9 @@ public class Repository extends Container<Object> implements InternalRepository
return accessor.loadCommitData(timeStamp);
}
- public List<RevisionInfo> loadRevisions(List<RevisionInfo> infos, CDOBranchPoint branchPoint,
- int referenceChunk, int prefetchDepth)
- {
+ public List<RevisionInfo> loadRevisions(List<RevisionInfo> infos, CDOBranchPoint branchPoint, int referenceChunk,
+ int prefetchDepth)
+ {
for (RevisionInfo info : infos)
{
CDOID id = info.getID();
@@ -580,7 +580,7 @@ public class Repository extends Container<Object> implements InternalRepository
}
return null;
- }
+ }
private InternalCDORevision loadRevisionTarget(CDOID id, CDOBranchPoint branchPoint, int referenceChunk,
IStoreAccessor accessor)
@@ -1200,8 +1200,8 @@ public class Repository extends Container<Object> implements InternalRepository
{
throw new IllegalArgumentException(
MessageFormat
- .format(
- "timeStamp ({0}) < repository creation time ({1})", CDOCommonUtil.formatTimeStamp(timeStamp), CDOCommonUtil.formatTimeStamp(creationTimeStamp))); //$NON-NLS-1$
+ .format(
+ "timeStamp ({0}) < repository creation time ({1})", CDOCommonUtil.formatTimeStamp(timeStamp), CDOCommonUtil.formatTimeStamp(creationTimeStamp))); //$NON-NLS-1$
}
long currentTimeStamp = getTimeStamp();
@@ -1209,8 +1209,8 @@ public class Repository extends Container<Object> implements InternalRepository
{
throw new IllegalArgumentException(
MessageFormat
- .format(
- "timeStamp ({0}) > current time ({1})", CDOCommonUtil.formatTimeStamp(timeStamp), CDOCommonUtil.formatTimeStamp(currentTimeStamp))); //$NON-NLS-1$
+ .format(
+ "timeStamp ({0}) > current time ({1})", CDOCommonUtil.formatTimeStamp(timeStamp), CDOCommonUtil.formatTimeStamp(currentTimeStamp))); //$NON-NLS-1$
}
}
@@ -1425,7 +1425,7 @@ public class Repository extends Container<Object> implements InternalRepository
public Set<CDOID> getMergeData(CDORevisionAvailabilityInfo targetInfo, CDORevisionAvailabilityInfo sourceInfo,
CDORevisionAvailabilityInfo targetBaseInfo, CDORevisionAvailabilityInfo sourceBaseInfo, OMMonitor monitor)
- {
+ {
CDOBranchPoint target = targetInfo.getBranchPoint();
CDOBranchPoint source = sourceInfo.getBranchPoint();
@@ -1483,7 +1483,7 @@ public class Repository extends Container<Object> implements InternalRepository
{
monitor.done();
}
- }
+ }
private void loadMergeData(Set<CDOID> ids, CDORevisionAvailabilityInfo info, OMMonitor monitor)
{
@@ -1589,7 +1589,7 @@ public class Repository extends Container<Object> implements InternalRepository
public static List<Object> revisionKeysToObjects(List<CDORevisionKey> revisionKeys, CDOBranch viewedBranch,
boolean isSupportingBranches)
- {
+ {
List<Object> lockables = new ArrayList<Object>();
for (CDORevisionKey revKey : revisionKeys)
{
@@ -1605,7 +1605,7 @@ public class Repository extends Container<Object> implements InternalRepository
}
return lockables;
- }
+ }
public LockObjectsResult lock(InternalView view, LockType lockType, List<CDORevisionKey> revKeys, boolean recursive,
long timeout)
@@ -1760,9 +1760,10 @@ public class Repository extends Container<Object> implements InternalRepository
return new UnlockObjectsResult(cdoLockStates, timestamp);
}
- public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter)
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public Object getAdapter(Class adapter)
{
- return Platform.getAdapterManager().getAdapter(this, adapter);
+ return AdapterUtil.adapt(this, adapter);
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java
index b016379a07..3bfe273720 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java
@@ -46,6 +46,7 @@ import org.eclipse.emf.cdo.spi.server.InternalSessionManager;
import org.eclipse.emf.cdo.spi.server.InternalTransaction;
import org.eclipse.emf.cdo.spi.server.InternalView;
+import org.eclipse.net4j.util.AdapterUtil;
import org.eclipse.net4j.util.ReflectUtil.ExcludeFromDump;
import org.eclipse.net4j.util.collection.IndexedList;
import org.eclipse.net4j.util.container.Container;
@@ -59,8 +60,6 @@ import org.eclipse.net4j.util.om.log.OMLogger;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.core.runtime.Platform;
-
import java.text.MessageFormat;
import java.util.List;
import java.util.Map;
@@ -527,9 +526,10 @@ public class Session extends Container<IView> implements InternalSession
}
}
- public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter)
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public Object getAdapter(Class adapter)
{
- return Platform.getAdapterManager().getAdapter(this, adapter);
+ return AdapterUtil.adapt(this, adapter);
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/View.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/View.java
index 0299532a16..d1417a7f1d 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/View.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/View.java
@@ -23,12 +23,11 @@ import org.eclipse.emf.cdo.spi.server.InternalRepository;
import org.eclipse.emf.cdo.spi.server.InternalSession;
import org.eclipse.emf.cdo.spi.server.InternalView;
+import org.eclipse.net4j.util.AdapterUtil;
import org.eclipse.net4j.util.ObjectUtil;
import org.eclipse.net4j.util.lifecycle.Lifecycle;
import org.eclipse.net4j.util.options.IOptionsContainer;
-import org.eclipse.core.runtime.Platform;
-
import java.text.MessageFormat;
import java.util.HashSet;
import java.util.Iterator;
@@ -222,9 +221,10 @@ public class View extends Lifecycle implements InternalView, CDOCommonView.Optio
changeSubscriptionIDs.clear();
}
- public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter)
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public Object getAdapter(Class adapter)
{
- return Platform.getAdapterManager().getAdapter(this, adapter);
+ return AdapterUtil.adapt(this, adapter);
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOPushTransaction.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOPushTransaction.java
index d7ae42e67e..e05d7b349c 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOPushTransaction.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/cdo/transaction/CDOPushTransaction.java
@@ -37,6 +37,7 @@ import org.eclipse.emf.cdo.view.CDOViewSet;
import org.eclipse.emf.internal.cdo.bundle.OM;
+import org.eclipse.net4j.util.AdapterUtil;
import org.eclipse.net4j.util.collection.CloseableIterator;
import org.eclipse.net4j.util.concurrent.IRWLockManager.LockType;
import org.eclipse.net4j.util.event.IListener;
@@ -50,7 +51,6 @@ import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.URIHandler;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Platform;
import java.io.File;
import java.io.FileInputStream;
@@ -942,9 +942,10 @@ public class CDOPushTransaction extends Notifier implements CDOTransaction
/**
* @since 4.2
*/
- public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter)
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public Object getAdapter(Class adapter)
{
- return Platform.getAdapterManager().getAdapter(this, adapter);
+ return AdapterUtil.adapt(this, adapter);
}
public static File createTempFile(CDOTransaction transaction) throws IOException
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java
index ca660a2fe1..2ada799dbc 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java
@@ -93,6 +93,7 @@ import org.eclipse.emf.internal.cdo.object.CDOFactoryImpl;
import org.eclipse.emf.internal.cdo.session.remote.CDORemoteSessionManagerImpl;
import org.eclipse.emf.internal.cdo.util.DefaultLocksChangedEvent;
+import org.eclipse.net4j.util.AdapterUtil;
import org.eclipse.net4j.util.ReflectUtil.ExcludeFromDump;
import org.eclipse.net4j.util.WrappedException;
import org.eclipse.net4j.util.concurrent.IRWLockManager;
@@ -129,8 +130,6 @@ import org.eclipse.emf.spi.cdo.InternalCDOSessionInvalidationEvent;
import org.eclipse.emf.spi.cdo.InternalCDOTransaction;
import org.eclipse.emf.spi.cdo.InternalCDOView;
-import org.eclipse.core.runtime.Platform;
-
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
@@ -1069,9 +1068,10 @@ public abstract class CDOSessionImpl extends CDOTransactionContainerImpl impleme
return invalidator;
}
- public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter)
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public Object getAdapter(Class adapter)
{
- return Platform.getAdapterManager().getAdapter(this, adapter);
+ return AdapterUtil.adapt(this, adapter);
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/SessionProperties.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/SessionProperties.java
index 322e5c99f3..f5f51bfb0b 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/SessionProperties.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/SessionProperties.java
@@ -19,6 +19,7 @@ import org.eclipse.emf.cdo.session.CDOSession;
import org.eclipse.emf.internal.cdo.messages.Messages;
+import org.eclipse.net4j.util.AdapterUtil;
import org.eclipse.net4j.util.StringUtil;
import org.eclipse.net4j.util.properties.DefaultPropertyTester;
import org.eclipse.net4j.util.properties.IProperties;
@@ -26,7 +27,6 @@ import org.eclipse.net4j.util.properties.Properties;
import org.eclipse.net4j.util.properties.Property;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Platform;
import java.util.Set;
@@ -264,9 +264,10 @@ public class SessionProperties extends Properties<CDOSession> implements CDOComm
});
}
- public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter)
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public Object getAdapter(Class adapter)
{
- return Platform.getAdapterManager().getAdapter(this, adapter);
+ return AdapterUtil.adapt(this, adapter);
}
public long getTimeStamp()
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/AbstractCDOView.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/AbstractCDOView.java
index d873e8406f..84aa40039d 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/AbstractCDOView.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/view/AbstractCDOView.java
@@ -72,6 +72,7 @@ import org.eclipse.emf.internal.cdo.object.CDOLegacyAdapter;
import org.eclipse.emf.internal.cdo.query.CDOQueryImpl;
import org.eclipse.emf.internal.cdo.transaction.CDOTransactionImpl;
+import org.eclipse.net4j.util.AdapterUtil;
import org.eclipse.net4j.util.CheckUtil;
import org.eclipse.net4j.util.ImplementationError;
import org.eclipse.net4j.util.ReflectUtil.ExcludeFromDump;
@@ -112,7 +113,6 @@ import org.eclipse.emf.spi.cdo.InternalCDOView;
import org.eclipse.emf.spi.cdo.InternalCDOViewSet;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Platform;
import java.io.IOException;
import java.text.MessageFormat;
@@ -1656,7 +1656,7 @@ public abstract class AbstractCDOView extends CDOCommitHistoryProviderImpl<CDOOb
}
}
}
-
+
return conflicts;
}
@@ -1735,9 +1735,10 @@ public abstract class AbstractCDOView extends CDOCommitHistoryProviderImpl<CDOOb
return !isActive();
}
- public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter)
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ public Object getAdapter(Class adapter)
{
- return Platform.getAdapterManager().getAdapter(this, adapter);
+ return AdapterUtil.adapt(this, adapter);
}
@Override
diff --git a/plugins/org.eclipse.net4j.buddies.common/META-INF/MANIFEST.MF b/plugins/org.eclipse.net4j.buddies.common/META-INF/MANIFEST.MF
index 6b5d371d5e..fa0796a354 100644
--- a/plugins/org.eclipse.net4j.buddies.common/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.net4j.buddies.common/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.net4j.buddies.common
-Bundle-Version: 4.0.300.qualifier
+Bundle-Version: 4.0.400.qualifier
Bundle-Vendor: %providerName
Bundle-Activator: org.eclipse.net4j.buddies.internal.common.bundle.OM$Activator
Bundle-ClassPath: .
@@ -11,9 +11,9 @@ Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)",
org.eclipse.net4j;bundle-version="[4.0.0,5.0.0)";visibility:=reexport
Import-Package: org.osgi.framework;version="[1.3.0,2.0.0)";resolution:=optional
-Export-Package: org.eclipse.net4j.buddies.common;version="4.0.300",
- org.eclipse.net4j.buddies.internal.common;version="4.0.300";x-friends:="org.eclipse.net4j.buddies,org.eclipse.net4j.buddies.server,org.eclipse.net4j.buddies.ui",
- org.eclipse.net4j.buddies.internal.common.bundle;version="4.0.300";x-internal:=true,
- org.eclipse.net4j.buddies.internal.common.protocol;version="4.0.300";x-friends:="org.eclipse.net4j.buddies,org.eclipse.net4j.buddies.server",
- org.eclipse.net4j.buddies.spi.common;version="4.0.300"
+Export-Package: org.eclipse.net4j.buddies.common;version="4.0.400",
+ org.eclipse.net4j.buddies.internal.common;version="4.0.400";x-friends:="org.eclipse.net4j.buddies,org.eclipse.net4j.buddies.server,org.eclipse.net4j.buddies.ui",
+ org.eclipse.net4j.buddies.internal.common.bundle;version="4.0.400";x-internal:=true,
+ org.eclipse.net4j.buddies.internal.common.protocol;version="4.0.400";x-friends:="org.eclipse.net4j.buddies,org.eclipse.net4j.buddies.server",
+ org.eclipse.net4j.buddies.spi.common;version="4.0.400"
Bundle-ActivationPolicy: lazy
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Buddy.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Buddy.java
index 721a6ea682..57d8f94607 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Buddy.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Buddy.java
@@ -15,14 +15,12 @@ import org.eclipse.net4j.buddies.common.IBuddyStateEvent;
import org.eclipse.net4j.buddies.common.ICollaboration;
import org.eclipse.net4j.buddies.common.IMembership;
import org.eclipse.net4j.buddies.common.ISession;
+import org.eclipse.net4j.util.AdapterUtil;
import org.eclipse.net4j.util.ObjectUtil;
import org.eclipse.net4j.util.event.Event;
import org.eclipse.net4j.util.event.IEvent;
import org.eclipse.net4j.util.event.IListener;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.PlatformObject;
-
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collections;
@@ -139,13 +137,10 @@ public abstract class Buddy extends MembershipContainer implements IBuddy
return memberships.length == 0 ? null : memberships[0];
}
- /**
- * @see PlatformObject#getAdapter(Class)
- */
- @SuppressWarnings("rawtypes")
+ @SuppressWarnings({ "unchecked", "rawtypes" })
public Object getAdapter(Class adapter)
{
- return Platform.getAdapterManager().getAdapter(this, adapter);
+ return AdapterUtil.adapt(this, adapter);
}
@Override
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Collaboration.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Collaboration.java
index 8f0bc37634..72bdb8541d 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Collaboration.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Collaboration.java
@@ -19,15 +19,13 @@ import org.eclipse.net4j.buddies.common.IMessage;
import org.eclipse.net4j.buddies.internal.common.bundle.OM;
import org.eclipse.net4j.buddies.internal.common.protocol.MessageNotification;
import org.eclipse.net4j.signal.SignalProtocol;
+import org.eclipse.net4j.util.AdapterUtil;
import org.eclipse.net4j.util.ObjectUtil;
import org.eclipse.net4j.util.event.Event;
import org.eclipse.net4j.util.event.IEvent;
import org.eclipse.net4j.util.event.IListener;
import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.PlatformObject;
-
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
@@ -184,13 +182,10 @@ public class Collaboration extends MembershipContainer implements ICollaboration
}
}
- /**
- * @see PlatformObject#getAdapter(Class)
- */
- @SuppressWarnings("rawtypes")
+ @SuppressWarnings({ "unchecked", "rawtypes" })
public Object getAdapter(Class adapter)
{
- return Platform.getAdapterManager().getAdapter(this, adapter);
+ return AdapterUtil.adapt(this, adapter);
}
@Override
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Membership.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Membership.java
index e7ede0d4dc..a11f526176 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Membership.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Membership.java
@@ -14,12 +14,10 @@ import org.eclipse.net4j.buddies.common.IBuddy;
import org.eclipse.net4j.buddies.common.ICollaboration;
import org.eclipse.net4j.buddies.common.IMembership;
import org.eclipse.net4j.buddies.common.IMembershipKey;
+import org.eclipse.net4j.util.AdapterUtil;
import org.eclipse.net4j.util.ObjectUtil;
import org.eclipse.net4j.util.lifecycle.Lifecycle;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.PlatformObject;
-
/**
* @author Eike Stepper
*/
@@ -69,13 +67,10 @@ public class Membership extends Lifecycle implements IMembership
return key;
}
- /**
- * @see PlatformObject#getAdapter(Class)
- */
- @SuppressWarnings("rawtypes")
+ @SuppressWarnings({ "unchecked", "rawtypes" })
public Object getAdapter(Class adapter)
{
- return Platform.getAdapterManager().getAdapter(this, adapter);
+ return AdapterUtil.adapt(this, adapter);
}
@Override
diff --git a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/spi/common/Facility.java b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/spi/common/Facility.java
index 0da68eb6e2..a34e687596 100644
--- a/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/spi/common/Facility.java
+++ b/plugins/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/spi/common/Facility.java
@@ -14,11 +14,9 @@ import org.eclipse.net4j.buddies.common.ICollaboration;
import org.eclipse.net4j.buddies.common.IFacility;
import org.eclipse.net4j.buddies.common.IMessage;
import org.eclipse.net4j.buddies.internal.common.Collaboration;
+import org.eclipse.net4j.util.AdapterUtil;
import org.eclipse.net4j.util.lifecycle.Lifecycle;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.PlatformObject;
-
/**
* @author Eike Stepper
*/
@@ -48,13 +46,10 @@ public abstract class Facility extends Lifecycle implements IFacility
this.collaboration = (Collaboration)collaboration;
}
- /**
- * @see PlatformObject#getAdapter(Class)
- */
- @SuppressWarnings("rawtypes")
+ @SuppressWarnings({ "unchecked", "rawtypes" })
public Object getAdapter(Class adapter)
{
- return Platform.getAdapterManager().getAdapter(this, adapter);
+ return AdapterUtil.adapt(this, adapter);
}
public void sendMessage(IMessage message)
diff --git a/plugins/org.eclipse.net4j.buddies.server/META-INF/MANIFEST.MF b/plugins/org.eclipse.net4j.buddies.server/META-INF/MANIFEST.MF
index 88a95807ae..bf141012fa 100644
--- a/plugins/org.eclipse.net4j.buddies.server/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.net4j.buddies.server/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.net4j.buddies.server;singleton:=true
-Bundle-Version: 4.0.300.qualifier
+Bundle-Version: 4.0.400.qualifier
Bundle-Vendor: %providerName
Bundle-Activator: org.eclipse.net4j.buddies.internal.server.bundle.OM$Activator
Bundle-ClassPath: .
@@ -10,9 +10,9 @@ Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)";resolution:=optional,
org.eclipse.net4j.buddies.common;bundle-version="[4.0.0,5.0.0)";visibility:=reexport
-Export-Package: org.eclipse.net4j.buddies.internal.server;version="4.0.300";x-internal:=true,
- org.eclipse.net4j.buddies.internal.server.bundle;version="4.0.300";x-internal:=true,
- org.eclipse.net4j.buddies.internal.server.messages;version="4.0.300";x-internal:=true,
- org.eclipse.net4j.buddies.internal.server.protocol;version="4.0.300";x-internal:=true,
- org.eclipse.net4j.buddies.server;version="4.0.300"
+Export-Package: org.eclipse.net4j.buddies.internal.server;version="4.0.400";x-internal:=true,
+ org.eclipse.net4j.buddies.internal.server.bundle;version="4.0.400";x-internal:=true,
+ org.eclipse.net4j.buddies.internal.server.messages;version="4.0.400";x-internal:=true,
+ org.eclipse.net4j.buddies.internal.server.protocol;version="4.0.400";x-internal:=true,
+ org.eclipse.net4j.buddies.server;version="4.0.400"
Bundle-ActivationPolicy: lazy
diff --git a/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/ServerSession.java b/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/ServerSession.java
index b85bc24bfa..39c1e60fa4 100644
--- a/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/ServerSession.java
+++ b/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/ServerSession.java
@@ -13,6 +13,7 @@ package org.eclipse.net4j.buddies.internal.server;
import org.eclipse.net4j.buddies.common.IBuddy;
import org.eclipse.net4j.buddies.common.ISession;
import org.eclipse.net4j.buddies.internal.server.protocol.BuddiesServerProtocol;
+import org.eclipse.net4j.util.AdapterUtil;
import org.eclipse.net4j.util.event.IEvent;
import org.eclipse.net4j.util.event.IListener;
import org.eclipse.net4j.util.lifecycle.ILifecycleEvent;
@@ -20,9 +21,6 @@ import org.eclipse.net4j.util.lifecycle.Lifecycle;
import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
import org.eclipse.net4j.util.om.log.OMLogger;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.PlatformObject;
-
/**
* @author Eike Stepper
*/
@@ -61,13 +59,10 @@ public class ServerSession extends Lifecycle implements ISession, IListener
LifecycleUtil.deactivate(this, OMLogger.Level.DEBUG);
}
- /**
- * @see PlatformObject#getAdapter(Class)
- */
- @SuppressWarnings("rawtypes")
+ @SuppressWarnings({ "unchecked", "rawtypes" })
public Object getAdapter(Class adapter)
{
- return Platform.getAdapterManager().getAdapter(this, adapter);
+ return AdapterUtil.adapt(this, adapter);
}
public void notifyEvent(IEvent event)
diff --git a/plugins/org.eclipse.net4j.buddies/META-INF/MANIFEST.MF b/plugins/org.eclipse.net4j.buddies/META-INF/MANIFEST.MF
index dfd9390301..ea85dffc6e 100644
--- a/plugins/org.eclipse.net4j.buddies/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.net4j.buddies/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.net4j.buddies; singleton:=true
-Bundle-Version: 4.0.300.qualifier
+Bundle-Version: 4.0.400.qualifier
Bundle-ClassPath: .
Bundle-Vendor: %providerName
Bundle-Localization: plugin
@@ -10,8 +10,8 @@ Bundle-Activator: org.eclipse.net4j.internal.buddies.bundle.OM$Activator
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)",
org.eclipse.net4j.buddies.common;bundle-version="[4.0.0,5.0.0)";visibility:=reexport
-Export-Package: org.eclipse.net4j.buddies;version="4.0.300",
- org.eclipse.net4j.internal.buddies;version="4.0.300";x-friends:="org.eclipse.net4j.buddies.ui",
- org.eclipse.net4j.internal.buddies.bundle;version="4.0.300";x-friends:="org.eclipse.net4j.buddies.ui",
- org.eclipse.net4j.internal.buddies.protocol;version="4.0.300";x-friends:="org.eclipse.net4j.buddies.ui"
+Export-Package: org.eclipse.net4j.buddies;version="4.0.400",
+ org.eclipse.net4j.internal.buddies;version="4.0.400";x-friends:="org.eclipse.net4j.buddies.ui",
+ org.eclipse.net4j.internal.buddies.bundle;version="4.0.400";x-friends:="org.eclipse.net4j.buddies.ui",
+ org.eclipse.net4j.internal.buddies.protocol;version="4.0.400";x-friends:="org.eclipse.net4j.buddies.ui"
Bundle-ActivationPolicy: lazy
diff --git a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/ClientSession.java b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/ClientSession.java
index d5f2a17402..0be67ac019 100644
--- a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/ClientSession.java
+++ b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/ClientSession.java
@@ -20,14 +20,12 @@ import org.eclipse.net4j.buddies.internal.common.Collaboration;
import org.eclipse.net4j.buddies.internal.common.protocol.BuddyStateNotification;
import org.eclipse.net4j.internal.buddies.bundle.OM;
import org.eclipse.net4j.internal.buddies.protocol.BuddiesClientProtocol;
+import org.eclipse.net4j.util.AdapterUtil;
import org.eclipse.net4j.util.event.IEvent;
import org.eclipse.net4j.util.lifecycle.ILifecycleEvent;
import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
import org.eclipse.net4j.util.om.log.OMLogger;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.PlatformObject;
-
import java.util.Set;
/**
@@ -68,13 +66,10 @@ public class ClientSession extends BuddyContainer implements IBuddySession
LifecycleUtil.deactivate(this, OMLogger.Level.DEBUG);
}
- /**
- * @see PlatformObject#getAdapter(Class)
- */
- @SuppressWarnings("rawtypes")
+ @SuppressWarnings({ "unchecked", "rawtypes" })
public Object getAdapter(Class adapter)
{
- return Platform.getAdapterManager().getAdapter(this, adapter);
+ return AdapterUtil.adapt(this, adapter);
}
@Override
diff --git a/plugins/org.eclipse.net4j.examples.installer/examples/org.eclipse.net4j.buddies.common/META-INF/MANIFEST.MF b/plugins/org.eclipse.net4j.examples.installer/examples/org.eclipse.net4j.buddies.common/META-INF/MANIFEST.MF
index 6b5d371d5e..fa0796a354 100644
--- a/plugins/org.eclipse.net4j.examples.installer/examples/org.eclipse.net4j.buddies.common/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.net4j.examples.installer/examples/org.eclipse.net4j.buddies.common/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.net4j.buddies.common
-Bundle-Version: 4.0.300.qualifier
+Bundle-Version: 4.0.400.qualifier
Bundle-Vendor: %providerName
Bundle-Activator: org.eclipse.net4j.buddies.internal.common.bundle.OM$Activator
Bundle-ClassPath: .
@@ -11,9 +11,9 @@ Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)",
org.eclipse.net4j;bundle-version="[4.0.0,5.0.0)";visibility:=reexport
Import-Package: org.osgi.framework;version="[1.3.0,2.0.0)";resolution:=optional
-Export-Package: org.eclipse.net4j.buddies.common;version="4.0.300",
- org.eclipse.net4j.buddies.internal.common;version="4.0.300";x-friends:="org.eclipse.net4j.buddies,org.eclipse.net4j.buddies.server,org.eclipse.net4j.buddies.ui",
- org.eclipse.net4j.buddies.internal.common.bundle;version="4.0.300";x-internal:=true,
- org.eclipse.net4j.buddies.internal.common.protocol;version="4.0.300";x-friends:="org.eclipse.net4j.buddies,org.eclipse.net4j.buddies.server",
- org.eclipse.net4j.buddies.spi.common;version="4.0.300"
+Export-Package: org.eclipse.net4j.buddies.common;version="4.0.400",
+ org.eclipse.net4j.buddies.internal.common;version="4.0.400";x-friends:="org.eclipse.net4j.buddies,org.eclipse.net4j.buddies.server,org.eclipse.net4j.buddies.ui",
+ org.eclipse.net4j.buddies.internal.common.bundle;version="4.0.400";x-internal:=true,
+ org.eclipse.net4j.buddies.internal.common.protocol;version="4.0.400";x-friends:="org.eclipse.net4j.buddies,org.eclipse.net4j.buddies.server",
+ org.eclipse.net4j.buddies.spi.common;version="4.0.400"
Bundle-ActivationPolicy: lazy
diff --git a/plugins/org.eclipse.net4j.examples.installer/examples/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Buddy.java b/plugins/org.eclipse.net4j.examples.installer/examples/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Buddy.java
index 721a6ea682..57d8f94607 100644
--- a/plugins/org.eclipse.net4j.examples.installer/examples/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Buddy.java
+++ b/plugins/org.eclipse.net4j.examples.installer/examples/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Buddy.java
@@ -15,14 +15,12 @@ import org.eclipse.net4j.buddies.common.IBuddyStateEvent;
import org.eclipse.net4j.buddies.common.ICollaboration;
import org.eclipse.net4j.buddies.common.IMembership;
import org.eclipse.net4j.buddies.common.ISession;
+import org.eclipse.net4j.util.AdapterUtil;
import org.eclipse.net4j.util.ObjectUtil;
import org.eclipse.net4j.util.event.Event;
import org.eclipse.net4j.util.event.IEvent;
import org.eclipse.net4j.util.event.IListener;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.PlatformObject;
-
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collections;
@@ -139,13 +137,10 @@ public abstract class Buddy extends MembershipContainer implements IBuddy
return memberships.length == 0 ? null : memberships[0];
}
- /**
- * @see PlatformObject#getAdapter(Class)
- */
- @SuppressWarnings("rawtypes")
+ @SuppressWarnings({ "unchecked", "rawtypes" })
public Object getAdapter(Class adapter)
{
- return Platform.getAdapterManager().getAdapter(this, adapter);
+ return AdapterUtil.adapt(this, adapter);
}
@Override
diff --git a/plugins/org.eclipse.net4j.examples.installer/examples/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Collaboration.java b/plugins/org.eclipse.net4j.examples.installer/examples/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Collaboration.java
index 8f0bc37634..72bdb8541d 100644
--- a/plugins/org.eclipse.net4j.examples.installer/examples/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Collaboration.java
+++ b/plugins/org.eclipse.net4j.examples.installer/examples/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Collaboration.java
@@ -19,15 +19,13 @@ import org.eclipse.net4j.buddies.common.IMessage;
import org.eclipse.net4j.buddies.internal.common.bundle.OM;
import org.eclipse.net4j.buddies.internal.common.protocol.MessageNotification;
import org.eclipse.net4j.signal.SignalProtocol;
+import org.eclipse.net4j.util.AdapterUtil;
import org.eclipse.net4j.util.ObjectUtil;
import org.eclipse.net4j.util.event.Event;
import org.eclipse.net4j.util.event.IEvent;
import org.eclipse.net4j.util.event.IListener;
import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.PlatformObject;
-
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
@@ -184,13 +182,10 @@ public class Collaboration extends MembershipContainer implements ICollaboration
}
}
- /**
- * @see PlatformObject#getAdapter(Class)
- */
- @SuppressWarnings("rawtypes")
+ @SuppressWarnings({ "unchecked", "rawtypes" })
public Object getAdapter(Class adapter)
{
- return Platform.getAdapterManager().getAdapter(this, adapter);
+ return AdapterUtil.adapt(this, adapter);
}
@Override
diff --git a/plugins/org.eclipse.net4j.examples.installer/examples/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Membership.java b/plugins/org.eclipse.net4j.examples.installer/examples/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Membership.java
index e7ede0d4dc..a11f526176 100644
--- a/plugins/org.eclipse.net4j.examples.installer/examples/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Membership.java
+++ b/plugins/org.eclipse.net4j.examples.installer/examples/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/internal/common/Membership.java
@@ -14,12 +14,10 @@ import org.eclipse.net4j.buddies.common.IBuddy;
import org.eclipse.net4j.buddies.common.ICollaboration;
import org.eclipse.net4j.buddies.common.IMembership;
import org.eclipse.net4j.buddies.common.IMembershipKey;
+import org.eclipse.net4j.util.AdapterUtil;
import org.eclipse.net4j.util.ObjectUtil;
import org.eclipse.net4j.util.lifecycle.Lifecycle;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.PlatformObject;
-
/**
* @author Eike Stepper
*/
@@ -69,13 +67,10 @@ public class Membership extends Lifecycle implements IMembership
return key;
}
- /**
- * @see PlatformObject#getAdapter(Class)
- */
- @SuppressWarnings("rawtypes")
+ @SuppressWarnings({ "unchecked", "rawtypes" })
public Object getAdapter(Class adapter)
{
- return Platform.getAdapterManager().getAdapter(this, adapter);
+ return AdapterUtil.adapt(this, adapter);
}
@Override
diff --git a/plugins/org.eclipse.net4j.examples.installer/examples/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/spi/common/Facility.java b/plugins/org.eclipse.net4j.examples.installer/examples/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/spi/common/Facility.java
index 0da68eb6e2..a34e687596 100644
--- a/plugins/org.eclipse.net4j.examples.installer/examples/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/spi/common/Facility.java
+++ b/plugins/org.eclipse.net4j.examples.installer/examples/org.eclipse.net4j.buddies.common/src/org/eclipse/net4j/buddies/spi/common/Facility.java
@@ -14,11 +14,9 @@ import org.eclipse.net4j.buddies.common.ICollaboration;
import org.eclipse.net4j.buddies.common.IFacility;
import org.eclipse.net4j.buddies.common.IMessage;
import org.eclipse.net4j.buddies.internal.common.Collaboration;
+import org.eclipse.net4j.util.AdapterUtil;
import org.eclipse.net4j.util.lifecycle.Lifecycle;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.PlatformObject;
-
/**
* @author Eike Stepper
*/
@@ -48,13 +46,10 @@ public abstract class Facility extends Lifecycle implements IFacility
this.collaboration = (Collaboration)collaboration;
}
- /**
- * @see PlatformObject#getAdapter(Class)
- */
- @SuppressWarnings("rawtypes")
+ @SuppressWarnings({ "unchecked", "rawtypes" })
public Object getAdapter(Class adapter)
{
- return Platform.getAdapterManager().getAdapter(this, adapter);
+ return AdapterUtil.adapt(this, adapter);
}
public void sendMessage(IMessage message)
diff --git a/plugins/org.eclipse.net4j.examples.installer/examples/org.eclipse.net4j.buddies.server/META-INF/MANIFEST.MF b/plugins/org.eclipse.net4j.examples.installer/examples/org.eclipse.net4j.buddies.server/META-INF/MANIFEST.MF
index 88a95807ae..bf141012fa 100644
--- a/plugins/org.eclipse.net4j.examples.installer/examples/org.eclipse.net4j.buddies.server/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.net4j.examples.installer/examples/org.eclipse.net4j.buddies.server/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.net4j.buddies.server;singleton:=true
-Bundle-Version: 4.0.300.qualifier
+Bundle-Version: 4.0.400.qualifier
Bundle-Vendor: %providerName
Bundle-Activator: org.eclipse.net4j.buddies.internal.server.bundle.OM$Activator
Bundle-ClassPath: .
@@ -10,9 +10,9 @@ Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)";resolution:=optional,
org.eclipse.net4j.buddies.common;bundle-version="[4.0.0,5.0.0)";visibility:=reexport
-Export-Package: org.eclipse.net4j.buddies.internal.server;version="4.0.300";x-internal:=true,
- org.eclipse.net4j.buddies.internal.server.bundle;version="4.0.300";x-internal:=true,
- org.eclipse.net4j.buddies.internal.server.messages;version="4.0.300";x-internal:=true,
- org.eclipse.net4j.buddies.internal.server.protocol;version="4.0.300";x-internal:=true,
- org.eclipse.net4j.buddies.server;version="4.0.300"
+Export-Package: org.eclipse.net4j.buddies.internal.server;version="4.0.400";x-internal:=true,
+ org.eclipse.net4j.buddies.internal.server.bundle;version="4.0.400";x-internal:=true,
+ org.eclipse.net4j.buddies.internal.server.messages;version="4.0.400";x-internal:=true,
+ org.eclipse.net4j.buddies.internal.server.protocol;version="4.0.400";x-internal:=true,
+ org.eclipse.net4j.buddies.server;version="4.0.400"
Bundle-ActivationPolicy: lazy
diff --git a/plugins/org.eclipse.net4j.examples.installer/examples/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/ServerSession.java b/plugins/org.eclipse.net4j.examples.installer/examples/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/ServerSession.java
index b85bc24bfa..39c1e60fa4 100644
--- a/plugins/org.eclipse.net4j.examples.installer/examples/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/ServerSession.java
+++ b/plugins/org.eclipse.net4j.examples.installer/examples/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/ServerSession.java
@@ -13,6 +13,7 @@ package org.eclipse.net4j.buddies.internal.server;
import org.eclipse.net4j.buddies.common.IBuddy;
import org.eclipse.net4j.buddies.common.ISession;
import org.eclipse.net4j.buddies.internal.server.protocol.BuddiesServerProtocol;
+import org.eclipse.net4j.util.AdapterUtil;
import org.eclipse.net4j.util.event.IEvent;
import org.eclipse.net4j.util.event.IListener;
import org.eclipse.net4j.util.lifecycle.ILifecycleEvent;
@@ -20,9 +21,6 @@ import org.eclipse.net4j.util.lifecycle.Lifecycle;
import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
import org.eclipse.net4j.util.om.log.OMLogger;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.PlatformObject;
-
/**
* @author Eike Stepper
*/
@@ -61,13 +59,10 @@ public class ServerSession extends Lifecycle implements ISession, IListener
LifecycleUtil.deactivate(this, OMLogger.Level.DEBUG);
}
- /**
- * @see PlatformObject#getAdapter(Class)
- */
- @SuppressWarnings("rawtypes")
+ @SuppressWarnings({ "unchecked", "rawtypes" })
public Object getAdapter(Class adapter)
{
- return Platform.getAdapterManager().getAdapter(this, adapter);
+ return AdapterUtil.adapt(this, adapter);
}
public void notifyEvent(IEvent event)
diff --git a/plugins/org.eclipse.net4j.examples.installer/examples/org.eclipse.net4j.buddies/META-INF/MANIFEST.MF b/plugins/org.eclipse.net4j.examples.installer/examples/org.eclipse.net4j.buddies/META-INF/MANIFEST.MF
index dfd9390301..ea85dffc6e 100644
--- a/plugins/org.eclipse.net4j.examples.installer/examples/org.eclipse.net4j.buddies/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.net4j.examples.installer/examples/org.eclipse.net4j.buddies/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.net4j.buddies; singleton:=true
-Bundle-Version: 4.0.300.qualifier
+Bundle-Version: 4.0.400.qualifier
Bundle-ClassPath: .
Bundle-Vendor: %providerName
Bundle-Localization: plugin
@@ -10,8 +10,8 @@ Bundle-Activator: org.eclipse.net4j.internal.buddies.bundle.OM$Activator
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)",
org.eclipse.net4j.buddies.common;bundle-version="[4.0.0,5.0.0)";visibility:=reexport
-Export-Package: org.eclipse.net4j.buddies;version="4.0.300",
- org.eclipse.net4j.internal.buddies;version="4.0.300";x-friends:="org.eclipse.net4j.buddies.ui",
- org.eclipse.net4j.internal.buddies.bundle;version="4.0.300";x-friends:="org.eclipse.net4j.buddies.ui",
- org.eclipse.net4j.internal.buddies.protocol;version="4.0.300";x-friends:="org.eclipse.net4j.buddies.ui"
+Export-Package: org.eclipse.net4j.buddies;version="4.0.400",
+ org.eclipse.net4j.internal.buddies;version="4.0.400";x-friends:="org.eclipse.net4j.buddies.ui",
+ org.eclipse.net4j.internal.buddies.bundle;version="4.0.400";x-friends:="org.eclipse.net4j.buddies.ui",
+ org.eclipse.net4j.internal.buddies.protocol;version="4.0.400";x-friends:="org.eclipse.net4j.buddies.ui"
Bundle-ActivationPolicy: lazy
diff --git a/plugins/org.eclipse.net4j.examples.installer/examples/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/ClientSession.java b/plugins/org.eclipse.net4j.examples.installer/examples/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/ClientSession.java
index d5f2a17402..0be67ac019 100644
--- a/plugins/org.eclipse.net4j.examples.installer/examples/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/ClientSession.java
+++ b/plugins/org.eclipse.net4j.examples.installer/examples/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/ClientSession.java
@@ -20,14 +20,12 @@ import org.eclipse.net4j.buddies.internal.common.Collaboration;
import org.eclipse.net4j.buddies.internal.common.protocol.BuddyStateNotification;
import org.eclipse.net4j.internal.buddies.bundle.OM;
import org.eclipse.net4j.internal.buddies.protocol.BuddiesClientProtocol;
+import org.eclipse.net4j.util.AdapterUtil;
import org.eclipse.net4j.util.event.IEvent;
import org.eclipse.net4j.util.lifecycle.ILifecycleEvent;
import org.eclipse.net4j.util.lifecycle.LifecycleUtil;
import org.eclipse.net4j.util.om.log.OMLogger;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.PlatformObject;
-
import java.util.Set;
/**
@@ -68,13 +66,10 @@ public class ClientSession extends BuddyContainer implements IBuddySession
LifecycleUtil.deactivate(this, OMLogger.Level.DEBUG);
}
- /**
- * @see PlatformObject#getAdapter(Class)
- */
- @SuppressWarnings("rawtypes")
+ @SuppressWarnings({ "unchecked", "rawtypes" })
public Object getAdapter(Class adapter)
{
- return Platform.getAdapterManager().getAdapter(this, adapter);
+ return AdapterUtil.adapt(this, adapter);
}
@Override
diff --git a/plugins/org.eclipse.net4j.ui.shared/META-INF/MANIFEST.MF b/plugins/org.eclipse.net4j.ui.shared/META-INF/MANIFEST.MF
index 04adb9cfc3..e68153808c 100644
--- a/plugins/org.eclipse.net4j.ui.shared/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.net4j.ui.shared/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.net4j.ui.shared;singleton:=true
-Bundle-Version: 4.2.100.qualifier
+Bundle-Version: 4.2.200.qualifier
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
@@ -9,8 +9,8 @@ Bundle-ActivationPolicy: lazy
Bundle-Activator: org.eclipse.net4j.ui.internal.shared.bundle.OM$Activator
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ClassPath: .
-Export-Package: org.eclipse.net4j.ui.shared;version="4.2.100";uses:="org.eclipse.jface.resource,org.eclipse.swt.graphics",
- org.eclipse.net4j.ui.internal.shared.bundle;version="4.2.100";x-internal:=true
+Export-Package: org.eclipse.net4j.ui.shared;version="4.2.200";uses:="org.eclipse.jface.resource,org.eclipse.swt.graphics",
+ org.eclipse.net4j.ui.internal.shared.bundle;version="4.2.200";x-internal:=true
Require-Bundle: org.eclipse.ui;bundle-version="[3.6.0,4.0.0)",
org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)",
org.eclipse.net4j.util;bundle-version="[3.1.0,4.0.0)"
diff --git a/plugins/org.eclipse.net4j.ui.shared/icons/full/obj16/pending.gif b/plugins/org.eclipse.net4j.ui.shared/icons/full/obj16/pending.gif
index 0cb9751233..6089d528ce 100644
--- a/plugins/org.eclipse.net4j.ui.shared/icons/full/obj16/pending.gif
+++ b/plugins/org.eclipse.net4j.ui.shared/icons/full/obj16/pending.gif
Binary files differ
diff --git a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/UIUtil.java b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/UIUtil.java
index 902e72a674..d42db2a833 100644
--- a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/UIUtil.java
+++ b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/UIUtil.java
@@ -50,6 +50,7 @@ import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
import java.util.List;
/**
@@ -264,6 +265,49 @@ public final class UIUtil
}
/**
+ * @since 3.5
+ */
+ public static List<Object> getElements(ISelection selection)
+ {
+ if (selection instanceof IStructuredSelection)
+ {
+ IStructuredSelection ssel = (IStructuredSelection)selection;
+
+ @SuppressWarnings("unchecked")
+ List<Object> result = ssel.toList();
+ return result;
+ }
+
+ return null;
+ }
+
+ /**
+ * @since 2.0
+ */
+ public static <T> List<T> getElements(ISelection selection, Class<T> type)
+ {
+ List<Object> elements = getElements(selection);
+ if (elements != null)
+ {
+ List<T> result = new ArrayList<T>();
+
+ for (Object element : elements)
+ {
+ if (type.isInstance(element))
+ {
+ @SuppressWarnings("unchecked")
+ T match = (T)element;
+ result.add(match);
+ }
+ }
+
+ return result;
+ }
+
+ return null;
+ }
+
+ /**
* Like {@link #getElement(ISelection, Class)} except that it attempts to adapt
* {@link IAdaptable}s to the required {@code type}, if necessary.
*
@@ -276,16 +320,27 @@ public final class UIUtil
}
/**
- * @since 2.0
+ * Like {@link #getElements(ISelection, Class)} except that it attempts to adapt
+ * {@link IAdaptable}s to the required {@code type}, if necessary.
+ *
+ * @since 3.5
*/
- public static <T> List<T> getElements(ISelection selection, Class<T> type)
+ public static <T> List<T> adaptElements(ISelection selection, Class<T> type)
{
- if (selection instanceof IStructuredSelection)
+ List<Object> elements = getElements(selection);
+ if (elements != null)
{
- IStructuredSelection ssel = (IStructuredSelection)selection;
+ List<T> result = new ArrayList<T>();
+
+ for (Object element : elements)
+ {
+ T match = AdapterUtil.adapt(element, type);
+ if (match != null)
+ {
+ result.add(match);
+ }
+ }
- @SuppressWarnings("unchecked")
- List<T> result = ssel.toList();
return result;
}
diff --git a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/actions/LongRunningAction.java b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/actions/LongRunningAction.java
index 1d35239dd9..4f481984d9 100644
--- a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/actions/LongRunningAction.java
+++ b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/actions/LongRunningAction.java
@@ -29,9 +29,9 @@ import org.eclipse.ui.PlatformUI;
*/
public abstract class LongRunningAction extends SafeAction
{
- private IWorkbenchPage page;
+ private static final ThreadLocal<Boolean> CANCELED = new ThreadLocal<Boolean>();
- private int totalWork;
+ private IWorkbenchPage page;
public LongRunningAction(IWorkbenchPage page)
{
@@ -153,44 +153,59 @@ public abstract class LongRunningAction extends SafeAction
return new Shell();
}
+ /**
+ * @deprecated Not supported anymore.
+ */
+ @Deprecated
protected final int getTotalWork()
{
- return totalWork;
+ return IProgressMonitor.UNKNOWN;
}
+ /**
+ * @deprecated Not supported anymore.
+ */
+ @Deprecated
protected final void setTotalWork(int totalWork)
{
- this.totalWork = totalWork;
}
protected final void cancel()
{
- totalWork = 0;
+ CANCELED.set(Boolean.TRUE);
}
@Override
protected final void safeRun() throws Exception
{
- totalWork = IProgressMonitor.UNKNOWN;
- preRun();
- if (totalWork != 0)
+ try
{
- new Job(getText())
+ CANCELED.set(Boolean.FALSE);
+ preRun();
+
+ if (CANCELED.get() != Boolean.TRUE)
{
- @Override
- protected IStatus run(IProgressMonitor progressMonitor)
+ new Job(getText())
{
- try
- {
- doRun(progressMonitor);
- return Status.OK_STATUS;
- }
- catch (Exception ex)
+ @Override
+ protected IStatus run(IProgressMonitor progressMonitor)
{
- return new Status(IStatus.ERROR, OM.BUNDLE_ID, ex.getMessage(), ex);
+ try
+ {
+ doRun(progressMonitor);
+ return Status.OK_STATUS;
+ }
+ catch (Exception ex)
+ {
+ return new Status(IStatus.ERROR, getBundleID(), ex.getMessage(), ex);
+ }
}
- }
- }.schedule();
+ }.schedule();
+ }
+ }
+ finally
+ {
+ CANCELED.remove();
}
}
diff --git a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/actions/LongRunningActionDelegate.java b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/actions/LongRunningActionDelegate.java
index abeb393b13..31dddea7f8 100644
--- a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/actions/LongRunningActionDelegate.java
+++ b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/actions/LongRunningActionDelegate.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Eike Stepper - initial API and implementation
*/
@@ -23,51 +23,66 @@ import org.eclipse.core.runtime.jobs.Job;
*/
public abstract class LongRunningActionDelegate extends SafeActionDelegate
{
- private int totalWork;
+ private static final ThreadLocal<Boolean> CANCELED = new ThreadLocal<Boolean>();
public LongRunningActionDelegate()
{
}
+ /**
+ * @deprecated Not supported anymore.
+ */
+ @Deprecated
protected final int getTotalWork()
{
- return totalWork;
+ return IProgressMonitor.UNKNOWN;
}
+ /**
+ * @deprecated Not supported anymore.
+ */
+ @Deprecated
protected final void setTotalWork(int totalWork)
{
- this.totalWork = totalWork;
}
protected final void cancel()
{
- totalWork = 0;
+ CANCELED.set(Boolean.TRUE);
}
@Override
protected final void safeRun() throws Exception
{
- totalWork = IProgressMonitor.UNKNOWN;
- preRun();
- if (totalWork != 0)
+ try
{
- new Job(getText())
+ CANCELED.set(Boolean.FALSE);
+ preRun();
+
+ if (CANCELED.get() != Boolean.TRUE)
{
- @Override
- protected IStatus run(IProgressMonitor progressMonitor)
+ new Job(getText())
{
- try
+ @Override
+ protected IStatus run(IProgressMonitor progressMonitor)
{
- doRun(progressMonitor);
- return Status.OK_STATUS;
+ try
+ {
+ doRun(progressMonitor);
+ return Status.OK_STATUS;
+ }
+ catch (Exception ex)
+ {
+ OM.LOG.error(ex);
+ return new Status(IStatus.ERROR, getBundleID(), ex.getMessage(), ex);
+ }
}
- catch (Exception ex)
- {
- OM.LOG.error(ex);
- return new Status(IStatus.ERROR, OM.BUNDLE_ID, ex.getMessage(), ex);
- }
- }
- }.schedule();
+ }.schedule();
+ }
+ }
+ finally
+ {
+ CANCELED.remove();
}
}
diff --git a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/handlers/LongRunningHandler.java b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/handlers/LongRunningHandler.java
index 60ea02d949..e204d92ec8 100644
--- a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/handlers/LongRunningHandler.java
+++ b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/handlers/LongRunningHandler.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Eike Stepper - initial API and implementation
* Christian W. Damus (CEA LIST) - bug 399306 - adapted from LongRunningActionDelegate
@@ -23,60 +23,75 @@ import org.eclipse.core.runtime.jobs.Job;
/**
* @author Eike Stepper
* @author Christian W. Damus (CEA LIST)
- *
+ *
* @since 3.4
*/
public abstract class LongRunningHandler extends SafeHandler
{
- private int totalWork;
+ private static final ThreadLocal<Boolean> CANCELED = new ThreadLocal<Boolean>();
public LongRunningHandler()
{
}
+ /**
+ * @deprecated Not supported anymore.
+ */
+ @Deprecated
protected final int getTotalWork()
{
- return totalWork;
+ return IProgressMonitor.UNKNOWN;
}
+ /**
+ * @deprecated Not supported anymore.
+ */
+ @Deprecated
protected final void setTotalWork(int totalWork)
{
- this.totalWork = totalWork;
}
protected final void cancel()
{
- totalWork = 0;
+ CANCELED.set(Boolean.TRUE);
}
@Override
- protected final Object safeExecute(ExecutionEvent event) throws Exception
+ protected final Object safeExecute(final ExecutionEvent event) throws Exception
{
- totalWork = IProgressMonitor.UNKNOWN;
- preRun();
- if (totalWork != 0)
+ try
{
- new Job(getText())
+ CANCELED.set(Boolean.FALSE);
+ preRun();
+
+ if (CANCELED.get() != Boolean.TRUE)
{
- @Override
- protected IStatus run(IProgressMonitor progressMonitor)
+ new Job(getText())
{
- try
- {
- doExecute(progressMonitor);
- return Status.OK_STATUS;
- }
- catch (Exception ex)
+ @Override
+ protected IStatus run(IProgressMonitor progressMonitor)
{
- OM.LOG.error(ex);
- return new Status(IStatus.ERROR, OM.BUNDLE_ID, ex.getMessage(), ex);
+ try
+ {
+ doExecute(event, progressMonitor);
+ return Status.OK_STATUS;
+ }
+ catch (Exception ex)
+ {
+ OM.LOG.error(ex);
+ return new Status(IStatus.ERROR, getBundleID(), ex.getMessage(), ex);
+ }
}
- }
- }.schedule();
- }
+ }.schedule();
+ }
- // Cannot return anything more useful
- return null;
+ // Cannot return anything more useful
+ return null;
+ }
+ finally
+ {
+ CANCELED.remove();
+ }
}
protected void preRun() throws Exception
@@ -94,8 +109,18 @@ public abstract class LongRunningHandler extends SafeHandler
* execution of the handler call-back on the UI thread. Any details required from
* it must be {@linkplain SafeHandler#extractEventDetails(ExecutionEvent) extracted}
* before the job is scheduled.
+ *
+ * @throws Exception
+ * @since 3.5
*/
- protected abstract void doExecute(IProgressMonitor progressMonitor) throws Exception;
+ protected void doExecute(ExecutionEvent event, IProgressMonitor progressMonitor) throws Exception
+ {
+ doExecute(progressMonitor);
+ }
+
+ protected void doExecute(IProgressMonitor progressMonitor) throws Exception
+ {
+ }
protected final void checkCancelation(IProgressMonitor monitor)
{
diff --git a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/handlers/SafeHandler.java b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/handlers/SafeHandler.java
index 77e8844338..b65d10d1e6 100644
--- a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/handlers/SafeHandler.java
+++ b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/handlers/SafeHandler.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Eike Stepper - initial API and implementation
* Christian W. Damus (CEA LIST) - bug 399306 - adapted from SafeActionDelegate
@@ -28,12 +28,11 @@ import org.eclipse.ui.handlers.HandlerUtil;
/**
* @author Eike Stepper
* @author Christian W. Damus (CEA LIST)
- *
+ *
* @since 3.4
*/
public abstract class SafeHandler extends AbstractHandler
{
-
private Command command;
private ISelection selection;
@@ -79,9 +78,16 @@ public abstract class SafeHandler extends AbstractHandler
@Override
public void setEnabled(Object evaluationContext)
{
- Object variable = HandlerUtil.getVariable(evaluationContext, ISources.ACTIVE_CURRENT_SELECTION_NAME);
- selection = variable instanceof ISelection ? (ISelection)variable : StructuredSelection.EMPTY;
- setBaseEnabled(updateSelection(selection));
+ try
+ {
+ Object variable = HandlerUtil.getVariable(evaluationContext, ISources.ACTIVE_CURRENT_SELECTION_NAME);
+ selection = variable instanceof ISelection ? (ISelection)variable : StructuredSelection.EMPTY;
+ setBaseEnabled(updateSelection(selection));
+ }
+ catch (Exception ex)
+ {
+ OM.LOG.error(ex);
+ }
}
/**
diff --git a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/views/ContainerItemProvider.java b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/views/ContainerItemProvider.java
index 0fcdc23f92..e5a9a19709 100644
--- a/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/views/ContainerItemProvider.java
+++ b/plugins/org.eclipse.net4j.util.ui/src/org/eclipse/net4j/util/ui/views/ContainerItemProvider.java
@@ -53,12 +53,17 @@ public class ContainerItemProvider<CONTAINER extends IContainer<Object>> extends
/**
* @since 3.5
*/
- public static final Image IMAGE_PENDING = SharedIcons.getImage(SharedIcons.OBJ_PENDING);
+ public static final Color PENDING_COLOR = UIUtil.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY);
/**
* @since 3.5
*/
- public static final Image IMAGE_ERROR = SharedIcons.getImage(SharedIcons.OBJ_ERROR);
+ public static final Image PENDING_IMAGE = SharedIcons.getImage(SharedIcons.OBJ_PENDING);
+
+ /**
+ * @since 3.5
+ */
+ public static final Image ERROR_IMAGE = SharedIcons.getImage(SharedIcons.OBJ_ERROR);
private Map<Object, Node> nodes = new HashMap<Object, Node>();
@@ -382,7 +387,7 @@ public class ContainerItemProvider<CONTAINER extends IContainer<Object>> extends
{
if (obj instanceof ContainerItemProvider.LazyElement)
{
- return getDisplay().getSystemColor(SWT.COLOR_GRAY);
+ return PENDING_COLOR;
}
return super.getForeground(obj);
@@ -393,12 +398,12 @@ public class ContainerItemProvider<CONTAINER extends IContainer<Object>> extends
{
if (obj instanceof ContainerItemProvider.LazyElement)
{
- return IMAGE_PENDING;
+ return PENDING_IMAGE;
}
if (obj instanceof ContainerItemProvider.ErrorElement)
{
- return IMAGE_ERROR;
+ return ERROR_IMAGE;
}
return super.getImage(obj);
@@ -411,9 +416,14 @@ public class ContainerItemProvider<CONTAINER extends IContainer<Object>> extends
*/
public interface Node
{
+ public boolean isDisposed();
+
public void dispose();
- public boolean isDisposed();
+ /**
+ * @since 3.5
+ */
+ public void disposeChildren();
public Object getElement();
@@ -443,6 +453,11 @@ public class ContainerItemProvider<CONTAINER extends IContainer<Object>> extends
this.parent = parent;
}
+ public boolean isDisposed()
+ {
+ return disposed;
+ }
+
public void dispose()
{
if (!disposed)
@@ -453,9 +468,11 @@ public class ContainerItemProvider<CONTAINER extends IContainer<Object>> extends
}
}
- public boolean isDisposed()
+ /**
+ * @since 3.5
+ */
+ public void disposeChildren()
{
- return disposed;
}
@Override
@@ -560,19 +577,25 @@ public class ContainerItemProvider<CONTAINER extends IContainer<Object>> extends
{
if (!isDisposed())
{
- if (children != null)
- {
- for (Node child : children)
- {
- child.dispose();
- }
+ disposeChildren();
+
+ containerListener = null;
+ super.dispose();
+ }
+ }
- children.clear();
- children = null;
- containerListener = null;
+ @Override
+ public void disposeChildren()
+ {
+ if (children != null)
+ {
+ for (Node child : children)
+ {
+ child.dispose();
}
- super.dispose();
+ children.clear();
+ children = null;
}
}
@@ -651,7 +674,7 @@ public class ContainerItemProvider<CONTAINER extends IContainer<Object>> extends
children.remove(lazyNode[0]);
}
- refreshElement(container, false);
+ refreshElement(container, true);
}
}
};

Back to the top