当前位置: 首页>>代码示例>>Java>>正文


Java ProcessAdapter类代码示例

本文整理汇总了Java中com.intellij.execution.process.ProcessAdapter的典型用法代码示例。如果您正苦于以下问题:Java ProcessAdapter类的具体用法?Java ProcessAdapter怎么用?Java ProcessAdapter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ProcessAdapter类属于com.intellij.execution.process包,在下文中一共展示了ProcessAdapter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: attachVM

import com.intellij.execution.process.ProcessAdapter; //导入依赖的package包/类
protected DebuggerSession attachVM(final RemoteConnection remoteConnection, final boolean pollConnection)
        throws InvocationTargetException, InterruptedException {
  final RemoteState remoteState = new RemoteStateState(myProject, remoteConnection);

  final DebuggerSession[] debuggerSession = new DebuggerSession[1];
  UIUtil.invokeAndWaitIfNeeded(new Runnable() {
    @Override
    public void run() {
      try {
        debuggerSession[0] = attachVirtualMachine(remoteState, new ExecutionEnvironmentBuilder(myProject, DefaultDebugExecutor.getDebugExecutorInstance())
          .runProfile(new MockConfiguration())
          .build(), remoteConnection, pollConnection);
      }
      catch (ExecutionException e) {
        fail(e.getMessage());
      }
    }
  });
  debuggerSession[0].getProcess().getProcessHandler().addProcessListener(new ProcessAdapter() {
    @Override
    public void onTextAvailable(ProcessEvent event, Key outputType) {
      print(event.getText(), outputType);
    }
  });
  return debuggerSession[0];
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:DebuggerTestCase.java

示例2: startProcess

import com.intellij.execution.process.ProcessAdapter; //导入依赖的package包/类
@NotNull
protected OSProcessHandler startProcess() throws ExecutionException {
  final OSProcessHandler handler = JavaCommandLineStateUtil.startProcess(createCommandLine());
  ProcessTerminatedListener.attach(handler, myProject, JavadocBundle.message("javadoc.generate.exited"));
  handler.addProcessListener(new ProcessAdapter() {
    public void processTerminated(ProcessEvent event) {
      if (myConfiguration.OPEN_IN_BROWSER) {
        File url = new File(myConfiguration.OUTPUT_DIRECTORY, INDEX_HTML);
        if (url.exists() && event.getExitCode() == 0) {
          BrowserUtil.browse(url);
        }
      }
    }
  });
  return handler;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:JavadocGeneratorRunProfile.java

示例3: init

import com.intellij.execution.process.ProcessAdapter; //导入依赖的package包/类
public XDebugSessionTab init(@NotNull XDebugProcess process, @NotNull XDebugSessionData sessionData, @Nullable RunContentDescriptor contentToReuse) {
  LOG.assertTrue(myDebugProcess == null);
  myDebugProcess = process;
  mySessionData = sessionData;

  if (myDebugProcess.checkCanInitBreakpoints()) {
    initBreakpoints();
  }

  myDebugProcess.getProcessHandler().addProcessListener(new ProcessAdapter() {
    @Override
    public void processTerminated(final ProcessEvent event) {
      stopImpl();
      myDebugProcess.getProcessHandler().removeProcessListener(this);
    }
  });
  //todo[nik] make 'createConsole()' method return ConsoleView
  myConsoleView = (ConsoleView)myDebugProcess.createConsole();
  if (!myShowTabOnSuspend.get()) {
    initSessionTab(contentToReuse);
  }

  return mySessionTab;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:XDebugSessionImpl.java

示例4: run

import com.intellij.execution.process.ProcessAdapter; //导入依赖的package包/类
public void run() {
  FileDocumentManager.getInstance().saveAllDocuments();

  // Use user-provided console if exist. Create new otherwise
  ConsoleView view = (myUserProvidedConsole != null ? myUserProvidedConsole :  createConsole(myProject));
  view.attachToProcess(myProcess);
  if (myAfterCompletion != null) {
    myProcess.addProcessListener(new ProcessAdapter() {
      @Override
      public void processTerminated(ProcessEvent event) {
        SwingUtilities.invokeLater(myAfterCompletion);
      }
    });
  }
  myProcess.startNotify();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:RunContentExecutor.java

示例5: doStart

import com.intellij.execution.process.ProcessAdapter; //导入依赖的package包/类
private void doStart() {
  if (myDebugMode) {
    AndroidDebugBridge.addClientChangeListener(this);
  }
  final MyDeviceChangeListener[] deviceListener = {null};
  getProcessHandler().addProcessListener(new ProcessAdapter() {
    @Override
    public void processWillTerminate(ProcessEvent event, boolean willBeDestroyed) {
      if (myDebugMode) {
        AndroidDebugBridge.removeClientChangeListener(AndroidRunningState.this);
      }
      if (deviceListener[0] != null) {
        Disposer.dispose(deviceListener[0]);
        AndroidDebugBridge.removeDeviceChangeListener(deviceListener[0]);
      }
      myStopped = true;
      synchronized (myLock) {
        myLock.notifyAll();
      }
    }
  });
  deviceListener[0] = prepareAndStartAppWhenDeviceIsOnline();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:AndroidRunningState.java

示例6: tryToCloseOldSessions

import com.intellij.execution.process.ProcessAdapter; //导入依赖的package包/类
private static void tryToCloseOldSessions(final Executor executor, Project project) {
  final ExecutionManager manager = ExecutionManager.getInstance(project);
  ProcessHandler[] processes = manager.getRunningProcesses();
  for (ProcessHandler process : processes) {
    final AndroidSessionInfo info = process.getUserData(ANDROID_SESSION_INFO);
    if (info != null) {
      process.addProcessListener(new ProcessAdapter() {
        @Override
        public void processTerminated(ProcessEvent event) {
          ApplicationManager.getApplication().invokeLater(new Runnable() {
            @Override
            public void run() {
              manager.getContentManager().removeRunContent(executor, info.getDescriptor());
            }
          });
        }
      });
      process.detachProcess();
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:AndroidDebugRunner.java

示例7: onProcessStarted

import com.intellij.execution.process.ProcessAdapter; //导入依赖的package包/类
public void onProcessStarted(final ProcessHandler process) {
  if (myTestsBuilt) return;
  process.addProcessListener(new ProcessAdapter() {
    @Override
    public void processTerminated(ProcessEvent event) {
      process.removeProcessListener(this);
      ApplicationManager.getApplication().invokeLater(new Runnable() {
        @Override
        public void run() {
          myStateInfo.setTerminated(myState);
          if (!myTestsBuilt && myProgressBar.getValue() == 0) {
            setStatusColor(ColorProgressBar.RED);
            setFraction(1.0);
            myState.append(ExecutionBundle.message("junit.running.info.failed.to.start.error.message"));
          }
        }
      });
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:JUnitStatusLine.java

示例8: SquirrelDebugProcess

import com.intellij.execution.process.ProcessAdapter; //导入依赖的package包/类
public SquirrelDebugProcess(@NotNull XDebugSession session, ExecutionEnvironment env, RunContentDescriptor executionResult) throws ExecutionException {
    super(session);
    session.setPauseActionSupported(false);

    myExecutionEnvironment = env;
    myRunningState = (SquirrelRunningState) getRunConfiguration().getState(myExecutionEnvironment.getExecutor(), myExecutionEnvironment);
    if (myRunningState == null) {
        throw new ExecutionException("Failed to execute a run configuration.");
    }

    myRunContentDescriptor = executionResult;

    getProcessHandler().addProcessListener(new ProcessAdapter() {
        @Override
        public void processWillTerminate(ProcessEvent event, boolean willBeDestroyed) {
            stop();
        }
    });

    myDebuggerConnection = new SquirrelDebuggerConnection(this, "127.0.0.1", 1234);  // todo make configurable
}
 
开发者ID:shvetsgroup,项目名称:squirrel-lang-idea-plugin,代码行数:22,代码来源:SquirrelDebugProcess.java

示例9: resolveUsingPantsGoal

import com.intellij.execution.process.ProcessAdapter; //导入依赖的package包/类
private void resolveUsingPantsGoal(
  @NotNull final ExternalSystemTaskId id,
  @NotNull PantsCompileOptionsExecutor executor,
  final ExternalSystemTaskNotificationListener listener,
  @NotNull DataNode<ProjectData> projectDataNode
) {
  final PantsResolver dependenciesResolver = new PantsResolver(executor);
  dependenciesResolver.resolve(
    new Consumer<String>() {
      @Override
      public void consume(String status) {
        listener.onStatusChange(new ExternalSystemTaskNotificationEvent(id, status));
      }
    },
    new ProcessAdapter() {
      @Override
      public void onTextAvailable(ProcessEvent event, Key outputType) {
        listener.onTaskOutput(id, event.getText(), outputType == ProcessOutputTypes.STDOUT);
      }
    }
  );
  dependenciesResolver.addInfoTo(projectDataNode);
}
 
开发者ID:pantsbuild,项目名称:intellij-pants-plugin,代码行数:24,代码来源:PantsSystemProjectResolver.java

示例10: loadProjectStructureFromScript

import com.intellij.execution.process.ProcessAdapter; //导入依赖的package包/类
@NotNull
private static String loadProjectStructureFromScript(
  @NotNull String scriptPath,
  @NotNull Consumer<String> statusConsumer,
  @Nullable ProcessAdapter processAdapter
) throws IOException, ExecutionException {
  final GeneralCommandLine commandLine = PantsUtil.defaultCommandLine(scriptPath);
  commandLine.setExePath(scriptPath);
  statusConsumer.consume("Executing " + PathUtil.getFileName(scriptPath));
  final ProcessOutput processOutput = PantsUtil.getCmdOutput(commandLine, processAdapter);
  if (processOutput.checkSuccess(LOG)) {
    return processOutput.getStdout();
  }
  else {
    throw new PantsExecutionException("Failed to update the project!", scriptPath, processOutput);
  }
}
 
开发者ID:pantsbuild,项目名称:intellij-pants-plugin,代码行数:18,代码来源:PantsCompileOptionsExecutor.java

示例11: loadProjectStructureFromTargets

import com.intellij.execution.process.ProcessAdapter; //导入依赖的package包/类
@NotNull
private String loadProjectStructureFromTargets(
  @NotNull Consumer<String> statusConsumer,
  @Nullable ProcessAdapter processAdapter
) throws IOException, ExecutionException {
  final File outputFile = FileUtil.createTempFile("pants_depmap_run", ".out");
  final GeneralCommandLine command = getPantsExportCommand(outputFile, statusConsumer);
  statusConsumer.consume("Resolving dependencies...");
  PantsMetrics.markExportStart();
  final ProcessOutput processOutput = getProcessOutput(command);
  PantsMetrics.markExportEnd();
  if (processOutput.getStdout().contains("no such option")) {
    throw new ExternalSystemException("Pants doesn't have necessary APIs. Please upgrade your pants!");
  }
  if (processOutput.checkSuccess(LOG)) {
    return FileUtil.loadFile(outputFile);
  }
  else {
    throw new PantsExecutionException("Failed to update the project!", command.getCommandLineString("pants"), processOutput);
  }
}
 
开发者ID:pantsbuild,项目名称:intellij-pants-plugin,代码行数:22,代码来源:PantsCompileOptionsExecutor.java

示例12: afterProcessStarted

import com.intellij.execution.process.ProcessAdapter; //导入依赖的package包/类
private void afterProcessStarted(final Runnable run) {
  class MyProcessAdapter extends ProcessAdapter {
    private boolean alreadyRun = false;

    public synchronized void run() {
      if(!alreadyRun) {
        alreadyRun = true;
        run.run();
      }
      removeProcessListener(this);
    }

    public void startNotified(ProcessEvent event) {
      run();
    }
  }
  MyProcessAdapter processListener = new MyProcessAdapter();
  addProcessListener(processListener);
  if(myExecutionResult != null) {
    if(myExecutionResult.getProcessHandler().isStartNotified()) {
      processListener.run();
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:25,代码来源:DebugProcessImpl.java

示例13: attachVM

import com.intellij.execution.process.ProcessAdapter; //导入依赖的package包/类
protected DebuggerSession attachVM(final RemoteConnection remoteConnection, final boolean pollConnection)
        throws InvocationTargetException, InterruptedException {
  final RemoteState remoteState = new RemoteStateState(myProject, remoteConnection);

  final DebuggerSession[] debuggerSession = new DebuggerSession[1];
  UIUtil.invokeAndWaitIfNeeded(new Runnable() {
    @Override
    public void run() {
      try {
        debuggerSession[0] = attachVirtualMachine(remoteState, remoteConnection, pollConnection);
      }
      catch (ExecutionException e) {
        fail(e.getMessage());
      }
    }
  });
  debuggerSession[0].getProcess().getExecutionResult().getProcessHandler().addProcessListener(new ProcessAdapter() {
    @Override
    public void onTextAvailable(ProcessEvent event, Key outputType) {
      print(event.getText(), outputType);
    }
  });
  return debuggerSession[0];
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:25,代码来源:DebuggerTestCase.java

示例14: startProcess

import com.intellij.execution.process.ProcessAdapter; //导入依赖的package包/类
@NotNull
protected OSProcessHandler startProcess() throws ExecutionException {
  final OSProcessHandler handler = JavaCommandLineStateUtil.startProcess(createCommandLine());
  ProcessTerminatedListener.attach(handler, myProject, JavadocBundle.message("javadoc.generate.exited"));
  handler.addProcessListener(new ProcessAdapter() {
    public void processTerminated(ProcessEvent event) {
      if (OPEN_IN_BROWSER) {
        File url = new File(OUTPUT_DIRECTORY, INDEX_HTML);
        if (url.exists() && event.getExitCode() == 0) {
          BrowserUtil.browse(url);
        }
      }
    }
  });
  return handler;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:JavadocConfiguration.java

示例15: init

import com.intellij.execution.process.ProcessAdapter; //导入依赖的package包/类
public XDebugSessionTab init(final XDebugProcess process, @NotNull final XDebugSessionData sessionData) {
  LOG.assertTrue(myDebugProcess == null);
  myDebugProcess = process;
  mySessionData = sessionData;

  if (autoInitBreakpoints) {
    initBreakpoints();
  }

  myDebugProcess.getProcessHandler().addProcessListener(new ProcessAdapter() {
    @Override
    public void processTerminated(final ProcessEvent event) {
      stopImpl();
    }
  });
  //todo[nik] make 'createConsole()' method return ConsoleView
  myConsoleView = (ConsoleView)myDebugProcess.createConsole();
  if (!myShowTabOnSuspend) {
    initSessionTab();
  }

  return mySessionTab;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:XDebugSessionImpl.java


注:本文中的com.intellij.execution.process.ProcessAdapter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。