當前位置: 首頁>>代碼示例>>Java>>正文


Java TopComponent.open方法代碼示例

本文整理匯總了Java中org.openide.windows.TopComponent.open方法的典型用法代碼示例。如果您正苦於以下問題:Java TopComponent.open方法的具體用法?Java TopComponent.open怎麽用?Java TopComponent.open使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.openide.windows.TopComponent的用法示例。


在下文中一共展示了TopComponent.open方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: splitWindow

import org.openide.windows.TopComponent; //導入方法依賴的package包/類
static void splitWindow(TopComponent tc, int orientation, int splitLocation) {
if (tc instanceof Splitable) {
    TopComponent split = ((Splitable) tc).splitComponent(orientation, splitLocation);
    split.open();
    split.requestActive();
           split.invalidate();
           split.revalidate();
           split.repaint();
           split.requestFocusInWindow();
}
   }
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:SplitAction.java

示例2: clearSplit

import org.openide.windows.TopComponent; //導入方法依賴的package包/類
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();
}
   }
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:SplitAction.java

示例3: testActionMapChanges

import org.openide.windows.TopComponent; //導入方法依賴的package包/類
public void testActionMapChanges() throws Exception {
    MVElemTopComponent elem1 = new MVElemTopComponent();
    MVElemTopComponent elem2 = new MVElemTopComponent();
    MVElem elem3 = new MVElem();
    MultiViewDescription desc1 = new MVDesc("desc1", null, 0, elem1);
    MultiViewDescription desc2 = new MVDesc("desc2", null, 0, elem2);
    MultiViewDescription desc3 = new MVDesc("desc3", null, 0, elem3);
    
    MultiViewDescription[] descs = new MultiViewDescription[] { desc1, desc2, desc3 };
    TopComponent tc = MultiViewFactory.createMultiView(descs, desc1);
    // WARNING: as anything else the first element's action map is set only after the tc is opened..
    Lookup.Result result = tc.getLookup().lookup(new Lookup.Template(ActionMap.class));
    LookListener list = new LookListener();
    list.resetCount();
    result.addLookupListener(list);
    result.allItems();
    
    tc.open();
    assertEquals(1, list.getCount());
    
    MultiViewHandler handler = MultiViews.findMultiViewHandler(tc);
    // test related hack, easy establishing a  connection from Desc->perspective
    Accessor.DEFAULT.createPerspective(desc2);
    handler.requestVisible(Accessor.DEFAULT.createPerspective(desc2));
    assertEquals(2, list.getCount());
    
    Accessor.DEFAULT.createPerspective(desc3);
    handler.requestVisible(Accessor.DEFAULT.createPerspective(desc3));
    assertEquals(3, list.getCount());
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:31,代碼來源:MultiViewActionMapTest.java

示例4: testMimePalette

import org.openide.windows.TopComponent; //導入方法依賴的package包/類
public void testMimePalette() throws IOException {
    TopComponent tc = createTopComponentWithPalette( null );
    tc.setActivatedNodes( new Node[] { DataObject.find( dummyDocumentFile ).getNodeDelegate() } );
    tc.open();
    
    PaletteSwitch paletteSwitch = PaletteSwitch.getDefault();
    
    PaletteController foundPalette = paletteSwitch.getPaletteFromMimeType( MIME_TYPE_NAME );
    assertNotNull( foundPalette );
    assertEquals( mimePaletteRootName, foundPalette.getModel().getName() );
    
    foundPalette = paletteSwitch.getPaletteFromTopComponent( tc, false, tc.isOpened() );
    assertNotNull( foundPalette );
    assertEquals( mimePaletteRootName, foundPalette.getModel().getName() );
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:16,代碼來源:PaletteSwitchTest.java

示例5: run

import org.openide.windows.TopComponent; //導入方法依賴的package包/類
@Override
public Void run() {
    assertTrue("Is EDT", EventQueue.isDispatchThread());
    TopComponent tc =new TopComponent();
    tc.open();
    tc.requestActive();
    return null;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:9,代碼來源:InitializeInAWTTest.java

示例6: action

import org.openide.windows.TopComponent; //導入方法依賴的package包/類
@Override
public synchronized void action(ActionEvent e) {
    if (serverDef.getServerFlag().getFlag() != null) {
        TopComponent map = WindowManager.getDefault().findTopComponent(uid);
        if (map == null) {
            map = new PureMapTopComponent(serverDef);
            uid = WindowManager.getDefault().findTopComponentID(map);
        }
        map.open();
        map.requestActive();
    }
}
 
開發者ID:kefik,項目名稱:Pogamut3,代碼行數:13,代碼來源:UnrealServerNode.java

示例7: doCheck

import org.openide.windows.TopComponent; //導入方法依賴的package包/類
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));
   }
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:34,代碼來源:MultiViewProcessorTest.java

