本文整理汇总了Java中org.openide.windows.Mode.getSelectedTopComponent方法的典型用法代码示例。如果您正苦于以下问题:Java Mode.getSelectedTopComponent方法的具体用法?Java Mode.getSelectedTopComponent怎么用?Java Mode.getSelectedTopComponent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openide.windows.Mode
的用法示例。
在下文中一共展示了Mode.getSelectedTopComponent方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: openWatchesView
import org.openide.windows.Mode; //导入方法依赖的package包/类
private static void openWatchesView() {
// open watches view
TopComponent watchesView = WindowManager.getDefault().findTopComponent("watchesView"); // NOI18N
if (watchesView != null && watchesView.isOpened()) {
Mode mw = WindowManager.getDefault().findMode(watchesView);
if (mw != null && mw.getSelectedTopComponent() == watchesView) {
return ; // Watches is already selected
}
}
String viewName = VariablesViewButtons.isWatchesViewNested() ? "localsView" : "watchesView";
ViewActions.openComponent (viewName, false).requestVisible();
}
示例2: checkFormGroupVisibility
import org.openide.windows.Mode; //导入方法依赖的package包/类
static void checkFormGroupVisibility() {
// when active TopComponent changes, check if we should open or close
// the form editor group of windows (Inspector, Palette, Properties)
WindowManager wm = WindowManager.getDefault();
final TopComponentGroup group = wm.findTopComponentGroup("form"); // NOI18N
if (group == null)
return; // group not found (should not happen)
boolean designerSelected = false;
Iterator it = wm.getModes().iterator();
while (it.hasNext()) {
Mode mode = (Mode) it.next();
TopComponent selected = mode.getSelectedTopComponent();
if (getSelectedElementType(selected) == FORM_ELEMENT_INDEX) {
designerSelected = true;
break;
}
}
if (designerSelected && !Boolean.TRUE.equals(groupVisible)) {
// Bug 116008: calling group.open() first time may cause hiding the
// FormDesigner (some winsys multiview initialization mess), calling
// this method again and hiding the group. By setting the groupVisible
// to false we make the re-entrant call effectively do nothing.
groupVisible = Boolean.FALSE;
group.open();
groupVisible = Boolean.TRUE;
final TopComponentGroup paletteGroup = wm.findTopComponentGroup( "commonpalette" ); // NOI18N
if( null != paletteGroup ) {
paletteGroup.open();
}
}
else if (!designerSelected && !Boolean.FALSE.equals(groupVisible)) {
group.close();
groupVisible = Boolean.FALSE;
}
}
示例3: getActive
import org.openide.windows.Mode; //导入方法依赖的package包/类
public static EditorTopComponent getActive() {
Set<? extends Mode> modes = WindowManager.getDefault().getModes();
for (Mode m : modes) {
TopComponent tc = m.getSelectedTopComponent();
if (tc instanceof EditorTopComponent) {
return (EditorTopComponent) tc;
}
}
return null;
}
示例4: getCurrentEditor
import org.openide.windows.Mode; //导入方法依赖的package包/类
static TopComponent getCurrentEditor() {
Set<? extends Mode> modes = WindowManager.getDefault().getModes();
for (Mode mode : modes) {
if ("editor".equals(mode.getName())) {
return mode.getSelectedTopComponent();
}
}
return null;
}
开发者ID:keevosh,项目名称:nb-springboot-configuration-support,代码行数:10,代码来源:SpringBootConfigurationCompletionProvider.java
示例5: updateGroupVisibility
import org.openide.windows.Mode; //导入方法依赖的package包/类
private void updateGroupVisibility() {
WindowManager wm = WindowManager.getDefault();
final TopComponentGroup group = wm.findTopComponentGroup("ireport_jrctx"); // NOI18N
if (group == null) {
return; // group not found (should not happen)
}
//
boolean isVisualViewSelected = false;
Iterator it = wm.getModes().iterator();
while (it.hasNext()) {
Mode mode = (Mode) it.next();
TopComponent selected = mode.getSelectedTopComponent();
if (selected != null) {
MultiViewHandler mvh = MultiViews.findMultiViewHandler(selected);
if (mvh != null) {
MultiViewPerspective mvp = mvh.getSelectedPerspective();
if (mvp != null) {
String id = mvp.preferredID();
if (PREFERRED_ID.equals(id)) {
isVisualViewSelected = true;
break;
}
}
}
}
}
//
if (isVisualViewSelected && !Boolean.TRUE.equals(groupVisible)) {
group.open();
} else if (!isVisualViewSelected && !Boolean.FALSE.equals(groupVisible)) {
group.close();
}
//
groupVisible = isVisualViewSelected ? Boolean.TRUE : Boolean.FALSE;
}
示例6: updateGroupVisibility
import org.openide.windows.Mode; //导入方法依赖的package包/类
private void updateGroupVisibility() {
WindowManager wm = WindowManager.getDefault();
final TopComponentGroup group = wm.findTopComponentGroup("ireport_jrctx"); // NOI18N
if (group == null) {
return; // group not found (should not happen)
}
//
boolean isVisualViewSelected = false;
Iterator it = wm.getModes().iterator();
while (it.hasNext()) {
Mode mode = (Mode) it.next();
TopComponent selected = mode.getSelectedTopComponent();
if (selected != null) {
MultiViewHandler mvh = MultiViews.findMultiViewHandler(selected);
if (mvh != null) {
MultiViewPerspective mvp = mvh.getSelectedPerspective();
if (mvp != null) {
String id = mvp.preferredID();
if (JRCTXVisualView.PREFERRED_ID.equals(id)) {
isVisualViewSelected = true;
break;
}
}
}
}
}
//
if (isVisualViewSelected && !Boolean.TRUE.equals(groupVisible)) {
group.open();
} else if (!isVisualViewSelected && !Boolean.FALSE.equals(groupVisible)) {
group.close();
}
//
groupVisible = isVisualViewSelected ? Boolean.TRUE : Boolean.FALSE;
}
示例7: getCurrentEditor
import org.openide.windows.Mode; //导入方法依赖的package包/类
/**
* Gets the currently opened editor.
*/
private TopComponent getCurrentEditor() {
Set<? extends Mode> modes = WindowManager.getDefault().getModes();
for (Mode mode : modes) {
if ("editor".equals(mode.getName())) {
return mode.getSelectedTopComponent();
}
}
return null;
}
示例8: updateGroupVisibility
import org.openide.windows.Mode; //导入方法依赖的package包/类
private void updateGroupVisibility() {
WindowManager wm = WindowManager.getDefault();
final TopComponentGroup group = wm.findTopComponentGroup("ireport"); // NOI18N
if (group == null) {
return; // group not found (should not happen)
}
//
boolean isVisualViewSelected = false;
Iterator it = wm.getModes().iterator();
while (it.hasNext()) {
Mode mode = (Mode) it.next();
TopComponent selected = mode.getSelectedTopComponent();
if (selected != null) {
MultiViewHandler mvh = MultiViews.findMultiViewHandler(selected);
if (mvh != null) {
MultiViewPerspective mvp = mvh.getSelectedPerspective();
if (mvp != null) {
String id = mvp.preferredID();
if (JrxmlVisualView.PREFERRED_ID.equals(id)) {
isVisualViewSelected = true;
break;
}
}
}
}
}
//
if (isVisualViewSelected && !Boolean.TRUE.equals(groupVisible)) {
group.open();
final TopComponent props = wm.findTopComponent("properties");
if (props != null && props.isVisible())
{
try {
props.getClass().getMethod("setNodes", new Class[]{(new Node[0]).getClass()}).invoke(props, new Object[]{getExplorerManager().getSelectedNodes()});
} catch (Exception ex) {
ex.printStackTrace();
}
}
} else if (!isVisualViewSelected && !Boolean.FALSE.equals(groupVisible)) {
group.close();
}
//
groupVisible = isVisualViewSelected ? Boolean.TRUE : Boolean.FALSE;
}