Author: scabanovich
Date: 2007-09-24 09:05:31 -0400 (Mon, 24 Sep 2007)
New Revision: 3767
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/server/ChangeTimeStampActionDelegate.java
Log:
JBIDE-929
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/server/ChangeTimeStampActionDelegate.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/server/ChangeTimeStampActionDelegate.java 2007-09-22
01:17:12 UTC (rev 3766)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/server/ChangeTimeStampActionDelegate.java 2007-09-24
13:05:31 UTC (rev 3767)
@@ -11,47 +11,26 @@
package org.jboss.tools.jst.web.ui.action.server;
import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jface.action.*;
import org.eclipse.jface.viewers.*;
import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities;
import org.eclipse.ui.*;
import org.eclipse.wst.common.componentcore.ComponentCore;
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.eclipse.wst.common.project.facet.core.runtime.IRuntime;
-import org.jboss.tools.common.meta.action.*;
-import org.jboss.tools.common.model.*;
-import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.jst.web.messages.xpl.WebUIMessages;
-import org.jboss.tools.jst.web.model.helpers.WebAppHelper;
import org.jboss.tools.jst.web.ui.WebUiPlugin;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.NullProgressMonitor;
public class ChangeTimeStampActionDelegate implements IWorkbenchWindowActionDelegate {
- static Set<String> warFilesToTouch = new HashSet<String>();
- static Set<String> earFilesToTouch = new HashSet<String>();
- static {
- warFilesToTouch.add("web.xml");
- earFilesToTouch.add("manifest.mf");
- }
-
protected IWorkbenchWindow window;
String tooltip = null;
@@ -105,32 +84,33 @@
if(project == null || !project.isAccessible()) return fs;
boolean isWar = J2EEProjectUtilities.isDynamicWebProject(project);
boolean isEar = J2EEProjectUtilities.isEARProject(project);
- boolean isEJB = J2EEProjectUtilities.isEJBProject(project);
+ boolean isReferencedByEar = false;
if(!isEar) {
IProject[] ps = J2EEProjectUtilities.getReferencingEARProjects(project);
for (int i = 0; i < ps.length; i++) {
fs.addAll(getFilesToTouch(ps[i]));
+ isReferencedByEar = true;
}
}
if(isEar) {
- List l = J2EEProjectUtilities.getAllProjectFiles(project);
- for (int i = 0; i < l.size(); i++) {
- IFile f = (IFile)l.get(i);
- String n = f.getName().toLowerCase();
- if(earFilesToTouch.contains(n)) fs.add(f);
+ IVirtualComponent component = ComponentCore.createComponent(project);
+ IPath path = component.getRootFolder().getProjectRelativePath();
+ IFile f =
project.getFile(path.append("META-INF").append("application.xml"));
+ if(f != null && f.exists()) {
+ fs.add(f);
}
}
- if(isWar) {
- List l = J2EEProjectUtilities.getAllProjectFiles(project);
- for (int i = 0; i < l.size(); i++) {
- IFile f = (IFile)l.get(i);
- String n = f.getName().toLowerCase();
- if(warFilesToTouch.contains(n)) fs.add(f);
+ if(isWar && !isReferencedByEar) {
+ IVirtualComponent component = ComponentCore.createComponent(project);
+ IPath path = component.getRootFolder().getProjectRelativePath();
+ IFile f =
project.getFile(path.append("WEB-INF").append("web.xml"));
+ if(f != null && f.exists()) {
+ fs.add(f);
}
}
return fs;
- }
+ }
public void run(IAction action) {
try {
@@ -139,7 +119,7 @@
WebUiPlugin.getPluginLog().logError(e);
}
}
-
+
protected void doRun() throws Exception {
if(project == null || !project.isAccessible()) return;
List<IFile> fs = getFilesToTouch(project);