Skip to content

Commit

Permalink
[launch] change MakeGoodLaunchConfigurationDelegate to use own `get…
Browse files Browse the repository at this point in the history
…DebuggerConfiguration()` instead of `PHPDebuggersRegistry.getDebuggerConfiguration()` #77

This changes will avoid `java.lang.NoSuchMethodError` as the following:

java.lang.NoSuchMethodError: org.eclipse.php.internal.debug.core.preferences.PHPDebuggersRegistry.getDebuggerConfiguration(Ljava/lang/String;)Lorg/eclipse/php/internal/debug/core/debugger/AbstractDebuggerConfiguration;
	at com.piece_framework.makegood.launch.MakeGoodLaunchConfigurationDelegate.rewriteBasicConfigurationAttributes(MakeGoodLaunchConfigurationDelegate.java:290)
	at com.piece_framework.makegood.launch.MakeGoodLaunchConfigurationDelegate.createConfiguration(MakeGoodLaunchConfigurationDelegate.java:268)
	at com.piece_framework.makegood.launch.MakeGoodLaunchConfigurationDelegate.getLaunch(MakeGoodLaunchConfigurationDelegate.java:86)
	at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:812)
	at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:739)
	at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1039)
	at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1256)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
  • Loading branch information
iteman committed May 28, 2015
1 parent 2e3ba94 commit ae44ff0
Showing 1 changed file with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Copyright (c) 2009-2010 MATSUFUJI Hideharu <[email protected]>,
* 2010-2013 KUBO Atsuhiro <[email protected]>,
* 2010-2013, 2015 KUBO Atsuhiro <[email protected]>,
* All rights reserved.
*
* This file is part of MakeGood.
Expand Down Expand Up @@ -34,6 +34,7 @@
import org.eclipse.php.debug.core.debugger.parameters.IDebugParametersKeys;
import org.eclipse.php.internal.debug.core.IPHPDebugConstants;
import org.eclipse.php.internal.debug.core.PHPDebugPlugin;
import org.eclipse.php.internal.debug.core.debugger.IDebuggerConfiguration;
import org.eclipse.php.internal.debug.core.launching.PHPLaunchDelegateProxy;
import org.eclipse.php.internal.debug.core.preferences.PHPDebugCorePreferenceNames;
import org.eclipse.php.internal.debug.core.preferences.PHPDebuggersRegistry;
Expand Down Expand Up @@ -283,7 +284,7 @@ private void rewriteBasicConfigurationAttributes(ILaunchConfigurationWorkingCopy
if (phpexeItem == null) return;

workingCopy.setAttribute(PHPDebugCorePreferenceNames.PHP_DEBUGGER_ID, phpexeItem.getDebuggerID());
workingCopy.setAttribute(PHPDebugCorePreferenceNames.CONFIGURATION_DELEGATE_CLASS, PHPDebuggersRegistry.getDebuggerConfiguration(phpexeItem.getDebuggerID()).getScriptLaunchDelegateClass());
workingCopy.setAttribute(PHPDebugCorePreferenceNames.CONFIGURATION_DELEGATE_CLASS, getDebuggerConfiguration(phpexeItem.getDebuggerID()).getScriptLaunchDelegateClass());
workingCopy.setAttribute(IPHPDebugConstants.ATTR_EXECUTABLE_LOCATION, phpexeItem.getExecutable().getAbsolutePath().toString());
workingCopy.setAttribute(IPHPDebugConstants.ATTR_INI_LOCATION, phpexeItem.getINILocation() != null ? phpexeItem.getINILocation().toString() : null);
workingCopy.setAttribute(IPHPDebugConstants.RUN_WITH_DEBUG_INFO, PHPDebugPlugin.getDebugInfoOption());
Expand All @@ -298,4 +299,17 @@ private void cancelLaunch(IProgressMonitor monitor) {
monitor.setCanceled(true);
cancelLaunch();
}

/**
* @since 3.2.0
*/
private static IDebuggerConfiguration getDebuggerConfiguration(String debuggerId) {
for (IDebuggerConfiguration debuggerConfiguration: PHPDebuggersRegistry.getDebuggersConfigurations()) {
if (debuggerId.equals(debuggerConfiguration.getDebuggerId())) {
return debuggerConfiguration;
}
}

return null;
}
}

2 comments on commit ae44ff0

@gschafra
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caused by API change in PDT 3.5. See eclipse-pdt/pdt@09cd85b

@zulus
Copy link

@zulus zulus commented on ae44ff0 May 29, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If PDT can do anything to keep BC tell me, we still have a time for final 3.5 release.

Please sign in to comment.