/*******************************************************************************
* Copyright (c) 2000, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
+ * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
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 net.sourceforge.phpdt.internal.ui.util.ExceptionHandler;
-
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.internal.ui.actions.ActionMessages;
import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.ITextSelection;
/**
* Toggles a line breakpoint in a Java editor.
- *
+ *
* @since 3.0
*/
public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget {
-
+
protected void report(String message, IWorkbenchPart part) {
IEditorStatusLine statusLine= (IEditorStatusLine) part.getAdapter(IEditorStatusLine.class);
if (statusLine != null) {
} else {
statusLine.setMessage(true, null, null);
}
- }
+ }
if (message != null && PHPDebugUiPlugin.getActiveWorkbenchShell() != null) {
PHPDebugUiPlugin.getActiveWorkbenchShell().getDisplay().beep();
}
}
-
+
// protected IType getType(ITextSelection selection) {
// IMember member= ActionDelegateHelper.getDefault().getCurrentMember(selection);
// IType type= null;
// PHPDebugUiPlugin.log(e);
// }
// return type;
-// }
-
+// }
+
/* (non-Javadoc)
* @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#toggleLineBreakpoints(IWorkbenchPart, ISelection)
*/
// }
// }
// }
-
+
// String typeName= null;
IResource resource;
PHPLineBreakpoint breakpoint= null;
}
// } else {
// typeName= type.getFullyQualifiedName();
-// PHPLineBreakpoint breakpoint=PHPDebugModel.lineBreakpointExists(lineNumber);
-// if (breakpoint==null)
+// PHPLineBreakpoint breakpoint=PHPDebugModel.lineBreakpointExists(lineNumber);
+// if (breakpoint==null)
// PHPDebugModel.createLineBreakpoint(getFile(), lineNumber, 0, true, null);
// else
-// DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint( breakpoint, true );
-//
+// DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint( breakpoint, true );
+//
PHPLineBreakpoint existingBreakpoint= PHPDebugModel.lineBreakpointExists(lineNumber); //typeName, lineNumber);
if (existingBreakpoint != null) {
DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint(existingBreakpoint, true);
// }
return false;
}
-
+
protected IMethod[] getMethods(IStructuredSelection selection) {
if (selection.isEmpty()) {
return new IMethod[0];
while (iterator.hasNext()) {
Object thing = iterator.next();
try {
- if (thing instanceof IMethod && !Flags.isAbstract(((IMethod)thing).getFlags())) {
+ 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()) {
// return new IField[0];
// Iterator iterator = selection.iterator();
// while (iterator.hasNext()) {
// Object thing = iterator.next();
-// if (thing instanceof IField) {
+// if (thing instanceof IField) {
// fields.add(thing);
// } else if (thing instanceof IJavaFieldVariable) {
// IField field= getField((IJavaFieldVariable) thing);
// }
// return (IField[]) fields.toArray(new IField[fields.size()]);
// }
-// }
+// }
/* (non-Javadoc)
* @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#toggleWatchpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
// }
// }
}
-
+
public static String resolveMethodSignature(IType type, String methodSignature) throws JavaModelException {
String[] parameterTypes= Signature.getParameterTypes(methodSignature);
int length= 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);
// 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();
}
return resource;
}
-
+
/**
* Returns a handle to the specified method or <code>null</code> if none.
- *
+ *
* @param editorPart the editor containing the method
* @param typeName
* @param methodName
}
return null;
}
-
+
// protected IJavaBreakpoint getBreakpoint(IMember element) {
// IBreakpointManager breakpointManager= DebugPlugin.getDefault().getBreakpointManager();
// IBreakpoint[] breakpoints= breakpointManager.getBreakpoints(JDIDebugModel.getPluginIdentifier());
// JDIDebugUIPlugin.log(e);
// }
// }
-// }
+// }
// }
// return null;
// }
// return (breakpointField.getElementName().equals(watchpoint.getFieldName()) &&
// breakpointField.getDeclaringType().getFullyQualifiedName().equals(watchpoint.getTypeName()));
// }
-//
+//
// protected CompilationUnit parseCompilationUnit(ITextEditor editor) {
// IEditorInput editorInput = editor.getEditorInput();
// IDocument document= editor.getDocumentProvider().getDocument(editorInput);
// parser.setSource(document.get().toCharArray());
// return (CompilationUnit) parser.createAST(null);
// }
-
+
/* (non-Javadoc)
* @see org.eclipse.debug.ui.actions.IToggleBreakpointsTarget#canToggleWatchpoints(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
*/
// }
return false;
}
-
+
/**
* Returns a selection of the member in the given text selection,
* or the original selection if none.
- *
+ *
* @param part
* @param selection
* @return a structured selection of the member in the given text selection,
// }
/**
- * Returns a list of matching types (IType - Java model) that correspond to the
+ * Returns a list of matching types (IType - Java model) that correspond to the
* declaring type (ReferenceType - JDI model) of the given variable.
*/
// protected static List searchForDeclaringType(IJavaFieldVariable variable) {
// if (launch == null) {
// return types;
// }
-//
+//
// ILaunchConfiguration configuration= launch.getLaunchConfiguration();
// IJavaProject[] javaProjects = null;
// IWorkspace workspace= ResourcesPlugin.getWorkspace();
// ArrayList typeRefsFound= new ArrayList(3);
// ITypeNameRequestor requestor= new TypeInfoRequestor(typeRefsFound);
// try {
-// engine.searchAllTypeNames(
-// getPackage(declaringType),
-// getTypeName(declaringType),
-// SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE,
-// IJavaSearchConstants.CLASS,
-// scope,
-// requestor,
+// engine.searchAllTypeNames(
+// getPackage(declaringType),
+// getTypeName(declaringType),
+// SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE,
+// IJavaSearchConstants.CLASS,
+// scope,
+// requestor,
// IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
// null);
// } catch (JavaModelException x) {
// }
// return types;
// }
-
+
/**
* Returns the package name of the given fully qualified type name.
- * The package name is assumed to be the dot-separated prefix of the
+ * The package name is assumed to be the dot-separated prefix of the
* type name.
*/
// protected static char[] getPackage(String fullyQualifiedName) {
// }
// return fullyQualifiedName.substring(0, index).toCharArray();
// }
-//
+//
// /**
// * Returns a simple type name from the given fully qualified type name.
-// * The type name is assumed to be the last contiguous segment of the
+// * The type name is assumed to be the last contiguous segment of the
// * fullyQualifiedName not containing a '.' or '$'
// */
// protected static char[] getTypeName(String fullyQualifiedName) {
// }
// return typeName.toCharArray();
// }
-//
+//
// /**
// * Return the associated IField (Java model) for the given
// * IJavaFieldVariable (JDI model)
// }
// }
// return null;
-// }
+// }
}