示例8: showPalette

import org.openide.windows.TopComponent; //導入方法依賴的package包/類
static void showPalette() {
    WindowManager wm = WindowManager.getDefault();
    TopComponent palette = wm.findTopComponent("CommonPalette"); // NOI18N
    if (null == palette) {
        Logger.getLogger(PaletteSwitch.class.getName()).log(Level.INFO, "Cannot find CommonPalette component."); // NOI18N

        //for unit-testing
        palette = getDefault();
    }
    if (!palette.isOpened()) {
        palette.open();
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:14,代碼來源:PaletteTopComponent.java

示例9: testSavePersistentOnlyOpenedTopComponent

import org.openide.windows.TopComponent; //導入方法依賴的package包/類
/**
 * Test saving of TopComponent with persistence type
 * TopComponent.PERSISTENCE_ONLY_OPENED.
 */
public void testSavePersistentOnlyOpenedTopComponent () throws Exception {
    WindowManager wm = WindowManager.getDefault();
    
    Mode m = wm.findMode("explorer");
    assertNotNull("Mode explorer must be present", m);
    
    TopComponent tc = new Component01();
    m.dockInto(tc);
    tc.open();
    
    String res = "Windows2Local/Modes/explorer/"
    + wm.findTopComponentID(tc) + ".wstcref";
    
    //Check that persistent only opened, opened TC is saved ie. wstcref file is created
    PersistenceHandler.getDefault().save();
    //Check wstcref file was created
    assertNotNull(FileUtil.getConfigFile(res));
    deleteLocalData();
    //Check wstcref file was deleted
    assertNull(FileUtil.getConfigFile(res));
    
    //Check that persistent only opened, closed TC is NOT saved ie. wstcref file is NOT created
    tc.close();
    PersistenceHandler.getDefault().save();        
    //Check wstcref file was not created
    assertNull(FileUtil.getConfigFile(res));
    deleteLocalData();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:33,代碼來源:TopComponentCreationTest.java

示例10: testUpdateTitle

import org.openide.windows.TopComponent; //導入方法依賴的package包/類
public void testUpdateTitle() throws Exception {
    MVElem elem1 = new MVElem();
    MVElem elem2 = new MVElem();
    MVElem elem3 = new MVElem();
    MultiViewDescription desc1 = new MVDesc("desc1", null, 0, elem1);
    MultiViewDescription desc2 = new MVDesc("desc2", null, 0, elem2);
    MultiViewDescription desc3 = new MVDesc("desc3", null, 0, elem3);
    MultiViewDescription[] descs = new MultiViewDescription[] { desc1, desc2, desc3 };
    TopComponent tc = MultiViewFactory.createMultiView(descs, desc2);

    tc.open();
    assertEquals(null, tc.getDisplayName());
    
    
    elem2.observer.updateTitle("test1");
    assertEquals("test1", tc.getDisplayName());
    
    // switch to desc3 to initilize the element..
    MultiViewHandler handler = MultiViews.findMultiViewHandler(tc);

    // test related hack, easy establishing a  connection from Desc->perspective
    handler.requestVisible(Accessor.DEFAULT.createPerspective(desc3));
    
    elem3.observer.updateTitle("test2");
    assertEquals("test2", tc.getDisplayName());
    
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:28,代碼來源:MultiViewElementTest.java

示例11: performAction

import org.openide.windows.TopComponent; //導入方法依賴的package包/類
@Override
protected void performAction(Node[] activatedNodes) {
    for (Node n : activatedNodes) {
        JavaComponentInfo ci = n.getLookup().lookup(JavaComponentInfo.class);
        if (ci != null) {
            TopComponent tc = WindowManager.getDefault().findTopComponent("eventsView");
            if (tc == null) {
                throw new IllegalArgumentException("eventsView");
            }
            tc.open();
            tc.requestActive();
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:15,代碼來源:ShowListenersAction.java

示例12: onMouseClick

import org.openide.windows.TopComponent; //導入方法依賴的package包/類
/**
 * Invoked when the user clicks the icon.
 */
protected void onMouseClick() {
    TopComponent tc = WindowManager.getDefault().findTopComponent("NotificationCenterTopComponent");
    tc.open();
    tc.requestActive();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:9,代碼來源:FlashingIcon.java

示例13: actionPerformed

import org.openide.windows.TopComponent; //導入方法依賴的package包/類
public void actionPerformed(ActionEvent evt) {
    TopComponent win = AnalyzeStackTopComponent.findInstance();
    win.open();
    win.requestActive();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:6,代碼來源:AnalyzeStackAction.java

示例14: testRequestVisible

import org.openide.windows.TopComponent; //導入方法依賴的package包/類
public void testRequestVisible() throws Exception {
    MVElem elem1 = new MVElem();
    MVElem elem2 = new MVElem();
    MVElem elem3 = new MVElem();
    MultiViewDescription desc1 = new MVDesc("desc1", null, 0, elem1);
    MultiViewDescription desc2 = new MVDesc("desc2", null, 0, elem2);
    MultiViewDescription desc3 = new MVDesc("desc3", null, 0, elem3);
    
    MultiViewDescription[] descs = new MultiViewDescription[] { desc1, desc2, desc3 };
    TopComponent tc = MultiViewFactory.createMultiView(descs, desc1);
    
    // NOT OPENED YET.
    assertEquals("",elem1.getLog());
    assertEquals("",elem2.getLog());
    
    tc.open();
    assertEquals("componentOpened-componentShowing-", elem1.getLog());
    assertEquals("",elem2.getLog());

    // initilize the elements..
    MultiViewHandler handler = MultiViews.findMultiViewHandler(tc);
    
    // test related hack, easy establishing a  connection from Desc->perspective
    Accessor.DEFAULT.createPerspective(desc2);
    handler.requestVisible(Accessor.DEFAULT.createPerspective(desc2));
    handler.requestVisible(Accessor.DEFAULT.createPerspective(desc3));
    handler.requestVisible(Accessor.DEFAULT.createPerspective(desc1));
    elem1.resetLog();
    elem2.resetLog();
    elem3.resetLog();
    
    elem2.doRequestVisible();
    assertEquals("componentHidden-", elem1.getLog());
    assertEquals("componentShowing-", elem2.getLog());
    assertEquals("", elem3.getLog());
    
    elem3.doRequestVisible();
    assertEquals("componentHidden-", elem1.getLog());
    assertEquals("componentShowing-componentHidden-", elem2.getLog());
    assertEquals("componentShowing-", elem3.getLog());
    
    elem1.doRequestVisible();
    assertEquals("componentShowing-componentHidden-", elem3.getLog());
    assertEquals("componentHidden-componentShowing-", elem1.getLog());
    
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:47,代碼來源:MultiViewElementTest.java

示例15: actionPerformed

import org.openide.windows.TopComponent; //導入方法依賴的package包/類
@Override
public void actionPerformed(ActionEvent evt) {
    TopComponent win = FilterTopComponent.findInstance();
    win.open();
    win.requestActive();
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:7,代碼來源:FilterAction.java


注:本文中的org.openide.windows.TopComponent.open方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。