类org.eclipse.jface.text.source.AnnotationModel源码实例Demo

下面列出了怎么用org.eclipse.jface.text.source.AnnotationModel的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: xtext-eclipse   文件: EmbeddedEditorModelAccess.java
protected void setModel(XtextDocument document, String prefix, String editablePart, String suffix) {
	if (this.insertLineBreaks) {
		String delimiter = document.getDefaultLineDelimiter();
		prefix = prefix + delimiter;
		suffix = delimiter + suffix;
	}
	String model = prefix + editablePart + suffix;
	document.set(model);
	XtextResource resource = createResource(model);
	document.setInput(resource);
	AnnotationModel annotationModel = new AnnotationModel();
	if (document instanceof ISynchronizable) {
		Object lock = ((ISynchronizable) document).getLockObject();
		if (lock == null) {
			lock = new Object();
			((ISynchronizable) document).setLockObject(lock);
		}
		((ISynchronizable) annotationModel).setLockObject(lock);
	}
	this.viewer.setDocument(document, annotationModel, prefix.length(), editablePart.length());
}
 
@Override
public void connect(Object element) throws CoreException {
	super.connect(element);
	if (getFileInfo(element) != null)
		return;

	CompilationUnitInfo info= fFakeCUMapForMissingInfo.get(element);
	if (info == null) {
		ICompilationUnit cu= createFakeCompiltationUnit(element, true);
		if (cu == null)
			return;
		info= new CompilationUnitInfo();
		info.fCopy= cu;
		info.fElement= element;
		info.fModel= new AnnotationModel();
		fFakeCUMapForMissingInfo.put(element, info);
	}
	info.fCount++;
}
 
源代码3 项目: saros   文件: ContributionAnnotationHistoryTest.java
@Test
public void testAddEntryWithMultipleModels() {
  final AnnotationModel testModel2 = new AnnotationModel();

  Pair<IAnnotationModel, List<ContributionAnnotation>> annotationsToRemove =
      history.addNewEntry(createDummyAnnotation(testModel2));
  assertNull(annotationsToRemove);

  for (int i = 1; i < MAX_HISTORY_LENGTH; i++) {
    annotationsToRemove = history.addNewEntry(createDummyAnnotation(testModel));
    assertNull(annotationsToRemove);
  }

  annotationsToRemove = history.addNewEntry(createDummyAnnotation(testModel));
  assertSame(testModel2, annotationsToRemove.getLeft());

  annotationsToRemove = history.addNewEntry(createDummyAnnotation(testModel));
  assertSame(testModel, annotationsToRemove.getLeft());
}
 
源代码4 项目: xtext-eclipse   文件: XtextDocumentProvider.java
@Override
protected IAnnotationModel createAnnotationModel(Object element) throws CoreException {
	if (element instanceof IFileEditorInput) {
		IFileEditorInput input = (IFileEditorInput) element;
		return new XtextResourceMarkerAnnotationModel(input.getFile(), issueResolutionProvider, issueUtil);
	} else if (element instanceof IURIEditorInput) {
		return new AnnotationModel();
	}
	return super.createAnnotationModel(element);
}
 
源代码5 项目: statecharts   文件: StyledTextXtextAdapter.java
protected XtextSourceViewer createXtextSourceViewer() {
	final XtextSourceViewer result = new XtextSourceViewerEx(getStyledText(),
			getPreferenceStoreAccess().getPreferenceStore());
	result.configure(getXtextSourceViewerConfiguration());
	result.setDocument(getXtextDocument(), new AnnotationModel());
	return result;
}
 
public IAnnotationModel createAnnotationModel(IPath path)
{
	IResource file = ResourcesPlugin.getWorkspace().getRoot().findMember(path);
	if (file instanceof IFile)
	{
		return new CommonAnnotationModel(file);
	}
	return new AnnotationModel();
}
 
源代码7 项目: birt   文件: ScriptEditor.java
/**
 * Creates a new line number ruler column that is appropriately initialized.
 * 
 * @return the created line number column
 */
private CompositeRuler createCompositeRuler( )
{
	CompositeRuler ruler = new CompositeRuler( );

	ruler.setModel( new AnnotationModel( ) );
	return ruler;
}
 
源代码8 项目: birt   文件: ExpressionBuilder.java
/**
 * Creates a new line number ruler column that is appropriately initialized.
 * 
 * @return the created line number column
 */
private CompositeRuler createCompositeRuler( )
{
	CompositeRuler ruler = new CompositeRuler( );

	ruler.setModel( new AnnotationModel( ) );
	return ruler;
}
 
