Java 类com.intellij.openapi.project.DumbAwareRunnable 实例源码

项目:hybris-integration-intellij-idea-plugin    文件:HybrisProjectManagerListener.java   
@Override
public void projectOpened(final Project project) {
    StartupManager.getInstance(project).registerPostStartupActivity((DumbAwareRunnable) () -> {
        if (project.isDisposed()) {
            return;
        }
        if (isOldHybrisProject(project)) {
            showNotification(project);
        }
        if (isDiscountTargetGroup()) {
            showDiscountOffer(project);
        }
        final CommonIdeaService commonIdeaService = ServiceManager.getService(CommonIdeaService.class);
        if (!commonIdeaService.isHybrisProject(project)) {
            return;
        }
        if (popupPermissionToSendStatistics(project)) {
            continueOpening(project);
        }
    });
}
项目:educational-plugin    文件:PyStudyShowTutorial.java   
@Override
public void projectOpened() {
  ApplicationManager.getApplication().invokeLater((DumbAwareRunnable)() -> ApplicationManager.getApplication().runWriteAction(
    (DumbAwareRunnable)() -> {
      if (PropertiesComponent.getInstance().getBoolean(ourShowPopup, true)) {
        final String content = "<html>If you'd like to learn more about PyCharm Edu, " +
                               "click <a href=\"https://www.jetbrains.com/pycharm-edu/quickstart/\">here</a> to watch a tutorial</html>";
        final Notification notification = new Notification("Watch Tutorials!", "", content, NotificationType.INFORMATION,
                                                           new NotificationListener.UrlOpeningListener(true));
        StartupManager.getInstance(myProject).registerPostStartupActivity(() -> Notifications.Bus.notify(notification));
        Balloon balloon = notification.getBalloon();
        if (balloon != null) {
          balloon.addListener(new JBPopupAdapter() {
            @Override
            public void onClosed(LightweightWindowEvent event) {
              notification.expire();
            }
          });
        }
        notification.whenExpired(() -> PropertiesComponent.getInstance().setValue(ourShowPopup, false, true));
      }
    }));
}
项目:mule-intellij-plugins    文件:MuleMavenModuleBuilder.java   
@Override
public void setupRootModel(ModifiableRootModel rootModel) throws ConfigurationException {
    super.setupRootModel(rootModel);

    addListener(new ModuleBuilderListener() {
        @Override
        public void moduleCreated(@NotNull Module module) {
            setMuleFramework(module);
        }
    });

    setMuleFacet(rootModel.getModule());

    final Project project = rootModel.getProject();
    final VirtualFile root = createAndGetContentEntry();
    rootModel.addContentEntry(root);

    //Check if this is a module and has parent
    final MavenId parentId = (this.getParentProject() != null ? this.getParentProject().getMavenId() : null);

    MavenUtil.runWhenInitialized(project, (DumbAwareRunnable) () -> {
        new MuleMavenProjectBuilderHelper().configure(project, getProjectId(), muleVersion, root, parentId);
    });
}
项目:intellij-ce-playground    文件:LexerEditorHighlighter.java   
private void doSetText(final CharSequence text) {
  final TokenProcessor processor = createTokenProcessor(0);
  myLexer.start(text, 0, text.length(),myInitialState);
  mySegments.removeAll();
  int i = 0;
  while (true) {
    final IElementType tokenType = myLexer.getTokenType();
    if (tokenType == null) break;

    int data = packData(tokenType, myLexer.getState());
    processor.addToken(i, myLexer.getTokenStart(), myLexer.getTokenEnd(), data, tokenType);
    i++;
    myLexer.advance();
  }
  processor.finish();

  if(myEditor != null && !ApplicationManager.getApplication().isHeadlessEnvironment()) {
    UIUtil.invokeLaterIfNeeded(new DumbAwareRunnable() {
      @Override
      public void run() {
        myEditor.repaint(0, text.length());
      }
    });
  }
}
项目:intellij-ce-playground    文件:UiNotifyConnector.java   
public void hierarchyChanged(@NotNull HierarchyEvent e) {
  if (isDisposed()) return;

  if ((e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) > 0) {
    final Runnable runnable = new DumbAwareRunnable() {
      public void run() {
        final Component c = myComponent.get();
        if (isDisposed() || c == null) return;

        if (c.isShowing()) {
          showNotify();
        }
        else {
          hideNotify();
        }
      }
    };
    final Application app = ApplicationManager.getApplication();
    if (app != null && app.isDispatchThread()) {
      app.invokeLater(runnable, ModalityState.current());
    } else {
      //noinspection SSBasedInspection
      SwingUtilities.invokeLater(runnable);
    }
  }
}
项目:intellij-ce-playground    文件:ExternalDependenciesManagerImpl.java   
@Override
public void loadState(ExternalDependenciesState state) {
  ArrayList<ProjectExternalDependency> oldDependencies = new ArrayList<ProjectExternalDependency>(myDependencies);
  myDependencies.clear();
  for (DependencyOnPluginState dependency : state.myDependencies) {
    myDependencies.add(new DependencyOnPlugin(dependency.myId, dependency.myMinVersion, dependency.myMaxVersion));
  }
  if (!oldDependencies.equals(myDependencies) && !myDependencies.isEmpty()) {
    StartupManager.getInstance(myProject).runWhenProjectIsInitialized(new DumbAwareRunnable() {
      @Override
      public void run() {
        CheckRequiredPluginsActivity.runCheck(myProject);
      }
    });
  }
}
项目:intellij-ce-playground    文件:PlatformProjectOpenProcessor.java   
private static void openFileFromCommandLine(final Project project, final VirtualFile virtualFile, final int line) {
  StartupManager.getInstance(project).registerPostStartupActivity(new DumbAwareRunnable() {
    public void run() {
      ToolWindowManager.getInstance(project).invokeLater(new Runnable() {
        public void run() {
          ToolWindowManager.getInstance(project).invokeLater(new Runnable() {
            public void run() {
              if (!virtualFile.isDirectory()) {
                if (line > 0) {
                  new OpenFileDescriptor(project, virtualFile, line-1, 0).navigate(true);
                }
                else {
                  new OpenFileDescriptor(project, virtualFile).navigate(true);
                }
              }
            }
          });
        }
      });
    }
  });
}
项目:intellij-ce-playground    文件:ProjectImpl.java   
@Override
public void setProjectName(@NotNull String projectName) {
  if (!projectName.equals(myName)) {
    myOldName = myName;
    myName = projectName;
    StartupManager.getInstance(this).runWhenProjectIsInitialized(new DumbAwareRunnable() {
      @Override
      public void run() {
        if (isDisposed()) return;

        JFrame frame = WindowManager.getInstance().getFrame(ProjectImpl.this);
        String title = FrameTitleBuilder.getInstance().getProjectTitle(ProjectImpl.this);
        if (frame != null && title != null) {
          frame.setTitle(title);
        }
      }
    });
  }
}
项目:intellij-ce-playground    文件:WelcomeFrame.java   
static void setupCloseAction(final JFrame frame) {
  frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
  frame.addWindowListener(
    new WindowAdapter() {
      public void windowClosing(final WindowEvent e) {
        frame.dispose();

        final Application app = ApplicationManager.getApplication();
        app.invokeLater(new DumbAwareRunnable() {
          public void run() {
            if (app.isDisposed()) {
              ApplicationManagerEx.getApplicationEx().exit();
              return;
            }

            final Project[] openProjects = ProjectManager.getInstance().getOpenProjects();
            if (openProjects.length == 0) {
              ApplicationManagerEx.getApplicationEx().exit();
            }
          }
        }, ModalityState.NON_MODAL);
      }
    }
  );
}
项目:intellij-ce-playground    文件:FileStatusManagerImpl.java   
@Override
public void fileStatusesChanged() {
  if (myProject.isDisposed()) {
    return;
  }
  if (!ApplicationManager.getApplication().isDispatchThread()) {
    ApplicationManager.getApplication().invokeLater(new DumbAwareRunnable() {
      @Override
      public void run() {
        fileStatusesChanged();
      }
    }, ModalityState.NON_MODAL);
    return;
  }

  myCachedStatuses.clear();
  myWhetherExactlyParentToChanged.clear();

  for (FileStatusListener listener : myListeners) {
    listener.fileStatusesChanged();
  }
}
项目:intellij-ce-playground    文件:ModuleBuilder.java   
@NotNull
public Module createAndCommitIfNeeded(@NotNull Project project, @Nullable ModifiableModuleModel model, boolean runFromProjectWizard)
  throws InvalidDataException, ConfigurationException, IOException, JDOMException, ModuleWithNameAlreadyExists {
  final ModifiableModuleModel moduleModel = model != null ? model : ModuleManager.getInstance(project).getModifiableModel();
  final Module module = createModule(moduleModel);
  if (model == null) moduleModel.commit();

  if (runFromProjectWizard) {
    StartupManager.getInstance(module.getProject()).runWhenProjectIsInitialized(new DumbAwareRunnable() {
      @Override
      public void run() {
        ApplicationManager.getApplication().runWriteAction(new Runnable() {
          @Override
          public void run() {
            onModuleInitialized(module);
          }
        });
      }
    });
  }
  else {
    onModuleInitialized(module);
  }
  return module;
}
项目:intellij-ce-playground    文件:XLineBreakpointManager.java   
public void updateBreakpointsUI() {
  if (myProject.isDefault()) return;

  Runnable runnable = new DumbAwareRunnable() {
    @Override
    public void run() {
      for (XLineBreakpointImpl breakpoint : myBreakpoints.keySet()) {
        breakpoint.updateUI();
      }
    }
  };

  if (ApplicationManager.getApplication().isUnitTestMode() || myStartupManager.startupActivityPassed()) {
    runnable.run();
  }
  else {
    myStartupManager.registerPostStartupActivity(runnable);
  }
}
项目:intellij-ce-playground    文件:RestoreUpdateTree.java   
@Override
public void projectOpened() {
  StartupManager.getInstance(myProject).registerPostStartupActivity(new DumbAwareRunnable() {
    @Override
    public void run() {
      if (myUpdateInfo != null && !myUpdateInfo.isEmpty() && ProjectReloadState.getInstance(myProject).isAfterAutomaticReload()) {
        ActionInfo actionInfo = myUpdateInfo.getActionInfo();
        if (actionInfo != null) {
          ProjectLevelVcsManagerEx.getInstanceEx(myProject).showUpdateProjectInfo(myUpdateInfo.getFileInformation(),
                                                                                  VcsBundle.message("action.display.name.update"), actionInfo,
                                                                                  false);
          CommittedChangesCache.getInstance(myProject).refreshIncomingChangesAsync();
        }
      }
      myUpdateInfo = null;
    }
  });
}
项目:intellij-ce-playground    文件:VcsInitialization.java   
public VcsInitialization(@NotNull final Project project) {
  myLock = new Object();

  StartupManager.getInstance(project).registerPostStartupActivity(new DumbAwareRunnable() {
    @Override
    public void run() {
      if (project.isDisposed()) return;
      myFuture = ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
        @Override
        public void run() {
          if (!project.isDisposed()) {
            execute();
          }
        }
      });
    }
  });
}
项目:intellij-ce-playground    文件:ChangeListManagerImpl.java   
@Override
public void projectOpened() {
  initializeForNewProject();

  final ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(myProject);
  if (ApplicationManager.getApplication().isUnitTestMode()) {
    myUpdater.initialized();
    vcsManager.addVcsListener(myVcsListener);
  }
  else {
    ((ProjectLevelVcsManagerImpl)vcsManager).addInitializationRequest(
      VcsInitObject.CHANGE_LIST_MANAGER, new DumbAwareRunnable() {
        @Override
        public void run() {
          myUpdater.initialized();
          broadcastStateAfterLoad();
          vcsManager.addVcsListener(myVcsListener);
        }
      });

    myConflictTracker.startTracking();
  }
}
项目:intellij-ce-playground    文件:PlatformProjectViewOpener.java   
@Override
public void configureProject(final Project project, @NotNull final VirtualFile baseDir, Ref<Module> moduleRef) {
  StartupManager.getInstance(project).registerPostStartupActivity(new DumbAwareRunnable() {
    @Override
    public void run() {
      // ensure the dialog is shown after all startup activities are done
      SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
          ApplicationManager.getApplication().invokeLater(new Runnable() {
            @Override
            public void run() {
              if (project.isDisposed()) return;
              final ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.PROJECT_VIEW);
              if (toolWindow != null && toolWindow.getType() != ToolWindowType.SLIDING) {
                toolWindow.activate(null);
              }
            }
          }, ModalityState.NON_MODAL);
        }
      });
    }
  });
}
项目:intellij-ce-playground    文件:BookmarkManager.java   
@Override
public void loadState(final Element state) {
  StartupManager.getInstance(myProject).runWhenProjectIsInitialized(new DumbAwareRunnable() {
    @Override
    public void run() {
      BookmarksListener publisher = myBus.syncPublisher(BookmarksListener.TOPIC);
      for (Bookmark bookmark : myBookmarks) {
        bookmark.release();
        publisher.bookmarkRemoved(bookmark);
      }
      myBookmarks.clear();

      readExternal(state);
    }
  });
}
项目:intellij-ce-playground    文件:FavoritesManager.java   
@Override
public void projectOpened() {
  if (!ApplicationManager.getApplication().isUnitTestMode()) {
    StartupManager.getInstance(myProject).registerPostStartupActivity(new DumbAwareRunnable() {
      @Override
      public void run() {
        final FavoritesListProvider[] providers = Extensions.getExtensions(EP_NAME, myProject);
        for (FavoritesListProvider provider : providers) {
          myProviders.put(provider.getListName(myProject), provider);
        }
        final MyRootsChangeAdapter myPsiTreeChangeAdapter = new MyRootsChangeAdapter();

        PsiManager.getInstance(myProject).addPsiTreeChangeListener(myPsiTreeChangeAdapter, myProject);
        if (myName2FavoritesRoots.isEmpty()) {
          myDescriptions.put(myProject.getName(), "auto-added");
          createNewList(myProject.getName());
        }
      }
    });
  }
}
项目:intellij-ce-playground    文件:StudyProjectComponent.java   
@Override
public void projectOpened() {
  final Course course = StudyTaskManager.getInstance(myProject).getCourse();
  if (course != null && !course.isUpToDate()) {
    course.setUpToDate(true);
    updateCourse();
  }

  registerStudyToolwindow(course);
  ApplicationManager.getApplication().invokeLater(new DumbAwareRunnable() {
    @Override
    public void run() {
      ApplicationManager.getApplication().runWriteAction(new DumbAwareRunnable() {
        @Override
        public void run() {
          if (course != null) {
            moveFocusToEditor();
            UISettings.getInstance().HIDE_TOOL_STRIPES = false;
            UISettings.getInstance().fireUISettingsChanged();
            registerShortcuts();
          }
        }
      });
    }
  });
}
项目:intellij-ce-playground    文件:MavenProjectsManager.java   
private void doInit(final boolean isNew) {
  synchronized (isInitialized) {
    if (isInitialized.getAndSet(true)) return;

    initProjectsTree(!isNew);

    initWorkers();
    listenForSettingsChanges();
    listenForProjectsTreeChanges();

    MavenUtil.runWhenInitialized(myProject, new DumbAwareRunnable() {
      public void run() {
        if (!isUnitTestMode()) {
          fireActivated();
          listenForExternalChanges();
        }
        scheduleUpdateAllProjects(isNew);
      }
    });
  }
}
项目:intellij-ce-playground    文件:MavenProjectsManager.java   
private AsyncPromise<Void> doScheduleUpdateProjects(final Collection<MavenProject> projects,
                                                    final boolean forceUpdate,
                                                    final boolean forceImportAndResolve) {
  final AsyncPromise<Void> promise = new AsyncPromise<Void>();
  MavenUtil.runWhenInitialized(myProject, new DumbAwareRunnable() {
    public void run() {
      if (projects == null) {
        myWatcher.scheduleUpdateAll(forceUpdate, forceImportAndResolve).processed(promise);
      }
      else {
        myWatcher.scheduleUpdate(MavenUtil.collectFiles(projects),
                                 Collections.<VirtualFile>emptyList(),
                                 forceUpdate,
                                 forceImportAndResolve).processed(promise);
      }
    }
  });
  return promise;
}
项目:intellij-ce-playground    文件:MavenModuleBuilder.java   
public void setupRootModel(ModifiableRootModel rootModel) throws ConfigurationException {
  final Project project = rootModel.getProject();

  final VirtualFile root = createAndGetContentEntry();
  rootModel.addContentEntry(root);

  // todo this should be moved to generic ModuleBuilder
  if (myJdk != null){
    rootModel.setSdk(myJdk);
  } else {
    rootModel.inheritSdk();
  }

  MavenUtil.runWhenInitialized(project, new DumbAwareRunnable() {
    public void run() {
      if (myEnvironmentForm != null) {
        myEnvironmentForm.setData(MavenProjectsManager.getInstance(project).getGeneralSettings());
      }

      new MavenModuleBuilderHelper(myProjectId, myAggregatorProject, myParentProject, myInheritGroupId,
                                   myInheritVersion, myArchetype, myPropertiesToCreateByArtifact, "Create new Maven module").configure(project, root, false);
    }
  });
}
项目:intellij-ce-playground    文件:MvcModuleStructureSynchronizer.java   
public void queue(SyncAction action, Object on) {
  ApplicationManager.getApplication().assertIsDispatchThread();
  if (myProject.isDisposed()) return;

  boolean shouldSchedule;
  synchronized (myOrders) {
    shouldSchedule = myOrders.isEmpty();
    myOrders.add(Pair.create(on, action));
  }
  if (shouldSchedule) {
    StartupManager.getInstance(myProject).runWhenProjectIsInitialized(new DumbAwareRunnable() {
      @Override
      public void run() {
        scheduleRunActions();
      }
    });
  }
}
项目:aem-ide-tooling-4-intellij    文件:SlingMavenModuleBuilder.java   
public void setupRootModel(ModifiableRootModel rootModel) throws ConfigurationException {
    final Project project = rootModel.getProject();

    final VirtualFile root = createAndGetContentEntry();
    rootModel.addContentEntry(root);

    // todo this should be moved to generic ModuleBuilder
    if (myJdk != null){
        rootModel.setSdk(myJdk);
    } else {
        rootModel.inheritSdk();
    }

    MavenUtil.runWhenInitialized(
        project, new DumbAwareRunnable() {
        public void run() {
            if (myEnvironmentForm != null) {
                myEnvironmentForm.setData(MavenProjectsManager.getInstance(project).getGeneralSettings());
            }

            new MavenModuleBuilderHelper(myProjectId, myAggregatorProject, myParentProject, myInheritGroupId,
                myInheritVersion, archetypeTemplate.getMavenArchetype(), myPropertiesToCreateByArtifact, "Create new Sling Maven module").configure(project, root, false);
            }
        }
    );
}
项目:embeddedlinux-jvmdebugger-intellij    文件:RPiJavaModuleBuilder.java   
/**
 * Runs a new thread to create the required files
 *
 * @param rootModel
 * @param project
 */
