Skip to content

Commit

Permalink
[527109] Disable WizardEditPolicy in Showing mode
Browse files Browse the repository at this point in the history
This commit disables the Capella WizardEditPolicy when the Sirius
Showing mode is enabled. This allows to test this POC in Capella.
Without this fix, the wizard interferes with the double click policy
that is supposed to change the visibility state in this mode.

Bug: 527109
Change-Id: Ib2b67d9fddbb626be32627a1eaa872452e2bce77
Signed-off-by: Laurent Redor <laurent.redor@obeo.fr>
(cherry picked from commit 180c638)
  • Loading branch information
lredor authored and pdulth committed Apr 6, 2018
1 parent 33a51c2 commit 21dd55c
Showing 1 changed file with 17 additions and 12 deletions.
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2014 THALES GLOBAL SERVICES.
* Copyright (c) 2006, 2018 THALES GLOBAL SERVICES.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
Expand All @@ -17,6 +17,7 @@
import org.eclipse.gef.RequestConstants;
import org.eclipse.gef.commands.Command;
import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
import org.eclipse.sirius.diagram.DDiagramElement;
import org.eclipse.sirius.diagram.ui.graphical.edit.policies.AbstractSiriusEditPolicy;
import org.eclipse.sirius.diagram.ui.tools.api.command.GMFCommandWrapper;
import org.eclipse.sirius.viewpoint.DSemanticDecorator;
Expand Down Expand Up @@ -49,21 +50,25 @@ public Command getCommand(final Request request) {
final DSemanticDecorator semanticDecorator = this.getFirstDecorateSemanticElement();
if (CapellaResourceHelper.isSemanticElement(semanticDecorator.getTarget())) {
final EObject modelElement = semanticDecorator.getTarget();
Command cmd = new ICommandProxy(new GMFCommandWrapper(getEditingDomain(), new IdentityCommand(getEditingDomain()) {
if (semanticDecorator instanceof DDiagramElement
&& !((DDiagramElement) semanticDecorator).getParentDiagram().isIsInShowingMode()) {
Command cmd = new ICommandProxy(
new GMFCommandWrapper(getEditingDomain(), new IdentityCommand(getEditingDomain()) {

@Override
public void execute() {
new OpenCustomWizardCommand(modelElement).run();
}
@Override
public void execute() {
new OpenCustomWizardCommand(modelElement).run();
}

@Override
public String getLabel() {
return Messages.CustomWizardHandler_Command_Title;
}
@Override
public String getLabel() {
return Messages.CustomWizardHandler_Command_Title;
}

}));
}));

return cmd;
return cmd;
}
}
}
return null;
Expand Down

0 comments on commit 21dd55c

Please sign in to comment.