jruaux 2003/03/07 01:54:14
Modified: integration/eclipse/src/java/org/apache/cactus/eclipse/war
Webapp.java WarBuilder.java
integration/eclipse/src/java/org/apache/cactus/eclipse/war/ui
WebAppPropertyPage.java
WebAppConfigurationBlock.java
Log:
Completed missing Javadoc
Revision Changes Path
1.2 +8 -6
jakarta-cactus/integration/eclipse/src/java/org/apache/cactus/eclipse/war/Webapp.java
Index: Webapp.java
===================================================================
RCS file:
/home/cvs/jakarta-cactus/integration/eclipse/src/java/org/apache/cactus/eclipse/war/Webapp.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Webapp.java 6 Mar 2003 18:04:26 -0000 1.1
+++ Webapp.java 7 Mar 2003 09:54:14 -0000 1.2
@@ -71,7 +71,9 @@
import org.eclipse.jdt.internal.core.JavaProject;
/**
- * Helper class for creating War files.
+ * Represents a web application for a given project.
+ * It knows how to load its values from project properties and
+ * how to persist them.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Julien Ruaux</a>
* @version $Id$
@@ -294,7 +296,7 @@
}
/**
- * @return IClasspathEntry[]
+ * @return IClasspathEntry[] the array of jar entries for this webapp
*/
public IClasspathEntry[] getClasspath()
{
@@ -302,7 +304,7 @@
}
/**
- * @return String
+ * @return String directory of this webapp source files
*/
public String getDir()
{
@@ -310,7 +312,7 @@
}
/**
- * @return String
+ * @return String temporary directory for jar copy
*/
public String getTempDir()
{
@@ -318,7 +320,7 @@
}
/**
- * @return String
+ * @return String location of the generated war
*/
public String getOutput()
{
1.2 +25 -11
jakarta-cactus/integration/eclipse/src/java/org/apache/cactus/eclipse/war/WarBuilder.java
Index: WarBuilder.java
===================================================================
RCS file:
/home/cvs/jakarta-cactus/integration/eclipse/src/java/org/apache/cactus/eclipse/war/WarBuilder.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- WarBuilder.java 6 Mar 2003 18:04:26 -0000 1.1
+++ WarBuilder.java 7 Mar 2003 09:54:14 -0000 1.2
@@ -84,11 +84,11 @@
public class WarBuilder
{
/**
- * the directory where to find classes
+ * directory where to find classes
*/
private File userClassFilesDir;
/**
- * the web.xml file
+ * web.xml file
*/
private File userWebXML;
@@ -97,14 +97,20 @@
*/
private File userWebFilesDir;
/**
- * the location of the Ant build file for creating wars
+ * location of the Ant build file for creating wars
*/
private File buildFileLocation;
-
+ /**
+ * location of generated war file
+ */
private File war;
-
+ /**
+ * location of the temporary directory for jar copy
+ */
private File tempDir;
-
+ /**
+ * jar entries to include in the war
+ */
private IClasspathEntry[] jarEntries;
/**
* Cactus plug-in relative path to the war build file
@@ -114,13 +120,21 @@
* Cactus plug-in relative path to the web.xml file
*/
private static final String WEB_XML_PATH = "./ant/confs/web.xml";
-
+ /**
+ * name of the WEB-INF directory
+ */
public static final String WEBINF = "WEB-INF";
-
+ /**
+ * name of the lib directory
+ */
public static final String LIB = "lib";
-
+ /**
+ * name of the web.xml file
+ */
public static final String WEBXML = "web.xml";
-
+ /**
+ * name of the temporary directory for jar copy
+ */
private static final String JARS_PATH =
"org.apache.cactus.eclipse.war.jars.temp";
1.2 +2 -2
jakarta-cactus/integration/eclipse/src/java/org/apache/cactus/eclipse/war/ui/WebAppPropertyPage.java
Index: WebAppPropertyPage.java
===================================================================
RCS file:
/home/cvs/jakarta-cactus/integration/eclipse/src/java/org/apache/cactus/eclipse/war/ui/WebAppPropertyPage.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- WebAppPropertyPage.java 6 Mar 2003 18:04:26 -0000 1.1
+++ WebAppPropertyPage.java 7 Mar 2003 09:54:14 -0000 1.2
@@ -76,7 +76,7 @@
public class WebAppPropertyPage extends PropertyPage
{
/**
- * Block showing the jar path list.
+ * The only UI block for this property page.
*/
private WebAppConfigurationBlock webAppConfigurationBlock;
1.2 +134 -35
jakarta-cactus/integration/eclipse/src/java/org/apache/cactus/eclipse/war/ui/WebAppConfigurationBlock.java
Index: WebAppConfigurationBlock.java
===================================================================
RCS file:
/home/cvs/jakarta-cactus/integration/eclipse/src/java/org/apache/cactus/eclipse/war/ui/WebAppConfigurationBlock.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- WebAppConfigurationBlock.java 6 Mar 2003 18:04:26 -0000 1.1
+++ WebAppConfigurationBlock.java 7 Mar 2003 09:54:14 -0000 1.2
@@ -85,22 +85,52 @@
import org.eclipse.swt.widgets.Shell;
/**
- * Helper class for creating War files.
+ * UI block which shows a list of jar entries.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Julien Ruaux</a>
* @version $Id$
*/
public class WebAppConfigurationBlock
{
+ /**
+ * Field for the output war location.
+ */
private StringButtonDialogField outputField;
+ /**
+ * Field for the webapp location.
+ */
private StringDialogField webappDirField;
+ /**
+ * Field for the temporary folder location.
+ */
private StringButtonDialogField tempDirField;
+ /**
+ * UI block that shows a list of jar entries.
+ */
private LibrariesWorkbookPage libraryPage;
-
+ /**
+ * List of entries displayed by the libraryPage.
+ */
private CheckedListDialogField classPathList;
+ /**
+ * Java project needed for the libraryPage initialization.
+ */
private IJavaProject javaProject;
+ /**
+ * The shell used by dialog popups (directory and file choosers).
+ */
private Shell shell;
+ /**
+ * Constructor.
+ * @param theShell The shell used by dialog popups
+ * (directory and file choosers)
+ * @param theJavaProject Java project needed for libraryPage initialization
+ * @param theOutput initial output field value
+ * @param theDir initial webapp directory value
+ * @param theTempDir initial temporary location value
+ * @param theEntries initial list of entries
+ */
public WebAppConfigurationBlock(
Shell theShell,
IJavaProject theJavaProject,
@@ -135,30 +165,50 @@
update(theOutput, theDir, theTempDir, theEntries);
}
+ /**
+ * Adapter that displatches control events.
+ */
private class BuildPathAdapter
implements IStringButtonAdapter, IDialogFieldListener
{
- // -------- IStringButtonAdapter --------
- public void changeControlPressed(DialogField field)
- {
- buildPathChangeControlPressed(field);
- }
-
- // ---------- IDialogFieldListener --------
- public void dialogFieldChanged(DialogField field)
- {
- buildPathDialogFieldChanged(field);
- }
- }
-
- private void buildPathDialogFieldChanged(DialogField field)
- {
- }
-
- private void buildPathChangeControlPressed(DialogField field)
+ /**
+ * @see org.eclipse.jdt.internal.ui.wizards.dialogfields.
+ * IStringButtonAdapter#changeControlPressed(
+ * org.eclipse.jdt.internal.ui.wizards.dialogfields.DialogField)
+ */
+ public void changeControlPressed(DialogField theField)
+ {
+ webappChangeControlPressed(theField);
+ }
+
+ /**
+ * @see org.eclipse.jdt.internal.ui.wizards.dialogfields.
+ * IDialogFieldListener#dialogFieldChanged(
+ * org.eclipse.jdt.internal.ui.wizards.dialogfields.DialogField)
+ */
+ public void dialogFieldChanged(DialogField theField)
+ {
+ webappDialogFieldChanged(theField);
+ }
+ }
+ /**
+ * Adapter that dispatches events from Dialog fields.
+ * Possible use : validation of an entry in a dialog field.
+ * @param theField field that triggered an event.
+ */
+ private void webappDialogFieldChanged(DialogField theField)
+ {
+ // TODO: validate entries in dialogs
+ // Do nothing.
+ }
+ /**
+ * Adapter that dispatches events from StringButtonDialog fields.
+ * @param theField field that triggered an event.
+ */
+ private void webappChangeControlPressed(DialogField theField)
{
- if (field == tempDirField)
+ if (theField == tempDirField)
{
File tempDir = chooseTempDir();
if (tempDir != null)
@@ -168,7 +218,7 @@
}
else
{
- if (field == outputField)
+ if (theField == outputField)
{
File output = chooseOutput();
if (output != null)
@@ -178,12 +228,17 @@
}
}
}
-
+
+ /**
+ * Displays a file chooser dialog and returns the chosen file.
+ * @return File the chosen file
+ */
private File chooseOutput()
{
File output = new File(outputField.getText());
- if (!output.exists()) {
- output = output.getParentFile();
+ if (!output.exists())
+ {
+ output = output.getParentFile();
}
String initPath = "";
if (output != null)
@@ -192,7 +247,7 @@
}
FileDialog dialog = new FileDialog(shell);
dialog.setText(PreferencesMessages.getString("War file selection"));
- dialog.setFilterExtensions(new String[] {"*.war"});
+ dialog.setFilterExtensions(new String[] { "*.war" });
dialog.setFilterPath(initPath);
String res = dialog.open();
if (res != null)
@@ -202,6 +257,10 @@
return null;
}
+ /**
+ * Displays a directory chooser dialog and returns the chosen directory.
+ * @return File the chosen directory
+ */
private File chooseTempDir()
{
File tempDir = new File(tempDirField.getText());
@@ -223,6 +282,11 @@
return null;
}
+ /**
+ * Returns the UI control for this block.
+ * @param theParent the parent control.
+ * @return Control the created control
+ */
public Control createContents(Composite theParent)
{
final Composite topComp = new Composite(theParent, SWT.NONE);
@@ -247,35 +311,55 @@
return topComp;
}
+ /**
+ * Validates entries in dialog fields.
+ */
private void doValidation()
{
String text = outputField.getText();
if (text.length() > 0)
{
- // File file = new File(text);
- // if (!file.isFile())
- // {
- //
status.setError(PreferencesMessages.getString("JavadocPreferencePage.error.notexists"));
- // }
+ // File file = new File(text);
+ // if (!file.isFile())
+ // {
+ // status.setError(PreferencesMessages.getString(
+ // "JavadocPreferencePage.error.notexists"));
+ // }
}
}
+ /**
+ * Returns the text entered in the output field.
+ * @return String the text entered
+ */
public String getOutput()
{
return outputField.getText();
}
+ /**
+ * Returns the text entered in the webapp field.
+ * @return String the text entered
+ */
public String getWebappDir()
{
return webappDirField.getText();
}
+ /**
+ * Returns the text entered in the tempDir field.
+ * @return String the text entered
+ */
public String getTempDir()
{
return tempDirField.getText();
}
+ /**
+ * Returns the array of jar entries selected in the libraryPage.
+ * @return IClasspathEntry[] the array of jar entries selected
+ */
public IClasspathEntry[] getWebappClasspath()
{
Vector result = new Vector();
@@ -292,12 +376,17 @@
new IClasspathEntry[result.size()]);
}
- private ArrayList getExistingEntries(IClasspathEntry[] classpathEntries)
+ /**
+ * Returns a list of jar entries contained in an array of entries.
+ * @param theClasspathEntries array of classpath entries
+ * @return ArrayList list containing the jar entries
+ */
+ private ArrayList getExistingEntries(IClasspathEntry[] theClasspathEntries)
{
ArrayList newClassPath = new ArrayList();
- for (int i = 0; i < classpathEntries.length; i++)
+ for (int i = 0; i < theClasspathEntries.length; i++)
{
- IClasspathEntry curr = classpathEntries[i];
+ IClasspathEntry curr = theClasspathEntries[i];
if (curr.getEntryKind() == IClasspathEntry.CPE_LIBRARY)
{
try
@@ -317,6 +406,13 @@
}
+ /**
+ * Refreshes the control with the given values.
+ * @param theOutput webapp output war location
+ * @param theDir webapp directory
+ * @param theTempDir temporary directory
+ * @param theEntries jar entries for the webapp
+ */
public void update(
String theOutput,
String theDir,
@@ -329,6 +425,9 @@
classPathList.setElements(getExistingEntries(theEntries));
}
+ /**
+ * Refreshes the control.
+ */
public void refresh()
{
libraryPage.init(javaProject);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]