@Override
    public void selectionChanged(@NotNull FileEditorManagerEvent event) {
      final FileEditor newFileEditor = event.getNewEditor();
      Editor mxmlEditor = null;
      if (newFileEditor instanceof TextEditor) {
        final Editor editor = ((TextEditor) newFileEditor).getEditor();
        if (DesignerApplicationManager.dumbAwareIsApplicable(
            project, PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument()))) {
          mxmlEditor = editor;
        }
      }

      if (mxmlEditor == null) {
        processFileEditorChange(null);
        return;
      }

      final DumbService dumbService = DumbService.getInstance(project);
      if (dumbService.isDumb()) {
        openWhenSmart(dumbService);
      } else {
        if (!isApplicableEditor(mxmlEditor)) {
          mxmlEditor = null;
        }

        processFileEditorChange(mxmlEditor);
      }
    }
  private void onSelectionChanged(@NotNull FileEditorManagerEvent event) {
    // Ignore events which don't target current editor.
    FileEditor oldEditor = event.getOldEditor();
    FileEditor newEditor = event.getNewEditor();
    if (oldEditor != this && newEditor != this) {
      return;
    }

    // We want to sync selected property key on selection change.
    if (newEditor == this) {
      if (oldEditor instanceof TextEditor) {
        setStructureViewSelectionFromPropertiesFile(((TextEditor) oldEditor).getEditor());
      }
    } else if (newEditor instanceof TextEditor) {
      setPropertiesFileSelectionFromStructureView(((TextEditor) newEditor).getEditor());
    }
  }
 @Override
 public void selectionChanged(@NotNull FileEditorManagerEvent event) {
   final FileEditor newEditor = event.getNewEditor();
   TextEditor layoutXmlEditor = null;
   if (newEditor instanceof TextEditor) {
     final TextEditor textEditor = (TextEditor) newEditor;
     if (isApplicableEditor(textEditor)) {
       layoutXmlEditor = textEditor;
     }
   }
   processFileEditorChange(layoutXmlEditor);
 }
Ejemplo n.º 4
0
 @Override
 public void selectionChanged(@NotNull FileEditorManagerEvent event) {
   if (ApplicationManager.getApplication().isUnitTestMode()) return;
   VirtualFile newFile = event.getNewFile();
   fileChanged(newFile);
 }