本文整理汇总了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();
}
}
}
示例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);
}
}
}
示例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();
}
}
}
示例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();
}
}
示例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;
}
示例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();
}
}
}
}
示例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));
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例13: closeView
import org.openide.windows.TopComponent; //导入方法依赖的package包/类
private static void closeView (String viewName) {
TopComponent view = WindowManager.getDefault().findTopComponent(viewName);
view.close();
}
示例14: hidePalette
import org.openide.windows.TopComponent; //导入方法依赖的package包/类
static void hidePalette() {
TopComponent palette = instance;
if (palette != null && palette.isOpened()) {
palette.close();
}
}
示例15: testListView
import org.openide.windows.TopComponent; //导入方法依赖的package包/类
public void testListView () {
TopComponent tc = prepareExplorerPanel (new ListView ());
invokeDefaultAction (tc);
assertDefaultActionWasPerformed ("ListView");
tc.close ();
}