源代码9 项目: saros   文件: ContributionAnnotationManagerTest.java
@Before
public void setUp() {
  store = new PreferenceStore();
  store.setValue(EclipsePreferenceConstants.SHOW_CONTRIBUTION_ANNOTATIONS, true);
  createListenerMocks();

  manager = new ContributionAnnotationManager(sessionMock, store);
  model = new AnnotationModel();
}
 
源代码10 项目: xtext-eclipse   文件: AbstractSourceView.java
protected AnnotationModel createAnnotationModel() {
	return new AnnotationModel();
}
 
源代码11 项目: xtext-xtend   文件: DerivedSourceView.java
@Override
protected AnnotationModel createAnnotationModel() {
	IFile file = getSelectedFile();
	return file != null ? new ResourceMarkerAnnotationModel(file) : super.createAnnotationModel();
}
 
源代码12 项目: APICloud-Studio   文件: CommitCommentArea.java
public SourceViewerConfig(AnnotationModel annotationModel,
		Document document) {
	strategy = new CommentSpellingReconcileStrategy(annotationModel);
	strategy.setDocument(document);
}
 
源代码13 项目: APICloud-Studio   文件: CommitCommentArea.java
public CommentSpellingReconcileStrategy(AnnotationModel annotationModel) {
  this.fAnnotationModel = annotationModel;
  fSpellingContext = new SpellingContext();
  fSpellingContext.setContentType(Platform.getContentTypeManager().getContentType(IContentTypeManager.CT_TEXT));
}
 
public IAnnotationModel createAnnotationModel(IPath path) {
	IResource file= ResourcesPlugin.getWorkspace().getRoot().findMember(path);
	if (file instanceof IFile)
		return new CompilationUnitAnnotationModel(file);
	return new AnnotationModel();
}
 
源代码15 项目: saros   文件: ContributionAnnotationHistoryTest.java
@Before
public void setUp() {
  history = new ContributionAnnotationHistory(MAX_HISTORY_LENGTH);
  testModel = new AnnotationModel();
}
 
源代码16 项目: saros   文件: ContributionAnnotationHistoryTest.java
private List<ContributionAnnotation> createDummyAnnotation(final AnnotationModel model) {
  final User dummyUser = new User(new JID("[email protected]"), false, false, null);
  final ContributionAnnotation dummyAnnotation = new ContributionAnnotation(dummyUser, model);
  return Arrays.asList(dummyAnnotation);
}
 
源代码17 项目: saros   文件: ContributionAnnotationManagerTest.java
@Test
public void testHistoryRemovalWithMultipleModels() {
  final AnnotationModel model2 = new AnnotationModel();
  final AnnotationModel model3 = new AnnotationModel();
  final int numberOfInsertions = 5;

  // Fill history
  for (int i = 0; i < numberOfInsertions; i++) {
    manager.insertAnnotation(model2, i, 1, ALICE_TEST_USER);
  }

  for (int i = 0; i < numberOfInsertions; i++) {
    manager.insertAnnotation(model3, i, 1, ALICE_TEST_USER);
  }

  int offset = 0;
  final int remainingInsertions = MAX_HISTORY_LENGTH - 2 * numberOfInsertions;
  for (int i = 0; i < remainingInsertions; i++, offset++) {
    manager.insertAnnotation(model, offset, 1, ALICE_TEST_USER);
  }

  assertEquals(remainingInsertions, getAnnotationCount(model));
  assertEquals(numberOfInsertions, getAnnotationCount(model2));
  assertEquals(numberOfInsertions, getAnnotationCount(model3));

  for (int i = 0; i < numberOfInsertions; i++, offset++) {
    manager.insertAnnotation(model, offset, 1, ALICE_TEST_USER);
  }

  assertEquals(remainingInsertions + numberOfInsertions, getAnnotationCount(model));
  assertEquals(
      "Insertions in another model should lead to removing all annotations in the model",
      0,
      getAnnotationCount(model2));
  assertEquals(numberOfInsertions, getAnnotationCount(model3));

  for (int i = 0; i < numberOfInsertions; i++, offset++) {
    manager.insertAnnotation(model, offset, 1, ALICE_TEST_USER);
  }

  assertEquals(remainingInsertions + 2 * numberOfInsertions, getAnnotationCount(model));
  assertEquals(0, getAnnotationCount(model2));
  assertEquals(
      "Insertions in another model should lead to removing all annotations in the model",
      0,
      getAnnotationCount(model3));
}
 
 类所在包
 同包方法