Java Code Examples for org.openide.windows.TopComponent#requestActive()
The following examples show how to use
org.openide.windows.TopComponent#requestActive() .
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: SaveAsActionTest.java From netbeans with Apache License 2.0 | 6 votes |
public void testActionStatusUpdatedOnLookupChange() throws Exception { final InstanceContent content = new InstanceContent(); Lookup lkp = new AbstractLookup( content ); final SaveAsCapable saveAsImpl = new SaveAsCapable() { public void saveAs(FileObject folder, String name) throws IOException { throw new UnsupportedOperationException("Not supported yet."); } }; TopComponent tc = new TopComponent( lkp ); editorMode.dockInto( tc ); tc.open(); tc.requestActive(); assertTrue(Arrays.asList(WindowManager.getDefault().getOpenedTopComponents(editorMode)).contains(tc)); ContextAwareAction action = SaveAsAction.create(); assertFalse( "action is disabled for editor windows without SaveAsCapable in their Lookup", action.isEnabled() ); Action a = action.createContextAwareInstance( tc.getLookup() ); content.add( saveAsImpl ); assertTrue( "action is enabled for editor windows with SaveAsCapable in their Lookup", a.isEnabled() ); content.remove( saveAsImpl ); assertFalse( "action is disabled for editor windows without SaveAsCapable in their Lookup", a.isEnabled() ); }
Example 2
Source File: PasteActionTest.java From netbeans with Apache License 2.0 | 6 votes |
public void testDelegatesAsArrayOfAction () throws Exception { OurAction[] arr = { new OurAction () }; action.putValue ("delegates", arr); //arr[0].setEnabled (true); TopComponent tc = new TopComponent(); tc.getActionMap ().put(javax.swing.text.DefaultEditorKit.pasteAction, action); tc.requestActive(); CharSequence log = Log.enable(PasteAction.class.getName(), Level.WARNING); global.actionPerformed (new ActionEvent (this, 0, "waitFinished")); assertEquals("Log is empty", "", log.toString()); arr[0].assertCnt ("Performed on delegate", 1); action.assertCnt ("Not performed on action", 0); }
Example 3
Source File: MVInnerComponentGetLookupTest.java From netbeans with Apache License 2.0 | 6 votes |
/** Setup component with lookup. */ @Override protected void setUp () { final MVElemTopComponent elem1 = new MVElemTopComponent(); final MVElemTopComponent elem2 = new MVElemTopComponent(); final MVElemTopComponent elem3 = new MVElemTopComponent(); desc1 = new MVDesc("desc1", null, 0, elem1); desc2 = new MVDesc("desc2", null, 0, elem2); desc3 = new MVDesc("desc3", null, 0, elem3); MultiViewDescription[] descs = new MultiViewDescription[] { desc1, desc2, desc3 }; TopComponent mvtop = MultiViewFactory.createMultiView(descs, desc1); top = (TopComponent)elem1; get = top; top2 = (TopComponent)elem2; top3 = (TopComponent)elem3; lookup = mvtop.getLookup(); mvtop.open(); mvtop.requestActive(); mvtc = mvtop; }
Example 4
Source File: SlideBar.java From netbeans with Apache License 2.0 | 6 votes |
/** Triggers slide operation by changing selected index */ @Override public void userClickedSlidingButton(Component clickedButton) { int index = getButtonIndex(clickedButton); SlidingButton button = (SlidingButton) buttons.get(index); button.setBlinking(false); if (index != selModel.getSelectedIndex() || !isActive()) { TopComponent tc = (TopComponent)dataModel.getTab(index).getComponent(); if (tc != null) { tc.requestActive(); } button.setSelected( true ); } else { selModel.setSelectedIndex(-1); } }
Example 5
Source File: Calls.java From netbeans with Apache License 2.0 | 5 votes |
public Object put(String key, Object value) { if ("requestActive".equals(key)) { TopComponent tc = (TopComponent)value; tc.requestActive(); return null; } throw new UnsupportedOperationException("Not supported yet."); }
Example 6
Source File: DebuggerHeapFragmentWalker.java From netbeans with Apache License 2.0 | 5 votes |
static TopComponent openComponent (String viewName, boolean activate) { TopComponent view = WindowManager.getDefault().findTopComponent(viewName); if (view == null) { throw new IllegalArgumentException(viewName); } view.open(); if (activate) { view.requestActive(); } ((InstancesView) view).assureSubViewsVisible(); return view; }
Example 7
Source File: Central.java From netbeans with Apache License 2.0 | 5 votes |
/** * Removes the given mode and moves all its TopComponents to some other mode. * @param mode */ void collapseTabGroup( ModeImpl mode ) { ModeImpl neighbor = findClosestNeighbor( mode ); if( null == neighbor ) return; TopComponent selTC = mode.getSelectedTopComponent(); mergeModes( mode, neighbor, -1 ); if( null != selTC ) selTC.requestActive(); updateViewAfterDnD( true ); WindowManagerImpl.getInstance().doFirePropertyChange( WindowManager.PROP_MODES, null, null); }
Example 8
Source File: ShowPaletteAction.java From netbeans with Apache License 2.0 | 5 votes |
/** Opens component palette. */ public void actionPerformed(ActionEvent evt) { // show ComponentPalette TopComponent palette = WindowManager.getDefault().findTopComponent("CommonPalette"); // NOI18N if( null == palette ) { Logger.getLogger( getClass().getName() ).log( Level.INFO, "Cannot find CommonPalette component." ); // NOI18N return; } Utils.setOpenedByUser( palette, true ); palette.open(); palette.requestActive(); }
Example 9
Source File: SplitAction.java From netbeans with Apache License 2.0 | 5 votes |
static void clearSplit(TopComponent tc, int elementToActivate) { if (tc instanceof Splitable) { TopComponent original = ((Splitable) tc).clearSplit(elementToActivate); original.open(); original.requestActive(); original.invalidate(); original.revalidate(); original.repaint(); original.requestFocusInWindow(); } }
Example 10
Source File: Open.java From BART with MIT License | 5 votes |
@Override public void actionPerformed(ActionEvent ev) { TopComponent tc = WindowManager.getDefault().findTopComponent(ViewResource.TOP_ID_DependencyViewTopComponent); if(tc != null) { if(tc.isOpened()) { tc.requestActive(); }else{ tc.open(); tc.requestActive(); } } }
Example 11
Source File: VariablesViewButtons.java From netbeans with Apache License 2.0 | 5 votes |
private static void openView (String viewName, boolean activate) { TopComponent view = WindowManager.getDefault().findTopComponent(viewName); view.open(); if (activate) { view.requestActive(); } }
Example 12
Source File: TriggeredTakeSnapshotProfilingPoint.java From netbeans with Apache License 2.0 | 4 votes |
public void showResults(URL url) { TopComponent topComponent = getReport(true); topComponent.open(); topComponent.requestActive(); }
Example 13
Source File: ASTBrowserAction.java From netbeans with Apache License 2.0 | 4 votes |
public void actionPerformed (ActionEvent evt) { TopComponent win = ASTBrowserTopComponent.findInstance (); win.open (); win.requestActive (); }
Example 14
Source File: CoordinateViewerAction.java From opensim-gui with Apache License 2.0 | 4 votes |
public void actionPerformed(ActionEvent evt) { TopComponent win = CoordinateViewerTopComponent.findInstance(); win.open(); win.requestActive(); }
Example 15
Source File: BytecodeViewAction.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public void actionPerformed(ActionEvent evt) { TopComponent win = BytecodeViewTopComponent.findInstance(); win.open(); win.requestActive(); }
Example 16
Source File: ParametersAction.java From opensim-gui with Apache License 2.0 | 4 votes |
public void actionPerformed(ActionEvent evt) { TopComponent win = ParametersTopComponent.findInstance(); win.open(); win.requestActive(); }
Example 17
Source File: ControlFlowAction.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public void actionPerformed(ActionEvent evt) { TopComponent win = ControlFlowTopComponent.findInstance(); win.open(); win.requestActive(); }
Example 18
Source File: FilterAction.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public void actionPerformed(ActionEvent evt) { TopComponent win = FilterTopComponent.findInstance(); win.open(); win.requestActive(); }
Example 19
Source File: InstructionsAction.java From opensim-gui with Apache License 2.0 | 4 votes |
public void actionPerformed(ActionEvent evt) { TopComponent win = InstructionsTopComponent.findInstance(); win.open(); win.requestActive(); }
Example 20
Source File: FilterAction.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
public void actionPerformed(ActionEvent evt) { TopComponent win = FilterTopComponent.findInstance(); win.open(); win.requestActive(); }