本文整理匯總了Java中org.eclipse.debug.core.model.IProcess類的典型用法代碼示例。如果您正苦於以下問題:Java IProcess類的具體用法?Java IProcess怎麽用?Java IProcess使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
IProcess類屬於org.eclipse.debug.core.model包,在下文中一共展示了IProcess類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: waitUntilLaunchTerminates
import org.eclipse.debug.core.model.IProcess; //導入依賴的package包/類
/**
* Waits until {@code launch} terminates or {@code monitor} is canceled. if the monitor is
* canceled, attempts to terminate the launch before returning.
*
* @return true if the launch terminated normally; false otherwise
*/
@VisibleForTesting
static boolean waitUntilLaunchTerminates(ILaunch launch, IProgressMonitor monitor)
throws InterruptedException, DebugException {
while (!launch.isTerminated() && !monitor.isCanceled()) {
Thread.sleep(100 /*ms*/);
}
if (monitor.isCanceled()) {
launch.terminate();
return false;
}
for (IProcess process : launch.getProcesses()) {
if (process.getExitValue() != 0) {
return false;
}
}
return true;
}
開發者ID:GoogleCloudPlatform,項目名稱:google-cloud-eclipse,代碼行數:25,代碼來源:FlexMavenPackagedProjectStagingDelegate.java
示例2: testWaitUntilLaunchTerminates_atLeastOneNonZeroExit
import org.eclipse.debug.core.model.IProcess; //導入依賴的package包/類
@Test
public void testWaitUntilLaunchTerminates_atLeastOneNonZeroExit()
throws DebugException, InterruptedException {
IProcess process = mock(IProcess.class);
when(process.getExitValue()).thenReturn(0);
IProcess nonZeroExitProcess = mock(IProcess.class);
when(nonZeroExitProcess.getExitValue()).thenReturn(1);
ILaunch launch = mock(ILaunch.class);
when(launch.isTerminated()).thenReturn(true);
when(launch.getProcesses()).thenReturn(new IProcess[] {process, nonZeroExitProcess});
boolean normalExit = FlexMavenPackagedProjectStagingDelegate.waitUntilLaunchTerminates(
launch, new NullProgressMonitor());
assertFalse(normalExit);
}
開發者ID:GoogleCloudPlatform,項目名稱:google-cloud-eclipse,代碼行數:17,代碼來源:FlexMavenPackagedProjectStagingDelegateTest.java
示例3: onAfterCodeServerStarted
import org.eclipse.debug.core.model.IProcess; //導入依賴的package包/類
private void onAfterCodeServerStarted(DebugEvent event) {
if (!(event.getSource() instanceof IProcess)) {
return;
}
IProcess runtimeProcess = (IProcess) event.getSource();
final ILaunch launch = runtimeProcess.getLaunch();
IProcess[] processes = launch.getProcesses();
final IProcess process = processes[0];
// Look for the links in the sdm console output
consoleStreamListenerCodeServer = new IStreamListener() {
@Override
public void streamAppended(String text, IStreamMonitor monitor) {
displayCodeServerUrlInDevMode(launch, text);
}
};
// Listen to Console output
streamMonitorCodeServer = process.getStreamsProxy().getOutputStreamMonitor();
streamMonitorCodeServer.addListener(consoleStreamListenerCodeServer);
}
示例4: getFlusher
import org.eclipse.debug.core.model.IProcess; //導入依賴的package包/類
private ConsoleStreamFlusher getFlusher(Object context) {
if (context instanceof IEvaluationContext) {
IEvaluationContext evaluationContext = (IEvaluationContext) context;
Object o = evaluationContext.getVariable(ISources.ACTIVE_PART_NAME);
if (!(o instanceof IWorkbenchPart)) {
return null;
}
IWorkbenchPart part = (IWorkbenchPart) o;
if (part instanceof IConsoleView && ((IConsoleView) part).getConsole() instanceof IConsole) {
IConsole activeConsole = (IConsole) ((IConsoleView) part).getConsole();
IProcess process = activeConsole.getProcess();
return (ConsoleStreamFlusher) process.getAdapter(ConsoleStreamFlusher.class);
}
}
return null;
}
示例5: waitForEmulator
import org.eclipse.debug.core.model.IProcess; //導入依賴的package包/類
/**
* Wait for Android Emulator
* @param emulatorProcess android emulator process
* @param monitor progress monitor to be checked for cancellation
* @throws CoreException
*/
public void waitForEmulator(IProcess emulatorProcess, IProgressMonitor monitor) throws CoreException{
while(!emulatorProcess.isTerminated()){ //check if process is terminated - could not start etc..
List<AndroidDevice> devices = this.listDevices();
if(devices != null ){
for (AndroidDevice androidDevice : devices) {
if(androidDevice.isEmulator() && androidDevice.getState() == AndroidDevice.STATE_DEVICE)
return;
}
}
try {
Thread.sleep(200);
} catch (InterruptedException e) {
throw new CoreException(new Status(IStatus.ERROR, AndroidCore.PLUGIN_ID, "Exception occured while waiting for emulator",e));
}
if (monitor.isCanceled()){
throw new CoreException(new Status(IStatus.ERROR, AndroidCore.PLUGIN_ID, "Operation cancelled"));
}
}
throw new CoreException(new Status(IStatus.ERROR, AndroidCore.PLUGIN_ID, "Android emulator was terminated"));
}
示例6: exec
import org.eclipse.debug.core.model.IProcess; //導入依賴的package包/類
/**
* Executes the given command and returns a handle to the
* process. Should only be used if access to {@link IProcess}
* instance is desired.
*
* @param command
* @param workingDirectory
* @param monitor
* @param envp
* @param launchConfiguration
* @param outStreamListener
* @param errorStreamListener
* @return the process
* @throws CoreException
*/
public IProcess exec(String[] command, File workingDirectory, IProgressMonitor monitor,
String[] envp, ILaunchConfiguration launchConfiguration,
IStreamListener outStreamListener, IStreamListener errorStreamListener ) throws CoreException{
checkCommands(command);
checkWorkingDirectory(workingDirectory);
if(monitor == null ){
monitor = new NullProgressMonitor();
}
if (envp == null && launchConfiguration != null ){
envp = DebugPlugin.getDefault().getLaunchManager().getEnvironment(launchConfiguration);
}
if (monitor.isCanceled()) {
return null;
}
Process process = DebugPlugin.exec(command, workingDirectory, envp);
Map<String, String> processAttributes = generateProcessAttributes(command, launchConfiguration);
Launch launch = new Launch(launchConfiguration, "run", null);
IProcess prcs = DebugPlugin.newProcess(launch, process, command[0], processAttributes);
setTracing(command, outStreamListener, errorStreamListener, prcs);
DebugPlugin.getDefault().getLaunchManager().addLaunch(launch);
return prcs;
}
示例7: setTracing
import org.eclipse.debug.core.model.IProcess; //導入依賴的package包/類
private void setTracing(String[] command, IStreamListener outStreamListener, IStreamListener errorStreamListener,
IProcess prcs) {
if(HybridCore.DEBUG){
HybridCore.trace("Creating TracingStreamListeners for " + Arrays.toString(command));
outStreamListener = new TracingStreamListener(outStreamListener);
errorStreamListener = new TracingStreamListener(outStreamListener);
}
if( outStreamListener != null ){
prcs.getStreamsProxy().getOutputStreamMonitor().addListener(outStreamListener);
//See bug 121454. Ensure that output to fast processes is processed
outStreamListener.streamAppended(prcs.getStreamsProxy().getOutputStreamMonitor().getContents(), null);
}
if( errorStreamListener != null ){
prcs.getStreamsProxy().getErrorStreamMonitor().addListener(errorStreamListener);
//See bug 121454. Ensure that output to fast processes is processed
errorStreamListener.streamAppended(prcs.getStreamsProxy().getErrorStreamMonitor().getContents(), null);
}
}
示例8: getLaunchConfiguration
import org.eclipse.debug.core.model.IProcess; //導入依賴的package包/類
protected ILaunchConfiguration getLaunchConfiguration(String label){
ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType type = manager.getLaunchConfigurationType(IExternalToolConstants.ID_PROGRAM_LAUNCH_CONFIGURATION_TYPE);
try {
ILaunchConfiguration cfg = type.newInstance(null, "cordova");
ILaunchConfigurationWorkingCopy wc = cfg.getWorkingCopy();
wc.setAttribute(IProcess.ATTR_PROCESS_LABEL, label);
if(additionalEnvProps != null && !additionalEnvProps.isEmpty()){
wc.setAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES,additionalEnvProps);
}
cfg = wc.doSave();
return cfg;
} catch (CoreException e) {
e.printStackTrace();
}
return null;
}
示例9: checkErrorMessage
import org.eclipse.debug.core.model.IProcess; //導入依賴的package包/類
/**
* Checks and forwards an error from the specified process
*
* @param process
* @throws CoreException
*/
private void checkErrorMessage( IProcess process ) throws CoreException
{
IStreamsProxy streamsProxy = process.getStreamsProxy( );
if ( streamsProxy != null )
{
String errorMessage = streamsProxy.getErrorStreamMonitor( )
.getContents( );
if ( errorMessage.length( ) == 0 )
{
errorMessage = streamsProxy.getOutputStreamMonitor( )
.getContents( );
}
if ( errorMessage.length( ) != 0 )
{
abort( errorMessage,
null,
IJavaLaunchConfigurationConstants.ERR_VM_LAUNCH_ERROR );
}
}
}
示例10: removeConsoleLaunch
import org.eclipse.debug.core.model.IProcess; //導入依賴的package包/類
/**
* Removes a launch from a pydev console and stops the related process (may be called from a thread).
*
* @param launch the launch to be removed
*/
public void removeConsoleLaunch(ILaunch launch) {
boolean removed;
synchronized (consoleLaunchesLock) {
removed = consoleLaunches.remove(launch);
}
if (removed) {
IProcess[] processes = launch.getProcesses();
if (processes != null) {
for (IProcess p : processes) {
try {
p.terminate();
} catch (Exception e) {
Log.log(e);
}
}
}
}
}
示例11: getEncodingFromFrame
import org.eclipse.debug.core.model.IProcess; //導入依賴的package包/類
public static String getEncodingFromFrame(PyStackFrame selectedFrame) {
try {
IDebugTarget adapter = (IDebugTarget) selectedFrame.getAdapter(IDebugTarget.class);
if (adapter == null) {
return "UTF-8";
}
IProcess process = adapter.getProcess();
if (process == null) {
return "UTF-8";
}
ILaunch launch = process.getLaunch();
if (launch == null) {
Log.log("Unable to get launch for: " + process);
return "UTF-8";
}
return getEncodingFromLaunch(launch);
} catch (Exception e) {
Log.log(e);
return "UTF-8";
}
}
示例12: PyDebugTarget
import org.eclipse.debug.core.model.IProcess; //導入依賴的package包/類
public PyDebugTarget(ILaunch launch, IProcess process, IPath[] file, AbstractRemoteDebugger debugger,
IProject project, boolean isAuxiliaryDebugTarget) {
this.launch = launch;
this.process = process;
this.file = file;
this.debugger = debugger;
this.threads = new PyThread[0];
this.project = project;
this.isAuxiliaryDebugTarget = isAuxiliaryDebugTarget;
launch.addDebugTarget(this);
debugger.addTarget(this);
IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager();
breakpointManager.addBreakpointListener(this);
PyExceptionBreakPointManager.getInstance().addListener(this);
PyPropertyTraceManager.getInstance().addListener(this);
// we have to know when we get removed, so that we can shut off the debugger
DebugPlugin.getDefault().getLaunchManager().addLaunchListener(this);
}
示例13: init
import org.eclipse.debug.core.model.IProcess; //導入依賴的package包/類
@Override
public void init(IPageBookViewPage page, IConsole console) {
if (!(console instanceof ProcessConsole)) {
return;
}
ProcessConsole processConsole = (ProcessConsole) console;
IProcess process = processConsole.getProcess();
if (process == null) {
return;
}
String attribute = process.getAttribute(Constants.PYDEV_DEBUG_IPROCESS_ATTR);
if (!Constants.PYDEV_DEBUG_IPROCESS_ATTR_TRUE.equals(attribute)) {
//Only provide the console page
return;
}
if (page instanceof IOConsolePage) {
final CurrentPyStackFrameForConsole currentPyStackFrameForConsole = new CurrentPyStackFrameForConsole(
console);
IOConsolePage consolePage = (IOConsolePage) page;
this.promptOverlay = new PromptOverlay(consolePage, processConsole, currentPyStackFrameForConsole);
}
}
示例14: init
import org.eclipse.debug.core.model.IProcess; //導入依賴的package包/類
@Override
public void init(final IConsole console) {
IProcess process = console.getProcess();
if (process != null) {
ILaunch launch = process.getLaunch();
if (launch != null) {
initLaunchConfiguration(launch.getLaunchConfiguration());
}
}
this.linkContainer = new ILinkContainer() {
@Override
public void addLink(IHyperlink link, int offset, int length) {
console.addLink(link, offset, length);
}
@Override
public String getContents(int offset, int length) throws BadLocationException {
return console.getDocument().get(offset, length);
}
};
}
示例15: update
import org.eclipse.debug.core.model.IProcess; //導入依賴的package包/類
@Override
public void update() {
IProcess process = console.getProcess();
setEnabled(true);
KeySequence binding = KeyBindingHelper
.getCommandKeyBinding("org.python.pydev.debug.ui.actions.relaunchLastAction");
String str = binding != null ? "(" + binding.format() + " with focus on editor)" : "(unbinded)";
if (process.canTerminate()) {
this.setImageDescriptor(SharedUiPlugin.getImageCache().getDescriptor(UIConstants.RELAUNCH));
this.setToolTipText("Restart the current launch. " + str);
} else {
this.setImageDescriptor(SharedUiPlugin.getImageCache().getDescriptor(UIConstants.RELAUNCH1));
this.setToolTipText("Relaunch with the same configuration." + str);
}
}