import java.util.ArrayList;
import java.util.List;
+import net.sourceforge.phpdt.debug.ui.PHPDebugUiConstants;
+import net.sourceforge.phpdt.internal.debug.ui.PHPDebugUiMessages;
+import net.sourceforge.phpdt.internal.debug.ui.PHPDebugUiPlugin;
+import net.sourceforge.phpdt.internal.launching.PHPLaunchConfigurationAttribute;
+import net.sourceforge.phpdt.internal.ui.util.PHPFileUtil;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
-import net.sourceforge.phpdt.debug.ui.PHPDebugUiConstants;
-import net.sourceforge.phpdt.internal.debug.ui.PHPDebugUiMessages;
-import net.sourceforge.phpdt.internal.debug.ui.PHPDebugUiPlugin;
-import net.sourceforge.phpdt.internal.launching.PHPLaunchConfigurationAttribute;
public class PHPLaunchShortcut implements ILaunchShortcut {
public PHPLaunchShortcut() {
}
-
+
public void launch(ISelection selection, String mode) {
- if (selection instanceof IStructuredSelection) {
+ if (selection instanceof IStructuredSelection) {
Object firstSelection = ((IStructuredSelection)selection).getFirstElement();
- if (firstSelection instanceof IFile) {
- if (
- ((IFile) firstSelection).getFileExtension().equals("php") ||
- ((IFile) firstSelection).getFileExtension().equals("php3") ||
- ((IFile) firstSelection).getFileExtension().equals("php4")
- ) {
+ if (firstSelection instanceof IFile) {
+ if (PHPFileUtil.isPHPFile((IFile) firstSelection)) {
ILaunchConfiguration config = findLaunchConfiguration((IFile)firstSelection, mode);
try {
if (config != null)
}
protected void log(String message) {
- PHPDebugUiPlugin.getDefault().log(new Status(Status.INFO, PHPDebugUiPlugin.PLUGIN_ID, Status.INFO, message, null));
+ PHPDebugUiPlugin.log(new Status(Status.INFO, PHPDebugUiPlugin.PLUGIN_ID, Status.INFO, message, null));
}
protected void log(Throwable t) {
- PHPDebugUiPlugin.getDefault().log(t);
+ PHPDebugUiPlugin.log(t);
}
}