# This patch file was generated by NetBeans IDE # This patch can be applied using context Tools: Apply Diff Patch action on respective folder. # It uses platform neutral UTF-8 encoding. # Above lines and this line are ignored by the patching process. Index: cnd/modelutil/src/org/netbeans/modules/cnd/modelutil/CsmUtilities.java --- cnd/modelutil/src/org/netbeans/modules/cnd/modelutil/CsmUtilities.java Base (1.27) +++ cnd/modelutil/src/org/netbeans/modules/cnd/modelutil/CsmUtilities.java Locally Modified (Based On 1.27) @@ -81,6 +81,7 @@ import javax.swing.text.Position; import org.netbeans.modules.cnd.api.model.CsmFunctionDefinition; import org.netbeans.modules.cnd.api.model.CsmTemplate; +import org.netbeans.modules.cnd.loaders.CppEditorSupport; import org.netbeans.modules.editor.NbEditorUtilities; import org.openide.awt.StatusDisplayer; import org.openide.cookies.EditorCookie; @@ -239,6 +240,21 @@ return getCsmFile(node.getLookup().lookup(DataObject.class), waitParsing); } + /* + * returns CsmFile if file is opened in editor + */ + public static CsmFile getCsmFile(Node node) { + EditorCookie ec = node.getCookie(EditorCookie.class); + if (ec instanceof CppEditorSupport) { + JEditorPane[] panes = getOpenedPanesInEQ(ec); + if (panes != null && panes.length>0) { + Document doc = panes[0].getDocument(); + return getCsmFile(doc, false); + } + } + return null; + } + public static JEditorPane[] getOpenedPanesInEQ(final EditorCookie ec) { assert ec != null; final JEditorPane[][] panes = {null};