diff options
author | Eike Stepper | 2022-11-23 17:21:06 +0000 |
---|---|---|
committer | Eike Stepper | 2022-11-23 17:21:06 +0000 |
commit | 50344bb1617ad3ddfc2ccd986c8d0262152349cf (patch) | |
tree | fe7d22f488c5dee49ee1fd8d0d0e5ef75831884a /plugins/org.eclipse.emf.cdo.ui/src/org | |
parent | 851b1e1dc003d730e0d420d02e7d3cc4ce1a423c (diff) | |
download | cdo-50344bb1617ad3ddfc2ccd986c8d0262152349cf.tar.gz cdo-50344bb1617ad3ddfc2ccd986c8d0262152349cf.tar.xz cdo-50344bb1617ad3ddfc2ccd986c8d0262152349cf.zip |
[581112] [UI] CDOEditor fails if the editor's resource disappears on ViewTargetChange
https://bugs.eclipse.org/bugs/show_bug.cgi?id=581112
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.ui/src/org')
-rw-r--r-- | plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java index c3cbd137ef..4ac96d1f81 100644 --- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java +++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java @@ -2210,23 +2210,26 @@ public class CDOEditor extends MultiPageEditorPart implements IEditingDomainProv { if (view != null) { - ResourceSet resourceSet = view.getResourceSet(); - Resource resource = resourceSet.getResources().get(0); - - if (resource instanceof CDOResource) + EList<Resource> resources = view.getResourceSet().getResources(); + if (!resources.isEmpty()) { - CDOResource cdoResource = (CDOResource)resource; - String path = cdoResource.getPath(); + Resource resource = resources.get(0); - CDOBranch branch = view.getBranch(); - long timeStamp = view.getTimeStamp(); + if (resource instanceof CDOResource) + { + CDOResource cdoResource = (CDOResource)resource; + String path = cdoResource.getPath(); - String id = "org.eclipse.emf.cdo.resource" + path + "/" + branch.getID() + "/" + timeStamp; - Image image = getTitleImage(); - String text = path + " [" + branch.getName() + "/" + CDOCommonUtil.formatTimeStamp(timeStamp) + "]"; - String description = text; + CDOBranch branch = view.getBranch(); + long timeStamp = view.getTimeStamp(); - return new Topic(view.getSession(), id, image, text, description); + String id = "org.eclipse.emf.cdo.resource" + path + "/" + branch.getID() + "/" + timeStamp; + Image image = getTitleImage(); + String text = path + " [" + branch.getName() + "/" + CDOCommonUtil.formatTimeStamp(timeStamp) + "]"; + String description = text; + + return new Topic(view.getSession(), id, image, text, description); + } } } |