當前位置: 首頁>>代碼示例>>Java>>正文


Java WindowManager.getModes方法代碼示例

本文整理匯總了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();
}
 
開發者ID:arodchen,項目名稱:MaxSim,代碼行數:25,代碼來源:GraphViewerImplementation.java

示例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();
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:25,代碼來源:GraphViewerImplementation.java

示例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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:CssStylesTCController.java

示例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("&nbsp;", " "); // NOI18N // NOI18N
            res = res.trim();
            return res;
        }
    });

    JScrollPane sp = new JScrollPane(elementsList);
    jPanel1.add(sp);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:67,代碼來源:EditorBufferSelectorPanel.java


注:本文中的org.openide.windows.WindowManager.getModes方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。