@Override protected void startListening() { editor.addPropertyListener(listener); }
private void hookListener(IEditorPart lastActiveEditor, IEditorPart newActiveEditor) { if (lastActiveEditor!=null) { lastActiveEditor.removePropertyListener(editorListener); } if (newActiveEditor!=null) { newActiveEditor.addPropertyListener(editorListener); } }
public void setEditor(IEditorPart editor) { if (this.editor != null) { this.editor.removePropertyListener(editorPropertyListener); } this.editor = editor; if (this.editor != null) { this.editor.addPropertyListener(editorPropertyListener); } }
/** * Set the inner editors. * * Should not be called by clients. * * @param children * the inner editors of this multi editor * @noreference This method is not intended to be referenced by clients. */ public final void setChildren(IEditorPart[] children) { innerEditors = children; activeEditorIndex = 0; for (IEditorPart child : children) { child.addPropertyListener( (source, propId) -> handlePropertyChange(propId)); } innerEditorsCreated(); }
SWTUtils.workaroundResize(parent1); editor.createPartControl(parent1); editor.addPropertyListener(new IPropertyListener() { public void propertyChanged(Object source, int propertyId) { SashEditorPart.this.handlePropertyChange(propertyId);
parent2.setLayout(new FillLayout()); editor.createPartControl(parent2); editor.addPropertyListener((source, propertyId) -> MultiPageEditorPart.this.handlePropertyChange(propertyId));
void openEditor(final String fileName) { IWorkbench workbench = PlatformUI.getWorkbench(); IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); IWorkbenchPage page = window.getActivePage(); IEditorDescriptor desc = workbench.getEditorRegistry().getDefaultEditor("settings.xml"); //$NON-NLS-1$ IEditorInput input = new FileStoreEditorInput(EFS.getLocalFileSystem().fromLocalFile(new File(fileName))); try { final IEditorPart editor = IDE.openEditor(page, input, desc.getId()); if(editor == null) { //external editor was opened return; } editor.addPropertyListener(new IPropertyListener() { public void propertyChanged(Object source, int propId) { if(!editor.isDirty()) { log.info("Refreshing settings " + fileName); //$NON-NLS-1$ } } }); } catch(PartInitException ex) { log.error(ex.getMessage(), ex); } }
activeEditor.addPropertyListener(editorPropertyListener);