Update of /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27296/src/net/sourceforge/bprocessor/gl/tool
Modified Files:
Tool.java ToolFactory.java
Added Files:
DebugTool.java
Log Message:
Eclipse project
A DebugTool for testing purposes is added to the tool bar.
Currently it verifies that we dont have object identity - the
database is queried whenever the model are accessed.
This creates multible copies of all objects.
The dist rule in build.xml are modifed to copy the gl.jar to the
dist directory in build/dist/plugin.
--- NEW FILE: DebugTool.java ---
//---------------------------------------------------------------------------------
// $Id: DebugTool.java,v 1.1 2005/08/10 12:42:46 henryml Exp $
//
// Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net)
// Released under the Lesser GNU Public License v2.1
//---------------------------------------------------------------------------------
package net.sourceforge.bprocessor.gl.tool;
import java.awt.event.MouseEvent;
import java.util.Iterator;
import java.util.Set;
import net.sourceforge.bprocessor.gl.GLView;
import net.sourceforge.bprocessor.model.Edge;
/**
* The DebugTool
*/
public class DebugTool extends SelectTool {
/**
* Constructor
* @param glv The GLView
*/
public DebugTool(GLView glv) {
super(glv);
}
/**
* Invoked when a mouse button has been pressed on a component.
* @param e The MouseEvent object
*/
protected void pressed(MouseEvent e) {
super.pressed(e);
if (SelectTool.selectedVertex != null) {
Set a = SelectTool.selectedVertex.getEdges();
Set b = SelectTool.selectedVertex.getEdges();
Iterator iter = a.iterator();
Iterator other = b.iterator();
while (iter.hasNext()) {
Edge e1 = (Edge) iter.next();
Edge e2 = (Edge) other.next();
System.out.println(e1);
System.out.println(e2);
if (e1 == e2) {
System.out.println("Equal!");
} else {
System.out.println("Not Equal!");
}
}
}
}
}
Index: ToolFactory.java
===================================================================
RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/ToolFactory.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ToolFactory.java 5 Aug 2005 10:52:31 -0000 1.2
--- ToolFactory.java 10 Aug 2005 12:42:46 -0000 1.3
***************
*** 41,44 ****
--- 41,48 ----
/** extrusion tool */
private ExtrusionTool extrusion;
+
+ /** debug tool */
+
+ private DebugTool debug;
/**
***************
*** 51,54 ****
--- 55,59 ----
move = new MoveTool(glv);
extrusion = new ExtrusionTool(glv);
+ debug = new DebugTool(glv);
Toolbar tb = Toolbar.getInstance();
***************
*** 61,65 ****
but = tb.registerAction(new ExtrudeAction(glv));
but.setToolTipText("Extrude");
!
Notifier.getInstance().addListener(select);
}
--- 66,71 ----
but = tb.registerAction(new ExtrudeAction(glv));
but.setToolTipText("Extrude");
! but = tb.registerAction(new DebugAction(glv));
! but.setToolTipText("Debug");
Notifier.getInstance().addListener(select);
}
***************
*** 99,102 ****
--- 105,110 ----
} else if (i == Tool.EXTRUSION_TOOL) {
return extrusion;
+ } else if (i == Tool.DEBUG_TOOL) {
+ return debug;
} else {
log.error("[get] No such tool " + i);
***************
*** 217,218 ****
--- 225,253 ----
}
}
+ /**
+ * The debug action inner class
+ */
+ class DebugAction extends AbstractAction {
+ /** The GLView */
+ private GLView glv = null;
+
+ /**
+ * Constructor
+ * @param glv TheGLView
+ */
+ DebugAction(GLView glv) {
+ this.glv = glv;
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ URL url = cl.getResource("selecticon.png");
+ ImageIcon im = new ImageIcon(url);
+ putValue(Action.SMALL_ICON, im);
+ }
+
+ /**
+ * Called when the button is pressed
+ * @param e The ActionEvent
+ */
+ public void actionPerformed(ActionEvent e) {
+ glv.changeTool(Tool.DEBUG_TOOL);
+ }
+ }
Index: Tool.java
===================================================================
RCS file: /cvsroot/bprocessor/gl/src/net/sourceforge/bprocessor/gl/tool/Tool.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Tool.java 5 Aug 2005 10:53:55 -0000 1.2
--- Tool.java 10 Aug 2005 12:42:46 -0000 1.3
***************
*** 22,25 ****
--- 22,27 ----
/** The extrude tool */
public static final int EXTRUSION_TOOL = 3;
+ /** The debug tool */
+ public static final int DEBUG_TOOL = 4;
|