Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlain Magloire2004-02-18 03:50:38 +0000
committerAlain Magloire2004-02-18 03:50:38 +0000
commit7c2f688b9a74426697300906ffbd6f439fc6718e (patch)
treef6829081e052a7eb8438772166e558728613f42b /core/org.eclipse.cdt.core.win32
parent50f8f8a971806a361824a6ae8a5de48f967da046 (diff)
downloadorg.eclipse.cdt-7c2f688b9a74426697300906ffbd6f439fc6718e.tar.gz
org.eclipse.cdt-7c2f688b9a74426697300906ffbd6f439fc6718e.tar.xz
org.eclipse.cdt-7c2f688b9a74426697300906ffbd6f439fc6718e.zip
Use Eclipse 3.o API to find the fragment location.
Diffstat (limited to 'core/org.eclipse.cdt.core.win32')
-rw-r--r--core/org.eclipse.cdt.core.win32/ChangeLog7
-rw-r--r--core/org.eclipse.cdt.core.win32/src/org/eclipse/cdt/internal/core/win32/ProcessList.java49
2 files changed, 26 insertions, 30 deletions
diff --git a/core/org.eclipse.cdt.core.win32/ChangeLog b/core/org.eclipse.cdt.core.win32/ChangeLog
index 8ab4304bdc3..bd84d12c4fa 100644
--- a/core/org.eclipse.cdt.core.win32/ChangeLog
+++ b/core/org.eclipse.cdt.core.win32/ChangeLog
@@ -1,3 +1,10 @@
+2004-02-17 Alain Magloire
+
+ Remove old Eclipse2.0 interface and
+ use what 3.0 provides instead.
+
+ * src/org/eclipse/cdt/internal/core/win32/ProcessList.java
+
2004-02-12 Alex Chapiro
Update starter and spawner to use named pipes.
diff --git a/core/org.eclipse.cdt.core.win32/src/org/eclipse/cdt/internal/core/win32/ProcessList.java b/core/org.eclipse.cdt.core.win32/src/org/eclipse/cdt/internal/core/win32/ProcessList.java
index 6ffe99c723e..1469ec3cc5d 100644
--- a/core/org.eclipse.cdt.core.win32/src/org/eclipse/cdt/internal/core/win32/ProcessList.java
+++ b/core/org.eclipse.cdt.core.win32/src/org/eclipse/cdt/internal/core/win32/ProcessList.java
@@ -5,7 +5,6 @@ import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
-import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
@@ -13,10 +12,9 @@ import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.IProcessInfo;
import org.eclipse.cdt.core.IProcessList;
import org.eclipse.cdt.utils.spawner.ProcessFactory;
-import org.eclipse.core.boot.BootLoader;
import org.eclipse.core.runtime.IPluginDescriptor;
-import org.eclipse.core.runtime.model.PluginDescriptorModel;
-import org.eclipse.core.runtime.model.PluginFragmentModel;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
/*
* Currently this will only work for Windows XP since tasklist
@@ -33,33 +31,23 @@ public class ProcessList implements IProcessList {
Process p = null;
String command = null;
InputStream in = null;
- IPluginDescriptor desc = CCorePlugin.getDefault().getDescriptor();
- if (desc instanceof PluginDescriptorModel) {
- PluginDescriptorModel model = (PluginDescriptorModel) desc;
- PluginFragmentModel[] fragments = model.getFragments();
- for (int i = 0; i < fragments.length; i++) {
- String location = fragments[i].getLocation();
- try {
- URL url = new URL(location + "/os/" + BootLoader.getOS() + "/" + BootLoader.getOSArch());
- File path = new File(url.getFile(), "listtasks.exe");
- if (path.exists()) {
- command = path.getCanonicalPath();
- break;
- }
- } catch (MalformedURLException e1) {
- } catch (IOException e) {
- }
- }
- }
- if (command != null) {
- try {
+ IPluginDescriptor desc = CCorePlugin.getDefault().getDescriptor();
+ try {
+ URL url = desc.find(new Path("$os$/listtasks.exe"));
+ url = Platform.resolve(url);
+ String path = url.getFile();
+ File file = new File(path);
+ if (file.exists()) {
+ command = file.getCanonicalPath();
+ if (command != null) {
p = ProcessFactory.getFactory().exec(command);
in = p.getInputStream();
InputStreamReader reader = new InputStreamReader(in);
return parseListTasks(reader);
- } catch (IOException e) {
}
}
+ } catch (IOException e) {
+ }
return NOPROCESS;
}
@@ -73,11 +61,12 @@ public class ProcessList implements IProcessList {
if (tab != -1) {
String proc = line.substring(0, tab).trim();
String name = line.substring(tab).trim();
- try {
- int pid = Integer.parseInt(proc);
- processList.add(new ProcessInfo(pid, name));
- } catch (NumberFormatException e) {
- name = null;
+ if (proc.length() > 0 && name.length() > 0) {
+ try {
+ int pid = Integer.parseInt(proc);
+ processList.add(new ProcessInfo(pid, name));
+ } catch (NumberFormatException e) {
+ }
}
}
}

Back to the top