Commit 45480e99 authored by andrei's avatar andrei

Get rid of broken breakpoints code

parent 5507d7c4
......@@ -191,7 +191,7 @@
<contentTypeBinding contentTypeId="org.eclipse.jdt.core.javaClass"/>
</editor>
</extension>
<!-- replacement for org.eclipse.debug.ui.actions.RulerToggleBreakpointActionDelegate,
required for toggle breakpoint by double-click in editor ruler in class files -->
<extension
......@@ -212,7 +212,7 @@
<toc file="doc/toc.xml" primary="true" />
</extension>
<!-- because of org.eclipse.jdt.internal.ui.javaeditor.ClassFileEditor replacement -->
<!-- because of org.eclipse.jdt.internal.ui.javaeditor.ClassFileEditor replacement
<extension point="org.eclipse.core.runtime.adapters">
<factory
class="org.eclipse.jdt.internal.debug.ui.actions.RetargettableActionAdapterFactory"
......@@ -220,7 +220,7 @@
<adapter type="org.eclipse.debug.ui.actions.IRunToLineTarget"/>
<adapter type="org.eclipse.debug.ui.actions.IToggleBreakpointsTarget"/>
</factory>
</extension>
</extension> -->
<extension
point="org.eclipse.ui.preferencePages">
<page
......
......@@ -61,9 +61,7 @@ import de.loskutov.bco.ui.JdtUtils;
* A "better" way to hook into JDT...
* @author Eugene Kuleshov, V. Grishchenko, Jochen Klein, Andrei Loskutov
*/
public class BytecodeClassFileEditor extends ClassFileEditor
implements
ClassFileDocumentProvider.InputChangeListener {
public class BytecodeClassFileEditor extends ClassFileEditor {
private final InputUpdater fInputUpdater;
public static final String ID = "de.loskutov.bco.editors.BytecodeClassFileEditor";
......@@ -133,6 +131,7 @@ public class BytecodeClassFileEditor extends ClassFileEditor
/*
* @see IEditorPart#init(IEditorSite, IEditorInput)
*/
@Override
public void init(IEditorSite site, IEditorInput input)
throws PartInitException {
input = doOpenBuffer(input, false, true);
......@@ -171,6 +170,7 @@ public class BytecodeClassFileEditor extends ClassFileEditor
* BytecodeClassFileEditor.doSetInput(IEditorInput) line: 201
* AbstractTextEditor$17.run(IProgressMonitor) line: 2396
*/
@Override
protected void doSetInput(IEditorInput input) throws CoreException {
input = transformEditorInput(input);
......@@ -282,7 +282,7 @@ public class BytecodeClassFileEditor extends ClassFileEditor
}
}
private String getAttachedJavaSource(IClassFile cf, boolean force) {
private static String getAttachedJavaSource(IClassFile cf, boolean force) {
String origSrc = null;
if (force) {
IBuffer buffer = BytecodeBufferManager.getBuffer(cf);
......@@ -302,7 +302,7 @@ public class BytecodeClassFileEditor extends ClassFileEditor
return origSrc;
}
private void changeBufferContent(IClassFile cf, char[] src) {
private static void changeBufferContent(IClassFile cf, char[] src) {
IBuffer buffer = BytecodeBufferManager.getBuffer(cf);
// i'm not sure if we need to create buffer each time -
......@@ -328,6 +328,7 @@ public class BytecodeClassFileEditor extends ClassFileEditor
/*
* @see JavaEditor#getElementAt(int)
*/
@Override
protected IJavaElement getElementAt(int offset) {
IClassFile classFile = getClassFile();
......@@ -369,6 +370,7 @@ public class BytecodeClassFileEditor extends ClassFileEditor
return ((IClassFileEditorInput) editorInput).getClassFile();
}
@Override
protected void setSelection(ISourceReference reference, boolean moveCursor) {
if (reference == null) {
if (moveCursor) {
......@@ -436,7 +438,7 @@ public class BytecodeClassFileEditor extends ClassFileEditor
}
}
private boolean isSupportedMember(ISourceReference reference) {
private static boolean isSupportedMember(ISourceReference reference) {
// TODO this condition is not enough. We could have inner/anon. classes
// as selection source (they are displayed in the outline),
// but they are not in the decompiled class,
......@@ -447,6 +449,7 @@ public class BytecodeClassFileEditor extends ClassFileEditor
|| reference instanceof IInitializer;
}
@Override
public Object getAdapter(Class required) {
if (IToggleBreakpointsTarget.class == required) {
......@@ -459,12 +462,13 @@ public class BytecodeClassFileEditor extends ClassFileEditor
// and the ActionDelegateHelper looks with the given offset at classfile or
// compilation unit, but our offset is completely different to Java source
// code
super.getAdapter(required);
return null;
}
return super.getAdapter(required);
}
@Override
protected ISourceReference computeHighlightRangeSourceReference() {
if (!isDecompiled()) {
return super.computeHighlightRangeSourceReference();
......@@ -497,12 +501,14 @@ public class BytecodeClassFileEditor extends ClassFileEditor
return (ISourceReference) element;
}
@Override
public void showHighlightRangeOnly(boolean showHighlightRangeOnly) {
// disabled as we currently do not support "partial" view on selected
// elements
// super.showHighlightRangeOnly(showHighlightRangeOnly);
}
@Override
protected void updateOccurrenceAnnotations(ITextSelection selection,
CompilationUnit astRoot) {
// disabled for bytecode as we currently do not support "occurencies" highlighting
......@@ -528,6 +534,7 @@ public class BytecodeClassFileEditor extends ClassFileEditor
/*
* @see Runnable#run()
*/
@Override
public void run() {
IClassFileEditorInput input;
......@@ -580,6 +587,7 @@ public class BytecodeClassFileEditor extends ClassFileEditor
/*
* @see JavaEditor#getCorrespondingElement(IJavaElement)
*/
@Override
protected IJavaElement getCorrespondingElement(IJavaElement element) {
IClassFile classFile = getClassFile();
if (classFile == null) {
......@@ -598,6 +606,7 @@ public class BytecodeClassFileEditor extends ClassFileEditor
/*
* @see org.eclipse.ui.texteditor.AbstractTextEditor#isEditable()
*/
@Override
public boolean isEditable() {
return isDecompiled();
}
......@@ -606,6 +615,7 @@ public class BytecodeClassFileEditor extends ClassFileEditor
* @see org.eclipse.ui.texteditor.AbstractTextEditor#isEditorInputReadOnly()
* @since 3.2
*/
@Override
public boolean isEditorInputReadOnly() {
return !isDecompiled();
}
......@@ -614,10 +624,12 @@ public class BytecodeClassFileEditor extends ClassFileEditor
* @see ITextEditorExtension2#isEditorInputModifiable()
* @since 2.1
*/
@Override
public boolean isEditorInputModifiable() {
return isDecompiled();
}
@Override
public boolean isSaveAsAllowed() {
return isDecompiled();
}
......@@ -654,6 +666,7 @@ public class BytecodeClassFileEditor extends ClassFileEditor
/*
* @see IWorkbenchPart#createPartControl(Composite)
*/
@Override
public void createPartControl(Composite parent) {
super.createPartControl(parent);
initDone = true;
......@@ -662,8 +675,10 @@ public class BytecodeClassFileEditor extends ClassFileEditor
/*
* @see ClassFileDocumentProvider.InputChangeListener#inputChanged(IClassFileEditorInput)
*/
@Override
public void inputChanged(final IClassFileEditorInput input) {
Runnable updateInput = new Runnable() {
@Override
public void run() {
fInputUpdater.post(input);
IClassFile cf = input.getClassFile();
......@@ -686,6 +701,7 @@ public class BytecodeClassFileEditor extends ClassFileEditor
/*
* @see org.eclipse.ui.IWorkbenchPart#dispose()
*/
@Override
public void dispose() {
// http://bugs.eclipse.org/bugs/show_bug.cgi?id=18510
IDocumentProvider documentProvider = getDocumentProvider();
......
......@@ -20,7 +20,7 @@ import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.internal.ui.contexts.DebugContextManager;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.contexts.DebugContextEvent;
import org.eclipse.debug.ui.contexts.IDebugContextListener;
import org.eclipse.jdt.core.IClassFile;
......@@ -57,7 +57,7 @@ public class BytecodeSourceMapper implements IDebugContextListener {
public BytecodeSourceMapper() {
super();
classToDecompiled = new WeakHashMap();
DebugContextManager.getDefault().addDebugContextListener(this);
DebugUITools.getDebugContextManager().addDebugContextListener(this);
}
public char[] getSource(IClassFile classFile, BitSet decompilerFlags) {
......@@ -169,20 +169,20 @@ public class BytecodeSourceMapper implements IDebugContextListener {
if(archivePath == null){
return null;
}
InputStream inputStream = null;
DecompiledClass decompiledClass = null;
ZipFile zf = null;
try {
ZipFile zf = new ZipFile(archivePath);
zf = new ZipFile(archivePath);
ZipEntry ze = zf.getEntry(className);
inputStream = zf.getInputStream(ze);
InputStream inputStream = zf.getInputStream(ze);
decompiledClass = decompile(source, inputStream, decompilerFlags);
} catch (IOException e) {
source.append(e.toString());
BytecodeOutlinePlugin.log(e, IStatus.ERROR);
} finally {
if (inputStream != null) {
if (zf != null) {
try {
inputStream.close();
zf.close();
} catch (IOException e) {
BytecodeOutlinePlugin.log(e, IStatus.ERROR);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment