Package org.gvt.action

Source Code of org.gvt.action.SelectionToolAction

package org.gvt.action;

import org.eclipse.gef.*;
import org.eclipse.gef.tools.SelectionTool;
import org.eclipse.jface.resource.ImageDescriptor;
import org.gvt.ChisioMain;

/**
* Tool to select and manipulate figures.
* A selection tool is in one of three states, e.g., background selection,
* figure selection, handle manipulation.
*
* @author Cihan Kucukkececi
*
* Copyright: I-Vis Research Group, Bilkent University, 2007
*/
public class SelectionToolAction extends AbstractGEFToolAction
{
  public SelectionToolAction(String text, ChisioMain main)
  {
    super(text, main);
    setImageDescriptor(ImageDescriptor.createFromFile(
      ChisioMain.class,
      "icon/select.png"));
  }

  protected Tool createTool()
  {
    SelectionTool tool = new SelectionTool()
    {
      public void activate()
      {
        setChecked(true);
        super.activate();
      }

      public void deactivate()
      {
        setChecked(false);
        super.deactivate();
      }
    };

    if (main.getEditDomain() != null)
    {
      main.getEditDomain().setDefaultTool(tool);
      main.getEditDomain().setActiveTool(tool);
    }

    return tool;
  }
}
TOP

Related Classes of org.gvt.action.SelectionToolAction

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.