Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2022-11-23 17:21:06 +0000
committerEike Stepper2022-11-23 17:21:06 +0000
commit50344bb1617ad3ddfc2ccd986c8d0262152349cf (patch)
treefe7d22f488c5dee49ee1fd8d0d0e5ef75831884a /plugins/org.eclipse.emf.cdo.ui/src/org
parent851b1e1dc003d730e0d420d02e7d3cc4ce1a423c (diff)
downloadcdo-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.java29
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);
+ }
}
}

Back to the top