Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcletavernie2013-04-09 13:48:55 +0000
committercletavernie2013-04-09 13:48:55 +0000
commit71e0f1de6235e7e5365b8dad61bd9f2aa14ba809 (patch)
tree45b452990154dd57f69cdc8cabf7a420e20645d9
parenta5135e5731b27fa9a41ada3d3dd2322a9e89cb79 (diff)
downloadorg.eclipse.papyrus-71e0f1de6235e7e5365b8dad61bd9f2aa14ba809.tar.gz
org.eclipse.papyrus-71e0f1de6235e7e5365b8dad61bd9f2aa14ba809.tar.xz
org.eclipse.papyrus-71e0f1de6235e7e5365b8dad61bd9f2aa14ba809.zip
386574: [CSS - Refresh] Only the active diagram is refresh when the stylesheets change
https://bugs.eclipse.org/bugs/show_bug.cgi?id=386574 Fix a regression in the previous commit. When refresh was called manually, the editor was not refreshed at all.
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/handler/RefreshHandler.java3
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/DiagramHelper.java20
2 files changed, 14 insertions, 9 deletions
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/handler/RefreshHandler.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/handler/RefreshHandler.java
index e1fceec6dcb..fe74c2fd726 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/handler/RefreshHandler.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/handler/RefreshHandler.java
@@ -14,6 +14,7 @@ package org.eclipse.papyrus.infra.gmfdiag.common.handler;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForHandlers;
import org.eclipse.papyrus.infra.gmfdiag.common.Activator;
@@ -33,7 +34,7 @@ public class RefreshHandler extends AbstractHandler {
public Object execute(ExecutionEvent event) throws ExecutionException {
IEditorPart activeEditor;
try {
- activeEditor = ServiceUtilsForHandlers.getInstance().getNestedActiveIEditorPart(event);
+ activeEditor = ServiceUtilsForHandlers.getInstance().getService(IMultiDiagramEditor.class, event);
} catch (ServiceException ex) {
Activator.log.error(ex);
return null;
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/DiagramHelper.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/DiagramHelper.java
index 8841bcb0785..8ab63c01f65 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/DiagramHelper.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/helper/DiagramHelper.java
@@ -11,6 +11,7 @@
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.common.helper;
+import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
@@ -23,6 +24,7 @@ import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
import org.eclipse.papyrus.infra.core.utils.EditorUtils;
import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
+import org.eclipse.papyrus.infra.gmfdiag.common.Activator;
import org.eclipse.ui.IEditorPart;
@@ -55,23 +57,25 @@ public class DiagramHelper {
* Refreshes all diagrams in this IEditorPart (Including nested editors when necessary)
*
* @param editorPart
- */
+ */
public static void refresh(IEditorPart editorPart) {
List<IEditorPart> visibleEditorParts = null;
if(editorPart instanceof IMultiDiagramEditor) {
- ServicesRegistry servicesRegistry = (ServicesRegistry)editorPart.getAdapter(ServicesRegistry.class);
- if (servicesRegistry != null) {
+ ServicesRegistry servicesRegistry = (ServicesRegistry)editorPart.getAdapter(ServicesRegistry.class);
+ if(servicesRegistry != null) {
try {
- ISashWindowsContainer container = ServiceUtils.getInstance().getISashWindowsContainer(servicesRegistry) ;
- visibleEditorParts = container.getVisibleIEditorParts() ;
+ ISashWindowsContainer container = ServiceUtils.getInstance().getISashWindowsContainer(servicesRegistry);
+ visibleEditorParts = container.getVisibleIEditorParts();
} catch (ServiceException e) {
- e.printStackTrace();
+ Activator.log.error(e);
}
}
+ } else {
+ visibleEditorParts = Collections.singletonList(editorPart);
}
- if (visibleEditorParts != null) {
- for (IEditorPart visiblePart : visibleEditorParts) {
+ if(visibleEditorParts != null) {
+ for(IEditorPart visiblePart : visibleEditorParts) {
if(visiblePart instanceof DiagramEditor) {
DiagramEditor diagramEditor = (DiagramEditor)visiblePart;
DiagramEditPart topEditPart = diagramEditor.getDiagramEditPart();

Back to the top