本文整理汇总了Java中org.openide.windows.Mode.dockInto方法的典型用法代码示例。如果您正苦于以下问题:Java Mode.dockInto方法的具体用法?Java Mode.dockInto怎么用?Java Mode.dockInto使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openide.windows.Mode
的用法示例。
在下文中一共展示了Mode.dockInto方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findInstance
import org.openide.windows.Mode; //导入方法依赖的package包/类
public static synchronized AnalysisResultTopComponent findInstance() {
TopComponent win = WindowManager.getDefault().findTopComponent(PREFERRED_ID);
if (win instanceof AnalysisResultTopComponent) {
return (AnalysisResultTopComponent) win;
}
if (win == null) {
Logger.getLogger(AnalysisResultTopComponent.class.getName()).warning(
"Cannot find " + PREFERRED_ID + " component. It will not be located properly in the window system.");
} else {
Logger.getLogger(AnalysisResultTopComponent.class.getName()).warning(
"There seem to be multiple components with the '" + PREFERRED_ID +
"' ID. That is a potential source of errors and unexpected behavior.");
}
AnalysisResultTopComponent result = new AnalysisResultTopComponent();
Mode outputMode = WindowManager.getDefault().findMode("output");
if (outputMode != null) {
outputMode.dockInto(result);
}
return result;
}
示例2: run
import org.openide.windows.Mode; //导入方法依赖的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();
}
}
}
示例3: openInMode
import org.openide.windows.Mode; //导入方法依赖的package包/类
/**
* Opens a top component in the given mode.
*
* @param topComponent The top component to open.
* @param modeName The mode's name.
* @return {@code true} on success.
*/
public static boolean openInMode(TopComponent topComponent, String modeName) {
Mode mode = WindowManager.getDefault().findMode(modeName);
if (mode != null) {
if (!Arrays.asList(mode.getTopComponents()).contains(topComponent)) {
if (mode.dockInto(topComponent)) {
topComponent.open();
return true;
}
} else {
topComponent.open();
return true;
}
}
return false;
}
示例4: open
import org.openide.windows.Mode; //导入方法依赖的package包/类
/** always open this top component in our special mode, if
* no mode for this component is specified yet */
public void open (Workspace workspace) {
// do not open this component if this is dummy browser
if (browserComponent.browserComponent == null)
return;
Workspace realWorkspace = (workspace == null)
? WindowManager.getDefault().getCurrentWorkspace()
: workspace;
// dock into our mode if not docked yet
Mode mode = realWorkspace.findMode(MODE_NAME);
if (mode == null) {
mode = realWorkspace.createMode(
MODE_NAME,
NbBundle.getBundle(HtmlBrowser.class).getString("CTL_WebBrowser"),
HtmlBrowser.class.getResource("/org/openide/resources/html/htmlView.gif")
);
}
Mode tcMode = realWorkspace.findMode(this);
if (tcMode == null)
mode.dockInto(this);
// behave like superclass
super.open(workspace);
}
示例5: actionPerformed
import org.openide.windows.Mode; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
String defaultName = WindowUtilities.getUniqueTitle(Bundle.VAL_NewWorkspaceActionValue(),
WorkspaceTopComponent.class);
NotifyDescriptor.InputLine d = new NotifyDescriptor.InputLine(Bundle.LBL_NewWorkspaceActionName(),
Bundle.CTL_NewWorkspaceActionName());
d.setInputText(defaultName);
Object result = DialogDisplayer.getDefault().notify(d);
if (NotifyDescriptor.OK_OPTION.equals(result)) {
WorkspaceTopComponent workspaceTopComponent = new WorkspaceTopComponent(d.getInputText());
Mode editor = WindowManager.getDefault().findMode("editor");
Assert.notNull(editor, "editor");
editor.dockInto(workspaceTopComponent);
workspaceTopComponent.open();
workspaceTopComponent.requestActive();
}
}
示例6: openSimStateWindow
import org.openide.windows.Mode; //导入方法依赖的package包/类
private static void openSimStateWindow(LinkedList registerOrder,
LinkedList busOrder, LinkedList memoryOrder,LinkedList storageOrder, LinkedList regArrOrder) {
SimStateTopComponent simStateTopCmpnt = (SimStateTopComponent) WindowManager.getDefault().findTopComponent("SimStateTopComponent");
if (simStateTopCmpnt == null) {
simStateTopCmpnt = new SimStateTopComponent();
}
Mode m = WindowManager.getDefault().findMode("simstate");
m.dockInto(simStateTopCmpnt);
if (!simStateTopCmpnt.isOpened()) {
simStateTopCmpnt.open();
}
simStateTopCmpnt.setData(registerOrder, busOrder, memoryOrder,storageOrder, regArrOrder);
simStateTopCmpnt.initTable();
}
示例7: open
import org.openide.windows.Mode; //导入方法依赖的package包/类
public void open() {
if (needsDocking()) { // needs docking
Mode mode = WindowManager.getDefault().findMode(Bundle.ProfilingPointsWindow_WindowMode());
if (mode != null) {
mode.dockInto(this);
}
}
super.open();
}
示例8: initEditorTopComponent
import org.openide.windows.Mode; //导入方法依赖的package包/类
private void initEditorTopComponent( TopComponent tc ) throws IOException {
Mode editorMode = WindowManagerImpl.getInstance().findMode( "unitTestEditorMode" );
if( null == editorMode ) {
editorMode = WindowManagerImpl.getInstance().createMode( "unitTestEditorMode", Constants.MODE_KIND_EDITOR, Constants.MODE_STATE_JOINED, false, new SplitConstraint[0] );
}
editorMode.dockInto(tc);
}
示例9: initViewTopComponent
import org.openide.windows.Mode; //导入方法依赖的package包/类
private void initViewTopComponent( TopComponent tc ) throws IOException {
Mode viewMode = WindowManagerImpl.getInstance().findMode( "unitTestViewMode" );
if( null == viewMode ) {
viewMode = WindowManagerImpl.getInstance().createMode( "unitTestViewMode", Constants.MODE_KIND_VIEW, Constants.MODE_STATE_JOINED, false, new SplitConstraint[0] );
}
viewMode.dockInto(tc);
}
示例10: testSavePersistentTopComponent
import org.openide.windows.Mode; //导入方法依赖的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));
}
示例11: testSavePersistentOnlyOpenedTopComponent
import org.openide.windows.Mode; //导入方法依赖的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();
}
示例12: testSavePersistentNeverTopComponent
import org.openide.windows.Mode; //导入方法依赖的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();
}
示例13: dockIntoEditorMode
import org.openide.windows.Mode; //导入方法依赖的package包/类
/**
*/
private void dockIntoEditorMode () {
// dock into editor mode if possible
Workspace current = WindowManager.getDefault().getCurrentWorkspace();
Mode editorMode = current.findMode (CloneableEditorSupport.EDITOR_MODE);
if ( editorMode != null ) {
editorMode.dockInto (this);
}
}
示例14: open
import org.openide.windows.Mode; //导入方法依赖的package包/类
public void open() {
WindowManager windowManager = WindowManager.getDefault();
if (windowManager.findMode(this) == null) { // needs docking
Mode mode = windowManager.findMode(Bundle.ProfilerWindow_mode());
if (mode != null) mode.dockInto(this);
}
super.open();
}
示例15: open
import org.openide.windows.Mode; //导入方法依赖的package包/类
public void open() {
WindowManager wmanager = WindowManager.getDefault();
if (wmanager.findMode(this) == null) { // needs docking
Mode _mode = wmanager.findMode(Bundle.SnapshotsWindowUI_mode());
if (_mode != null) _mode.dockInto(this);
}
super.open();
}