Changeset 518
- Timestamp:
- 11/22/13 11:54:45 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/actions/Misc.java
r516 r518 30 30 import org.expeditee.gui.TimeKeeper; 31 31 import org.expeditee.importer.FrameDNDTransferHandler; 32 import org.expeditee.io.ExpClipReader;33 32 import org.expeditee.items.Item; 34 33 import org.expeditee.items.ItemUtils; … … 1084 1083 FrameIO.SaveFrame(frame); // save frame to disk 1085 1084 } 1085 1086 private static boolean startWidget(String name) throws Exception { 1087 String fullName = Actions.getClassName(name); 1088 if(fullName == null) { 1089 return false; 1090 } 1091 MessageBay.displayMessage("Creating new \"" + fullName + "\""); 1092 1093 FreeItems.getInstance().clear(); 1094 Text wt = new Text("@iw:" + fullName); // create new text item for browser widget 1095 wt.setParent(DisplayIO.getCurrentFrame()); // set parent of text source for InteractiveWidget.createWidget() 1096 wt.setXY(FrameMouseActions.getX(), FrameMouseActions.getY()); // move to the mouse cursor 1097 InteractiveWidget widget = InteractiveWidget.createWidget(wt); 1098 FrameMouseActions.pickup(widget.getItems()); 1099 1100 return true; 1101 } 1102 1103 private static void runUnknown(String command) throws Exception { 1104 if(startWidget(command)) { 1105 return; 1106 } 1107 1108 Actions.PerformAction(DisplayIO.getCurrentFrame(), null, command); 1109 } 1110 1111 public static void run(String command) throws Exception { 1112 int firstSpace = command.indexOf(" "); 1113 if(firstSpace == -1) { 1114 runUnknown(command); 1115 return; 1116 } 1117 String argLower = command.toLowerCase(); 1118 String name = argLower.substring(0, firstSpace).trim(); // first word 1119 String args = argLower.substring(firstSpace).trim(); // remainder after first word 1120 if(name == "action" || name == "agent") { 1121 if(args.length() > 0) { 1122 Actions.PerformAction(DisplayIO.getCurrentFrame(), null, args); 1123 } else { 1124 MessageBay.displayMessage("Please specify an action/agent name"); 1125 } 1126 } else if(name == "widget") { 1127 if(args.length() > 0) { 1128 if(!startWidget(args)) { 1129 MessageBay.displayMessage("Widget \"" + name + "\" does not exist"); 1130 } 1131 } else { 1132 MessageBay.displayMessage("Please specify a widget name"); 1133 } 1134 } else { 1135 runUnknown(command); 1136 } 1137 } 1138 1139 public static void run(Item item) throws Exception { 1140 run(((Text)item).getText()); 1141 } 1086 1142 }
Note:
See TracChangeset
for help on using the changeset viewer.