Author: rob.stryker(a)jboss.com
Date: 2012-08-08 01:22:30 -0400 (Wed, 08 Aug 2012)
New Revision: 42900
Modified:
branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/vcf/WorkspaceFilesetVirtualComponent.java
branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/DeploymentPreferenceLoader.java
branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerConverter.java
Log:
JBIDE-12361 astools portion to maintenance
Modified:
branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/vcf/WorkspaceFilesetVirtualComponent.java
===================================================================
---
branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/vcf/WorkspaceFilesetVirtualComponent.java 2012-08-08
00:55:06 UTC (rev 42899)
+++
branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/filesets/vcf/WorkspaceFilesetVirtualComponent.java 2012-08-08
05:22:30 UTC (rev 42900)
@@ -10,6 +10,10 @@
******************************************************************************/
package org.jboss.ide.eclipse.archives.webtools.filesets.vcf;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@@ -19,8 +23,8 @@
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
import org.jboss.ide.eclipse.archives.core.model.DirectoryScannerFactory;
+import
org.jboss.ide.eclipse.archives.core.model.DirectoryScannerFactory.DirectoryScannerExtension;
import org.jboss.ide.eclipse.archives.core.model.IArchiveModelRootNode;
-import
org.jboss.ide.eclipse.archives.core.model.DirectoryScannerFactory.DirectoryScannerExtension;
import org.jboss.ide.eclipse.as.wtp.core.util.ResourceFilter;
import org.jboss.ide.eclipse.as.wtp.core.util.ResourceListVirtualFolder;
import org.jboss.ide.eclipse.as.wtp.core.vcf.AbstractFilesetVirtualComponent;
@@ -96,12 +100,33 @@
scanner = DirectoryScannerFactory.createDirectoryScanner(
rootFolderPath, new Path(""), //$NON-NLS-1$
includes, excludes, getProject().getName(), true,
- IArchiveModelRootNode.DESCRIPTOR_VERSION_1_3, false);
+ IArchiveModelRootNode.DESCRIPTOR_VERSION_1_3, true);
}
public boolean accepts(IResource resource) {
- boolean b = scanner.couldBeIncluded(resource.getFullPath().toString(), true);
- return b;
+ String absolutePath = resource.getLocation().toFile().getAbsolutePath();
+ ArrayList<DirectoryScannerExtension.FileWrapper> sum =
getAllMatches(absolutePath);
+ if( sum.size() > 0 ) {
+ DirectoryScannerExtension.FileWrapper tmp;
+ Iterator<DirectoryScannerExtension.FileWrapper> i = sum.iterator();
+ while(i.hasNext()) {
+ tmp = i.next();
+ if( tmp.getWrapperPath().equals(resource.getFullPath()))
+ return true;
+ }
+ }
+ return false;
}
+ private ArrayList<DirectoryScannerExtension.FileWrapper> getAllMatches(String
absolutePath) {
+ HashMap<String, ArrayList<DirectoryScannerExtension.FileWrapper>>
matchedFiles = scanner.getMatchedMap();
+ HashMap<String, ArrayList<DirectoryScannerExtension.FileWrapper>>
requiredFolders = scanner.getRequiredFolderMap();
+ ArrayList<DirectoryScannerExtension.FileWrapper> sum = new
ArrayList<DirectoryScannerExtension.FileWrapper>();
+
+ if( matchedFiles.get(absolutePath) != null )
+ sum.addAll(matchedFiles.get(absolutePath));
+ if( requiredFolders.get(absolutePath) != null )
+ sum.addAll(requiredFolders.get(absolutePath));
+ return sum;
+ }
}
}
Modified:
branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/DeploymentPreferenceLoader.java
===================================================================
---
branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/DeploymentPreferenceLoader.java 2012-08-08
00:55:06 UTC (rev 42899)
+++
branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/DeploymentPreferenceLoader.java 2012-08-08
05:22:30 UTC (rev 42900)
@@ -26,6 +26,7 @@
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.IServerAttributes;
+import org.eclipse.wst.server.core.IServerWorkingCopy;
import org.eclipse.wst.server.core.internal.Server;
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
import org.jboss.ide.eclipse.as.core.publishers.LocalPublishMethod;
@@ -64,6 +65,7 @@
return server.getAttribute(IDeployableServer.SERVER_MODE, defaultType);
}
+ @Deprecated
public static DeploymentPreferences loadPreferencesFromFile(IServer server) {
File f = getFile(server);
if( f.exists()) {
@@ -77,7 +79,7 @@
return null;
}
- public static DeploymentPreferences loadPreferencesFromServer(IServer server) {
+ public static DeploymentPreferences loadPreferencesFromServer(IServerAttributes server)
{
String xml = ((Server)server).getAttribute(DEPLOYMENT_PREFERENCES_KEY, (String)null);
ByteArrayInputStream bis = null;
if( xml != null ) {
@@ -86,6 +88,7 @@
return new DeploymentPreferences(bis);
}
+ @Deprecated
public static void savePreferences(IServer server, DeploymentPreferences prefs) throws
IOException {
File f = getFile(server);
prefs.getMemento().saveToFile(f.getAbsolutePath());
@@ -185,17 +188,23 @@
}
public DeploymentModulePrefs getModulePrefs(IModule module) {
- return children.get(module.getId());
+ return getModulePrefs(module.getId());
}
+ public DeploymentModulePrefs getModulePrefs(String id) {
+ return children.get(id);
+ }
public DeploymentModulePrefs getOrCreateModulePrefs(IModule module) {
- if( children.get(module.getId()) == null ) {
+ return getOrCreateModulePrefs(module.getId());
+ }
+ public DeploymentModulePrefs getOrCreateModulePrefs(String id) {
+ if( children.get(id) == null ) {
IMemento childMemento = memento.createChild("module"); //$NON-NLS-1$
- childMemento.putString("id", module.getId()); //$NON-NLS-1$
- children.put(module.getId(),
- new DeploymentModulePrefs(module.getId(),
+ childMemento.putString("id", id); //$NON-NLS-1$
+ children.put(id,
+ new DeploymentModulePrefs(id,
childMemento));
}
- return children.get(module.getId());
+ return children.get(id);
}
public String getProperty(String key) {
@@ -262,15 +271,19 @@
}
public static void savePreferencesToServerWorkingCopy(ServerAttributeHelper helper,
DeploymentPreferences prefs) {
+ savePreferencesToServerWorkingCopy(helper.getWorkingCopy(), prefs);
+ }
+
+ public static void savePreferencesToServerWorkingCopy(IServerWorkingCopy wc,
DeploymentPreferences prefs) {
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
DeploymentPreferenceLoader.savePreferences(bos, prefs);
String asXML = new String(bos.toByteArray());
- helper.setAttribute(DeploymentPreferenceLoader.DEPLOYMENT_PREFERENCES_KEY, asXML);
+ wc.setAttribute(DeploymentPreferenceLoader.DEPLOYMENT_PREFERENCES_KEY, asXML);
} catch(IOException ioe) {
// Should never happen since this is a simple byte array output stream
JBossServerCorePlugin.log(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID,
- "Could not save module deployment preferences to server " +
helper.getServer().getName(), ioe)); //$NON-NLS-1$
+ "Could not save module deployment preferences to server " +
wc.getOriginal().getName(), ioe)); //$NON-NLS-1$
}
}
Modified:
branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerConverter.java
===================================================================
---
branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerConverter.java 2012-08-08
00:55:06 UTC (rev 42899)
+++
branches/jbosstools-3.3.x/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerConverter.java 2012-08-08
05:22:30 UTC (rev 42900)
@@ -104,7 +104,7 @@
return jbServer;
}
- public static IDeployableServer getDeployableServer(IServer server) {
+ public static IDeployableServer getDeployableServer(IServerAttributes server) {
if (server == null) {
return null;
}