public final void registerListener(Object key, GeneralAction.BaseDelAction a) { if (key == null) { return; } synchronized (CACHE) { Set<GeneralAction.BaseDelAction> existing = listeners.get(key); if (existing == null) { existing = new WeakSet<GeneralAction.BaseDelAction>(); listeners.put(key, existing); } existing.add(a); a.updateState(new ActionMap(), actionMap.get(), false); } }
final void notifyListeners(ActionMap prev, ActionMap now) { if (prev == null) prev = new ActionMap(); if (now == null) now = new ActionMap(); HashSet<Object> keys = new HashSet<Object>(); Object[] allPrev = prev.allKeys(); Object[] allNow = now.allKeys(); if (allPrev != null) { keys.addAll(Arrays.asList(allPrev)); } if (allNow != null) { keys.addAll(Arrays.asList(allNow)); } for (Object k : keys) { Set<GeneralAction.BaseDelAction> actions = listeners.get(k); if (actions == null) { continue; } for (GeneralAction.BaseDelAction del : actions) { if (del != null) { del.updateState(prev, now, true); } } } }
ActionMap merged = new ActionMap(); if (newMap != null) { Object[] allK = newMap.allKeys();
/** * Action map for key binding feature * * @return The current action map * @see #setActionMap(javax.swing.ActionMap) */ public ActionMap getActionMap() { if (actionMap == null) actionMap = new ActionMap(); return actionMap; }
@Override protected ActionMap createViewActionMap(View p) { return new ActionMap(); }
/** Returns an empty ActionMap. */ @Override public ActionMap createActionMap(Application a, @Nullable View v) { return new ActionMap(); }
public PerspectivesManager(SyDockingContext dockingContext) { super(); this.defaultActionMap = new ActionMap(); this.defaultInputMap = new InputMap(); this.dockingContext = dockingContext; UIManager.put("DockingDesktop.closeActionAccelerator", KeyStroke.getKeyStroke(87, InputEvent.CTRL_DOWN_MASK)); // ctrl + w }
private ActionMap createActionMap(Map<KeyStroke, Action> keyActionMap) { ActionMap actionMap = new ActionMap(); for (KeyStroke keyStroke : keyActionMap.keySet()) { actionMap.put(keyStroke.toString(), keyActionMap.get(keyStroke)); // System.out.println(keyStroke.toString() + ": " + keyActionMap.get(keyStroke).toString()); } return actionMap; }
void update() { internal = new ProxyLookup(ExplorerUtils.createLookup(manager, new ActionMap()), layerListController.getLookup()); }
private void checkState(){ if (explorerManager == null || lookup == null){ explorerManager = initExplorer(); lookup = ExplorerUtils.createLookup(explorerManager, new ActionMap()); } }
@Override protected void initExplorer() { ExplorerManager manager = new ExplorerManager(); setExplorerManager(manager, new ActionMap()); }
@Override public void installCG(SComponent component) { super.installCG(component); final STabbedPane tab = (STabbedPane) component; InputMap inputMap = new InputMap(); inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, KeyEvent.ALT_DOWN_MASK, false), "previous"); inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, KeyEvent.ALT_DOWN_MASK, false), "next"); tab.setInputMap(SComponent.WHEN_FOCUSED_OR_ANCESTOR_OF_FOCUSED_COMPONENT, inputMap); Action action = new MyAbstractAction(tab); ActionMap actionMap = new ActionMap(); actionMap.put("previous", action); actionMap.put("next", action); tab.setActionMap(actionMap); }
protected ActionMap createModelActionMap(ApplicationModel mo) { ActionMap rootMap = new ActionMap(); rootMap.put(AboutAction.ID, new AboutAction(this)); rootMap.put(ClearRecentFilesMenuAction.ID, new ClearRecentFilesMenuAction(this)); ActionMap moMap = mo.createActionMap(this, null); moMap.setParent(rootMap); return moMap; }
protected ActionMap createModelActionMap(ApplicationModel mo) { ActionMap rootMap = new ActionMap(); rootMap.put(AboutAction.ID, new AboutAction(this)); rootMap.put(ExitAction.ID, new ExitAction(this)); rootMap.put(ClearRecentFilesMenuAction.ID, new ClearRecentFilesMenuAction(this)); rootMap.put(MaximizeWindowAction.ID, new MaximizeWindowAction(this, null)); rootMap.put(MinimizeWindowAction.ID, new MinimizeWindowAction(this, null)); rootMap.put(ArrangeWindowsAction.VERTICAL_ID, new ArrangeWindowsAction(desktopPane, Arrangeable.Arrangement.VERTICAL)); rootMap.put(ArrangeWindowsAction.HORIZONTAL_ID, new ArrangeWindowsAction(desktopPane, Arrangeable.Arrangement.HORIZONTAL)); rootMap.put(ArrangeWindowsAction.CASCADE_ID, new ArrangeWindowsAction(desktopPane, Arrangeable.Arrangement.CASCADE)); ActionMap moMap = mo.createActionMap(this, null); moMap.setParent(rootMap); return moMap; }
protected ActionMap createModelActionMap(ApplicationModel mo) { ActionMap rootMap = new ActionMap(); rootMap.put(AboutAction.ID, new AboutAction(this)); rootMap.put(ExitAction.ID, new ExitAction(this)); rootMap.put(OpenApplicationAction.ID, new OpenApplicationAction(this)); rootMap.put(OpenApplicationFileAction.ID, new OpenApplicationFileAction(this)); rootMap.put(ReOpenApplicationAction.ID, new ReOpenApplicationAction(this)); rootMap.put(ClearRecentFilesMenuAction.ID, new ClearRecentFilesMenuAction(this)); rootMap.put(MaximizeWindowAction.ID, new MaximizeWindowAction(this, null)); rootMap.put(MinimizeWindowAction.ID, new MinimizeWindowAction(this, null)); ActionMap moMap = mo.createActionMap(this, null); moMap.setParent(rootMap); return moMap; }
@Override protected ActionMap createViewActionMap(View v) { ActionMap intermediateMap = new ActionMap(); intermediateMap.put(FocusWindowAction.ID, new FocusWindowAction(v)); intermediateMap.put(MaximizeWindowAction.ID, new MaximizeWindowAction(this, v)); intermediateMap.put(MinimizeWindowAction.ID, new MinimizeWindowAction(this, v)); ActionMap vMap = model.createActionMap(this, v); vMap.setParent(intermediateMap); intermediateMap.setParent(getActionMap(null)); return vMap; }
@Override protected ActionMap createViewActionMap(View v) { ActionMap intermediateMap = new ActionMap(); intermediateMap.put(FocusWindowAction.ID, new FocusWindowAction(v)); ActionMap vMap = model.createActionMap(this, v); vMap.setParent(intermediateMap); intermediateMap.setParent(getActionMap(null)); return vMap; }
@Override protected ActionMap createViewActionMap(View v) { ActionMap intermediateMap = new ActionMap(); intermediateMap.put(CloseFileAction.ID, new CloseFileAction(this, v)); ActionMap vMap = model.createActionMap(this, v); vMap.setParent(intermediateMap); intermediateMap.setParent(getActionMap(null)); return vMap; } }
public ImportExplorerTopComponent() { ExplorerManager manager = controller.getExplorerManager(); ActionMap map = new ActionMap(); //AgroSense-33: // action id "org.openide.actions.DeleteAction" will pass a key to lookup in the action map, // tie it to the explorer action so Node.destroy() will be called: map.put("delete", ExplorerUtils.actionDelete(manager, true)); initComponents(); setName(Bundle.CTL_ImportExplorerTopComponent()); setToolTipText(Bundle.HINT_ImportExplorerTopComponent()); setLayout(new BorderLayout()); view.setRootVisible(false); add(view); associateLookup(ExplorerUtils.createLookup(manager, map)); }
/** * Not used for this module */ @Override protected void initExplorer() { Node rootNode = new AbstractNode(Children.create(new MessageNodeFactory(), true)); ExplorerManager manager = new ExplorerManager(); manager.setRootContext(rootNode); manager.getRootContext().setDisplayName("messages"); setExplorerManager(manager, new ActionMap()); }