本文整理汇总了Java中org.netbeans.api.extexecution.ExecutionDescriptor类的典型用法代码示例。如果您正苦于以下问题:Java ExecutionDescriptor类的具体用法?Java ExecutionDescriptor怎么用?Java ExecutionDescriptor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ExecutionDescriptor类属于org.netbeans.api.extexecution包,在下文中一共展示了ExecutionDescriptor类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testCallback
import org.netbeans.api.extexecution.ExecutionDescriptor; //导入依赖的package包/类
public void testCallback() throws InterruptedException {
ExecutionDescriptor desc = new ExecutionDescriptor();
ExecutionService service = ExecutionService.newService(new Callable<Process>() {
@Override
public Process call() throws Exception {
return new TestProcess();
}
}, desc, "Test"); // NOI18N
CountDownLatch latch = new CountDownLatch(1);
TestCallback callback = new TestCallback(latch);
RerunAction action = new RerunAction();
action.setExecutionService(service);
action.setRerunCallback(callback);
action.actionPerformed(null);
assertTrue(latch.await(5, TimeUnit.SECONDS));
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:RerunActionTest.java
示例2: runRegular
import org.netbeans.api.extexecution.ExecutionDescriptor; //导入依赖的package包/类
private Future<Integer> runRegular() {
Charset charset = descriptor.charset;
if (charset == null) {
charset = execCharset;
}
Logger.getInstance().log(Level.FINE, "Input stream charset: {0}", charset);
ExecutionDescriptor descr =
new ExecutionDescriptor().controllable(descriptor.controllable).
frontWindow(descriptor.frontWindow).
preExecution(new PreExecution()).
inputVisible(descriptor.inputVisible).
inputOutput(descriptor.inputOutput).
outLineBased(descriptor.outLineBased).
showProgress(descriptor.showProgress).
postExecution(descriptor.postExecution).
noReset(!descriptor.resetInputOutputOnFinish).
errConvertorFactory(descriptor.errConvertorFactory).
outConvertorFactory(descriptor.outConvertorFactory).
charset(charset);
return ExecutionService.newService(processBuilder, descr, displayName).run();
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:NativeExecutionService.java
示例3: runInternal
import org.netbeans.api.extexecution.ExecutionDescriptor; //导入依赖的package包/类
@CheckForNull
private Future<Integer> runInternal(ExecutionDescriptor executionDescriptor, ExecutionDescriptor.InputProcessorFactory2 outProcessorFactory) {
Parameters.notNull("executionDescriptor", executionDescriptor); // NOI18N
final String error = ExternalExecutableValidator.validateCommand(executable, executableName);
if (error != null) {
if (warnUser) {
ExternalExecutableUserWarning euw = Lookup.getDefault().lookup(ExternalExecutableUserWarning.class);
if (euw == null) {
LOGGER.info("No implementation of "+ExternalExecutableUserWarning.class);
} else {
euw.displayError(error, optionsPath);
}
}
return null;
}
ProcessBuilder processBuilder = getProcessBuilder();
executionDescriptor = getExecutionDescriptor(executionDescriptor, outProcessorFactory);
return ExecutionService.newService(processBuilder, executionDescriptor, getDisplayName()).run();
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:ExternalExecutable.java
示例4: executeEclipseCommand
import org.netbeans.api.extexecution.ExecutionDescriptor; //导入依赖的package包/类
public static void executeEclipseCommand(PlayProject playProject) {
try {
addEclipseSBTPluginIfNeeded(playProject);
ExecutionDescriptor descriptor = new ExecutionDescriptor()
.frontWindow(true)
.inputVisible(true)
.showProgress(true);
ExternalProcessBuilder processBuilderEclipseCommand = new ExternalProcessBuilder(PlayProjectUtil.getActivatorExecutablePath())
.workingDirectory(new File(playProject.getProjectDirectory().getPath()))
.addArgument("eclipse");
processBuilderEclipseCommand = PlayProjectUtil.addJavaHomeVariable(processBuilderEclipseCommand);
ExecutionService serviceEclipseCommand = ExecutionService.newService(processBuilderEclipseCommand,
descriptor,
"Configuring (" + playProject.getProjectName() + ") Classpath");
Future<Integer> eclipseCommandFuture = serviceEclipseCommand.run();
eclipseCommandFuture.get(); //wait for this to finish before leave this method
} catch (InterruptedException | ExecutionException ex) {
ExceptionManager.logException(ex);
}
}
开发者ID:pedrohidalgo,项目名称:pleasure,代码行数:26,代码来源:ClassPathUtil.java
示例5: attachOutputProcessor
import org.netbeans.api.extexecution.ExecutionDescriptor; //导入依赖的package包/类
/**
* Attach a Processor to collect the output of the running process
*/
public void attachOutputProcessor()
{
descriptor = descriptor.outProcessorFactory(new ExecutionDescriptor.InputProcessorFactory()
{
public InputProcessor newInputProcessor()
{
return outProcessor;
}
public InputProcessor newInputProcessor(InputProcessor defaultProcessor)
{
return outProcessor;
}
});
}
开发者ID:tcolar,项目名称:fantomidemodule,代码行数:20,代码来源:FanExecution.java
示例6: detectDefaultWebBrowser
import org.netbeans.api.extexecution.ExecutionDescriptor; //导入依赖的package包/类
private static String detectDefaultWebBrowser() {
// XXX hotfix for #233047
// assert !EventQueue.isDispatchThread();
// #233145
if (!XDG_SETTINGS_AVAILABLE) {
return null;
}
OutputProcessorFactory outputProcessorFactory = new OutputProcessorFactory();
ExternalProcessBuilder processBuilder = new ExternalProcessBuilder(XDG_SETTINGS_COMMAND) // NOI18N
.addArgument("get") // NOI18N
.addArgument("default-web-browser"); // NOI18N
ExecutionDescriptor silentDescriptor = new ExecutionDescriptor()
.inputOutput(InputOutput.NULL)
.inputVisible(false)
.frontWindow(false)
.showProgress(false)
.outProcessorFactory(outputProcessorFactory);
Future<Integer> result = ExecutionService.newService(processBuilder, silentDescriptor, "Detecting default web browser") // NOI18N
.run();
try {
result.get(10, TimeUnit.SECONDS);
} catch (InterruptedException | ExecutionException | TimeoutException ex) {
LOGGER.log(Level.INFO, null, ex);
}
String output = outputProcessorFactory.getOutput();
if (output == null) {
return null;
}
return output.toLowerCase(Locale.US);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:31,代码来源:NbDefaultUnixBrowserImpl.java
示例7: getDescriptor
import org.netbeans.api.extexecution.ExecutionDescriptor; //导入依赖的package包/类
private ExecutionDescriptor getDescriptor(Runnable postTask) {
return new ExecutionDescriptor()
.inputOutput(IOProvider.getDefault().getIO(Bundle.Less_compile(), false))
.inputVisible(false)
.frontWindow(false)
.frontWindowOnError(CssPrepOptions.getInstance().getLessOutputOnError())
.noReset(true)
.showProgress(true)
.postExecution(postTask);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:LessExecutable.java
示例8: getSilentDescriptor
import org.netbeans.api.extexecution.ExecutionDescriptor; //导入依赖的package包/类
private static ExecutionDescriptor getSilentDescriptor() {
return new ExecutionDescriptor()
.inputOutput(InputOutput.NULL)
.inputVisible(false)
.frontWindow(false)
.showProgress(false);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:LessExecutable.java
示例9: getDescriptor
import org.netbeans.api.extexecution.ExecutionDescriptor; //导入依赖的package包/类
private ExecutionDescriptor getDescriptor(Runnable postTask) {
return new ExecutionDescriptor()
.inputOutput(IOProvider.getDefault().getIO(Bundle.SassCli_compile(), false))
.inputVisible(false)
.frontWindow(false)
.frontWindowOnError(CssPrepOptions.getInstance().getSassOutputOnError())
.noReset(true)
.showProgress(true)
.postExecution(postTask);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:SassCli.java
示例10: runAndWait
import org.netbeans.api.extexecution.ExecutionDescriptor; //导入依赖的package包/类
/**
* Run this executable with the given execution descriptor and optional output processor factory, <b>blocking but not blocking the UI thread</b>
* (it displays progress dialog if it is running in it).
* @param executionDescriptor execution descriptor to be used
* @param outProcessorFactory output processor factory to be used, can be {@code null}
* @param progressMessage message displayed if the task is running in the UI thread
* @return exit code of the process or {@code null} if any error occured
* @throws ExecutionException if any error occurs
* @see #runAndWait(String)
* @see #runAndWait(ExecutionDescriptor, String)
*/
@CheckForNull
public Integer runAndWait(@NonNull ExecutionDescriptor executionDescriptor, @NullAllowed ExecutionDescriptor.InputProcessorFactory2 outProcessorFactory,
@NonNull final String progressMessage) throws ExecutionException {
Parameters.notNull("progressMessage", progressMessage); // NOI18N
final Future<Integer> result = run(executionDescriptor, outProcessorFactory);
if (result == null) {
return null;
}
final AtomicReference<ExecutionException> executionException = new AtomicReference<>();
if (Mutex.EVENT.isReadAccess()) { // Is EDT
if (!result.isDone()) {
try {
// let's wait in EDT to avoid flashing dialogs
getResult(result, 90L);
} catch (TimeoutException ex) {
BaseProgressUtils.showProgressDialogAndRun(new Runnable() {
@Override
public void run() {
try {
getResult(result);
} catch (ExecutionException extEx) {
executionException.set(extEx);
}
}
}, progressMessage);
}
}
}
if (executionException.get() != null) {
throw executionException.get();
}
return getResult(result);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:45,代码来源:ExternalExecutable.java
示例11: getExecutionDescriptor
import org.netbeans.api.extexecution.ExecutionDescriptor; //导入依赖的package包/类
private ExecutionDescriptor getExecutionDescriptor(ExecutionDescriptor executionDescriptor, ExecutionDescriptor.InputProcessorFactory2 outProcessorFactory) {
final List<ExecutionDescriptor.InputProcessorFactory2> inputProcessors = new CopyOnWriteArrayList<>();
// colors
ExecutionDescriptor.InputProcessorFactory2 infoOutProcessorFactory = getInfoOutputProcessorFactory();
if (infoOutProcessorFactory != null) {
inputProcessors.add(infoOutProcessorFactory);
}
// output
ExecutionDescriptor.InputProcessorFactory2 outputOutProcessorFactory = getOutputProcessorFactory();
if (outputOutProcessorFactory != null) {
inputProcessors.add(outputOutProcessorFactory);
}
// file output
ExecutionDescriptor.InputProcessorFactory2 fileOutProcessorFactory = getFileOutputProcessorFactory();
if (fileOutProcessorFactory != null) {
inputProcessors.add(fileOutProcessorFactory);
if (fileOutputOnly) {
executionDescriptor = executionDescriptor
.inputOutput(InputOutput.NULL)
.frontWindow(false)
.frontWindowOnError(false);
}
}
if (outProcessorFactory != null) {
inputProcessors.add(outProcessorFactory);
}
if (!inputProcessors.isEmpty()) {
executionDescriptor = executionDescriptor.outProcessorFactory(new ExecutionDescriptor.InputProcessorFactory2() {
@Override
public InputProcessor newInputProcessor(InputProcessor defaultProcessor) {
InputProcessor[] processors = new InputProcessor[inputProcessors.size()];
for (int i = 0; i < inputProcessors.size(); ++i) {
processors[i] = inputProcessors.get(i).newInputProcessor(defaultProcessor);
}
return InputProcessors.proxy(processors);
}
});
}
return executionDescriptor;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:41,代码来源:ExternalExecutable.java
示例12: getInfoOutputProcessorFactory
import org.netbeans.api.extexecution.ExecutionDescriptor; //导入依赖的package包/类
private ExecutionDescriptor.InputProcessorFactory2 getInfoOutputProcessorFactory() {
if (noInfo) {
// no info
return null;
}
return new ExecutionDescriptor.InputProcessorFactory2() {
@Override
public InputProcessor newInputProcessor(InputProcessor defaultProcessor) {
return new InfoInputProcessor(defaultProcessor, fullCommand);
}
};
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:ExternalExecutable.java
示例13: getOutputProcessorFactory
import org.netbeans.api.extexecution.ExecutionDescriptor; //导入依赖的package包/类
private ExecutionDescriptor.InputProcessorFactory2 getOutputProcessorFactory() {
if (noOutput) {
// no output
return null;
}
return new ExecutionDescriptor.InputProcessorFactory2() {
@Override
public InputProcessor newInputProcessor(InputProcessor defaultProcessor) {
return defaultProcessor;
}
};
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:ExternalExecutable.java
示例14: getFileOutputProcessorFactory
import org.netbeans.api.extexecution.ExecutionDescriptor; //导入依赖的package包/类
private ExecutionDescriptor.InputProcessorFactory2 getFileOutputProcessorFactory() {
if (fileOutput == null) {
return null;
}
return new ExecutionDescriptor.InputProcessorFactory2() {
@Override
public InputProcessor newInputProcessor(InputProcessor defaultProcessor) {
return new RedirectOutputProcessor(fileOutput);
}
};
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:ExternalExecutable.java
示例15: actionPerformed
import org.netbeans.api.extexecution.ExecutionDescriptor; //导入依赖的package包/类
@Override
public void actionPerformed(ActionEvent ev) {
FileObject fileObject = context.getPrimaryFile();
String fileDisplayName = FileUtil.getFileDisplayName(fileObject);
ExecutionDescriptor descriptor = new ExecutionDescriptor()
.frontWindow(true)
.showProgress(true)
.inputVisible(true)
.controllable(true)
.preExecution(() -> {
try {
Runtime.getRuntime().exec("chmod +x " + fileDisplayName).waitFor();
} catch (IOException | InterruptedException ex) {
Exceptions.printStackTrace(ex);
}
LifecycleManager.getDefault().saveAll();
});
ExternalProcessBuilder processBuilder = new ExternalProcessBuilder(fileDisplayName);
ExecutionService service = ExecutionService.newService(
processBuilder, descriptor, fileDisplayName);
service.run();
}
开发者ID:pedrohidalgo,项目名称:nbshell,代码行数:28,代码来源:RunFileAction.java
示例16: AbstractElectronAction
import org.netbeans.api.extexecution.ExecutionDescriptor; //导入依赖的package包/类
public AbstractElectronAction(DataObject context) {
this.context = context;
this.preferences = new ElectronPreferences();
this.arguments = new ArrayList<>();
descriptor = new ExecutionDescriptor()
.frontWindow(true)
.frontWindowOnError(true)
.controllable(true)
.showProgress(true)
.errLineBased(true);
}
开发者ID:mario-s,项目名称:netbeans-electron-support,代码行数:12,代码来源:AbstractElectronAction.java
示例17: launchEmulator
import org.netbeans.api.extexecution.ExecutionDescriptor; //导入依赖的package包/类
public Future<IDevice> launchEmulator(AvdInfo avdInfo, LaunchConfiguration launchCfg) {
final String cookie = Long.toString(System.currentTimeMillis());
ExecutionDescriptor descriptor = new ExecutionDescriptor()
.frontWindow(true);
ExternalProcessBuilder processBuilder = new ExternalProcessBuilder(getEmulatorBinaryPath())
.addArgument(FLAG_AVD).addArgument(avdInfo.getName())
.addArgument(FLAG_PROP).addArgument(LAUNCH_COOKIE + "=" + cookie);
// TODO support quoting
for (String arg : Splitter.on(' ').omitEmptyStrings().split(launchCfg.getEmulatorOptions())) {
processBuilder = processBuilder.addArgument(arg);
}
ExecutionService service = ExecutionService.newService(
processBuilder, descriptor, "Android emulator");
Future<Integer> taskStatus = service.run();
return EXECUTOR.submit(new Callable<IDevice>() {
@Override
public IDevice call() throws Exception {
synchronized (connectLock) {
while (true) {
for (IDevice device : connectedDevices) {
if (device.isOnline()) {
ProgressHandle handle = ProgressHandle.createHandle("Emulator starting");
handle.start();
while (true) {
String property = device.getSystemProperty("sys.boot_completed").get();
if (property != null) {
break;
}
}
handle.finish();
LOG.log(Level.INFO, "Started emulator device connected.");
return device;
}
}
connectLock.wait();
}
}
}
});
}
开发者ID:NBANDROIDTEAM,项目名称:NBANDROID-V2,代码行数:45,代码来源:EmulatorLauncher.java
示例18: runCommand
import org.netbeans.api.extexecution.ExecutionDescriptor; //导入依赖的package包/类
private Future<Integer> runCommand(List<String> params, String title) {
ExecutionDescriptor descriptor = DEFAULT_SILENT_DESCRIPTOR;
return run(descriptor, params, title);
}
开发者ID:junichi11,项目名称:netbeans-textlint-plugin,代码行数:5,代码来源:Textlint.java
示例19: run
import org.netbeans.api.extexecution.ExecutionDescriptor; //导入依赖的package包/类
private Future<Integer> run(ExecutionDescriptor executionDescriptor, List<String> params, String title) {
ProcessBuilder processBuilder = createProcessBuilder(getAllParams(params));
return ExecutionService.newService(processBuilder, executionDescriptor, title).run();
}
开发者ID:junichi11,项目名称:netbeans-textlint-plugin,代码行数:5,代码来源:Textlint.java
示例20: getOutputProcessorFactory
import org.netbeans.api.extexecution.ExecutionDescriptor; //导入依赖的package包/类
private ExecutionDescriptor.InputProcessorFactory2 getOutputProcessorFactory(final LineProcessor lineProcessor) {
return inputProcessor -> {
return InputProcessors.ansiStripping(InputProcessors.bridge(lineProcessor));
};
}
开发者ID:junichi11,项目名称:netbeans-textlint-plugin,代码行数:6,代码来源:Textlint.java
注:本文中的org.netbeans.api.extexecution.ExecutionDescriptor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论