javax.swing.text.Keymap Java Examples
The following examples show how to use
javax.swing.text.Keymap.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CslEditorKit.java From netbeans with Apache License 2.0 | 6 votes |
private void addAcceleretors(Action a, JMenuItem item, JTextComponent target) { // Try to get the accelerator Keymap km = target.getKeymap(); if (km != null) { KeyStroke[] keys = km.getKeyStrokesForAction(a); if ((keys != null) && (keys.length > 0)) { item.setAccelerator(keys[0]); } else if (a != null) { KeyStroke ks = (KeyStroke)a.getValue(Action.ACCELERATOR_KEY); if (ks != null) { item.setAccelerator(ks); } } } }
Example #2
Source File: ScrollCompletionPane.java From netbeans with Apache License 2.0 | 6 votes |
/** Attempt to find the editor keystroke for the given editor action. */ private KeyStroke[] findEditorKeys(JTextComponent component, String editorActionName, KeyStroke defaultKey) { // This method is implemented due to the issue // #25715 - Attempt to search keymap for the keybinding that logically corresponds to the action KeyStroke[] ret = new KeyStroke[] { defaultKey }; if (component != null) { Action a = component.getActionMap().get(editorActionName); Keymap km = component.getKeymap(); if (a != null && km != null) { KeyStroke[] keys = km.getKeyStrokesForAction(a); if (keys != null && keys.length > 0) { ret = keys; } } } return ret; }
Example #3
Source File: ScrollCompletionPane.java From netbeans with Apache License 2.0 | 6 votes |
/** Attempt to find the editor keystroke for the given editor action. */ private KeyStroke[] findEditorKeys(String editorActionName, KeyStroke defaultKey) { // This method is implemented due to the issue // #25715 - Attempt to search keymap for the keybinding that logically corresponds to the action KeyStroke[] ret = new KeyStroke[] { defaultKey }; if (component != null) { Action a = component.getActionMap().get(editorActionName); Keymap km = component.getKeymap(); if (a != null && km != null) { KeyStroke[] keys = km.getKeyStrokesForAction(a); if (keys != null && keys.length > 0) { ret = keys; } } } return ret; }
Example #4
Source File: DocumentationScrollPane.java From netbeans with Apache License 2.0 | 6 votes |
/** Attempt to find the editor keystroke for the given editor action. */ private KeyStroke[] findEditorKeys(String editorActionName, KeyStroke defaultKey, JTextComponent component) { // This method is implemented due to the issue // #25715 - Attempt to search keymap for the keybinding that logically corresponds to the action KeyStroke[] ret = new KeyStroke[] { defaultKey }; if (component != null) { TextUI componentUI = component.getUI(); Keymap km = component.getKeymap(); if (componentUI != null && km != null) { EditorKit kit = componentUI.getEditorKit(component); if (kit instanceof BaseKit) { Action a = ((BaseKit)kit).getActionByName(editorActionName); if (a != null) { KeyStroke[] keys = km.getKeyStrokesForAction(a); if (keys != null && keys.length > 0) { ret = keys; } } } } } return ret; }
Example #5
Source File: MainMenuAction.java From netbeans with Apache License 2.0 | 6 votes |
/** Adds accelerators to given JMenuItem taken from the action */ protected static void addAccelerators(Action a, JMenuItem item, JTextComponent target){ if (target == null || a==null || item==null) return; // get accelerators from kitAction Action kitAction = getActionByName((String)a.getValue(Action.NAME)); if (kitAction!=null) a = kitAction; // Try to get the accelerator, TopComponent action could be obsoleted Keymap km = target.getKeymap(); if (km != null) { KeyStroke[] keys = km.getKeyStrokesForAction(a); KeyStroke itemAccelerator = item.getAccelerator(); if (keys != null && keys.length > 0) { if (itemAccelerator==null || !itemAccelerator.equals(keys[0])){ item.setAccelerator(keys[0]); } }else{ if (itemAccelerator!=null && kitAction!=null){ item.setAccelerator(null); } } } }
Example #6
Source File: NbEditorKit.java From netbeans with Apache License 2.0 | 6 votes |
private void addAcceleretors(Action a, JMenuItem item, JTextComponent target){ // Try to get the accelerator Keymap km = (target == null) ? BaseKit.getKit(BaseKit.class).getKeymap() : target.getKeymap(); if (km != null) { KeyStroke[] keys = km.getKeyStrokesForAction(a); if (keys != null && keys.length > 0) { boolean added = false; for (int i = 0; i<keys.length; i++){ if ((keys[i].getKeyCode() == KeyEvent.VK_MULTIPLY) || keys[i].getKeyCode() == KeyEvent.VK_ADD){ item.setMnemonic(keys[i].getKeyCode()); added = true; break; } } if (added == false) item.setMnemonic(keys[0].getKeyCode()); } } }
Example #7
Source File: NbEditorKit.java From netbeans with Apache License 2.0 | 6 votes |
private static void assignAccelerator(Keymap km, Action action, JMenuItem item) { if (item.getAccelerator() == null){ KeyStroke ks = (KeyStroke)action.getValue(Action.ACCELERATOR_KEY); if (ks!=null) { item.setMnemonic(ks.getKeyCode()); } else { // Try to get the accelerator from keymap if (km != null) { KeyStroke[] keys = km.getKeyStrokesForAction(action); if (keys != null && keys.length > 0) { item.setMnemonic(keys[0].getKeyCode()); } } } } }
Example #8
Source File: Terminal.java From netbeans with Apache License 2.0 | 6 votes |
private void applyShortcuts() { if (!termOptions.getIgnoreKeymap()) { Set<String> actions = new HashSet<String>(); for (FileObject def : shortcutsDir.getChildren()) { try { DataObject dobj = DataObject.find(def); InstanceCookie ic = dobj.getLookup().lookup(InstanceCookie.class); if (ic != null) { // put class names in the map, // otherwise we may end with several instances of the action actions.add(ic.instanceCreate().getClass().getName()); } } catch (Exception e) { Exceptions.printStackTrace(e); } } term.setKeymap(Lookup.getDefault().lookup(Keymap.class), actions); // needed for Ctrl+Tab, Ctrl+Shift+Tab switching term.getScreen().setFocusTraversalKeysEnabled(false); } else { term.setKeymap(null, null); term.getScreen().setFocusTraversalKeysEnabled(true); } }
Example #9
Source File: DocumentationScrollPane.java From netbeans with Apache License 2.0 | 6 votes |
/** Attempt to find the editor keystroke for the given editor action. */ private KeyStroke[] findEditorKeys(String editorActionName, KeyStroke defaultKey, JTextComponent component) { // This method is implemented due to the issue // #25715 - Attempt to search keymap for the keybinding that logically corresponds to the action KeyStroke[] ret = new KeyStroke[] { defaultKey }; if (component != null) { TextUI componentUI = component.getUI(); Keymap km = component.getKeymap(); if (componentUI != null && km != null) { EditorKit kit = componentUI.getEditorKit(component); if (kit instanceof BaseKit) { Action a = ((BaseKit)kit).getActionByName(editorActionName); if (a != null) { KeyStroke[] keys = km.getKeyStrokesForAction(a); if (keys != null && keys.length > 0) { ret = keys; } } } } } return ret; }
Example #10
Source File: DocumentationScrollPane.java From netbeans with Apache License 2.0 | 6 votes |
/** Attempt to find the editor keystroke for the given editor action. */ private KeyStroke[] findEditorKeys(String editorActionName, KeyStroke defaultKey, JTextComponent component) { // This method is implemented due to the issue // #25715 - Attempt to search keymap for the keybinding that logically corresponds to the action KeyStroke[] ret = new KeyStroke[] { defaultKey }; if (component != null) { TextUI componentUI = component.getUI(); Keymap km = component.getKeymap(); if (componentUI != null && km != null) { EditorKit kit = componentUI.getEditorKit(component); if (kit instanceof BaseKit) { Action a = ((BaseKit)kit).getActionByName(editorActionName); if (a != null) { KeyStroke[] keys = km.getKeyStrokesForAction(a); if (keys != null && keys.length > 0) { ret = keys; } } } } } return ret; }
Example #11
Source File: CompletionScrollPane.java From netbeans with Apache License 2.0 | 6 votes |
/** Attempt to find the editor keystroke for the given editor action. */ private KeyStroke[] findEditorKeys(String editorActionName, KeyStroke defaultKey, JTextComponent component) { // This method is implemented due to the issue // #25715 - Attempt to search keymap for the keybinding that logically corresponds to the action KeyStroke[] ret = new KeyStroke[] { defaultKey }; if (component != null && editorActionName != null) { Action a = component.getActionMap().get(editorActionName); Keymap km = component.getKeymap(); if (a != null && km != null) { KeyStroke[] keys = km.getKeyStrokesForAction(a); if (keys != null && keys.length > 0) { ret = keys; } } } return ret; }
Example #12
Source File: CompletionScrollPane.java From netbeans with Apache License 2.0 | 6 votes |
/** Attempt to find the editor keystroke for the given editor action. */ private KeyStroke[] findEditorKeys(String editorActionName, KeyStroke defaultKey, JTextComponent component) { // This method is implemented due to the issue // #25715 - Attempt to search keymap for the keybinding that logically corresponds to the action KeyStroke[] ret = new KeyStroke[] { defaultKey }; if (component != null && editorActionName != null) { Action a = component.getActionMap().get(editorActionName); Keymap km = component.getKeymap(); if (a != null && km != null) { KeyStroke[] keys = km.getKeyStrokesForAction(a); if (keys != null && keys.length > 0) { ret = keys; } } } return ret; }
Example #13
Source File: DocumentationScrollPane.java From netbeans with Apache License 2.0 | 6 votes |
/** Attempt to find the editor keystroke for the given editor action. */ private KeyStroke[] findEditorKeys(String editorActionName, KeyStroke defaultKey, JTextComponent component) { // This method is implemented due to the issue // #25715 - Attempt to search keymap for the keybinding that logically corresponds to the action KeyStroke[] ret = new KeyStroke[] { defaultKey }; if (component != null) { TextUI componentUI = component.getUI(); Keymap km = component.getKeymap(); if (componentUI != null && km != null) { EditorKit kit = componentUI.getEditorKit(component); if (kit instanceof BaseKit) { Action a = ((BaseKit)kit).getActionByName(editorActionName); if (a != null) { KeyStroke[] keys = km.getKeyStrokesForAction(a); if (keys != null && keys.length > 0) { ret = keys; } } } } } return ret; }
Example #14
Source File: VCSCommitPanel.java From netbeans with Apache License 2.0 | 5 votes |
@Override protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed) { boolean ret = super.processKeyBinding(ks, e, condition, pressed); // XXX #250546 Reason of overriding: to process global shortcut. if ((JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT == condition) && (ret == false) && !e.isConsumed()) { Keymap km = Lookup.getDefault().lookup(Keymap.class); Action action = (km != null) ? km.getAction(ks) : null; if (action == null) { return false; } if (action instanceof CallbackSystemAction) { CallbackSystemAction csAction = (CallbackSystemAction) action; if (tabbedPane != null) { Action a = tabbedPane.getActionMap().get(csAction.getActionMapKey()); if (a != null) { a.actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, Utilities.keyToString(ks))); return true; } } } return false; } else { return ret; } }
Example #15
Source File: CommitPanel.java From netbeans with Apache License 2.0 | 5 votes |
@Override protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed) { boolean ret = super.processKeyBinding(ks, e, condition, pressed); // XXX #250546 Reason of overriding: to process global shortcut. if ((JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT == condition) && (ret == false) && !e.isConsumed()) { Keymap km = Lookup.getDefault().lookup(Keymap.class); Action action = (km != null) ? km.getAction(ks) : null; if (action == null) { return false; } if (action instanceof CallbackSystemAction) { CallbackSystemAction csAction = (CallbackSystemAction) action; if (tabbedPane != null) { Action a = tabbedPane.getActionMap().get(csAction.getActionMapKey()); if (a != null) { a.actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, Utilities.keyToString(ks))); return true; } } } return false; } else { return ret; } }
Example #16
Source File: NbEditorToolBar.java From netbeans with Apache License 2.0 | 5 votes |
/** Attempt to find the editor keystroke for the given action. */ private KeyStroke[] findEditorKeys(String editorActionName, KeyStroke defaultKey) { KeyStroke[] ret = new KeyStroke[] { defaultKey }; JTextComponent comp = getComponent(); if (editorActionName != null && comp != null) { TextUI textUI = comp.getUI(); Keymap km = comp.getKeymap(); if (textUI != null && km != null) { EditorKit kit = textUI.getEditorKit(comp); if (kit instanceof BaseKit) { Action a = ((BaseKit)kit).getActionByName(editorActionName); if (a != null) { KeyStroke[] keys = km.getKeyStrokesForAction(a); if (keys != null && keys.length > 0) { ret = keys; } else { // try kit's keymap Keymap km2 = ((BaseKit)kit).getKeymap(); KeyStroke[] keys2 = km2.getKeyStrokesForAction(a); if (keys2 != null && keys2.length > 0) { ret = keys2; } } } } } } return ret; }
Example #17
Source File: MultiKeymap.java From netbeans with Apache License 2.0 | 5 votes |
public void setResolveParent(Keymap parent) { if (context != null) { context.setResolveParent(parent); } else { delegate.setResolveParent(parent); } }
Example #18
Source File: NbEditorKit.java From netbeans with Apache License 2.0 | 5 votes |
private static void addAcceleretors(Action a, JMenuItem item, JTextComponent target) { // Try to get the accelerator Keymap km = (target == null) ? BaseKit.getKit(BaseKit.class).getKeymap() : target.getKeymap(); if (km != null) { KeyStroke[] keys = km.getKeyStrokesForAction(a); if (keys != null && keys.length > 0) { boolean added = false; for (int i = 0; i<keys.length; i++){ if ((keys[i].getKeyCode() == KeyEvent.VK_MULTIPLY) || keys[i].getKeyCode() == KeyEvent.VK_ADD){ item.setMnemonic(keys[i].getKeyCode()); added = true; break; } } if (added == false) { item.setMnemonic(keys[0].getKeyCode()); } }else if (a!=null){ KeyStroke ks = (KeyStroke)a.getValue(Action.ACCELERATOR_KEY); if (ks!=null) { item.setMnemonic(ks.getKeyCode()); } } } }
Example #19
Source File: MultiKeymap.java From netbeans with Apache License 2.0 | 5 votes |
/** Loads key to action mappings into this keymap * @param bindings array of bindings * @param actions map of [action_name, action] pairs */ public void load(JTextComponent.KeyBinding[] bindings, Map actions) { // now create bindings in keymap(s) for (int i = 0; i < bindings.length; i++) { Action a = (Action)actions.get(bindings[i].actionName); if (a != null) { boolean added = false; if (bindings[i] instanceof MultiKeyBinding) { MultiKeyBinding mb = (MultiKeyBinding)bindings[i]; if (mb.keys != null) { Keymap cur = delegate; for (int j = 0; j < mb.keys.length; j++) { if (j == mb.keys.length - 1) { // last keystroke in sequence cur.addActionForKeyStroke(mb.keys[j], a); } else { // not the last keystroke Action sca = cur.getAction(mb.keys[j]); if (!(sca instanceof KeymapSetContextAction)) { sca = new KeymapSetContextAction(JTextComponent.addKeymap(null, null)); cur.addActionForKeyStroke(mb.keys[j], sca); } cur = ((KeymapSetContextAction)sca).contextKeymap; } } added = true; } } if (!added) { if (bindings[i].key != null) { delegate.addActionForKeyStroke(bindings[i].key, a); } else { // key is null -> set default action setDefaultAction(a); } } } } }
Example #20
Source File: ToolTipView.java From netbeans with Apache License 2.0 | 5 votes |
@Override public void setKeymap(Keymap map) { //#181722: keymaps are shared among components with the same UI //a default action will be set to the Keymap of this component below, //so it is necessary to use a Keymap that is not shared with other JTextAreas super.setKeymap(addKeymap(null, map)); }
Example #21
Source File: CommitPanel.java From netbeans with Apache License 2.0 | 5 votes |
@Override protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed) { boolean ret = super.processKeyBinding(ks, e, condition, pressed); // XXX #250546 Reason of overriding: to process global shortcut. if ((JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT == condition) && (ret == false) && !e.isConsumed()) { Keymap km = Lookup.getDefault().lookup(Keymap.class); Action action = (km != null) ? km.getAction(ks) : null; if (action == null) { return false; } if (action instanceof CallbackSystemAction) { CallbackSystemAction csAction = (CallbackSystemAction) action; if (tabbedPane != null) { Action a = tabbedPane.getActionMap().get(csAction.getActionMapKey()); if (a != null) { a.actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, Utilities.keyToString(ks))); return true; } } } return false; } else { return ret; } }
Example #22
Source File: JTextComponentOperator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Maps {@code JTextComponent.getKeymap()} through queue */ public Keymap getKeymap() { return (runMapping(new MapAction<Keymap>("getKeymap") { @Override public Keymap map() { return ((JTextComponent) getSource()).getKeymap(); } })); }
Example #23
Source File: ContextAwareActionInTopComponentTest.java From netbeans with Apache License 2.0 | 5 votes |
protected void setUp () throws Exception { tc = new TopComponent (); tc.requestActive(); MockServices.setServices( MyKeymap.class ); Keymap km = Lookup.getDefault().lookup(Keymap.class); km.addActionForKeyStroke( KEY_STROKE, myGlobalAction ); MyContextAwareAction.globalActionWasPerformed = false; MyContextAwareAction.contextActionWasPerformed = false; }
Example #24
Source File: JTextComponentOperator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Maps {@code JTextComponent.setKeymap(Keymap)} through queue */ public void setKeymap(final Keymap keymap) { runMapping(new MapVoidAction("setKeymap") { @Override public void map() { ((JTextComponent) getSource()).setKeymap(keymap); } }); }
Example #25
Source File: ShortcutAndMenuKeyEventProcessor.java From netbeans with Apache License 2.0 | 5 votes |
private boolean processShortcut(KeyEvent ev) { //ignore shortcut keys when the IDE is shutting down if (NbLifecycleManager.isExiting()) { ev.consume(); return true; } KeyStroke ks = KeyStroke.getKeyStrokeForEvent(ev); Window w = SwingUtilities.windowForComponent(ev.getComponent()); // don't process shortcuts if this is a help frame if ((w instanceof JFrame) && ((JFrame)w).getRootPane().getClientProperty("netbeans.helpframe") != null) // NOI18N return true; // don't let action keystrokes to propagate from both // modal and nonmodal dialogs, but propagate from separate floating windows, // even if they are backed by JDialog if ((w instanceof Dialog) && !WindowManagerImpl.isSeparateWindow(w) && !isTransmodalAction(ks)) { return false; } // Provide a reasonably useful action event that identifies what was focused // when the key was pressed, as well as what keystroke ran the action. ActionEvent aev = new ActionEvent( ev.getSource(), ActionEvent.ACTION_PERFORMED, Utilities.keyToString(ks)); Keymap root = Lookup.getDefault().lookup(Keymap.class); Action a = root.getAction (ks); if (a != null && a.isEnabled()) { ActionManager am = Lookup.getDefault().lookup(ActionManager.class); am.invokeAction(a, aev); ev.consume(); return true; } return false; }
Example #26
Source File: DefaultSyntaxKit.java From visualvm with GNU General Public License v2.0 | 5 votes |
/** * Add keyboard actions to this control using the Configuration we have * @param map * @param prefix */ public void addSyntaxActions(Keymap map, String prefix) { // look at all keys that either start with prefix.Action, or // that start with Action. Pattern splitter = CONFIG.getValueSeparator(prefix); Configuration actionsConf = CONFIG.subConfig(prefix, "Action."); for (String actionName : actionsConf.stringPropertyNames()) { String[] values = splitter.split( actionsConf.getProperty(actionName)); String actionClass = values[0]; SyntaxAction action = editorActions.get(actionClass); if (action == null) { action = createAction(actionClass); action.config(CONFIG, prefix, actionName); } String keyStrokeString = values[1]; KeyStroke ks = KeyStroke.getKeyStroke(keyStrokeString); // KeyEvent.VK_QUOTEDBL if (ks == null) { throw new IllegalArgumentException("Invalid KeyStroke: " + keyStrokeString); } TextAction ta = action.getAction(actionName); if(ta == null) { throw new IllegalArgumentException("Invalid ActionName: " + actionName); } map.addActionForKeyStroke(ks, ta); } }
Example #27
Source File: NbKeymap.java From netbeans with Apache License 2.0 | 5 votes |
protected @Override KeyStroke keyStrokeForAction(Action action, FileObject definingFile) { Keymap km = Lookup.getDefault().lookup(Keymap.class); if (km instanceof NbKeymap) { return ((NbKeymap) km).keyStrokeForAction(action, definingFile); } else { LOG.log(Level.WARNING, "unexpected keymap: {0}", km); return null; } }
Example #28
Source File: SyntaxEditorKit.java From nextreports-designer with Apache License 2.0 | 5 votes |
@Override public void install(JEditorPane target) { super.install(target); // add key bindings Keymap keymap = target.getKeymap(); JTextComponent.loadKeymap(keymap, getKeyBindings(), target.getActions()); }
Example #29
Source File: ToolTipSupport.java From netbeans with Apache License 2.0 | 4 votes |
private JEditorPane createHtmlTextToolTip() { class HtmlTextToolTip extends JEditorPane { public @Override void setSize(int width, int height) { Dimension prefSize = getPreferredSize(); if (width >= prefSize.width) { width = prefSize.width; } else { // smaller available width super.setSize(width, 10000); // the height is unimportant prefSize = getPreferredSize(); // re-read new pref width } if (height >= prefSize.height) { // enough height height = prefSize.height; } super.setSize(width, height); } @Override public void setKeymap(Keymap map) { //#181722: keymaps are shared among components with the same UI //a default action will be set to the Keymap of this component below, //so it is necessary to use a Keymap that is not shared with other components super.setKeymap(addKeymap(null, map)); } } JEditorPane tt = new HtmlTextToolTip(); /* See NETBEANS-403. It still appears possible to use Escape to close the popup when the focus is in the editor. */ tt.putClientProperty(SUPPRESS_POPUP_KEYBOARD_FORWARDING_CLIENT_PROPERTY_KEY, true); // setup tooltip keybindings filterBindings(tt.getActionMap()); tt.getActionMap().put(HIDE_ACTION.getValue(Action.NAME), HIDE_ACTION); tt.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), HIDE_ACTION.getValue(Action.NAME)); tt.getKeymap().setDefaultAction(NO_ACTION); Font font = UIManager.getFont(UI_PREFIX + ".font"); // NOI18N Color backColor = UIManager.getColor(UI_PREFIX + ".background"); // NOI18N Color foreColor = UIManager.getColor(UI_PREFIX + ".foreground"); // NOI18N if (font != null) { tt.setFont(font); } if (foreColor != null) { tt.setForeground(foreColor); } if (backColor != null) { tt.setBackground(backColor); } tt.setOpaque(true); tt.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createLineBorder(tt.getForeground()), BorderFactory.createEmptyBorder(0, 3, 0, 3) )); tt.setContentType("text/html"); //NOI18N return tt; }
Example #30
Source File: NbEditorKit.java From netbeans with Apache License 2.0 | 4 votes |
protected @Override void addAction(JTextComponent component, JPopupMenu popupMenu, String actionName) { if (actionName != null) { // try if it's an action class name // Check for the TopComponent actions if (TopComponent.class.getName().equals(actionName)) { addTopComponentActions(component, popupMenu); return; } else { // not cloneable-editor actions // Try to load the action class Class saClass = null; try { ClassLoader loader = (ClassLoader)Lookup.getDefault().lookup(ClassLoader.class); saClass = Class.forName(actionName, false, loader); } catch (Throwable t) { } if (saClass != null && SystemAction.class.isAssignableFrom(saClass)) { Lookup contextLookup = getContextLookup(component); Action action = SystemAction.get(saClass); action = translateContextLookupAction(contextLookup, action); JMenuItem item = (action != null) ? createLocalizedMenuItem(action) : null; if (item != null) { if (item instanceof DynamicMenuContent) { Component[] cmps = ((DynamicMenuContent)item).getMenuPresenters(); for (int i = 0; i < cmps.length; i++) { if(cmps[i] != null) { popupMenu.add(cmps[i]); } else { popupMenu.addSeparator(); } } } else { if (!(item instanceof JMenu)) { if (Boolean.TRUE.equals(action.getValue(DynamicMenuContent.HIDE_WHEN_DISABLED)) && !action.isEnabled()) { return; } assignAccelerator( (Keymap)Lookup.getDefault().lookup(Keymap.class), action, item ); } debugPopupMenuItem(item, action); popupMenu.add(item); } } return; } } } super.addAction(component, popupMenu, actionName); }