Commit e3f7af9f authored by andrei's avatar andrei

Port to 3.3.0 Eclipse (3.2 is not more supported)

parent fb30f061
......@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Bytecode Outline Plug-in
Bundle-SymbolicName: de.loskutov.BytecodeOutline;singleton:=true
Bundle-Version: 2.1.3
Bundle-Version: 2.2.2
Bundle-ClassPath: .,
lib/asm-3.0.jar,
lib/asm-analysis-3.0.jar,
......@@ -19,7 +19,6 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.jdt.core,
org.eclipse.ui.workbench.texteditor,
org.eclipse.jdt.ui,
org.eclipse.core.resources,
org.eclipse.ui.ide,
org.eclipse.compare,
org.eclipse.ui.console,
......@@ -27,8 +26,6 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.help.appserver,
org.eclipse.jdt.debug.ui,
org.eclipse.debug.ui,
org.eclipse.debug.core,
org.eclipse.jdt.debug,
org.eclipse.ui.views,
org.junit;resolution:=optional
Eclipse-AutoStart: true
Eclipse-LazyStart: true
plugin.id=de.loskutov.BytecodeOutline
plugin.version=2.1.3
plugin.version=2.2.2
bin.includes = LICENSE.txt,\
README.txt,\
......
......@@ -2,7 +2,7 @@
<feature
id="de.loskutov.BytecodeOutline.feature"
label="Bytecode Outline"
version="2.1.3"
version="2.2.2"
provider-name="Andrei Loskutov">
<description url="http://asm.objectweb.org/eclipse/bco/index.html">
......@@ -11,12 +11,12 @@ for any java/class file.
</description>
<copyright url="..">
Copyright (C)2004 by Andrei Loskutov Loskutov@gmx.de
Copyright (C)2004-2007 by Andrei Loskutov Loskutov@gmx.de
All rights reserved.
</copyright>
<license>
Copyright (C)2004 by Andrei Loskutov Loskutov@gmx.de
Copyright (C)2004-2007 by Andrei Loskutov Loskutov@gmx.de
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
......@@ -41,7 +41,7 @@ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS&apos;&apos; AND
<import plugin="org.eclipse.jdt.core"/>
<import plugin="org.eclipse.ui.workbench.texteditor"/>
<import plugin="org.eclipse.jdt.ui"/>
<import plugin="org.eclipse.core.resources" version="3.2.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.core.resources" version="3.3.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.ui.ide"/>
<import plugin="org.eclipse.compare"/>
<import plugin="org.eclipse.ui.console"/>
......
......@@ -4,8 +4,14 @@
Bytecode Outline Plugin Update Site
</description>
<feature url="features/de.loskutov.BytecodeOutline.feature_2.1.3.jar" id="de.loskutov.BytecodeOutline.feature" version="2.1.3">
<category name="bytecode-outline"/>
<category name="Bytecode Outline for Eclipse 3.1"/>
</feature>
<category-def name="Bytecode Outline for Eclipse 3.1" label="Bytecode Outline for Eclipse 3.2"/>
<archive path="plugins/de.loskutov.BytecodeOutline_2.1.3.jar" url="http://download.forge.objectweb.org/asm/de.loskutov.BytecodeOutline_2.1.3.jar"/>
<category-def name="bytecode-outline" label="Bytecode Outline"/>
<feature url="features/de.loskutov.BytecodeOutline.feature_2.2.2.jar" id="de.loskutov.BytecodeOutline.feature" version="2.2.2">
<category name="Bytecode Outline for Eclipse 3.3"/>
</feature>
<archive path="plugins/de.loskutov.BytecodeOutline_2.2.2.jar" url="http://download.forge.objectweb.org/asm/de.loskutov.BytecodeOutline_2.2.2.jar"/>
<category-def name="Bytecode Outline for Eclipse 3.3" label="Bytecode Outline for Eclipse 3.3"/>
</site>
......@@ -123,7 +123,7 @@ public class BytecodeBreakpointAdapter extends ToggleBreakpointAdapter {
compilationUnit.accept(locator);
String methodName = locator.getMethodName();
if (methodName == null) {
report(ActionMessages.ManageMethodBreakpointActionDelegate_CantAdd, part);
report("Method breakpoints can only be added to concrete methods.", part);
return Status.OK_STATUS;
}
String typeName = locator.getTypeName();
......@@ -220,7 +220,7 @@ public class BytecodeBreakpointAdapter extends ToggleBreakpointAdapter {
compilationUnit.accept(locator);
String fieldName = locator.getFieldName();
if (fieldName == null) {
report(ActionMessages.ManageWatchpointActionDelegate_CantAdd, part);
report("Watchpoints can only be added to field members.", part);
return Status.OK_STATUS;
}
int idx = fieldName.indexOf("final"); //$NON-NLS-1$
......@@ -233,7 +233,7 @@ public class BytecodeBreakpointAdapter extends ToggleBreakpointAdapter {
IJavaWatchpoint existing = getWatchpoint(typeName, fieldName);
if (existing == null) {
if(!allowed) {
report(ActionMessages.ToggleBreakpointAdapter_8, part);
report("You cannot create create watchpoints on final or static final members.", part);
return Status.OK_STATUS;
}
createWatchpoint(getResource((IEditorPart) part), typeName, fieldName, -1, -1, -1, 0, true, new HashMap(10));
......@@ -270,7 +270,7 @@ public class BytecodeBreakpointAdapter extends ToggleBreakpointAdapter {
IJavaBreakpoint breakpoint = getWatchpoint(typeName, fieldName);
if (breakpoint == null) {
if(!allowed) {
report(ActionMessages.ToggleBreakpointAdapter_8, part);
report("You cannot create create watchpoints on final or static final members.", part);
return Status.OK_STATUS;
}
IResource resource = null;
......@@ -359,7 +359,7 @@ public class BytecodeBreakpointAdapter extends ToggleBreakpointAdapter {
if (offset < start || offset > end) {
// not in the inner type
IStatusLineManager statusLine = editor.getEditorSite().getActionBars().getStatusLineManager();
statusLine.setErrorMessage(MessageFormat.format(ActionMessages.ManageBreakpointRulerAction_Breakpoints_can_only_be_created_within_the_type_associated_with_the_editor___0___1, new String[] { type.getTypeQualifiedName() }));
statusLine.setErrorMessage(MessageFormat.format("Breakpoints can only be created within the type associated with the editor: {0}.", new String[] { type.getTypeQualifiedName() }));
Display.getCurrent().beep();
return Status.OK_STATUS;
}
......
......@@ -13,7 +13,8 @@ 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.internal.ui.contexts.provisional.IDebugContextListener;
import org.eclipse.debug.ui.contexts.DebugContextEvent;
import org.eclipse.debug.ui.contexts.IDebugContextListener;
import org.eclipse.jdt.core.IClassFile;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IMember;
......@@ -27,7 +28,6 @@ import org.eclipse.jdt.internal.core.BinaryType;
import org.eclipse.jdt.internal.debug.core.model.JDIStackFrame;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IWorkbenchPart;
import de.loskutov.bco.BytecodeOutlinePlugin;
import de.loskutov.bco.asm.DecompiledClass;
......@@ -53,13 +53,8 @@ public class BytecodeSourceMapper implements IDebugContextListener {
public char[] getSource(IClassFile classFile, BitSet decompilerFlags) {
IType type;
try {
type = classFile.getType();
} catch (JavaModelException e) {
BytecodeOutlinePlugin.log(e, IStatus.ERROR);
return null;
}
if (!type.isBinary()) {
type = classFile.getType();
if (type == null || !type.isBinary()) {
return null;
}
IBinaryType info = null;
......@@ -255,7 +250,26 @@ public class BytecodeSourceMapper implements IDebugContextListener {
return 0;
}
public void contextActivated(ISelection selection, IWorkbenchPart part) {
public IJavaReferenceType getLastTypeInDebugger() {
return lastTypeInDebugger;
}
public int mapDebuggerToDecompiled(IClassFile cf) {
if(cf == null || lastMethodInDebugger == null){
return -1;
}
DecompiledClass dc = (DecompiledClass) classToDecompiled.get(cf);
if (dc != null) {
return dc.getDecompiledLine(lastMethodInDebugger);
}
return -1;
}
/* (non-Javadoc)
* @see org.eclipse.debug.ui.contexts.IDebugContextListener#debugContextChanged(org.eclipse.debug.ui.contexts.DebugContextEvent)
*/
public void debugContextChanged(DebugContextEvent event) {
ISelection selection = event.getContext();
if(selection instanceof IStructuredSelection){
IStructuredSelection sSelection = (IStructuredSelection) selection;
if(sSelection.isEmpty()){
......@@ -274,23 +288,4 @@ public class BytecodeSourceMapper implements IDebugContextListener {
}
}
public void contextChanged(ISelection selection, IWorkbenchPart part) {
contextActivated(selection, part);
}
public IJavaReferenceType getLastTypeInDebugger() {
return lastTypeInDebugger;
}
public int mapDebuggerToDecompiled(IClassFile cf) {
if(cf == null || lastMethodInDebugger == null){
return -1;
}
DecompiledClass dc = (DecompiledClass) classToDecompiled.get(cf);
if (dc != null) {
return dc.getDecompiledLine(lastMethodInDebugger);
}
return -1;
}
}
......@@ -405,17 +405,13 @@ public class JdtUtils {
for (int i = 0; i < innerClasses.size(); i++) {
InnerClassNode in = (InnerClassNode) innerClasses.get(i);
if(typeSignature.equals(in.name)){
try {
int idx = typeSignature.lastIndexOf(PACKAGE_SEPARATOR);
String className = typeSignature;
if (idx > 0) {
className = typeSignature.substring(idx + 1, typeSignature.length());
}
className += ".class";
return cf.getType().getPackageFragment().getClassFile(className);
} catch (JavaModelException e) {
BytecodeOutlinePlugin.log(e, IStatus.ERROR);
int idx = typeSignature.lastIndexOf(PACKAGE_SEPARATOR);
String className = typeSignature;
if (idx > 0) {
className = typeSignature.substring(idx + 1, typeSignature.length());
}
className += ".class";
return cf.getType().getPackageFragment().getClassFile(className);
}
}
return null;
......
......@@ -751,6 +751,11 @@ public class BytecodeOutlineView extends ViewPart {
selectionChangedAction.run();
}
}
public void mouseUp(MouseEvent e) {
if (modes.get(BCOConstants.F_LINK_VIEW_TO_EDITOR)) {
selectionChangedAction.run();
}
}
});
textControl.addKeyListener(new KeyListener() {
......@@ -1319,23 +1324,41 @@ public class BytecodeOutlineView extends ViewPart {
return;
}
int decompiledLine;
int startDecLine;
int endDecLine = -1;
if (modes.get(BCOConstants.F_SHOW_ANALYZER)) {
decompiledLine = tableControl.getSelectionIndex();
startDecLine = tableControl.getSelectionIndex();
} else {
decompiledLine = textControl.getLineAtOffset(selection.x);
startDecLine = textControl.getLineAtOffset(selection.x);
endDecLine = textControl.getLineAtOffset(selection.y);
}
int startSourceLine = lastDecompiledResult.getSourceLine(startDecLine);
int endSourceLine = -1;
if(endDecLine > 0){
endSourceLine = lastDecompiledResult.getSourceLine(endDecLine);
}
if(endSourceLine < startSourceLine){
int tmp = startSourceLine;
startSourceLine = endSourceLine;
endSourceLine = tmp;
}
int sourceLine = lastDecompiledResult.getSourceLine(decompiledLine);
try {
if (sourceLine > 0) {
if (startSourceLine > 0) {
IDocument document = javaEditor.getDocumentProvider()
.getDocument(javaEditor.getEditorInput());
try {
IRegion lineInfo = document
.getLineInformation(sourceLine - 1);
EclipseUtils.selectInEditor(javaEditor, lineInfo
.getOffset(), lineInfo.getLength());
.getLineInformation(startSourceLine - 1);
int startOffset = lineInfo.getOffset();
int length = lineInfo.getLength();
if(endSourceLine > 0){
IRegion region = document.getLineInformation(endSourceLine - 1);
length = region.getLength() + (region.getOffset() - startOffset);
}
EclipseUtils.selectInEditor(javaEditor, startOffset, length);
} catch (BadLocationException e) {
// do nothing. This could happens e.g. if editor does not contain
// full source code etc, so that line info is not exist in editor
......@@ -1346,7 +1369,7 @@ public class BytecodeOutlineView extends ViewPart {
}
int bytecodeOffset = lastDecompiledResult
.getBytecodeOffset(decompiledLine);
.getBytecodeOffset(startDecLine);
updateStatus(lastDecompiledResult, bytecodeOffset, -1);
}
......
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