当前位置: 首页>>代码示例>>Java>>正文


Java EditorCookie.getOpenedPanes方法代码示例

本文整理汇总了Java中org.openide.cookies.EditorCookie.getOpenedPanes方法的典型用法代码示例。如果您正苦于以下问题:Java EditorCookie.getOpenedPanes方法的具体用法?Java EditorCookie.getOpenedPanes怎么用?Java EditorCookie.getOpenedPanes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openide.cookies.EditorCookie的用法示例。


在下文中一共展示了EditorCookie.getOpenedPanes方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getCaretPos

import org.openide.cookies.EditorCookie; //导入方法依赖的package包/类
private static int getCaretPos(FoldHierarchy h) {
    int caretPos = -1;
    JTextComponent c = h.getComponent();
    if (c == null) {
        return -1;
    }
    Document doc = getDocument(h);
    Object od = doc.getProperty(Document.StreamDescriptionProperty);
    if (od instanceof DataObject) {
        DataObject d = (DataObject)od;
        EditorCookie cake = d.getCookie(EditorCookie.class);
        JEditorPane[] panes = cake.getOpenedPanes();
        int idx = panes == null ? -1 : Arrays.asList(panes).indexOf(c);
        if (idx != -1) {
            caretPos = c.getCaret().getDot();
        }
    }
    return caretPos;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:ParsingFoldSupport.java

示例2: run

import org.openide.cookies.EditorCookie; //导入方法依赖的package包/类
public void run() {
    if (pos == null) {
        return;
    }
    try {
        EditorCookie cook = DataObject.find(file).getLookup().lookup(EditorCookie.class);
        JEditorPane[] arr = cook.getOpenedPanes();
        if (arr == null) {
            return;
        }
        arr[0].setCaretPosition(pos.getOffset());
        InstantRenamePerformer.invokeInstantRename(arr[0]);
    } catch (DataObjectNotFoundException ex) {
        Exceptions.printStackTrace(ex);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:AssignResultToVariable.java

示例3: performContextAction

import org.openide.cookies.EditorCookie; //导入方法依赖的package包/类
@Override
protected void performContextAction(Node[] nodes) {        
    if(!Subversion.getInstance().checkClientAvailable()) {            
        return;
    }        
    if (visible(nodes)) {
        JEditorPane pane = activatedEditorPane(nodes);
        AnnotationBarManager.hideAnnotationBar(pane);
    } else {
        EditorCookie ec = activatedEditorCookie(nodes);
        if (ec == null) return;
        
        final File file = activatedFile(nodes);

        JEditorPane[] panes = ec.getOpenedPanes();
        if (panes == null) {
            ec.open();
            panes = ec.getOpenedPanes();
        }
        if (panes == null) {
            return;
        }
        final JEditorPane currentPane = panes[0];
        showAnnotations(currentPane, file, null);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:BlameAction.java

示例4: performContextAction

import org.openide.cookies.EditorCookie; //导入方法依赖的package包/类
@Override
protected void performContextAction(Node[] nodes) {
    if (visible(nodes)) {
        JEditorPane pane = activatedEditorPane(nodes);
        AnnotationBarManager.hideAnnotationBar(pane);
    } else {
        EditorCookie ec = activatedEditorCookie(nodes);
        if (ec == null) return;

        final File file = activatedFile(nodes);

        JEditorPane[] panes = ec.getOpenedPanes();
        if (panes == null) {
            ec.open();
            panes = ec.getOpenedPanes();
        }

        if (panes == null) {
            return;
        }
        final JEditorPane currentPane = panes[0];
        showAnnotations(currentPane, file, null, true);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:AnnotateAction.java

示例5: findComponent

import org.openide.cookies.EditorCookie; //导入方法依赖的package包/类
static JTextComponent findComponent(Lookup lookup) {
    EditorCookie ec = (EditorCookie) lookup.lookup(EditorCookie.class);
    if (ec != null) {
        JEditorPane panes[] = ec.getOpenedPanes();
        if (panes != null && panes.length > 0) {
            return panes[0];
        }
    }
    return lookup.lookup(JTextComponent.class);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:NavigationHistoryBackAction.java

示例6: getTargetFile

import org.openide.cookies.EditorCookie; //导入方法依赖的package包/类
public static FileObject getTargetFile(JTextComponent targetComponent) {
    if (targetComponent == null) {
        return null;
    }
    DataObject d = NbEditorUtilities.getDataObject(targetComponent.getDocument());
    if (d == null) {
        return null;
    }
    EditorCookie ec = (EditorCookie) d.getLookup().lookup(EditorCookie.class);
    if (ec == null || ec.getOpenedPanes() == null) {
        return null;
    }
    return d.getPrimaryFile();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:SoapServiceClientEditorDrop.java

示例7: getTargetFile

import org.openide.cookies.EditorCookie; //导入方法依赖的package包/类
public static FileObject getTargetFile(JTextComponent targetComponent) {
    if (targetComponent == null) {
        return null;
    }
    DataObject d = NbEditorUtilities.getDataObject(targetComponent.getDocument());
    if (d == null) {
        return null;
    }
    EditorCookie ec = (EditorCookie) d.getCookie(EditorCookie.class);
    if (ec == null || ec.getOpenedPanes() == null) {
        return null;
    }
    return d.getPrimaryFile();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:SoapClientEditorDrop.java

示例8: isFromEditor

import org.openide.cookies.EditorCookie; //导入方法依赖的package包/类
private static boolean isFromEditor(EditorCookie ec) {
    if (ec != null && ec.getOpenedPanes() != null) {
        TopComponent activetc = TopComponent.getRegistry().getActivated();
        if (activetc instanceof CloneableEditorSupport.Pane) {
            return true;
        }
    }
    return false;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:CPActionsImplementationProvider.java

示例9: getCurrentEditor

import org.openide.cookies.EditorCookie; //导入方法依赖的package包/类
private JEditorPane getCurrentEditor () {
    Node[] ns = TopComponent.getRegistry ().getActivatedNodes ();
    if (ns.length != 1) return null;
    EditorCookie editorCookie = ns [0].getLookup ().
        lookup (EditorCookie.class);
    if (editorCookie == null) return null;
    if (editorCookie.getOpenedPanes () == null) return null;
    if (editorCookie.getOpenedPanes ().length < 1) return null;
    return editorCookie.getOpenedPanes () [0];
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:TokensBrowserTopComponent.java

示例10: getCurrentDocument

import org.openide.cookies.EditorCookie; //导入方法依赖的package包/类
private AbstractDocument getCurrentDocument () {
    Node[] ns = TopComponent.getRegistry ().getActivatedNodes ();
    if (ns.length != 1) return null;
    EditorCookie editorCookie = ns [0].getLookup ().
        lookup (EditorCookie.class);
    if (editorCookie == null) return null;
    if (editorCookie.getOpenedPanes () == null) return null;
    if (editorCookie.getOpenedPanes ().length < 1) return null;
    JEditorPane pane = editorCookie.getOpenedPanes () [0];
    
    if (caretListener == null)
        caretListener = new CListener ();
    if (lastPane != null && lastPane != pane) {
        lastPane.removeCaretListener (caretListener);
        lastPane = null;
    }
    if (lastPane == null) {
        pane.addCaretListener (caretListener);
        lastPane = pane;
    }

    AbstractDocument doc = (AbstractDocument) editorCookie.getDocument ();
    if (documentListener == null)
        documentListener = new CDocumentListener ();
    if (lastDocument != null && lastDocument != doc) {
        lastDocument.removeDocumentListener (documentListener);
        lastDocument = null;
    }
    if (lastDocument == null) {
        doc.addDocumentListener (documentListener);
        lastDocument = doc;
    }
    return doc;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:35,代码来源:TokensBrowserTopComponent.java

示例11: getJTextComponent

import org.openide.cookies.EditorCookie; //导入方法依赖的package包/类
public JTextComponent getJTextComponent () {
    if (component == null) {
        DataObject dob = NbEditorUtilities.getDataObject (doc);
        EditorCookie ec = dob.getLookup ().lookup (EditorCookie.class);
        if (ec.getOpenedPanes ().length > 0)
            component = ec.getOpenedPanes () [0];
    }
    return component;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:Context.java

示例12: testDoNotAutocompleteQuteInHtmlAttribute

import org.openide.cookies.EditorCookie; //导入方法依赖的package包/类
public void testDoNotAutocompleteQuteInHtmlAttribute() throws DataObjectNotFoundException, IOException, BadLocationException {
    FileObject fo = getTestFile("testfiles/test.html");
    assertEquals("text/html", fo.getMIMEType());

    DataObject dobj = DataObject.find(fo);
    EditorCookie ec = dobj.getCookie(EditorCookie.class);
    Document document = ec.openDocument();
    ec.open();
    JEditorPane jep = ec.getOpenedPanes()[0];
    BaseAction type = (BaseAction) jep.getActionMap().get(NbEditorKit.defaultKeyTypedAction);
    //find the pipe
    String text = document.getText(0, document.getLength());

    int pipeIdx = text.indexOf('|');
    assertTrue(pipeIdx != -1);

    //delete the pipe
    document.remove(pipeIdx, 1);

    jep.setCaretPosition(pipeIdx);
    
    //type "
    ActionEvent ae = new ActionEvent(doc, 0, "\"");
    type.actionPerformed(ae, jep);

    //check the document content
    String beforeCaret = document.getText(pipeIdx, 2);
    assertEquals("\" ", beforeCaret);

}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:31,代码来源:CssBracketCompleterTest.java

示例13: getEPanes

import org.openide.cookies.EditorCookie; //导入方法依赖的package包/类
private JEditorPane[] getEPanes(final EditorCookie ec) throws Exception {
    class R implements Runnable {
        JEditorPane[] arr;
        public void run() {
            arr = ec == null ? null : ec.getOpenedPanes();
        }
    }
    R r = new R();
    SwingUtilities.invokeAndWait(r);
    return r.arr;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:DefaultDataObjectTest.java

示例14: run

import org.openide.cookies.EditorCookie; //导入方法依赖的package包/类
public void run() {
    try {
        EditorCookie cook = DataObject.find(file).getLookup().lookup(EditorCookie.class);
        JEditorPane[] arr = cook.getOpenedPanes();
        if (arr == null) {
            return;
        }
        EqualsHashCodeGenerator.invokeEqualsHashCode(handle, arr[0]);
    } catch (DataObjectNotFoundException ex) {
        Exceptions.printStackTrace(ex);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:MissingHashCode.java

示例15: activatedEditorPane

import org.openide.cookies.EditorCookie; //导入方法依赖的package包/类
private JEditorPane activatedEditorPane() {
    EditorCookie ec = activatedEditorCookie();        
    if (ec != null && SwingUtilities.isEventDispatchThread()) {              
        JEditorPane[] panes = ec.getOpenedPanes();
        if (panes != null && panes.length > 0) {
            return panes[0];
        }
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:VcsAnnotateAction.java


注:本文中的org.openide.cookies.EditorCookie.getOpenedPanes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。