Java 类com.intellij.util.ui.AdjustComponentWhenShown 实例源码

项目:tools-idea    文件:SelectRepositoryAndShowLogAction.java   
private MyDialog(Project project, final List<VirtualFile> virtualFiles) {
  super(project, true);
  myProject = project;
  myVirtualFiles = virtualFiles;
  myGitLog = new LogFactoryService(myProject, ServiceManager.getService(GitCommitsSequentially.class)).createComponent(false);
  myGitLog.rootsChanged(myVirtualFiles);
  Disposer.register(getDisposable(), myGitLog);
  new AdjustComponentWhenShown() {
    @Override
    protected boolean init() {
      myGitLog.setModalityState(ModalityState.current());
      return true;
    }
  }.install(myGitLog.getVisualComponent());
  setTitle("Git Log");
  init();
}
项目:intellij-ce-playground    文件:ChangesBrowserDialog.java   
private void initDialog(final Project project, final CommittedChangesTableModel changes, final Mode mode) {
  myProject = project;
  myChanges = changes;
  myMode = mode;
  setTitle(VcsBundle.message("dialog.title.changes.browser"));
  setCancelButtonText(CommonBundle.getCloseButtonText());
  final ModalityState currentState = ModalityState.current();
  if ((mode != Mode.Choose) && (ModalityState.NON_MODAL.equals(currentState))) {
    setModal(false);
  }
  myAppender = new AsynchConsumer<List<CommittedChangeList>>() {

    public void finished() {
      SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
          if (ChangesBrowserDialog.this.isShowing()) {
            myCommittedChangesBrowser.stopLoading();
          }
        }
      });
    }

    public void consume(final List<CommittedChangeList> committedChangeLists) {
      SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
          if (ChangesBrowserDialog.this.isShowing()) {
            final boolean selectFirst = (myChanges.getRowCount() == 0) && (!committedChangeLists.isEmpty());
            myChanges.addRows(committedChangeLists);
            if (selectFirst) {
              myCommittedChangesBrowser.selectFirstIfAny();
            }
          }
        }
      });
    }
  };

  init();

  if (myInitRunnable != null) {
    new AdjustComponentWhenShown() {
      @Override
      protected boolean init() {
        myInitRunnable.consume(ChangesBrowserDialog.this);
        return true;
      }
    }.install(myCommittedChangesBrowser);
  }
}
项目:tools-idea    文件:ChangesBrowserDialog.java   
private void initDialog(final Project project, final CommittedChangesTableModel changes, final Mode mode) {
  myProject = project;
  myChanges = changes;
  myMode = mode;
  setTitle(VcsBundle.message("dialog.title.changes.browser"));
  setCancelButtonText(CommonBundle.getCloseButtonText());
  final ModalityState currentState = ModalityState.current();
  if ((mode != Mode.Choose) && (ModalityState.NON_MODAL.equals(currentState))) {
    setModal(false);
  }
  myAppender = new AsynchConsumer<List<CommittedChangeList>>() {

    public void finished() {
      SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
          if (ChangesBrowserDialog.this.isShowing()) {
            myCommittedChangesBrowser.stopLoading();
          }
        }
      });
    }

    public void consume(final List<CommittedChangeList> committedChangeLists) {
      SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
          if (ChangesBrowserDialog.this.isShowing()) {
            final boolean selectFirst = (myChanges.getRowCount() == 0) && (!committedChangeLists.isEmpty());
            myChanges.addRows(committedChangeLists);
            if (selectFirst) {
              myCommittedChangesBrowser.selectFirstIfAny();
            }
          }
        }
      });
    }
  };

  init();

  if (myInitRunnable != null) {
    new AdjustComponentWhenShown() {
      @Override
      protected boolean init() {
        myInitRunnable.consume(ChangesBrowserDialog.this);
        return true;
      }
    }.install(myCommittedChangesBrowser);
  }
}
项目:consulo    文件:ChangesBrowserDialog.java   
private void initDialog(final Project project, final CommittedChangesTableModel changes, final Mode mode) {
  myProject = project;
  myChanges = changes;
  myMode = mode;
  setTitle(VcsBundle.message("dialog.title.changes.browser"));
  setCancelButtonText(CommonBundle.getCloseButtonText());
  final ModalityState currentState = ModalityState.current();
  if ((mode != Mode.Choose) && (ModalityState.NON_MODAL.equals(currentState))) {
    setModal(false);
  }
  myAppender = new AsynchConsumer<List<CommittedChangeList>>() {

    public void finished() {
      SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
          if (ChangesBrowserDialog.this.isShowing()) {
            myCommittedChangesBrowser.stopLoading();
          }
        }
      });
    }

    public void consume(final List<CommittedChangeList> committedChangeLists) {
      SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
          if (ChangesBrowserDialog.this.isShowing()) {
            final boolean selectFirst = (myChanges.getRowCount() == 0) && (!committedChangeLists.isEmpty());
            myChanges.addRows(committedChangeLists);
            if (selectFirst) {
              myCommittedChangesBrowser.selectFirstIfAny();
            }
          }
        }
      });
    }
  };

  init();

  if (myInitRunnable != null) {
    new AdjustComponentWhenShown() {
      @Override
      protected boolean init() {
        myInitRunnable.consume(ChangesBrowserDialog.this);
        return true;
      }
    }.install(myCommittedChangesBrowser);
  }
}