diff options
| author | pnehrer | 2005-01-31 16:21:22 +0000 |
|---|---|---|
| committer | pnehrer | 2005-01-31 16:21:22 +0000 |
| commit | 1dba21b1afeee1042c887a8fc8c63408a1a40dd1 (patch) | |
| tree | b654aed9f41100c77a5825426581dc7b137f9286 | |
| parent | cebe12eac3c6613e41ddbd9382c9b8e9b8f9b5cc (diff) | |
| download | org.eclipse.ecf-1dba21b1afeee1042c887a8fc8c63408a1a40dd1.tar.gz org.eclipse.ecf-1dba21b1afeee1042c887a8fc8c63408a1a40dd1.tar.xz org.eclipse.ecf-1dba21b1afeee1042c887a8fc8c63408a1a40dd1.zip | |
Refactored for latest API.
2 files changed, 17 insertions, 12 deletions
diff --git a/examples/bundles/org.eclipse.ecf.example.sdo.editor/src/org/eclipse/ecf/example/sdo/editor/EditorPlugin.java b/examples/bundles/org.eclipse.ecf.example.sdo.editor/src/org/eclipse/ecf/example/sdo/editor/EditorPlugin.java index 319e76b91..d300db11e 100644 --- a/examples/bundles/org.eclipse.ecf.example.sdo.editor/src/org/eclipse/ecf/example/sdo/editor/EditorPlugin.java +++ b/examples/bundles/org.eclipse.ecf.example.sdo.editor/src/org/eclipse/ecf/example/sdo/editor/EditorPlugin.java @@ -24,6 +24,7 @@ import org.eclipse.ecf.core.SharedObjectCreateException; import org.eclipse.ecf.core.SharedObjectDescription; import org.eclipse.ecf.core.identity.IDFactory; import org.eclipse.ecf.core.identity.IDInstantiationException; +import org.eclipse.ecf.core.util.ECFException; import org.eclipse.ecf.sdo.ISharedDataGraph; import org.eclipse.ecf.sdo.ISubscriptionCallback; import org.eclipse.ecf.sdo.IUpdateConsumer; @@ -165,7 +166,7 @@ public class EditorPlugin extends AbstractUIPlugin { return SDOPlugin.getDefault().getDataGraphSharing(container) .subscribe(IDFactory.makeStringID(path), callback, new EMFUpdateProvider(), consumer); - } catch (IDInstantiationException e) { + } catch (ECFException e) { throw new CoreException(new Status(Status.ERROR, getBundle() .getSymbolicName(), 0, "Could not subscribe to graph with id " + path + ".", e)); @@ -182,7 +183,7 @@ public class EditorPlugin extends AbstractUIPlugin { new EMFUpdateProvider(), consumer); published.put(path, container); return sdg; - } catch (IDInstantiationException e) { + } catch (ECFException e) { throw new CoreException(new Status(Status.ERROR, getBundle() .getSymbolicName(), 0, "Could not publish graph with id " + path + ".", e)); diff --git a/examples/bundles/org.eclipse.ecf.example.sdo.editor/src/org/eclipse/ecf/example/sdo/editor/SharedSDOEditor.java b/examples/bundles/org.eclipse.ecf.example.sdo.editor/src/org/eclipse/ecf/example/sdo/editor/SharedSDOEditor.java index d1c65badd..6ab2c24a3 100644 --- a/examples/bundles/org.eclipse.ecf.example.sdo.editor/src/org/eclipse/ecf/example/sdo/editor/SharedSDOEditor.java +++ b/examples/bundles/org.eclipse.ecf.example.sdo.editor/src/org/eclipse/ecf/example/sdo/editor/SharedSDOEditor.java @@ -17,7 +17,7 @@ import org.eclipse.ecf.core.identity.ID; import org.eclipse.ecf.core.util.ECFException; import org.eclipse.ecf.sdo.ISharedDataGraph; import org.eclipse.ecf.sdo.IUpdateConsumer; -import org.eclipse.ecf.sdo.SubscriptionBlocker; +import org.eclipse.ecf.sdo.WaitableSubscriptionCallback; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.sdo.EDataGraph; @@ -42,11 +42,12 @@ public class SharedSDOEditor extends SDOEditor { return true; } - public void updateFailed(ISharedDataGraph graph, ID containerID) { + public void updateFailed(ISharedDataGraph graph, ID containerID, + Throwable cause) { EditorPlugin.getDefault().log( new CoreException(new Status(Status.ERROR, EditorPlugin .getDefault().getBundle().getSymbolicName(), 0, - "Data graph upate failed.", null))); + "Data graph upate failed.", cause))); } } @@ -65,7 +66,7 @@ public class SharedSDOEditor extends SDOEditor { URI uri = URI.createPlatformResourceURI(modelFile.getFile() .getFullPath().toString()); if (EditorPlugin.getDefault().isPublished(path)) { - SubscriptionBlocker mutex = new SubscriptionBlocker(); + WaitableSubscriptionCallback mutex = new WaitableSubscriptionCallback(); try { sharedDataGraph = EditorPlugin.getDefault().subscribe(path, mutex, new UpdateConsumer()); @@ -75,21 +76,24 @@ public class SharedSDOEditor extends SDOEditor { return; } - boolean subscribed; + ID containerID = null; + Throwable cause = null; try { - subscribed = mutex.waitForSubscription(1000); + containerID = mutex.waitForSubscription(1000); } catch (InterruptedException e) { - subscribed = false; + cause = e; + } catch (ECFException e) { + cause = e; } - if (!subscribed) { + if (containerID == null) { EditorPlugin.getDefault().log( new CoreException(new Status(Status.ERROR, EditorPlugin .getDefault().getBundle().getSymbolicName(), 0, - "Failed to subscribe.", null))); + "Failed to subscribe.", cause))); return; } - + EDataGraph dataGraph = (EDataGraph) sharedDataGraph.getDataGraph(); dataGraph.getDataGraphResource().setURI(uri); editingDomain.getResourceSet().getResources().addAll( |
