Examples of TextConsole


Examples of org.eclipse.ui.console.TextConsole

  }

  @Override
  public void matchFound(PatternMatchEvent event) {
    if (event.getSource() instanceof TextConsole) {
      TextConsole console = (TextConsole) event.getSource();
      IDocument doc =  console.getDocument();
      int off = event.getOffset();
      int lenght = event.getLength();

      String fn = null;
      int ln = 1;

      try {
        String str = doc.get(off,lenght);
        Matcher m = _p.matcher(str);
        m.matches();
        fn = m.group(1);
        ln = Integer.parseInt(m.group(2));
      } catch (BadLocationException e1) {
        e1.printStackTrace();
      }
     
      IWorkspace ws = ResourcesPlugin.getWorkspace();
      IWorkspaceRoot root = ws.getRoot();
      String active_prj_name = null;
      try {
        active_prj_name = root.getPersistentProperty(QN_PREFERENCES_ACTIVE_PRJ);
      } catch (CoreException e1) {
        e1.printStackTrace();
        return;
      }

      if(active_prj_name == null)
        return;
     
      IHyperlink link = null;
      IProject p = root.getProject(active_prj_name);

      File f = new File(fn);
     
      if(f.exists())
        link = (IHyperlink) new URLLink(f.toURI(), ln);
      else
        link = new FileLink(p.getFile(fn), null, -1, -1, ln);

      try {
        console.addHyperlink(link, event.getOffset(), event.getLength());
      } catch (BadLocationException e) {
        e.printStackTrace();
      }
    }
  }
View Full Code Here

