public InteractiveInterpreterConsole(
      IInterpreter interpreter, String name, String prompt, String continuationPrompt) {
    super(name, CONSOLE_TYPE, null, false);

    this.interpreter = interpreter;
    commandExecutor = new CommandExecutor(this);
    consoleOutputStream = new ConsoleOutputStream(this);
    interpreter.setConsole(this);

    this.prompt = prompt;
    this.continuationPrompt = continuationPrompt;

    commandHistory = new CommandHistory();
    documentListener = new ConsoleDocumentListener(this);
    documentListener.registerListener();

    partitioner = new InterpreterConsolePartitioner();
    IDocument doc = getDocument();
    doc.setDocumentPartitioner(partitioner);
    partitioner.connect(doc);

    documentListener.enable();

    setFont();
  }
 private String getContentType(String content, int offset) {
   if (partitioner == null) {
     IDocument document = new Document(content);
     partitioner =
         new FastPartitioner(new XMLPartitionScanner(), XMLSourceConfiguration.CONTENT_TYPES);
     partitioner.connect(document);
     document.setDocumentPartitioner(partitioner);
   }
   return partitioner.getContentType(offset);
 }
 @Override
 protected IDocument createDocument(final Object elem) throws CoreException {
   IDocument result = super.createDocument(elem);
   if (result != null) {
     IDocumentPartitioner partitioner = createDocumentPartitioner();
     partitioner.connect(result);
     result.setDocumentPartitioner(partitioner);
   }
   return result;
 }
 protected void setupDocument(IDocument document) {
   LogManager.logDebug("Start setupDocument: document-" + document, this);
   if (document != null) {
     IDocumentPartitioner partitioner =
         new FastPartitioner(new CPartitionScanner(), new String[] {CPartitionScanner.C_COMMENT});
     partitioner.connect(document);
     document.setDocumentPartitioner(partitioner);
   }
   LogManager.logDebug("End setupDocument:", this);
 }
 @Override
 protected IDocument createDocument(Object element) throws CoreException {
   IDocument document = super.createDocument(element);
   if (document != null) {
     IDocumentPartitioner partitioner =
         new FastPartitioner(new JsxPartitionScanner(), new String[] {JSX_KEYWORD, JSX_COMMENT});
     partitioner.connect(document);
     document.setDocumentPartitioner(partitioner);
   }
   return document;
 }
 @Override
 public IDocument createDocument(Object element) throws CoreException {
   IDocument document = super.createDocument(element);
   if (document != null) {
     IDocumentPartitioner partitioner =
         new FastPartitioner(
             new CSSPartitionScanner(), new String[] {CSSPartitionScanner.CSS_COMMENT});
     partitioner.connect(document);
     document.setDocumentPartitioner(partitioner);
   }
   return document;
 }
 protected IDocument createDocument(Object element) throws CoreException {
   IDocument document = super.createDocument(element);
   if (document != null) {
     IDocumentPartitioner partitioner =
         new FastPartitioner(
             new XMLPartitionScanner(),
             new String[] {XMLPartitionScanner.XML_TAG, XMLPartitionScanner.XML_COMMENT});
     partitioner.connect(document);
     document.setDocumentPartitioner(partitioner);
   }
   return document;
 }
 protected void setupDocumentPartitioner(IDocument document, String partitioning) {
   IDocumentPartitioner partitioner = createDocumentPartitioner();
   if (partitioner != null) {
     partitioner.connect(document);
     if (document instanceof IDocumentExtension3) {
       IDocumentExtension3 extension3 = (IDocumentExtension3) document;
       extension3.setDocumentPartitioner(partitioning, partitioner);
     } else {
       document.setDocumentPartitioner(partitioner);
     }
   }
 }
 public void setup(IDocument document) {
   AutoconfPartitioner partitioner =
       new AutoconfPartitioner(
           new AutoconfPartitionScanner(), AutoconfPartitionScanner.AUTOCONF_PARTITION_TYPES);
   partitioner.connect(document, 1);
   if (document instanceof IDocumentExtension3) {
     IDocumentExtension3 extension3 = (IDocumentExtension3) document;
     extension3.setDocumentPartitioner(AutoconfEditor.AUTOCONF_PARTITIONING, partitioner);
   } else {
     document.setDocumentPartitioner(partitioner);
   }
   //		document.addDocumentListener(this);
 }
 @Override
 protected FileInfo createFileInfo(Object element) throws CoreException {
   FileInfo info = super.createFileInfo(element);
   if (info == null) {
     info = createEmptyFileInfo();
   }
   IDocument document = info.fTextFileBuffer.getDocument();
   if (document != null) {
     IDocumentPartitioner partitioner =
         new FastPartitioner(
             new CSSPartitionScanner(), new String[] {CSSPartitionScanner.CSS_COMMENT});
     partitioner.connect(document);
     document.setDocumentPartitioner(partitioner);
   }
   return info;
 }
 protected IDocument createDocument(Object element) throws CoreException {
   IDocument document = super.createDocument(element);
   if (document != null) {
     IDocumentPartitioner partitioner =
         new FastPartitioner(
             new CodePartitionScanner(),
             new String[] {
               CodePartitionScanner.COMMENT,
               CodePartitionScanner.KEYWORD,
               CodePartitionScanner.NOTE,
             });
     partitioner.connect(document);
     document.setDocumentPartitioner(partitioner);
   }
   return document;
 }
