Changeset 22 for trunk/src/org/expeditee/actions
- Timestamp:
- 05/09/08 09:31:42 (16 years ago)
- Location:
- trunk/src/org/expeditee/actions
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/actions/Simple.java
r21 r22 4 4 import java.awt.Point; 5 5 import java.awt.event.InputEvent; 6 import java.io.BufferedReader; 7 import java.io.InputStreamReader; 6 8 import java.util.ArrayList; 7 9 import java.util.LinkedList; 8 10 import java.util.List; 9 11 12 import org.expeditee.agents.WriteTree; 10 13 import org.expeditee.gui.AttributeUtils; 11 14 import org.expeditee.gui.DisplayIO; … … 880 883 String log = SessionStats.getFrameEventList(); 881 884 Text t; 882 try {883 884 885 886 } catch (Exception e) {887 888 889 }885 // try { 886 t = (Text) context.getPointers().getVariable(tokens[1]) 887 .getValue(); 888 t.setText(log); 889 // } catch (Exception e) { 890 // t = new Text(-1, log); 891 // context.getPointers().setObject(tokens[1], t); 892 // } 890 893 891 894 return Status.OK; … … 1028 1031 String stats = SessionStats.getCurrentStats(); 1029 1032 Text t; 1030 try {1031 1032 1033 1034 } catch (Exception e) {1035 1036 1037 }1033 // try { 1034 t = (Text) context.getPointers().getVariable(tokens[1]) 1035 .getValue(); 1036 t.setText(stats); 1037 // } catch (Exception e) { 1038 // t = new Text(-1, stats); 1039 // context.getPointers().setObject(tokens[1], t); 1040 // } 1038 1041 1039 1042 return Status.OK; … … 1123 1126 Text dynamicCode = new Text(1, codeText); 1124 1127 RunItem(dynamicCode, context, Status.OK); 1128 return Status.OK; 1129 } else if (tokens[0].equals("runoscommand")) { 1130 String command = getMessage(tokens, context, code.toString(), " ", 1131 1); 1132 Runtime.getRuntime().exec(command); 1133 return Status.OK; 1134 } else if (tokens[0].equals("executeoscommand")) { 1135 String command = getMessage(tokens, context, code.toString(), " ", 1136 1); 1137 Process p = Runtime.getRuntime().exec(command); 1138 FrameGraphics.DisplayMessage(command, Color.darkGray); 1139 1140 BufferedReader stdInput = new BufferedReader(new InputStreamReader( 1141 p.getInputStream())); 1142 BufferedReader stdError = new BufferedReader(new InputStreamReader( 1143 p.getErrorStream())); 1144 String message = ""; 1145 while ((message = stdInput.readLine()) != null) { 1146 FrameGraphics.DisplayMessage(message); 1147 } 1148 while ((message = stdError.readLine()) != null) { 1149 FrameGraphics.ErrorMessage(message); 1150 } 1125 1151 return Status.OK; 1126 1152 } else if (tokens[0].startsWith("else")) { … … 1279 1305 Item item = (Item) context.getPointers().getVariable(itemVar) 1280 1306 .getValue(); 1307 item 1308 .setPosition(FrameMouseActions.MouseX, 1309 FrameMouseActions.MouseY); 1281 1310 FrameMouseActions.pickup(item); 1282 1311 return Status.OK; … … 1291 1320 Frame frame = DisplayIO.getCurrentFrame(); 1292 1321 Text item = frame.createNewText(s); 1322 item 1323 .setPosition(FrameMouseActions.MouseX, 1324 FrameMouseActions.MouseY); 1293 1325 FrameMouseActions.pickup(item); 1294 1326 // DisplayIO.repaint(); … … 1333 1365 frame.addItem(new Line(dot1, dot2, frame.getNextItemID())); 1334 1366 return Status.OK; 1335 } else if (tokens[0].equals("createitem")) { 1367 } else if (tokens[0].equals("createitem") 1368 || tokens[0].equals("createtext")) { 1336 1369 assertMinParametreCount(tokens, 4); 1337 1370 assertVariableType(tokens[1], 1, SPointer.framePrefix); … … 1352 1385 } 1353 1386 newItem = frame.addText(x, y, newText, newAction); 1354 } else 1355 // create a point if the optional params are not provided 1356 newItem = frame.addDot(x, y); 1387 } else { 1388 if (tokens[0].equals("createtext")) { 1389 newItem = frame.createNewText(); 1390 newItem.setPosition(x, y); 1391 } else { 1392 // create a point if the optional params are not provided 1393 newItem = frame.addDot(x, y); 1394 } 1395 } 1357 1396 context.getPointers().setObject(tokens[4], newItem); 1358 1397 … … 1639 1678 } 1640 1679 context.createFrameset(framesetName, successVar); 1680 return Status.OK; 1681 } else if (tokens[0].equals("writetree")) { 1682 assertMinParametreCount(tokens, 3); 1683 assertVariableType(tokens[1], 1, SPointer.framePrefix); 1684 Frame source = (Frame) context.getPointers().getVariable(tokens[1]) 1685 .getValue(); 1686 String format = context.getPrimitives().getStringValue(tokens[2]); 1687 String fileName = context.getPrimitives().getStringValue(tokens[3]); 1688 WriteTree wt = new WriteTree(format, fileName); 1689 if (wt.initialise(source)){ 1690 wt.setStartFrame(source); 1691 wt.run(); 1692 } 1641 1693 return Status.OK; 1642 1694 } else if (tokens[0].equals("concatstr")) {
Note:
See TracChangeset
for help on using the changeset viewer.