本文整理汇总了Java中com.intellij.execution.process.OSProcessHandler.startNotify方法的典型用法代码示例。如果您正苦于以下问题:Java OSProcessHandler.startNotify方法的具体用法?Java OSProcessHandler.startNotify怎么用?Java OSProcessHandler.startNotify使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.execution.process.OSProcessHandler
的用法示例。
在下文中一共展示了OSProcessHandler.startNotify方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: OCamlTopLevelConsoleView
import com.intellij.execution.process.OSProcessHandler; //导入方法依赖的package包/类
public OCamlTopLevelConsoleView(@NotNull final Project project, @NotNull final ContentManager contentManager, final Sdk topLevelSdk) throws ExecutionException {
super(project, contentManager);
myConsoleNumber = ++ourLastConsoleNumber;
final GeneralCommandLine cmd = createCommandLine(topLevelSdk);
myConsoleView = TextConsoleBuilderFactory.getInstance().createBuilder(project).getConsole();
myProcessHandler = new OSProcessHandler(cmd.createProcess(), cmd.getCommandLineString());
myConsoleView.attachToProcess(myProcessHandler);
ProcessTerminatedListener.attach(myProcessHandler);
setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
final DefaultActionGroup group = new DefaultActionGroup();
group.add(getOCamlToolWindowOpenCloseAction(true, false));
group.addAll(myConsoleView.createConsoleActions());
group.add(getOCamlToolWindowSettingsAction());
group.add(getOCamlToolWindowOpenCloseAction(false, true));
final JComponent toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, group, false).getComponent();
toolbar.setMaximumSize(new Dimension(toolbar.getPreferredSize().width, Integer.MAX_VALUE));
add(toolbar);
add(myConsoleView.getComponent());
myConsoleView.getComponent().requestFocus();
myProcessHandler.startNotify();
}
示例2: startProcess
import com.intellij.execution.process.OSProcessHandler; //导入方法依赖的package包/类
/**
* {@link ProcessListenerLivingDoc#startNotified(ProcessEvent)} is the listener method for <code>osProcessHandler.startNotify()</code>
*/
@NotNull
@Override
protected OSProcessHandler startProcess() throws ExecutionException {
OSProcessHandler osProcessHandler = super.startProcess();
osProcessHandler.addProcessListener(new ProcessListenerLivingDoc(runConfiguration));
osProcessHandler.startNotify(); // start capturing the process output
return osProcessHandler;
}
示例3: execute
import com.intellij.execution.process.OSProcessHandler; //导入方法依赖的package包/类
public void execute(AnActionEvent event, DataContext dataContext, long executionId, @Nullable final ProcessListener processListener) {
final Project project = CommonDataKeys.PROJECT.getData(dataContext);
if (project == null) {
return;
}
FileDocumentManager.getInstance().saveAllDocuments();
try {
if (isUseConsole()) {
ExecutionEnvironment environment = ExecutionEnvironmentBuilder.create(project,
DefaultRunExecutor.getRunExecutorInstance(),
new ToolRunProfile(this, dataContext)).build();
environment.setExecutionId(executionId);
environment.getRunner().execute(environment, new ProgramRunner.Callback() {
@Override
public void processStarted(RunContentDescriptor descriptor) {
ProcessHandler processHandler = descriptor.getProcessHandler();
if (processHandler != null && processListener != null) {
processHandler.addProcessListener(processListener);
}
}
});
}
else {
GeneralCommandLine commandLine = createCommandLine(dataContext);
if (commandLine == null) {
return;
}
OSProcessHandler handler = new OSProcessHandler(commandLine.createProcess(), commandLine.getCommandLineString());
handler.addProcessListener(new ToolProcessAdapter(project, synchronizeAfterExecution(), getName()));
if (processListener != null) {
handler.addProcessListener(processListener);
}
handler.startNotify();
}
}
catch (ExecutionException ex) {
ExecutionErrorDialog.show(ex, ToolsBundle.message("tools.process.start.error"), project);
}
}
示例4: doLaunchDdms
import com.intellij.execution.process.OSProcessHandler; //导入方法依赖的package包/类
private static void doLaunchDdms(GeneralCommandLine commandLine, final Project project, final boolean adbServiceWasEnabled) {
try {
ourProcessHandler = new OSProcessHandler(commandLine.createProcess(), "");
ourProcessHandler.startNotify();
ourProcessHandler.waitFor();
}
catch (ExecutionException e) {
LOG.info(e);
}
finally {
ourProcessHandler = null;
if (adbServiceWasEnabled) {
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
if (project.isDisposed()) {
return;
}
AndroidEnableAdbServiceAction.setAdbServiceEnabled(project, true);
// trigger creation of new bridge
File adb = AndroidSdkUtils.getAdb(project);
if (adb != null) {
AdbService.getInstance().getDebugBridge(adb);
}
}
});
}
}
}
示例5: createIntelliProject
import com.intellij.execution.process.OSProcessHandler; //导入方法依赖的package包/类
private void createIntelliProject(@NotNull final Project project) {
final GeneralCommandLine cmdLine =
DefracCommandLineBuilder.forSdk(checkNotNull(defracSdk)).
command("ide-intellij").
workingDirectory(VfsUtilCore.virtualToIoFile(project.getBaseDir())).
build();
try {
final OSProcessHandler handler = new OSProcessHandler(cmdLine);
handler.startNotify();
handler.waitFor();
} catch(final ExecutionException exception) {
LOG.error(exception);
}
}
示例6: installEmberCLI
import com.intellij.execution.process.OSProcessHandler; //导入方法依赖的package包/类
private void installEmberCLI() {
final GeneralCommandLine generalCommandLine = new GeneralCommandLine("npm", "install","-g", "ember-cli");
generalCommandLine.setWorkDirectory(getNewProjectFilePath());
try {
final OSProcessHandler handler = new OSProcessHandler(generalCommandLine);
handler.addProcessListener(this);
handler.startNotify();
generalCommandLine.createProcess();
} catch (Exception e) {
handleError(e);
}
}
示例7: executeCommand
import com.intellij.execution.process.OSProcessHandler; //导入方法依赖的package包/类
@NotNull
public static ExecutionStatus executeCommand(@NotNull GeneralCommandLine commandLine,
@Nullable final OutputProcessor processor,
@Nullable WaitingStrategies.Strategy strategy) throws ExecutionException {
LOG.info(commandLine.getCommandLineString());
OSProcessHandler handler = new OSProcessHandler(commandLine.createProcess(), "");
final ProcessAdapter listener = new ProcessAdapter() {
@Override
public void onTextAvailable(final ProcessEvent event, final Key outputType) {
if (processor != null) {
final String message = event.getText();
processor.onTextAvailable(message);
}
}
};
if (!(strategy instanceof WaitingStrategies.DoNotWait)) {
handler.addProcessListener(listener);
}
handler.startNotify();
try {
if (!(strategy instanceof WaitingStrategies.WaitForever)) {
if (strategy instanceof WaitingStrategies.WaitForTime) {
handler.waitFor(((WaitingStrategies.WaitForTime)strategy).getTimeMs());
}
}
else {
handler.waitFor();
}
}
catch (ProcessCanceledException e) {
return ExecutionStatus.ERROR;
}
if (!handler.isProcessTerminated()) {
return ExecutionStatus.TIMEOUT;
}
if (!(strategy instanceof WaitingStrategies.DoNotWait)) {
handler.removeProcessListener(listener);
}
int exitCode = handler.getProcess().exitValue();
return exitCode == 0 ? ExecutionStatus.SUCCESS : ExecutionStatus.ERROR;
}
示例8: installPlugin
import com.intellij.execution.process.OSProcessHandler; //导入方法依赖的package包/类
public static void installPlugin(@NotNull Project project, @NotNull PluginGeneratorSettings settings) {
// download cli tools, if not existing locally
VirtualFile cliFile = getCliToolsPharFile(project);
if (cliFile == null) {
showErrorNotification(project, "No CLI-Tools phar found");
return;
}
List<String> commands = generateCommand(settings);
String[] myCommand = ArrayUtil.toStringArray(commands);
final StringBuilder outputBuilder = new StringBuilder();
try {
OSProcessHandler processHandler = ScriptRunnerUtil.execute(myCommand[0], project.getBaseDir().getPath(), null, Arrays.copyOfRange(myCommand, 1, myCommand.length));
processHandler.addProcessListener(new ProcessAdapter() {
@Override
public void onTextAvailable(ProcessEvent event, com.intellij.openapi.util.Key outputType) {
String text = event.getText();
outputBuilder.append(text);
}
});
processHandler.startNotify();
for (;;){
boolean finished = processHandler.waitFor(CHECKING_TIMEOUT_IN_MILLISECONDS);
if (finished) {
break;
}
}
}
catch (ExecutionException e) {
showErrorNotification(project, e.getMessage());
return;
}
String output = outputBuilder.toString();
if (output.toLowerCase().contains("exception")) {
String message = SymfonyInstallerUtil.formatExceptionMessage(output);
if(message == null) {
message = "The unexpected happens...";
}
showErrorNotification(project, message);
return;
}
// delete cli tools
FileUtil.delete(VfsUtil.virtualToIoFile(cliFile));
// move into correct plugin folder
String newDir = project.getBasePath() + "/engine/Shopware/Plugins/Local/" + settings.getNamespace() + "/" + settings.getPluginName();
if (FileUtil.canWrite(newDir)) {
return;
}
FileUtil.createDirectory(new File(newDir));
FileUtil.moveDirWithContent(new File(project.getBasePath() + "/" + settings.getPluginName()), new File(newDir));
// open bootstrap file
VirtualFile fileByIoFile = VfsUtil.findFileByIoFile(new File(newDir + "/Bootstrap.php"), true);
if(fileByIoFile == null) {
return;
}
final PsiFile file = PsiManager.getInstance(project).findFile(fileByIoFile);
if (file == null) {
return;
}
IdeHelper.navigateToPsiElement(file);
}