ConfigureNodeAction.java
Go to the documentation of this file.
00001 package org.ros.model.ros.diagram.part;
00002 
00003 import java.io.IOException;
00004 import java.util.Map;
00005 
00006 
00007 import org.eclipse.jface.action.IAction;
00008 import org.eclipse.jface.viewers.ISelection;
00009 import org.eclipse.jface.viewers.IStructuredSelection;
00010 import org.eclipse.ui.IObjectActionDelegate;
00011 import org.eclipse.ui.IWorkbenchPart;
00012 import org.ros.model.ros.diagram.edit.parts.NodeEditPart;
00013 import org.ros.model.ros.diagram.edit.parts.NodeNameEditPart;
00014 
00015 public class ConfigureNodeAction implements IObjectActionDelegate {
00016  
00017         public final static String ID = "org.ros.model.ros.popup.ConfigureNodeActionID";
00018 
00019         private NodeEditPart selectedElement;
00020 
00021         @Override
00022         public void run(IAction action) {
00023                 System.out.println("TTUT");
00024                 if (selectedElement == null) {
00025                         return;
00026                 }
00027                 String nodename = ((NodeNameEditPart)selectedElement.getChildBySemanticHint(RosVisualIDRegistry.getType(5008))).getEditText();
00028                 System.out.println(nodename);
00029                 String cmd = "rosrun dynamic_reconfigure reconfigure_gui";
00030                 Runtime run = Runtime.getRuntime();
00031                 Process pr;
00032                 try {
00033                         pr = run.exec(cmd);
00034                 } catch (IOException e) {
00035                         // TODO Auto-generated catch block
00036                         e.printStackTrace();
00037                 }
00038                 
00039         }
00040 
00041         @Override
00042         public void selectionChanged(IAction action, ISelection selection) {
00043                 // TODO Auto-generated method stub
00044                 selectedElement = null;
00045                 if (selection instanceof IStructuredSelection) {
00046                         IStructuredSelection structuredSelection = (IStructuredSelection) selection;
00047                         if (structuredSelection.getFirstElement() instanceof NodeEditPart) {
00048                                 selectedElement = (NodeEditPart) structuredSelection.getFirstElement();
00049                         }
00050                 }
00051         }
00052 
00053         @Override
00054         public void setActivePart(IAction action, IWorkbenchPart targetPart) {
00055                 // TODO Auto-generated method stub
00056                 
00057         }
00058 
00059         
00060 
00061 }


bride_plugin_source
Author(s): Alexander Bubeck
autogenerated on Sun Oct 5 2014 22:38:34