1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-21 21:52:10 +02:00

Bug 547186: Remove use of depracated Platform API

Change-Id: I5253633692a8619dabff28c542fda12c1d2fe9a9
This commit is contained in:
Jonah Graham 2019-05-11 21:22:42 -04:00
parent 62617729fa
commit 7f7ff20e6b
3 changed files with 20 additions and 14 deletions

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.examples.dsf.pda;singleton:=true
Bundle-Version: 2.1.1.qualifier
Bundle-Version: 2.1.100.qualifier
Bundle-Activator: org.eclipse.cdt.examples.dsf.pda.PDAPlugin
Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime,

View file

@ -16,8 +16,6 @@
package org.eclipse.cdt.examples.dsf.pda;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.concurrent.ExecutionException;
@ -153,13 +151,18 @@ public class PDAPlugin extends Plugin {
* <code>IPath</code> in the plugin directory, or <code>null</code> if none.
*/
public static File getFileInPlugin(IPath path) {
try {
URL installURL = new URL(getDefault().getDescriptor().getInstallURL(), path.toString());
URL localURL = Platform.asLocalURL(installURL);
return new File(localURL.getFile());
} catch (IOException ioe) {
return null;
if (true) {
throw new RuntimeException(
"The commented out code below has not worked in many years with a NullPointerException. Now the API that was returning null has been removed, see Bug 475944");
}
return null;
// try {
// URL installURL = new URL(getDefault().getDescriptor().getInstallURL(), path.toString());
// URL localURL = Platform.asLocalURL(installURL);
// return new File(localURL.getFile());
// } catch (IOException ioe) {
// return null;
// }
}
/**

View file

@ -38,7 +38,6 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.debug.core.DebugPlugin;
@ -243,11 +242,15 @@ public class PDABackend extends AbstractDsfService {
commandList.add(javaVMExec);
commandList.add("-cp");
try {
commandList.add(File.pathSeparator + PDAPlugin.getFileInPlugin(new Path("bin")) + File.pathSeparator
+ new File(Platform.asLocalURL(PDAPlugin.getDefault().getDescriptor().getInstallURL()).getFile()));
} catch (IOException e) {
if (true) {
throw new RuntimeException(
"The commented out code below has not worked in many years with a NullPointerException. Now the API that was returning null has been removed, see Bug 475944");
}
// try {
// commandList.add(File.pathSeparator + PDAPlugin.getFileInPlugin(new Path("bin")) + File.pathSeparator
// + new File(Platform.asLocalURL(PDAPlugin.getDefault().getDescriptor().getInstallURL()).getFile()));
// } catch (IOException e) {
// }
commandList.add("org.eclipse.cdt.examples.pdavm.PDAVirtualMachine");