Beispiel #12
0
  /**
   * createDocument
   *
   * @param partitionType
   * @param source
   * @return
   */
  static IDocument createDocument(String source) {
    CompositePartitionScanner partitionScanner =
        new CompositePartitionScanner(
            CSSSourceConfiguration.getDefault().createSubPartitionScanner(),
            new NullSubPartitionScanner(),
            new NullPartitionerSwitchStrategy());
    IDocumentPartitioner partitioner =
        new ExtendedFastPartitioner(
            partitionScanner, CSSSourceConfiguration.getDefault().getContentTypes());
    partitionScanner.setPartitioner((IExtendedPartitioner) partitioner);

    final IDocument document = new Document(source);
    partitioner.connect(document);
    document.setDocumentPartitioner(partitioner);

    return document;
  }
Beispiel #13
0
 /**
  * Creates the document to be associated to the SourceViewer for OQL queries
  *
  * @return the Document instance
  */
 private IDocument createDocument() {
   IDocument doc = new Document();
   IDocumentPartitioner partitioner =
       new PatchedFastPartitioner(
           new OQLPartitionScanner(),
           new String[] {
             IDocument.DEFAULT_CONTENT_TYPE,
             OQLPartitionScanner.SELECT_CLAUSE,
             OQLPartitionScanner.FROM_CLAUSE,
             OQLPartitionScanner.WHERE_CLAUSE,
             OQLPartitionScanner.UNION_CLAUSE,
             OQLPartitionScanner.COMMENT_CLAUSE
           });
   partitioner.connect(doc);
   doc.setDocumentPartitioner(partitioner);
   return doc;
 }
 protected IDocument createDocument(Object element) throws CoreException {
   IDocument document = super.createDocument(element);
   if (document != null) {
     IDocumentPartitioner partitioner =
         new FastPartitioner(
             new HTMLPartitionScanner(),
             new String[] {
               HTMLPartitionScanner.HTML_TAG,
               HTMLPartitionScanner.HTML_COMMENT,
               HTMLPartitionScanner.HTML_SCRIPT,
               HTMLPartitionScanner.HTML_DOCTYPE,
               HTMLPartitionScanner.JAVASCRIPT,
               HTMLPartitionScanner.HTML_CSS
             });
     partitioner.connect(document);
     document.setDocumentPartitioner(partitioner);
   }
   return document;
 }
  protected IDocument createDocument(Object element) throws CoreException {
    IDocument document = super.createDocument(element);

    if (document != null) {
      IDocumentPartitioner partitioner =
          new DomainObjectPartitioner(
              new DomainObjectPartitionScanner(),
              new String[] {
                DomainObjectPartitionScanner.DOMAIN_OBJECT_DECLARATION,
                DomainObjectPartitionScanner.OPERATION_DECLARATION,
                DomainObjectPartitionScanner.ATTRIBUTE_DECLARATION,
                DomainObjectPartitionScanner.VALIDATION_RULE_DECLARATION,
                DomainObjectPartitionScanner.IMPORT_DECLARATION,
                DomainObjectPartitionScanner.PACKAGE_DECLARATION
              });
      partitioner.connect(document);
      document.setDocumentPartitioner(partitioner);
    }
    return document;
  }
 private String getContentType(String content, int offset) {
   if (partitioner == null) {
     IDocument document = new Document(content);
     CompositePartitionScanner partitionScanner =
         new CompositePartitionScanner(
             HTMLSourceConfiguration.getDefault().createSubPartitionScanner(),
             RubySourceConfiguration.getDefault().createSubPartitionScanner(),
             ERBPartitionerSwitchStrategy.getDefault());
     partitioner =
         new ExtendedFastPartitioner(
             partitionScanner,
             TextUtils.combine(
                 new String[][] {
                   CompositePartitionScanner.SWITCHING_CONTENT_TYPES,
                   HTMLSourceConfiguration.getDefault().getContentTypes(),
                   RubySourceConfiguration.getDefault().getContentTypes()
                 }));
     partitionScanner.setPartitioner(partitioner);
     partitioner.connect(document);
     document.setDocumentPartitioner(partitioner);
   }
   return partitioner.getContentType(offset);
 }