/* (non-Javadoc) * Method declared on ActiveEditorAction. */ @Override protected void editorActivated(IEditorPart part) { if (part != null) { part.addPropertyListener(propListener); partsWithListeners.add(part); } }
private void tryConnectTo(IWorkbenchPart part) { if (part instanceof IEditorPart) { IStructuredModel model = (IStructuredModel) part.getAdapter(IStructuredModel.class); if (part != swtXmlEditorPart && model != null && SwtXmlModelHandler.associatedContentTypeID.equals(model.getContentTypeIdentifier())) { connectTo(part); } else if (((IEditorPart) part).getEditorInput() instanceof FileEditorInput) { if (((FileEditorInput) (((IEditorPart) part).getEditorInput())) .getFile() .toString() .endsWith(".properties")) { propertiesFileEditorPart = (IEditorPart) part; propertiesFileEditorPart.addPropertyListener(updatePreviewOnSavePropertiesFile); } } } }
public void setActiveEditor(IEditorPart targetEditor) { super.setActiveEditor(targetEditor); workbench = targetEditor.getSite().getWorkbenchWindow().getActivePage(); workbench.addPartListener(this); targetEditor.addPropertyListener(this); }