private void createProjectFiles(@NotNull final ModifiableRootModel rootModel,@NotNull final Project project) {
    ProjectUtils.runWhenInitialized(project, new DumbAwareRunnable() {
        public void run() {
            String srcPath = project.getBasePath() + File.separator + "src";
            addJarFiles(rootModel.getModule());
            String[] directoriesToMake = packageName.split(Pattern.quote("."));
            for (String directory : directoriesToMake) {
                try {
                    VfsUtil.createDirectories(srcPath + FileUtilities.SEPARATOR + directory);
                } catch (IOException e) {

                }
                srcPath += FileUtilities.SEPARATOR + directory;
            }
            Template.builder().name(getMainClassTemplateName())
                    .classContext(this.getClass())
                    .outputFile(srcPath + FileUtilities.SEPARATOR + "Main.java")
                    .data(new HashMap<String, Object>() {{
                        put("packagename", packageName);
                    }}).build()
                    .toFile();
            ProjectUtils.addProjectConfiguration(rootModel.getModule(), packageName + ".Main", getPresentableName());
        }
    });
}
项目:plgin    文件:RefactoringTask.java   
private void refactor(ProgressIndicator indicator) throws IOException, ProcessCanceledException {
    indicator.setText("Import images");
    indicator.checkCanceled();
    indicator.setIndeterminate(false);
    for (int i = 0; i < imageInformationList.size(); i++) {
        ImageInformation information = imageInformationList.get(i);
        indicator.checkCanceled();
        RefactorHelper.exportTempImage(project, information);
        indicator.setFraction((float) (i + 1) / (float) imageInformationList.size());
    }

    UIUtil.invokeLaterIfNeeded(new DumbAwareRunnable() {
        public void run() {
            try {
                RefactorHelper.move(project, imageInformationList);
                LocalFileSystem.getInstance().refresh(true);
            } catch (IOException ignored) {
            }
        }
    });
}
项目:tools-idea    文件:UiNotifyConnector.java   
public void hierarchyChanged(HierarchyEvent e) {
  if (isDisposed()) return;

  if ((e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) > 0) {
    final Runnable runnable = new DumbAwareRunnable() {
      public void run() {
        final Component c = myComponent.get();
        if (isDisposed() || c == null) return;

        if (c.isShowing()) {
          showNotify();
        }
        else {
          hideNotify();
        }
      }
    };
    final Application app = ApplicationManager.getApplication();
    if (app != null && app.isDispatchThread()) {
      app.invokeLater(runnable, ModalityState.current());
    } else {
      //noinspection SSBasedInspection
      SwingUtilities.invokeLater(runnable);
    }
  }
}
项目:tools-idea    文件:PlatformProjectOpenProcessor.java   
private static void openFileFromCommandLine(final Project project, final VirtualFile virtualFile, final int line) {
  StartupManager.getInstance(project).registerPostStartupActivity(new DumbAwareRunnable() {
    public void run() {
      ToolWindowManager.getInstance(project).invokeLater(new Runnable() {
        public void run() {
          ToolWindowManager.getInstance(project).invokeLater(new Runnable() {
            public void run() {
              if (!virtualFile.isDirectory()) {
                if (line > 0) {
                  new OpenFileDescriptor(project, virtualFile, line-1, 0).navigate(true);
                }
                else {
                  new OpenFileDescriptor(project, virtualFile).navigate(true);
                }
              }
            }
          });
        }
      });
    }
  });
}
项目:tools-idea    文件:ProjectImpl.java   
@Override
public void setProjectName(@NotNull String projectName) {
  if (!projectName.equals(myName)) {
    myOldName = myName;
    myName = projectName;
    StartupManager.getInstance(this).runWhenProjectIsInitialized(new DumbAwareRunnable() {
      @Override
      public void run() {
        if (isDisposed()) return;

        JFrame frame = WindowManager.getInstance().getFrame(ProjectImpl.this);
        String title = FrameTitleBuilder.getInstance().getProjectTitle(ProjectImpl.this);
        if (frame != null && title != null) {
          frame.setTitle(title);
        }
      }
    });
  }
}
项目:tools-idea    文件:WelcomeFrame.java   
private void setupCloseAction() {
  setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
  addWindowListener(
    new WindowAdapter() {
      public void windowClosing(final WindowEvent e) {
        dispose();

        final Application app = ApplicationManager.getApplication();
        app.invokeLater(new DumbAwareRunnable() {
          public void run() {
            if (app.isDisposed()) {
              ApplicationManagerEx.getApplicationEx().exit();
              return;
            }

            final Project[] openProjects = ProjectManager.getInstance().getOpenProjects();
            if (openProjects.length == 0) {
              ApplicationManagerEx.getApplicationEx().exit();
            }
          }
        }, ModalityState.NON_MODAL);
      }
    }
  );
}
项目:tools-idea    文件:FileStatusManagerImpl.java   
public void fileStatusesChanged() {
  if (myProject.isDisposed()) {
    return;
  }
  if (!ApplicationManager.getApplication().isDispatchThread()) {
    ApplicationManager.getApplication().invokeLater(new DumbAwareRunnable() {
      public void run() {
        fileStatusesChanged();
      }
    }, ModalityState.NON_MODAL);
    return;
  }

  myCachedStatuses.clear();
  myWhetherExactlyParentToChanged.clear();

  for (FileStatusListener listener : myListeners) {
    listener.fileStatusesChanged();
  }
}
项目:tools-idea    文件:LexerEditorHighlighter.java   
private void doSetText(final CharSequence text) {
  final TokenProcessor processor = createTokenProcessor(0);
  myLexer.start(text, 0, text.length(),myInitialState);
  mySegments.removeAll();
  int i = 0;
  while (true) {
    final IElementType tokenType = myLexer.getTokenType();
    if (tokenType == null) break;

    int data = packData(tokenType, myLexer.getState());
    processor.addToken(i, myLexer.getTokenStart(), myLexer.getTokenEnd(), data, tokenType);
    i++;
    myLexer.advance();
  }
  processor.finish();

  if(myEditor != null && !ApplicationManager.getApplication().isHeadlessEnvironment()) {
    UIUtil.invokeLaterIfNeeded(new DumbAwareRunnable() {
      @Override
      public void run() {
        myEditor.repaint(0, text.length());
      }
    });
  }
}
项目:tools-idea    文件:EventLog.java   
private void printNotification(final Notification notification) {
  final EventLogConsole console = myConsole;
  if (console == null) {
    myInitial.add(notification);
    return;
  }

  if (!NotificationsConfigurationImpl.getSettings(notification.getGroupId()).isShouldLog()) {
    return;
  }

  myProjectModel.addNotification(notification);

  StartupManager.getInstance(myProject).runWhenProjectIsInitialized(new DumbAwareRunnable() {
    @Override
    public void run() {
      if (!ShutDownTracker.isShutdownHookRunning() && !myProject.isDisposed()) {
        ApplicationManager.getApplication().runReadAction(new Runnable() {
          public void run() {
            console.doPrintNotification(notification);
          }
        });
      }
    }
  });
}
项目:tools-idea    文件:ModuleBuilder.java   
@NotNull
public Module createAndCommitIfNeeded(@NotNull Project project, @Nullable ModifiableModuleModel model, boolean runFromProjectWizard)
  throws InvalidDataException, ConfigurationException, IOException, JDOMException, ModuleWithNameAlreadyExists {
  final ModifiableModuleModel moduleModel = model != null ? model : ModuleManager.getInstance(project).getModifiableModel();
  final Module module = createModule(moduleModel);
  if (model == null) moduleModel.commit();

  if (runFromProjectWizard) {
    StartupManager.getInstance(module.getProject()).runWhenProjectIsInitialized(new DumbAwareRunnable() {
      @Override
      public void run() {
        ApplicationManager.getApplication().runWriteAction(new Runnable() {
          @Override
          public void run() {
            onModuleInitialized(module);
          }
        });
      }
    });
  }
  else {
    onModuleInitialized(module);
  }
  return module;
}
项目:tools-idea    文件:RestoreUpdateTree.java   
public void projectOpened() {
  StartupManager.getInstance(myProject).registerPostStartupActivity(new DumbAwareRunnable() {
    public void run() {
      if (myUpdateInfo != null && !myUpdateInfo.isEmpty() && ProjectReloadState.getInstance(myProject).isAfterAutomaticReload()) {
        ActionInfo actionInfo = myUpdateInfo.getActionInfo();
        if (actionInfo != null) {
          ProjectLevelVcsManagerEx.getInstanceEx(myProject).showUpdateProjectInfo(myUpdateInfo.getFileInformation(),
                                                                                  VcsBundle.message("action.display.name.update"), actionInfo,
                                                                                  false);
          CommittedChangesCache.getInstance(myProject).refreshIncomingChangesAsync();
        }
        myUpdateInfo = null;
      }
      else {
        myUpdateInfo = null;
      }
    }
  });
}
项目:tools-idea    文件:VcsInitialization.java   
public VcsInitialization(final Project project) {
  myLock = new Object();
  myProject = project;
  myList = new LinkedList<Pair<VcsInitObject, Runnable>>();

  StartupManager.getInstance(myProject).registerPostStartupActivity(new DumbAwareRunnable() {
    public void run() {
      if (myProject.isDisposed()) return;
      ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
        @Override
        public void run() {
          if (!myProject.isDisposed()) {
            execute();
          }
        }
      });
    }
  });
}
项目:tools-idea    文件:ProjectLevelVcsManagerImpl.java   
public void projectOpened() {
  final StartupManager manager = StartupManager.getInstance(myProject);
  manager.registerPostStartupActivity(new DumbAwareRunnable() {
    public void run() {
      ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(myProject);
      if (toolWindowManager != null) { // Can be null in tests
        ToolWindow toolWindow =
          toolWindowManager.registerToolWindow(ToolWindowId.VCS, true, ToolWindowAnchor.BOTTOM, myProject, true);
        myContentManager = toolWindow.getContentManager();
        toolWindow.setIcon(AllIcons.Toolwindows.VcsSmallTab);
        toolWindow.installWatcher(myContentManager);
      } else {
        myContentManager = ContentFactory.SERVICE.getInstance().createContentManager(true, myProject);
      }
    }
  });
}
项目:tools-idea    文件:VcsDirtyScopeManagerImpl.java   
public void projectOpened() {
  if (ApplicationManager.getApplication().isUnitTestMode()) {
    myLife.born();
    final AbstractVcs[] vcss = myVcsManager.getAllActiveVcss();
    if (vcss.length > 0) {
      markEverythingDirty();
    }
  }
  else {
    StartupManager.getInstance(myProject).registerPostStartupActivity(new DumbAwareRunnable() {
      public void run() {
        myLife.born();
        markEverythingDirty();
      }
    });
  }
}
项目:tools-idea    文件:ChangeListManagerImpl.java   
public void projectOpened() {
  initializeForNewProject();

  final ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(myProject);
  if (ApplicationManager.getApplication().isUnitTestMode()) {
    myUpdater.initialized();
    vcsManager.addVcsListener(myVcsListener);
  }
  else {
    ((ProjectLevelVcsManagerImpl) vcsManager).addInitializationRequest(
      VcsInitObject.CHANGE_LIST_MANAGER, new DumbAwareRunnable() {
      public void run() {
        myUpdater.initialized();
        broadcastStateAfterLoad();
        vcsManager.addVcsListener(myVcsListener);
      }
    });
  }

  myConflictTracker.startTracking();
}
项目:tools-idea    文件:PlatformProjectViewOpener.java   
@Override
public void configureProject(final Project project, @NotNull final VirtualFile baseDir, Ref<Module> moduleRef) {
  StartupManager.getInstance(project).registerPostStartupActivity(new DumbAwareRunnable() {
    @Override
    public void run() {
      // ensure the dialog is shown after all startup activities are done
      SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
          ApplicationManager.getApplication().invokeLater(new Runnable() {
            @Override
            public void run() {
              if (project.isDisposed()) return;
              final ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.PROJECT_VIEW);
              if (toolWindow != null && toolWindow.getType() != ToolWindowType.SLIDING) {
                toolWindow.activate(null);
              }
            }
          }, ModalityState.NON_MODAL);
        }
      });
    }
  });
}