Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv9455/src/net/sourceforge/bprocessor/gui/treeview
Modified Files:
GenericTreeView.java
Log Message:
added delete and add of globals to the database view
Index: GenericTreeView.java
===================================================================
RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/GenericTreeView.java,v
retrieving revision 1.40
retrieving revision 1.41
diff -C2 -d -r1.40 -r1.41
*** GenericTreeView.java 11 Sep 2006 09:21:03 -0000 1.40
--- GenericTreeView.java 11 Sep 2006 14:03:45 -0000 1.41
***************
*** 384,395 ****
if (object instanceof Entity) {
AbstractAction delete = new EntityAction((Entity)object, "Delete") {
! public void actionPerformed(ActionEvent arg0) {
! if (entity != null) {
! entity.delete();
! Project.getInstance().checkpoint();
! }
}
! };
pm.add(delete);
}
return pm;
--- 384,407 ----
if (object instanceof Entity) {
AbstractAction delete = new EntityAction((Entity)object, "Delete") {
! public void actionPerformed(ActionEvent arg0) {
! if (entity != null) {
! entity.delete();
! Project.getInstance().checkpoint();
}
! }
! };
pm.add(delete);
+ } else if (object instanceof Attribute) {
+ AbstractAction delete = new AttributeAction((Attribute)object, "Delete") {
+ public void actionPerformed(ActionEvent arg0) {
+ Project p = Project.getInstance();
+ p.getGlobals().remove(attribute);
+ p.changed(p);
+ p.checkpoint();
+ }
+ };
+ pm.add(delete);
+ } else {
+ return null;
}
return pm;
***************
*** 416,419 ****
--- 428,449 ----
/**
+ * Actions for a attribute
+ */
+ public abstract class AttributeAction extends AbstractAction {
+ /** The entity */
+ protected Attribute attribute;
+
+ /**
+ * The constructor
+ * @param a the attribute
+ * @param name the name of the action
+ */
+ public AttributeAction(Attribute a, String name) {
+ super(name);
+ this.attribute = a;
+ }
+ }
+
+ /**
* Actions for a entity
*/
***************
*** 833,843 ****
return spacegroupicon;
}
-
- /**
- * @return Menu
- */
- public JPopupMenu menu() {
- return null;
- }
}
--- 863,866 ----
***************
*** 1007,1010 ****
--- 1030,1051 ----
return name;
}
+
+ /**
+ * Context menu for ParameterBlockNode
+ * @return the menu
+ */
+ public JPopupMenu menu() {
+ JPopupMenu pm = new JPopupMenu();
+ AbstractAction add = new EntityAction(null, "Add global") {
+ public void actionPerformed(ActionEvent arg0) {
+ ParameterBlock pb = Project.getInstance().getGlobals();
+ pb.put("new global", 0);
+ Project.getInstance().changed(pb);
+ Project.getInstance().checkpoint();
+ }
+ };
+ pm.add(add);
+ return pm;
+ }
}
|