org.openide.windows.InputOutput Java Examples
The following examples show how to use
org.openide.windows.InputOutput.
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: 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 #2
Source File: RunUtils.java From netbeans with Apache License 2.0 | 6 votes |
private static ExecutorTask executeGradleImpl(String runtimeName, final GradleExecutor exec, String initialOutput) { InputOutput io = exec.getInputOutput(); ExecutorTask task = ExecutionEngine.getDefault().execute(runtimeName, exec, new ProxyNonSelectableInputOutput(io)); if (initialOutput != null) { try { if (IOColorPrint.isSupported(io)) { IOColorPrint.print(io, initialOutput, IOColors.getColor(io, IOColors.OutputType.LOG_DEBUG)); } else { io.getOut().println(initialOutput); } } catch (IOException ex) { LOG.log(Level.WARNING, "Can't write initial output: " + initialOutput, ex); } } exec.setTask(task); return task; }
Example #3
Source File: NbIOProvider.java From netbeans with Apache License 2.0 | 6 votes |
private static Color outputColorToAwtColor(InputOutput io, OutputColor color) { if (color == null) { return null; } OutputColorType type = OutputColors.getType(color); if (type == OutputColorType.RGB) { return new Color(OutputColors.getRGB(color)); } else { switch (type) { case DEBUG: return IOColors.getColor(io, IOColors.OutputType.LOG_DEBUG); case FAILURE: return IOColors.getColor(io, IOColors.OutputType.LOG_FAILURE); case WARNING: return IOColors.getColor(io, IOColors.OutputType.LOG_WARNING); case SUCCESS: return IOColors.getColor(io, IOColors.OutputType.LOG_SUCCESS); default: return null; } } }
Example #4
Source File: T5_MTStress_Test.java From netbeans with Apache License 2.0 | 6 votes |
private void exercise(InputOutput xio, OutputWriter ow, final int nlines) { IOPosition.Position positions[] = new IOPosition.Position[nlines]; for (int lx = 0; lx < nlines; lx++) { ow.println("Line " + lx + "\r"); try { IOColorLines.println(xio, "Colored line\r", Color.blue); positions[lx] = IOPosition.currentPosition(io); } catch (IOException ex) { Exceptions.printStackTrace(ex); } } sleep(1); xio.select(); for (int lx = 0; lx < nlines; lx+=2) { positions[lx].scrollTo(); sleep(1); } }
Example #5
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 #6
Source File: IOTermSupport.java From netbeans with Apache License 2.0 | 5 votes |
/** * Return the underlying Term associatd with this IO. * @param io IO to operate on. * @return underlying Term associatd with io. null if no such Term. */ public static Term term(InputOutput io) { IOTerm iot = find(io); if (iot != null) return iot.term(); else return null; }
Example #7
Source File: PostMessageDisplayer.java From netbeans with Apache License 2.0 | 5 votes |
protected static Color getColorFailure(InputOutput io) { Color color = IOColors.getColor(io, IOColors.OutputType.LOG_FAILURE); if (color == null) { color = UIManager.getColor("nb.output.failure.foreground"); // NOI18N if (color == null) { color = Color.RED.darker(); } } return color; }
Example #8
Source File: ActionProviderImpl.java From netbeans with Apache License 2.0 | 5 votes |
public static StopAction record(InputOutput io, StopAction ifAbsent) { StopAction res = actions.get(io); if (res == null) { actions.put(io, res = ifAbsent); } return res; }
Example #9
Source File: OpenServerLogAction.java From netbeans with Apache License 2.0 | 5 votes |
protected void performAction(Node[] activatedNodes) { for (Node activatedNode : activatedNodes) { Object node = activatedNode.getLookup().lookup(JBManagerNode.class); if (!(node instanceof JBManagerNode)) { continue; } JBDeploymentManager dm = ((JBManagerNode)node).getDeploymentManager(); InputOutput io = UISupport.getServerIO(dm.getUrl()); if (io != null) { io.select(); } InstanceProperties ip = dm.getInstanceProperties(); JBOutputSupport outputSupport = JBOutputSupport.getInstance(ip, false); if (outputSupport == null) { outputSupport = JBOutputSupport.getInstance(ip, true); String serverDir = ip.getProperty(JBPluginProperties.PROPERTY_SERVER_DIR); String logFileName = serverDir + File.separator + "log" + File.separator + "server.log" ; // NOI18N File logFile = new File(logFileName); if (logFile.exists()) { outputSupport.start(io, logFile); } } } }
Example #10
Source File: ShellLaunchManager.java From netbeans with Apache License 2.0 | 5 votes |
public void attachInputOutput(String remoteKey, InputOutput out, String displayName) { ShellAgent ag; synchronized (registeredAgents) { ag = registeredAgents.get(remoteKey); } if (ag == null) { LOG.log(Level.FINE, "Unregistered agent for key: {0}", remoteKey); } else { ag.setIO(out, displayName); } }
Example #11
Source File: ShellAgent.java From netbeans with Apache License 2.0 | 5 votes |
public synchronized void setIO(InputOutput io, String displayName) { if (!connections.isEmpty() || connectAddress != null) { throw new IllegalStateException("Cannot set I/O on already active agent"); } this.io = io; this.displayName = displayName; }
Example #12
Source File: ProjectRunnerImpl.java From netbeans with Apache License 2.0 | 5 votes |
@Override public InputOutput getInputOutput() { final Union2<ExecutorTask, Throwable> result = work.getResult(); return result == null || result.hasSecond() ? InputOutput.NULL : result.first().getInputOutput(); }
Example #13
Source File: BuildTask.java From netbeans with Apache License 2.0 | 5 votes |
private void println(InputOutput io, String message) { if (colorSupported) { try { IOColorLines.println(io, message, Color.GRAY); } catch (IOException ex) { // silent } } else { io.getOut().println(message); } }
Example #14
Source File: BowerExecutable.java From netbeans with Apache License 2.0 | 5 votes |
private static ExecutionDescriptor getSilentDescriptor() { return new ExecutionDescriptor() .inputOutput(InputOutput.NULL) .inputVisible(false) .frontWindow(false) .showProgress(false) .charset(StandardCharsets.UTF_8); }
Example #15
Source File: PhingExecutable.java From netbeans with Apache License 2.0 | 5 votes |
private static ExecutionDescriptor getSilentDescriptor() { return new ExecutionDescriptor() .inputOutput(InputOutput.NULL) .inputVisible(false) .frontWindow(false) .showProgress(false) .charset(StandardCharsets.UTF_8) .outLineBased(true); }
Example #16
Source File: T4_Attribute_Test.java From netbeans with Apache License 2.0 | 5 votes |
public void testSecondTab() { System.out.printf("testSecondTab()\n"); io.select(); sleep(1); // give select time to take effect InputOutput io2 = ioProvider.getIO("test2", null, ioContainer); assertNotNull ("Could not get InputOutput", io2); io2.select(); sleep(1); // give select time to take effect setAttrs(); sleep(1); // give them time to take effect }
Example #17
Source File: IOEmulation.java From netbeans with Apache License 2.0 | 5 votes |
/** * Return the terminal type supported by this IO. * @param io IO to operate on. * @return terminal type. */ public static String getEmulation(InputOutput io) { IOEmulation ior = find(io); if (ior != null) return ior.getEmulation(); else return "dumb"; // NOI18N }
Example #18
Source File: IOVisibility.java From netbeans with Apache License 2.0 | 5 votes |
public static boolean isClosable(InputOutput io) { IOVisibility iov = find(io); if (iov != null) return iov.isClosable(); else return true; }
Example #19
Source File: GruntExecutable.java From netbeans with Apache License 2.0 | 5 votes |
private static ExecutionDescriptor getSilentDescriptor() { return new ExecutionDescriptor() .inputOutput(InputOutput.NULL) .inputVisible(false) .frontWindow(false) .showProgress(false) .charset(StandardCharsets.UTF_8) .outLineBased(true); }
Example #20
Source File: DbgpStream.java From netbeans with Apache License 2.0 | 5 votes |
@Override @NbBundle.Messages("LBL_PhpDebuggerConsole=PHP Debugger Console") public void process(DebugSession session, DbgpCommand command) { byte[] buffer; try { buffer = Base64.getDecoder().decode(getNodeValue(getNode())); } catch (IllegalArgumentException ex) { Logger.getLogger(DbgpStream.class.getName()).log(Level.WARNING, null, ex); buffer = new byte[0]; } InputOutput io = IOProvider.getDefault().getIO(Bundle.LBL_PhpDebuggerConsole(), false); io.getOut().println(new String(buffer, Charset.defaultCharset())); io.getOut().close(); }
Example #21
Source File: IOTerm.java From netbeans with Apache License 2.0 | 5 votes |
private static IOTerm find(InputOutput io) { if (io instanceof Lookup.Provider) { Lookup.Provider p = (Lookup.Provider) io; return p.getLookup().lookup(IOTerm.class); } return null; }
Example #22
Source File: BuildTask.java From netbeans with Apache License 2.0 | 5 votes |
public BuildTask(DockerInstance instance, InputOutput inputOutput, Hook hook, FileObject buildContext, FileObject dockerfile, Map<String, String> buildargs, String repository, String tag, boolean pull, boolean noCache) { this.instance = new WeakReference<>(instance); this.inputOutput = new WeakReference<>(inputOutput); this.hook = hook; this.buildContext = buildContext; this.dockerfile = dockerfile; this.repository = repository; this.tag = tag; this.pull = pull; this.noCache = noCache; this.buildargs = buildargs; }
Example #23
Source File: T1_Close_Test.java From netbeans with Apache License 2.0 | 5 votes |
public void testTitle() { testTitleHelp(io); InputOutput io1 = ioProvider.getIO("io1", null, ioContainer); io1.select(); testTitleHelp(io1); io1.closeInputOutput(); }
Example #24
Source File: RemoteCommand.java From netbeans with Apache License 2.0 | 5 votes |
protected RemoteClient getRemoteClient(InputOutput io) { RunConfigRemote runConfig = RunConfigRemote.forProject(getProject()); return new RemoteClient(runConfig.getRemoteConfiguration(), new RemoteClient.AdvancedProperties() .setInputOutput(io) .setAdditionalInitialSubdirectory(runConfig.getUploadDirectory()) .setPreservePermissions(runConfig.arePermissionsPreserved()) .setUploadDirectly(runConfig.getUploadDirectly()) .setPhpVisibilityQuery(PhpVisibilityQuery.forProject(getProject()))); }
Example #25
Source File: ExecutionService.java From netbeans with Apache License 2.0 | 5 votes |
/** * Retrieves or creates the output window usable for the current run. * * @param required output window required by rerun or <code>null</code> * @return the output window usable for the current run */ private InputOutputManager.InputOutputData getInputOutput(InputOutput required) { InputOutputManager.InputOutputData result = null; synchronized (InputOutputManager.class) { InputOutput io = descriptor.getInputOutput(); if (io != null) { result = new InputOutputManager.InputOutputData(io, originalDisplayName, null, null, null); } // try to acquire required one (rerun action) // this will always succeed if this method is called from EDT if (result == null) { result = InputOutputManager.getInputOutput(required); } // try to find free output windows if (result == null) { result = InputOutputManager.getInputOutput( originalDisplayName, descriptor.isControllable(), descriptor.getOptionsPath()); } // free IO was not found, create new one if (result == null) { result = InputOutputManager.createInputOutput( originalDisplayName, descriptor.isControllable(), descriptor.getOptionsPath()); } configureInputOutput(result.getInputOutput()); } return result; }
Example #26
Source File: LogViewer.java From netbeans with Apache License 2.0 | 5 votes |
/** * Make the log tab visible */ public void takeFocus() { InputOutput io = inOut; if (io != null) { io.select(); } }
Example #27
Source File: OutputUtils.java From netbeans with Apache License 2.0 | 5 votes |
private static Pair<InputOutput, Boolean> getTerminalInputOutput(DockerContainer container) { synchronized (TERMS) { InputOutput io = TERMS.get(container); if (io == null) { io = IOProvider.get("Terminal") // NOI18N .getIO(container.getShortId(), new Action[]{new TerminalOptionsAction()}); TERMS.put(container, io); return Pair.of(io, false); } return Pair.of(io, IOConnect.isSupported(io) && IOConnect.isConnected(io)); } }
Example #28
Source File: FtpConnectionProvider.java From netbeans with Apache License 2.0 | 5 votes |
@Override public RemoteClient getRemoteClient(RemoteConfiguration remoteConfiguration, InputOutput io) { if (remoteConfiguration instanceof FtpConfiguration) { return new FtpClient((FtpConfiguration) remoteConfiguration, io); } return null; }
Example #29
Source File: LessExecutable.java From netbeans with Apache License 2.0 | 5 votes |
private static ExecutionDescriptor getSilentDescriptor() { return new ExecutionDescriptor() .inputOutput(InputOutput.NULL) .inputVisible(false) .frontWindow(false) .showProgress(false); }
Example #30
Source File: BridgingInputOutputProvider.java From netbeans with Apache License 2.0 | 5 votes |
/** * Convert AWT-independent {@link OutputColor} to {@link java.awt.Color}. * * @return Appropriate color, or null if default color should be used. */ private static Color outputColorToAwtColor(InputOutput io, OutputColor color) { if (color == null) { return null; } OutputColorType type = OutputColors.getType(color); if (type == OutputColorType.RGB) { return new Color(OutputColors.getRGB(color)); } else if (IOColors.isSupported(io)) { switch (type) { case DEBUG: return IOColors.getColor(io, OutputType.LOG_DEBUG); case FAILURE: return IOColors.getColor(io, OutputType.LOG_FAILURE); case WARNING: return IOColors.getColor(io, OutputType.LOG_WARNING); case SUCCESS: return IOColors.getColor(io, OutputType.LOG_SUCCESS); default: return null; } } else { return null; } }