org.openide.windows.IOProvider Java Examples
The following examples show how to use
org.openide.windows.IOProvider.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProcessListAction.java From netbeans with Apache License 2.0 | 6 votes |
@NbBundle.Messages({ "# {0} - container id", "MSG_ProcessList=Processes in {0}" }) @Override protected void performAction(DockerContainer container) throws DockerException { try { DockerAction facade = new DockerAction(container.getInstance()); JSONObject processList = facade.getRunningProcessesList(container); InputOutput io = IOProvider.getDefault().getIO(Bundle.MSG_ProcessList(container.getShortId()), false); io.getOut().reset(); io.getOut().println(processList.get(TITLES_JSON_KEY).toString()); io.getOut().println(processList.get(PROCESSES_JSON_KEY).toString()); io.getOut().close(); io.getErr().close(); io.select(); } catch (IOException ex) { throw new DockerException(ex); } }
Example #2
Source File: InputOutputManagerTest.java From netbeans with Apache License 2.0 | 6 votes |
public void testOrder() { InputOutput firstIO = IOProvider.getDefault().getIO("test", true); InputOutputManager.addInputOutput( new InputOutputManager.InputOutputData(firstIO, "test", null, null, null)); InputOutput secondIO = IOProvider.getDefault().getIO("test #1", true); InputOutputManager.addInputOutput( new InputOutputManager.InputOutputData(secondIO, "test #1", null, null, null)); InputOutputManager.InputOutputData data = InputOutputManager.getInputOutput("test", false, null); assertEquals("test", data.getDisplayName()); assertEquals(firstIO, data.getInputOutput()); data = InputOutputManager.getInputOutput("test", false, null); assertEquals("test #1", data.getDisplayName()); assertEquals(secondIO, data.getInputOutput()); data = InputOutputManager.getInputOutput("test", false, null); assertNull(data); }
Example #3
Source File: InputOutputManagerTest.java From netbeans with Apache License 2.0 | 6 votes |
public void testGetRequired() { InputOutput io = IOProvider.getDefault().getIO("test", true); InputOutputManager.addInputOutput( new InputOutputManager.InputOutputData(io, "test", null, null, null)); InputOutputManager.InputOutputData data = InputOutputManager.getInputOutput(io); assertEquals("test", data.getDisplayName()); assertEquals(io, data.getInputOutput()); assertNull(data.getRerunAction()); assertNull(data.getStopAction()); data = InputOutputManager.getInputOutput(io); assertNull(data); InputOutputManager.addInputOutput( new InputOutputManager.InputOutputData(io, "test", null, null, null)); data = InputOutputManager.getInputOutput(io); assertNotNull(data); }
Example #4
Source File: JsTestDriverImpl.java From netbeans with Apache License 2.0 | 6 votes |
@Override public void startServer(File jsTestDriverJar, int port, boolean strictMode, ServerListener listener) { if (wasStartedExternally(port)) { externallyStarted = true; IOProvider.getDefault().getIO("js-test-driver Server", false).getOut(). println("Port "+port+" is busy. Server was started outside of the IDE."); return; } ExecutionDescriptor descriptor = new ExecutionDescriptor(). controllable(false). // outLineBased(true). // errLineBased(true). outProcessorFactory(new ServerInputProcessorFactory(listener)). frontWindowOnError(true); File extjar = InstalledFileLocator.getDefault().locate("modules/ext/libs.jstestdriver-ext.jar", "org.netbeans.libs.jstestdriver", false); // NOI18N ExternalProcessBuilder processBuilder = new ExternalProcessBuilder(getJavaBinary()). addArgument("-cp"). addArgument(jsTestDriverJar.getAbsolutePath()+File.pathSeparatorChar+extjar.getAbsolutePath()). addArgument("org.netbeans.libs.jstestdriver.ext.StartServer"). addArgument(""+port). addArgument(""+strictMode); ExecutionService service = ExecutionService.newService(processBuilder, descriptor, "js-test-driver Server"); task = service.run(); running = true; }
Example #5
Source File: InputOutputManagerTest.java From netbeans with Apache License 2.0 | 6 votes |
public void testGetActions() { StopAction stopAction = new StopAction(); RerunAction rerunAction = new RerunAction(); InputOutput io = IOProvider.getDefault().getIO("test", new Action[] {rerunAction, stopAction}); InputOutputManager.addInputOutput( new InputOutputManager.InputOutputData(io, "test", stopAction, rerunAction, null)); InputOutputManager.InputOutputData data = InputOutputManager.getInputOutput("test", false, null); assertNull(data); data = InputOutputManager.getInputOutput("test", true, null); assertEquals("test", data.getDisplayName()); assertEquals(io, data.getInputOutput()); assertEquals(rerunAction, data.getRerunAction()); assertEquals(stopAction, data.getStopAction()); data = InputOutputManager.getInputOutput("test", true, null); assertNull(data); InputOutputManager.addInputOutput( new InputOutputManager.InputOutputData(io, "test", stopAction, rerunAction, null)); data = InputOutputManager.getInputOutput("test", true, null); assertNotNull(data); }
Example #6
Source File: ControllerTest.java From netbeans with Apache License 2.0 | 6 votes |
public void testUpdaterRemovesUnavailableTabs() throws InterruptedException, InvocationTargetException { Controller c = new Controller(); final Controller.CoalescedNameUpdater updater = c.new CoalescedNameUpdater(); final NbIO io = (NbIO) IOProvider.getDefault().getIO( "test", true); //NOI18N SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { OutputTab ot = new OutputTab(io); updater.add(ot); assertTrue(updater.contains(ot)); updater.run(); assertFalse(updater.contains(ot)); } }); }
Example #7
Source File: AndroidShellAdbAction.java From NBANDROID-V2 with Apache License 2.0 | 6 votes |
@Override protected void performAction(Node[] activatedNodes) { Runnable runnable = new Runnable() { @Override public void run() { for (Node activatedNode : activatedNodes) { DevicesNode.MobileDeviceHolder holder = activatedNode.getLookup().lookup(DevicesNode.MobileDeviceHolder.class); final TerminalContainerTopComponent instance = TerminalContainerTopComponent.findInstance(); instance.open(); instance.requestActive(); final IOContainer ioContainer = instance.getIOContainer(); final IOProvider term = IOProvider.get("Terminal"); // NOI18N if (term != null) { final ExecutionEnvironment env = ExecutionEnvironmentFactory.getLocal(); if (env != null) { openTerminalImpl(ioContainer, env, null, false, false, 0, holder); } } } } }; WindowManager.getDefault().invokeWhenUIReady(runnable); }
Example #8
Source File: InputOutputManagerTest.java From netbeans with Apache License 2.0 | 6 votes |
public void testGet() { InputOutput io = IOProvider.getDefault().getIO("test", true); InputOutputManager.addInputOutput( new InputOutputManager.InputOutputData(io, "test", null, null, null)); InputOutputManager.InputOutputData data = InputOutputManager.getInputOutput("test", false, null); assertEquals("test", data.getDisplayName()); assertEquals(io, data.getInputOutput()); assertNull(data.getRerunAction()); assertNull(data.getStopAction()); data = InputOutputManager.getInputOutput("test", true, null); assertNull(data); data = InputOutputManager.getInputOutput("test", false, null); assertNull(data); InputOutputManager.addInputOutput( new InputOutputManager.InputOutputData(io, "test", null, null, null)); data = InputOutputManager.getInputOutput("test", false, null); assertNotNull(data); }
Example #9
Source File: Base64Decode.java From minifierbeans with Apache License 2.0 | 6 votes |
void decode() { InputOutput io = IOProvider.getDefault().getIO(Bundle.CTL_Base64Encode(), false); ImageUtil imageUtil = new ImageUtil(); try { FileObject file = context.getPrimaryFile(); if (file.getExt().equalsIgnoreCase("ENCODE")) { File newFile = new File(file.getPath()); String fileType = file.getName().substring(file.getName().lastIndexOf('.') + 1); imageUtil.decodeToImage(FileUtils.readFileToString(newFile), file.getParent().getPath() + File.separator + file.getName(), fileType); NotificationDisplayer.getDefault().notify("Image decoded successfully", NotificationDisplayer.Priority.NORMAL.getIcon(), "The decoding of the image was successful.", null); } else { NotificationDisplayer.getDefault().notify("Invalid file to decode", NotificationDisplayer.Priority.HIGH.getIcon(), String.format("The file '%s' is invalid. File must have an '.encode' extension.", file.getParent().getPath() + File.separator + file.getNameExt()), null); } } catch (IOException ex) { io.getOut().println("Exception: " + ex.toString()); } }
Example #10
Source File: AbstractNBTask.java From jeddict with Apache License 2.0 | 6 votes |
private void initLog() { TopComponent tc = WindowManager.getDefault().findTopComponent("output"); // NOI18N if (tc != null && isDisplayOutput()) // NOI18N { tc.open(); tc.requestActive(); tc.toFront(); } inputOutput = IOProvider.getDefault().getIO(getTaskName(), false); // NOI18N try { inputOutput.getOut().reset(); out = inputOutput.getOut(); } catch (IOException e) { // TODO: ignore } if (isDisplayOutput()) // NOI18N { inputOutput.select(); inputOutput.setOutputVisible(true); } }
Example #11
Source File: OutputLogger.java From netbeans with Apache License 2.0 | 6 votes |
/** * @return the log */ private InputOutput getLog() { writable = true; if(log == null) { Subversion.LOG.log(Level.FINE, "Creating OutputLogger for {0}", repositoryRootString); log = IOProvider.getDefault().getIO(repositoryRootString, false); if (!openedWindows.contains(repositoryRootString)) { // log window has been opened writable = SvnModuleConfig.getDefault().getAutoOpenOutput(); openedWindows.add(repositoryRootString); if (!writable) { // close it again log.closeInputOutput(); } } } return log; }
Example #12
Source File: InputOutputCache.java From netbeans with Apache License 2.0 | 6 votes |
private static CachedInputOutput createInputOutput(String originalDisplayName, List<Action> actions) { synchronized (InputOutputCache.class) { String displayName = getNonActiveDisplayName(originalDisplayName); InputOutput io; if (actions != null && !actions.isEmpty()) { io = IOProvider.getDefault().getIO(displayName, actions.toArray(new Action[actions.size()])); //rerunAction.setParent(io); } else { io = IOProvider.getDefault().getIO(displayName, true); } ACTIVE_DISPLAY_NAMES.add(displayName); return new CachedInputOutput(io, displayName, actions); } }
Example #13
Source File: SaveEGTask.java From BART with MIT License | 6 votes |
@Override public void save() throws IOException { dto = CentralLookup.getDefLookup().lookup(EGTaskDataObjectDataObject.class); final InputOutput io = IOProvider.getDefault().getIO(dto.getPrimaryFile().getName(), false); io.select(); OutputWindow.openOutputWindowStream(io.getOut(), io.getErr()); final Dialog d = BusyDialog.getBusyDialog(); RequestProcessor.Task T = RequestProcessor.getDefault().post(new SaveEgtaskRunnable()); T.addTaskListener(new TaskListener() { @Override public void taskFinished(Task task) { // d.setVisible(false); if(esito) { System.out.println(Bundle.MSG_SaveEGTask_OK(dto.getPrimaryFile().getName())); }else{ System.err.println(Bundle.MSG_SaveEGTask_Failed(dto.getPrimaryFile().getName())); } OutputWindow.closeOutputWindowStream(io.getOut(), io.getErr()); // d.setVisible(false); } }); // d.setVisible(true); }
Example #14
Source File: RetrieverEngineImpl.java From netbeans with Apache License 2.0 | 6 votes |
private InputOutput getOPWindow(){ if(iop == null){ iop = IOProvider.getDefault().getIO(opTabTitle, false); iop.setErrSeparated(true); iop.setFocusTaken(false); /*iop.select(); try { iop.getOut().reset(); } catch (IOException ex) { }*/ ioOut = iop.getOut(); DateFormat dtf = DateFormat.getDateTimeInstance(); ioOut.print("\n\n"+dtf.format(new Date(System.currentTimeMillis()))+" : "); } return iop; }
Example #15
Source File: OutputUtils.java From netbeans with Apache License 2.0 | 6 votes |
@NbBundle.Messages({ "# {0} - container id", "LBL_LogInputOutput=Log {0}" }) private static LogConnect getLogInputOutput(DockerContainer container) { synchronized (LOGS) { LogConnect connect = LOGS.get(container); if (connect == null) { InputOutput io = IOProvider.getDefault().getIO( Bundle.LBL_LogInputOutput(container.getShortId()), true); connect = new LogConnect(io); LOGS.put(container, connect); } return connect; } }
Example #16
Source File: HudsonConsoleDisplayer.java From netbeans with Apache License 2.0 | 5 votes |
@Override public synchronized void open() { hyperlinker = new Hyperlinker(job); io = IOProvider.getDefault().getIO(displayName, new Action[]{}); io.select(); out = io.getOut(); err = io.getErr(); }
Example #17
Source File: HudsonFailureDisplayer.java From netbeans with Apache License 2.0 | 5 votes |
private void prepareOutput() { if (io == null) { String title = Bundle.ShowFailures_title(displayName); io = IOProvider.getDefault().getIO(title, new Action[0]); io.select(); Manager.getInstance().testStarted(session); } }
Example #18
Source File: SassCli.java From netbeans with Apache License 2.0 | 5 votes |
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); }
Example #19
Source File: WebBrowserImpl.java From netbeans with Apache License 2.0 | 5 votes |
private void _dumpDocument( Document doc, String title ) { if( null == title || title.isEmpty() ) { title = NbBundle.getMessage(WebBrowserImpl.class, "Lbl_GenericDomDumpTitle"); } InputOutput io = IOProvider.getDefault().getIO( title, true ); io.select(); try { DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance(); DOMImplementationLS impl = (DOMImplementationLS) registry.getDOMImplementation( "XML 3.0 LS 3.0" ); //NOI18N if( null == impl ) { io.getErr().println( NbBundle.getMessage(WebBrowserImpl.class, "Err_DOMImplNotFound") ); return; } LSSerializer serializer = impl.createLSSerializer(); if( serializer.getDomConfig().canSetParameter( "format-pretty-print", Boolean.TRUE ) ) { //NOI18N serializer.getDomConfig().setParameter( "format-pretty-print", Boolean.TRUE ); //NOI18N } LSOutput output = impl.createLSOutput(); output.setEncoding("UTF-8"); //NOI18N output.setCharacterStream( io.getOut() ); serializer.write(doc, output); io.getOut().println(); } catch( Exception ex ) { ex.printStackTrace( io.getErr() ); } finally { if( null != io ) { io.getOut().close(); io.getErr().close(); } } }
Example #20
Source File: SQLExecutionLoggerImpl.java From netbeans with Apache License 2.0 | 5 votes |
@NbBundle.Messages({ "# {0} - the name of the executed SQL file", "LBL_SQLFileExecution={0} execution"}) public SQLExecutionLoggerImpl(String displayName, LineCookie lineCookie) { this.lineCookie = lineCookie; String ioName = LBL_SQLFileExecution(displayName); inputOutput = IOProvider.getDefault().getIO(ioName, true); }
Example #21
Source File: OutputTabMaintainer.java From netbeans with Apache License 2.0 | 5 votes |
protected final InputOutput createInputOutput() { if (MavenSettings.getDefault().isReuseOutputTabs()) { synchronized (freeTabs) { for (Map.Entry<InputOutput,AllContext<?>> entry : freeTabs.entrySet()) { InputOutput free = entry.getKey(); AllContext<?> allContext = entry.getValue(); if (io == null && allContext.name.equals(name) && allContext.tabContextType == tabContextType()) { // Reuse it. io = free; reassignAdditionalContext(tabContextType().cast(allContext.tabContext)); try { io.getOut().reset(); } catch (IOException ex) { ex.printStackTrace(); } // useless: io.flushReader(); } else { // Discard it. free.closeInputOutput(); } } freeTabs.clear(); } } // } if (io == null) { io = IOProvider.getDefault().getIO(name, createNewTabActions()); io.setInputVisible(true); } return io; }
Example #22
Source File: Base64Encode.java From minifierbeans with Apache License 2.0 | 5 votes |
void encode() { InputOutput io = IOProvider.getDefault().getIO(Bundle.CTL_Base64Encode(), false); ImageUtil imageUtil = new ImageUtil(); try { FileObject file = context.getPrimaryFile(); String imgstr = imageUtil.encodeToString(file.getPath(), file.getExt()); File newFile = new File(file.getParent().getPath() + File.separator + file.getName() + "." + file.getExt() + ".encode"); FileUtils.writeStringToFile(newFile, imgstr); io.getOut().println("Image Base64 Encoding : " + imgstr); } catch (IOException ex) { io.getOut().println("Exception: " + ex.toString()); } }
Example #23
Source File: CheckCleanInstance.java From BART with MIT License | 5 votes |
@Override public void run() { ProgressHandle progr = null; InputOutput io = null; try{ progr = ProgressHandleFactory.createHandle("Check Clean Instance ...."); io = IOProvider.getDefault().getIO(dto.getPrimaryFile().getName(), false); io.select(); OutputWindow.openOutputWindowStream(io.getOut(), io.getErr()); progr.start(); if(task == null)return; if (task.getDCs().isEmpty()) { message.append(Bundle.MSG_CheckCleanInstanceDCEmpty()); esito = false; return; } if((task.getTarget() == null) || (task.getTarget() instanceof EmptyDB)) { message.append(Bundle.MSG_CheckCleanInstanceTargetEmpty()); esito = false; return; } cleanInstanceChecker.check(task.getDCs(), task.getSource(), task.getTarget(), task); esito = true; }catch(Exception ex) { System.err.println(""+ex.getLocalizedMessage()); String tmp = ex.toString().replaceAll("bart.exceptions.ErrorGeneratorException:", ""); message.append(Bundle.MSG_CheckCleanInstanceViolated(tmp)); esito = false; }finally{ OutputWindow.closeOutputWindowStream(io.getOut(), io.getErr()); progr.finish(); } }
Example #24
Source File: ReloadDependencies.java From BART with MIT License | 5 votes |
@Override// closeDependencyViewTopComponent public void actionPerformed(ActionEvent ev) { if(dto == null || dto.getEgtask() == null)return; if(textPanel.getText().isEmpty())return; if((egtask.getTarget() == null) || (egtask.getTarget() instanceof EmptyDB)) { DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message( Bundle.MSG_ReloadDependenciesNoDBTarget(), NotifyDescriptor.INFORMATION_MESSAGE)); return; } final InputOutput io = IOProvider.getDefault().getIO(dto.getPrimaryFile().getName(), false); io.select(); OutputWindow.openOutputWindowStream(io.getOut(), io.getErr()); final Dialog d = BusyDialog.getBusyDialog(); RequestProcessor.Task T = RequestProcessor.getDefault().post(new reloadDependeciesRunnable()); T.addTaskListener(new TaskListener() { @Override public void taskFinished(Task task) { // d.setVisible(false); if(esito) { dto.setEgtModified(true); StatusBar.setStatus(Bundle.MSG_ReloadDependenciesExecuted(), 10,5000); System.out.println(Bundle.MSG_ReloadDependenciesExecuted()); DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message( Bundle.MSG_ReloadDependenciesExecuted(), NotifyDescriptor.INFORMATION_MESSAGE)); }else{ System.err.println(Bundle.MSG_ReloadDependenciesException()); StatusBar.setStatus(Bundle.MSG_ReloadDependenciesExecuted(), 10,5000); } OutputWindow.closeOutputWindowStream(io.getOut(), io.getErr()); } }); // d.setVisible(true); }
Example #25
Source File: ChaseTaskListener.java From Llunatic with GNU General Public License v3.0 | 5 votes |
@Override public void onTaskStarted(ChaseTask task) { this.progress = ProgressHandleFactory.createHandle(task.getScenario().getDataObject().getName().concat(Bundle.MSG_ChaseInProgress()), task); this.progress.start(); this.outputWindowName = "Chase Execution " + df.format(new Date().getTime()); redirectOutput(); IOProvider.getDefault().getIO(outputWindowName, false).select(); }
Example #26
Source File: ChaseTaskListener.java From Llunatic with GNU General Public License v3.0 | 5 votes |
@Override public void onTaskCompleted(ChaseTask task) { progress.finish(); if (!task.isCancelled()) { try { IChaseResult result = task.get(); LoadedScenario scenario = task.getScenario(); scenario.put(R.BeanProperty.CHASE_RESULT, result); String statusText = Bundle.MSG_ChaseSuccessful(); Long exTime = ChaseStats.getInstance().getStat(ChaseStats.CHASE_TIME); if (exTime != null && exTime > 0) { statusText += " in " + exTime + " ms"; } status.setStatusText(statusText); for (String windowName : result.getWindowsToOpen()) { view.show(windowName); } view.show(result.getWindowsToOpen().get(0)); if (scenario.getScenario().isMCScenario()) { view.show(R.Window.CELL_GROUP_EXPLORER); } } catch (Exception ex) { logger.error(ex.getMessage()); if (logger.isDebugEnabled()) ex.printStackTrace(); status.setStatusText(Bundle.MSG_ChaseFailed() + ": " + ex.getLocalizedMessage()); Exceptions.printStackTrace(ex); } IOProvider.getDefault().getIO(outputWindowName, false).select(); resetOutput(); task.getScenario().remove(R.BeanProperty.CHASE_STATE); } else { this.progress = ProgressHandleFactory.createHandle(Bundle.MSG_ChaseStopping()); this.progress.start(); } }
Example #27
Source File: ImageUtil.java From minifierbeans with Apache License 2.0 | 5 votes |
public void compressJPG(String inputFilePath, String outputFilePath, String fileType) { InputOutput io = IOProvider.getDefault().getIO(Bundle.CTL_Base64Encode(), false); try { File imageFile = new File(inputFilePath); File compressedImageFile = new File(outputFilePath); InputStream is = new FileInputStream(imageFile); OutputStream os = new FileOutputStream(compressedImageFile); float quality = 0.5f; // create a BufferedImage as the result of decoding the supplied InputStream BufferedImage image = ImageIO.read(is); // get all image writers for JPG format Iterator<ImageWriter> writers = ImageIO.getImageWritersByFormatName(fileType); if (!writers.hasNext()) { throw new IllegalStateException("No writers found"); } ImageWriter writer = writers.next(); ImageOutputStream ios = ImageIO.createImageOutputStream(os); writer.setOutput(ios); ImageWriteParam param = writer.getDefaultWriteParam(); param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); param.setCompressionQuality(quality); // appends a complete image stream containing a single image and //associated stream and image metadata and thumbnails to the output writer.write(null, new IIOImage(image, null, null), param); is.close(); os.close(); ios.close(); writer.dispose(); } catch (IOException ex) { io.getOut().println("Exception: " + ex.toString()); } }
Example #28
Source File: LessExecutable.java From netbeans with Apache License 2.0 | 5 votes |
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); }
Example #29
Source File: ExecutionServiceTest.java From netbeans with Apache License 2.0 | 5 votes |
public void testIOReset() throws InterruptedException, InvocationTargetException, ExecutionException { TestProcess process = new TestProcess(0); TestCallable callable = new TestCallable(); callable.addProcess(process); InputOutput io = IOProvider.getDefault().getIO("Test", new Action[] {}); TestInputOutput testIO = new TestInputOutput(io); ExecutionDescriptor descriptor = new ExecutionDescriptor() .inputOutput(testIO).noReset(true); ExecutionService service = ExecutionService.newService( callable, descriptor, "Test"); Future<Integer> task = service.run(); assertNotNull(task); process.destroy(); assertEquals(0, task.get().intValue()); assertFalse(testIO.isReset()); // now with enabled process = new TestProcess(0); callable = new TestCallable(); callable.addProcess(process); testIO = new TestInputOutput(io); descriptor = new ExecutionDescriptor().inputOutput(testIO); service = ExecutionService.newService(callable, descriptor, "Test"); task = service.run(); assertNotNull(task); process.destroy(); assertEquals(0, task.get().intValue()); assertTrue(testIO.isReset()); }
Example #30
Source File: OutputLogger.java From netbeans with Apache License 2.0 | 5 votes |
/** * @return the log */ private InputOutput getLog() { writable = true; if(log == null) { Mercurial.LOG.fine("Creating OutputLogger for " + repositoryRootString); log = IOProvider.getDefault().getIO(repositoryRootString, false); if (!openedWindows.contains(repositoryRootString)) { // log window has been opened writable = HgModuleConfig.getDefault().getAutoOpenOutput(); openedWindows.add(repositoryRootString); if (!writable) { // close it again log.closeInputOutput(); } } } if (log.isClosed()) { if (HgModuleConfig.getDefault().getAutoOpenOutput()) { Mercurial.LOG.fine("Creating OutputLogger for " + repositoryRootString); log = IOProvider.getDefault().getIO(repositoryRootString, false); try { // HACK (mystic logic) workaround, otherwise it writes to nowhere log.getOut().reset(); } catch (IOException e) { Mercurial.LOG.log(Level.SEVERE, null, e); } } else { writable = false; } } return log; }