本文整理匯總了Java中org.eclipse.jface.text.ITypedRegion.equals方法的典型用法代碼示例。如果您正苦於以下問題:Java ITypedRegion.equals方法的具體用法?Java ITypedRegion.equals怎麽用?Java ITypedRegion.equals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.jface.text.ITypedRegion
的用法示例。
在下文中一共展示了ITypedRegion.equals方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addLocalJavascript
import org.eclipse.jface.text.ITypedRegion; //導入方法依賴的package包/類
public void addLocalJavascript(IDocument doc, List files, int offset) {
try {
List typedOffsets = new ArrayList();
String[] categories = doc.getPositionCategories();
for (int i = 0; i < categories.length; i++) {
Position[] positions = doc.getPositions(categories[i]);
for (int j = 0; j < positions.length; j++) {
typedOffsets.add(new Integer(positions[j].getOffset()));
}
}
Collections.sort(typedOffsets);
List regions = new ArrayList();
ITypedRegion saveRegion = null;
ITypedRegion currentRegion = null;
for (Iterator i = typedOffsets.iterator(); i.hasNext();) {
int tOffset = ((Integer) i.next()).intValue();
if (tOffset > offset)
break;
saveRegion = doc.getPartition(tOffset);
if (null == currentRegion || !currentRegion.equals(saveRegion)) {
currentRegion = saveRegion;
regions.add(currentRegion);
}
}
List javascriptFunctions = new ArrayList();
for (Iterator i = regions.iterator(); i.hasNext();) {
ITypedRegion region = (ITypedRegion) i.next();
if (region.getType().equals(PartitionScanner.XML_TAG)) {
if (isNodeHeader(region, doc)) {
Node n = new Node(null, region, doc);
if (null != n.getName() && n.getName().equalsIgnoreCase("script")) {
int index = doc.get().indexOf("</", n.getNameStart());
if (index > 0) {
JavascriptFunction[] functions = JavascriptParser.parse(doc.get(n.getNameStart(), index
- n.getNameStart()));
for (int j = 0; j < functions.length; j++) {
javascriptFunctions.add(functions[j]);
}
}
}
}
}
}
if (javascriptFunctions.size() > 0) {
files.add(new JavascriptFile((JavascriptFunction[]) javascriptFunctions
.toArray(new JavascriptFunction[javascriptFunctions.size()])));
}
} catch (Exception e) {
}
}
示例2: addLocalCSS
import org.eclipse.jface.text.ITypedRegion; //導入方法依賴的package包/類
public void addLocalCSS(IDocument doc, List files, int offset) {
try {
List typedOffsets = new ArrayList();
String[] categories = doc.getPositionCategories();
for (int i = 0; i < categories.length; i++) {
Position[] positions = doc.getPositions(categories[i]);
for (int j = 0; j < positions.length; j++) {
typedOffsets.add(new Integer(positions[j].getOffset()));
}
}
Collections.sort(typedOffsets);
List regions = new ArrayList();
ITypedRegion saveRegion = null;
ITypedRegion currentRegion = null;
for (Iterator i = typedOffsets.iterator(); i.hasNext();) {
int tOffset = ((Integer) i.next()).intValue();
if (tOffset > offset)
break;
saveRegion = doc.getPartition(tOffset);
if (null == currentRegion || !currentRegion.equals(saveRegion)) {
currentRegion = saveRegion;
regions.add(currentRegion);
}
}
List cssStyles = new ArrayList();
for (Iterator i = regions.iterator(); i.hasNext();) {
ITypedRegion region = (ITypedRegion) i.next();
if (region.getType().equals(PartitionScanner.XML_TAG)) {
if (isNodeHeader(region, doc)) {
Node n = new Node(null, region, doc);
if (null != n.getName() && n.getName().equalsIgnoreCase("style")) {
int index = doc.get().indexOf("</", n.getNameStart());
if (index > 0) {
CSSStyle[] styles = CSSParser
.parse(doc.get(n.getNameStart(), index - n.getNameStart()));
for (int j = 0; j < styles.length; j++) {
cssStyles.add(styles[j]);
}
}
}
}
}
}
if (cssStyles.size() > 0) {
files.add(new CSSFile((CSSStyle[]) cssStyles.toArray(new CSSStyle[cssStyles.size()])));
}
} catch (Exception e) {
}
}