Java 类com.intellij.util.ParameterizedRunnable 实例源码

项目:intellij-ce-playground    文件:LibraryEditingUtil.java   
public static BaseListPopupStep<LibraryType> createChooseTypeStep(final ClasspathPanel classpathPanel,
                                                                  final ParameterizedRunnable<LibraryType> action) {
  return new BaseListPopupStep<LibraryType>(IdeBundle.message("popup.title.select.library.type"), getSuitableTypes(classpathPanel)) {
        @NotNull
        @Override
        public String getTextFor(LibraryType value) {
          return value != null ? value.getCreateActionName() : IdeBundle.message("create.default.library.type.action.name");
        }

        @Override
        public Icon getIconFor(LibraryType aValue) {
          return aValue != null ? aValue.getIcon(null) : PlatformIcons.LIBRARY_ICON;
        }

        @Override
        public PopupStep onChosen(final LibraryType selectedValue, boolean finalChoice) {
          return doFinalStep(new Runnable() {
            @Override
            public void run() {
              action.run(selectedValue);
            }
          });
        }
      };
}
项目:intellij-ce-playground    文件:AddCustomLibraryDialog.java   
private AddCustomLibraryDialog(CustomLibraryDescription description, LibrariesContainer librariesContainer,
                               Module module,
                               ModifiableRootModel modifiableRootModel,
                               @Nullable ParameterizedRunnable<ModifiableRootModel> beforeLibraryAdded) {
  super(module.getProject(), true);
  myLibrariesContainer = librariesContainer;
  myModule = module;
  myModifiableRootModel = modifiableRootModel;
  myBeforeLibraryAdded = beforeLibraryAdded;
  setTitle(IdeBundle.message("setup.library.dialog.title"));
  VirtualFile baseDir = myModule.getProject().getBaseDir();
  final String baseDirPath = baseDir != null ? baseDir.getPath() : "";
  myPanel = new LibraryOptionsPanel(description, baseDirPath, FrameworkLibraryVersionFilter.ALL, myLibrariesContainer, false);
  Disposer.register(myDisposable, myPanel);
  init();
}
项目:intellij-ce-playground    文件:AddNewLibraryDependencyAction.java   
public static void chooseTypeAndCreate(final ClasspathPanel classpathPanel,
                                       final StructureConfigurableContext context,
                                       final JButton contextButton, @NotNull final LibraryCreatedCallback callback) {
  if (LibraryEditingUtil.hasSuitableTypes(classpathPanel)) {
    final ListPopup popup = JBPopupFactory.getInstance().createListPopup(LibraryEditingUtil.createChooseTypeStep(classpathPanel, new ParameterizedRunnable<LibraryType>() {
      @Override
      public void run(LibraryType libraryType) {
        doCreateLibrary(classpathPanel, context, callback, contextButton, libraryType);
      }
    }));
    popup.showUnderneathOf(contextButton);
  }
  else {
    doCreateLibrary(classpathPanel, context, callback, contextButton, null);
  }
}
项目:intellij-ce-playground    文件:BaseCompilerTestCase.java   
protected CompilationLog compile(final CompileScope scope, final CompilerFilter filter, final boolean forceCompile,
                                 final boolean errorsExpected) {
  return compile(errorsExpected, new ParameterizedRunnable<CompileStatusNotification>() {
    @Override
    public void run(CompileStatusNotification callback) {
      final CompilerManager compilerManager = getCompilerManager();
      if (forceCompile) {
        Assert.assertSame("Only 'ALL' filter is supported for forced compilation", CompilerFilter.ALL, filter);
        compilerManager.compile(scope, callback);
      }
      else {
        compilerManager.make(scope, filter, callback);
      }
    }
  });
}
项目:intellij-ce-playground    文件:ServerConnectionImpl.java   
@Override
public void deploy(@NotNull final DeploymentTask<D> task, @NotNull final ParameterizedRunnable<String> onDeploymentStarted) {
  connectIfNeeded(new ConnectionCallbackBase<D>() {
    @Override
    public void connected(@NotNull ServerRuntimeInstance<D> instance) {
      LocalDeploymentImpl deployment = new LocalDeploymentImpl(instance,
                                                               ServerConnectionImpl.this,
                                                               DeploymentStatus.DEPLOYING,
                                                               null,
                                                               null,
                                                               task);
      String deploymentName = deployment.getName();
      synchronized (myLocalDeployments) {
        myLocalDeployments.put(deploymentName, deployment);
      }
      DeploymentLogManagerImpl logManager = new DeploymentLogManagerImpl(task.getProject(), new ChangeListener())
        .withMainHandlerVisible(true);
      LoggingHandlerImpl handler = logManager.getMainLoggingHandler();
      myLogManagers.put(deploymentName, logManager);
      handler.printlnSystemMessage("Deploying '" + deploymentName + "'...");
      onDeploymentStarted.run(deploymentName);
      instance
        .deploy(task, logManager, new DeploymentOperationCallbackImpl(deploymentName, (DeploymentTaskImpl<D>)task, handler, deployment));
    }
  });
}
项目:intellij-ce-playground    文件:DeployToServerState.java   
@Nullable
@Override
public ExecutionResult execute(Executor executor, @NotNull ProgramRunner runner) throws ExecutionException {
  final ServerConnection connection = ServerConnectionManager.getInstance().getOrCreateConnection(myServer);
  final Project project = myEnvironment.getProject();
  RemoteServersView.getInstance(project).showServerConnection(connection);

  final DebugConnector<?,?> debugConnector;
  if (DefaultDebugExecutor.getDebugExecutorInstance().equals(executor)) {
    debugConnector = myServer.getType().createDebugConnector();
  }
  else {
    debugConnector = null;
  }
  connection.deploy(new DeploymentTaskImpl(mySource, myConfiguration, project, debugConnector, myEnvironment),
                    new ParameterizedRunnable<String>() {
                      @Override
                      public void run(String s) {
                        RemoteServersView.getInstance(project).showDeployment(connection, s);
                      }
                    });
  return null;
}
项目:intellij-ce-playground    文件:MvcUpgradeAction.java   
@Override
protected void actionPerformed(@NotNull AnActionEvent e, @NotNull final Module module, @NotNull final MvcFramework framework) {
  final GroovyLibraryDescription description = framework.createLibraryDescription();
  final AddCustomLibraryDialog dialog =
    AddCustomLibraryDialog.createDialog(description, module, new ParameterizedRunnable<ModifiableRootModel>() {
      @Override
      public void run(ModifiableRootModel modifiableRootModel) {
        removeOldMvcSdk(framework, modifiableRootModel);
      }
    });
  dialog.setTitle("Change " + framework.getDisplayName() + " SDK version");
  if (dialog.showAndGet()) {
    module.putUserData(MvcFramework.UPGRADE, Boolean.TRUE);
    module.putUserData(MvcModuleStructureUtil.LAST_MVC_VERSION, null);
  }
}
项目:tools-idea    文件:LibraryEditingUtil.java   
public static BaseListPopupStep<LibraryType> createChooseTypeStep(final ClasspathPanel classpathPanel,
                                                                  final ParameterizedRunnable<LibraryType> action) {
  return new BaseListPopupStep<LibraryType>(IdeBundle.message("popup.title.select.library.type"), getSuitableTypes(classpathPanel)) {
        @NotNull
        @Override
        public String getTextFor(LibraryType value) {
          return value != null ? value.getCreateActionName() : IdeBundle.message("create.default.library.type.action.name");
        }

        @Override
        public Icon getIconFor(LibraryType aValue) {
          return aValue != null ? aValue.getIcon() : PlatformIcons.LIBRARY_ICON;
        }

        @Override
        public PopupStep onChosen(final LibraryType selectedValue, boolean finalChoice) {
          return doFinalStep(new Runnable() {
            @Override
            public void run() {
              action.run(selectedValue);
            }
          });
        }
      };
}
项目:tools-idea    文件:AddCustomLibraryDialog.java   
private AddCustomLibraryDialog(CustomLibraryDescription description, LibrariesContainer librariesContainer,
                               Module module,
                               ModifiableRootModel modifiableRootModel,
                               @Nullable ParameterizedRunnable<ModifiableRootModel> beforeLibraryAdded) {
  super(module.getProject(), true);
  myLibrariesContainer = librariesContainer;
  myModule = module;
  myModifiableRootModel = modifiableRootModel;
  myBeforeLibraryAdded = beforeLibraryAdded;
  setTitle(IdeBundle.message("setup.library.dialog.title"));
  VirtualFile baseDir = myModule.getProject().getBaseDir();
  final String baseDirPath = baseDir != null ? baseDir.getPath() : "";
  myPanel = new LibraryOptionsPanel(description, baseDirPath, FrameworkLibraryVersionFilter.ALL, myLibrariesContainer, false);
  Disposer.register(myDisposable, myPanel);
  init();
}
项目:tools-idea    文件:AddNewLibraryDependencyAction.java   
public static void chooseTypeAndCreate(final ClasspathPanel classpathPanel,
                                       final StructureConfigurableContext context,
                                       final JButton contextButton, @NotNull final LibraryCreatedCallback callback) {
  if (LibraryEditingUtil.hasSuitableTypes(classpathPanel)) {
    final ListPopup popup = JBPopupFactory.getInstance().createListPopup(LibraryEditingUtil.createChooseTypeStep(classpathPanel, new ParameterizedRunnable<LibraryType>() {
      @Override
      public void run(LibraryType libraryType) {
        doCreateLibrary(classpathPanel, context, callback, contextButton, libraryType);
      }
    }));
    popup.showUnderneathOf(contextButton);
  }
  else {
    doCreateLibrary(classpathPanel, context, callback, contextButton, null);
  }
}
项目:tools-idea    文件:BaseCompilerTestCase.java   
protected CompilationLog compile(final CompileScope scope, final CompilerFilter filter, final boolean forceCompile,
                                 final boolean errorsExpected) {
  return compile(errorsExpected, new ParameterizedRunnable<CompileStatusNotification>() {
    @Override
    public void run(CompileStatusNotification callback) {
      final CompilerManager compilerManager = getCompilerManager();
      if (forceCompile) {
        Assert.assertSame("Only 'ALL' filter is supported for forced compilation", CompilerFilter.ALL, filter);
        compilerManager.compile(scope, callback);
      }
      else {
        compilerManager.make(scope, filter, callback);
      }
    }
  });
}
项目:tools-idea    文件:MvcUpgradeAction.java   
@Override
protected void actionPerformed(@NotNull AnActionEvent e, @NotNull final Module module, @NotNull final MvcFramework framework) {
  final GroovyLibraryDescription description = framework.createLibraryDescription();
  final AddCustomLibraryDialog dialog = AddCustomLibraryDialog.createDialog(description, module, new ParameterizedRunnable<ModifiableRootModel>() {
      @Override
      public void run(ModifiableRootModel modifiableRootModel) {
        removeOldMvcSdk(framework, modifiableRootModel);
      }
    });
  dialog.setTitle("Change " + framework.getDisplayName() + " SDK version");
  dialog.show();

  if (dialog.isOK()) {
    module.putUserData(MvcFramework.UPGRADE, Boolean.TRUE);
    module.putUserData(MvcModuleStructureUtil.LAST_MVC_VERSION, null);
  }
}
项目:consulo    文件:ServerConnectionImpl.java   
@Override
public void deploy(@Nonnull final DeploymentTask<D> task, @Nonnull final ParameterizedRunnable<String> onDeploymentStarted) {
  connectIfNeeded(new ConnectionCallbackBase<D>() {
    @Override
    public void connected(@Nonnull ServerRuntimeInstance<D> instance) {
      DeploymentSource source = task.getSource();
      String deploymentName = instance.getDeploymentName(source);
      DeploymentImpl deployment;
      synchronized (myLocalDeployments) {
        deployment = new DeploymentImpl(deploymentName, DeploymentStatus.DEPLOYING, null, null, task);
        myLocalDeployments.put(deploymentName, deployment);
      }
      DeploymentLogManagerImpl logManager = new DeploymentLogManagerImpl(task.getProject(), new Runnable() {
        @Override
        public void run() {
          myEventDispatcher.queueDeploymentsChanged(ServerConnectionImpl.this);
        }
      });
      LoggingHandlerImpl handler = logManager.getMainLoggingHandler();
      myLogManagers.put(deploymentName, logManager);
      handler.printlnSystemMessage("Deploying '" + deploymentName + "'...");
      onDeploymentStarted.run(deploymentName);
      instance.deploy(task, logManager, new DeploymentOperationCallbackImpl(deploymentName, (DeploymentTaskImpl<D>)task, handler, deployment));
    }
  });
}
项目:consulo    文件:LibraryEditingUtil.java   
public static BaseListPopupStep<LibraryType> createChooseTypeStep(final ClasspathPanel classpathPanel,
                                                                  final ParameterizedRunnable<LibraryType> action) {
  return new BaseListPopupStep<LibraryType>(IdeBundle.message("popup.title.select.library.type"), getSuitableTypes(classpathPanel)) {
        @Nonnull
        @Override
        public String getTextFor(LibraryType value) {
          String createActionName = value != null ? value.getCreateActionName() : null;
          return createActionName != null ? createActionName : IdeBundle.message("create.default.library.type.action.name");
        }

        @Override
        public Icon getIconFor(LibraryType aValue) {
          return aValue != null ? aValue.getIcon() : AllIcons.Nodes.PpLib;
        }

        @Override
        public PopupStep onChosen(final LibraryType selectedValue, boolean finalChoice) {
          return doFinalStep(new Runnable() {
            @Override
            public void run() {
              action.run(selectedValue);
            }
          });
        }
      };
}
项目:intellij-ce-playground    文件:AddLibraryDependencyAction.java   
@Override
public PopupStep createSubStep() {
  return LibraryEditingUtil.createChooseTypeStep(myClasspathPanel, new ParameterizedRunnable<LibraryType>() {
    @Override
    public void run(LibraryType libraryType) {
      new AddNewLibraryDependencyAction(myClasspathPanel, myContext, libraryType).execute();
    }
  });
}
项目:intellij-ce-playground    文件:BaseCompilerTestCase.java   
protected CompilationLog rebuild() {
  return compile(false, new ParameterizedRunnable<CompileStatusNotification>() {
    @Override
    public void run(CompileStatusNotification compileStatusNotification) {
      getCompilerManager().rebuild(compileStatusNotification);
    }
  });
}
项目:intellij-ce-playground    文件:BaseCompilerTestCase.java   
protected CompilationLog compile(final boolean errorsExpected, final ParameterizedRunnable<CompileStatusNotification> action) {
  CompilationLog log = compile(action);
  if (errorsExpected && log.myErrors.length == 0) {
    Assert.fail("compilation finished without errors");
  }
  else if (!errorsExpected && log.myErrors.length > 0) {
    Assert.fail("compilation finished with errors: " + Arrays.toString(log.myErrors));
  }
  return log;
}
项目:intellij-ce-playground    文件:SshKeyChecker.java   
private void redeploy() {
  final ServerConnection connection = ServerConnectionManager.getInstance().getOrCreateConnection(myServerRuntime.getServer());

  final RemoteServersView view = RemoteServersView.getInstance(myDeploymentTask.getProject());
  view.showServerConnection(connection);

  connection.deploy(myDeploymentTask,
                    new ParameterizedRunnable<String>() {

                      @Override
                      public void run(String s) {
                        view.showDeployment(connection, s);
                      }
                    });
}
项目:intellij-ce-playground    文件:LightToolWindowManager.java   
private void runUpdateContent(ParameterizedRunnable<DesignerEditorPanelFacade> action) {
  for (FileEditor editor : myFileEditorManager.getAllEditors()) {
    DesignerEditorPanelFacade designer = getDesigner(editor);
    if (designer != null) {
      action.run(designer);
    }
  }
}
项目:tools-idea    文件:AddLibraryDependencyAction.java   
@Override
public PopupStep createSubStep() {
  return LibraryEditingUtil.createChooseTypeStep(myClasspathPanel, new ParameterizedRunnable<LibraryType>() {
    @Override
    public void run(LibraryType libraryType) {
      new AddNewLibraryDependencyAction(myClasspathPanel, myContext, libraryType).execute();
    }
  });
}
项目:tools-idea    文件:BaseCompilerTestCase.java   
protected CompilationLog rebuild() {
  return compile(false, new ParameterizedRunnable<CompileStatusNotification>() {
    @Override
    public void run(CompileStatusNotification compileStatusNotification) {
      getCompilerManager().rebuild(compileStatusNotification);
    }
  });
}
项目:tools-idea    文件:BaseCompilerTestCase.java   
protected CompilationLog compile(final boolean errorsExpected, final ParameterizedRunnable<CompileStatusNotification> action) {
  CompilationLog log = compile(action);
  if (errorsExpected && log.myErrors.length == 0) {
    Assert.fail("compilation finished without errors");
  }
  else if (!errorsExpected && log.myErrors.length > 0) {
    Assert.fail("compilation finished with errors: " + Arrays.toString(log.myErrors));
  }
  return log;
}
项目:tools-idea    文件:AbstractToolWindowManager.java   
private void runUpdateContent(ParameterizedRunnable<DesignerEditorPanel> action) {
  for (FileEditor editor : myFileEditorManager.getAllEditors()) {
    DesignerEditorPanel designer = getDesigner(editor);
    if (designer != null) {
      action.run(designer);
    }
  }
}
项目:cordovastudio    文件:AbstractToolWindowManager.java   
private void runUpdateContent(ParameterizedRunnable<CordovaDesignerEditorPanel> action) {
  for (FileEditor editor : myFileEditorManager.getAllEditors()) {
      CordovaDesignerEditorPanel designer = getDesigner(editor);
    if (designer != null) {
      action.run(designer);
    }
  }
}
项目:consulo    文件:DeployToServerState.java   
@javax.annotation.Nullable
@Override
public ExecutionResult execute(Executor executor, @Nonnull ProgramRunner runner) throws ExecutionException {
  final ServerConnection connection = ServerConnectionManager.getInstance().getOrCreateConnection(myServer);
  final Project project = myEnvironment.getProject();
  RemoteServersView.getInstance(project).showServerConnection(connection);

  final DebugConnector<?,?> debugConnector;
  if (DefaultDebugExecutor.getDebugExecutorInstance().equals(executor)) {
    debugConnector = myServer.getType().createDebugConnector();
  }
  else {
    debugConnector = null;
  }
  connection.computeDeployments(new Runnable() {
    @Override
    public void run() {
      connection.deploy(new DeploymentTaskImpl(mySource, myConfiguration, project, debugConnector, myEnvironment),
                        new ParameterizedRunnable<String>() {
                          @Override
                          public void run(String s) {
                            RemoteServersView.getInstance(project).showDeployment(connection, s);
                          }
                        });
    }
  });
  return null;
}
项目:consulo    文件:LightToolWindowManager.java   
private void runUpdateContent(ParameterizedRunnable<DesignerEditorPanelFacade> action) {
  for (FileEditor editor : myFileEditorManager.getAllEditors()) {
    DesignerEditorPanelFacade designer = getDesigner(editor);
    if (designer != null) {
      action.run(designer);
    }
  }
}
项目:intellij-ce-playground    文件:JpsModelLoaderImpl.java   
public JpsModelLoaderImpl(String projectPath, String globalOptionsPath, @Nullable ParameterizedRunnable<JpsModel> initializer) {
  myProjectPath = projectPath;
  myGlobalOptionsPath = globalOptionsPath;
  myModelInitializer = initializer;
}
项目:intellij-ce-playground    文件:Standalone.java   
public int loadAndRunBuild(final String projectPath) {
  String globalOptionsPath = null;
  if (configPath != null) {
    File optionsDir = new File(configPath, "options");
    if (!optionsDir.isDirectory()) {
      System.err.println("'" + configPath + "' is not valid config path: " + optionsDir.getAbsolutePath() + " not found");
      return 1;
    }
    globalOptionsPath = optionsDir.getAbsolutePath();
  }

  ParameterizedRunnable<JpsModel> initializer = null;
  String scriptPath = initializationScriptPath;
  if (scriptPath != null) {
    File scriptFile = new File(scriptPath);
    if (!scriptFile.isFile()) {
      System.err.println("Script '" + scriptPath + "' not found");
      return 1;
    }
    initializer = new GroovyModelInitializer(scriptFile);
  }

  if (modules.length == 0 && artifacts.length == 0 && !allModules && !allArtifacts) {
    System.err.println("Nothing to compile: at least one of --modules, --artifacts, --all-modules or --all-artifacts parameters must be specified");
    return 1;
  }

  JpsModelLoaderImpl loader = new JpsModelLoaderImpl(projectPath, globalOptionsPath, initializer);
  Set<String> modulesSet = new HashSet<String>(Arrays.asList(modules));
  List<String> artifactsList = Arrays.asList(artifacts);
  File dataStorageRoot;
  if (cacheDirPath != null) {
    dataStorageRoot = new File(cacheDirPath);
  }
  else {
    dataStorageRoot = Utils.getDataStorageRoot(projectPath);
  }
  if (dataStorageRoot == null) {
    System.err.println("Error: Cannot determine build data storage root for project " + projectPath);
    return 1;
  }

  ConsoleMessageHandler consoleMessageHandler = new ConsoleMessageHandler();
  long start = System.currentTimeMillis();
  try {
    runBuild(loader, dataStorageRoot, !incremental, modulesSet, allModules, artifactsList, allArtifacts, true,
             consoleMessageHandler);
  }
  catch (Throwable t) {
    System.err.println("Internal error: " + t.getMessage());
    t.printStackTrace();
  }
  System.out.println("Build finished in " + Utils.formatDuration(System.currentTimeMillis() - start));
  return consoleMessageHandler.hasErrors() ? 1 : 0;
}
项目:intellij-ce-playground    文件:AddCustomLibraryDialog.java   
public static AddCustomLibraryDialog createDialog(@NotNull CustomLibraryDescription description,
                                                  final @NotNull Module module,
                                                  final ParameterizedRunnable<ModifiableRootModel> beforeLibraryAdded) {
  return createDialog(description, LibrariesContainerFactory.createContainer(module), module, null, beforeLibraryAdded);
}
项目:intellij-ce-playground    文件:AddCustomLibraryDialog.java   
public static AddCustomLibraryDialog createDialog(CustomLibraryDescription description,
                                                  final @NotNull LibrariesContainer librariesContainer, final @NotNull Module module,
                                                  final @Nullable ModifiableRootModel modifiableRootModel,
                                                  @Nullable ParameterizedRunnable<ModifiableRootModel> beforeLibraryAdded) {
  return new AddCustomLibraryDialog(description, librariesContainer, module, modifiableRootModel, beforeLibraryAdded);
}
项目:intellij-ce-playground    文件:BaseCompilerTestCase.java   
private CompilationLog compile(final ParameterizedRunnable<CompileStatusNotification> action) {
  final Ref<CompilationLog> result = Ref.create(null);
  final Semaphore semaphore = new Semaphore();
  semaphore.down();
  final List<String> generatedFilePaths = new ArrayList<String>();
  getCompilerManager().addCompilationStatusListener(new CompilationStatusAdapter() {
    @Override
    public void fileGenerated(String outputRoot, String relativePath) {
      generatedFilePaths.add(relativePath);
    }
  }, myTestRootDisposable);
  UIUtil.invokeAndWaitIfNeeded(new Runnable() {
    @Override
    public void run() {

      final CompileStatusNotification callback = new CompileStatusNotification() {
        @Override
        public void finished(boolean aborted, int errors, int warnings, CompileContext compileContext) {
          try {
            if (aborted) {
              Assert.fail("compilation aborted");
            }
            ExitStatus status = CompileDriver.getExternalBuildExitStatus(compileContext);
            result.set(new CompilationLog(status == ExitStatus.UP_TO_DATE,
                                          generatedFilePaths,
                                          compileContext.getMessages(CompilerMessageCategory.ERROR),
                                          compileContext.getMessages(CompilerMessageCategory.WARNING)));
          }
          finally {
            semaphore.up();
          }
        }
      };
      myProject.save();
      CompilerTestUtil.saveApplicationSettings();
      action.run(callback);
    }
  });

  final long start = System.currentTimeMillis();
  while (!semaphore.waitFor(10)) {
    if (System.currentTimeMillis() - start > 5 * 60 * 1000) {
      throw new RuntimeException("timeout");
    }
    if (SwingUtilities.isEventDispatchThread()) {
      UIUtil.dispatchAllInvocationEvents();
    }
  }
  if (SwingUtilities.isEventDispatchThread()) {
    UIUtil.dispatchAllInvocationEvents();
  }

  return result.get();
}
项目:tools-idea    文件:JpsModelLoaderImpl.java   
public JpsModelLoaderImpl(String projectPath, String globalOptionsPath, @Nullable ParameterizedRunnable<JpsModel> initializer) {
  myProjectPath = projectPath;
  myGlobalOptionsPath = globalOptionsPath;
  myModelInitializer = initializer;
}
项目:tools-idea    文件:Standalone.java   
public void loadAndRunBuild(final String projectPath) {
  String globalOptionsPath = null;
  if (configPath != null) {
    File optionsDir = new File(configPath, "options");
    if (!optionsDir.isDirectory()) {
      System.err.println("'" + configPath + "' is not valid config path: " + optionsDir.getAbsolutePath() + " not found");
      return;
    }
    globalOptionsPath = optionsDir.getAbsolutePath();
  }

  ParameterizedRunnable<JpsModel> initializer = null;
  String scriptPath = initializationScriptPath;
  if (scriptPath != null) {
    File scriptFile = new File(scriptPath);
    if (!scriptFile.isFile()) {
      System.err.println("Script '" + scriptPath + "' not found");
      return;
    }
    initializer = new GroovyModelInitializer(scriptFile);
  }

  if (modules.length == 0 && artifacts.length == 0 && !allModules) {
    System.err.println("Nothing to compile: at least one of --modules, --artifacts or --all-modules parameters must be specified");
    return;
  }

  JpsModelLoaderImpl loader = new JpsModelLoaderImpl(projectPath, globalOptionsPath, initializer);
  Set<String> modulesSet = new HashSet<String>(Arrays.asList(modules));
  List<String> artifactsList = Arrays.asList(artifacts);
  File dataStorageRoot;
  if (cacheDirPath != null) {
    dataStorageRoot = new File(cacheDirPath);
  }
  else {
    dataStorageRoot = Utils.getDataStorageRoot(projectPath);
  }
  if (dataStorageRoot == null) {
    System.err.println("Error: Cannot determine build data storage root for project " + projectPath);
    return;
  }

  long start = System.currentTimeMillis();
  try {
    runBuild(loader, dataStorageRoot, !incremental, modulesSet, allModules, artifactsList, true, new ConsoleMessageHandler());
  }
  catch (Throwable t) {
    System.err.println("Internal error: " + t.getMessage());
    t.printStackTrace();
  }
  System.out.println("Build finished in " + Utils.formatDuration(System.currentTimeMillis() - start));
}
项目:tools-idea    文件:AddCustomLibraryDialog.java   
public static AddCustomLibraryDialog createDialog(@NotNull CustomLibraryDescription description,
                                                  final @NotNull Module module,
                                                  final ParameterizedRunnable<ModifiableRootModel> beforeLibraryAdded) {
  return createDialog(description, LibrariesContainerFactory.createContainer(module), module, null, beforeLibraryAdded);
}
项目:tools-idea    文件:AddCustomLibraryDialog.java   
public static AddCustomLibraryDialog createDialog(CustomLibraryDescription description,
                                                  final @NotNull LibrariesContainer librariesContainer, final @NotNull Module module,
                                                  final @Nullable ModifiableRootModel modifiableRootModel,
                                                  @Nullable ParameterizedRunnable<ModifiableRootModel> beforeLibraryAdded) {
  return new AddCustomLibraryDialog(description, librariesContainer, module, modifiableRootModel, beforeLibraryAdded);
}
项目:tools-idea    文件:BaseCompilerTestCase.java   
private CompilationLog compile(final ParameterizedRunnable<CompileStatusNotification> action) {
  final Ref<CompilationLog> result = Ref.create(null);
  final Semaphore semaphore = new Semaphore();
  semaphore.down();
  UIUtil.invokeAndWaitIfNeeded(new Runnable() {
    @Override
    public void run() {

      CompilerManagerImpl.testSetup();
      final CompileStatusNotification callback = new CompileStatusNotification() {
        @Override
        public void finished(boolean aborted, int errors, int warnings, CompileContext compileContext) {
          try {
            if (aborted) {
              Assert.fail("compilation aborted");
            }
            ExitStatus status = CompileDriver.getExternalBuildExitStatus(compileContext);
            result.set(new CompilationLog(status == ExitStatus.UP_TO_DATE,
                                          CompilerManagerImpl.getPathsToRecompile(), CompilerManagerImpl.getPathsToDelete(),
                                          compileContext.getMessages(CompilerMessageCategory.ERROR),
                                          compileContext.getMessages(CompilerMessageCategory.WARNING)));
          }
          finally {
            semaphore.up();
          }
        }
      };
      if (useExternalCompiler()) {
        myProject.save();
        CompilerTestUtil.saveApplicationSettings();
        CompilerTestUtil.scanSourceRootsToRecompile(myProject);
      }
      action.run(callback);
    }
  });

  final long start = System.currentTimeMillis();
  while (!semaphore.waitFor(10)) {
    if (System.currentTimeMillis() - start > 60 * 1000) {
      throw new RuntimeException("timeout");
    }
    if (SwingUtilities.isEventDispatchThread()) {
      UIUtil.dispatchAllInvocationEvents();
    }
  }
  if (SwingUtilities.isEventDispatchThread()) {
    UIUtil.dispatchAllInvocationEvents();
  }

  return result.get();
}
项目:consulo    文件:WelcomeDesktopBalloonLayoutImpl.java   
public WelcomeDesktopBalloonLayoutImpl(@Nonnull JRootPane parent, @Nonnull Insets insets, @Nonnull ParameterizedRunnable<List<NotificationType>> listener, @Nonnull Computable<Point> buttonLocation) {
  super(parent, insets);
  myListener = listener;
  myButtonLocation = buttonLocation;
}
项目:intellij-ce-playground    文件:ServerConnection.java   
void deploy(@NotNull DeploymentTask<D> task, @NotNull ParameterizedRunnable<String> onDeploymentStarted);
项目:consulo    文件:ServerConnection.java   
void deploy(@Nonnull DeploymentTask<D> task, @Nonnull ParameterizedRunnable<String> onDeploymentStarted);