Commit 0709c15c authored by andrei's avatar andrei

Fixed "disabled view" bug by toggling link with editor off, added the BCO...

Fixed "disabled view" bug by toggling link with editor off, added the BCO preference page, changed version to 2.2.5
parent 6c6e1ccc
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry combineaccessrules="false" kind="src" path="/asm 3.0"/>
<classpathentry kind="src" path="src"/>
<classpathentry excluding="JCL/" kind="src" path="test"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3.8.1"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
<accessrules>
<accessrule kind="accessible" pattern="**/jdt/internal/**"/>
</accessrules>
</classpathentry>
<classpathentry kind="output" path="output/eclipse"/>
</classpath>
This diff is collapsed.
#Tue Oct 03 15:07:33 CEST 2006
#Sat Jan 13 11:52:17 CET 2007
eclipse.preferences.version=1
org.eclipse.jdt.core.codeComplete.argumentPrefixes=
org.eclipse.jdt.core.codeComplete.argumentSuffixes=
......@@ -17,7 +17,7 @@ org.eclipse.jdt.core.compiler.doc.comment.support=enabled
org.eclipse.jdt.core.compiler.problem.deprecation=warning
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
......
#Tue Apr 11 23:11:33 CEST 2006
#Sun Feb 11 10:22:10 CET 2007
comment_clear_blank_lines=true
comment_format_comments=true
comment_format_header=true
......@@ -10,7 +10,7 @@ comment_line_length=90
comment_new_line_for_parameter=false
comment_separate_root_tags=false
eclipse.preferences.version=1
formatter_settings_version=10
formatter_settings_version=11
internal.default.compliance=default
org.eclipse.jdt.ui.exception.name=e
org.eclipse.jdt.ui.gettersetter.use.is=true
......
......@@ -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.2.4
Bundle-Version: 2.2.5
Bundle-ClassPath: .,
lib/asm-3.1.jar,
lib/asm-analysis-3.1.jar,
......@@ -16,7 +16,7 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.ui.editors,
org.eclipse.core.runtime,
org.eclipse.jface.text,
org.eclipse.jdt.core,
org.eclipse.jdt.core;bundle-version="3.4.0",
org.eclipse.ui.workbench.texteditor,
org.eclipse.jdt.ui,
org.eclipse.ui.ide,
......@@ -27,5 +27,6 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.jdt.debug.ui,
org.eclipse.debug.ui,
org.eclipse.jdt.debug,
org.junit;resolution:=optional
org.junit;resolution:=optional,
org.eclipse.core.net
Eclipse-LazyStart: true
plugin.id=de.loskutov.BytecodeOutline
plugin.version=2.2.4
plugin.version=2.2.5
bin.includes = LICENSE.txt,\
README.txt,\
......
......@@ -240,4 +240,13 @@
<adapter type="org.eclipse.debug.ui.actions.IToggleBreakpointsTarget"/>
</factory>
</extension>
<extension
point="org.eclipse.ui.preferencePages">
<page
category="org.eclipse.jdt.ui.preferences.JavaBasePreferencePage"
class="de.loskutov.bco.preferences.BCOPreferencePage"
id="de.loskutov.ByteCodeOutline.page"
name="Bytecode Outline">
</page>
</extension>
</plugin>
......@@ -2,7 +2,7 @@
<feature
id="de.loskutov.BytecodeOutline.feature"
label="Bytecode Outline"
version="2.2.4"
version="2.2.5"
provider-name="Andrei Loskutov">
<description url="http://asm.objectweb.org/eclipse/bco/index.html">
......@@ -38,10 +38,8 @@ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS&apos;&apos; AND
<import plugin="org.eclipse.ui.editors"/>
<import plugin="org.eclipse.core.runtime"/>
<import plugin="org.eclipse.jface.text"/>
<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.4.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.ui.ide"/>
<import plugin="org.eclipse.compare"/>
<import plugin="org.eclipse.ui.console"/>
......@@ -49,16 +47,16 @@ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS&apos;&apos; AND
<import plugin="org.eclipse.help.appserver"/>
<import plugin="org.eclipse.jdt.debug.ui"/>
<import plugin="org.eclipse.debug.ui"/>
<import plugin="org.eclipse.debug.core"/>
<import plugin="org.eclipse.jdt.debug"/>
<import plugin="org.eclipse.ui.views"/>
<import plugin="org.eclipse.jdt.core" version="3.4.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.core.net"/>
</requires>
<plugin
id="de.loskutov.BytecodeOutline"
download-size="650"
install-size="650"
version="0.0.0"
version="2.2.5"
unpack="false"/>
</feature>
......@@ -21,8 +21,12 @@ BytecodeOutlineView.toggle.automatic.label=&Automatic View Orientation
BytecodeReferenceView.empty.selection.text=<html><head><title>Bytecode reference</title></head><body bgcolor='#D3D3D3'>Please select any bytecode instruction in the bytecode outline view.</body></html>
BCOPreferencePage.defaultsGroup=Default selections for Bytecode Outline view
BCOPreferencePage.showVariables=Show Variables
BCOPreferencePage.description=Bytecode Outline View Settings
BCOPreferencePage.defaultsGroup=Outline
BCOPreferencePage.compareGroup=Compare
BCOPreferencePage.miscGroup=Misc...
BCOPreferencePage.showVariables=Show variables
BCOPreferencePage.showLineInfo=Show line info
BCOPreferencePage.showStackMap=Show stack map
BCOPreferencePage.expandStackMap=Expand stack map
......@@ -31,7 +35,15 @@ BCOPreferencePage.showRawBytecode=Show internal types
BCOPreferencePage.showAnalyzer=Show analyzer pane
BCOPreferencePage.showAsmifierCode=Show ASMifier code
BCOPreferencePage.showOnlySelected=Show bytecode for selected element only
BCOPreferencePage.linkViewToEditor=Link bytecode view to editor
BCOPreferencePage.linkViewToEditor=Link Bytecode Outline view to editor
BCOPreferencePage.linkRefViewToEditor=Link Bytecode Reference view to editor
BCOPreferencePage.showHexValues=Show hex values for numeric constants
BCOPreferencePage.diffExpandStackMap=Expand stack map
BCOPreferencePage.diffShowStackMap=Show stack map
BCOPreferencePage.diffShowLineInfo=Show line info
BCOPreferencePage.diffShowVariables=Show variables
BCOPreferencePage.diffShowAsmifierCode=Show ASMifier code
action.showVariables.text=Show local variables
action.showVariables.toolTipText=Show local variables (if available in bytecode)
......
......@@ -118,24 +118,24 @@ public interface BCOConstants {
* Key is Integer value from one of F_* constants, value is the String value of one of corresponding
* preference keys. It is not intended that the map would be modified by clients.
*/
Map/*<Integer,String>*/ FLAG_TO_NAME_MAP = new ConstantsMap();
Map/*<Integer,String>*/ NAME_TO_FLAG_MAP = new ConstantsMap();
final class ConstantsMap extends HashMap {
private static final long serialVersionUID = 1L;
private ConstantsMap() {
super();
put(Integer.valueOf(F_EXPAND_STACKMAP), EXPAND_STACKMAP);
put(Integer.valueOf(F_LINK_VIEW_TO_EDITOR), LINK_VIEW_TO_EDITOR);
put(Integer.valueOf(F_RECALCULATE_STACKMAP), RECALCULATE_STACKMAP);
put(Integer.valueOf(F_SHOW_ANALYZER), SHOW_ANALYZER);
put(Integer.valueOf(F_SHOW_ASMIFIER_CODE), SHOW_ASMIFIER_CODE);
put(Integer.valueOf(F_SHOW_HEX_VALUES), SHOW_HEX_VALUES);
put(Integer.valueOf(F_SHOW_LINE_INFO), SHOW_LINE_INFO);
put(Integer.valueOf(F_SHOW_ONLY_SELECTED_ELEMENT), SHOW_ONLY_SELECTED_ELEMENT);
put(Integer.valueOf(F_SHOW_RAW_BYTECODE), SHOW_RAW_BYTECODE);
put(Integer.valueOf(F_SHOW_STACKMAP), SHOW_STACKMAP);
put(Integer.valueOf(F_SHOW_VARIABLES), SHOW_VARIABLES);
put(EXPAND_STACKMAP, Integer.valueOf(F_EXPAND_STACKMAP));
put(LINK_VIEW_TO_EDITOR, Integer.valueOf(F_LINK_VIEW_TO_EDITOR));
put(RECALCULATE_STACKMAP, Integer.valueOf(F_RECALCULATE_STACKMAP));
put(SHOW_ANALYZER, Integer.valueOf(F_SHOW_ANALYZER));
put(SHOW_ASMIFIER_CODE, Integer.valueOf(F_SHOW_ASMIFIER_CODE));
put(SHOW_HEX_VALUES, Integer.valueOf(F_SHOW_HEX_VALUES));
put(SHOW_LINE_INFO, Integer.valueOf(F_SHOW_LINE_INFO));
put(SHOW_ONLY_SELECTED_ELEMENT, Integer.valueOf(F_SHOW_ONLY_SELECTED_ELEMENT));
put(SHOW_RAW_BYTECODE, Integer.valueOf(F_SHOW_RAW_BYTECODE));
put(SHOW_STACKMAP, Integer.valueOf(F_SHOW_STACKMAP));
put(SHOW_VARIABLES, Integer.valueOf(F_SHOW_VARIABLES));
}
}
}
/*******************************************************************************
* Copyright (c) 2008 Andrei Loskutov.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the BSD License
* which accompanies this distribution, and is available at
* http://www.opensource.org/licenses/bsd-license.php
* Contributor: Andrei Loskutov - initial API and implementation
*******************************************************************************/
package de.loskutov.bco.preferences;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import org.eclipse.core.net.proxy.IProxyData;
import org.eclipse.core.net.proxy.IProxyService;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Text;
import org.osgi.util.tracker.ServiceTracker;
import de.loskutov.bco.BytecodeOutlinePlugin;
/**
* @author Andrei
*/
public class RateIt {
private static boolean ratingDone;
static boolean isProxyEnabled() {
ServiceTracker proxyTracker = new ServiceTracker(BytecodeOutlinePlugin.getDefault()
.getBundle().getBundleContext(), IProxyService.class.getName(), null);
proxyTracker.open();
IProxyService proxyService = (IProxyService) proxyTracker.getService();
IProxyData proxyData = proxyService.getProxyDataForHost(
"www.eclipseplugincentral.com", IProxyData.HTTP_PROXY_TYPE);
proxyTracker.close();
return proxyData != null && proxyService.isProxiesEnabled();
}
static boolean rate(int value, String comment) {
DataOutputStream out = null;
try {
URL url = new URL("http://www.eclipseplugincentral.com/Web_Links.html");
URLConnection urlConn = url.openConnection();
urlConn.setDoInput(true);
urlConn.setDoOutput(true);
urlConn.setUseCaches(false);
urlConn.setRequestProperty("Content-Type",
"application/x-www-form-urlencoded");
out = new DataOutputStream(urlConn.getOutputStream());
String content = "rating=" + value + "&ratinglid=275&ratinguser=outside"
+ "&req=addrating";
if (comment != null && comment.trim().length() > 0) {
content += "&ratingcomments="
+ URLEncoder.encode(comment.trim(), "UTF-8");
}
out.writeBytes(content);
out.flush();
out.close();
BufferedReader input = new BufferedReader(new InputStreamReader(urlConn
.getInputStream()));
// String s;
while ((/* s = */input.readLine()) != null) {
// just read response
// System.out.println(s);
}
input.close();
ratingDone = true;
return true;
} catch (IOException e) {
BytecodeOutlinePlugin.error("Failed to rate on EPIC...", e);
return false;
} finally {
if (out != null) {
try {
out.close();
} catch (IOException e) {
BytecodeOutlinePlugin.log(e, IStatus.ERROR);
}
}
}
}
static void createTextArea(Composite defPanel) {
Composite commonPanel = new Composite(defPanel, SWT.NONE);
GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false);
GridLayout layout = new GridLayout();
layout.numColumns = 3;
layout.marginWidth = 0;
commonPanel.setLayout(layout);
commonPanel.setLayoutData(gridData);
Label label = new Label(commonPanel, SWT.LEFT);
label.setText("Rate:");
label.setToolTipText("You can vote only once!");
final Combo combo = new Combo(commonPanel, SWT.READ_ONLY | SWT.BORDER);
final String[] items = new String[] { "Perfect", "Very good", "Good", "So so" };
combo.setItems(items);
combo.select(0);
gridData = new GridData();
gridData.widthHint = 50;
combo.setLayoutData(gridData);
combo.setToolTipText("You can vote only once!");
final Button okButton = new Button(commonPanel, SWT.NONE);
okButton.setText("Rate now!");
okButton.setToolTipText("You can vote only once!");
commonPanel = new Composite(defPanel, SWT.NONE);
gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
layout = new GridLayout();
layout.numColumns = 1;
layout.marginWidth = 0;
commonPanel.setLayout(layout);
commonPanel.setLayoutData(gridData);
String tooltip = "This comment will appear on the EPIC web page (www.eclipseplugincentral.com)";
label = new Label(commonPanel, SWT.LEFT);
label.setText("Rating Comment");
label.setToolTipText(tooltip);
final String commentText = "I like it ("
+ System.getProperty("user.name", "anonymous user") + ")";
final Text textArea = new Text(commonPanel, SWT.MULTI | SWT.V_SCROLL | SWT.BORDER
| SWT.V_SCROLL | SWT.H_SCROLL);
gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
textArea.setLayoutData(gridData);
textArea.setText(items[0] + ", " + commentText);
textArea.setToolTipText(tooltip);
combo.addSelectionListener(new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
public void widgetSelected(SelectionEvent e) {
if (combo.getSelectionIndex() == items.length - 1) {
okButton.setEnabled(false);
textArea.setText("If you have to report any issues,\n"
+ "please don't hesitate to mail me at:\nloskutov@gmx.de!");
textArea.setToolTipText(null);
} else {
okButton.setEnabled(true);
textArea.setText(items[combo.getSelectionIndex()] + ", "
+ commentText);
}
}
});
okButton.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
if (!combo.isEnabled()) {
return;
}
boolean success = rate(10 - combo.getSelectionIndex(), textArea.getText());
if (success) {
combo.setEnabled(false);
textArea.setEnabled(false);
okButton.setEnabled(false);
}
}
});
if (ratingDone) {
textArea.setText("Thank you for rating!");
combo.setEnabled(false);
textArea.setEditable(false);
okButton.setEnabled(false);
} else if (isProxyEnabled()) {
textArea
.setText("Unfortunately,\nhttp proxy "
+ "is enabled and therefore you can't rate BCO plugin now...\n"
+ "Please try to rate for BCO plugin\nfrom another workstation,\nuse this url:\n"
+ "www.eclipseplugincentral.com/Web_Links-index-req-ratelink-lid-275-ttitle-Bytecode_Outline.html");
combo.setEnabled(false);
textArea.setEditable(false);
okButton.setEnabled(false);
}
}
}
......@@ -10,6 +10,8 @@ package de.loskutov.bco.ui.actions;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import de.loskutov.bco.BytecodeOutlinePlugin;
......@@ -22,7 +24,7 @@ import de.loskutov.bco.BytecodeOutlinePlugin;
* event name.
* @author Andrei
*/
public abstract class DefaultToggleAction extends Action {
public abstract class DefaultToggleAction extends Action implements IPropertyChangeListener {
private static final String ACTION = "action";
......@@ -35,6 +37,23 @@ public abstract class DefaultToggleAction extends Action {
boolean isChecked = store.getBoolean(id);
setChecked(isChecked);
store.addPropertyChangeListener(this);
}
public void propertyChange(PropertyChangeEvent event){
String id = getId();
if(!id.equals(event.getProperty())){
return;
}
IPreferenceStore store = BytecodeOutlinePlugin.getDefault().getPreferenceStore();
boolean isChecked = store.getBoolean(id);
setChecked(isChecked);
run(isChecked);
}
public void dispose(){
IPreferenceStore store = BytecodeOutlinePlugin.getDefault().getPreferenceStore();
store.removePropertyChangeListener(this);
}
private void init(){
......
......@@ -147,16 +147,16 @@ public class BytecodeOutlineView extends ViewPart {
protected EditorListener editorListener;
protected Action selectionChangedAction;
protected Action refreshVarsAndStackAction;
protected Action linkWithEditorAction;
protected Action showSelectedOnlyAction;
protected Action setRawModeAction;
protected Action toggleASMifierModeAction;
protected Action hideLineInfoAction;
protected Action hideLocalsAction;
protected Action hideStackMapAction;
protected Action showHexValuesAction;
protected Action expandStackMapAction;
protected Action toggleVerifierAction;
protected DefaultToggleAction linkWithEditorAction;
protected DefaultToggleAction showSelectedOnlyAction;
protected DefaultToggleAction setRawModeAction;
protected DefaultToggleAction toggleASMifierModeAction;
protected DefaultToggleAction hideLineInfoAction;
protected DefaultToggleAction hideLocalsAction;
protected DefaultToggleAction hideStackMapAction;
protected DefaultToggleAction showHexValuesAction;
protected DefaultToggleAction expandStackMapAction;
protected DefaultToggleAction toggleVerifierAction;
protected StatusLineManager statusLineManager;
protected BCOViewSelectionProvider viewSelectionProvider;
......@@ -233,7 +233,7 @@ public class BytecodeOutlineView extends ViewPart {
lvtTable.setEnabled(on);
}
showSelectedOnlyAction.setEnabled(on);
linkWithEditorAction.setEnabled(on);
// linkWithEditorAction.setEnabled(on);
selectionChangedAction.setEnabled(on);
toggleVerifierAction.setEnabled(on);
hideLocalsAction.setEnabled(on);
......@@ -393,6 +393,8 @@ public class BytecodeOutlineView extends ViewPart {
createToolbarActions();
setEnabled(false);
// activateView();
}
private void initModes() {
......@@ -457,8 +459,10 @@ public class BytecodeOutlineView extends ViewPart {
if (!toggleASMifierModeAction.isChecked()) {
setRawModeAction.setEnabled(true);
}
activateView();
checkOpenEditors(true);
// refreshView();
inputChanged = true;
refreshView();
}
}
};
......@@ -769,6 +773,19 @@ public class BytecodeOutlineView extends ViewPart {
javaEditor = null;
setJavaInput(null);
lastChildElement = null;
lastDecompiledResult = null;
linkWithEditorAction.dispose();
showSelectedOnlyAction.dispose();
setRawModeAction.dispose();
toggleASMifierModeAction.dispose();
hideLineInfoAction.dispose();
hideLocalsAction.dispose();
hideStackMapAction.dispose();
showHexValuesAction.dispose();
expandStackMapAction.dispose();
toggleVerifierAction.dispose();
linkWithEditorAction = null;
selectionChangedAction = null;
refreshVarsAndStackAction = null;
......@@ -781,7 +798,6 @@ public class BytecodeOutlineView extends ViewPart {
showHexValuesAction = null;
expandStackMapAction = null;
toggleVerifierAction = null;
lastDecompiledResult = null;
super.dispose();
}
......@@ -859,6 +875,9 @@ public class BytecodeOutlineView extends ViewPart {
protected void handlePartVisible(IWorkbenchPart part) {
if (!modes.get(BCOConstants.F_LINK_VIEW_TO_EDITOR)) {
if(this == part){
isVisible = true;
}
return;
}
if (this == part) {
......
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