diff -r 1f155bc084cd php.dbgp/nbproject/project.xml --- a/php.dbgp/nbproject/project.xml Mon Mar 30 14:41:22 2015 +0200 +++ b/php.dbgp/nbproject/project.xml Tue Mar 31 16:21:39 2015 +0200 @@ -159,7 +159,7 @@ 1 - 2.13 + 2.50 diff -r 1f155bc084cd php.dbgp/src/org/netbeans/modules/php/dbgp/breakpoints/Utils.java --- a/php.dbgp/src/org/netbeans/modules/php/dbgp/breakpoints/Utils.java Mon Mar 30 14:41:22 2015 +0200 +++ b/php.dbgp/src/org/netbeans/modules/php/dbgp/breakpoints/Utils.java Tue Mar 31 16:21:39 2015 +0200 @@ -43,18 +43,11 @@ */ package org.netbeans.modules.php.dbgp.breakpoints; -import java.util.List; import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; -import javax.swing.text.AbstractDocument; -import javax.swing.text.Document; -import javax.swing.text.StyledDocument; import org.netbeans.api.debugger.Breakpoint; import org.netbeans.api.debugger.DebuggerManager; -import org.netbeans.api.lexer.LanguagePath; -import org.netbeans.api.lexer.TokenHierarchy; -import org.netbeans.api.lexer.TokenSequence; import org.netbeans.api.options.OptionsDisplayer; import org.netbeans.modules.php.dbgp.DebugSession; import org.netbeans.modules.php.dbgp.SessionId; @@ -64,13 +57,11 @@ import org.netbeans.modules.php.dbgp.packets.BrkpntSetCommand; import org.netbeans.modules.php.dbgp.packets.BrkpntSetCommand.State; import org.netbeans.spi.debugger.ui.EditorContextDispatcher; -import org.openide.cookies.EditorCookie; import org.openide.cookies.LineCookie; import org.openide.filesystems.FileObject; import org.openide.loaders.DataObject; import org.openide.loaders.DataObjectNotFoundException; import org.openide.text.Line; -import org.openide.text.NbDocument; /** * @author ads @@ -217,49 +208,8 @@ if (!isPhpFile(fo)) { return false; } - EditorCookie editorCookie = line.getLookup().lookup(EditorCookie.class); - StyledDocument document = editorCookie.getDocument(); - Boolean isPhp = null; - ((AbstractDocument) document).readLock(); - try { - TokenHierarchy th = TokenHierarchy.get((Document) document); - int ln = line.getLineNumber(); - int offset = NbDocument.findLineOffset(document, ln); - int maxOffset = document.getLength() - 1; - int maxLine = NbDocument.findLineNumber(document, maxOffset); - int offset2; - if (ln + 1 > maxLine) { - offset2 = maxOffset; - } else { - offset2 = NbDocument.findLineOffset(document, ln+1) - 1; - } - // The line has offsets - Set languagePaths = th.languagePaths(); - for (LanguagePath lp : languagePaths) { - List> tsl = th.tokenSequenceList(lp, offset, offset2); - for (TokenSequence ts : tsl) { - if (ts.moveNext()) { - //int to = ts.offset(); - //if (!(offset <= to && to < offset2)) { - // continue; - //} - TokenSequence ets; - ets = ts.embedded(); - if (ets != null) { - ts = ets; - } - String mimeType = ts.language().mimeType(); - if (isPhp == null && MIME_TYPE.equals(mimeType)) { - isPhp = true; - break; - } - } - } - } - } finally { - ((AbstractDocument) document).readUnlock(); - } - return isPhp != null && isPhp; + Set mimeTypesOnLine = EditorContextDispatcher.getDefault().getMIMETypesOnLine(line); + return mimeTypesOnLine.contains(MIME_TYPE); } } diff -r 1f155bc084cd spi.debugger.ui/apichanges.xml --- a/spi.debugger.ui/apichanges.xml Mon Mar 30 14:41:22 2015 +0200 +++ b/spi.debugger.ui/apichanges.xml Tue Mar 31 16:21:39 2015 +0200 @@ -229,6 +229,25 @@ + + + A method for retrieving a set of language MIME types on a line in a document is added. + + + + + +

+ Methods getMIMETypesOnCurrentLine() and + getMIMETypesOnLine() added to + EditorContextDispatcher class. They provide a set of + MIME types of languages found on the line. +

+
+ + +
+ diff -r 1f155bc084cd spi.debugger.ui/manifest.mf --- a/spi.debugger.ui/manifest.mf Mon Mar 30 14:41:22 2015 +0200 +++ b/spi.debugger.ui/manifest.mf Tue Mar 31 16:21:39 2015 +0200 @@ -2,6 +2,6 @@ OpenIDE-Module: org.netbeans.spi.debugger.ui/1 OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/debugger/ui/Bundle.properties OpenIDE-Module-Layer: org/netbeans/modules/debugger/resources/mf-layer.xml -OpenIDE-Module-Specification-Version: 2.49 +OpenIDE-Module-Specification-Version: 2.50 OpenIDE-Module-Provides: org.netbeans.spi.debugger.ui OpenIDE-Module-Install: org/netbeans/modules/debugger/ui/DebuggerModule.class diff -r 1f155bc084cd spi.debugger.ui/src/org/netbeans/spi/debugger/ui/EditorContextDispatcher.java --- a/spi.debugger.ui/src/org/netbeans/spi/debugger/ui/EditorContextDispatcher.java Mon Mar 30 14:41:22 2015 +0200 +++ b/spi.debugger.ui/src/org/netbeans/spi/debugger/ui/EditorContextDispatcher.java Tue Mar 31 16:21:39 2015 +0200 @@ -294,7 +294,12 @@ } } - Set getMIMETypesOnCurrentLine() { + /** + * Get a list of MIME types of languages found on the current line. + * @return A set of MIME types. + * @since 2.50 + */ + public Set getMIMETypesOnCurrentLine() { Line line = getCurrentLine(); if (line == null) { return Collections.EMPTY_SET; @@ -302,7 +307,13 @@ return getMIMETypesOnLine(line); } - Set getMIMETypesOnLine(Line line) { + /** + * Get a list of MIME types of languages found on the line. + * @param line The line to search for the MIME types. + * @return A set of MIME types. + * @since 2.50 + */ + public Set getMIMETypesOnLine(Line line) { EditorCookie editorCookie = line.getLookup().lookup(EditorCookie.class); StyledDocument document = editorCookie.getDocument(); Set mimeTypes = null;