use of org.eclipse.ui.texteditor.IDocumentProvider in project bndtools by bndtools.
the class BndEditor method loadEditModel.
private void loadEditModel() throws Exception {
// Create the bnd edit model and workspace
Workspace ws = Central.getWorkspaceIfPresent();
Project bndProject = Run.createRun(ws, inputFile);
model.setWorkspace(bndProject.getWorkspace());
model.setProject(bndProject);
// Load content into the edit model
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
final IDocumentProvider docProvider = sourcePage.getDocumentProvider();
// #1625: Ensure the IDocumentProvider is not null.
if (docProvider != null) {
IDocument document = docProvider.getDocument(getEditorInput());
try {
model.loadFrom(new IDocumentWrapper(document));
model.setBndResource(inputFile);
} catch (IOException e) {
logger.logError("Unable to load edit model", e);
}
for (int i = 0; i < getPageCount(); i++) {
Control control = getControl(i);
if (control instanceof ScrolledForm) {
ScrolledForm form = (ScrolledForm) control;
if (SYNC_MESSAGE.equals(form.getMessage())) {
form.setMessage(null, IMessageProvider.NONE);
}
}
}
}
}
});
}
use of org.eclipse.ui.texteditor.IDocumentProvider in project bndtools by bndtools.
the class BndSourceEditorPage method getDocument.
private IDocument getDocument() {
IDocumentProvider docProvider = getDocumentProvider();
IEditorInput input = getEditorInput();
return new IDocumentWrapper(docProvider.getDocument(input));
}
use of org.eclipse.ui.texteditor.IDocumentProvider in project eclipse.platform.text by eclipse.
the class TextFileDocumentProvider method getContentType.
@Override
public IContentType getContentType(Object element) throws CoreException {
FileInfo info = fFileInfoMap.get(element);
if (info != null)
return info.fTextFileBuffer.getContentType();
IDocumentProvider parent = getParentProvider();
if (parent instanceof IDocumentProviderExtension4)
return ((IDocumentProviderExtension4) parent).getContentType(element);
return null;
}
use of org.eclipse.ui.texteditor.IDocumentProvider in project eclipse.platform.text by eclipse.
the class LastSaveReferenceProvider method setActiveEditor.
@Override
public void setActiveEditor(ITextEditor targetEditor) {
IDocumentProvider provider = null;
IEditorInput input = null;
if (targetEditor != null) {
provider = targetEditor.getDocumentProvider();
input = targetEditor.getEditorInput();
}
// note that they may serve multiple editors
if (provider != fDocumentProvider || input != fEditorInput) {
dispose();
synchronized (fLock) {
fEditor = targetEditor;
fDocumentProvider = provider;
fEditorInput = input;
}
}
}
use of org.eclipse.ui.texteditor.IDocumentProvider in project eclipse.platform.text by eclipse.
the class LastSaveReferenceProvider method dispose.
@Override
public void dispose() {
IProgressMonitor monitor = fProgressMonitor;
if (monitor != null) {
monitor.setCanceled(true);
}
IDocumentProvider provider = fDocumentProvider;
synchronized (fLock) {
if (provider != null)
provider.removeElementStateListener(this);
fEditorInput = null;
fDocumentProvider = null;
fReference = null;
fDocumentRead = false;
fProgressMonitor = null;
fEditor = null;
}
}
Aggregations