# HG changeset patch # Parent 028f257adef1c7339812655cabef9d15fd552e2c # User Ralph Benjamin Ruijs [no commit message] diff -r 028f257adef1 java.source/apichanges.xml --- a/java.source/apichanges.xml Tue Nov 19 12:34:43 2013 +0000 +++ b/java.source/apichanges.xml Tue Nov 19 15:28:23 2013 +0100 @@ -108,6 +108,22 @@ + + + Added utility methods to find span of a Label's name in the source. + + + + + + Added utility methods to find span of a Label's name in the source. + Returns starting and ending offset of the label's name in the source code that was parsed + (ie. CompilationInfo.getText()), which may differ from the positions in the source + document if it has been already altered. + + + + Adding TreeUtilities.toScopeWithDisabledAccessibilityChecks method. diff -r 028f257adef1 java.source/nbproject/project.properties --- a/java.source/nbproject/project.properties Tue Nov 19 12:34:43 2013 +0000 +++ b/java.source/nbproject/project.properties Tue Nov 19 15:28:23 2013 +0100 @@ -46,7 +46,7 @@ javadoc.title=Java Source javadoc.arch=${basedir}/arch.xml javadoc.apichanges=${basedir}/apichanges.xml -spec.version.base=0.130.0 +spec.version.base=0.131.0 test.qa-functional.cp.extra=${refactoring.java.dir}/modules/ext/nb-javac-api.jar test.unit.run.cp.extra=${o.n.core.dir}/core/core.jar:\ ${o.n.core.dir}/lib/boot.jar:\ diff -r 028f257adef1 java.source/src/org/netbeans/api/java/source/TreeUtilities.java --- a/java.source/src/org/netbeans/api/java/source/TreeUtilities.java Tue Nov 19 12:34:43 2013 +0000 +++ b/java.source/src/org/netbeans/api/java/source/TreeUtilities.java Tue Nov 19 15:28:23 2013 +0100 @@ -840,6 +840,58 @@ return findNameSpan(var.getName().toString(), var); } + /**Find span of the {@link LabeledStatementTree#getLabel()} identifier in the source. + * Returns starting and ending offset of the name in the source code that was parsed + * (ie. {@link CompilationInfo.getText()}, which may differ from the positions in the source + * document if it has been already altered. + * + * @param lst labeled statement which name should be searched for + * @return the span of the name, or null if cannot be found + * @since 0.131 + */ + public int[] findNameSpan(LabeledStatementTree lst) { + return findNameSpan(lst.getLabel().toString(), lst); + } + + /**Find span of the {@link TypeParameterTree#getName()} identifier in the source. + * Returns starting and ending offset of the name in the source code that was parsed + * (ie. {@link CompilationInfo.getText()}, which may differ from the positions in the source + * document if it has been already altered. + * + * @param tpt type parameter which name should be searched for + * @return the span of the name, or null if cannot be found + * @since 0.131 + */ + public int[] findNameSpan(TypeParameterTree tpt) { + return findNameSpan(tpt.getName().toString(), tpt); + } + + /**Find span of the {@link LabeledStatementTree#getLabel()} identifier in the source. + * Returns starting and ending offset of the name in the source code that was parsed + * (ie. {@link CompilationInfo.getText()}, which may differ from the positions in the source + * document if it has been already altered. + * + * @param brk labeled statement which name should be searched for + * @return the span of the name, or null if cannot be found + * @since 0.131 + */ + public int[] findNameSpan(BreakTree brk) { + return findNameSpan(brk.getLabel().toString(), brk); + } + + /**Find span of the {@link LabeledStatementTree#getLabel()} identifier in the source. + * Returns starting and ending offset of the name in the source code that was parsed + * (ie. {@link CompilationInfo.getText()}, which may differ from the positions in the source + * document if it has been already altered. + * + * @param cont labeled statement which name should be searched for + * @return the span of the name, or null if cannot be found + * @since 0.131 + */ + public int[] findNameSpan(ContinueTree cont) { + return findNameSpan(cont.getLabel().toString(), cont); + } + /**Find span of the {@link MethodTree#getParameters()} parameter list in the source. * Returns the position of the opening and closing parentheses of the parameter list * in the source code that was parsed (ie. {@link CompilationInfo.getText()}, which