Java Code Examples for org.openide.windows.TopComponent#requestVisible()
The following examples show how to use
org.openide.windows.TopComponent#requestVisible() .
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: HierarchyTopComponent.java From netbeans with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") @Override public void actionPerformed(ActionEvent e) { if (refreshButton == e.getSource()) { final JTextComponent lastFocusedComponent = EditorRegistry.lastFocusedComponent(); if (lastFocusedComponent != null) { final JavaSource js = JavaSource.forDocument(Utilities.getDocument(lastFocusedComponent)); if (js != null) { setContext(js, lastFocusedComponent); } } } else if (jdocButton == e.getSource()) { final TopComponent win = JavadocTopComponent.findInstance(); if (win != null && !win.isShowing()) { win.open(); win.requestVisible(); jdocTask.schedule(NOW); } } else if (historyCombo == e.getSource()) { refresh(); } else if (viewTypeCombo == e.getSource()) { refresh(); } }
Example 2
Source File: SlideBar.java From netbeans with Apache License 2.0 | 6 votes |
/** Request for automatic slide in from gesture recognizer */ @Override public boolean userTriggeredAutoSlideIn(Component sourceButton) { int index = getButtonIndex(sourceButton); if (index < 0) { return false; } SlidingButton button = (SlidingButton) buttons.get(index); button.setBlinking(false); TopComponent tc = (TopComponent)dataModel.getTab(index).getComponent(); if (tc == null) { return false; } tc.requestVisible(); return true; }
Example 3
Source File: DomTCController.java From netbeans with Apache License 2.0 | 6 votes |
/** * Updates the state of DOM Tree view. This method can be called * from event-dispatch thread only. */ private void updateDomTC0() { synchronized (this) { TopComponentGroup group = getDOMTCGroup(); Page inspectedPage = PageInspector.getDefault().getPage(); if (inspectedPage == null) { group.close(); } else { TopComponent tc = WindowManager.getDefault().findTopComponent(DomTC.ID); boolean wasOpened = tc.isOpened(); group.open(); if (!wasOpened && tc.isOpened() && !WindowManager.getDefault().isTopComponentMinimized(tc)) { tc.requestVisible(); } } } }
Example 4
Source File: DataAccessUtilities.java From constellation with Apache License 2.0 | 5 votes |
private static DataAccessPane getInternalDataAccessPane() { final TopComponent tc = WindowManager.getDefault().findTopComponent(DataAccessViewTopComponent.class.getSimpleName()); if (tc != null) { if (!tc.isOpened()) { tc.open(); } tc.requestVisible(); return ((DataAccessViewTopComponent) tc).getDataAccessPane(); } else { return null; } }
Example 5
Source File: PerfWatchProjects.java From netbeans with Apache License 2.0 | 5 votes |
public static void assertTextDocuments() throws Exception { closeTopComponents(); Thread.sleep(2000); TopComponent tc = new TopComponent(); tc.setLayout(new FlowLayout()); tc.add(new JTextArea()); tc.open(); tc.requestVisible(); tc.requestActive(); String jVMversion = System.getProperty("java.specification.version"); System.out.println("Java.specification.version="+jVMversion); if (!("1.8".equals(jVMversion))) { try { System.out.println("Cleaning well known static fields"); cleanWellKnownStaticFields(); } catch (Exception ex) { throw new IllegalStateException(ex); } } System.setProperty("assertgc.paths", "0"); try { Thread.sleep(4000); } catch (InterruptedException exc) { Exceptions.printStackTrace(exc); } try { Log.assertInstances("Are all documents GCed?", "TextDocument"); } catch (AssertionFailedError afe) { throw afe; } finally { dumpHeap(null); } }
Example 6
Source File: MultiViewProcessorTest.java From netbeans with Apache License 2.0 | 5 votes |
private void doCheck(TopComponent mvc, InstanceContent ic) { assertNotNull("MultiViewComponent cloned", mvc); MultiViewHandler handler = MultiViews.findMultiViewHandler(mvc); assertNotNull("Handler found", handler); MultiViewPerspective[] arr = handler.getPerspectives(); assertEquals("Two perspetives found", 2, arr.length); assertEquals("Contextual", arr[0].getDisplayName()); assertEquals("Contextual", arr[1].getDisplayName()); MultiViewDescription description = Accessor.DEFAULT.extractDescription(arr[0]); assertTrue(description instanceof ContextAwareDescription); assertFalse("First one is not for split", ((ContextAwareDescription)description).isSplitDescription()); description = Accessor.DEFAULT.extractDescription(arr[1]); assertTrue(description instanceof ContextAwareDescription); assertTrue("Second one is for split", ((ContextAwareDescription)description).isSplitDescription()); assertPersistence("Always", TopComponent.PERSISTENCE_ALWAYS, mvc); mvc.open(); mvc.requestActive(); mvc.requestVisible(); handler.requestActive(arr[0]); assertNull("No integer now", mvc.getLookup().lookup(Integer.class)); ic.add(1); assertEquals("1 now", Integer.valueOf(1), mvc.getLookup().lookup(Integer.class)); ((MultiViewCloneableTopComponent)mvc).splitComponent(JSplitPane.HORIZONTAL_SPLIT, -1); handler.requestActive(arr[0]); ic.remove(1); assertNull("No integer now", mvc.getLookup().lookup(Integer.class)); ic.add(2); assertEquals("2 now", Integer.valueOf(2), mvc.getLookup().lookup(Integer.class)); }
Example 7
Source File: MultiViewProcessorTest.java From netbeans with Apache License 2.0 | 5 votes |
public void testMultiViewsContextCreate() { InstanceContent ic = new InstanceContent(); Lookup lookup = new AbstractLookup(ic); TopComponent mvc = MultiViews.createMultiView("text/context", new LP(lookup)); assertNotNull("MultiViewComponent created", mvc); MultiViewHandler handler = MultiViews.findMultiViewHandler(mvc); assertNotNull("Handler found", handler); MultiViewPerspective[] arr = handler.getPerspectives(); assertEquals("Two perspetives found", 2, arr.length); assertEquals("Contextual", arr[0].getDisplayName()); assertEquals("Contextual", arr[1].getDisplayName()); MultiViewDescription description = Accessor.DEFAULT.extractDescription(arr[0]); assertTrue(description instanceof ContextAwareDescription); assertFalse("First one is not for split", ((ContextAwareDescription)description).isSplitDescription()); description = Accessor.DEFAULT.extractDescription(arr[1]); assertTrue(description instanceof ContextAwareDescription); assertTrue("Second one is for split", ((ContextAwareDescription)description).isSplitDescription()); mvc.open(); mvc.requestActive(); mvc.requestVisible(); handler.requestActive(arr[0]); assertNull("No integer now", mvc.getLookup().lookup(Integer.class)); ic.add(1); assertEquals("1 now", Integer.valueOf(1), mvc.getLookup().lookup(Integer.class)); ((MultiViewTopComponent)mvc).splitComponent(JSplitPane.HORIZONTAL_SPLIT, -1); ic.remove(1); handler.requestActive(arr[1]); assertNull("No integer now", mvc.getLookup().lookup(Integer.class)); ic.add(2); assertEquals("2 now", Integer.valueOf(2), mvc.getLookup().lookup(Integer.class)); }