Package es.iiia.sgi.actions

Source Code of es.iiia.sgi.actions.PasteAction

package es.iiia.sgi.actions;

import org.eclipse.jface.action.Action;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;

import es.iiia.shapeeditor.ShapeEditor;
import es.iiia.shapegrammar.model.GeometryModel;

public class PasteAction extends Action implements IWorkbenchAction {
  private IWorkbenchWindow workbenchWindow;
  private ShapeEditor editor;

  public PasteAction(IWorkbenchWindow window) {
    workbenchWindow = window;
  }

  @Override
  public void dispose() {
  }

  @Override
  public void run() {
    try {
      if (ShapeClipboard.get() != null) {
        ShapeEditor editor = (ShapeEditor) workbenchWindow
            .getActivePage().getActiveEditor();
        for (GeometryModel mdl : ShapeClipboard.get()) {
          editor.getModel().addChild(mdl.clone());
        }
      }
    } catch (Exception ex) {

    }
  }
}
TOP

Related Classes of es.iiia.sgi.actions.PasteAction

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.