Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 356828

Summary: Editor title is not decoded last segment of resource URI
Product: [Modeling] Graphiti Reporter: Filippo Rossoni <filippo.rossoni>
Component: CoreAssignee: Michael Wenz <michael.wenz>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: matthias.gorning, michael.wenz
Version: 0.8.0Flags: michael.wenz: juno+
Target Milestone: 0.9.0   
Hardware: All   
OS: All   
Whiteboard: Juno M2 Theme_bugs
Attachments:
Description Flags
restore previus version of org.eclipse.graphiti.ui.internal.editor.DiagramEditorInternal.refreshTitle()
none
fix editor name patch
none
fix editor name patch michael.wenz: iplog+

Description Filippo Rossoni CLA 2011-09-06 11:27:42 EDT
Build Identifier: 730ab5024235058a25e77f37a4b0af7d54863eb6

the diagram editor title is changed from Diagram name to last segment of resource URI
for example if the file contains space the title contains %20

Reproducible: Always

Steps to Reproduce:
1.create a diagram with a diagram name diffrent from file name wich contains space
2.open editor
3.
Comment 1 Filippo Rossoni CLA 2011-09-06 11:36:37 EDT
Created attachment 202816 [details]
restore previus version of org.eclipse.graphiti.ui.internal.editor.DiagramEditorInternal.refreshTitle()

restore previus version of org.eclipse.graphiti.ui.internal.editor.DiagramEditorInternal.refreshTitle()
Comment 2 Filippo Rossoni CLA 2011-09-06 11:44:24 EDT
Created attachment 202818 [details]
fix editor name patch

restore old org.eclipse.graphiti.ui.internal.editor.DiagramEditorInternal.refreshTitle()
Comment 3 Filippo Rossoni CLA 2011-09-06 11:48:38 EDT
Comment on attachment 202818 [details]
fix editor name patch

>From 7820306c01d1bbdd66b74766f8d5d5493453f6e9 Tue, 6 Sep 2011 17:41:47 +0200
>From: rossonifi <filippo.rossoni@valueteam.com>
>Date: Tue, 6 Sep 2011 17:41:27 +0200
>Subject: [PATCH] fix editor name
>
>diff --git a/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/internal/editor/DiagramEditorInternal.java b/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/internal/editor/DiagramEditorInternal.java
>index 540f6ba..82c4136 100644
>--- a/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/internal/editor/DiagramEditorInternal.java
>+++ b/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/internal/editor/DiagramEditorInternal.java
>@@ -38,6 +38,7 @@
> import org.eclipse.draw2d.geometry.Dimension;
> import org.eclipse.draw2d.geometry.Point;
> import org.eclipse.emf.common.command.CommandStackListener;
>+import org.eclipse.emf.common.util.URI;
> import org.eclipse.emf.ecore.EObject;
> import org.eclipse.emf.ecore.resource.Resource;
> import org.eclipse.emf.ecore.resource.ResourceSet;
>@@ -1390,8 +1391,15 @@
> 	}
> 
> 	private void refreshTitle() {
>-		String lastSegment = getDiagramTypeProvider().getDiagram().eResource().getURI().lastSegment();
>-		setPartName(lastSegment);
>+		String name = getConfigurationProvider().getDiagramTypeProvider().getDiagramTitle();
>+		if (name == null || name.length() == 0) {
>+			name = getConfigurationElement().getAttribute("name"); //$NON-NLS-1$
>+		}
>+		if (name == null || name.length() == 0) {
>+			name = URI.decode(getDiagramTypeProvider().getDiagram().eResource().getURI().lastSegment());
>+		setPartName(name);
> 	}
> 
> 	@Override
Comment 4 Filippo Rossoni CLA 2011-09-06 11:50:26 EDT
Created attachment 202819 [details]
fix editor name patch

restore previus org.eclipse.graphiti.ui.internal.editor.DiagramEditorInternal.refreshTitle()
Comment 5 Michael Wenz CLA 2011-09-07 09:23:38 EDT
Correct, what we edit in the Diagram editor is the diagram not the file.
Comment 6 Michael Wenz CLA 2011-09-08 08:36:45 EDT
I have taken over the attached patch, committed and pushed it to Eclipse. Additionally I have created a SWT bot test for this.

commit 4db838b29c0b56526d66e8170104d69c3989e6d3
Author: mwenz <michael.wenz@sap.com> 2011-09-08 14:31:57
Committer: mwenz <michael.wenz@sap.com> 2011-09-08 14:32:54
Parent: 0fd452f7f562e3f43ccc561fd9ef95f5d41af8be (IGaService#ignoreAll renamed to resetAll())
Branches: master
Comment 7 Michael Wenz CLA 2012-04-11 10:35:15 EDT
Bookkeeping: Set target release
Comment 8 Michael Wenz CLA 2012-06-28 10:42:24 EDT
Part of Graphiti 0.9.0 (Eclipse Juno)