本文整理汇总了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();
}
}
示例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();
}
}
示例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());
}
示例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() );
}
示例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;
}
示例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();
}
}
示例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));
}
示例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();
}
}
示例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();
}
示例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());
}
示例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();
}
}
}
示例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();
}
示例13: actionPerformed
import org.openide.windows.TopComponent; //导入方法依赖的package包/类
public void actionPerformed(ActionEvent evt) {
TopComponent win = AnalyzeStackTopComponent.findInstance();
win.open();
win.requestActive();
}
示例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());
}
示例15: actionPerformed
import org.openide.windows.TopComponent; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent evt) {
TopComponent win = FilterTopComponent.findInstance();
win.open();
win.requestActive();
}