@Override public IOContainer ioContainer() { if (ioContainer == null) ioContainer = IOContainer.create(this); return ioContainer; }
/** * Factory method for IOContainer instances * @param provider Provider implemantation * @return IOContainer instance */ public static IOContainer create(Provider provider) { Parameters.notNull("provider", provider); return new IOContainer(provider); }
private synchronized void log(String msg, Object... items) { LOGGER.log(Level.FINER, "{0}: {1} {2}", new Object[] {provider.getClass(), msg, Arrays.asList(items)}); checkIsEDT(); }
ioContainer = IOContainer.getDefault(); tio = new TerminalInputOutput(name, actions, ioContainer); list.add(tio);
@Override public void perform() { if (terminal().isDisposed()) return; terminal().setClosedUnconditionally(false); if (!terminal().isVisibleInContainer()) { container().add(terminal(), terminal().callBacks()); terminal().setVisibleInContainer(true); } if (extraOps != null) { if (extraOps.contains(IOSelect.AdditionalOperation.OPEN)) container().open(); if (extraOps.contains(IOSelect.AdditionalOperation.REQUEST_VISIBLE)) container().requestVisible(); if (extraOps.contains(IOSelect.AdditionalOperation.REQUEST_ACTIVE)) container().requestActive(); } container().select(terminal()); } }
/** * Selects parent container (if it is opened), but does not activate it */ public void requestVisible() { log("requestVisible()"); provider.requestVisible(); }
@Override public void perform() { // It's important to add first because otherwise output2's // container impl will assert. container().add(terminal(), terminal().callBacks()); container().setToolbarActions(terminal(), actions); terminal().setVisibleInContainer(true); /* OLD bug #181064 container().open(); container().requestActive(); */ /* OLD // output2 tacks on this " ". // If anything it protects against null names. terminal().setTitle(terminal().name() + " "); // NOI18N */ terminal().updateName(terminal().name()); // TMP container().add(terminal(), terminal().callBacks()); } }
ioContainer.remove(this);
IOContainer.getDefault()); w.messagesio.select(); } catch (Exception ex) {
/** * Checks if parent container is activated * @return true if parent container is activated */ public boolean isActivated() { log("isActivated()"); return provider.isActivated(); }
IOContainer container = IOContainer.getDefault(); Field f = container.getClass().getDeclaredField("provider"); f.setAccessible(true);
public IOContainer getIOContainer() { if (ioContainer == null) { ioContainer = IOContainer.create(new IOContainerImpl()); } return ioContainer; }
/** * Sets tool tip text for provided component * @param comp component for which title should be set * @param text component title */ public void setToolTipText(JComponent comp, String text) { log("setToolTipText()", comp, text); provider.setToolTipText(comp, text); }
@Override protected void init() { SonarIssuesTopComponent sonarTopComponent = (SonarIssuesTopComponent) WindowManager.getDefault().findTopComponent("SonarIssuesTopComponent"); sonarTopComponent.setSummaryOptions(new SummaryOptions<>(Severity.getType(), Collections.emptyList())); sonarTopComponent.resetState(); stopAction.setEnabled(true); if(io == null) { io = IOProvider.getDefault().getIO("Sonar-runner", true, new Action[]{stopAction}, IOContainer.getDefault()); } try { io.getOut().reset(); io.getErr().reset(); } catch (IOException ex) { Exceptions.printStackTrace(ex); } io.select(); io.getOut().println("Starting sonar-runner"); }
/** * Gets the default container according to a generic {@link Provider}. * <p> * Normally this is taken from {@link Lookup#getDefault} but if there is no * instance in lookup, a fallback instance is created which can be useful for * unit tests and perhaps for standalone usage of various libraries. * @return a generic container */ public static IOContainer getDefault() { if (defaultIOContainer == null) { Provider provider = Lookup.getDefault().lookup(Provider.class); if (provider == null) { provider = new Trivial(); } defaultIOContainer = create(provider); } return defaultIOContainer; }
/** * Adds component to parent container * @param comp component to be added * @param cb callbacks for added component or null if not interested in notifications * @see CallBacks */ public void add(JComponent comp, CallBacks cb) { log("add()", comp, cb); provider.add(comp, cb); }
/** * Activates parent container */ public void requestActive() { log("requestActive()"); provider.requestActive(); }
/** * Removes component from parent container * @param comp component that should be removed */ public void remove(JComponent comp) { log("remove()", comp); provider.remove(comp); }
/** * Sets title for provided component * @param comp component for which title should be set * @param name component title */ public void setTitle(JComponent comp, String name) { log("setTitle()", comp, name); provider.setTitle(comp, name); }
/** * Checks whether comp can be closed (e.g. if Close action should be * present in component popup menu) * @param comp component which should be closeable * @return true if component can be closed */ public boolean isCloseable(JComponent comp) { log("isCloseable()", comp); return provider.isCloseable(comp); }