/** Dock this top component to editor mode if it is not docked * in some mode at this time */ private void dockIfNeeded(Workspace workspace) { // dock into editor mode if possible Mode ourMode = workspace.findMode(this); if (ourMode == null) { editorMode(workspace).dockInto(this); } }
/** Dock this top component to editor mode if it is not docked * in some mode at this time */ private void dockIfNeeded(Workspace workspace) { // dock into editor mode if possible Mode ourMode = workspace.findMode(this); if (ourMode == null) { editorMode(workspace).dockInto(this); } }
/** * Opens a top component in the given mode. * * @param topComponent The top component to open. * @param modeName The mode's name. * @return {@code true} on success. */ public static boolean openInMode(TopComponent topComponent, String modeName) { Mode mode = WindowManager.getDefault().findMode(modeName); if (mode != null) { if (!Arrays.asList(mode.getTopComponents()).contains(topComponent)) { if (mode.dockInto(topComponent)) { topComponent.open(); return true; } } else { topComponent.open(); return true; } } return false; }
public void open() { if (needsDocking()) { // needs docking Mode mode = WindowManager.getDefault().findMode(Bundle.ProfilerControlPanel2_WindowMode()); if (mode != null) { mode.dockInto(this); } } super.open(); }
public void open() { if (needsDocking()) { // needs docking Mode mode = WindowManager.getDefault().findMode(Bundle.TelemetryOverviewPanel_WindowMode()); if (mode != null) { mode.dockInto(this); } } super.open(); }
private TopComponent dockInternalFrame(JInternalFrame internalFrame) { TopComponent topComponent = closeInternalFrame(internalFrame, true); Mode mode = WindowManager.getDefault().findMode("editor"); mode.dockInto(topComponent); if (!topComponent.isOpened()) { topComponent.open(); } return topComponent; }
@Override public void open() { if (isOpened() && isShowing()) return; // Workaround per http://wiki.netbeans.org/DevFaqWindowsOpenInMode WindowManager wm = WindowManager.getDefault(); Mode mode = wm.findMode(this); // mode to which we belong if (mode == null) { // if not in any mode, dock us into the default mode mode = wm.findMode("output"); // NOI18N } mode.dockInto(this); super.open(); }
@Override public void open() { if (isOpened() && isShowing()) return; // Workaround per http://wiki.netbeans.org/DevFaqWindowsOpenInMode WindowManager wm = WindowManager.getDefault(); Mode mode = wm.findMode(this); // mode to which we belong if (mode == null) { // if not in any mode, dock us into the default mode mode = wm.findMode("output"); // NOI18N } mode.dockInto(this); super.open(); }
/******************************************************************************************************************* * * {@inheritDoc} * ******************************************************************************************************************/ @Override public final void performAction() { if (activeComponent != null) { assert EventQueue.isDispatchThread() : "Not in EDT!"; final Mode targetMode = WindowManager.getDefault().findMode(getModeName()); logger.fine("doPerformAction() - docking to %s", targetMode); if (targetMode != null) { activeComponent.close(); targetMode.dockInto(activeComponent); activeComponent.open(); // component.requestVisible(); activeComponent.requestActive(); // see BM-333 } } }
/** * Opens a new window in SNAP Desktop. * * @param window The window which must must be an instance of {@link TopComponent}. * @param location The location where the window should appear when it is first opened. * Possible docking areas are * "explorer" (upper left), "navigator" (lower left), "properties" (upper right), * "output" (bottom). You may choose "floating" to not dock the window at all. Note * that this mode requires explicitly setting the window's position and size. * @param requestActive {@code true} if a request will be made to activate the window after opening it. */ public static void openWindow(TopComponent window, String location, boolean requestActive) { WindowManager.getDefault().invokeWhenUIReady(() -> { Mode mode = WindowManager.getDefault().findMode(location); if (mode != null) { mode.dockInto(window); } window.open(); if (requestActive) { window.requestActive(); } }); }
@Override public void actionPerformed(ActionEvent e) { String defaultName = WindowUtilities.getUniqueTitle(Bundle.VAL_NewWorkspaceActionValue(), WorkspaceTopComponent.class); NotifyDescriptor.InputLine d = new NotifyDescriptor.InputLine(Bundle.LBL_NewWorkspaceActionName(), Bundle.CTL_NewWorkspaceActionName()); d.setInputText(defaultName); Object result = DialogDisplayer.getDefault().notify(d); if (NotifyDescriptor.OK_OPTION.equals(result)) { WorkspaceTopComponent workspaceTopComponent = new WorkspaceTopComponent(d.getInputText()); Mode editor = WindowManager.getDefault().findMode("editor"); Assert.notNull(editor, "editor"); editor.dockInto(workspaceTopComponent); workspaceTopComponent.open(); workspaceTopComponent.requestActive(); } }
/** * Opens a document window. * <p> * Document windows are initially opened in the NetBeans {@code "editor"} mode which * is the central panel of the main frame. * * @param documentWindow The document window to be opened. * @return {@code true} on success */ public boolean openWindow(DocumentWindow documentWindow) { TopComponent topComponent = documentWindow.getTopComponent(); WorkspaceTopComponent workspaceTopComponent = WorkspaceTopComponent.findShowingInstance(); if (workspaceTopComponent != null) { workspaceTopComponent.addTopComponent(topComponent); return true; } Mode editor = WindowManager.getDefault().findMode("editor"); if (editor.dockInto(topComponent)) { topComponent.open(); return true; } return false; }
private GizmoIndicatorsTopComponent(boolean dock) { initComponents(); this.dock = dock; setSession(null); setName(getMessage("CTL_DLightIndicatorsTopComponent")); // NOI18N setToolTipText(getMessage("CTL_DLightIndicatorsTopComponent"));//NOI18N setIcon(ImageUtilities.loadImage(ICON_PATH, true)); if (dock) { if (WindowManager.getDefault().findMode(this) == null || WindowManager.getDefault().findMode(this).getName().equals("navigator")) { // NOI18N if (WindowManager.getDefault().findMode("navigator") != null) { // NOI18N WindowManager.getDefault().findMode("navigator").dockInto(this);//NOI18N } } } setFocusTraversalPolicyProvider(true); setFocusTraversalPolicy(focusPolicy); ActionMap map = new ActionMap(); map.put("org.openide.actions.PopupAction", popupAction);//NOI18N this.associateLookup(ExplorerUtils.createLookup(manager, map)); installActions(); }
private DLightIndicatorsTopComponent(boolean dock) { initComponents(); this.dock = dock; setSession(null); setName(getMessage("CTL_DLightIndicatorsTopComponent")); // NOI18N setToolTipText(getMessage("CTL_DLightIndicatorsTopComponent"));//NOI18N setIcon(ImageUtilities.loadImage(ICON_PATH, true)); if (dock) { if (WindowManager.getDefault().findMode(this) == null || WindowManager.getDefault().findMode(this).getName().equals("navigator")) { // NOI18N if (WindowManager.getDefault().findMode("navigator") != null) { // NOI18N WindowManager.getDefault().findMode("navigator").dockInto(this);//NOI18N } } } setFocusTraversalPolicyProvider(true); setFocusTraversalPolicy(focusPolicy); // ActionMap map = new ActionMap(); // map.put("org.openide.actions.PopupAction", popupAction);//NOI18N // this.associateLookup(ExplorerUtils.createLookup(manager, map)); // installActions(); }