本文整理汇总了Java中com.intellij.execution.process.ProcessEvent类的典型用法代码示例。如果您正苦于以下问题:Java ProcessEvent类的具体用法?Java ProcessEvent怎么用?Java ProcessEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ProcessEvent类属于com.intellij.execution.process包,在下文中一共展示了ProcessEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processTerminated
import com.intellij.execution.process.ProcessEvent; //导入依赖的package包/类
@Override
public void processTerminated(ProcessEvent processEvent) {
executionCounter.setEndTime(System.currentTimeMillis());
if (processEvent.getExitCode() == 0) {
try {
LivingDocExecution execution = getLivingDocExecution();
updateStatusLine(execution);
File resultFile = loadResultFile(execution);
BrowserLauncher browser = new BrowserLauncherImpl();
browser.open(resultFile.getPath());
} catch (IOException | LivingDocException e) {
LOG.error(e);
}
} else {
statusLine.setText(I18nSupport.getValue("run.execution.error.process"));
statusLine.setStatusColor(ColorProgressBar.RED);
statusLine.setFraction(100d);
}
}
示例2: attachVM
import com.intellij.execution.process.ProcessEvent; //导入依赖的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];
}
示例3: startProcess
import com.intellij.execution.process.ProcessEvent; //导入依赖的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;
}
示例4: onTextAvailable
import com.intellij.execution.process.ProcessEvent; //导入依赖的package包/类
@Override
public void onTextAvailable(ProcessEvent event, Key outputType) {
String text;
synchronized (this) {
if (myStoredLength > 2048) {
return;
}
text = event.getText();
if (StringUtil.isEmptyOrSpaces(text)) {
return;
}
myStoredLength += text.length();
}
try {
myOutput.append(text);
}
catch (IOException ignored) {
}
}
示例5: init
import com.intellij.execution.process.ProcessEvent; //导入依赖的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;
}
示例6: run
import com.intellij.execution.process.ProcessEvent; //导入依赖的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();
}
示例7: doStart
import com.intellij.execution.process.ProcessEvent; //导入依赖的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();
}
示例8: tryToCloseOldSessions
import com.intellij.execution.process.ProcessEvent; //导入依赖的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();
}
}
}
示例9: onProcessStarted
import com.intellij.execution.process.ProcessEvent; //导入依赖的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"));
}
}
});
}
});
}
示例10: notifyTextAvailable
import com.intellij.execution.process.ProcessEvent; //导入依赖的package包/类
@Override
public void notifyTextAvailable(String text, Key outputType) {
terminalOutputCapturer.onTextAvailable(new ProcessEvent(this, text), outputType);
text = filterText(text);
if (!StringUtil.isEmpty(text)) {
StringBuilder lastLine = getLastLineFor(outputType);
String currentLine = lastLine.append(text).toString();
lastLine.setLength(0);
currentLine = filterCombinedText(currentLine);
// check if current line presents some interactive output
boolean handled = handlePrompt(currentLine, outputType);
if (!handled) {
notify(currentLine, outputType, lastLine);
}
}
}
示例11: createAdditionalTabComponents
import com.intellij.execution.process.ProcessEvent; //导入依赖的package包/类
@Override
public void createAdditionalTabComponents(final AdditionalTabComponentManager manager, ProcessHandler startedProcess) {
if (myOutputType == OutputType.CONSOLE) {
final HighlightingOutputConsole console = new HighlightingOutputConsole(getProject(), myFileType);
XsltCommandLineState state = startedProcess.getUserData(XsltCommandLineState.STATE);
boolean debug = state != null && state.isDebugger();
boolean consoleTabAdded = false;
for (XsltRunnerExtension extension : XsltRunnerExtension.getExtensions(this, debug)) {
if (extension.createTabs(getProject(), manager, console, startedProcess)) {
consoleTabAdded = true;
}
}
if (!consoleTabAdded) {
manager.addAdditionalTabComponent(console, console.getTabTitle()); // TODO: verify parameter
}
final OutputTabAdapter listener = new OutputTabAdapter(startedProcess, console);
if (startedProcess.isStartNotified()) {
listener.startNotified(new ProcessEvent(startedProcess));
}
else {
startedProcess.addProcessListener(listener);
}
}
}
示例12: SquirrelDebugProcess
import com.intellij.execution.process.ProcessEvent; //导入依赖的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
}
示例13: resolveUsingPantsGoal
import com.intellij.execution.process.ProcessEvent; //导入依赖的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);
}
示例14: processTerminated
import com.intellij.execution.process.ProcessEvent; //导入依赖的package包/类
@Override
public void processTerminated( ProcessEvent event )
{
super.processTerminated( event );
int exitCode = event.getExitCode();
if( exitCode == EQUINOX_RESTART_EXIT_CODE )
{
ApplicationManager.getApplication().runReadAction( new Runnable()
{
@Override
public void run()
{
ProgramRunnerUtil.executeConfiguration( appModule.getProject(),
environment.getRunnerAndConfigurationSettings(), executor );
}
} );
}
}
示例15: afterProcessStarted
import com.intellij.execution.process.ProcessEvent; //导入依赖的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();
}
}
}