blob: 22dc34b599c56ab365ab26025dc7352b5fdaacc9 [file] [log] [blame]
/*****************************************************************************
* Copyright (c) 2019 CEA LIST.
*
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Xavier Le Pallec (for CEA LIST) xlepallec@lilo.org - Bug 558456
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.clazz.lf.autosizeableclasses.statemachine;
import org.eclipse.gef.palette.ToolEntry;
import org.eclipse.gef.ui.palette.PaletteViewer;
/**
* This class implements an listener to detect every change of actions on the
* class diagram, according the palette. It implements the
* org.eclipse.gef.palette.PaletteListener class. When the active tool changes,
* the listener notifies the state machine (passed in parameter).
*
*/
public class EndOfRequestListener implements org.eclipse.gef.palette.PaletteListener {
private StateMachine stateMachine;
/**
* As when the active tool changes, the listener will notify a state machine,
* this last one has to be passed in parameter of this constructor. (passed in
* parameter).
*
* @param stateMachine state machine to notified when there is a change of tool.
*/
public EndOfRequestListener(StateMachine stateMachine) {
super();
this.stateMachine = stateMachine;
}
private StateMachine getStateMachine() {
return stateMachine;
}
/**
* When the active tool changes, the listener notifies the state machine (passed
* in parameter of the constructor).
*/
@Override
public void activeToolChanged(PaletteViewer palette, ToolEntry tool) {
getStateMachine().getLowEventManager().activeToolChanged();
}
}