import org.simantics.scl.ui.Activator;
import org.simantics.scl.ui.assist.SCLContentProposalProvider;
import org.simantics.scl.ui.assist.StyledTextContentAdapter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import gnu.trove.set.hash.THashSet;
* @author Hannu Niemistö
*/
public class SCLConsole extends AbstractCommandConsole {
- public static final String JOB_NAME = "org.simantics.scl.console.job";
+
+ /**
+ * Use this option mask to exclude {@link SCLConsoleListener}s contributed as
+ * OSGi services from listening to this console.
+ */
+ public static final int EXCLUDE_CONTRIBUTED_LISTENERS = 1 << 10;
+
+ public static final String JOB_NAME = "org.simantics.scl.console.job"; //$NON-NLS-1$
public static final long TERMINATE_GRACE_PERIOD = 1000L;
private THashSet<Job> currentJobs = new THashSet<Job>();
SCLReportingHandler handler = new AbstractSCLReportingHandler() {
@Override
public void print(String text) {
- appendOutput(text + "\n", null, null);
+ appendOutput(text + "\n", null, null); //$NON-NLS-1$
}
@Override
public void printError(String error) {
- appendOutput(error + "\n", redColor, null);
+ appendOutput(error + "\n", redColor, null); //$NON-NLS-1$
}
@Override
public void printCommand(String command) {
- appendOutput("> " + command.replace("\n", "\n ") + "\n", greenColor, null);
+ appendOutput("> " + command.replace("\n", "\n ") + "\n", greenColor, null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
};
public SCLConsole(Composite parent, int style, int options) {
super(parent, style, options);
createContentProposalAdapter();
- addContributedListeners();
+ if (!hasOption(EXCLUDE_CONTRIBUTED_LISTENERS))
+ addContributedListeners();
}
protected void createContentProposalAdapter() {
input,
styledTextContentAdapter,
contentProvider,
- KeyStroke.getInstance("Ctrl+Space"),
+ KeyStroke.getInstance("Ctrl+Space"), //$NON-NLS-1$
null);
contentProposalAdapter.setAutoActivationDelay(200);
} catch (ParseException e) {
}
private String jobNameFromCommand(String command) {
- return command.split("\n")[0];
+ return command.split("\n")[0]; //$NON-NLS-1$
}
@Override
}
}.open();
}
+
+ @Override
+ public Logger getLogger() {
+ return LoggerFactory.getLogger(getClass());
+ }
+
}