use of org.freeplane.core.ui.components.IconSelectionPopupDialog in project freeplane by freeplane.
the class IconSelectionPlugin method actionPerformed.
public void actionPerformed(final ActionEvent e) {
final ModeController modeController = Controller.getCurrentModeController();
ArrayList<IIconInformation> actions = new ArrayList<IIconInformation>();
final Controller controller = Controller.getCurrentController();
actions.add((IIconInformation) modeController.getAction("RemoveIcon_0_Action"));
actions.add((IIconInformation) modeController.getAction("RemoveIconAction"));
actions.add((IIconInformation) modeController.getAction("RemoveAllIconsAction"));
final MIconController mIconController = (MIconController) IconController.getController();
for (AFreeplaneAction aFreeplaneAction : mIconController.getIconActions()) actions.add((IIconInformation) aFreeplaneAction);
final IconSelectionPopupDialog selectionDialog = new IconSelectionPopupDialog(UITools.getCurrentFrame(), actions);
final NodeModel selected = controller.getSelection().getSelected();
controller.getMapViewManager().scrollNodeToVisible(selected);
selectionDialog.pack();
UITools.setDialogLocationRelativeTo(selectionDialog, selected);
selectionDialog.setModal(true);
selectionDialog.show();
final int result = selectionDialog.getResult();
if (result >= 0) {
final Action action = (Action) actions.get(result);
action.actionPerformed(new ActionEvent(action, 0, NodeModel.NODE_ICON, selectionDialog.getModifiers()));
}
}
use of org.freeplane.core.ui.components.IconSelectionPopupDialog in project freeplane by freeplane.
the class IconProperty method actionPerformed.
public void actionPerformed(final ActionEvent e) {
final List<MindIcon> icons = new ArrayList<MindIcon>();
final List<String> descriptions = new ArrayList<String>();
for (final MindIcon icon : mIcons) {
icons.add(icon);
descriptions.add(icon.getTranslationValueLabel());
}
final IconSelectionPopupDialog dialog = new IconSelectionPopupDialog(JOptionPane.getFrameForComponent((Component) e.getSource()), icons);
dialog.setLocationRelativeTo(JOptionPane.getFrameForComponent((Component) e.getSource()));
dialog.setModal(true);
dialog.setVisible(true);
final int result = dialog.getResult();
if (result >= 0) {
final MindIcon icon = mIcons.get(result);
setValue(icon.getName());
firePropertyChangeEvent();
}
}
Aggregations