/******************************************************************************* * Copyright (c) 2012, 2013 Association for Decentralized Information Management in * Industry THTH ry. * 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 * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * VTT Technical Research Centre of Finland - initial API and implementation *******************************************************************************/ package org.simantics.g3d.vtk.action; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import org.eclipse.jface.action.Action; import org.simantics.g3d.vtk.common.InteractiveVtkPanel; public abstract class vtkAction extends Action implements KeyListener, MouseListener, MouseMotionListener { protected InteractiveVtkPanel panel; public vtkAction(InteractiveVtkPanel panel) { this.panel = panel; } @Override public void run() { panel.setActiveAction(this); } public void attach() { panel.addKeyListener(this); panel.addMouseListener(this); panel.addMouseMotionListener(this); } public void deattach() { panel.removeKeyListener(this); panel.removeMouseListener(this); panel.removeMouseMotionListener(this); } @Override public void keyPressed(KeyEvent e) { } @Override public void keyReleased(KeyEvent e) { } @Override public void keyTyped(KeyEvent e) { } public void mouseClicked(java.awt.event.MouseEvent e) { }; @Override public void mouseDragged(MouseEvent e) { } @Override public void mouseEntered(MouseEvent e) { } @Override public void mouseExited(MouseEvent e) { } @Override public void mouseMoved(MouseEvent e) { } @Override public void mousePressed(MouseEvent e) { } @Override public void mouseReleased(MouseEvent e) { } }