private static void doCapture(ShellPrintWriter writer, char[] arr, StringBuilder output, int start, int cursor) { String tk = new String(arr, start, cursor - start).trim(); if (LITERALS.contains(tk)) { output.append(writer.renderColor(CLR_KEYWORD, tk)); } else { output.append(tk); } }
@Override public void run() { try { byte[] buf = new byte[1024]; int read; while ((read = in.read(buf)) != -1) { out.write(buf, 0, read); } } catch (IOException e) { throw new RuntimeException("Error reading input from child process", e); } } }
private void listVars() { for (Map.Entry<String, Object> entry : forge.getProperties().entrySet()) { writer.println(entry.getKey() + "=" + entry.getValue()); } }
public void modified(@Observes final ResourceModified event, final ShellPrintWriter writer) { writer.println("Wrote " + event.getResource().getFullyQualifiedName()); }
public void moved(@Observes final ResourceRenamed event, final ShellPrintWriter writer) { writer.println("Renamed " + event.getOriginalLocation() + " -> " + event.getNewLocation()); } }
output.append(writer.renderColor(CLR_STR_LITERAL, getHTMLizedString(arr, start, ++cursor - start))); output.append(writer.renderColor(CLR_COMMENT, comment)); cursor++; output.append(writer.renderColor(CLR_COMMENT, comment)); cursor++; cursor++; String token = new String(arr, start, cursor - start); output.append(writer.renderColor(CLR_ANNOTATION, token));
public void deleted(@Observes final ResourceDeleted event, final ShellPrintWriter writer) { writer.println("Deleted " + event.getResource().getFullyQualifiedName()); }
public void created(@Observes final ResourceCreated event, final ShellPrintWriter writer) { writer.println("Wrote " + event.getResource().getFullyQualifiedName()); }
@DefaultCommand public void listProperties() { Map<String, Object> properties = forge.getProperties(); for (Entry<String, Object> entry : properties.entrySet()) { String key = entry.getKey(); Object value = entry.getValue(); writer.print(key + "="); if (value != null) { writer.print(value.toString()); } writer.println(); } } }
@DefaultCommand public void listProperties() { Iterator<?> properties = config.getKeys(); while (properties.hasNext()) { Object key = properties.next(); if (key != null) { writer.print(ShellColor.BOLD, key.toString()); writer.print("="); for (ConfigurationScope scope : ConfigurationScope.values()) { Configuration scoped = config.getScopedConfiguration(scope); if (scoped != null) { Object value = scoped.getProperty(key.toString()); writer.print(ShellColor.YELLOW, scope.name() + ": "); if (value != null) { writer.print("[" + value.toString() + "] "); } else writer.print("[] "); } } writer.println(); } } }