Commit 63571937 authored by andrei's avatar andrei

Get rid of compiler / FB warnings

parent 45480e99
......@@ -25,7 +25,7 @@ public class BytecodeOutlinePlugin extends AbstractUIPlugin {
private static BytecodeOutlinePlugin plugin;
//Resource bundle.
private ResourceBundle resourceBundle;
public static boolean debug;
public static boolean DEBUG;
/**
* The constructor.
......@@ -49,9 +49,10 @@ public class BytecodeOutlinePlugin extends AbstractUIPlugin {
* @param context
* @throws Exception
*/
@Override
public void start(BundleContext context) throws Exception {
super.start(context);
debug = isDebugging();
DEBUG = isDebugging();
}
/**
......@@ -59,6 +60,7 @@ public class BytecodeOutlinePlugin extends AbstractUIPlugin {
* @param context
* @throws Exception
*/
@Override
public void stop(BundleContext context) throws Exception {
super.stop(context);
}
......
......@@ -259,7 +259,7 @@ public class CommentedASMifierClassVisitor extends ASMifier implements ICommente
public void visitLineNumber(int line, Label start) {
if (showLines) {
addIndex(-1);
currMethod.addLineNumber(start, new Integer(line));
currMethod.addLineNumber(start, Integer.valueOf(line));
super.visitLineNumber(line, start);
}
}
......
......@@ -334,7 +334,7 @@ public class CommentedClassVisitor extends Textifier implements ICommentedClassV
addIndex(opcode);
text.add(tab2 + OPCODES[opcode] + " " + var);
if (!raw) {
text.add(new Integer(var));
text.add(Integer.valueOf(var));
}
text.add("\n");
}
......@@ -377,7 +377,7 @@ public class CommentedClassVisitor extends Textifier implements ICommentedClassV
addIndex(Opcodes.IINC);
text.add(tab2 + "IINC " + var);
if (!raw) {
text.add(new Integer(var));
text.add(Integer.valueOf(var));
}
text.add(" " + increment + "\n");
}
......@@ -544,7 +544,7 @@ public class CommentedClassVisitor extends Textifier implements ICommentedClassV
public void visitLineNumber(final int line, final Label start) {
if (showLines) {
addIndex(-1);
currMethod.addLineNumber(start, new Integer(line));
currMethod.addLineNumber(start, Integer.valueOf(line));
super.visitLineNumber(line, start);
}
}
......
......@@ -337,7 +337,7 @@ public class DecompiledClass {
DecompiledMethod m = (DecompiledMethod) o;
int l = m.getErrorLine();
if (l != -1) {
errors.add(new Integer(l + currentDecompiledLine));
errors.add(Integer.valueOf(l + currentDecompiledLine));
}
currentDecompiledLine += m.getLineCount();
} else {
......
......@@ -178,7 +178,7 @@ public class DecompiledMethod {
if(bestMatch < 0){
return -1;
}
return ((Integer)decompiledLines.get(new Integer(bestMatch))).intValue();
return ((Integer)decompiledLines.get(Integer.valueOf(bestMatch))).intValue();
}
/**
......@@ -271,9 +271,9 @@ public class DecompiledMethod {
for (int i = 0; i < localVariables.size(); ++i) {
LocalVariableNode lvNode = (LocalVariableNode) localVariables.get(i);
if (lvNode.start == index.labelNode) {
locals.put(new Integer(lvNode.index), lvNode.name);
locals.put(Integer.valueOf(lvNode.index), lvNode.name);
} else if (lvNode.end == index.labelNode) {
locals.remove(new Integer(lvNode.index));
locals.remove(Integer.valueOf(lvNode.index));
}
}
}
......@@ -307,11 +307,11 @@ public class DecompiledMethod {
} else {
++currentDecompiledLine;
}
Integer cdl = new Integer(currentDecompiledLine);
Integer ci = new Integer(currentInsn1);
Integer co = new Integer(currentOpcode);
Integer cdl = Integer.valueOf(currentDecompiledLine);
Integer ci = Integer.valueOf(currentInsn1);
Integer co = Integer.valueOf(currentOpcode);
if(currentSourceLine >= 0){
Integer csl = new Integer(currentSourceLine);
Integer csl = Integer.valueOf(currentSourceLine);
sourceLines.put(cdl, csl);
if (decompiledLines.get(csl) == null) {
decompiledLines.put(csl, cdl);
......@@ -398,7 +398,7 @@ public class DecompiledMethod {
if (error == null) {
return -1;
}
Integer i = (Integer) insnLines.get(new Integer(errorInsn));
Integer i = (Integer) insnLines.get(Integer.valueOf(errorInsn));
return i == null
? -1
: i.intValue();
......@@ -435,7 +435,7 @@ public class DecompiledMethod {
}
public int getSourceLine(final int decompiledLine) {
Integer i = (Integer) sourceLines.get(new Integer(decompiledLine));
Integer i = (Integer) sourceLines.get(Integer.valueOf(decompiledLine));
return i == null
? -1
: i.intValue();
......@@ -494,7 +494,7 @@ public class DecompiledMethod {
* @return
*/
public Integer getBytecodeOffset(final int decompiledLine) {
Integer insn = (Integer) insns.get(new Integer(decompiledLine));
Integer insn = (Integer) insns.get(Integer.valueOf(decompiledLine));
return insn;
}
......@@ -503,7 +503,7 @@ public class DecompiledMethod {
* @return
*/
public Integer getBytecodeInsn(final int decompiledLine) {
Integer insn = (Integer) opcodes.get(new Integer(decompiledLine));
Integer insn = (Integer) opcodes.get(Integer.valueOf(decompiledLine));
return insn;
}
......@@ -613,7 +613,7 @@ public class DecompiledMethod {
}
public int getDecompiledLine(final int sourceLine) {
Integer i = (Integer) decompiledLines.get(new Integer(sourceLine));
Integer i = (Integer) decompiledLines.get(Integer.valueOf(sourceLine));
return i == null
? -1
: i.intValue();
......
......@@ -62,6 +62,7 @@ public class BytecodeCompare extends CompareEditorInput {
toggleAsmifierModeAction = new DefaultToggleAction(
BCOConstants.DIFF_SHOW_ASMIFIER_CODE, false) {
@Override
public void run(final boolean newState) {
toggleMode(
BCOConstants.F_SHOW_ASMIFIER_CODE, newState, newState);
......@@ -71,6 +72,7 @@ public class BytecodeCompare extends CompareEditorInput {
hideLineInfoAction = new DefaultToggleAction(
BCOConstants.DIFF_SHOW_LINE_INFO, false) {
@Override
public void run(final boolean newState) {
toggleMode(
BCOConstants.F_SHOW_LINE_INFO, newState,
......@@ -81,6 +83,7 @@ public class BytecodeCompare extends CompareEditorInput {
hideLocalsAction = new DefaultToggleAction(
BCOConstants.DIFF_SHOW_VARIABLES, false) {
@Override
public void run(final boolean newState) {
toggleMode(
BCOConstants.F_SHOW_VARIABLES, newState,
......@@ -91,6 +94,7 @@ public class BytecodeCompare extends CompareEditorInput {
hideStackMapAction = new DefaultToggleAction(
BCOConstants.DIFF_SHOW_STACKMAP, false) {
@Override
public void run(final boolean newState) {
toggleMode(
BCOConstants.F_SHOW_STACKMAP, newState,
......@@ -101,6 +105,7 @@ public class BytecodeCompare extends CompareEditorInput {
expandStackMapAction = new DefaultToggleAction(
BCOConstants.DIFF_EXPAND_STACKMAP, false) {
@Override
public void run(final boolean newState) {
toggleMode(
BCOConstants.F_EXPAND_STACKMAP, newState,
......@@ -110,6 +115,7 @@ public class BytecodeCompare extends CompareEditorInput {
}
/** @see CompareEditorInput#prepareInput(IProgressMonitor) */
@Override
protected Object prepareInput(final IProgressMonitor monitor)
throws InterruptedException {
if (right == null || left == null) {
......@@ -193,6 +199,7 @@ public class BytecodeCompare extends CompareEditorInput {
/**
* @see org.eclipse.compare.CompareEditorInput#createContents(org.eclipse.swt.widgets.Composite)
*/
@Override
public Control createContents(final Composite parent) {
Object obj = parent.getData();
if(obj == null) {
......
......@@ -11,6 +11,7 @@ package de.loskutov.bco.compare;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.util.BitSet;
import org.eclipse.compare.BufferedContent;
......@@ -140,7 +141,7 @@ public class TypedElement extends BufferedContent
BytecodeOutlinePlugin.log(e, IStatus.WARNING);
}
}
final byte[] bytes = decompiledClass.getText().getBytes();
final byte[] bytes = decompiledClass.getText().getBytes(Charset.forName("UTF-8"));
// use internal buffering to prevent multiple calls to this method
Display.getDefault().syncExec(new Runnable(){
@Override
......
......@@ -62,6 +62,7 @@ public class BytecodeActionBarContributor
attachAction = new AttachSourceAction(actionIcon);
}
@Override
public void contributeToToolBar(IToolBarManager toolBarManager) {
super.contributeToToolBar(toolBarManager);
toolBarManager.add(refreshAction);
......@@ -71,6 +72,7 @@ public class BytecodeActionBarContributor
// toolBarManager.appendToGroup(JadclipsePlugin.PID_JADCLIPSE, dAction);
}
@Override
public void contributeToMenu(IMenuManager menu) {
super.contributeToMenu(menu);
IMenuManager edit = menu
......@@ -82,6 +84,7 @@ public class BytecodeActionBarContributor
}
}
@Override
public void setActiveEditor(IEditorPart targetEditor) {
if (targetEditor instanceof BytecodeClassFileEditor) {
editor = (BytecodeClassFileEditor) targetEditor;
......@@ -109,6 +112,7 @@ public class BytecodeActionBarContributor
setAccelerator(SWT.CTRL | SWT.SHIFT | 'B');
}
@Override
public void run() {
if (editor != null) {
ISelection selection = editor.getSelectionProvider()
......@@ -139,6 +143,7 @@ public class BytecodeActionBarContributor
setToolTipText("Attach Source...");
}
@Override
public void run() {
if (editor == null) {
return;
......@@ -207,6 +212,7 @@ public class BytecodeActionBarContributor
setToolTipText("Show Internal Types");
}
@Override
public void run() {
if (editor != null) {
editor.setDecompilerFlag(
......
......@@ -26,7 +26,8 @@ public final class BytecodeBufferManager {
}
public static IBuffer createBuffer(IOpenable owner) {
return BufferManager.getDefaultBufferManager().createBuffer(owner);
BufferManager.getDefaultBufferManager();
return BufferManager.createBuffer(owner);
}
/**
......
......@@ -33,6 +33,7 @@ public class BytecodeDocumentProvider extends ClassFileDocumentProvider {
* Overriden to get control over document content for bytecode editors
* @see StorageDocumentProvider#setDocumentContent(IDocument, IEditorInput)
*/
@Override
protected boolean setDocumentContent(IDocument document,
IEditorInput editorInput, String encoding) throws CoreException {
......@@ -64,7 +65,7 @@ public class BytecodeDocumentProvider extends ClassFileDocumentProvider {
/**
*
* During debug session, debugger tries to get line information for the current line
* During DEBUG session, debugger tries to get line information for the current line
* in the stack, and then uses this info to set cursor and select text in editor.
*
* The problem is, that Java debugger knows only "source" - based lines, but our editor
......@@ -82,6 +83,7 @@ public class BytecodeDocumentProvider extends ClassFileDocumentProvider {
* All other clients of this method shouldn't be affected and should receive always
* the original document.
*/
@Override
public IDocument getDocument(Object element) {
IDocument document = super.getDocument(element);
if (element instanceof IClassFileEditorInput && isDebuggerCall()) {
......@@ -93,7 +95,7 @@ public class BytecodeDocumentProvider extends ClassFileDocumentProvider {
}
/**
* We are looking for two stack patterns, which both are related to debug session and
* We are looking for two stack patterns, which both are related to DEBUG session and
* coming from SourceLookupFacility.display(ISourceLookupResult result, IWorkbenchPage page):
* first is the highlighting the editor current line, corresponding to
* the line in the bytecode stack (light gray color),
......@@ -103,7 +105,7 @@ public class BytecodeDocumentProvider extends ClassFileDocumentProvider {
* This is a VERY BAD and VERY DIRTY hack, but it works.
* @return
*/
private boolean isDebuggerCall() {
private static boolean isDebuggerCall() {
Exception e = new Exception();
StackTraceElement[] stackTrace = e.getStackTrace();
boolean stackOk = true;
......@@ -156,13 +158,13 @@ public class BytecodeDocumentProvider extends ClassFileDocumentProvider {
* private void positionEditor(ITextEditor editor, IStackFrame frame)
* private IRegion getLineInformation(ITextEditor editor, int lineNumber)
*
* Other place for debug instruction pointer with the "wrong line" is InstructionPointerManager
* Other place for DEBUG instruction pointer with the "wrong line" is InstructionPointerManager
* public void addAnnotation(ITextEditor textEditor, IStackFrame frame, Annotation annotation)
*/
/**
* This class is non-functional replacement for IDocument. The only one purpose is to
* override getLineInformation() implementation for debug purposes
* override getLineInformation() implementation for DEBUG purposes
*/
private static final class DocumentProxy4Debugger extends AbstractDocument {
......@@ -175,6 +177,7 @@ public class BytecodeDocumentProvider extends ClassFileDocumentProvider {
this.cf = cf;
}
@Override
public IRegion getLineInformation(int line) throws BadLocationException {
BytecodeSourceMapper mapper = BytecodeClassFileEditor
.getSourceMapper();
......
......@@ -14,14 +14,12 @@ import org.eclipse.jface.preference.IPreferenceStore;
import de.loskutov.bco.BytecodeOutlinePlugin;
/**
* Inializer of default values for BCO preferences
* Initalizer of default values for BCO preferences
* @author Andrei
*/
public class BCOPreferenceInitializer extends AbstractPreferenceInitializer {
/* (non-Javadoc)
* @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
*/
@Override
public void initializeDefaultPreferences() {
IPreferenceStore store = BytecodeOutlinePlugin.getDefault().getPreferenceStore();
store.setDefault(BCOConstants.LINK_VIEW_TO_EDITOR, true);
......
......@@ -46,10 +46,12 @@ public class BCOPreferencePage extends FieldEditorPreferencePage
.getResourceString("BCOPreferencePage.description"));
}
@Override
public void setVisible(boolean visible) {
super.setVisible(visible);
}
@Override
protected void adjustGridLayout() {
super.adjustGridLayout();
// ((GridData)rateGroup.getLayoutData()).horizontalSpan = 2;
......@@ -60,6 +62,7 @@ public class BCOPreferencePage extends FieldEditorPreferencePage
* needed to manipulate various types of preferences. Each field editor knows how to
* save and restore itself.
*/
@Override
public void createFieldEditors() {
Composite fieldEditorParent = getFieldEditorParent();
......@@ -183,6 +186,7 @@ public class BCOPreferencePage extends FieldEditorPreferencePage
*
* @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
*/
@Override
public void init(IWorkbench workbench) {
//
}
......
......@@ -59,6 +59,7 @@ public class SupportPanel {
link.setText(" - <a>visit homepage</a>");
link.setToolTipText("You need just a sense of humor!");
link.addListener (SWT.Selection, new Listener () {
@Override
public void handleEvent(Event event) {
handleUrlClick("http://andrei.gmxhome.de/bytecode");
}
......@@ -69,6 +70,7 @@ public class SupportPanel {
link.setText(" - <a>report issue or feature request</a>");
link.setToolTipText("You need a valid account at ow2.org!");
link.addListener (SWT.Selection, new Listener () {
@Override
public void handleEvent(Event event) {
handleUrlClick("http://forge.ow2.org/tracker/?group_id=23");
}
......@@ -79,6 +81,7 @@ public class SupportPanel {
link.setText(" - <a>add to your favorites at Eclipse MarketPlace</a>");
link.setToolTipText("You need a valid bugzilla account at Eclipse.org!");
link.addListener (SWT.Selection, new Listener () {
@Override
public void handleEvent(Event event) {
handleUrlClick("http://marketplace.eclipse.org/content/bytecode-outline");
}
......@@ -89,6 +92,7 @@ public class SupportPanel {
link.setText(" - <a>make a donation to support plugin development</a>");
link.setToolTipText("You do NOT need a PayPal account!");
link.addListener (SWT.Selection, new Listener () {
@Override
public void handleEvent(Event event) {
handleUrlClick("https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=R5SHJLNGUXKHU");
}
......
......@@ -92,10 +92,13 @@ public class EclipseUtils {
* @return full package name in default java notation (with dots)
*/
public static String getJavaPackageName(IJavaElement resource) {
String name = resource == null
? null : resource.getElementName(); //$NON-NLS-1$
String name;
if (resource == null) {
return "";
}
name = resource.getElementName();
if (name == null) {
return ""; //$NON-NLS-1$
return "";
}
int type = resource.getElementType();
if (type == IJavaElement.PACKAGE_FRAGMENT
......@@ -110,4 +113,4 @@ public class EclipseUtils {
return ""; //$NON-NLS-1$
}
}
\ No newline at end of file
}
......@@ -1125,7 +1125,7 @@ public class JdtUtils {
anonType, sourceComparator);
Collections.sort(anonymous, classComparator);
if(BytecodeOutlinePlugin.debug){
if(BytecodeOutlinePlugin.DEBUG){
debugCompilePrio(classComparator);
}
}
......@@ -1135,12 +1135,13 @@ public class JdtUtils {
final Map map = classComparator.map;
Comparator prioComp = new Comparator() {
@Override
public int compare(Object e1, Object e2) {
int result = ((Comparable) map.get(e1)).compareTo(map.get(e2));
int result = ((Comparable) map.get(e2)).compareTo(map.get(e1));
if (result == 0) {
return e1.toString().compareTo(e2.toString());
}
return -result;
return result;
}
};
......@@ -1365,6 +1366,7 @@ public class JdtUtils {
* @param o2 should be IType
* @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
*/
@Override
public int compare(Object o1, Object o2) {
IType m1 = (IType) o1;
IType m2 = (IType) o2;
......@@ -1438,6 +1440,7 @@ public class JdtUtils {
*
* @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
*/
@Override
public int compare(Object o1, Object o2) {
if(o1 == o2){
return 0;
......@@ -1503,14 +1506,14 @@ public class JdtUtils {
Integer prio;
if ((prio = (Integer) map.get(anonType)) != null) {
compilePrio = prio.intValue();
if (BytecodeOutlinePlugin.debug) {
if (BytecodeOutlinePlugin.DEBUG) {
System.out.println("Using cache");
}
} else {
compilePrio = getAnonCompilePriority(
anonType, firstAncestor, topAncestorType, is50OrHigher);
map.put(anonType, Integer.valueOf(compilePrio));
if (BytecodeOutlinePlugin.debug) {
if (BytecodeOutlinePlugin.DEBUG) {
System.out.println("Calculating value!");
}
}
......
......@@ -31,7 +31,7 @@ import de.loskutov.bco.BytecodeOutlinePlugin;
class BCOViewSelectionProvider implements IPostSelectionProvider {
private IPostSelectionProvider realProvider;
private List selProviders;
private final List selProviders;
private ISelection selection;
public BCOViewSelectionProvider(){
......@@ -62,6 +62,7 @@ class BCOViewSelectionProvider implements IPostSelectionProvider {
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.IPostSelectionProvider#addPostSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
*/
@Override
public void addPostSelectionChangedListener(ISelectionChangedListener listener) {
for (int i = 0; i < selProviders.size(); i++) {
IPostSelectionProvider provider = (IPostSelectionProvider) selProviders.get(i);
......@@ -72,6 +73,7 @@ class BCOViewSelectionProvider implements IPostSelectionProvider {
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.IPostSelectionProvider#removePostSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
*/
@Override
public void removePostSelectionChangedListener(ISelectionChangedListener listener) {
for (int i = 0; i < selProviders.size(); i++) {
IPostSelectionProvider provider = (IPostSelectionProvider) selProviders.get(i);
......@@ -82,6 +84,7 @@ class BCOViewSelectionProvider implements IPostSelectionProvider {
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.ISelectionProvider#addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
*/
@Override
public void addSelectionChangedListener(ISelectionChangedListener listener) {
for (int i = 0; i < selProviders.size(); i++) {
IPostSelectionProvider provider = (IPostSelectionProvider) selProviders.get(i);
......@@ -92,6 +95,7 @@ class BCOViewSelectionProvider implements IPostSelectionProvider {
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.ISelectionProvider#getSelection()
*/
@Override
public ISelection getSelection() {
return realProvider != null? realProvider.getSelection() : null;
}
......@@ -99,6 +103,7 @@ class BCOViewSelectionProvider implements IPostSelectionProvider {
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.ISelectionProvider#removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
*/
@Override
public void removeSelectionChangedListener(ISelectionChangedListener listener) {
for (int i = 0; i < selProviders.size(); i++) {
IPostSelectionProvider provider = (IPostSelectionProvider) selProviders.get(i);
......@@ -109,6 +114,7 @@ class BCOViewSelectionProvider implements IPostSelectionProvider {
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.ISelectionProvider#setSelection(org.eclipse.jface.viewers.ISelection)
*/
@Override
public void setSelection(ISelection selection) {
this.selection = selection;
if(realProvider != null) {
......
......@@ -625,6 +625,7 @@ public class BytecodeOutlineView extends ViewPart {
tmanager.add(toggleVerifierAction);
}
@SuppressWarnings("unused")
private void createVerifyControl() {
verifyControl = new SashForm(stackComposite, SWT.VERTICAL);
......@@ -1558,7 +1559,7 @@ public class BytecodeOutlineView extends ViewPart {
// this is the "cookie" for the bytecode reference, which could be
// mapped later to the sourcecode line on selection event in the
// table
item.setData(new Integer(i));
item.setData(Integer.valueOf(i));
}
item.setText(j, s);
}
......
......@@ -49,12 +49,14 @@ public class BytecodeReferenceView extends ViewPart implements IPartListener2, I
super();
}
@Override
public void createPartControl(Composite parent) {
browser = new Browser(parent, SWT.BORDER);
final IWorkbenchWindow workbenchWindow = getSite().getWorkbenchWindow();
linkWithView = BytecodeOutlinePlugin.getDefault().getPreferenceStore()
.getBoolean(BCOConstants.LINK_REF_VIEW_TO_EDITOR);
linkWithViewAction = new DefaultToggleAction(BCOConstants.LINK_REF_VIEW_TO_EDITOR){
@Override
public void run(boolean newState) {
linkWithView = newState;
if(linkWithView){
......@@ -80,6 +82,7 @@ public class BytecodeReferenceView extends ViewPart implements IPartListener2, I
workbenchWindow.getPartService().addPartListener(this);
}
@Override
public void dispose() {
getSite().getWorkbenchWindow().getPartService().removePartListener(this);
browser.dispose();
......@@ -88,32 +91,39 @@ public class BytecodeReferenceView extends ViewPart implements IPartListener2, I
super.dispose();
}
@Override
public void setFocus() {
browser.setFocus();
}
@Override
public void partActivated(IWorkbenchPartReference partRef) {
//
}
@Override
public void partBroughtToTop(IWorkbenchPartReference partRef) {
//
}
@Override
public void partClosed(IWorkbenchPartReference partRef) {
//
}
@Override
public void partDeactivated(IWorkbenchPartReference partRef) {
//
}
@Override
public void partOpened(IWorkbenchPartReference partRef) {
// WORKAROUND - sometimes Eclipse does not invoke partVisible(),
// but only partOpened()...
partVisible(partRef);
}
@Override
public void partHidden(IWorkbenchPartReference partRef) {
if (partRef.getId().equals(getSite().getId())) {
getSite().getWorkbenchWindow().getSelectionService()
......@@ -121,6 +131,7 @@ public class BytecodeReferenceView extends ViewPart implements IPartListener2, I
}
}
@Override
public void partVisible(IWorkbenchPartReference partRef) {
if (partRef.getId().equals(getSite().getId())) {
IWorkbenchWindow workbenchWindow = getSite().getWorkbenchWindow();
......@@ -142,10 +153,12 @@ public class BytecodeReferenceView extends ViewPart implements IPartListener2, I
}
}
@Override
public void partInputChanged(IWorkbenchPartReference partRef) {
//
}
@Override
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
boolean isViewSelection = part instanceof BytecodeOutlineView;
if (!linkWithView || !(isViewSelection
......@@ -195,7 +208,7 @@ public class BytecodeReferenceView extends ViewPart implements IPartListener2, I
+ "empty.selection.text"));
}
private String checkOpcodeName(String opcodeName) {
private static String checkOpcodeName(String opcodeName) {
opcodeName = opcodeName.toLowerCase();
/*
* we need an additional check for DCONST_1...5, FCONST_1...5 etc case
......@@ -223,7 +236,7 @@ public class BytecodeReferenceView extends ViewPart implements IPartListener2, I
return opcodeName;
}
private URL getHelpResource(String name) {
private static URL getHelpResource(String name) {
try {
String href = "/"
+ BytecodeOutlinePlugin.getDefault().getBundle()
......
......@@ -44,6 +44,7 @@ public class EditorListener implements ISelectionListener, IFileBufferListener,
* @param selection
*
*/
@Override
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
if(!(selection instanceof ITextSelection)){
if(selection instanceof IStructuredSelection){
......@@ -60,6 +61,7 @@ public class EditorListener implements ISelectionListener, IFileBufferListener,
Display display = Display.getDefault();
// fork
display.asyncExec(new Runnable() {
@Override
public void run() {
view.checkOpenEditors(true);
}
......@@ -74,11 +76,12 @@ public class EditorListener implements ISelectionListener, IFileBufferListener,
/**
* @see org.eclipse.core.filebuffers.IFileBufferListener#dirtyStateChanged(org.eclipse.core.filebuffers.IFileBuffer, boolean)
*/
@Override
public void dirtyStateChanged(IFileBuffer buffer, final boolean isDirty) {
if(!view.isLinkedWithEditor()){
return;
}
if(isSupportedBuffer(buffer)){ //$NON-NLS-1$
if(isSupportedBuffer(buffer)){
// first call set only view flag - cause
view.handleBufferIsDirty(isDirty);
......@@ -87,6 +90,7 @@ public class EditorListener implements ISelectionListener, IFileBufferListener,
// this one will be called in UI thread after some delay, because we need
// to wait until the bytecode will be written on disk
final Runnable runnable2 = new Runnable() {
@Override
public void run() {
view.handleBufferIsDirty(isDirty);
}
......@@ -94,6 +98,7 @@ public class EditorListener implements ISelectionListener, IFileBufferListener,
// this one will be called in UI thread ASAP and allow us to leave
// current (probably non-UI) thread
Runnable runnable1 = new Runnable() {
@Override