当前位置: 首页>>代码示例>>Java>>正文


Java TypedRegion类代码示例

本文整理汇总了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);
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:27,代码来源:PyPartitioner.java

示例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;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:12,代码来源:LoadReconcilingStrategy.java

示例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);
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:11,代码来源:SyntacticReconcilingStrategy.java

示例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);
}
 
开发者ID:SAP,项目名称:hybris-commerce-eclipse-plugin,代码行数:11,代码来源:ImpexDocumentPartitioner.java

示例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;
}
 
开发者ID:tlaplus,项目名称:tlaplus,代码行数:21,代码来源:TLAFastPartitioner.java

示例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;
    }
}
 
开发者ID:tlaplus,项目名称:tlaplus,代码行数:18,代码来源:TagBasedTLCAnalyzer.java

示例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;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:23,代码来源:DocumentPartitioner.java

示例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;
}
 
开发者ID:eclipse,项目名称:che,代码行数:20,代码来源:FastPartitioner.java

示例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;
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:15,代码来源:CommonReconciler.java

示例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;
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:22,代码来源:MultiRegionSpellingReconcileStrategy.java

示例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;
}
 
开发者ID:SAP,项目名称:hybris-commerce-eclipse-plugin,代码行数:69,代码来源:ImpexDocumentPartitioner.java

示例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") }));
}
 
开发者ID:tlaplus,项目名称:tlaplus,代码行数:9,代码来源:ParsingToolkitTest.java

示例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") }));
}
 
开发者ID:tlaplus,项目名称:tlaplus,代码行数:6,代码来源:ParsingToolkitTest.java

示例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) };
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:5,代码来源:ScriptConsolePartitioner.java

示例15: getPartition

import org.eclipse.jface.text.TypedRegion; //导入依赖的package包/类
@Override
public ITypedRegion getPartition(int offset) {
    return new TypedRegion(offset, 1, IDocument.DEFAULT_CONTENT_TYPE);
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:5,代码来源:ScriptConsolePartitioner.java


注:本文中的org.eclipse.jface.text.TypedRegion类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。