diff options
author | Benoit Maggi | 2018-07-02 09:22:35 +0000 |
---|---|---|
committer | Benoit Maggi | 2018-07-02 13:30:54 +0000 |
commit | e9c6b1b23e75a5572c2083b1aa3e00c42daaea95 (patch) | |
tree | 01af9d23b826bbec9b358deb4ff63790c7b04f42 /plugins/infra/gmfdiag | |
parent | 6a380916aed9be05f2a114cb98a0977b69d02742 (diff) | |
download | org.eclipse.papyrus-e9c6b1b23e75a5572c2083b1aa3e00c42daaea95.tar.gz org.eclipse.papyrus-e9c6b1b23e75a5572c2083b1aa3e00c42daaea95.tar.xz org.eclipse.papyrus-e9c6b1b23e75a5572c2083b1aa3e00c42daaea95.zip |
Bug 536581 - NullPointerException in PolicyChecker.getFor
- provide default policyChecker for call with null
- return null as diagramType when diagram is null
Change-Id: I31eac58d645f82e4c8ac93c67950aecf27f0927b
Signed-off-by: Benoit Maggi <benoit.maggi@cea.fr>
Diffstat (limited to 'plugins/infra/gmfdiag')
-rw-r--r-- | plugins/infra/gmfdiag/expansion/org.eclipse.papyrus.infra.gmfdiag.expansion/src/main/java/org/eclipse/papyrus/infra/gmfdiag/expansion/expansionmodel/providers/ExpandEditPartProvider.java | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/plugins/infra/gmfdiag/expansion/org.eclipse.papyrus.infra.gmfdiag.expansion/src/main/java/org/eclipse/papyrus/infra/gmfdiag/expansion/expansionmodel/providers/ExpandEditPartProvider.java b/plugins/infra/gmfdiag/expansion/org.eclipse.papyrus.infra.gmfdiag.expansion/src/main/java/org/eclipse/papyrus/infra/gmfdiag/expansion/expansionmodel/providers/ExpandEditPartProvider.java index 469f19af7ca..877d0972cb9 100644 --- a/plugins/infra/gmfdiag/expansion/org.eclipse.papyrus.infra.gmfdiag.expansion/src/main/java/org/eclipse/papyrus/infra/gmfdiag/expansion/expansionmodel/providers/ExpandEditPartProvider.java +++ b/plugins/infra/gmfdiag/expansion/org.eclipse.papyrus.infra.gmfdiag.expansion/src/main/java/org/eclipse/papyrus/infra/gmfdiag/expansion/expansionmodel/providers/ExpandEditPartProvider.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2015 CEA LIST. + * Copyright (c) 2015, 2018 CEA LIST. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -8,8 +8,8 @@ * * Contributors: * - * CEA LIST - Initial API and implementation - * + * CEA LIST - Initial API and implementation + * Benoit Maggi (CEA) - Bug 536581 *****************************************************************************/ package org.eclipse.papyrus.infra.gmfdiag.expansion.expansionmodel.providers; @@ -52,10 +52,10 @@ public class ExpandEditPartProvider extends AbstractEditPartProvider { // private static final boolean DEBUG_EXPANSION = "true".equalsIgnoreCase(Platform.getDebugOption( // "org.eclipse.papyrus.infra.gmfdiag.common/debug/expansion")); /** Map containing node view types supported by this provider */ - protected Map<String, Class<?>> nodeMap = new HashMap<String, Class<?>>(); + protected Map<String, Class<?>> nodeMap = new HashMap<>(); /** Map containing edge view types supported by this provider */ - protected Map<String, Class<?>> edgeMap = new HashMap<String, Class<?>>(); + protected Map<String, Class<?>> edgeMap = new HashMap<>(); private DiagramExpansionsRegistry diagramExpansionRegistry=null; @@ -67,14 +67,15 @@ public class ExpandEditPartProvider extends AbstractEditPartProvider { } protected String getDiagramType(View currentView) { - Diagram diagram=currentView.getDiagram(); String currentDiagramType=null; - ViewPrototype viewPrototype=org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils.getPrototype(diagram); - if(viewPrototype!=null){ - currentDiagramType=viewPrototype.getLabel(); - } - else{ - currentDiagramType=diagram.getType(); + Diagram diagram=currentView.getDiagram(); + if (diagram != null) { + ViewPrototype viewPrototype=org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils.getPrototype(diagram); + if(viewPrototype!=null){ + currentDiagramType=viewPrototype.getLabel(); + } else{ + currentDiagramType=diagram.getType(); + } } return currentDiagramType; } @@ -123,8 +124,7 @@ public class ExpandEditPartProvider extends AbstractEditPartProvider { if ((currentDiagramType == null) || (diagramExpansionRegistry.getUsage(currentDiagramType)==null)) { return null; } - - + String graphicalType = view.getType(); Activator.log.trace(Activator.EXPANSION_TRACE,this.getClass().getName()+" view appears with the type "+graphicalType);//$NON-NLS-1$ EObject eObject= diagramExpansionRegistry.mapChildreen.get(currentDiagramType).IDMap.get(graphicalType); @@ -178,7 +178,6 @@ public class ExpandEditPartProvider extends AbstractEditPartProvider { private IGraphicalEditPart createNewGraphicEditPart(Class editpartClass, Object[] constructorParams) { try { Constructor constructor = getCreationConstructor(editpartClass); - return (constructor == null)? null : (IGraphicalEditPart) constructor.newInstance(constructorParams); } catch (Throwable e) { |