本文整理汇总了Java中org.eclipse.jface.text.TextUtilities.indexOf方法的典型用法代码示例。如果您正苦于以下问题:Java TextUtilities.indexOf方法的具体用法?Java TextUtilities.indexOf怎么用?Java TextUtilities.indexOf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.text.TextUtilities
的用法示例。
在下文中一共展示了TextUtilities.indexOf方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isBlockCommented
import org.eclipse.jface.text.TextUtilities; //导入方法依赖的package包/类
private boolean isBlockCommented(int startLine, int endLine, String[] prefixes, IDocument document) {
try {
// check for occurrences of prefixes in the given lines
for (int i = startLine; i <= endLine; i++) {
IRegion line = document.getLineInformation(i);
String text = document.get(line.getOffset(), line.getLength());
int[] found = TextUtilities.indexOf(prefixes, text, 0);
if (found[0] == -1) {
// found a line which is not commented
return false;
}
String s = document.get(line.getOffset(), found[0]);
s = s.trim();
if (s.length() != 0) {
// found a line which is not commented
return false;
}
}
return true;
} catch (BadLocationException x) {
// should not happen
}
return false;
}
示例2: isBlockCommented
import org.eclipse.jface.text.TextUtilities; //导入方法依赖的package包/类
/**
* Determines whether each line is prefixed by one of the prefixes.
*
* @param startLine Start line in document
* @param endLine End line in document
* @param prefixes Possible comment prefixes
* @param document The document
* @return <code>true</code> iff each line from <code>startLine</code>
* to and including <code>endLine</code> is prepended by one
* of the <code>prefixes</code>, ignoring whitespace at the
* begin of line
*/
private boolean isBlockCommented(int startLine, int endLine, String[] prefixes, IDocument document)
{
try
{
// check for occurrences of prefixes in the given lines
for (int i = startLine; i <= endLine; i++)
{
IRegion line = document.getLineInformation(i);
String text = document.get(line.getOffset(), line.getLength());
int[] found = TextUtilities.indexOf(prefixes, text, 0);
if (found[0] == -1)
// found a line which is not commented
return false;
String s = document.get(line.getOffset(), found[0]);
s = s.trim();
if (s.length() != 0)
// found a line which is not commented
return false;
}
return true;
} catch (BadLocationException x)
{
// should not happen
// TODO
}
return false;
}
示例3: isBlockCommented
import org.eclipse.jface.text.TextUtilities; //导入方法依赖的package包/类
/**
* Determines whether each line is prefixed by one of the prefixes.
*
* @param startLine Start line in document
* @param endLine End line in document
* @param prefixes Possible comment prefixes
* @param document The document
* @return <code>true</code> iff each line from <code>startLine</code>
* to and including <code>endLine</code> is prepended by one
* of the <code>prefixes</code>, ignoring whitespace at the
* begin of line
* @since 2.1
*/
protected boolean isBlockCommented(int startLine, int endLine, String[] prefixes, IDocument document) {
try {
// check for occurrences of prefixes in the given lines
for (int i= startLine; i <= endLine; i++) {
IRegion line= document.getLineInformation(i);
String text= document.get(line.getOffset(), line.getLength());
int[] found= TextUtilities.indexOf(prefixes, text, 0);
if (found[0] == -1)
// found a line which is not commented
return false;
String s= document.get(line.getOffset(), found[0]);
s= s.trim();
if (s.length() != 0)
// found a line which is not commented
return false;
}
return true;
} catch (BadLocationException x) {
// should not happen
log.error(x.getMessage(), x);
}
return false;
}
示例4: isBlockCommented
import org.eclipse.jface.text.TextUtilities; //导入方法依赖的package包/类
/**
* Determines whether each line is prefixed by one of the prefixes.
*
* @param startLine
* Start line in document
* @param endLine
* End line in document
* @param prefixes
* Possible comment prefixes
* @param document
* The document
* @return <code>true</code> iff each line from <code>startLine</code>
* to and including <code>endLine</code> is prepended by one of
* the <code>prefixes</code>, ignoring whitespace at the begin of
* line
*/
private boolean isBlockCommented(int startLine, int endLine, String[] prefixes, IDocument document)
{
try
{
// check for occurrences of prefixes in the given lines
for (int i = startLine; i <= endLine; i++)
{
IRegion line = document.getLineInformation(i);
String text = document.get(line.getOffset(), line.getLength());
int[] found = TextUtilities.indexOf(prefixes, text, 0);
if (found[0] == -1)
// found a line which is not commented
return false;
String s = document.get(line.getOffset(), found[0]);
s = s.trim();
if (s.length() != 0)
// found a line which is not commented
return false;
}
return true;
}
catch (BadLocationException x)
{
// should not happen
// JavaPlugin.log(x);
}
return false;
}
示例5: isBlockCommented
import org.eclipse.jface.text.TextUtilities; //导入方法依赖的package包/类
/**
* Determines whether each line is prefixed by one of the prefixes.
*
* @param startLine Start line in document
* @param endLine End line in document
* @param prefixes Possible comment prefixes
* @param document The document
* @return <code>true</code> iff each line from <code>startLine</code>
* to and including <code>endLine</code> is prepended by one
* of the <code>prefixes</code>, ignoring whitespace at the
* begin of line
*/
private boolean isBlockCommented(int startLine, int endLine, String[] prefixes, IDocument document) {
try {
// check for occurrences of prefixes in the given lines
for (int i= startLine; i <= endLine; i++) {
IRegion line= document.getLineInformation(i);
String text= document.get(line.getOffset(), line.getLength());
int[] found= TextUtilities.indexOf(prefixes, text, 0);
if (found[0] == -1)
// found a line which is not commented
return false;
String s= document.get(line.getOffset(), found[0]);
s= s.trim();
if (s.length() != 0)
// found a line which is not commented
return false;
}
return true;
} catch (BadLocationException x) {
// should not happen
JavaPlugin.log(x);
}
return false;
}
示例6: isBlockCommented
import org.eclipse.jface.text.TextUtilities; //导入方法依赖的package包/类
/**
* Determines whether each line is prefixed by one of the prefixes.
*
* @param startLine Start line in document
* @param endLine End line in document
* @param prefixes Possible comment prefixes
* @param document The document
* @return <code>true</code> iff each line from <code>startLine</code>
* to and including <code>endLine</code> is prepended by one
* of the <code>prefixes</code>, ignoring whitespace at the
* begin of line
*/
protected boolean isBlockCommented(int startLine, int endLine, String[] prefixes, IDocument document) {
try {
// check for occurrences of prefixes in the given lines
for (int i= startLine; i <= endLine; i++) {
IRegion line= document.getLineInformation(i);
String text= document.get(line.getOffset(), line.getLength());
int[] found= TextUtilities.indexOf(prefixes, text, 0);
if (found[0] == -1)
// found a line which is not commented
return false;
String s= document.get(line.getOffset(), found[0]);
s= s.trim();
if (s.length() != 0)
// found a line which is not commented
return false;
}
return true;
} catch (BadLocationException x) {
// should not happen
LangCore.logError("Unexpected error.", x);
}
return false;
}