diff --git a/.classpath b/.classpath
index 275b34c..472ee29 100644
--- a/.classpath
+++ b/.classpath
@@ -1,7 +1,7 @@
-
+
-
+
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
index c1a4bf7..eb1cb4c 100644
--- a/.settings/org.eclipse.jdt.core.prefs
+++ b/.settings/org.eclipse.jdt.core.prefs
@@ -1,6 +1,6 @@
-#Thu Feb 10 20:33:41 CET 2011
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.5
diff --git a/META-INF/MANIFEST.MF b/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..2df01e0
--- /dev/null
+++ b/META-INF/MANIFEST.MF
@@ -0,0 +1,24 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Tomcat Plugin
+Bundle-SymbolicName: com.sysdeo.eclipse.tomcat; singleton:=true
+Bundle-Version: 3.3.0.5
+Bundle-ClassPath: tomcat.jar
+Bundle-Activator: com.sysdeo.eclipse.tomcat.TomcatLauncherPlugin
+Bundle-Vendor: EclipseTotale.com
+Bundle-Localization: plugin
+Export-Package: .,
+ com.sysdeo.eclipse.tomcat,
+ com.sysdeo.eclipse.tomcat.actions,
+ com.sysdeo.eclipse.tomcat.editors
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.ui.ide;resolution:=optional,
+ org.eclipse.jdt.core,
+ org.eclipse.jdt.launching,
+ org.eclipse.jdt.ui,
+ org.eclipse.debug.ui,
+ org.eclipse.jdt.debug.ui,
+ org.eclipse.ui.ide;resolution:=optional,
+ org.eclipse.core.runtime;bundle-version="2.1"
+Eclipse-LazyStart: true
+Plugin-Class: com.sysdeo.eclipse.tomcat.TomcatLauncherPlugin
diff --git a/build.properties b/build.properties
index 549fab0..2009ba2 100644
--- a/build.properties
+++ b/build.properties
@@ -13,7 +13,8 @@ bin.includes = plugin.xml,\
readme.html,\
readmeDevLoader.html,\
releaseNotesV33.txt,\
- tomcat.jar
+ tomcat.jar,\
+ META-INF/
src.includes = .classpath,\
.project,\
.settings/,\
diff --git a/plugin.xml b/plugin.xml
index 2687b6d..0833e62 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -1,35 +1,7 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
" + redirectLogger + "\n");
fileContent.append(" " + updateXml + "\n");
fileContent.append(" " + warLocation + "\n");
- fileContent.append(" " + URLEncoder.encode(extraInfo) + "\n");
- fileContent.append(" " + webPath + "\n");
+ fileContent.append(" " + URLEncoder.encode(extraInfo) + "\n");
+ fileContent.append(" " + webPath + "\n");
if (webClassPathEntries != null) {
fileContent.append(webClassPathEntries.xmlMarshal(4));
}
fileContent.append("\n");
FileUtil.toTextFile(getPropertiesFile(), fileContent.toString());
- // refresh the project files.
- project.refreshLocal(IResource.DEPTH_ONE, null);
-
+ // refresh the project files.
+ project.refreshLocal(IResource.DEPTH_ONE, null);
+
//Notification for VCM (Team plug-in)
IFile propertiesIFile = this.getProject().getFile(PROPERTIES_FILENAME);
ResourcesPlugin.getWorkspace().validateEdit(new IFile[]{propertiesIFile}, null);
-
-
+
+
} catch (Exception ex) {
- TomcatLauncherPlugin.log(ex.getMessage());
- }
+ TomcatLauncherPlugin.log(ex.getMessage());
+ }
}
/**
@@ -399,27 +399,27 @@ public void saveProperties() {
*/
public void fullConfiguration() throws CoreException, IOException {
if(!rootDir.equals("")) {
- this.initRootDirFolder(true);
+ this.initRootDirFolder(true);
}
- this.addProjectToSourcePathPref();
+ this.addProjectToSourcePathPref();
this.createWEBINFFolder();
this.createWEBINFSrcFolder();
this.createWorkFolder();
-
+
this.addTomcatJarToProjectClasspath();
this.addWEBINFLibJarFilesToProjectClasspath();
-
+
this.clearDefaultSourceEntries();
this.setClassesAsOutputFolder();
if(classesContainsJavaFiles()) {
this.setClassesAsSourceFolder();
}
-
+
this.setSrcAsSourceFolder();
this.setWEBINFSrcAsSourceFolder();
this.setWorkAsSourceFolder();
-
+
this.updateContext();
}
@@ -436,26 +436,26 @@ public void clearDefaultSourceEntries() throws CoreException {
/*
* Add servlet.jar and jasper.jar to project classpath
- */
+ */
public void addTomcatJarToProjectClasspath() throws CoreException {
TomcatBootstrap tb = TomcatLauncherPlugin.getDefault().getTomcatBootstrap();
-
+
IClasspathEntry[] entries = javaProject.getRawClasspath();
List cp = new ArrayList(entries.length + 1);
-
+
for (int i = 0; i < entries.length; i++) {
IClasspathEntry entry = entries[i];
- if(!((entry.getEntryKind() == IClasspathEntry.CPE_VARIABLE) &&
+ if(!((entry.getEntryKind() == IClasspathEntry.CPE_VARIABLE) &&
(entry.getPath().toOSString().startsWith(TomcatLauncherPlugin.getDefault().getTomcatIPath().toOSString())))) {
cp.add(entry);
- }
+ }
}
cp.addAll(tb.getTomcatJars());
-
+
javaProject.setRawClasspath((IClasspathEntry[])cp.toArray(new IClasspathEntry[cp.size()]), null);
}
-
+
/*
* Add all jar in WEB-INF/lib to project classpath
@@ -467,16 +467,16 @@ public void addWEBINFLibJarFilesToProjectClasspath() throws CoreException {
IClasspathEntry[] entries = javaProject.getRawClasspath();
List cp= new ArrayList(entries.length + 1);
cp.addAll(Arrays.asList(entries));
-
+
for(int i=0; i", contextTagIdx);
boolean hasNoBody = false;
if (endTagIndex < 0) {
@@ -722,15 +722,15 @@ private void removeContextInServerXML() throws CoreException, IOException {
}
else
endTagIndex+= "".length();
-
+
StringBuffer out = null;
out = new StringBuffer(xml.substring(0, contextTagIdx));
- out.append(xml.substring(endTagIndex+1, xml.length()));
+ out.append(xml.substring(endTagIndex+1, xml.length()));
+
+ if (out != null) FileUtil.toTextFile(getServerXML(), out.toString());
- if (out != null) FileUtil.toTextFile(getServerXML(), out.toString());
-
}
}
@@ -743,27 +743,27 @@ private void removeContextInServerXML() throws CoreException, IOException {
public void backupServerXML() throws CoreException, IOException {
String backup = getServerXMLLocation() + ".backup";
String old = getServerXMLLocation() + ".old";
-
+
if(!getServerXML().exists()) {
String msg = "Tomcat server.xml file is not found in " + getServerXML().getAbsolutePath();
- Status status = new Status(IStatus.ERROR, TomcatLauncherPlugin.getDefault().getDescriptor().getUniqueIdentifier(), IStatus.ERROR, msg, null);
+ Status status = new Status(IStatus.ERROR, TomcatLauncherPlugin.getDefault().getBundle().getSymbolicName(), IStatus.ERROR, msg, null);
throw new CoreException(status);
}
-
+
File backupFile = new File(backup);
if(!backupFile.exists()) {
- FileUtil.copy(getServerXML(), backupFile);
+ FileUtil.copy(getServerXML(), backupFile);
}
-
- FileUtil.copy(getServerXML(), new File(old));
+
+ FileUtil.copy(getServerXML(), new File(old));
}
-
-
+
+
private File getServerXML() {
- return new File(getServerXMLLocation());
+ return new File(getServerXMLLocation());
}
-
+
private String getServerXMLLocation() {
return TomcatLauncherPlugin.getDefault().getConfigFile();
}
@@ -775,49 +775,49 @@ private String getServerXMLLocation() {
private boolean contextExistsInXML(String xml) throws IOException {
return (getContextTagIndex(xml) != -1);
}
-
+
private int getContextTagIndex(String xml) throws IOException {
int pathIndex = xml.indexOf(getContextPath());
-
+
if(pathIndex == -1)
- return -1;
-
+ return -1;
+
int tagIndex = (xml.substring(0, pathIndex)).lastIndexOf('<');
- String tag = xml.substring(tagIndex, tagIndex + 8);
+ String tag = xml.substring(tagIndex, tagIndex + 8);
if(!tag.equalsIgnoreCase(getContextStartTag()))
return -1;
-
+
return tagIndex;
}
-
+
private void addContextToServerXML() throws IOException {
String xml = FileUtil.readTextFile(getServerXML());
String tag = TomcatLauncherPlugin.getDefault().getTomcatBootstrap().getXMLTagAfterContextDefinition();
-
+
int tagIndex = xml.indexOf(tag);
int insertIndex = (xml.substring(0, tagIndex)).lastIndexOf('\n');
-
+
StringBuffer out = new StringBuffer(xml.substring(0, insertIndex));
out.append(this.createContextDefinition());
out.append(xml.substring(insertIndex, xml.length()));
-
- FileUtil.toTextFile(getServerXML(), out.toString());
+
+ FileUtil.toTextFile(getServerXML(), out.toString());
}
-
+
private String createContextDefinition() {
StringBuffer contextBuffer = new StringBuffer();
contextBuffer.append(getContextStartTag());
contextBuffer.append(' ');
contextBuffer.append(getContextPath());
contextBuffer.append(' ');
- contextBuffer.append(getContextReloadable());
- contextBuffer.append(' ');
+ contextBuffer.append(getContextReloadable());
+ contextBuffer.append(' ');
contextBuffer.append(getContextDocBase());
contextBuffer.append(' ');
contextBuffer.append(getContextWorkDir());
contextBuffer.append(" />\n");
- String context = contextBuffer.toString();
+ String context = contextBuffer.toString();
if (getWebClassPathEntries() != null) {
context = this.addLoaderToContext(context);
}
@@ -827,9 +827,9 @@ private String createContextDefinition() {
if(!(getExtraInfo().equals(""))) {
context = this.addExtraInfoToContext(context);
}
-
+
return context;
-
+
}
private String updateContextDefinition(String context) {
@@ -841,14 +841,14 @@ private String updateContextDefinition(String context) {
} else {
context = this.updateReloadableInContext(context);
}
-
+
// update docBase if set
int docBaseIndex = context.indexOf("docBase");
if(docBaseIndex == -1) {
context = this.addDocBaseToContext(context);
} else {
context = this.updateDocBaseInContext(context);
- }
+ }
// if work param not set
int workIndex = context.indexOf("workDir");
@@ -865,11 +865,11 @@ private String updateContextDefinition(String context) {
}
if((loaderIndex != -1) && (getWebClassPathEntries() == null)) {
context = this.removeLoaderInContext(context);
- }
+ }
if((loaderIndex != -1) && (getWebClassPathEntries() != null)) {
context = this.updateLoaderInContext(context);
- }
-
+ }
+
// if logger not set
int loggerIndex = context.indexOf("",contextTagIndex);
if(xml.charAt(endContextTagIndex-1) != '/') {
- endContextTagIndex = xml.indexOf(this.getContextEndTag(), contextTagIndex) + this.getContextEndTag().length() -1;
+ endContextTagIndex = xml.indexOf(this.getContextEndTag(), contextTagIndex) + this.getContextEndTag().length() -1;
}
String context = xml.substring(contextTagIndex, endContextTagIndex+1);
StringBuffer out = new StringBuffer(xml.substring(0, contextTagIndex));
out.append(this.updateContextDefinition(context));
out.append(xml.substring(endContextTagIndex+1));
- FileUtil.toTextFile(xmlFile, out.toString());
+ FileUtil.toTextFile(xmlFile, out.toString());
}
private String addDocBaseToContext(String context) {
int reloadableIndex = context.indexOf(getContextReloadable());
- int firstDoubleQuoteIndex = context.indexOf('"', reloadableIndex) + 1;
+ int firstDoubleQuoteIndex = context.indexOf('"', reloadableIndex) + 1;
int docBaseIndex = context.indexOf('"',firstDoubleQuoteIndex) + 1;
StringBuffer out = new StringBuffer(context.substring(0, docBaseIndex));
out.append(' ');
out.append(getContextDocBase());
out.append(' ');
- out.append(context.substring(docBaseIndex, context.length()));
-
- return out.toString();
+ out.append(context.substring(docBaseIndex, context.length()));
+
+ return out.toString();
}
private String updateDocBaseInContext(String context) {
@@ -940,8 +940,8 @@ private String updateDocBaseInContext(String context) {
StringBuffer out = new StringBuffer(context.substring(0, docBaseIndex));
out.append(getContextDocBase());
out.append(context.substring(endIndex+1, context.length()));
-
- return out.toString();
+
+ return out.toString();
}
private String getContextReloadable(){
@@ -952,14 +952,14 @@ private String addReloadableToContext(String context) {
int pathIndex = context.indexOf(getContextPath());
int firstDoubleQuoteIndex = context.indexOf('"', pathIndex) + 1;
int reloadableIndex = context.indexOf('"',firstDoubleQuoteIndex) + 1;
-
+
StringBuffer out = new StringBuffer(context.substring(0, reloadableIndex));
out.append(' ');
out.append(getContextReloadable());
out.append(' ');
- out.append(context.substring(reloadableIndex, context.length()));
-
- return out.toString();
+ out.append(context.substring(reloadableIndex, context.length()));
+
+ return out.toString();
}
private String updateReloadableInContext(String context){
@@ -969,10 +969,10 @@ private String updateReloadableInContext(String context){
StringBuffer out = new StringBuffer(context.substring(0,reloadableIndex));
out.append(getContextReloadable());
out.append(context.substring(endIndex+1,context.length()));
-
+
return out.toString();
}
-
+
private String addWorkToContext(String context) {
int docBaseIndex = context.indexOf("docBase");
int firstDoubleQuoteIndex = context.indexOf('"',docBaseIndex) + 1;
@@ -981,9 +981,9 @@ private String addWorkToContext(String context) {
out.append(' ');
out.append(getContextWorkDir());
out.append(' ');
- out.append(context.substring(workIndex, context.length()));
-
- return out.toString();
+ out.append(context.substring(workIndex, context.length()));
+
+ return out.toString();
}
private String updateWorkInContext(String context) {
@@ -993,14 +993,14 @@ private String updateWorkInContext(String context) {
StringBuffer out = new StringBuffer(context.substring(0, workDirIndex));
out.append(getContextWorkDir());
out.append(context.substring(endIndex+1, context.length()));
-
- return out.toString();
+
+ return out.toString();
}
// Add instead of />, and \n if needed
private String formatContextEndTag(String context) {
int endContextStartTagIndex = context.indexOf(">");
- StringBuffer newContext = new StringBuffer();
+ StringBuffer newContext = new StringBuffer();
if(context.charAt(endContextStartTagIndex-1) == '/') {
newContext.append(context.substring(0, endContextStartTagIndex-1));
newContext.append(">");
@@ -1008,149 +1008,149 @@ private String formatContextEndTag(String context) {
newContext.append(getContextEndTag());
newContext.append("\n");
context = newContext.toString();
- endContextStartTagIndex--;
+ endContextStartTagIndex--;
} else {
int endContextTagIndex = context.indexOf(getContextEndTag());
if(context.charAt(endContextTagIndex-1) != '\n') {
newContext.append(context.substring(0,endContextTagIndex));
newContext.append("\n");
- newContext.append(context.substring(endContextTagIndex));
+ newContext.append(context.substring(endContextTagIndex));
} else {
return context;
}
}
-
+
return newContext.toString();
}
-
+
private String addLoaderToContext(String context) {
context = this.formatContextEndTag(context);
- int endContextStartTagIndex = context.indexOf(">");
+ int endContextStartTagIndex = context.indexOf(">");
int loaderIndex = endContextStartTagIndex + 1;
StringBuffer out = new StringBuffer(context.substring(0, loaderIndex));
out.append(getContextWebAppClassLoader());
- out.append(context.substring(loaderIndex, context.length()));
-
- return out.toString();
+ out.append(context.substring(loaderIndex, context.length()));
+
+ return out.toString();
}
private String updateLoaderInContext(String context) {
- context = this.formatContextEndTag(context);
+ context = this.formatContextEndTag(context);
int endContextStartTagIndex = context.indexOf(">");
int startIndex = context.indexOf("",startIndex+1)+1;
StringBuffer out = new StringBuffer(context.substring(0, startIndex));
out.append(getContextWebAppClassLoader());
out.append(context.substring(endIndex+1, context.length()));
-
- return out.toString();
+
+ return out.toString();
}
private String removeLoaderInContext(String context) {
int endContextStartTagIndex = context.indexOf(">");
int startIndex = context.indexOf("",startIndex+1)+1;
StringBuffer out = new StringBuffer(context.substring(0, startIndex));
out.append(context.substring(endIndex+1, context.length()));
-
- return out.toString();
+
+ return out.toString();
}
private String addLoggerToContext(String context) {
context = this.formatContextEndTag(context);
- int endContextStartTagIndex = context.indexOf(">");
+ int endContextStartTagIndex = context.indexOf(">");
int loggerIndex = endContextStartTagIndex + 1;
StringBuffer out = new StringBuffer(context.substring(0, loggerIndex));
out.append(getContextLogger());
- out.append(context.substring(loggerIndex, context.length()));
-
- return out.toString();
+ out.append(context.substring(loggerIndex, context.length()));
+
+ return out.toString();
}
private String updateLoggerInContext(String context) {
int endContextStartTagIndex = context.indexOf(">");
int startIndex = context.indexOf("",startIndex)+1;
StringBuffer out = new StringBuffer(context.substring(0, startIndex));
out.append(getContextLogger());
out.append(context.substring(endIndex+1, context.length()));
-
- return out.toString();
+
+ return out.toString();
}
private String removeLoggerInContext(String context) {
int endContextStartTagIndex = context.indexOf(">");
int startIndex = context.indexOf("",startIndex)+1;
StringBuffer out = new StringBuffer(context.substring(0, startIndex));
out.append(context.substring(endIndex+1, context.length()));
-
- return out.toString();
+
+ return out.toString();
}
private String addExtraInfoToContext(String context) {
context = this.formatContextEndTag(context);
- int endContextStartTagIndex = context.indexOf(">");
+ int endContextStartTagIndex = context.indexOf(">");
int extraInfoIndex = endContextStartTagIndex + 1;
StringBuffer out = new StringBuffer(context.substring(0, extraInfoIndex));
- out.append('\n');
+ out.append('\n');
out.append(extraBeginTag);
out.append('\n');
out.append(getExtraInfo());
out.append('\n');
- out.append(extraEndTag);
- out.append(context.substring(extraInfoIndex, context.length()));
-
- return out.toString();
+ out.append(extraEndTag);
+ out.append(context.substring(extraInfoIndex, context.length()));
+
+ return out.toString();
}
private String updateExtraInfoInContext(String context) {
int endContextStartTagIndex = context.indexOf(">");
int startIndex = context.indexOf(extraBeginTag, endContextStartTagIndex);
if(context.charAt(startIndex-1) == '\t') startIndex--;
- if(context.charAt(startIndex-1) == '\n') startIndex--;
+ if(context.charAt(startIndex-1) == '\n') startIndex--;
int extraEndTagStartIndex = context.indexOf(extraEndTag,startIndex);
StringBuffer out = new StringBuffer(context.substring(0, startIndex));
- out.append('\n');
+ out.append('\n');
out.append(extraBeginTag);
out.append('\n');
out.append(getExtraInfo());
out.append('\n');
out.append(context.substring(extraEndTagStartIndex, context.length()));
-
- return out.toString();
+
+ return out.toString();
}
private String removeExtraInfoInContext(String context) {
int endContextStartTagIndex = context.indexOf(">");
int startIndex = context.indexOf(extraBeginTag, endContextStartTagIndex);
if(context.charAt(startIndex-1) == '\t') startIndex--;
- if(context.charAt(startIndex-1) == '\n') startIndex--;
+ if(context.charAt(startIndex-1) == '\n') startIndex--;
int extraEndTagStartIndex = context.indexOf(extraEndTag,startIndex);
StringBuffer out = new StringBuffer(context.substring(0, startIndex));
int endIndex = extraEndTagStartIndex + extraEndTag.length();
out.append(context.substring(endIndex, context.length()));
-
- return out.toString();
+
+ return out.toString();
}
-
+
private String getContextStartTag() {
return ("";
}
-
+
private String getContextLogger() {
return "\n\t";
}
@@ -1177,20 +1177,20 @@ private String getContextLogger() {
private String getContextEndTag() {
return "";
-
+
}
public void exportToWar() throws IOException {
File warFile = new File(this.getWarLocation());
-
+
File directory = null;
if(getRootDirFolder() == null) {
directory = this.getProject().getLocation().toFile();
- } else {
+ } else {
directory = this.getRootDirFolder().getLocation().toFile();
}
-
+
Zipper zipper = new TomcatProjectZipper(warFile, directory, getExportSource());
zipper.zip();
}
@@ -1199,18 +1199,18 @@ public void exportToWar() throws IOException {
* if WEB-INF classes contains Java files add it to source folders
* Otherwise Eclipse will delete all those files
*/
- private boolean classesContainsJavaFiles() {
- IFolder webinfFolder = this.getWebInfFolder();
+ private boolean classesContainsJavaFiles() {
+ IFolder webinfFolder = this.getWebInfFolder();
IFolder classesFolder = webinfFolder.getFolder("classes");
File f = classesFolder.getLocation().toFile();
-
- if (!f.exists()) return false;
- if (!f.isDirectory()) return false;
-
+
+ if (!f.exists()) return false;
+ if (!f.isDirectory()) return false;
+
return FileUtil.dirContainsFiles(f, "java", true);
- }
-
-
+ }
+
+
/*
* A new Tomcat project should be checked by default in source path preference page
*/
diff --git a/src/com/sysdeo/eclipse/tomcat/TomcatProjectCreationWizard.java b/src/com/sysdeo/eclipse/tomcat/TomcatProjectCreationWizard.java
index 2c15641..8a26c06 100644
--- a/src/com/sysdeo/eclipse/tomcat/TomcatProjectCreationWizard.java
+++ b/src/com/sysdeo/eclipse/tomcat/TomcatProjectCreationWizard.java
@@ -54,12 +54,7 @@ public boolean canFinish() {
}
private ImageDescriptor getBannerImg() {
- try {
- URL prefix = new URL(TomcatLauncherPlugin.getDefault().getDescriptor().getInstallURL(), "icons/");
- return ImageDescriptor.createFromURL(new URL(prefix, "newjprj_wiz.gif"));
- } catch (MalformedURLException e) {
- return null;
- }
+ return ImageDescriptor.createFromURL(TomcatLauncherPlugin.getDefault().getBundle().getResource("icons/newjprj_wiz.gif"));
}
/*