/** Getter for class that allows obtaining of information about components. * It allows to find out which component is selected, which nodes are * currently or has been activated and list of all components. * * @return the registry of components */ public static final Registry getRegistry () { return WindowManager.getDefault().getRegistry(); }
/** Getter for class that allows obtaining of information about components. * It allows to find out which component is selected, which nodes are * currently or has been activated and list of all components. * * @return the registry of components */ public static final Registry getRegistry () { return WindowManager.getDefault().getRegistry(); }
public static WorkspaceTopComponent findShowingInstance() { TopComponent activated = WindowManager.getDefault().getRegistry().getActivated(); if (activated instanceof WorkspaceTopComponent) { return (WorkspaceTopComponent) activated; } List<WorkspaceTopComponent> showingWorkspaces = findShowingInstances(); if (!showingWorkspaces.isEmpty()) { return showingWorkspaces.get(0); } return null; }
/** * Constructor. */ protected DocumentWindowManager() { listeners = new LinkedHashMap<>(); openDocumentWindows = new LinkedHashSet<>(); captureCurrentState(); WindowManager.getDefault().getRegistry().addPropertyChangeListener(new RegistryPropertyChangeDelegate()); }
/*************************************************************************** * * **************************************************************************/ public static boolean isInActivatedTopComponent (final JComponent component) { if (registry == null) { registry = WindowManager.getDefault().getRegistry(); } return registry.getActivated() == findTopComponent(component); }
/** Finds current undo/redo. */ static UndoRedo getUndoRedo (){ TopComponent el = WindowManager.getDefault ().getRegistry ().getActivated (); return el == null ? UndoRedo.NONE : el.getUndoRedo (); }
private static TopComponent findExistingTc(Artifact artifact) { String id = getTcId(artifact); Set<TopComponent> tcs = WindowManager.getDefault().getRegistry().getOpened(); for (TopComponent tc : tcs) { if (id.equals(tc.getClientProperty(MAVEN_TC_PROPERTY))) { return tc; } } return null; }
/*************************************************************************** * * **************************************************************************/ public static boolean isInActivatedTopComponent (final JComponent component) { if (registry == null) { registry = WindowManager.getDefault().getRegistry(); } return registry.getActivated() == findTopComponent(component); }
private EditorCookie activatedEditorCookie(Node[] nodes) { if (nodes == null) { nodes = WindowManager.getDefault().getRegistry().getActivatedNodes(); } if (nodes.length == 1) { Node node = nodes[0]; return (EditorCookie) node.getCookie(EditorCookie.class); } return null; }
/** Getter for array of activated new types. */ private static NewType[] getNewTypes () { return getNewTypes ( WindowManager.getDefault().getRegistry ().getCurrentNodes () ); }
/** Finds current undo/redo. */ static UndoRedo getUndoRedo (){ TopComponent el = WindowManager.getDefault ().getRegistry ().getActivated (); return el == null ? UndoRedo.NONE : el.getUndoRedo (); }
/** Getter for array of activated new types. */ private static NewType[] getNewTypes () { return getNewTypes ( WindowManager.getDefault().getRegistry ().getCurrentNodes () ); }
public void actionPerformed(ActionEvent ev) { Node[] activeNodes = WindowManager.getDefault().getRegistry().getActivatedNodes(); performAction(activeNodes, false); }
public void actionPerformed(ActionEvent e) { Node[] n = WindowManager.getDefault().getRegistry().getActivatedNodes(); if (n.length > 0) { ContextShareAction.actionPerformed(n); } else { ContextShareAction.actionPerformed((Node[]) null); } }
@Override public JMenuItem getPopupPresenter() { Node[] activeNodes = WindowManager.getDefault().getRegistry().getActivatedNodes(); return new TargetPopupMenu(this, enable(activeNodes), activeNodes); }
public void actionPerformed(ActionEvent e) { Node[] n = WindowManager.getDefault().getRegistry().getActivatedNodes(); if (n.length > 0) { ShareAction.actionPerformed(n); } else { ShareAction.actionPerformed((Node []) null); } } }
@Override public void afterLoad(WindowSystemEvent event) { WindowManager.getDefault().removeWindowSystemListener(this); WindowManager.getDefault().getRegistry().addPropertyChangeListener(new OpenedFilesListener()); } @Override public void beforeSave(WindowSystemEvent event) {}
/** Instance not connected to any node. */ public RootChildren (Node n) { TopComponent.Registry reg = WindowManager.getDefault ().getRegistry (); reg.addPropertyChangeListener (org.openide.util.WeakListeners.propertyChange (this, reg)); updateWizard (getWizard (n)); }
/** Initializes the object. */ static synchronized void initializeUndoRedo () { if (listener != null) return; listener = new Listener (); Registry r = WindowManager.getDefault ().getRegistry (); r.addPropertyChangeListener ( org.openide.util.WeakListeners.propertyChange (listener, r) ); last = getUndoRedo (); last.addChangeListener (listener); updateStatus (); }
protected TileAction(Lookup actionContext) { defaultTileable = Tileable.getDefault(); tileableResult = actionContext.lookupResult(Tileable.class); tileableResult.addLookupListener(WeakListeners.create(LookupListener.class, this, tileableResult)); TopComponent.Registry registry = WindowManager.getDefault().getRegistry(); registry.addPropertyChangeListener(WeakListeners.propertyChange(this, registry)); updateState(); }