Examples of org.eclipse.ui.console.TextConsole

          }
        }
        return cm;
      }
    });
    final TextConsole console = new TextConsole("console",
        "javaStackTraceConsole", null, false) {

     
      public String getType() {
        return super.getType();
      }

     
      protected IConsoleDocumentPartitioner getPartitioner() {
        return new MM(this);
      }
    };
    final TextConsoleViewer sv = new TextConsoleViewer(owner, console);
    ConsolePlugin.getDefault().getConsoleManager()
        .createPatternMatchListeners(console);
    IDocument document = console.getDocument();
    document.setDocumentPartitioner(new MM(console));
    logViewer.setFilter(new IFilter(){

      public boolean accept(Object o) {
        return true;
View Full Code Here

Examples of org.eclipse.ui.console.TextConsole

      int offset = event.getOffset();
      int length = event.getLength();
     
      Object object = event.getSource();
      if(! (object instanceof TextConsole)) return;
      TextConsole console = (TextConsole)object;
     
      String consolecontent = console.getDocument().get();
      String matchedstring = consolecontent.substring(offset, offset+length);
     
      ParseErrorString parser = new ParseErrorString(regex);
      boolean success = parser.parse(matchedstring);
      if (!success) return;
       
      setProblemMarker(parser.filename, problemlevel, parser.linenr, parser.message);     
     
      IResource resource = getFile(parser.filename);
      if(resource instanceof IFile) {
        IFile file = (IFile) resource;
        FileLink hyperlink = new FileLink(file,null,-1,-1,parser.linenr);
        try {
          console.addHyperlink(hyperlink, offset+parser.startinmatchedstring,
              parser.endinmatchedstring-parser.startinmatchedstring+1);
        } catch (BadLocationException e) {
        }
      } else {
        //VerilogPlugin.println("Not a filename!");
View Full Code Here

Examples of org.eclipse.ui.console.TextConsole

    List added = new ArrayList(consoles.length);
    synchronized (fConsoles) {
      for (int i = 0; i < consoles.length; i++) {
          IConsole console = consoles[i];
          if(console instanceof TextConsole) {
              TextConsole ioconsole = (TextConsole)console;
              createPatternMatchListeners(ioconsole);
          }
        if (!fConsoles.contains(console)) {
          fConsoles.add(console);
          added.add(console);
View Full Code Here

Examples of org.eclipse.ui.console.TextConsole

                        i.remove();
                        continue;
                    }
           
                if (console instanceof TextConsole && extension.isEnabledFor(console)) {
                        TextConsole textConsole = (TextConsole) console;
                    PatternMatchListener patternMatchListener = new PatternMatchListener(extension);
                        try {
                            textConsole.addPatternMatchListener(patternMatchListener);
                            list.add(patternMatchListener);
                        } catch (PatternSyntaxException e) {
                            ConsolePlugin.log(e);
                            i.remove();
                        }
View Full Code Here

Examples of org.jnode.driver.console.TextConsole

        }
    }

    private static TextConsole createConsoleWithShell(final ConsoleManager conMgr, PrintWriter out)
        throws ShellException {
        final TextConsole console = (TextConsole) conMgr.createConsole(null,
                ConsoleManager.CreateOptions.TEXT | ConsoleManager.CreateOptions.SCROLLABLE);
        CommandShell commandShell = new CommandShell(console);
        new Thread(commandShell, "command-shell").start();

        out.println("New console created with name: " + console.getConsoleName());

        // FIXME we shouldn't be setting the invoker (and interpreter) via the System Properties
        // object because it is "global" in some operation modes, and we want to be able to
        // control the invoker / interpreter on a per-console basis.
        String invokerName = System.getProperty(CommandShell.INVOKER_PROPERTY_NAME, "");
        // FIXME this is a temporary hack until we decide what to do about these invokers
        if ("thread".equals(invokerName) || "default".equals(invokerName)) {
            PrintWriter err = new PrintWriter(console.getErr());
            err.println(
                    "Warning: any commands run in this console via their main(String[]) will " +
                    "have the 'wrong' System.out and System.err.");
            err.println("The 'proclet' invoker should give better results.");
            err.println("To use it, type 'exit', run 'set jnode.invoker proclet' " +
View Full Code Here

Examples of org.jnode.driver.console.TextConsole

        public static void main(String[] args) {
            try {
                final ShellManager sm = InitialNaming.lookup(ShellManager.NAME);
                final ConsoleManager conMgr = sm.getCurrentShell().getConsole().getManager();
                final PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
                TextConsole console = createConsoleWithShell(conMgr, out);
                System.setIn(new ReaderInputStream(console.getIn()));
                System.setOut(new PrintStream(new WriterOutputStream(console.getOut(), false), true));
                System.setErr(new PrintStream(new WriterOutputStream(console.getErr(), false), true));
            } catch (Exception ex) {
                // FIXME
                System.out.println("Problem creating the isolated console");
                ex.printStackTrace(System.err);
            }
View Full Code Here

Examples of org.jnode.driver.console.TextConsole

    }
   
    @Override
    public void execute() throws Exception {
        final Shell shell = ShellUtils.getCurrentShell();
        TextConsole tc = (TextConsole) shell.getConsole();
        tc.clear();
        tc.setCursor(0, 0);
    }
View Full Code Here

Examples of org.jnode.driver.console.TextConsole

            } else {
                createConsoleWithShell(conMgr, out);
            }
        } else if (test) {
            out.println("test RawTextConsole");
            final TextConsole console = (TextConsole) conMgr.createConsole(
                    null, ConsoleManager.CreateOptions.TEXT | ConsoleManager.CreateOptions.NO_LINE_EDITTING);
            conMgr.registerConsole(console);
            conMgr.focus(console);
            console.clear();
        }
    }
View Full Code Here

Examples of org.jnode.driver.console.TextConsole

    private static Toolkit createInstance() {
        try {
            final ShellManager sm = InitialNaming.lookup(ShellManager.NAME);
            final ConsoleManager conMgr = sm.getCurrentShell().getConsole().getManager();
            final TextConsole console = (TextConsole) conMgr.createConsole(
                "charva",
                ConsoleManager.CreateOptions.TEXT |
                            ConsoleManager.CreateOptions.STACKED |
                            ConsoleManager.CreateOptions.NO_LINE_EDITTING);
            console.addKeyboardListener(new KeyboardAdapter() {
                public void keyPressed(KeyboardEvent event) {
                    if (event.isControlDown() && event.getKeyChar() == 'z') {
                        System.err.println("got ctrl-z, unregistering Toolkit.");
                        //maybe this will help to debug the finite-sized text
                        // area bug.
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.