use of javax.swing.JRadioButtonMenuItem in project oxygen-git-client-addon by oxygenxml.
the class HistoryPanel method addPresentHistoryActions.
/**
* Add actions for present history in different way.
* <br>
* History could be presented so: All branches(remote + locals), All local branches, Current branch(remote + local), Current local branch.
*
* @param button
*/
private void addPresentHistoryActions(final SplitMenuButton button) {
final ButtonGroup branchActionsGroup = new ButtonGroup();
final HistoryStrategy[] strategies = HistoryStrategy.values();
for (HistoryStrategy strategy : strategies) {
AbstractAction action = new AbstractAction(strategy.toString()) {
@Override
public void actionPerformed(ActionEvent arg0) {
currentStrategy = strategy;
button.setText(strategy.toString());
optionsStorage.setOption(OptionTags.HISTORY_STRATEGY, strategy.toString());
scheduleRefreshHistory();
}
};
final JRadioButtonMenuItem menuItem = new JRadioButtonMenuItem(action);
menuItem.setToolTipText(strategy.getToolTipText());
branchActionsGroup.add(menuItem);
button.add(menuItem);
if (currentStrategy.equals(strategy)) {
menuItem.setSelected(true);
}
}
}
use of javax.swing.JRadioButtonMenuItem in project qvcsos by jimv39.
the class ActivityPaneLogLevelButtonGroup method selectActiveButton.
void selectActiveButton(Level level) {
String levelString = level.toString();
Enumeration it = getElements();
while (it.hasMoreElements()) {
JRadioButtonMenuItem button = (JRadioButtonMenuItem) it.nextElement();
if (button.getText().equalsIgnoreCase(levelString)) {
setSelected(button.getModel(), true);
break;
}
}
}
use of javax.swing.JRadioButtonMenuItem in project qvcsos by jimv39.
the class ActivityPaneLogLevelButtonGroup method getSelectedLevel.
Level getSelectedLevel() {
Level retVal = Level.INFO;
Enumeration it = getElements();
while (it.hasMoreElements()) {
JRadioButtonMenuItem button = (JRadioButtonMenuItem) it.nextElement();
if (button.getModel().isSelected()) {
String buttonString = button.getText();
retVal = Level.parse(buttonString.toUpperCase());
break;
}
}
return retVal;
}
use of javax.swing.JRadioButtonMenuItem in project cristal-ise by cristal-ise.
the class MenuBuilder method addMenuItem.
/**
* Adds a menu item to a menu. Adds an action listener to the menu item.
*/
public void addMenuItem(String itemName, String menuName, ButtonGroup bg, int checkBox) {
// checks to see if the menu to add the item to exists
if (availableMenus.containsKey(menuName)) {
JMenuItem myItem = new JMenuItem(itemName);
if (bg != null) {
// if the menu item equals the current style, set it selected
myItem = new JRadioButtonMenuItem(itemName, UIManager.getLookAndFeel().getName().equals(itemName));
bg.add(myItem);
}
if (checkBox != 0) {
myItem = new JCheckBoxMenuItem(itemName, checkBox == 2);
}
myItem.addActionListener(this);
JMenu myMenu = availableMenus.get(menuName);
myMenu.add(myItem);
}
}
use of javax.swing.JRadioButtonMenuItem in project bytecode-viewer by Konloch.
the class MainViewerGUI method buildSettingsMenu.
public void buildSettingsMenu() {
rootMenu.add(settingsMainMenu);
// settingsMainMenu.add(visualSettings);
// settingsMainMenu.add(new JSeparator());
settingsMainMenu.add(compileOnSave);
settingsMainMenu.add(autoCompileOnRefresh);
settingsMainMenu.add(refreshOnChange);
settingsMainMenu.add(new JSeparator());
settingsMainMenu.add(updateCheck);
settingsMainMenu.add(forcePureAsciiAsText);
settingsMainMenu.add(new JSeparator());
settingsMainMenu.add(setPython2);
settingsMainMenu.add(setPython3);
settingsMainMenu.add(setJRERT);
settingsMainMenu.add(setOptionalLibrary);
settingsMainMenu.add(setJavac);
settingsMainMenu.add(new JSeparator());
// TODO the dialog below works but for 3 options,
// it might be better to leave it as a secondary menu
settingsMainMenu.add(apkConversionSecondaryMenu);
// settingsMainMenu.add(useNewSettingsDialog ? apkConversionSettings : apkConversionMenu);
// Smali minSdkVersion
minSdkVersionSpinner.setPreferredSize(new Dimension(60, 24));
minSdkVersionSpinner.setMinimumSize(new Dimension(60, 24));
minSdkVersionSpinner.setModel(new SpinnerNumberModel(26, 1, null, 1));
minSdkVersionMenu.add(minSdkVersionSpinner);
settingsMainMenu.add(minSdkVersionMenu);
settingsMainMenu.add(new JSeparator());
fontSpinner.setPreferredSize(new Dimension(60, 24));
fontSpinner.setMinimumSize(new Dimension(60, 24));
fontSpinner.setModel(new SpinnerNumberModel(12, 1, null, 1));
fontSize.add(fontSpinner);
apkConversionSecondaryMenu.add(decodeAPKResources);
apkConversionSecondaryMenu.add(apkConversionDex);
apkConversionSecondaryMenu.add(apkConversionEnjarify);
apkConversionGroup.add(apkConversionDex);
apkConversionGroup.add(apkConversionEnjarify);
apkConversionGroup.setSelected(apkConversionDex.getModel(), true);
// apkConversionSettingsDialog = new SettingsDialogue(apkConversionSecondaryMenu, new JPanel());
apkConversionSettings.addActionListener((e) -> apkConversionSettingsDialog.showDialog());
ButtonGroup rstaGroup = new ButtonGroup();
for (RSTATheme t : RSTATheme.values()) {
JRadioButtonMenuItem item = new TranslatedJRadioButtonMenuItem(t.getReadableName(), t.getTranslation());
if (Configuration.rstaTheme.equals(t))
item.setSelected(true);
rstaGroup.add(item);
item.addActionListener(e -> {
Configuration.rstaTheme = t;
item.setSelected(true);
SettingsSerializer.saveSettingsAsync();
updateTabTheme();
});
rstaThemes.put(t, item);
rstaTheme.add(item);
}
rstaThemeSettingsDialog = new SettingsDialog(rstaTheme, new JPanel());
rstaThemeSettings.addActionListener((e) -> rstaThemeSettingsDialog.showDialog());
ButtonGroup lafGroup = new ButtonGroup();
for (LAFTheme theme : LAFTheme.values()) {
JRadioButtonMenuItem item = new TranslatedJRadioButtonMenuItem(theme.getReadableName(), theme.getTranslation());
if (Configuration.lafTheme.equals(theme))
item.setSelected(true);
lafGroup.add(item);
item.addActionListener(e -> {
Configuration.lafTheme = theme;
Configuration.rstaTheme = theme.getRSTATheme();
rstaThemes.get(Configuration.rstaTheme).setSelected(true);
item.setSelected(true);
SettingsSerializer.saveSettingsAsync();
try {
theme.setLAF();
updateTabTheme();
} catch (Exception ex) {
ex.printStackTrace();
}
});
lafThemes.put(theme, item);
lafTheme.add(item);
}
lafThemeSettingsDialog = new SettingsDialog(lafTheme, new JPanel());
lafThemeSettings.addActionListener((e) -> lafThemeSettingsDialog.showDialog());
ButtonGroup languageGroup = new ButtonGroup();
for (Language l : Language.values()) {
JRadioButtonMenuItem item = new JRadioButtonMenuItem(l.getReadableName());
if (Configuration.language.equals(l))
item.setSelected(true);
languageGroup.add(item);
item.addActionListener(e -> {
SettingsSerializer.saveSettingsAsync();
MiscUtils.setLanguage(l);
});
languages.put(l, item);
language.add(item);
}
languageSettingsDialog = new SettingsDialog(language, new JPanel());
languageSettings.addActionListener((e) -> languageSettingsDialog.showDialog());
visualSettings.add(useNewSettingsDialog ? lafThemeSettings : lafTheme);
visualSettings.add(useNewSettingsDialog ? rstaThemeSettings : rstaTheme);
visualSettings.add(useNewSettingsDialog ? languageSettings : language);
visualSettings.add(fontSize);
visualSettings.add(showFileInTabTitle);
visualSettings.add(simplifyNameInTabTitle);
visualSettings.add(synchronizedViewing);
visualSettings.add(showClassMethods);
// PROCYON SETTINGS
settingsMainMenu.add(useNewSettingsDialog ? procyonSettings : procyonSettingsSecondaryMenu);
procyonSettingsSecondaryMenu.add(alwaysGenerateExceptionVars);
procyonSettingsSecondaryMenu.add(excludeNestedTypes);
procyonSettingsSecondaryMenu.add(showDebugLineNumbers);
procyonSettingsSecondaryMenu.add(includeLineNumbersInBytecode);
procyonSettingsSecondaryMenu.add(includeErrorDiagnostics);
procyonSettingsSecondaryMenu.add(showSyntheticMembers);
procyonSettingsSecondaryMenu.add(simplifyMemberReferences);
procyonSettingsSecondaryMenu.add(mergeVariables);
procyonSettingsSecondaryMenu.add(forceExplicitTypeArguments);
procyonSettingsSecondaryMenu.add(forceExplicitImports);
procyonSettingsSecondaryMenu.add(flattenSwitchBlocks);
procyonSettingsSecondaryMenu.add(retainPointlessSwitches);
procyonSettingsSecondaryMenu.add(retainRedunantCasts);
procyonSettingsSecondaryMenu.add(unicodeOutputEnabled);
procyonSettingsDialog = new SettingsDialog(procyonSettingsSecondaryMenu, new JPanel());
procyonSettings.addActionListener((e) -> procyonSettingsDialog.showDialog());
// CFR SETTINGS
settingsMainMenu.add(useNewSettingsDialog ? cfrSettings : cfrSettingsSecondaryMenu);
cfrSettingsSecondaryMenu.add(decodeEnumSwitch);
cfrSettingsSecondaryMenu.add(sugarEnums);
cfrSettingsSecondaryMenu.add(decodeStringSwitch);
cfrSettingsSecondaryMenu.add(arrayiter);
cfrSettingsSecondaryMenu.add(collectioniter);
cfrSettingsSecondaryMenu.add(innerClasses);
cfrSettingsSecondaryMenu.add(removeBoilerPlate);
cfrSettingsSecondaryMenu.add(removeInnerClassSynthetics);
cfrSettingsSecondaryMenu.add(decodeLambdas);
cfrSettingsSecondaryMenu.add(hideBridgeMethods);
cfrSettingsSecondaryMenu.add(liftConstructorInit);
cfrSettingsSecondaryMenu.add(removeDeadMethods);
cfrSettingsSecondaryMenu.add(removeBadGenerics);
cfrSettingsSecondaryMenu.add(sugarAsserts);
cfrSettingsSecondaryMenu.add(sugarBoxing);
cfrSettingsSecondaryMenu.add(showVersion);
cfrSettingsSecondaryMenu.add(decodeFinally);
cfrSettingsSecondaryMenu.add(tidyMonitors);
cfrSettingsSecondaryMenu.add(lenient);
cfrSettingsSecondaryMenu.add(dumpClassPath);
cfrSettingsSecondaryMenu.add(comments);
cfrSettingsSecondaryMenu.add(forceTopSort);
cfrSettingsSecondaryMenu.add(forceTopSortAggress);
cfrSettingsSecondaryMenu.add(forceExceptionPrune);
cfrSettingsSecondaryMenu.add(stringBuffer);
cfrSettingsSecondaryMenu.add(stringBuilder);
cfrSettingsSecondaryMenu.add(silent);
cfrSettingsSecondaryMenu.add(recover);
cfrSettingsSecondaryMenu.add(eclipse);
cfrSettingsSecondaryMenu.add(override);
cfrSettingsSecondaryMenu.add(showInferrable);
cfrSettingsSecondaryMenu.add(aexagg);
cfrSettingsSecondaryMenu.add(forceCondPropagate);
cfrSettingsSecondaryMenu.add(hideUTF);
cfrSettingsSecondaryMenu.add(hideLongStrings);
cfrSettingsSecondaryMenu.add(commentMonitor);
cfrSettingsSecondaryMenu.add(allowCorrecting);
cfrSettingsSecondaryMenu.add(labelledBlocks);
cfrSettingsSecondaryMenu.add(j14ClassOBJ);
cfrSettingsSecondaryMenu.add(hideLangImports);
cfrSettingsSecondaryMenu.add(recoveryTypeClash);
cfrSettingsSecondaryMenu.add(recoveryTypehInts);
cfrSettingsSecondaryMenu.add(forceTurningIFs);
cfrSettingsSecondaryMenu.add(forLoopAGGCapture);
cfrSettingsDialog = new SettingsDialog(cfrSettingsSecondaryMenu, new JPanel());
cfrSettings.addActionListener((e) -> cfrSettingsDialog.showDialog());
// FERNFLOWER SETTINGS
settingsMainMenu.add(useNewSettingsDialog ? fernFlowerSettings : fernFlowerSettingsSecondaryMenu);
fernFlowerSettingsSecondaryMenu.add(ren);
fernFlowerSettingsSecondaryMenu.add(dc4);
fernFlowerSettingsSecondaryMenu.add(nns);
fernFlowerSettingsSecondaryMenu.add(ner);
fernFlowerSettingsSecondaryMenu.add(bto);
fernFlowerSettingsSecondaryMenu.add(rgn);
fernFlowerSettingsSecondaryMenu.add(rer);
fernFlowerSettingsSecondaryMenu.add(rbr);
fernFlowerSettingsSecondaryMenu.add(rsy);
fernFlowerSettingsSecondaryMenu.add(hes);
fernFlowerSettingsSecondaryMenu.add(hdc);
fernFlowerSettingsSecondaryMenu.add(din);
fernFlowerSettingsSecondaryMenu.add(das);
fernFlowerSettingsSecondaryMenu.add(dgs);
fernFlowerSettingsSecondaryMenu.add(den);
fernFlowerSettingsSecondaryMenu.add(uto);
fernFlowerSettingsSecondaryMenu.add(udv);
fernFlowerSettingsSecondaryMenu.add(fdi);
fernFlowerSettingsSecondaryMenu.add(asc);
fernFlowerSettingsDialog = new SettingsDialog(fernFlowerSettingsSecondaryMenu, new JPanel());
fernFlowerSettings.addActionListener((e) -> fernFlowerSettingsDialog.showDialog());
// CFIDE SETTINGS
settingsMainMenu.add(useNewSettingsDialog ? bytecodeDecompilerSettings : bytecodeDecompilerSettingsSecondaryMenu);
bytecodeDecompilerSettingsSecondaryMenu.add(debugHelpers);
bytecodeDecompilerSettingsSecondaryMenu.add(appendBracketsToLabels);
bytecodeDecompilerSettingsDialog = new SettingsDialog(bytecodeDecompilerSettingsSecondaryMenu, new JPanel());
bytecodeDecompilerSettings.addActionListener((e) -> bytecodeDecompilerSettingsDialog.showDialog());
deleteForeignOutdatedLibs.addActionListener(arg0 -> showForeignLibraryWarning());
forcePureAsciiAsText.addActionListener(arg0 -> SettingsSerializer.saveSettingsAsync());
setPython2.addActionListener(arg0 -> ExternalResources.getSingleton().selectPython2());
setJRERT.addActionListener(arg0 -> ExternalResources.getSingleton().selectJRERTLibrary());
setPython3.addActionListener(arg0 -> ExternalResources.getSingleton().selectPython3());
setOptionalLibrary.addActionListener(arg0 -> ExternalResources.getSingleton().selectOptionalLibraryFolder());
setJavac.addActionListener(arg0 -> ExternalResources.getSingleton().selectJavac());
showFileInTabTitle.addActionListener(arg0 -> {
Configuration.displayParentInTab = BytecodeViewer.viewer.showFileInTabTitle.isSelected();
SettingsSerializer.saveSettingsAsync();
BytecodeViewer.refreshAllTabTitles();
});
simplifyNameInTabTitle.addActionListener(arg0 -> {
Configuration.simplifiedTabNames = BytecodeViewer.viewer.simplifyNameInTabTitle.isSelected();
SettingsSerializer.saveSettingsAsync();
BytecodeViewer.refreshAllTabTitles();
});
}
Aggregations