本文整理汇总了Java中org.openide.windows.WindowManager.getModes方法的典型用法代码示例。如果您正苦于以下问题:Java WindowManager.getModes方法的具体用法?Java WindowManager.getModes怎么用?Java WindowManager.getModes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openide.windows.WindowManager
的用法示例。
在下文中一共展示了WindowManager.getModes方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: view
import org.openide.windows.WindowManager; //导入方法依赖的package包/类
@Override
public void view(InputGraph graph, boolean clone) {
if (!clone) {
WindowManager manager = WindowManager.getDefault();
for (Mode m : manager.getModes()) {
for (TopComponent t : manager.getOpenedTopComponents(m)) {
if (t instanceof EditorTopComponent) {
EditorTopComponent etc = (EditorTopComponent) t;
if (etc.getModel().getGroup().getGraphs().contains(graph)) {
etc.getModel().selectGraph(graph);
t.requestActive();
return;
}
}
}
}
}
Diagram diagram = Diagram.createDiagram(graph, Settings.get().get(Settings.NODE_TEXT, Settings.NODE_TEXT_DEFAULT));
EditorTopComponent tc = new EditorTopComponent(diagram);
tc.open();
tc.requestActive();
}
示例2: view
import org.openide.windows.WindowManager; //导入方法依赖的package包/类
@Override
public void view(InputGraph graph, boolean clone) {
if (!clone) {
WindowManager manager = WindowManager.getDefault();
for (Mode m : manager.getModes()) {
for (TopComponent t : manager.getOpenedTopComponents(m)) {
if (t instanceof EditorTopComponent) {
EditorTopComponent etc = (EditorTopComponent) t;
if (etc.getModel().getGroup().getGraphs().contains(graph)) {
etc.getModel().selectGraph(graph);
t.requestActive();
return;
}
}
}
}
}
Diagram diagram = Diagram.createDiagram(graph, Settings.get().get(Settings.NODE_TEXT, Settings.NODE_TEXT_DEFAULT));
EditorTopComponent tc = new EditorTopComponent(diagram);
tc.open();
tc.requestActive();
}
示例3: isCSSStylesTCOpened
import org.openide.windows.WindowManager; //导入方法依赖的package包/类
/**
* Checks if the CssStylesTC TopComponent is opened but does not initialize it.
*/
private boolean isCSSStylesTCOpened() {
WindowManager wm = WindowManager.getDefault();
for(Mode mode : wm.getModes()) {
if(CssStylesTCController.CSS_TC_MODE.equals(mode.getName())) {
for(TopComponent tc : wm.getOpenedTopComponents(mode)) {
if(tc instanceof CssStylesTC) {
return true;
}
}
break;
}
}
return false;
}
示例4: initEditorDocuments
import org.openide.windows.WindowManager; //导入方法依赖的package包/类
private void initEditorDocuments() {
elementsList = new JList() {
@Override
public String getToolTipText(MouseEvent event) {
int index = locationToIndex(event.getPoint());
if (index != -1) {
EditorListElement element = (EditorListElement) elementsList.getModel().getElementAt(index);
return element.fileObject.getPath();
}
return null;
}
};
List<EditorListElement> elements = new ArrayList<EditorListElement>();
WindowManager wm = WindowManager.getDefault();
Set<? extends Mode> modes = wm.getModes();
for (Mode mode : modes) {
if (wm.isEditorMode(mode)) {
TopComponent[] tcs = mode.getTopComponents();
for (TopComponent tc : tcs) {
Lookup lukap = tc.getLookup();
FileObject fo = lukap.lookup(FileObject.class);
if (fo == null) {
DataObject dobj = lukap.lookup(DataObject.class);
if (dobj != null) {
fo = dobj.getPrimaryFile();
}
}
if (fo != null && fo != peer) {
if (tc.getHtmlDisplayName() != null) {
elements.add(new EditorListElement(fo, tc.getHtmlDisplayName(), true));
} else {
elements.add(new EditorListElement(fo, tc.getName(), false));
}
}
}
}
}
elementsList.setListData(elements.toArray(new EditorListElement[elements.size()]));
elementsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
elementsList.addListSelectionListener(this);
elementsList.setCellRenderer(new DefaultListCellRenderer() {
@Override
public Component getListCellRendererComponent (JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
if (isSelected && value instanceof EditorListElement && ((EditorListElement) value).isHtml()) {
value = stripHtml(((EditorListElement) value).toString());
}
return super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
}
private String stripHtml (String htmlText) {
if (null == htmlText) {
return null;
}
String res = htmlText.replaceAll("<[^>]*>", ""); // NOI18N // NOI18N
res = res.replaceAll(" ", " "); // NOI18N // NOI18N
res = res.trim();
return res;
}
});
JScrollPane sp = new JScrollPane(elementsList);
jPanel1.add(sp);
}