vmassol 2003/06/11 09:05:45
Modified:
integration/eclipse/org.apache.cactus.eclipse.webapp/src/java/org/apache/cactus/eclipse/webapp/internal
Webapp.java WarBuilder.java
integration/eclipse/org.apache.cactus.eclipse.webapp/src/java/org/apache/cactus/eclipse/webapp/internal/ui
WebAppConfigurationBlock.java
WebAppPropertyPage.java WebappMessages.java
WebappPlugin.java
Log:
Applied checkstyle checks
Revision Changes Path
1.2 +16 -16
jakarta-cactus/integration/eclipse/org.apache.cactus.eclipse.webapp/src/java/org/apache/cactus/eclipse/webapp/internal/Webapp.java
Index: Webapp.java
===================================================================
RCS file:
/home/cvs/jakarta-cactus/integration/eclipse/org.apache.cactus.eclipse.webapp/src/java/org/apache/cactus/eclipse/webapp/internal/Webapp.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Webapp.java 11 Jun 2003 14:48:26 -0000 1.1
+++ Webapp.java 11 Jun 2003 16:05:43 -0000 1.2
@@ -144,7 +144,7 @@
/**
* @param theJavaProject the project this webapp is linked to
*/
- public Webapp(IJavaProject theJavaProject)
+ public Webapp(final IJavaProject theJavaProject)
{
this.javaProject = theJavaProject;
}
@@ -154,7 +154,7 @@
* if they exist.
* @return boolean true if we loaded the default values
*/
- public boolean init()
+ public final boolean init()
{
return loadValues();
}
@@ -167,7 +167,7 @@
* @return true if the default values were loaded or false if the
* persistent ones were loaded
*/
- public boolean loadValues()
+ public final boolean loadValues()
{
boolean isDefaultValues;
@@ -197,7 +197,7 @@
* Loads the persistent properties for this webapp.
* @throws CoreException if we fail to load a persistent property
*/
- public void loadPersistentValues() throws CoreException
+ public final void loadPersistentValues() throws CoreException
{
IProject theProject = javaProject.getProject();
@@ -210,7 +210,7 @@
/**
* Loads the default values of a webapp.
*/
- public void loadDefaultValues()
+ public final void loadDefaultValues()
{
this.output = DEFAULT_OUTPUT;
this.dir = DEFAULT_DIR;
@@ -229,7 +229,7 @@
* Saves this webapp in the project's properties
* @throws CoreException if an error occurs while saving
*/
- public void persist() throws CoreException
+ public final void persist() throws CoreException
{
IProject project = javaProject.getProject();
project.setPersistentProperty(OUTPUT_QN, output);
@@ -244,7 +244,7 @@
* @return an array of library entries
*/
private IClasspathEntry[] toClasspathEntryArray(
- String theClasspathEntriesString)
+ final String theClasspathEntriesString)
{
if (theClasspathEntriesString == null)
{
@@ -281,7 +281,7 @@
* @param theClasspathEntries an array of library entries
* @return String string of delimiter-separated classpaths
*/
- private String toString(IClasspathEntry[] theClasspathEntries)
+ private String toString(final IClasspathEntry[] theClasspathEntries)
{
StringBuffer result = new StringBuffer();
for (int i = 0; i < theClasspathEntries.length; i++)
@@ -297,7 +297,7 @@
* Sets the classpath.
* @param theClasspath The classpath to set
*/
- public void setClasspath(IClasspathEntry[] theClasspath)
+ public final void setClasspath(final IClasspathEntry[] theClasspath)
{
this.classpath = theClasspath;
}
@@ -306,7 +306,7 @@
* Sets the dir.
* @param theDir The dir to set
*/
- public void setDir(String theDir)
+ public final void setDir(final String theDir)
{
this.dir = theDir;
}
@@ -315,7 +315,7 @@
* Sets the output.
* @param theOutput The output to set
*/
- public void setOutput(String theOutput)
+ public final void setOutput(final String theOutput)
{
this.output = theOutput;
}
@@ -323,7 +323,7 @@
/**
* @return IClasspathEntry[] the array of jar entries for this webapp
*/
- public IClasspathEntry[] getClasspath()
+ public final IClasspathEntry[] getClasspath()
{
return this.classpath;
}
@@ -332,7 +332,7 @@
* @return String directory of this webapp source files
* relative to the project path
*/
- public String getDir()
+ public final String getDir()
{
return this.dir;
}
@@ -340,7 +340,7 @@
/**
* @return the absolute directory to this webapp source files
*/
- public File getAbsoluteDir()
+ public final File getAbsoluteDir()
{
File result = null;
@@ -355,7 +355,7 @@
/**
* @return String location of the generated war
*/
- public String getOutput()
+ public final String getOutput()
{
return this.output;
}
1.2 +24 -46
jakarta-cactus/integration/eclipse/org.apache.cactus.eclipse.webapp/src/java/org/apache/cactus/eclipse/webapp/internal/WarBuilder.java
Index: WarBuilder.java
===================================================================
RCS file:
/home/cvs/jakarta-cactus/integration/eclipse/org.apache.cactus.eclipse.webapp/src/java/org/apache/cactus/eclipse/webapp/internal/WarBuilder.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- WarBuilder.java 11 Jun 2003 14:48:28 -0000 1.1
+++ WarBuilder.java 11 Jun 2003 16:05:43 -0000 1.2
@@ -63,7 +63,6 @@
import org.apache.cactus.eclipse.webapp.internal.ui.WebappMessages;
import org.apache.cactus.eclipse.webapp.internal.ui.WebappPlugin;
import org.apache.tools.ant.Project;
-import org.apache.tools.ant.taskdefs.Copy;
import org.apache.tools.ant.taskdefs.War;
import org.apache.tools.ant.taskdefs.Zip;
import org.apache.tools.ant.types.FileSet;
@@ -122,7 +121,8 @@
* created
* @throws JavaModelException if we can't get the output location
*/
- public WarBuilder(IJavaProject theJavaProject) throws JavaModelException
+ public WarBuilder(final IJavaProject theJavaProject)
+ throws JavaModelException
{
this.javaProject = theJavaProject;
this.webapp = new Webapp(theJavaProject);
@@ -133,7 +133,7 @@
* @return the web.xml file in the given webapp directory,
* or null if none
*/
- public File getWebXML(File theWebFilesDir)
+ public static File getWebXML(final File theWebFilesDir)
{
if (theWebFilesDir == null)
{
@@ -155,7 +155,8 @@
* @param theEntries array of IClasspathEntry to render asbolute
* @return an array of absolute IClasspathEntries
*/
- private IClasspathEntry[] getAbsoluteEntries(IClasspathEntry[] theEntries)
+ private static IClasspathEntry[] getAbsoluteEntries(
+ final IClasspathEntry[] theEntries)
{
if (theEntries == null)
{
@@ -203,8 +204,8 @@
* @throws JavaModelException if we fail to get the project relative
* output location
*/
- private File getAbsoluteOutputLocation(IJavaProject theJavaProject)
- throws JavaModelException
+ private static final File getAbsoluteOutputLocation(
+ final IJavaProject theJavaProject) throws JavaModelException
{
IPath projectPath = theJavaProject.getProject().getLocation();
IPath outputLocation = theJavaProject.getOutputLocation();
@@ -220,10 +221,15 @@
* @return File the location where the war file was created
* @throws CoreException if we can't create the file
*/
- public File createWar(IProgressMonitor thePM) throws CoreException
+ public final File createWar(final IProgressMonitor thePM)
+ throws CoreException
{
- IProgressMonitor progressMonitor =
- (thePM != null) ? thePM : new NullProgressMonitor();
+ IProgressMonitor progressMonitor = thePM;
+ if (progressMonitor == null)
+ {
+ progressMonitor = new NullProgressMonitor();
+ }
+
progressMonitor.subTask(
WebappMessages.getString("WarBuilder.message.createwar.monitor"));
this.webapp.loadValues();
@@ -299,7 +305,8 @@
* @param theJarEntries the jars to build ZipFileSets from
* @return an array of ZipFileSet corresponding to the given jars
*/
- private ZipFileSet[] getZipFileSets(IClasspathEntry[] theJarEntries)
+ private static final ZipFileSet[] getZipFileSets(
+ final IClasspathEntry[] theJarEntries)
{
Vector result = new Vector();
for (int i = 0; i < theJarEntries.length; i++)
@@ -323,7 +330,7 @@
private File getUserWebFilesDir()
{
// path to the web directory relative to the user's project
- String userWebFilesPath = webapp.getDir();
+ String userWebFilesPath = this.webapp.getDir();
if (userWebFilesPath == null || userWebFilesPath.equals(""))
{
return null;
@@ -342,7 +349,7 @@
*/
private IClasspathEntry[] getJarEntries()
{
- return getAbsoluteEntries(webapp.getClasspath());
+ return getAbsoluteEntries(this.webapp.getClasspath());
}
/**
@@ -350,44 +357,14 @@
*/
private File getOutputWar()
{
- return new File(webapp.getOutput());
- }
-
- /**
- * Copies a set of Jar files to the destination directory.
- * @param theEntries set of Jars
- * @param theDestination the destination directory
- */
- private void copyJars(IClasspathEntry[] theEntries, File theDestination)
- {
- if (!theDestination.isDirectory())
- {
- return;
- }
- Project antProject = new Project();
- antProject.init();
- Copy jarCopy = new Copy();
- jarCopy.setProject(antProject);
- jarCopy.setTodir(theDestination);
- for (int i = 0; i < theEntries.length; i++)
- {
- IClasspathEntry currentEntry = theEntries[i];
- if (currentEntry.getEntryKind() == IClasspathEntry.CPE_LIBRARY)
- {
- File currentJar = currentEntry.getPath().toFile();
- FileSet fileSet = new FileSet();
- fileSet.setFile(currentJar);
- jarCopy.addFileset(fileSet);
- }
- }
- jarCopy.execute();
+ return new File(this.webapp.getOutput());
}
/**
* Removes the specified file or directory, and all subdirectories
* @param theFile the file or directory to delete
*/
- public static void delete(File theFile)
+ public static final void delete(final File theFile)
{
if (theFile.isDirectory())
{
@@ -410,7 +387,8 @@
* @param theZipFile the zip file to create
* @param theExistingFile the file to include in the zip
*/
- private void createZipFile(File theZipFile, File theExistingFile)
+ private void createZipFile(final File theZipFile,
+ final File theExistingFile)
{
Project antProject = new Project();
antProject.init();
1.2 +23 -22
jakarta-cactus/integration/eclipse/org.apache.cactus.eclipse.webapp/src/java/org/apache/cactus/eclipse/webapp/internal/ui/WebAppConfigurationBlock.java
Index: WebAppConfigurationBlock.java
===================================================================
RCS file:
/home/cvs/jakarta-cactus/integration/eclipse/org.apache.cactus.eclipse.webapp/src/java/org/apache/cactus/eclipse/webapp/internal/ui/WebAppConfigurationBlock.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- WebAppConfigurationBlock.java 11 Jun 2003 14:48:29 -0000 1.1
+++ WebAppConfigurationBlock.java 11 Jun 2003 16:05:44 -0000 1.2
@@ -94,6 +94,11 @@
public class WebAppConfigurationBlock
{
/**
+ * Number of chars visible in the output war location field
+ */
+ private static final int NB_VISIBLE_CHARS = 25;
+
+ /**
* Field for the output war location.
*/
private StringButtonDialogField outputField;
@@ -132,12 +137,9 @@
* @param theDir initial webapp directory value
* @param theEntries initial list of entries
*/
- public WebAppConfigurationBlock(
- Shell theShell,
- IJavaProject theJavaProject,
- String theOutput,
- String theDir,
- IClasspathEntry[] theEntries)
+ public WebAppConfigurationBlock(final Shell theShell,
+ final IJavaProject theJavaProject, final String theOutput,
+ final String theDir, final IClasspathEntry[] theEntries)
{
shell = theShell;
javaProject = theJavaProject;
@@ -177,7 +179,7 @@
* IStringButtonAdapter#changeControlPressed(
* org.eclipse.jdt.internal.ui.wizards.dialogfields.DialogField)
*/
- public void changeControlPressed(DialogField theField)
+ public final void changeControlPressed(final DialogField theField)
{
webappChangeControlPressed(theField);
}
@@ -187,7 +189,7 @@
* IDialogFieldListener#dialogFieldChanged(
* org.eclipse.jdt.internal.ui.wizards.dialogfields.DialogField)
*/
- public void dialogFieldChanged(DialogField theField)
+ public final void dialogFieldChanged(final DialogField theField)
{
webappDialogFieldChanged(theField);
}
@@ -198,7 +200,7 @@
* Possible use : validation of an entry in a dialog field.
* @param theField field that triggered an event.
*/
- private void webappDialogFieldChanged(DialogField theField)
+ private final void webappDialogFieldChanged(final DialogField theField)
{
// TODO: validate entries in dialogs
// Do nothing.
@@ -208,7 +210,7 @@
* Adapter that dispatches events from StringButtonDialog fields.
* @param theField field that triggered an event.
*/
- private void webappChangeControlPressed(DialogField theField)
+ private final void webappChangeControlPressed(final DialogField theField)
{
if (theField == outputField)
{
@@ -268,7 +270,7 @@
* @param theParent the parent control.
* @return Control the created control
*/
- public Control createContents(Composite theParent)
+ public final Control createContents(final Composite theParent)
{
Composite topComp = new Composite(theParent, SWT.NONE);
@@ -284,7 +286,7 @@
PixelConverter converter = new PixelConverter(topComp);
LayoutUtil.setWidthHint(
outputField.getTextControl(null),
- converter.convertWidthInCharsToPixels(25));
+ converter.convertWidthInCharsToPixels(NB_VISIBLE_CHARS));
LayoutUtil.setHorizontalGrabbing(outputField.getTextControl(null));
Control libraryPageControl = libraryPage.getControl(topComp);
@@ -299,7 +301,7 @@
* Returns the text entered in the output field.
* @return String the text entered
*/
- public String getOutput()
+ public final String getOutput()
{
return outputField.getText();
}
@@ -308,7 +310,7 @@
* Returns the text entered in the webapp field.
* @return String the text entered
*/
- public String getWebappDir()
+ public final String getWebappDir()
{
return webappDirField.getText();
}
@@ -317,7 +319,7 @@
* Returns the array of jar entries selected in the libraryPage.
* @return IClasspathEntry[] the array of jar entries selected
*/
- public IClasspathEntry[] getWebappClasspath()
+ public final IClasspathEntry[] getWebappClasspath()
{
Vector result = new Vector();
List cplist = classPathList.getElements();
@@ -338,7 +340,8 @@
* @param theClasspathEntries array of classpath entries
* @return ArrayList list containing the jar entries
*/
- private ArrayList getExistingEntries(IClasspathEntry[] theClasspathEntries)
+ private ArrayList getExistingEntries(
+ final IClasspathEntry[] theClasspathEntries)
{
ArrayList newClassPath = new ArrayList();
for (int i = 0; i < theClasspathEntries.length; i++)
@@ -369,10 +372,8 @@
* @param theDir webapp directory
* @param theEntries jar entries for the webapp
*/
- public void update(
- String theOutput,
- String theDir,
- IClasspathEntry[] theEntries)
+ public final void update(final String theOutput,
+ final String theDir, final IClasspathEntry[] theEntries)
{
outputField.setText(theOutput);
webappDirField.setText(theDir);
@@ -382,7 +383,7 @@
/**
* Refreshes the control.
*/
- public void refresh()
+ public final void refresh()
{
libraryPage.init(javaProject);
}
1.2 +12 -9
jakarta-cactus/integration/eclipse/org.apache.cactus.eclipse.webapp/src/java/org/apache/cactus/eclipse/webapp/internal/ui/WebAppPropertyPage.java
Index: WebAppPropertyPage.java
===================================================================
RCS file:
/home/cvs/jakarta-cactus/integration/eclipse/org.apache.cactus.eclipse.webapp/src/java/org/apache/cactus/eclipse/webapp/internal/ui/WebAppPropertyPage.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- WebAppPropertyPage.java 11 Jun 2003 14:48:30 -0000 1.1
+++ WebAppPropertyPage.java 11 Jun 2003 16:05:44 -0000 1.2
@@ -89,15 +89,18 @@
* @see org.eclipse.jface.preference.PreferencePage#createContents(
* org.eclipse.swt.widgets.Composite)
*/
- protected Control createContents(Composite theParent)
+ protected final Control createContents(final Composite theParent)
{
IJavaProject javaProject = JavaCore.create(getProject());
webapp = new Webapp(javaProject);
- boolean loadedDefaults = webapp.init();
- if (loadedDefaults)
- {
- // Status line indicating we loaded the defaults
- }
+ webapp.init();
+
+ // TODO: Status line indicating we loaded the defaults
+// boolean loadedDefaults = webapp.init();
+// if (loadedDefaults)
+// {
+// }
+
webAppConfigurationBlock =
new WebAppConfigurationBlock(
getShell(),
@@ -111,7 +114,7 @@
/**
* @see org.eclipse.jface.preference.PreferencePage#performOk()
*/
- public boolean performOk()
+ public final boolean performOk()
{
webapp.setOutput(webAppConfigurationBlock.getOutput());
webapp.setDir(webAppConfigurationBlock.getWebappDir());
@@ -131,7 +134,7 @@
/**
* @see org.eclipse.jface.preference.PreferencePage#performDefaults()
*/
- public void performDefaults()
+ public final void performDefaults()
{
super.performDefaults();
webapp.loadDefaultValues();
1.2 +6 -4
jakarta-cactus/integration/eclipse/org.apache.cactus.eclipse.webapp/src/java/org/apache/cactus/eclipse/webapp/internal/ui/WebappMessages.java
Index: WebappMessages.java
===================================================================
RCS file:
/home/cvs/jakarta-cactus/integration/eclipse/org.apache.cactus.eclipse.webapp/src/java/org/apache/cactus/eclipse/webapp/internal/ui/WebappMessages.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- WebappMessages.java 11 Jun 2003 14:48:30 -0000 1.1
+++ WebappMessages.java 11 Jun 2003 16:05:45 -0000 1.2
@@ -96,7 +96,8 @@
* @param theArg the object to use when constructing the message
* @return the formatted string
*/
- public static String getFormattedString(String theKey, Object theArg)
+ public static String getFormattedString(final String theKey,
+ final Object theArg)
{
return MessageFormat.format(getString(theKey),
new Object[] {theArg});
@@ -109,7 +110,8 @@
* @param theArgs the objects to use when constructing the message
* @return the formatted string
*/
- public static String getFormattedString(String theKey, Object[] theArgs)
+ public static String getFormattedString(final String theKey,
+ final Object[] theArgs)
{
return MessageFormat.format(getString(theKey), theArgs);
}
@@ -121,7 +123,7 @@
* @return the string from the resource bundle or "![key name]!" if the key
* does not exist in the resource bundle
*/
- public static String getString(String theKey)
+ public static String getString(final String theKey)
{
try
{
1.2 +5 -5
jakarta-cactus/integration/eclipse/org.apache.cactus.eclipse.webapp/src/java/org/apache/cactus/eclipse/webapp/internal/ui/WebappPlugin.java
Index: WebappPlugin.java
===================================================================
RCS file:
/home/cvs/jakarta-cactus/integration/eclipse/org.apache.cactus.eclipse.webapp/src/java/org/apache/cactus/eclipse/webapp/internal/ui/WebappPlugin.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- WebappPlugin.java 11 Jun 2003 14:48:30 -0000 1.1
+++ WebappPlugin.java 11 Jun 2003 16:05:45 -0000 1.2
@@ -87,7 +87,7 @@
* The constructor.
* @param theDescriptor the descriptor for this plugin
*/
- public WebappPlugin(IPluginDescriptor theDescriptor)
+ public WebappPlugin(final IPluginDescriptor theDescriptor)
{
super(theDescriptor);
plugin = this;
@@ -126,7 +126,7 @@
* @param theKey the key of the resource to return
* @return the string
*/
- public static String getResourceString(String theKey)
+ public static String getResourceString(final String theKey)
{
ResourceBundle bundle = WebappPlugin.getDefault().getResourceBundle();
try
@@ -143,7 +143,7 @@
* Returns the plugin's resource bundle
* @return the resource bundle
*/
- public ResourceBundle getResourceBundle()
+ public final ResourceBundle getResourceBundle()
{
return resourceBundle;
}
@@ -160,7 +160,7 @@
* @param theJavaProject the Java project to get the webapp from
* @return the webapp associated to the given Java project
*/
- public static Webapp getWebapp(IJavaProject theJavaProject)
+ public static Webapp getWebapp(final IJavaProject theJavaProject)
{
return new Webapp(theJavaProject);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]