private void createToolbarActions() {
createTextActions();
final IActionBars bars = getViewSite().getActionBars();
final IToolBarManager tmanager = bars.getToolBarManager();
final IMenuManager mmanager = bars.getMenuManager();
selectionChangedAction = new Action() {
public void run() {
Point selection = textControl.getSelection();
setSelectionInJavaEditor(selection);
}
};
refreshVarsAndStackAction = new Action() {
public void run() {
int selectionIndex = tableControl.getSelectionIndex();
TableItem[] items = tableControl.getSelection();
if(items == null || items.length < 1){
return;
}
String line = items[0].getText(0);
if(line == null || "".equals(line)){
return;
}
Integer valueOf = Integer.valueOf(line);
if(valueOf != null){
updateVerifierControl4insn(valueOf.intValue());
tableControl.setSelection(selectionIndex);
}
}
};
linkWithEditorAction = new DefaultToggleAction(
BCOConstants.LINK_VIEW_TO_EDITOR) {
public void run(boolean newState) {
setMode(BCOConstants.F_LINK_VIEW_TO_EDITOR, newState);
if (modes.get(BCOConstants.F_LINK_VIEW_TO_EDITOR)) {
showSelectedOnlyAction.setEnabled(true);
toggleVerifierAction.setEnabled(true);
hideLineInfoAction.setEnabled(true);
hideLocalsAction.setEnabled(true);
toggleASMifierModeAction.setEnabled(true);
if (!toggleASMifierModeAction.isChecked()) {
setRawModeAction.setEnabled(true);
}
activateView();
checkOpenEditors(true);
inputChanged = true;
refreshView();
}
}
};
showSelectedOnlyAction = new DefaultToggleAction(
BCOConstants.SHOW_ONLY_SELECTED_ELEMENT) {
public void run(boolean newState) {
setMode(BCOConstants.F_SHOW_ONLY_SELECTED_ELEMENT, newState);
inputChanged = true;
refreshView();
}
};
setRawModeAction = new DefaultToggleAction(
BCOConstants.SHOW_RAW_BYTECODE) {
public void run(boolean newState) {
setMode(BCOConstants.F_SHOW_RAW_BYTECODE, newState);
inputChanged = true;
refreshView();
}
};
hideLineInfoAction = new DefaultToggleAction(
BCOConstants.SHOW_LINE_INFO) {
public void run(boolean newState) {
setMode(BCOConstants.F_SHOW_LINE_INFO, newState);
inputChanged = true;
refreshView();
}
};
hideLocalsAction = new DefaultToggleAction(BCOConstants.SHOW_VARIABLES) {
public void run(boolean newState) {
setMode(BCOConstants.F_SHOW_VARIABLES, newState);
inputChanged = true;
refreshView();
}
};
hideStackMapAction = new DefaultToggleAction(BCOConstants.SHOW_STACKMAP) {
public void run(boolean newState) {
setMode(BCOConstants.F_SHOW_STACKMAP, newState);
inputChanged = true;
refreshView();
}
};
expandStackMapAction = new DefaultToggleAction(
BCOConstants.EXPAND_STACKMAP) {
public void run(boolean newState) {
setMode(BCOConstants.F_EXPAND_STACKMAP, newState);
inputChanged = true;
refreshView();
}
};
showHexValuesAction = new DefaultToggleAction(
BCOConstants.SHOW_HEX_VALUES) {
public void run(boolean newState) {
setMode(BCOConstants.F_SHOW_HEX_VALUES, newState);
inputChanged = true;
refreshView();
}
};
toggleASMifierModeAction = new DefaultToggleAction(
BCOConstants.SHOW_ASMIFIER_CODE) {
public void run(boolean newState) {
setMode(BCOConstants.F_SHOW_ASMIFIER_CODE, newState);
if (newState) {
setMode(BCOConstants.F_SHOW_RAW_BYTECODE, true);
setRawModeAction.setEnabled(false);
} else {
setRawModeAction.setEnabled(true);
}
inputChanged = true;
refreshView();
}
};
toggleVerifierAction = new DefaultToggleAction(
BCOConstants.SHOW_ANALYZER) {
public void run(boolean newState) {
toggleVerifyMode(mmanager, newState);
inputChanged = true;
refreshView();
}
};
mmanager.add(linkWithEditorAction);
mmanager.add(showSelectedOnlyAction);
mmanager.add(setRawModeAction);
mmanager.add(hideLineInfoAction);
mmanager.add(hideLocalsAction);
mmanager.add(showHexValuesAction);
mmanager.add(hideStackMapAction);
mmanager.add(expandStackMapAction);
mmanager.add(toggleASMifierModeAction);
mmanager.add(toggleVerifierAction);
mmanager.add(new Separator());
toggleOrientationActions = new ToggleOrientationAction[]{
new ToggleOrientationAction(this, VIEW_ORIENTATION_VERTICAL),
new ToggleOrientationAction(this, VIEW_ORIENTATION_HORIZONTAL),
new ToggleOrientationAction(this, VIEW_ORIENTATION_AUTOMATIC)};
for (int i = 0; i < toggleOrientationActions.length; ++i) {
mmanager.add(toggleOrientationActions[i]);
}
tmanager.add(linkWithEditorAction);
tmanager.add(showSelectedOnlyAction);
tmanager.add(setRawModeAction);