コード例 #1
0
 /* (non-Javadoc)
  * Method declared on ActiveEditorAction.
  */
 @Override
 protected void editorActivated(IEditorPart part) {
   if (part != null) {
     part.addPropertyListener(propListener);
     partsWithListeners.add(part);
   }
 }
コード例 #2
0
ファイル: PreviewViewPart.java プロジェクト: ralfebert/swtxml
 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);
       }
     }
   }
 }
コード例 #3
0
 public void setActiveEditor(IEditorPart targetEditor) {
   super.setActiveEditor(targetEditor);
   workbench = targetEditor.getSite().getWorkbenchWindow().getActivePage();
   workbench.addPartListener(this);
   targetEditor.addPropertyListener(this);
 }