Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv9114/src/net/sourceforge/bprocessor/gui
Modified Files:
GUI.java
Log Message:
Index: GUI.java
===================================================================
RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/GUI.java,v
retrieving revision 1.120
retrieving revision 1.121
diff -C2 -d -r1.120 -r1.121
*** GUI.java 31 Aug 2010 13:48:06 -0000 1.120
--- GUI.java 6 Sep 2010 13:08:43 -0000 1.121
***************
*** 19,23 ****
import net.sourceforge.bprocessor.gui.actions.FileSaveActionListener;
import net.sourceforge.bprocessor.gui.actions.FileSaveAsActionListener;
- import net.sourceforge.bprocessor.gui.actions.ModellorMenuAction;
import net.sourceforge.bprocessor.gui.actions.ToolsEnergyActionListener;
import net.sourceforge.bprocessor.gui.attrview.AttributeView;
--- 19,22 ----
***************
*** 26,29 ****
--- 25,29 ----
import net.sourceforge.bprocessor.gui.treeview.LibraryTreeView;
import net.sourceforge.bprocessor.gui.treeview.SpaceTreeView;
+ import net.sourceforge.bprocessor.model.Command;
import net.sourceforge.bprocessor.model.Geometric;
import net.sourceforge.bprocessor.model.Project;
***************
*** 429,473 ****
create.add(action);
}
!
! for (Modellor current : Modellor.getRegisteredModellors()) {
! if (current.application() == Modellor.SHAPE) {
! AbstractAction action = new ModellorAction(current) {
! public void actionPerformed(ActionEvent e) {
! System.out.println("actionate " + modellor);
! Space space = modellor.createSpace();
! Project.getInstance().world().add(space);
! Project.getInstance().changed();
! }
! };
! create.add(action);
}
}
-
-
-
- JMenu modellorSubmenu = new JMenu("Modellors");
- modellorSubmenu.setMnemonic(KeyEvent.VK_M);
- modellorSubmenu.addMenuListener(new MenuListener() {
- public void menuCanceled(MenuEvent e) {
- }
-
- public void menuDeselected(MenuEvent e) {
- }
-
- public void menuSelected(MenuEvent e) {
- JMenu jm = (JMenu)e.getSource();
- jm.removeAll();
- Space s = Project.getInstance().getActiveSpace();
- int level = s.getLevel();
- for (Modellor m : Modellor.getRegisteredModellors()) {
- JMenuItem mod = new JMenuItem(m.title());
- if (level == m.getUseableLevel()) {
- mod.addActionListener(new ModellorMenuAction(s, m));
- jm.add(mod);
- }
- }
- }
- });
- create.add(modellorSubmenu);
}
});
--- 429,440 ----
create.add(action);
}
! {
! JMenu submenu = new JMenu("Parametric Objects");
! for (Class<? extends Command> current : Command.getCommands()) {
! AbstractAction action = new CommandAction(current);
! submenu.add(action);
}
+ create.add(submenu);
}
}
});
***************
*** 475,478 ****
--- 442,479 ----
return create;
}
+
+ class CommandAction extends AbstractAction {
+ private Class<? extends Command> clarse;
+
+ public CommandAction(Class<? extends Command> clarse) {
+ super(clarse.getSimpleName());
+ this.clarse = clarse;
+ }
+ public void actionPerformed(ActionEvent e) {
+ try {
+ Space union = Command.invoke(clarse);
+ Space active = Project.getInstance().getActiveSpace();
+ active.add(union);
+ Space net = (Space) union.find("Construction Geometry");
+ if (net != null) {
+ net.edit();
+ }
+ Command command = null;
+ for (Command current : union.getScripts()) {
+ command = current;
+ }
+ if (command != null) {
+ AttributeView.instance().display(command);
+ } else {
+ AttributeView.instance().display(union);
+ }
+ Project.getInstance().checkpoint();
+ Project.getInstance().changed();
+ } catch (Exception e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+ }
+ }
private JMenu createEditMenu() {
|