org.eclipse.ui.texteditor.DocumentProviderRegistry Java Examples

The following examples show how to use org.eclipse.ui.texteditor.DocumentProviderRegistry. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DefaultMergeEditor.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected void doSetInput(IEditorInput input) throws CoreException {
	if (input != null) {
		setDocumentProvider(DocumentProviderRegistry.getDefault().getDocumentProvider(input));
	}
	super.doSetInput(input);
	inputSet = true;
}
 
Example #2
Source File: XtextDocumentUtil.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * @since 2.19
 */
public IXtextDocument getXtextDocument(IEditorInput editorInput) {
	IDocumentProvider documentProvider = DocumentProviderRegistry.getDefault().getDocumentProvider(editorInput);
	if (documentProvider == null) {
		return null;
	}
	IDocument document = documentProvider.getDocument(editorInput);
	if (document != null) {
		return getXtextDocument(document);
	}
	return null;
}
 
Example #3
Source File: ERDiagramElementStateListener.java    From ermasterr with Apache License 2.0 5 votes vote down vote up
public ERDiagramElementStateListener(final ERDiagramMultiPageEditor editorPart) {
    this.editorPart = editorPart;

    documentProvider = DocumentProviderRegistry.getDefault().getDocumentProvider(editorPart.getEditorInput());

    documentProvider.addElementStateListener(this);

    try {
        documentProvider.connect(editorPart.getEditorInput());
    } catch (final CoreException e) {
        ERDiagramActivator.showExceptionDialog(e);
    }
}
 
Example #4
Source File: ERDiagramElementStateListener.java    From erflute with Apache License 2.0 5 votes vote down vote up
public ERDiagramElementStateListener(ERFluteMultiPageEditor editorPart) {
    this.editorPart = editorPart;
    documentProvider = DocumentProviderRegistry.getDefault().getDocumentProvider(editorPart.getEditorInput());
    documentProvider.addElementStateListener(this);
    try {
        documentProvider.connect(editorPart.getEditorInput());
    } catch (final CoreException e) {
        Activator.showExceptionDialog(e);
    }
}
 
Example #5
Source File: AnnotationModelHelper.java    From saros with GNU General Public License v2.0 5 votes vote down vote up
public IAnnotationModel retrieveAnnotationModel(IEditorPart editorPart) {
  IEditorInput input = editorPart.getEditorInput();
  IDocumentProvider provider = DocumentProviderRegistry.getDefault().getDocumentProvider(input);
  IAnnotationModel model = provider.getAnnotationModel(input);

  return model;
}
 
Example #6
Source File: ERDiagramElementStateListener.java    From ermaster-b with Apache License 2.0 5 votes vote down vote up
public ERDiagramElementStateListener(ERDiagramMultiPageEditor editorPart) {
	this.editorPart = editorPart;

	documentProvider = DocumentProviderRegistry.getDefault()
			.getDocumentProvider(editorPart.getEditorInput());

	documentProvider.addElementStateListener(this);

	try {
		documentProvider.connect(editorPart.getEditorInput());
	} catch (CoreException e) {
		Activator.showExceptionDialog(e);
	}
}
 
Example #7
Source File: TestEditor.java    From ermasterr with Apache License 2.0 4 votes vote down vote up
protected void setDocumentProvider(final IEditorInput input) {
    fImplicitDocumentProvider = DocumentProviderRegistry.getDefault().getDocumentProvider(input);
}
 
Example #8
Source File: TestEditor.java    From ermaster-b with Apache License 2.0 4 votes vote down vote up
protected void setDocumentProvider(IEditorInput input) {
	fImplicitDocumentProvider = DocumentProviderRegistry.getDefault()
			.getDocumentProvider(input);
}
 
Example #9
Source File: EditorAPI.java    From saros with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns the {@link IDocumentProvider} of the given {@link IEditorInput}. This method analyzes
 * the file extension of the {@link IFile} associated with the given {@link IEditorInput}.
 * Depending on the file extension it returns file-types responsible {@link IDocumentProvider}.
 *
 * @param input the {@link IEditorInput} for which {@link IDocumentProvider} is needed
 * @return IDocumentProvider of the given input
 */
public static IDocumentProvider getDocumentProvider(final IEditorInput input) {
  return DocumentProviderRegistry.getDefault().getDocumentProvider(input);
}