@OnShowing public class ModeBoundsSetter implements Runnable { @Override public void run() { WindowManager wm = WindowManager.getDefault(); Mode mode = wm.findMode("editor"); if(null != mode) { mode.setBounds(new Rectangle(0,0,2000,100)); } } }
public boolean needsDocking() { return WindowManager.getDefault().findMode(this) == null; }
public boolean needsDocking() { return WindowManager.getDefault().findMode(this) == null; }
@Override public void propertyChange (@Nonnull final PropertyChangeEvent event) { if (TopComponent.Registry.PROP_ACTIVATED.equals(event.getPropertyName())) { activeComponent = (TopComponent)event.getNewValue(); boolean enabled = false; if (activeComponent != null) { final Mode mode = WindowManager.getDefault().findMode(activeComponent); enabled = testEnabled(mode.getName()); } setEnabled(enabled); } } });
@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(); }
private TopComponent selectedEditorComponent() { Mode editor = WindowManager.getDefault().findMode("editor");//NOI18N TopComponent tc = editor.getSelectedTopComponent(); TopComponent topComponent = getTopComponent(EditorRegistry.lastFocusedComponent()); if (topComponent == tc) { return tc; } return null; }
/** * 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(); }
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(); }
@Override public void run() { Mode tcMode = WindowManager.getDefault().findMode("editor"); // NOI18N TopComponent[] topComponents = tcMode.getTopComponents(); TopComponent tcToClose = null; for (TopComponent tc : topComponents) { Lookup lookup = tc.getLookup(); FileObject fileObject = getFileObject(lookup); if (null != fileObject) { String path = fileObject.getPath(); if (path.equals(filePath)) { tcToClose = tc; break; } } } if (null != tcToClose) { tcToClose.close(); } } });
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; }
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(); }
/******************************************************************************************************************* * * {@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 } } }
@Override public void actionPerformed(ActionEvent e) { WorkspaceTopComponent workspaceTopComponent = FloatIntoWorkspaceAction.promptForWorkspaces(); if (workspaceTopComponent != null) { workspaceTopComponent.requestActive(); Mode mode = WindowManager.getDefault().findMode(window); if (mode != null) { TopComponent[] topComponents = WindowManager.getDefault().getOpenedTopComponents(mode); for (TopComponent topComponent : topComponents) { if (!(topComponent instanceof WorkspaceTopComponent)) { workspaceTopComponent.addTopComponent(topComponent); } } } } } }
private void insertLink() { Mode editor = WindowManager.getDefault().findMode("editor"); //NOI18N TopComponent tc = editor.getSelectedTopComponent(); if (getTopComponent(EditorRegistry.lastFocusedComponent()) == tc) { insertLinkToEditor(); } else if (tc != null && isIssueRelated(tc)) { insertLinkToIssue(); } else { insertLinkToEditor(); } } private void insertLinkToEditor() {
/** * 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(); } }
@Override public void run() { final ResultWindow window = ResultWindow.getInstance(); Mode mode = WindowManager.getDefault().findMode(window); boolean isInSlidingMode = mode != null && mode.getName().contains("SlidingSide"); //NOI18N if (window.isOpened() && !isInSlidingMode) { window.promote(); } else if (!window.isOpened() || (window.isOpened() && !window.isShowing() && isInSlidingMode)) { Icon icon = new ImageIcon(ImageUtilities.loadImage("org/netbeans/modules/gsf/testrunner/ui/resources/testResults.png")); //NOI18N String projectname = ProjectUtils.getInformation(session.getProject()).getDisplayName(); int total = displayHandler.getTotalTests(); String title = total == 0 ? Bundle.LBL_NotificationDisplayer_NoTestsExecuted_title(projectname) : Bundle.LBL_NotificationDisplayer_title(total, projectname); if(bubbleTask.cancel()) { bubbleTask.schedule(0); } bubbleNotification = NotificationDisplayer.getDefault().notify(title, icon, Bundle.LBL_NotificationDisplayer_detailsText(), new ActionListener() { @Override public void actionPerformed(ActionEvent e) { window.promote(); bubbleTask.cancel(); } }); bubbleTask.schedule(15000); } } });