本文整理汇总了Java中org.eclipse.jface.text.TypedRegion类的典型用法代码示例。如果您正苦于以下问题:Java TypedRegion类的具体用法?Java TypedRegion怎么用?Java TypedRegion使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TypedRegion类属于org.eclipse.jface.text包,在下文中一共展示了TypedRegion类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPartition
import org.eclipse.jface.text.TypedRegion; //导入依赖的package包/类
@Override
public ITypedRegion getPartition(int offset, boolean preferOpenPartitions) {
if (preferOpenPartitions) {
if (offset <= 0) {
return new TypedRegion(offset, 0, IDocument.DEFAULT_CONTENT_TYPE);
}
if (fDocument != null && offset == fDocument.getLength()) {
// Fix issue where a wrong partition is being gotten when a comment is being typed
// as the last thing in the document.
// Fixes #PyDev-762: Code completion is active in comments.
try {
int lineOffset = fDocument.getLineOffset(fDocument.getLineOfOffset(offset));
if (lineOffset != offset) { // A comment must start with a #, so, the char 0 of a line can't be a comment itself.
ITypedRegion region = getPartition(offset - 1);
if (IPythonPartitions.PY_COMMENT.equals(region.getType())
|| IDocument.DEFAULT_CONTENT_TYPE.equals(region.getType())) {
return region;
}
}
} catch (BadLocationException e) {
// ignore
}
}
}
return super.getPartition(offset, preferOpenPartitions);
}
示例2: reconcile
import org.eclipse.jface.text.TypedRegion; //导入依赖的package包/类
@Override
public void reconcile(DirtyRegion dirtyRegion, IRegion subRegion) {
if (this.document == null)
return;
final TypedRegion tr = (TypedRegion) subRegion;
if (tr.getType().equals(MetaModelPartitionScanner.META_MODEL_LOADINSTANCE)
|| tr.getType().equals(MetaModelPartitionScanner.META_MODEL_LOADMODEL))
this.reconcile(subRegion);
return;
}
示例3: reconcile
import org.eclipse.jface.text.TypedRegion; //导入依赖的package包/类
@Override
public void reconcile(final DirtyRegion dirtyRegion, final IRegion subRegion) {
if (this.document == null) {
return;
}
if (((TypedRegion) subRegion).getType().equals(MetaModelPartitionScanner.META_MODEL_REASON)) {
return;
}
this.reconcile(subRegion);
}
示例4: getPartition
import org.eclipse.jface.text.TypedRegion; //导入依赖的package包/类
@Override
public ITypedRegion getPartition(int arg0) {
/*
* Never gets called because this class implements IDocumentPartitioner
* rather than IDocumentPartitionerExtension2 which is required for
* IDocumentExtension3
* Confused ?? Me too...
*/
return new TypedRegion(0, fDocument.getLength(), IMPEX_HEADER);
}
示例5: getPartition
import org.eclipse.jface.text.TypedRegion; //导入依赖的package包/类
/**
* {@inheritDoc}
* <p>
* May be replaced or extended by subclasses.
* </p>
*/
public ITypedRegion getPartition(int offset, boolean preferOpenPartitions) {
ITypedRegion region= getPartition(offset);
if (preferOpenPartitions) {
if (region.getOffset() == offset && !region.getType().equals(IDocument.DEFAULT_CONTENT_TYPE)) {
if (offset > 0) {
region= getPartition(offset - 1);
if (region.getType().equals(IDocument.DEFAULT_CONTENT_TYPE))
return region;
}
return new TypedRegion(offset, 0, IDocument.DEFAULT_CONTENT_TYPE);
}
}
return region;
}
示例6: getUserRegion
import org.eclipse.jface.text.TypedRegion; //导入依赖的package包/类
/**
* @return
*/
public ITypedRegion getUserRegion()
{
if (hasUserPartitions())
{
ITypedRegion region = PartitionToolkit.mergePartitions((ITypedRegion[]) userOutput
.toArray(new TypedRegion[userOutput.size()]));
// re-initialize the user partitions
resetUserPartitions();
return region;
} else
{
return null;
}
}
示例7: getPartition
import org.eclipse.jface.text.TypedRegion; //导入依赖的package包/类
/**
* {@inheritDoc}
* <p>
* May be replaced or extended by subclasses.
* </p>
*
* @since 2.2
*/
public ITypedRegion getPartition(int offset, boolean preferOpenPartitions) {
ITypedRegion region = getPartition(offset);
if (preferOpenPartitions) {
if (region.getOffset() == offset && !region.getType().equals(IDocument.DEFAULT_CONTENT_TYPE)) {
if (offset > 0) {
region = getPartition(offset - 1);
if (region.getType().equals(IDocument.DEFAULT_CONTENT_TYPE))
return region;
}
return new TypedRegion(offset, 0, IDocument.DEFAULT_CONTENT_TYPE);
}
}
return region;
}
示例8: getPartition
import org.eclipse.jface.text.TypedRegion; //导入依赖的package包/类
/**
* {@inheritDoc}
*
* <p>May be replaced or extended by subclasses.
*/
public ITypedRegion getPartition(int offset, boolean preferOpenPartitions) {
ITypedRegion region = getPartition(offset);
if (preferOpenPartitions) {
if (region.getOffset() == offset
&& !region.getType().equals(IDocument.DEFAULT_CONTENT_TYPE)) {
if (offset > 0) {
region = getPartition(offset - 1);
if (region.getType().equals(IDocument.DEFAULT_CONTENT_TYPE)) return region;
}
return new TypedRegion(offset, 0, IDocument.DEFAULT_CONTENT_TYPE);
}
}
return region;
}
示例9: computePartitioning
import org.eclipse.jface.text.TypedRegion; //导入依赖的package包/类
protected ITypedRegion[] computePartitioning(int offset, int length)
{
ITypedRegion[] regions = null;
try
{
regions = TextUtilities
.computePartitioning(getDocument(), getDocumentPartitioning(), offset, length, false);
}
catch (BadLocationException x)
{
regions = new TypedRegion[0];
}
return regions;
}
示例10: computePartitioning
import org.eclipse.jface.text.TypedRegion; //导入依赖的package包/类
/**
* Computes and returns the partitioning for the given region of the input document
* of the reconciler's connected text viewer.
*
* @param offset the region offset
* @param length the region length
* @return the computed partitioning
* @since 3.0
*/
private ITypedRegion[] computePartitioning(int offset, int length)
{
ITypedRegion[] regions = null;
try
{
regions = TextUtilities.computePartitioning(getDocument(), getDocumentPartitioning(), offset, length, false);
} catch (BadLocationException x)
{
regions = new TypedRegion[0];
}
return regions;
}
示例11: computePartitioning
import org.eclipse.jface.text.TypedRegion; //导入依赖的package包/类
@Override
public ITypedRegion[] computePartitioning(int offset, int length) {
/*
* Never gets called because this class implements IDocumentPartitioner
* rather than IDocumentPartitionerExtension2 which is required for
* IDocumentExtension3
* Confused ?? Me too...
*/
List<TypedRegion> list = new ArrayList<TypedRegion>();
try {
int start;
int nextOffset;
boolean isHeader = true;
int docLength = fDocument.getLength();
if (offset == 0) {
nextOffset = getLineEndOffset(1, fDocument);
list.add(new TypedRegion(0, nextOffset + 1, IMPEX_HEADER));
int i = 1;
while (nextOffset + 1 < docLength) {
start = nextOffset+ 1;
if (Character.isDigit(fDocument.getChar(start))) {
isHeader = true;
}
else {
isHeader = false;
}
nextOffset = getLineEndOffset(i + 1, fDocument);
if (isHeader) {
list.add(new TypedRegion(start, nextOffset - start + 1, IMPEX_INSTRUCTION));
}
else {
list.add(new TypedRegion(start, nextOffset - start + 1, IMPEX_DATA));
}
i = i + 1;
}
}
else {
if (Character.isDigit(fDocument.getChar(offset))) {
isHeader = true;
}
else {
isHeader = false;
}
if (isHeader) {
list.add(new TypedRegion(offset, length, IMPEX_HEADER));
}
else {
list.add(new TypedRegion(offset, length, IMPEX_DATA));
}
}
}
catch (BadLocationException ble) {
Activator.logError("BadLocationException", ble);
}
if (list.isEmpty()) {
list.add(new TypedRegion(offset, length, null));
}
TypedRegion[] result = new TypedRegion[list.size()];
list.toArray(result);
return result;
}
示例12: testMergePartitions
import org.eclipse.jface.text.TypedRegion; //导入依赖的package包/类
/**
* Test method for {@link org.lamport.tla.toolbox.tool.tlc.output.ParsingTLCOutputSink#mergePartitions(org.eclipse.jface.text.ITypedRegion[])}.
*/
public void testMergePartitions()
{
assertEquals(new TypedRegion(0, 100, "type"), PartitionToolkit.mergePartitions(new ITypedRegion[] {
new TypedRegion(0, 10, "type"), new TypedRegion(10, 80, "type"), new TypedRegion(90, 10, "type") }));
}
示例13: testMergePartitions2
import org.eclipse.jface.text.TypedRegion; //导入依赖的package包/类
public void testMergePartitions2()
{
assertEquals(new TypedRegion(0, 100, "type"), PartitionToolkit
.mergePartitions(new ITypedRegion[] { new TypedRegion(0, 100, "type") }));
}
示例14: computePartitioning
import org.eclipse.jface.text.TypedRegion; //导入依赖的package包/类
@Override
public ITypedRegion[] computePartitioning(int offset, int length) {
return new TypedRegion[] { new TypedRegion(offset, length, IDocument.DEFAULT_CONTENT_TYPE) };
}
示例15: getPartition
import org.eclipse.jface.text.TypedRegion; //导入依赖的package包/类
@Override
public ITypedRegion getPartition(int offset) {
return new TypedRegion(offset, 1, IDocument.DEFAULT_CONTENT_TYPE);
}