Package tool.commands.run

Source Code of tool.commands.run.RunHandler

package tool.commands.run;

import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ITreeSelection;
import org.eclipse.ui.ISelectionService;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.handlers.HandlerUtil;

import tool.builder.FScript;

public class RunHandler  extends AbstractHandler{
  FScript fscript;
  @Override
  public Object execute(ExecutionEvent event) throws ExecutionException {
    IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
    ISelectionService selectionService = window.getSelectionService();
    ISelection selection = selectionService.getSelection();
   
    if (selection instanceof ITreeSelection && (((ITreeSelection) selection).getFirstElement() instanceof IFolder)){
      ITreeSelection treeSelection = (ITreeSelection)selection;
      IFolder planFolder = (IFolder) treeSelection.getFirstElement();
      RunJob runner = new RunJob(planFolder);
      runner.setPriority(Job.INTERACTIVE);
      runner.schedule();
    }
   
   
    return null;
  }

}
TOP

Related Classes of tool.commands.run.RunHandler

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.