Java 类com.intellij.openapi.util.EmptyRunnable 实例源码

项目:intellij-ce-playground    文件:ProjectConfigurable.java   
private void createUIComponents() {
  myLanguageLevelCombo = new LanguageLevelCombo(JavaCoreBundle.message("default.language.level.description")) {
    @Override
    protected LanguageLevel getDefaultLevel() {
      Sdk sdk = myProjectJdkConfigurable.getSelectedProjectJdk();
      if (sdk == null) return null;
      JavaSdkVersion version = JavaSdk.getInstance().getVersion(sdk);
      return version == null ? null : version.getMaxLanguageLevel();
    }
  };
  final JTextField textField = new JTextField();
  final FileChooserDescriptor outputPathsChooserDescriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
  InsertPathAction.addTo(textField, outputPathsChooserDescriptor);
  outputPathsChooserDescriptor.setHideIgnored(false);
  BrowseFilesListener listener = new BrowseFilesListener(textField, "", ProjectBundle.message("project.compiler.output"), outputPathsChooserDescriptor);
  myProjectCompilerOutput = new FieldPanel(textField, null, null, listener, EmptyRunnable.getInstance());
  FileChooserFactory.getInstance().installFileCompletion(myProjectCompilerOutput.getTextField(), outputPathsChooserDescriptor, true, null);
}
项目:intellij-ce-playground    文件:TestRunnerUtil.java   
public static void replaceIdeEventQueueSafely() {
  if (Toolkit.getDefaultToolkit().getSystemEventQueue() instanceof IdeEventQueue) {
    return;
  }
  if (SwingUtilities.isEventDispatchThread()) {
    throw new RuntimeException("must not call under EDT");
  }
  AWTAutoShutdown.getInstance().notifyThreadBusy(Thread.currentThread());
  UIUtil.pump();
  // in JDK 1.6 java.awt.EventQueue.push() causes slow painful death of current EDT
  // so we have to wait through its agony to termination
  try {
    SwingUtilities.invokeAndWait(new Runnable() {
      @Override
      public void run() {
        IdeEventQueue.getInstance();
      }
    });
    SwingUtilities.invokeAndWait(EmptyRunnable.getInstance());
    SwingUtilities.invokeAndWait(EmptyRunnable.getInstance());
  }
  catch (Exception e) {
    throw new RuntimeException(e);
  }
}
项目:intellij-ce-playground    文件:ApplicationImplTest.java   
public void testWriteActionIsAllowedFromEDTOnly() throws InterruptedException {
  Thread thread = new Thread("test") {
    @Override
    public void run() {
      try {
        ApplicationManager.getApplication().runWriteAction(EmptyRunnable.getInstance());
      }
      catch (Throwable e) {
        exception = e;
      }
    }
  };
  thread.start();
  thread.join();
  assertNotNull(exception);
}
项目:intellij-ce-playground    文件:CoreCommandProcessor.java   
@Override
@Nullable
public Object startCommand(final Project project,
                           @Nls final String name,
                           final Object groupId,
                           final UndoConfirmationPolicy undoConfirmationPolicy) {
  ApplicationManager.getApplication().assertIsDispatchThread();
  if (project != null && project.isDisposed()) return null;

  if (CommandLog.LOG.isDebugEnabled()) {
    CommandLog.LOG.debug("startCommand: name = " + name + ", groupId = " + groupId);
  }

  if (myCurrentCommand != null) {
    return null;
  }

  Document document = groupId instanceof Ref && ((Ref)groupId).get() instanceof Document ? (Document)((Ref)groupId).get() : null;
  myCurrentCommand = new CommandDescriptor(EmptyRunnable.INSTANCE, project, name, groupId, undoConfirmationPolicy, document);
  fireCommandStarted();
  return myCurrentCommand;
}
项目:intellij-ce-playground    文件:VisiblePropertyTest.java   
@Test
public void testVisibleProperty() throws Exception {
  JLabel label = new JLabel();
  VisibleProperty visibleProperty = new VisibleProperty(label);
  CountListener listener = new CountListener();
  visibleProperty.addListener(listener);

  assertThat(visibleProperty.get()).isTrue();
  assertThat(listener.getCount()).isEqualTo(0);

  label.setVisible(false);
  // Swing enqueues the visibility changed event, so we need to wait for it
  SwingUtilities.invokeAndWait(EmptyRunnable.INSTANCE);
  assertThat(visibleProperty.get()).isFalse();
  assertThat(listener.getCount()).isEqualTo(1);

  visibleProperty.set(true);
  assertThat(label.isVisible()).isTrue();
  assertThat(listener.getCount()).isGreaterThan(1);
}
项目:intellij-ce-playground    文件:MavenProjectsProcessorArtifactsDownloadingTask.java   
public void perform(final Project project, MavenEmbeddersManager embeddersManager, MavenConsole console, MavenProgressIndicator indicator)
  throws MavenProcessCanceledException {
  MavenArtifactDownloader.DownloadResult result =
    myTree.downloadSourcesAndJavadocs(project, myProjects, myArtifacts, myDownloadSources, myDownloadDocs, embeddersManager, console, indicator);
  if (myCallbackResult != null) myCallbackResult.setDone(result);

  // todo: hack to update all file pointers.
  MavenUtil.invokeLater(project, new Runnable() {
    public void run() {
      AccessToken accessToken = WriteAction.start();
      try {
        ProjectRootManagerEx.getInstanceEx(project).makeRootsChange(EmptyRunnable.getInstance(), false, true);
      }
      finally {
        accessToken.finish();
      }
    }
  });
}
项目:tools-idea    文件:JavaAutoImportOptions.java   
public void apply() {
  CodeInsightSettings codeInsightSettings = CodeInsightSettings.getInstance();
  DaemonCodeAnalyzerSettings daemonSettings = DaemonCodeAnalyzerSettings.getInstance();

  codeInsightSettings.ADD_IMPORTS_ON_PASTE = getSmartPasteValue();
  codeInsightSettings.EXCLUDED_PACKAGES = getExcludedPackages();
  daemonSettings.setImportHintEnabled(myCbShowImportPopup.isSelected());
  codeInsightSettings.OPTIMIZE_IMPORTS_ON_THE_FLY = myCbOptimizeImports.isSelected();
  codeInsightSettings.ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY = myCbAddUnambiguousImports.isSelected();

  ApplicationManager.getApplication().runWriteAction(new Runnable() {
    public void run() {
      for (Project project : ProjectManager.getInstance().getOpenProjects()) {
        ProjectRootManagerEx.getInstanceEx(project).makeRootsChange(EmptyRunnable.getInstance(), false, true);
      }
    }
  });
}
项目:tools-idea    文件:CommandProcessorImpl.java   
@Override
@Nullable
public Object startCommand(final Project project,
                           @Nls final String name,
                           final Object groupId,
                           final UndoConfirmationPolicy undoConfirmationPolicy) {
  ApplicationManager.getApplication().assertIsDispatchThread();
  if (project != null && project.isDisposed()) return null;

  if (CommandLog.LOG.isDebugEnabled()) {
    CommandLog.LOG.debug("startCommand: name = " + name + ", groupId = " + groupId);
  }

  if (myCurrentCommand != null) {
    return null;
  }

  Document document = groupId instanceof Ref && ((Ref)groupId).get() instanceof Document ? (Document)((Ref)groupId).get() : null;
  myCurrentCommand = new CommandDescriptor(EmptyRunnable.INSTANCE, project, name, groupId, undoConfirmationPolicy, document);
  fireCommandStarted();
  return myCurrentCommand;
}
项目:tools-idea    文件:EnforcedPlainTextFileTypeManager.java   
private static void fireRootsChanged(final Collection<VirtualFile> files, final boolean isAdded) {
  ApplicationManager.getApplication().runWriteAction(new Runnable() {
    @Override
    public void run() {
      for (Project project : ProjectManager.getInstance().getOpenProjects()) {
        ProjectRootManagerEx.getInstanceEx(project).makeRootsChange(EmptyRunnable.getInstance(), false, true);
        ProjectPlainTextFileTypeManager projectPlainTextFileTypeManager = ProjectPlainTextFileTypeManager.getInstance(project);
        for (VirtualFile file : files) {
          if (projectPlainTextFileTypeManager.hasProjectContaining(file)) {
            if (isAdded) {
              projectPlainTextFileTypeManager.addFile(file);
            }
            else {
              projectPlainTextFileTypeManager.removeFile(file);
            }
          }
        }
      }
    }
  });
}
项目:tools-idea    文件:MavenProjectsProcessorArtifactsDownloadingTask.java   
public void perform(final Project project, MavenEmbeddersManager embeddersManager, MavenConsole console, MavenProgressIndicator indicator)
  throws MavenProcessCanceledException {
  MavenArtifactDownloader.DownloadResult result =
    myTree.downloadSourcesAndJavadocs(project, myProjects, myArtifacts, myDownloadSources, myDownloadDocs, embeddersManager, console, indicator);
  if (myCallbackResult != null) myCallbackResult.setDone(result);

  // todo: hack to update all file pointers.
  MavenUtil.invokeLater(project, new Runnable() {
    public void run() {
      AccessToken accessToken = WriteAction.start();
      try {
        ProjectRootManagerEx.getInstanceEx(project).makeRootsChange(EmptyRunnable.getInstance(), false, true);
      }
      finally {
        accessToken.finish();
      }
    }
  });
}
项目:tools-idea    文件:GitLogPerformanceTest.java   
private void impl(RootsHolder rootsHolder, GitLogFilters filters) {
  final GitCommitsSequentialIndex commitsSequentially = new GitCommitsSequentialIndex();
  final MediatorImpl mediator = new MediatorImpl(myProject, commitsSequentially);
  final LoadController controller = new LoadController(myProject, mediator, null, commitsSequentially);

  mediator.setLoader(controller);
  final BigTableTableModel tableModel = new BigTableTableModel(Collections.<ColumnInfo>emptyList(), EmptyRunnable.getInstance());
  mediator.setTableModel(tableModel);
  tableModel.setRootsHolder(rootsHolder);
  final Semaphore semaphore = new Semaphore();
  final MyUIRefresh refresh = new MyUIRefresh(semaphore);
  mediator.setUIRefresh(refresh);

  final long start = System.currentTimeMillis();
  semaphore.down();
  mediator.reload(rootsHolder, Collections.<String>emptyList(), Collections.<String>emptyList(), filters, true);
  semaphore.waitFor(300000);
  refresh.assertMe();
  final long end = System.currentTimeMillis();
  System.out.println("Time: " + (end - start));
}
项目:consulo-haxe    文件:HaxeImportOptimizer.java   
@NotNull
@Override
public Runnable processFile(final PsiFile file)
{
    VirtualFile vFile = file.getVirtualFile();
    if(vFile instanceof VirtualFileWindow)
    {
        vFile = ((VirtualFileWindow) vFile).getDelegate();
    }
    if(vFile == null || !ProjectRootManager.getInstance(file.getProject()).getFileIndex().isInSourceContent(vFile))
    {
        return EmptyRunnable.INSTANCE;
    }

    return new Runnable()
    {
        @Override
        public void run()
        {
            optimizeImports(file);
        }
    };
}
项目:consulo    文件:ProgressWindow.java   
@Override
public synchronized void stop() {
  LOG.assertTrue(!myStoppedAlready);

  super.stop();

  UIUtil.invokeLaterIfNeeded(() -> {
    boolean wasShowing = isDialogShowing();
    if (myDialog != null) {
      myDialog.hide();
    }

    synchronized (this) {
      myStoppedAlready = true;
    }

    Disposer.dispose(this);
  });

  SwingUtilities.invokeLater(EmptyRunnable.INSTANCE); // Just to give blocking dispatching a chance to go out.
}
项目:consulo    文件:CoreCommandProcessor.java   
@Override
@Nullable
public Object startCommand(@Nonnull final Project project,
                           @Nls final String name,
                           final Object groupId,
                           @Nonnull final UndoConfirmationPolicy undoConfirmationPolicy) {
  ApplicationManager.getApplication().assertIsDispatchThread();
  if (project.isDisposed()) return null;

  if (CommandLog.LOG.isDebugEnabled()) {
    CommandLog.LOG.debug("startCommand: name = " + name + ", groupId = " + groupId);
  }

  if (myCurrentCommand != null) {
    return null;
  }

  Document document = groupId instanceof Ref && ((Ref)groupId).get() instanceof Document ? (Document)((Ref)groupId).get() : null;
  myCurrentCommand = new CommandDescriptor(EmptyRunnable.INSTANCE, project, name, groupId, undoConfirmationPolicy, true, document);
  fireCommandStarted();
  return myCurrentCommand;
}
项目:consulo    文件:EnforcedPlainTextFileTypeManager.java   
private static void fireRootsChanged(final Collection<VirtualFile> files, final boolean isAdded) {
  ApplicationManager.getApplication().runWriteAction(new Runnable() {
    @Override
    public void run() {
      for (Project project : ProjectManager.getInstance().getOpenProjects()) {
        ProjectRootManagerEx.getInstanceEx(project).makeRootsChange(EmptyRunnable.getInstance(), false, true);
        ProjectPlainTextFileTypeManager projectPlainTextFileTypeManager = ProjectPlainTextFileTypeManager.getInstance(project);
        for (VirtualFile file : files) {
          if (projectPlainTextFileTypeManager.hasProjectContaining(file)) {
            if (isAdded) {
              projectPlainTextFileTypeManager.addFile(file);
            }
            else {
              projectPlainTextFileTypeManager.removeFile(file);
            }
          }
        }
      }
    }
  });
}
项目:intellij-ce-playground    文件:TimingLog.java   
public static Runnable startActivity(final String name) {
  if (!LOG.isDebugEnabled()) {
    return EmptyRunnable.INSTANCE;
  }
  final long start = System.currentTimeMillis();
  return new Runnable() {
    @Override
    public void run() {
      LOG.debug(name + " in " + (System.currentTimeMillis() - start) + "ms");
    }
  };
}
项目:intellij-ce-playground    文件:Extractor.java   
@Override
public void dispose() {
  // wait until all our submitted tasks are executed
  try {
    myExecutor.submit(EmptyRunnable.getInstance()).get();
  }
  catch (Exception ignored) {
  }
}
项目:intellij-ce-playground    文件:IdeaProjectModelModifier.java   
@Override
public Promise<Void> changeLanguageLevel(@NotNull Module module, @NotNull LanguageLevel level) {
  final LanguageLevel moduleLevel = LanguageLevelModuleExtensionImpl.getInstance(module).getLanguageLevel();
  if (moduleLevel != null && JavaSdkUtil.isLanguageLevelAcceptable(myProject, module, level)) {
    final ModifiableRootModel rootModel = ModuleRootManager.getInstance(module).getModifiableModel();
    rootModel.getModuleExtension(LanguageLevelModuleExtension.class).setLanguageLevel(level);
    rootModel.commit();
  }
  else {
    LanguageLevelProjectExtension.getInstance(myProject).setLanguageLevel(level);
    ProjectRootManagerEx.getInstanceEx(myProject).makeRootsChange(EmptyRunnable.INSTANCE, false, true);
  }
  return Promise.DONE;
}
项目:intellij-ce-playground    文件:DirectoryIndexTest.java   
private void fireRootsChanged() {
  ApplicationManager.getApplication().runWriteAction(new Runnable() {
    @Override
    public void run() {
      ProjectRootManagerEx.getInstanceEx(getProject()).makeRootsChange(EmptyRunnable.getInstance(), false, true);
    }
  });
}
项目:intellij-ce-playground    文件:CodeFragmentsTest.java   
public void testDontRecreateFragmentPsi() {
  PsiExpressionCodeFragment fragment = JavaCodeFragmentFactory.getInstance(myProject).createExpressionCodeFragment("a", null, null, true);
  VirtualFile file = fragment.getViewProvider().getVirtualFile();
  assertInstanceOf(file, LightVirtualFile.class);

  ProjectRootManagerEx.getInstanceEx(getProject()).makeRootsChange(EmptyRunnable.getInstance(), false, true);

  assertSame(fragment, PsiManager.getInstance(myProject).findFile(file));
  assertTrue(fragment.isValid());
}
项目:intellij-ce-playground    文件:PutSourceItemIntoParentAndLinkViaManifestAction.java   
@Override
public void actionPerformed(AnActionEvent e) {
  final List<PackagingSourceItem> items = mySourceItemsTree.getSelectedItems();
  ParentElementsInfo parentsInfo = findParentAndGrandParent(myArtifactEditor.getArtifact());
  if (parentsInfo == null) {
    return;
  }

  final Artifact artifact = parentsInfo.getGrandparentArtifact();
  final ArtifactEditorContext context = myArtifactEditor.getContext();
  //todo[nik] improve
  final Runnable emptyRunnable = EmptyRunnable.getInstance();
  context.editLayout(artifact, emptyRunnable);
  context.editLayout(parentsInfo.getParentArtifact(), emptyRunnable);
  parentsInfo = findParentAndGrandParent(myArtifactEditor.getArtifact());//find elements under modifiable root
  if (parentsInfo == null) {
    return;
  }

  final CompositePackagingElement<?> grandParent = parentsInfo.getGrandparentElement();
  final List<String> classpath = new ArrayList<String>();
  context.editLayout(artifact, new Runnable() {
    @Override
    public void run() {
      for (PackagingSourceItem item : items) {
        final List<? extends PackagingElement<?>> elements = item.createElements(context);
        grandParent.addOrFindChildren(elements);
        classpath.addAll(ManifestFileUtil.getClasspathForElements(elements, context, artifact.getArtifactType()));
      }
    }
  });

  final ArtifactEditor parentArtifactEditor = context.getOrCreateEditor(parentsInfo.getParentArtifact());
  parentArtifactEditor.addToClasspath(parentsInfo.getParentElement(), classpath);
  ((ArtifactEditorImpl)context.getOrCreateEditor(parentsInfo.getGrandparentArtifact())).rebuildTries();
}
项目:intellij-ce-playground    文件:ProjectRootManagerImpl.java   
@Override
public void rootSetChanged(final RootProvider wrapper) {
  if (myInsideRootsChange) return;
  myInsideRootsChange = true;
  try {
    makeRootsChange(EmptyRunnable.INSTANCE, false, true);
  }
  finally {
    myInsideRootsChange = false;
  }
}
项目:intellij-ce-playground    文件:GraphTableModel.java   
@NotNull
@Override
public final Object getValueAt(int rowIndex, int columnIndex) {
  if (rowIndex >= getRowCount() - 1 && canRequestMore()) {
    requestToLoadMore(EmptyRunnable.INSTANCE);
  }

  VcsShortCommitDetails data = getShortDetails(rowIndex);
  switch (columnIndex) {
    case ROOT_COLUMN:
      return getRoot(rowIndex);
    case COMMIT_COLUMN:
      return getCommitColumnCell(rowIndex, data);
    case AUTHOR_COLUMN:
      if (data == null) {
        return "";
      }
      else {
        String authorString = data.getAuthor().getName();
        if (authorString.isEmpty()) authorString = data.getAuthor().getEmail();
        return authorString + (data.getAuthor().equals(data.getCommitter()) ? "" : "*");
      }
    case DATE_COLUMN:
      if (data == null || data.getAuthorTime() < 0) {
        return "";
      }
      else {
        return DateFormatUtil.formatDateTime(data.getAuthorTime());
      }
    default:
      throw new IllegalArgumentException("columnIndex is " + columnIndex + " > " + (COLUMN_COUNT - 1));
  }
}
项目:intellij-ce-playground    文件:LightPlatformTestCase.java   
@Override
public final void runBare() throws Throwable {
  if (!shouldRunTest()) {
    return;
  }

  TestRunnerUtil.replaceIdeEventQueueSafely();
  EdtTestUtil.runInEdtAndWait(new ThrowableRunnable<Throwable>() {
    @Override
    public void run() throws Throwable {
      try {
        ourTestThread = Thread.currentThread();
        startRunAndTear();
      }
      finally {
        ourTestThread = null;
        try {
          Application application = ApplicationManager.getApplication();
          if (application instanceof ApplicationEx) {
            PlatformTestCase.cleanupApplicationCaches(ourProject);
          }
          resetAllFields();
        }
        catch (Throwable e) {
          e.printStackTrace();
        }
      }
    }
  });

  // just to make sure all deferred Runnables to finish
  SwingUtilities.invokeAndWait(EmptyRunnable.getInstance());

  if (IdeaLogger.ourErrorsOccurred != null) {
    throw IdeaLogger.ourErrorsOccurred;
  }
}
项目:intellij-ce-playground    文件:ProgressWindow.java   
@Override
public synchronized void stop() {
  LOG.assertTrue(!myStoppedAlready);

  super.stop();

  if (isDialogShowing()) {
    if (myFocusTrackback != null) {
      myFocusTrackback.setWillBeSheduledForRestore();
    }
  }

  UIUtil.invokeLaterIfNeeded(new Runnable() {
    @Override
    public void run() {
      boolean wasShowing = isDialogShowing();
      if (myDialog != null) {
        myDialog.hide();
      }

      if (myFocusTrackback != null) {
        if (wasShowing) {
          myFocusTrackback.restoreFocus();
        }
        else {
          myFocusTrackback.consume();
        }
      }

      synchronized (ProgressWindow.this) {
        myStoppedAlready = true;
      }

      Disposer.dispose(ProgressWindow.this);
    }
  });

  SwingUtilities.invokeLater(EmptyRunnable.INSTANCE); // Just to give blocking dispatching a chance to go out.
}
项目:intellij-ce-playground    文件:CustomizeDesktopEntryStep.java   
public CustomizeDesktopEntryStep(String iconPath) {
  setLayout(new BorderLayout());

  JPanel panel = createBigButtonPanel(createSmallBorderLayout(), myCreateEntryCheckBox, EmptyRunnable.INSTANCE);
  panel.setBorder(createSmallEmptyBorder());

  JPanel buttonPanel = new JPanel(new GridBagLayout());
  buttonPanel.setOpaque(false);

  GridBag gbc =
    new GridBag().setDefaultAnchor(GridBagConstraints.WEST).setDefaultFill(GridBagConstraints.HORIZONTAL).setDefaultWeightX(1);

  myCreateEntryCheckBox.setOpaque(false);
  buttonPanel.add(myCreateEntryCheckBox, gbc.nextLine());

  myGlobalEntryCheckBox.setOpaque(false);
  gbc.nextLine().insets.left = UIUtil.PANEL_REGULAR_INSETS.left;
  buttonPanel.add(myGlobalEntryCheckBox, gbc);

  panel.add(buttonPanel, BorderLayout.NORTH);

  JLabel label = new JLabel(IconLoader.getIcon(iconPath));
  label.setVerticalAlignment(JLabel.TOP);
  panel.add(label, BorderLayout.CENTER);

  add(panel, BorderLayout.CENTER);

  myCreateEntryCheckBox.addChangeListener(new ChangeListener() {
    @Override
    public void stateChanged(ChangeEvent e) {
      myGlobalEntryCheckBox.setEnabled(myCreateEntryCheckBox.isSelected());
      myGlobalEntryCheckBox.setSelected(myCreateEntryCheckBox.isSelected() && !PathManager.getHomePath().startsWith("/home"));
    }
  });

  myCreateEntryCheckBox.setSelected(true);
}
项目:intellij-ce-playground    文件:ApplicationImplTest.java   
public void testRunProcessWithProgressSynchronouslyInReadActionWithPendingWriteAction() throws Throwable {
  SwingUtilities.invokeLater(() -> ApplicationManager.getApplication().runWriteAction(EmptyRunnable.getInstance()));
  boolean result = ((ApplicationEx)ApplicationManager.getApplication())
    .runProcessWithProgressSynchronouslyInReadAction(getProject(), "title", true, "cancel", null, () -> TimeoutUtil.sleep(10000));
  assertTrue(result);
  UIUtil.dispatchAllInvocationEvents();
  if (exception != null) throw exception;
}
项目:intellij-ce-playground    文件:ProgressIndicatorTest.java   
public void testProgressPerformance() {
  PlatformTestUtil.startPerformanceTest("progress", 100, new ThrowableRunnable() {
    @Override
    public void run() throws Throwable {
      EmptyProgressIndicator indicator = new EmptyProgressIndicator();
      for (int i=0;i<100000;i++) {
        ProgressManager.getInstance().executeProcessUnderProgress(EmptyRunnable.getInstance(), indicator);
      }
    }
  }).assertTiming();
}
项目:intellij-ce-playground    文件:NewMappings.java   
public void activateActiveVcses() {
  synchronized (myLock) {
    if (myActivated) return;
    myActivated = true;
  }
  keepActiveVcs(EmptyRunnable.getInstance());
  mappingsChanged();
}
项目:intellij-ce-playground    文件:AbstractVcsTestCase.java   
protected void tearDownProject() throws Exception {
  if (myProject != null) {
    ((ChangeListManagerImpl)ChangeListManager.getInstance(myProject)).stopEveryThingIfInTestMode();
    CommittedChangesCache.getInstance(myProject).clearCaches(EmptyRunnable.INSTANCE);
    myProject = null;
  }
  if (myProjectFixture != null) {
    myProjectFixture.tearDown();
    myProjectFixture = null;
  }
}
项目:intellij-ce-playground    文件:OptimizeImportsProcessor.java   
private void retrieveAndStoreNotificationInfo(@NotNull Runnable runnable) {
  if (runnable instanceof ImportOptimizer.CollectingInfoRunnable) {
    String optimizerMessage = ((ImportOptimizer.CollectingInfoRunnable)runnable).getUserNotificationInfo();
    myOptimizerNotifications.add(optimizerMessage != null ? new NotificationInfo(optimizerMessage) : NOTHING_CHANGED_NOTIFICATION);
  }
  else if (runnable == EmptyRunnable.getInstance()) {
    myOptimizerNotifications.add(NOTHING_CHANGED_NOTIFICATION);
  }
  else {
    myOptimizerNotifications.add(SOMETHING_CHANGED_WITHOUT_MESSAGE_NOTIFICATION);
  }
}
项目:intellij    文件:PluginUtils.java   
/** Install and/or enable the given plugins. Does nothing for plugins already enabled. */
public static void installOrEnablePlugins(Set<String> pluginIds) {
  Set<String> toInstall = new HashSet<>();
  for (String id : pluginIds) {
    if (isPluginInstalled(id)) {
      PluginManager.enablePlugin(id);
    } else {
      toInstall.add(id);
    }
  }
  if (!toInstall.isEmpty()) {
    PluginsAdvertiser.installAndEnablePlugins(toInstall, EmptyRunnable.INSTANCE);
  }
}
项目:tools-idea    文件:TimingLog.java   
public static Runnable startActivity(final String name) {
  if (!LOG.isDebugEnabled()) {
    return EmptyRunnable.INSTANCE;
  }
  final long start = System.currentTimeMillis();
  return new Runnable() {
    @Override
    public void run() {
      LOG.debug(name + " in " + (System.currentTimeMillis() - start) + "ms");
    }
  };
}
项目:tools-idea    文件:PutSourceItemIntoParentAndLinkViaManifestAction.java   
@Override
public void actionPerformed(AnActionEvent e) {
  final List<PackagingSourceItem> items = mySourceItemsTree.getSelectedItems();
  ParentElementsInfo parentsInfo = findParentAndGrandParent(myArtifactEditor.getArtifact());
  if (parentsInfo == null) {
    return;
  }

  final Artifact artifact = parentsInfo.getGrandparentArtifact();
  final ArtifactEditorContext context = myArtifactEditor.getContext();
  //todo[nik] improve
  final Runnable emptyRunnable = EmptyRunnable.getInstance();
  context.editLayout(artifact, emptyRunnable);
  context.editLayout(parentsInfo.getParentArtifact(), emptyRunnable);
  parentsInfo = findParentAndGrandParent(myArtifactEditor.getArtifact());//find elements under modifiable root
  if (parentsInfo == null) {
    return;
  }

  final CompositePackagingElement<?> grandParent = parentsInfo.getGrandparentElement();
  final List<String> classpath = new ArrayList<String>();
  context.editLayout(artifact, new Runnable() {
    @Override
    public void run() {
      for (PackagingSourceItem item : items) {
        final List<? extends PackagingElement<?>> elements = item.createElements(context);
        grandParent.addOrFindChildren(elements);
        classpath.addAll(ManifestFileUtil.getClasspathForElements(elements, context, artifact.getArtifactType()));
      }
    }
  });

  final ArtifactEditor parentArtifactEditor = context.getOrCreateEditor(parentsInfo.getParentArtifact());
  parentArtifactEditor.addToClasspath(parentsInfo.getParentElement(), classpath);
  ((ArtifactEditorImpl)context.getOrCreateEditor(parentsInfo.getGrandparentArtifact())).rebuildTries();
}
项目:tools-idea    文件:ProjectConfigurable.java   
private void createUIComponents() {
  myLanguageLevelCombo = new LanguageLevelCombo();
  final JTextField textField = new JTextField();
  final FileChooserDescriptor outputPathsChooserDescriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
  InsertPathAction.addTo(textField, outputPathsChooserDescriptor);
  outputPathsChooserDescriptor.setHideIgnored(false);
  BrowseFilesListener listener = new BrowseFilesListener(textField, "", ProjectBundle.message("project.compiler.output"), outputPathsChooserDescriptor);
  myProjectCompilerOutput = new FieldPanel(textField, null, null, listener, EmptyRunnable.getInstance());
  FileChooserFactory.getInstance().installFileCompletion(myProjectCompilerOutput.getTextField(), outputPathsChooserDescriptor, true, null);
}
项目:tools-idea    文件:ProjectRootManagerImpl.java   
@Override
public void rootSetChanged(final RootProvider wrapper) {
  if (myInsideRootsChange) return;
  myInsideRootsChange = true;
  try {
    makeRootsChange(EmptyRunnable.INSTANCE, false, true);
  }
  finally {
    myInsideRootsChange = false;
  }
}
项目:tools-idea    文件:NewMappings.java   
public void activateActiveVcses() {
  synchronized (myLock) {
    if (myActivated) return;
    myActivated = true;
  }
  keepActiveVcs(EmptyRunnable.getInstance());
  mappingsChanged();
}
项目:tools-idea    文件:ProjectFileExclusionManagerImpl.java   
private static void fireRootsChange(final Project project) {
  ApplicationManager.getApplication().runWriteAction(new Runnable(){
    @Override
    public void run() {
      ProjectRootManagerEx.getInstanceEx(project).makeRootsChange(EmptyRunnable.getInstance(), false, true);
    }
  });
}
项目:tools-idea    文件:SkeletonBuilderTest.java   
public void testTwoReposStart() throws Exception {
  final BigTableTableModel model = new BigTableTableModel(Collections.<ColumnInfo>emptyList(), EmptyRunnable.getInstance());
  model.setCommitIdxInterval(2);
  model.setNumEventsInGroup(2);
  final VirtualFile[] arr = new VirtualFile[] {new MyVf(), new MyVf()};
  model.setRootsHolder(new RootsHolder(Arrays.asList(arr)));
  model.clear(true, true);

  final List<List<AbstractHash>> parentsOne = new ArrayList<List<AbstractHash>>();
  final List<List<AbstractHash>> parentsTwo = new ArrayList<List<AbstractHash>>();
  final List<CommitI> one = new ArrayList<CommitI>(2);
  final List<CommitI> two = new ArrayList<CommitI>(2);
  CommitI first = new MultipleRepositoryCommitDecorator(new Commit("1", 1, new Ref<Integer>(-1)), 0);
  one.add(first);

  CommitI second = new MultipleRepositoryCommitDecorator(new Commit("0", 2, new Ref<Integer>(-1)), 1);
  two.add(second);

  parentsOne.add(Collections.singletonList(AbstractHash.create("2")));

  parentsTwo.add(Collections.singletonList(AbstractHash.create("1")));

  model.setStrategy(new CommitGroupingStrategy() {
    @Override
    public String getGroupName(CommitI commit) {
      if ("1".equals(commit.getHash().toString())) return "Header 1";
      return "Header 2";
    }

    @Override
    public void beforeStart() {
    }
  });

  model.appendData(one, parentsOne);
  model.appendData(two, parentsTwo);
  System.out.println("2");
}
项目:intellij-haxe    文件:HaxeImportOptimizer.java   
@NotNull
@Override
public Runnable processFile(final PsiFile file) {
  VirtualFile vFile = file.getVirtualFile();
  if (vFile instanceof VirtualFileWindow) vFile = ((VirtualFileWindow)vFile).getDelegate();
  if (vFile == null || !ProjectRootManager.getInstance(file.getProject()).getFileIndex().isInSourceContent(vFile)) {
    return EmptyRunnable.INSTANCE;
  }

  return () -> optimizeImports(file);
}