Java Code Examples for org.eclipse.ui.texteditor.IDocumentProvider#addElementStateListener()
The following examples show how to use
org.eclipse.ui.texteditor.IDocumentProvider#addElementStateListener() .
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: TLAEditor.java From tlaplus with MIT License | 6 votes |
/** * Register the element state listener to react on the changes to the state (saved, dirty:=not saved) */ protected void setDocumentProvider(IEditorInput input) { super.setDocumentProvider(input); IDocumentProvider provider = getDocumentProvider(); if (provider != null) { provider.addElementStateListener(new ElementStateAdapter() { public void elementDirtyStateChanged(Object element, boolean isDirty) { if (isDirty) { contextService.deactivateContext(contextActivation); } else { contextActivation = contextService.activateContext("toolbox.contexts.cleaneditor"); } } }); } }
Example 2
Source File: PartEventListener.java From scava with Eclipse Public License 2.0 | 4 votes |
private void saveListener(ITextEditor textEditor) { IDocumentProvider provider = textEditor.getDocumentProvider(); IEditorInput input = textEditor.getEditorInput(); provider.addElementStateListener(new ResourceElementEventListener(input)); }
Example 3
Source File: DirtyStateListener.java From saros with GNU General Public License v2.0 | 3 votes |
public void register(IDocumentProvider documentProvider, IEditorInput input) { Set<IEditorInput> inputs = documentProviders.get(documentProvider); if (inputs == null) { inputs = new HashSet<IEditorInput>(); documentProviders.put(documentProvider, inputs); } if (inputs.contains(input)) return; if (inputs.size() == 0) documentProvider.addElementStateListener(this); inputs.add(input); }