*******************************************************************************/
package net.sourceforge.phpdt.internal.debug.ui.actions;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
+//import java.util.ArrayList;
+//import java.util.Iterator;
+//import java.util.List;
-import net.sourceforge.phpdt.core.Flags;
-import net.sourceforge.phpdt.core.ICompilationUnit;
-import net.sourceforge.phpdt.core.IJavaElement;
-import net.sourceforge.phpdt.core.IMethod;
-import net.sourceforge.phpdt.core.IType;
-import net.sourceforge.phpdt.core.JavaModelException;
-import net.sourceforge.phpdt.core.Signature;
+//import net.sourceforge.phpdt.core.Flags;
+//import net.sourceforge.phpdt.core.ICompilationUnit;
+//import net.sourceforge.phpdt.core.IJavaElement;
+//import net.sourceforge.phpdt.core.IMethod;
+//import net.sourceforge.phpdt.core.IType;
+//import net.sourceforge.phpdt.core.JavaModelException;
+//import net.sourceforge.phpdt.core.Signature;
import net.sourceforge.phpdt.debug.core.PHPDebugModel;
import net.sourceforge.phpdt.internal.debug.core.breakpoints.PHPLineBreakpoint;
import net.sourceforge.phpdt.internal.debug.ui.PHPDebugUiPlugin;
//import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.ITextSelection;
import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
+//import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IFileEditorInput;
// String typeName= null;
IResource resource;
- PHPLineBreakpoint breakpoint = null;
+ //PHPLineBreakpoint breakpoint = null;
// if (type == null) {
if (editorInput instanceof IFileEditorInput) {
resource = ((IFileEditorInput) editorInput).getFile();
.removeBreakpoint(existingBreakpoint, true);
return;
} else {
- breakpoint = PHPDebugModel.createLineBreakpoint(resource,
- lineNumber, 0, true, null);
+// breakpoint = PHPDebugModel.createLineBreakpoint(resource,
+// lineNumber, 0, true, null);
}
// }
// new BreakpointLocationVerifierJob(document, breakpoint,
return false;
}
- protected IMethod[] getMethods(IStructuredSelection selection) {
- if (selection.isEmpty()) {
- return new IMethod[0];
- } else {
- List methods = new ArrayList(selection.size());
- Iterator iterator = selection.iterator();
- while (iterator.hasNext()) {
- Object thing = iterator.next();
- try {
- if (thing instanceof IMethod
- && !Flags.isAbstract(((IMethod) thing).getFlags())) {
- methods.add(thing);
- }
- } catch (JavaModelException e) {
- }
- }
- return (IMethod[]) methods.toArray(new IMethod[methods.size()]);
- }
- }
+// protected IMethod[] getMethods(IStructuredSelection selection) {
+// if (selection.isEmpty()) {
+// return new IMethod[0];
+// } else {
+// List methods = new ArrayList(selection.size());
+// Iterator iterator = selection.iterator();
+// while (iterator.hasNext()) {
+// Object thing = iterator.next();
+// try {
+// if (thing instanceof IMethod
+// && !Flags.isAbstract(((IMethod) thing).getFlags())) {
+// methods.add(thing);
+// }
+// } catch (JavaModelException e) {
+// }
+// }
+// return (IMethod[]) methods.toArray(new IMethod[methods.size()]);
+// }
+// }
// protected IField[] getFields(IStructuredSelection selection) {
// if (selection.isEmpty()) {
// }
}
- public static String resolveMethodSignature(IType type,
- String methodSignature) throws JavaModelException {
- String[] parameterTypes = Signature.getParameterTypes(methodSignature);
- int length = parameterTypes.length;
- String[] resolvedParameterTypes = new String[length];
-
- for (int i = 0; i < length; i++) {
- resolvedParameterTypes[i] = resolveType(type, parameterTypes[i]);
- if (resolvedParameterTypes[i] == null) {
- return null;
- }
- }
-
- String resolvedReturnType = resolveType(type, Signature
- .getReturnType(methodSignature));
- if (resolvedReturnType == null) {
- return null;
- }
-
- return Signature.createMethodSignature(resolvedParameterTypes,
- resolvedReturnType);
- }
+// public static String resolveMethodSignature(IType type,
+// String methodSignature) throws JavaModelException {
+// String[] parameterTypes = Signature.getParameterTypes(methodSignature);
+// int length = parameterTypes.length;
+// String[] resolvedParameterTypes = new String[length];
+//
+// for (int i = 0; i < length; i++) {
+// resolvedParameterTypes[i] = resolveType(type, parameterTypes[i]);
+// if (resolvedParameterTypes[i] == null) {
+// return null;
+// }
+// }
+//
+// String resolvedReturnType = resolveType(type, Signature
+// .getReturnType(methodSignature));
+// if (resolvedReturnType == null) {
+// return null;
+// }
+//
+// return Signature.createMethodSignature(resolvedParameterTypes,
+// resolvedReturnType);
+// }
- private static String resolveType(IType type, String typeSignature)
- throws JavaModelException {
- // int count= Signature.getArrayCount(typeSignature);
- // String elementTypeSignature= Signature.getElementType(typeSignature);
- // if (elementTypeSignature.length() == 1) {
- // // no need to resolve primitive types
- // return typeSignature;
- // }
- // String elementTypeName= Signature.toString(elementTypeSignature);
- // String[][] resolvedElementTypeNames=
- // type.resolveType(elementTypeName);
- // if (resolvedElementTypeNames == null ||
- // resolvedElementTypeNames.length != 1) {
- // // the type name cannot be resolved
- // return null;
- // }
- // String resolvedElementTypeName=
- // Signature.toQualifiedName(resolvedElementTypeNames[0]);
- // String resolvedElementTypeSignature=
- // Signature.createTypeSignature(resolvedElementTypeName,
- // true).replace('.', '/');
- // return Signature.createArraySignature(resolvedElementTypeSignature,
- // count);
- return "";
- }
+// private static String resolveType(IType type, String typeSignature)
+// throws JavaModelException {
+// // int count= Signature.getArrayCount(typeSignature);
+// // String elementTypeSignature= Signature.getElementType(typeSignature);
+// // if (elementTypeSignature.length() == 1) {
+// // // no need to resolve primitive types
+// // return typeSignature;
+// // }
+// // String elementTypeName= Signature.toString(elementTypeSignature);
+// // String[][] resolvedElementTypeNames=
+// // type.resolveType(elementTypeName);
+// // if (resolvedElementTypeNames == null ||
+// // resolvedElementTypeNames.length != 1) {
+// // // the type name cannot be resolved
+// // return null;
+// // }
+// // String resolvedElementTypeName=
+// // Signature.toQualifiedName(resolvedElementTypeNames[0]);
+// // String resolvedElementTypeSignature=
+// // Signature.createTypeSignature(resolvedElementTypeName,
+// // true).replace('.', '/');
+// // return Signature.createArraySignature(resolvedElementTypeSignature,
+// // count);
+// return "";
+// }
- protected static IResource getResource(IEditorPart editor) {
- IResource resource;
- IEditorInput editorInput = editor.getEditorInput();
- if (editorInput instanceof IFileEditorInput) {
- resource = ((IFileEditorInput) editorInput).getFile();
- } else {
- resource = ResourcesPlugin.getWorkspace().getRoot();
- }
- return resource;
- }
+// protected static IResource getResource(IEditorPart editor) {
+// IResource resource;
+// IEditorInput editorInput = editor.getEditorInput();
+// if (editorInput instanceof IFileEditorInput) {
+// resource = ((IFileEditorInput) editorInput).getFile();
+// } else {
+// resource = ResourcesPlugin.getWorkspace().getRoot();
+// }
+// return resource;
+// }
/**
* Returns a handle to the specified method or <code>null</code> if none.
* @param signature
* @return handle or <code>null</code>
*/
- protected IMethod getMethodHandle(IEditorPart editorPart, String typeName,
- String methodName, String signature) throws CoreException {
- IJavaElement element = (IJavaElement) editorPart.getEditorInput()
- .getAdapter(IJavaElement.class);
- IType type = null;
- if (element instanceof ICompilationUnit) {
- IType[] types = ((ICompilationUnit) element).getAllTypes();
- for (int i = 0; i < types.length; i++) {
- if (types[i].getFullyQualifiedName().equals(typeName)) {
- type = types[i];
- break;
- }
- }
- }
- // else if (element instanceof IClassFile) {
- // type = ((IClassFile)element).getType();
- // }
- if (type != null) {
- String[] sigs = Signature.getParameterTypes(signature);
- return type.getMethod(methodName, sigs);
- }
- return null;
- }
+// protected IMethod getMethodHandle(IEditorPart editorPart, String typeName,
+// String methodName, String signature) throws CoreException {
+// IJavaElement element = (IJavaElement) editorPart.getEditorInput()
+// .getAdapter(IJavaElement.class);
+// IType type = null;
+// if (element instanceof ICompilationUnit) {
+// IType[] types = ((ICompilationUnit) element).getAllTypes();
+// for (int i = 0; i < types.length; i++) {
+// if (types[i].getFullyQualifiedName().equals(typeName)) {
+// type = types[i];
+// break;
+// }
+// }
+// }
+// // else if (element instanceof IClassFile) {
+// // type = ((IClassFile)element).getType();
+// // }
+// if (type != null) {
+// String[] sigs = Signature.getParameterTypes(signature);
+// return type.getMethod(methodName, sigs);
+// }
+// return null;
+// }
// protected IJavaBreakpoint getBreakpoint(IMember element) {
// IBreakpointManager breakpointManager=
package net.sourceforge.phpdt.internal.debug.ui.launcher;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
+//import org.eclipse.core.resources.IFile;
+//import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.QualifiedName;
public class ExecutionArguments {
protected String interpreterArguments, phpFileArguments;
- public static ExecutionArguments getExecutionArguments(IFile phpScriptFile) {
- try {
- String executionArgumentsPersistableFormat = phpScriptFile
- .getPersistentProperty(EXECUTION_ARGUMENTS_PROPERTY);
- ExecutionArguments executionArguments = new ExecutionArguments();
-
- if (executionArgumentsPersistableFormat != null) {
- int argBreakIndex = executionArgumentsPersistableFormat
- .indexOf(ARGUMENT_SEPARATOR);
- executionArguments
- .setInterpreterArguments(executionArgumentsPersistableFormat
- .substring(0, argBreakIndex));
- executionArguments
- .setPHPFileArguments(executionArgumentsPersistableFormat
- .substring(argBreakIndex
- + ARGUMENT_SEPARATOR.length()));
- }
-
- return executionArguments;
- } catch (CoreException e) {
- }
-
- return null;
- }
-
- public static void setExecutionArguments(IFile phpScriptFile,
- ExecutionArguments arguments) {
- try {
- phpScriptFile.setPersistentProperty(EXECUTION_ARGUMENTS_PROPERTY,
- arguments.toPersistableFormat());
- } catch (CoreException e) {
- }
- }
-
- public void setInterpreterArguments(String theArguments) {
- interpreterArguments = theArguments;
- }
-
- public void setPHPFileArguments(String theArguments) {
- phpFileArguments = theArguments;
- }
-
- public String toPersistableFormat() {
- return interpreterArguments + ARGUMENT_SEPARATOR + phpFileArguments;
- }
+// public static ExecutionArguments getExecutionArguments(IFile phpScriptFile) {
+// try {
+// String executionArgumentsPersistableFormat = phpScriptFile
+// .getPersistentProperty(EXECUTION_ARGUMENTS_PROPERTY);
+// ExecutionArguments executionArguments = new ExecutionArguments();
+//
+// if (executionArgumentsPersistableFormat != null) {
+// int argBreakIndex = executionArgumentsPersistableFormat
+// .indexOf(ARGUMENT_SEPARATOR);
+// executionArguments
+// .setInterpreterArguments(executionArgumentsPersistableFormat
+// .substring(0, argBreakIndex));
+// executionArguments
+// .setPHPFileArguments(executionArgumentsPersistableFormat
+// .substring(argBreakIndex
+// + ARGUMENT_SEPARATOR.length()));
+// }
+//
+// return executionArguments;
+// } catch (CoreException e) {
+// }
+//
+// return null;
+// }
+
+// public static void setExecutionArguments(IFile phpScriptFile,
+// ExecutionArguments arguments) {
+// try {
+// phpScriptFile.setPersistentProperty(EXECUTION_ARGUMENTS_PROPERTY,
+// arguments.toPersistableFormat());
+// } catch (CoreException e) {
+// }
+// }
+
+// public void setInterpreterArguments(String theArguments) {
+// interpreterArguments = theArguments;
+// }
+
+// public void setPHPFileArguments(String theArguments) {
+// phpFileArguments = theArguments;
+// }
+
+// public String toPersistableFormat() {
+// return interpreterArguments + ARGUMENT_SEPARATOR + phpFileArguments;
+// }
}
\ No newline at end of file