From 847c62ff92d54a0723a0b143afa12771d6855c72 Mon Sep 17 00:00:00 2001 From: Sebastien Gabel Date: Fri, 22 Jul 2016 17:30:12 +0200 Subject: Bug 498357: Avoid adding non executable command that will block all others in CustomizableDropEditPolicy https://bugs.eclipse.org/bugs/show_bug.cgi?id=498357 Test the returned command before adding it to the array list. Change-Id: I103c559385e8077e2c373f8c971f9535c688eca9 Signed-off-by: Sebastien Gabel --- .../infra/gmfdiag/dnd/policy/CustomizableDropEditPolicy.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'plugins') diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.dnd/src/org/eclipse/papyrus/infra/gmfdiag/dnd/policy/CustomizableDropEditPolicy.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.dnd/src/org/eclipse/papyrus/infra/gmfdiag/dnd/policy/CustomizableDropEditPolicy.java index 3391c69e53b..36dffd84eaf 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.dnd/src/org/eclipse/papyrus/infra/gmfdiag/dnd/policy/CustomizableDropEditPolicy.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.dnd/src/org/eclipse/papyrus/infra/gmfdiag/dnd/policy/CustomizableDropEditPolicy.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2012, 2015 CEA LIST, Christian W. Damus, and others. + * Copyright (c) 2012, 2016 CEA LIST, Christian W. Damus, Esterel Technologies SAS and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -10,6 +10,7 @@ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation * Christian W. Damus - bug 433206 * Christian W. Damus - bug 477384 + * Sebastien Bordes (Esterel Technologies SAS) - bug 498357 *****************************************************************************/ package org.eclipse.papyrus.infra.gmfdiag.dnd.policy; @@ -477,9 +478,12 @@ public class CustomizableDropEditPolicy extends DragDropEditPolicy { } //Retrieve defaultStrategy - ArrayList selectedCommands = new ArrayList(); - selectedCommands.add(defaultDropStrategy.getCommand(request, getHost())); - matchingStrategies.put(defaultDropStrategy, selectedCommands); + Command command = defaultDropStrategy.getCommand(request, getHost()); + if (command != null && command.canExecute()) { + List selectedCommands = new ArrayList(); + selectedCommands.add(command); + matchingStrategies.put(defaultDropStrategy, selectedCommands); + } return matchingStrategies; } -- cgit v1.2.3