metasim 00/11/16 11:40:52
Modified: src/antidote/org/apache/tools/ant/gui About.java
EventResponder.java ProjectProxy.java
Log:
Added save and saveas action implementation.
Revision Changes Path
1.4 +11 -3
jakarta-ant/src/antidote/org/apache/tools/ant/gui/About.java
Index: About.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/About.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- About.java 2000/11/12 20:00:01 1.3
+++ About.java 2000/11/16 19:40:48 1.4
@@ -58,13 +58,14 @@
import java.io.IOException;
import java.util.*;
import java.awt.BorderLayout;
+import java.awt.Dimension;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
/**
* Dialog displaying information on the application.
*
- * @version $Revision: 1.3 $
+ * @version $Revision: 1.4 $
* @author Simeon Fitch
*/
public class About extends JDialog {
@@ -104,7 +105,7 @@
while(tok.hasMoreTokens()) {
String name = tok.nextToken();
buf.append(name);
- buf.append("<P>\n");
+ buf.append("<br>\n");
}
String message = context.getResources().getMessage(
@@ -115,7 +116,14 @@
getClass(), "title");
setTitle(title);
- JLabel contents = new JLabel(message);
+ JTextPane contents = new JTextPane();
+ contents.setContentType("text/html");
+ contents.setText(message);
+ contents.setEditable(false);
+ // XXX Still not sure why this is necessary. JTextPane doesn't
+ // seem to report a "true" preferred size.
+ contents.setPreferredSize(
+ new Dimension(contents.getPreferredSize().width, 450));
getContentPane().add(BorderLayout.CENTER, contents);
// Add the OK button.
1.6 +7 -1
jakarta-ant/src/antidote/org/apache/tools/ant/gui/EventResponder.java
Index: EventResponder.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/EventResponder.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- EventResponder.java 2000/11/16 18:32:23 1.5
+++ EventResponder.java 2000/11/16 19:40:48 1.6
@@ -63,7 +63,7 @@
* The purpose of this class is to watch for events that require some sort
* of action, like opening a file.
*
- * @version $Revision: 1.5 $
+ * @version $Revision: 1.6 $
* @author Simeon Fitch
*/
class EventResponder {
@@ -118,6 +118,12 @@
// lookup using an initialized hash table.
if(command.equals(OpenCmd.ACTION_NAME)) {
new OpenCmd(_context).execute();
+ }
+ else if(command.equals(SaveCmd.ACTION_NAME)) {
+ new SaveCmd(_context).execute();
+ }
+ else if(command.equals(SaveAsCmd.ACTION_NAME)) {
+ new SaveAsCmd(_context).execute();
}
else if(command.equals(BuildCmd.ACTION_NAME)) {
new BuildCmd(_context).execute();
1.7 +23 -2
jakarta-ant/src/antidote/org/apache/tools/ant/gui/ProjectProxy.java
Index: ProjectProxy.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/ProjectProxy.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ProjectProxy.java 2000/11/16 18:32:23 1.6
+++ ProjectProxy.java 2000/11/16 19:40:48 1.7
@@ -56,6 +56,7 @@
import org.apache.tools.ant.gui.event.*;
import org.apache.tools.ant.gui.acs.*;
import java.io.File;
+import java.io.Writer;
import java.io.IOException;
import javax.swing.tree.TreeModel;
import javax.swing.text.Document;
@@ -70,7 +71,7 @@
* (or other external datamodel) occurs. This class also provides various
* views into the data model, such as TreeModel, Documenet, etc.
*
- * @version $Revision: 1.6 $
+ * @version $Revision: 1.7 $
* @author Simeon Fitch
*/
public class ProjectProxy {
@@ -95,7 +96,6 @@
_file = file;
_context = context;
loadProject();
-
}
/**
@@ -109,6 +109,17 @@
}
/**
+ * Write the project in XML format to the given output.
+ *
+ * @param out Output to write to.
+ */
+ public void write(Writer out) throws IOException {
+ if(_project == null) return;
+
+ _project.write(out);
+ }
+
+ /**
* Build the project with the current target (or the default target
* if none is selected. Build occurs on a separate thread, so method
* returns immediately.
@@ -143,6 +154,16 @@
public File getFile() {
return _file;
}
+
+ /**
+ * Set the file that this is to be saved to.
+ *
+ * @param file File to save to.
+ */
+ public void setFile(File file) {
+ _file = file;
+ }
+
/**
* Get the TreeModel perspective on the data.