Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Johnston2011-09-08 20:17:58 +0000
committerJeff Johnston2011-09-08 20:17:58 +0000
commitbd909221c70f3998b32494e2e2d7e8d2f54dbce2 (patch)
tree4935a0f1c27250bb1ff56f001f24703e1598a97d
parent58f9f6790ebeb0a7b1f8d3185877cdf7bd91657b (diff)
downloadorg.eclipse.linuxtools-bd909221c70f3998b32494e2e2d7e8d2f54dbce2.tar.gz
org.eclipse.linuxtools-bd909221c70f3998b32494e2e2d7e8d2f54dbce2.tar.xz
org.eclipse.linuxtools-bd909221c70f3998b32494e2e2d7e8d2f54dbce2.zip
Use remote file and launch proxies.
* src/org/eclipse/linuxtools/internal/cdt/autotools/core/configure/AutotoolsConfigurationManager.java (applyConfigs): Use remote file proxy to save .autotools file. (getSavedConfigs): Use remote file proxy to access .autotools file. * src/org/eclipse/linuxtools/internal/cdt/autotools/core/AutotoolsNewMakeGenerator.java (runScript): Use remote launch proxy. (getWinOSType): Ditto. (runCommand): Ditto. (makefileCvsExists): Use remote file proxy. (regenerateMakefiles): Ditto. (createDirectory): Ditto. (initialize): Get remote file proxy for current project. * src/org/eclipse/linuxtools/internal/cdt/autotools/core/PkgconfigErrorResolution.java (run): Use remote command launch proxy. * src/org/eclipse/linuxtools/internal/cdt/autotools/core/RemoteProxyManager.java: New class.
-rw-r--r--autotools/org.eclipse.linuxtools.cdt.autotools.core/ChangeLog17
-rw-r--r--autotools/org.eclipse.linuxtools.cdt.autotools.core/src/org/eclipse/linuxtools/internal/cdt/autotools/core/AutotoolsNewMakeGenerator.java27
-rw-r--r--autotools/org.eclipse.linuxtools.cdt.autotools.core/src/org/eclipse/linuxtools/internal/cdt/autotools/core/FileProxyManager.java30
-rw-r--r--autotools/org.eclipse.linuxtools.cdt.autotools.core/src/org/eclipse/linuxtools/internal/cdt/autotools/core/IRemoteCommandLauncher.java17
-rw-r--r--autotools/org.eclipse.linuxtools.cdt.autotools.core/src/org/eclipse/linuxtools/internal/cdt/autotools/core/LocalLauncher.java34
-rw-r--r--autotools/org.eclipse.linuxtools.cdt.autotools.core/src/org/eclipse/linuxtools/internal/cdt/autotools/core/PkgconfigErrorResolution.java9
-rw-r--r--autotools/org.eclipse.linuxtools.cdt.autotools.core/src/org/eclipse/linuxtools/internal/cdt/autotools/core/RemoteProxyManager.java38
-rw-r--r--autotools/org.eclipse.linuxtools.cdt.autotools.core/src/org/eclipse/linuxtools/internal/cdt/autotools/core/configure/AutotoolsConfigurationManager.java104
8 files changed, 183 insertions, 93 deletions
diff --git a/autotools/org.eclipse.linuxtools.cdt.autotools.core/ChangeLog b/autotools/org.eclipse.linuxtools.cdt.autotools.core/ChangeLog
index a7818f5c4d..08a7a097f4 100644
--- a/autotools/org.eclipse.linuxtools.cdt.autotools.core/ChangeLog
+++ b/autotools/org.eclipse.linuxtools.cdt.autotools.core/ChangeLog
@@ -1,3 +1,20 @@
+2011-09-08 Jeff Johnston <jjohnstn@redhat.com>
+
+ * src/org/eclipse/linuxtools/internal/cdt/autotools/core/configure/AutotoolsConfigurationManager.java (applyConfigs):
+ Use remote file proxy to save .autotools file.
+ (getSavedConfigs): Use remote file proxy to access .autotools file.
+ * src/org/eclipse/linuxtools/internal/cdt/autotools/core/AutotoolsNewMakeGenerator.java (runScript): Use
+ remote launch proxy.
+ (getWinOSType): Ditto.
+ (runCommand): Ditto.
+ (makefileCvsExists): Use remote file proxy.
+ (regenerateMakefiles): Ditto.
+ (createDirectory): Ditto.
+ (initialize): Get remote file proxy for current project.
+ * src/org/eclipse/linuxtools/internal/cdt/autotools/core/PkgconfigErrorResolution.java (run): Use
+ remote command launch proxy.
+ * src/org/eclipse/linuxtools/internal/cdt/autotools/core/RemoteProxyManager.java: New class.
+
2011-08-18 Jeff Johnston <jjohnstn@redhat.com>
* src/org/eclipse/linuxtools/internal/cdt/autotools/core/LocalFileProxy.java: New file.
diff --git a/autotools/org.eclipse.linuxtools.cdt.autotools.core/src/org/eclipse/linuxtools/internal/cdt/autotools/core/AutotoolsNewMakeGenerator.java b/autotools/org.eclipse.linuxtools.cdt.autotools.core/src/org/eclipse/linuxtools/internal/cdt/autotools/core/AutotoolsNewMakeGenerator.java
index 9ac79d5d3b..be1189ad74 100644
--- a/autotools/org.eclipse.linuxtools.cdt.autotools.core/src/org/eclipse/linuxtools/internal/cdt/autotools/core/AutotoolsNewMakeGenerator.java
+++ b/autotools/org.eclipse.linuxtools.cdt.autotools.core/src/org/eclipse/linuxtools/internal/cdt/autotools/core/AutotoolsNewMakeGenerator.java
@@ -26,7 +26,6 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.CommandLauncher;
import org.eclipse.cdt.core.ConsoleOutputStream;
import org.eclipse.cdt.core.ICDescriptor;
import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
@@ -153,7 +152,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
public void initialize(IProject project, IManagedBuildInfo info,
IProgressMonitor monitor) {
this.project = project;
- proxy = FileProxyManager.getInstance().getFileProxy(project);
+ proxy = RemoteProxyManager.getInstance().getFileProxy(project);
ICProjectDescription pdesc = CCorePlugin.getDefault().getProjectDescription(project);
this.cdesc = pdesc.getActiveConfiguration();
this.cfg = info.getDefaultConfiguration();
@@ -777,7 +776,8 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
consoleOutStream.flush();
// Get a launcher for the config command
- CommandLauncher launcher = new CommandLauncher();
+ IRemoteCommandLauncher launcher = RemoteProxyManager.getInstance().getLauncher(project);
+
// Set the environment
IEnvironmentVariable variables[] =
CCorePlugin.getDefault().getBuildEnvironmentManager().getVariables(cdesc, true);
@@ -800,7 +800,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
OutputStream stdout = epm.getOutputStream();
OutputStream stderr = stdout;
- launcher.showCommand(true);
+// launcher.showCommand(true);
Process proc = launcher.execute(commandPath, configTargets, env,
runPath, new NullProgressMonitor());
if (proc != null) {
@@ -812,7 +812,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
}
if (launcher.waitAndRead(stdout, stderr, new SubProgressMonitor(
- monitor, IProgressMonitor.UNKNOWN)) != CommandLauncher.OK) {
+ monitor, IProgressMonitor.UNKNOWN)) != IRemoteCommandLauncher.OK) {
errMsg = launcher.getErrorMessage();
}
@@ -889,7 +889,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
private String getWinOSType() {
if (winOSType.equals("")) {
try {
- CommandLauncher launcher = new CommandLauncher();
+ IRemoteCommandLauncher launcher = RemoteProxyManager.getInstance().getLauncher(project);
ByteArrayOutputStream out = new ByteArrayOutputStream();
launcher.execute(
new Path(SHELL_COMMAND), //$NON-NLS-1$
@@ -897,7 +897,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
new String[0],
new Path("."), //$NON-NLS-1$
new NullProgressMonitor());
- if (launcher.waitAndRead(out, out) == CommandLauncher.OK)
+ if (launcher.waitAndRead(out, out, new NullProgressMonitor()) == IRemoteCommandLauncher.OK)
winOSType = out.toString().trim();
} catch (CoreException e) {
// do nothing
@@ -911,7 +911,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
// doesn't cause Makefile to choke. For Cygwin we use /cygdrive/C/a/b
private String getPathString(IPath path) {
String s = path.toString();
- if (Platform.getOS().equals(Platform.OS_WIN32)) {
+ if (RemoteProxyManager.getInstance().getOS(project).equals(Platform.OS_WIN32)) {
if (getWinOSType().equals("cygwin")) {
s = s.replaceAll("^([A-Z])(:)", "/cygdrive/$1");
} else {
@@ -946,8 +946,9 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
configTargets[0] = getPathString(commandPath);
// Fix for bug #343731
- if (Platform.getOS().equals(Platform.OS_WIN32)
- || Platform.getOS().equals(Platform.OS_MACOSX)) {
+ RemoteProxyManager rpm = RemoteProxyManager.getInstance();
+ if (rpm.getOS(project).equals(Platform.OS_WIN32)
+ || rpm.getOS(project).equals(Platform.OS_MACOSX)) {
removePWD = true;
// Neither Mac or Windows support calling scripts directly.
String command = null;
@@ -1004,7 +1005,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
consoleOutStream.flush();
// Get a launcher for the config command
- CommandLauncher launcher = new CommandLauncher();
+ IRemoteCommandLauncher launcher = RemoteProxyManager.getInstance().getLauncher(project);
// Set the environment
IEnvironmentVariable variables[] =
CCorePlugin.getDefault().getBuildEnvironmentManager().getVariables(cdesc, true);
@@ -1033,7 +1034,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
OutputStream stdout = epm.getOutputStream();
OutputStream stderr = stdout;
- launcher.showCommand(true);
+// launcher.showCommand(true);
// Run the shell script via shell command.
Process proc = launcher.execute(new Path(SHELL_COMMAND), configTargets, env,
runPath, new NullProgressMonitor());
@@ -1046,7 +1047,7 @@ public class AutotoolsNewMakeGenerator extends MarkerGenerator {
}
if (launcher.waitAndRead(stdout, stderr, new SubProgressMonitor(
- monitor, IProgressMonitor.UNKNOWN)) != CommandLauncher.OK) {
+ monitor, IProgressMonitor.UNKNOWN)) != IRemoteCommandLauncher.OK) {
errMsg = launcher.getErrorMessage();
}
diff --git a/autotools/org.eclipse.linuxtools.cdt.autotools.core/src/org/eclipse/linuxtools/internal/cdt/autotools/core/FileProxyManager.java b/autotools/org.eclipse.linuxtools.cdt.autotools.core/src/org/eclipse/linuxtools/internal/cdt/autotools/core/FileProxyManager.java
deleted file mode 100644
index 4fd67c7da2..0000000000
--- a/autotools/org.eclipse.linuxtools.cdt.autotools.core/src/org/eclipse/linuxtools/internal/cdt/autotools/core/FileProxyManager.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package org.eclipse.linuxtools.internal.cdt.autotools.core;
-
-import org.eclipse.core.resources.IProject;
-
-public class FileProxyManager {
-
- private static FileProxyManager manager;
- private LocalFileProxy lfp;
-
- private FileProxyManager() {
- // do nothing
- }
-
- public static FileProxyManager getInstance() {
- if (manager == null)
- manager = new FileProxyManager();
- return manager;
- }
-
- LocalFileProxy getLocalFileProxy() {
- if (lfp == null)
- lfp = new LocalFileProxy();
- return lfp;
- }
-
- IRemoteFileProxy getFileProxy(IProject project) {
- return getLocalFileProxy();
- }
-
-}
diff --git a/autotools/org.eclipse.linuxtools.cdt.autotools.core/src/org/eclipse/linuxtools/internal/cdt/autotools/core/IRemoteCommandLauncher.java b/autotools/org.eclipse.linuxtools.cdt.autotools.core/src/org/eclipse/linuxtools/internal/cdt/autotools/core/IRemoteCommandLauncher.java
new file mode 100644
index 0000000000..880af09e33
--- /dev/null
+++ b/autotools/org.eclipse.linuxtools.cdt.autotools.core/src/org/eclipse/linuxtools/internal/cdt/autotools/core/IRemoteCommandLauncher.java
@@ -0,0 +1,17 @@
+package org.eclipse.linuxtools.internal.cdt.autotools.core;
+
+import java.io.OutputStream;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+public interface IRemoteCommandLauncher {
+
+ public final static int OK = 0;
+
+ public Process execute(IPath commandPath, String[] args, String[] env, IPath changeToDirectory, IProgressMonitor monitor) throws CoreException;
+ public int waitAndRead(OutputStream output, OutputStream err, IProgressMonitor monitor);
+ public String getErrorMessage();
+
+} \ No newline at end of file
diff --git a/autotools/org.eclipse.linuxtools.cdt.autotools.core/src/org/eclipse/linuxtools/internal/cdt/autotools/core/LocalLauncher.java b/autotools/org.eclipse.linuxtools.cdt.autotools.core/src/org/eclipse/linuxtools/internal/cdt/autotools/core/LocalLauncher.java
new file mode 100644
index 0000000000..eead59b831
--- /dev/null
+++ b/autotools/org.eclipse.linuxtools.cdt.autotools.core/src/org/eclipse/linuxtools/internal/cdt/autotools/core/LocalLauncher.java
@@ -0,0 +1,34 @@
+package org.eclipse.linuxtools.internal.cdt.autotools.core;
+
+import java.io.OutputStream;
+
+import org.eclipse.cdt.core.CommandLauncher;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+public class LocalLauncher implements IRemoteCommandLauncher {
+
+ private CommandLauncher launcher;
+
+ public LocalLauncher() {
+ launcher = new CommandLauncher();
+ }
+
+ public Process execute(IPath commandPath, String[] args, String[] env,
+ IPath changeToDirectory, IProgressMonitor monitor)
+ throws CoreException {
+ launcher.showCommand(true);
+ return launcher.execute(commandPath, args, env, changeToDirectory, monitor);
+ }
+
+ public int waitAndRead(OutputStream output, OutputStream err,
+ IProgressMonitor monitor) {
+ return launcher.waitAndRead(output, err, monitor);
+ }
+
+ public String getErrorMessage() {
+ return launcher.getErrorMessage();
+ }
+
+}
diff --git a/autotools/org.eclipse.linuxtools.cdt.autotools.core/src/org/eclipse/linuxtools/internal/cdt/autotools/core/PkgconfigErrorResolution.java b/autotools/org.eclipse.linuxtools.cdt.autotools.core/src/org/eclipse/linuxtools/internal/cdt/autotools/core/PkgconfigErrorResolution.java
index 0c91aad758..dae20e9c2d 100644
--- a/autotools/org.eclipse.linuxtools.cdt.autotools.core/src/org/eclipse/linuxtools/internal/cdt/autotools/core/PkgconfigErrorResolution.java
+++ b/autotools/org.eclipse.linuxtools.cdt.autotools.core/src/org/eclipse/linuxtools/internal/cdt/autotools/core/PkgconfigErrorResolution.java
@@ -14,9 +14,10 @@ import java.io.IOException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import org.eclipse.cdt.core.CommandLauncher;
import org.eclipse.cdt.core.ConsoleOutputStream;
import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.NullProgressMonitor;
@@ -56,7 +57,9 @@ public class PkgconfigErrorResolution implements IMarkerResolution {
IPath pkgconfigPath =
new Path("/usr/lib/pkgconfig").append(pkgName+".pc"); //$NON-NLS-1$ //$NON-NLS-2$
// Get a launcher for the config command
- CommandLauncher launcher = new CommandLauncher();
+ IResource resource = marker.getResource();
+ IProject project = resource.getProject();
+ IRemoteCommandLauncher launcher = RemoteProxyManager.getInstance().getLauncher(project);
IPath commandPath = new Path("rpm"); //$NON-NLS-1$
String[] commandArgs =
new String[] {"-q", //$NON-NLS-1$
@@ -78,7 +81,7 @@ public class PkgconfigErrorResolution implements IMarkerResolution {
} catch (IOException e) {
}
if (launcher.waitAndRead(output, output, new NullProgressMonitor())
- != CommandLauncher.OK) {
+ != IRemoteCommandLauncher.OK) {
AutotoolsPlugin.logErrorMessage(launcher.getErrorMessage());
} else {
String result = output.readBuffer();
diff --git a/autotools/org.eclipse.linuxtools.cdt.autotools.core/src/org/eclipse/linuxtools/internal/cdt/autotools/core/RemoteProxyManager.java b/autotools/org.eclipse.linuxtools.cdt.autotools.core/src/org/eclipse/linuxtools/internal/cdt/autotools/core/RemoteProxyManager.java
new file mode 100644
index 0000000000..63c815c394
--- /dev/null
+++ b/autotools/org.eclipse.linuxtools.cdt.autotools.core/src/org/eclipse/linuxtools/internal/cdt/autotools/core/RemoteProxyManager.java
@@ -0,0 +1,38 @@
+package org.eclipse.linuxtools.internal.cdt.autotools.core;
+
+import org.eclipse.cdt.utils.Platform;
+import org.eclipse.core.resources.IProject;
+
+public class RemoteProxyManager {
+
+ private static RemoteProxyManager manager;
+ private LocalFileProxy lfp;
+
+ private RemoteProxyManager() {
+ // do nothing
+ }
+
+ public static RemoteProxyManager getInstance() {
+ if (manager == null)
+ manager = new RemoteProxyManager();
+ return manager;
+ }
+
+ LocalFileProxy getLocalFileProxy() {
+ if (lfp == null)
+ lfp = new LocalFileProxy();
+ return lfp;
+ }
+
+ public IRemoteFileProxy getFileProxy(IProject project) {
+ return getLocalFileProxy();
+ }
+
+ public IRemoteCommandLauncher getLauncher(IProject project) {
+ return new LocalLauncher();
+ }
+
+ public String getOS(IProject project) {
+ return Platform.getOS();
+ }
+}
diff --git a/autotools/org.eclipse.linuxtools.cdt.autotools.core/src/org/eclipse/linuxtools/internal/cdt/autotools/core/configure/AutotoolsConfigurationManager.java b/autotools/org.eclipse.linuxtools.cdt.autotools.core/src/org/eclipse/linuxtools/internal/cdt/autotools/core/configure/AutotoolsConfigurationManager.java
index 95c04bbccb..4fe5b4bc1a 100644
--- a/autotools/org.eclipse.linuxtools.cdt.autotools.core/src/org/eclipse/linuxtools/internal/cdt/autotools/core/configure/AutotoolsConfigurationManager.java
+++ b/autotools/org.eclipse.linuxtools.cdt.autotools.core/src/org/eclipse/linuxtools/internal/cdt/autotools/core/configure/AutotoolsConfigurationManager.java
@@ -14,6 +14,8 @@ import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.HashSet;
@@ -35,6 +37,8 @@ import org.eclipse.cdt.managedbuilder.core.IOption;
import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.IToolChain;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceChangeEvent;
@@ -42,8 +46,12 @@ import org.eclipse.core.resources.IResourceChangeListener;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.linuxtools.cdt.autotools.core.AutotoolsPlugin;
+import org.eclipse.linuxtools.internal.cdt.autotools.core.IRemoteFileProxy;
+import org.eclipse.linuxtools.internal.cdt.autotools.core.RemoteProxyManager;
import org.eclipse.linuxtools.internal.cdt.autotools.core.configure.AutotoolsConfiguration.Option;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -177,12 +185,14 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
if (list == null) {
try {
IPath fileLocation = project.getLocation().append(CFG_FILE_NAME);
- File dirFile = fileLocation.toFile();
+ IRemoteFileProxy proxy = RemoteProxyManager.getInstance().getFileProxy(project);
+ IFileStore f = proxy.getResource(fileLocation.toString());
Map<String, IAConfiguration> cfgList = new HashMap<String, IAConfiguration>();
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
- if (dirFile.exists()) {
- Document d = db.parse(dirFile);
+ if (f.fetchInfo().exists()) {
+ InputStream is = f.openInputStream(EFS.NONE, new NullProgressMonitor());
+ Document d = db.parse(is);
Element e = d.getDocumentElement();
// Get the stored configuration data
NodeList cfgs = e.getElementsByTagName("configuration"); // $NON-NLS-1$
@@ -235,6 +245,9 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
+ } catch (CoreException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
}
}
return list;
@@ -399,27 +412,44 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
}
IProject project = (IProject)res;
IPath output = project.getLocation().append(CFG_FILE_NAME);
- File f = output.toFile();
- if (!f.exists())
- f.createNewFile();
- if (f.exists()) {
- PrintWriter p = new PrintWriter(new BufferedWriter(new FileWriter(f)));
- Map<String, IAConfiguration> cfgs = getSavedConfigs(project);
- if (cfgs == null)
- return;
- p.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); //$NON-NLS-1$
- p.println("<configurations>"); // $NON-NLS-1$
- Option[] optionList = AutotoolsConfiguration.getOptionList();
- HashSet<String> savedIds = new HashSet<String>();
- setSyncing(true);
- for (int x = 0; x < cfgds.length; ++x) {
- ICConfigurationDescription cfgd = cfgds[x];
- @SuppressWarnings("unused")
- CConfigurationData data = cfgd.getConfigurationData();
- String id = cfgd.getId();
- savedIds.add(id);
- IAConfiguration cfg = getTmpConfiguration(project, cfgd);
- cfgs.put(id, cfg); // add to list in case we have a new configuration not yet added to Project Description
+ IRemoteFileProxy proxy = RemoteProxyManager.getInstance().getFileProxy(project);
+ IFileStore f = proxy.getResource(output.toString());
+ PrintWriter p = new PrintWriter(new BufferedWriter(new OutputStreamWriter(f.openOutputStream(EFS.NONE, new NullProgressMonitor()))));
+ Map<String, IAConfiguration> cfgs = getSavedConfigs(project);
+ if (cfgs == null)
+ return;
+ p.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); //$NON-NLS-1$
+ p.println("<configurations>"); // $NON-NLS-1$
+ Option[] optionList = AutotoolsConfiguration.getOptionList();
+ HashSet<String> savedIds = new HashSet<String>();
+ setSyncing(true);
+ for (int x = 0; x < cfgds.length; ++x) {
+ ICConfigurationDescription cfgd = cfgds[x];
+ @SuppressWarnings("unused")
+ CConfigurationData data = cfgd.getConfigurationData();
+ String id = cfgd.getId();
+ savedIds.add(id);
+ IAConfiguration cfg = getTmpConfiguration(project, cfgd);
+ cfgs.put(id, cfg); // add to list in case we have a new configuration not yet added to Project Description
+ p.println("<configuration id=\"" + id + "\">"); //$NON-NLS-1$ //$NON-NLS-2$
+ for (int j = 0; j < optionList.length; ++j) {
+ Option option = optionList[j];
+ IConfigureOption opt = cfg.getOption(option.getName());
+ if (!opt.isCategory())
+ p.println("<option id=\"" + option.getName() + "\" value=\"" + opt.getValue() + "\"/>"); //$NON-NLS-1$ //$NON-NLS-2$ // $NON-NLS-3$
+ }
+ p.println("</configuration>"); //$NON-NLS-1$
+ syncNameField(cfgd);
+ }
+ setSyncing(false);
+
+ // Put all the remaining configurations already saved back into the file.
+ // These represent deleted configurations, but confirmation has not occurred.
+ for (Iterator<String> i = cfgs.keySet().iterator(); i.hasNext(); ) {
+ String id = i.next();
+ // A remaining id won't appear in our savedIds list.
+ if (!savedIds.contains(id)) {
+ IAConfiguration cfg = cfgs.get(id);
p.println("<configuration id=\"" + id + "\">"); //$NON-NLS-1$ //$NON-NLS-2$
for (int j = 0; j < optionList.length; ++j) {
Option option = optionList[j];
@@ -428,31 +458,11 @@ public class AutotoolsConfigurationManager implements IResourceChangeListener {
p.println("<option id=\"" + option.getName() + "\" value=\"" + opt.getValue() + "\"/>"); //$NON-NLS-1$ //$NON-NLS-2$ // $NON-NLS-3$
}
p.println("</configuration>"); //$NON-NLS-1$
- syncNameField(cfgd);
}
- setSyncing(false);
-
- // Put all the remaining configurations already saved back into the file.
- // These represent deleted configurations, but confirmation has not occurred.
- for (Iterator<String> i = cfgs.keySet().iterator(); i.hasNext(); ) {
- String id = i.next();
- // A remaining id won't appear in our savedIds list.
- if (!savedIds.contains(id)) {
- IAConfiguration cfg = cfgs.get(id);
- p.println("<configuration id=\"" + id + "\">"); //$NON-NLS-1$ //$NON-NLS-2$
- for (int j = 0; j < optionList.length; ++j) {
- Option option = optionList[j];
- IConfigureOption opt = cfg.getOption(option.getName());
- if (!opt.isCategory())
- p.println("<option id=\"" + option.getName() + "\" value=\"" + opt.getValue() + "\"/>"); //$NON-NLS-1$ //$NON-NLS-2$ // $NON-NLS-3$
- }
- p.println("</configuration>"); //$NON-NLS-1$
- }
- }
- p.println("</configurations>");
- p.close();
}
- } catch (IOException e) {
+ p.println("</configurations>");
+ p.close();
+ } catch (CoreException e) {
AutotoolsPlugin.log(e);
}
}

Back to the top