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


Java TopComponent.close方法代碼示例

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


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

示例1: run

import org.openide.windows.TopComponent; //導入方法依賴的package包/類
@Override
public void run() {
    BIG: for (Mode m : WindowManager.getDefault().getModes()) {
        boolean found = false;
        for (TopComponent topComponent : m.getTopComponents()) {
            if (topComponent instanceof DesignViewComponent) {
                found = true;
                continue;
            }
            topComponent.close();
        }
        if (!found) {
            final DesignViewComponent mc = new DesignViewComponent();
            m.dockInto(mc);
            mc.open();
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:19,代碼來源:DesignView.java

示例2: propertyChange

import org.openide.windows.TopComponent; //導入方法依賴的package包/類
@Override
public void propertyChange(PropertyChangeEvent evt) {
    if(Registry.PROP_ACTIVATED.equals(evt.getPropertyName())) {
        try {
            TopComponent tc =(TopComponent) evt.getNewValue();
            Lookup l = tc.getLookup();
            DataObject tcDataObject = l.lookup(DataObject.class);
            
            if (tcDataObject != null && dataObject.equals(tcDataObject)) {
                final MultiViewHandler handler = MultiViews.findMultiViewHandler(tc);
                if (handler == null || !activateHistoryTab(handler, tc)) {
                    // oops, whats this? 
                    // lets fallback on LHTC
                    tc.close();
                    openLocalHistoryTC(files);
                }
            }
        } finally {
            TopComponent.getRegistry().removePropertyChangeListener(this);
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:23,代碼來源:ShowHistoryAction.java

示例3: componentHidden

import org.openide.windows.TopComponent; //導入方法依賴的package包/類
@Override
protected void componentHidden() {
    super.componentHidden();
    if (propertiesOpened) {
        propertiesOpened = false;
        TopComponent properties = WindowManager.getDefault().findTopComponent("properties");    // NOI18N
        if (properties != null) {
            properties.close();
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:ScreenshotComponent.java

示例4: userMiddleClickedSlidingButton

import org.openide.windows.TopComponent; //導入方法依賴的package包/類
@Override
public void userMiddleClickedSlidingButton(Component clickedButton) {
    int index = getButtonIndex(clickedButton);
    SlidingButton button = (SlidingButton) buttons.get(index);
    button.setBlinking(false);
    
    if (index >= 0 && index < dataModel.size() ) {
        TopComponent tc = (TopComponent)dataModel.getTab(index).getComponent();
        tc.close();
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:SlideBar.java

示例5: closeAllDocuments

import org.openide.windows.TopComponent; //導入方法依賴的package包/類
static boolean closeAllDocuments() {
    TopComponent[] tcs = WindowManagerImpl.getInstance().getEditorTopComponents();
    for( TopComponent tc : tcs ) {
        if( !Switches.isClosingEnabled(tc) ) {
            continue;
        }
        tc.putClientProperty("inCloseAll", Boolean.TRUE); //NOI18N
        if( !tc.close() ) {
            return false;
        }
    }

    return true;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:15,代碼來源:GroupsManager.java

示例6: propertyChange

import org.openide.windows.TopComponent; //導入方法依賴的package包/類
@Override
public void propertyChange(PropertyChangeEvent evt) {
    if (TopComponent.Registry.PROP_OPENED.equals(evt.getPropertyName())) {
        for (Mode m : WindowManager.getDefault().getModes()) {
            for (TopComponent topComponent : m.getTopComponents()) {
                if (topComponent instanceof DesignViewComponent) {
                    continue;
                }
                topComponent.close();
            }
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:14,代碼來源:DesignView.java

示例7: testSavePersistentTopComponent

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

示例8: 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

示例9: testSavePersistentNeverTopComponent

import org.openide.windows.TopComponent; //導入方法依賴的package包/類
/**
 * Test saving of TopComponent with persistence type
 * TopComponent.PERSISTENCE_NEVER.
 */
public void testSavePersistentNeverTopComponent () throws Exception {
    WindowManager wm = WindowManager.getDefault();
    
    Mode m = wm.findMode("explorer");
    assertNotNull("Mode explorer must be present", m);
    
    TopComponent tc = new Component02();
    m.dockInto(tc);
    tc.open();
    
    String res = "Windows2Local/Modes/explorer/"
    + wm.findTopComponentID(tc) + ".wstcref";
    
    //Check that non persistent, opened TC is NOT saved ie. wstcref file is NOT created
    PersistenceHandler.getDefault().save();
    //Check wstcref file was not created
    assertNull(FileUtil.getConfigFile(res));
    deleteLocalData();
    
    //Check that non persistent, 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,代碼行數:31,代碼來源:TopComponentCreationTest.java

示例10: testCreateNewIssue

import org.openide.windows.TopComponent; //導入方法依賴的package包/類
public void testCreateNewIssue() {
    Repository repo = getRepo();
    APITestRepository apiRepo = getApiRepo();
    
    apiRepo.newIssue = null;
    Util.createNewIssue(repo);
    
    long t = System.currentTimeMillis();
    TopComponent openedTC = null;
    while(openedTC == null) {
        Set<TopComponent> openedTCs = WindowManager.getDefault().getRegistry().getOpened();
        for (TopComponent tc : openedTCs) {
            if(tc instanceof IssueTopComponent) {
                IssueTopComponent itc = (IssueTopComponent)tc;
                IssueImpl issueImpl = itc.getIssue();
                if(issueImpl != null && issueImpl.isData(apiRepo.newIssue)) {
                    openedTC = tc;
                    break;
                }
            }
        }
        if(System.currentTimeMillis() - t > 5000) {
            break;
        }
    }
    
    assertNotNull(apiRepo.newIssue);
    if(openedTC == null) {
        fail("TopComponent with new issue wasn't opened");
    }
    openedTC.close();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:33,代碼來源:UtilTestCase.java

示例11: testCreateIssue

import org.openide.windows.TopComponent; //導入方法依賴的package包/類
public void testCreateIssue() {
    Repository repo = getRepo();
    APITestRepository apiRepo = getApiRepo();
    
    apiRepo.newIssue = null;
    String summary = "summary";
    String desc = "desc";
    Util.createIssue(repo, summary, desc);
    
    long t = System.currentTimeMillis();
    TopComponent openedTC = null;
    while(openedTC == null) {
        Set<TopComponent> openedTCs = WindowManager.getDefault().getRegistry().getOpened();
        for (TopComponent tc : openedTCs) {
            if(tc instanceof IssueTopComponent) {
                IssueTopComponent itc = (IssueTopComponent)tc;
                IssueImpl issueImpl = itc.getIssue();
                if(issueImpl != null && issueImpl.isData(apiRepo.newIssue)) {
                    openedTC = tc;
                    break;
                }
            }
        }
        if(System.currentTimeMillis() - t > 5000) {
            break;
        }
    }
    
    assertNotNull(apiRepo.newIssue);
    if(openedTC == null) {
        fail("TopComponent with new issue wasn't opened");
    }
    assertEquals(summary, apiRepo.newIssue.getSummary());
    assertEquals(desc, apiRepo.newIssue.getDescription());
    
    openedTC.close();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:38,代碼來源:UtilTestCase.java

示例12: testCreateNewQuery

import org.openide.windows.TopComponent; //導入方法依賴的package包/類
public void testCreateNewQuery() {
    Repository repo = getRepo();
    APITestRepository apiRepo = getApiRepo();
    
    assertNull(apiRepo.newQuery);
    Util.createNewQuery(repo);
    
    long t = System.currentTimeMillis();
    TopComponent openedTC = null;
    while(openedTC == null) {
        Set<TopComponent> openedTCs = WindowManager.getDefault().getRegistry().getOpened();
        for (TopComponent tc : openedTCs) {
            if(tc instanceof QueryTopComponent) {
                QueryTopComponent itc = (QueryTopComponent)tc;
                QueryImpl queryImpl = itc.getQuery();
                if(queryImpl != null && queryImpl.isData(apiRepo.newQuery)) {
                    openedTC = tc;
                    break;
                }
            }
        }
        if(System.currentTimeMillis() - t > 50000) {
            break;
        }
    }
    
    assertNotNull(apiRepo.newQuery);
    if(openedTC == null) {
        fail("TopComponent with new query wasn't opened");
    }
    openedTC.close();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:33,代碼來源:UtilTestCase.java

示例13: closeView

import org.openide.windows.TopComponent; //導入方法依賴的package包/類
private static void closeView (String viewName) {
    TopComponent view = WindowManager.getDefault().findTopComponent(viewName);
    view.close();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:5,代碼來源:VariablesViewButtons.java

示例14: hidePalette

import org.openide.windows.TopComponent; //導入方法依賴的package包/類
static void hidePalette() {
    TopComponent palette = instance;
    if (palette != null && palette.isOpened()) {
        palette.close();
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:7,代碼來源:PaletteTopComponent.java

示例15: testListView

import org.openide.windows.TopComponent; //導入方法依賴的package包/類
public void testListView () {
    TopComponent tc = prepareExplorerPanel (new ListView ());
    invokeDefaultAction (tc);
    assertDefaultActionWasPerformed ("ListView");
    tc.close ();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:7,代碼來源:DefaultActionTest.java


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