Java 类org.eclipse.ui.console.PatternMatchEvent 实例源码

项目:CppStyle    文件:CppStyleConsolePatternMatchListener.java   
@Override
public void matchFound(PatternMatchEvent event) {
    try {
        CppStyleMessageConsole console = (CppStyleMessageConsole) event.getSource();

        String line = console.getDocument().get(event.getOffset(), event.getLength());

        Matcher m = pattern.matcher(line);
        if (m.matches()) {
            String ln = m.group(lineNumGroup);

            int lineno = Integer.parseInt(ln);

            FileLink link = new FileLink(file, null, -1, -1, lineno == 0 ? 1 : lineno);
            console.addFileLink(link, event.getOffset(), event.getLength());
        }
    } catch (BadLocationException e) {
        CppStyle.log("Failed to add link", e);
    }
}
项目:eclectic    文件:PatternMatchListenerDelegate.java   
@Override
public void matchFound(PatternMatchEvent event)  {
       int offset = event.getOffset();
       int length = event.getLength();
       int prefix = 0;

       try {
           String text = fConsole.getDocument().get(offset, length);

           IHyperlink link = new EclecticTraceHyperLink(fConsole);

        fConsole.addHyperlink(link, offset, length);
    } catch (BadLocationException e) {
        e.printStackTrace();
        throw new RuntimeException(e);
        // IStatus status = new Status(IStatus.ERROR, "org.eclectic.debug.ui", 0, "Cannot set link for " + event, e);
        // throw new CoreException(status); 
    }

}
项目:smaccm    文件:AgreePatternListener.java   
@Override
public void matchFound(PatternMatchEvent event) {
    // remove the brackets
    int offset = event.getOffset() + 1;
    int length = event.getLength() - 2;
    try {
        String name = console.getDocument().get(offset, length);
        EObject ref = findBestReference(name);

        if (ref != null) {
            IHyperlink hyperlink = new AgreeConsoleHyperLink(ref);
            console.addHyperlink(hyperlink, offset, length);
        }
    } catch (BadLocationException e) {
        e.printStackTrace();
    }
}
项目:google-cloud-eclipse    文件:PatternToHyperlinkConverter.java   
@Override
public void matchFound(PatternMatchEvent event) {
  if (event.getSource() instanceof TextConsole) {
    try {
      final TextConsole console = (TextConsole) event.getSource();
      final int start = event.getOffset();
      final int length = event.getLength();
      IHyperlink link = new BrowserSupportBasedHyperlink(console.getDocument().get(start, length));
      console.addHyperlink(link, start, length);
    } catch (BadLocationException e) {
      logger.log(Level.SEVERE, "Cannot create hyperlink", e);
    }
  }
}
项目:ErrorLinkyThing    文件:ErrorLinkyPatternMatchListenerDelegate.java   
@Override
public void matchFound(PatternMatchEvent event)
{
    try
    {
        String fileReferenceText = console.getDocument().get(event.getOffset(), event.getLength());
        int separatorIndex = fileReferenceText.lastIndexOf(":");

        String absoluteFilePath = fileReferenceText.substring(0, separatorIndex);
        //String workspacePath = ResourcesPlugin.getWorkspace().getRoot().getLocation().toString();

        //if (absoluteFilePath.startsWith(workspacePath))
        {
            //String relativeFilePath = absoluteFilePath.substring(workspacePath.length());
            //IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(relativeFilePath));  // this way can work, but only for files in the workspace :(

            int lineNumber = Integer.parseInt(fileReferenceText.substring(separatorIndex + 1));

            //FileLink hyperlink = new FileLink(file, null, -1, -1, lineNumber); // a link to a file in the workspace
            IHyperlink hyperlink = makeHyperlink(absoluteFilePath, lineNumber); // a link to any file
            console.addHyperlink(hyperlink, event.getOffset(), event.getLength());
        }
    }
    catch (Exception exception)
    {
        throw new RuntimeException(exception);
    }
}
项目:ErrorLinkyThing    文件:ErrorLinkyPatternMatchListenerDelegate.java   
@Override
public void matchFound(PatternMatchEvent event)
{
    try
    {
        String fileReferenceText = console.getDocument().get(event.getOffset(), event.getLength());
        int separatorIndex = fileReferenceText.lastIndexOf(":");

        String absoluteFilePath = fileReferenceText.substring(0, separatorIndex);
        //String workspacePath = ResourcesPlugin.getWorkspace().getRoot().getLocation().toString();

        //if (absoluteFilePath.startsWith(workspacePath))
        {
            //String relativeFilePath = absoluteFilePath.substring(workspacePath.length());
            //IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(relativeFilePath));  // this way can work, but only for files in the workspace :(

            int lineNumber = Integer.parseInt(fileReferenceText.substring(separatorIndex + 1));

            //FileLink hyperlink = new FileLink(file, null, -1, -1, lineNumber); // a link to a file in the workspace
            IHyperlink hyperlink = makeHyperlink(absoluteFilePath, lineNumber); // a link to any file
            console.addHyperlink(hyperlink, event.getOffset(), event.getLength());
        }
    }
    catch (Exception exception)
    {
        throw new RuntimeException(exception);
    }
}
项目:cft    文件:AbstractConsoleMonitorAppStateTracker.java   
public void matchFound(PatternMatchEvent event) {
    if (Logger.INFO) {
        Logger.println(Logger.INFO_LEVEL, this, "matchFound", "Application start detected: " + appName); //$NON-NLS-1$ //$NON-NLS-2$
    }
    appState = IServer.STATE_STARTED;
}
项目:dockerfoundry    文件:AbstractConsoleMonitorAppStateTracker.java   
public void matchFound(PatternMatchEvent event) {
    if (Logger.INFO) {
        Logger.println(Logger.INFO_LEVEL, this, "matchFound", "Application start detected: " + appName); //$NON-NLS-1$ //$NON-NLS-2$
    }
    appState = IServer.STATE_STARTED;
}
项目:umple    文件:UmplePatternMatcher.java   
public void matchFound(PatternMatchEvent event) {
if(fConsole!=null){
  int eventOffset= event.getOffset();
  int eventLength= event.getLength();
  IDocument document= fConsole.getDocument();
  String matchedText= null;

  try {
    matchedText= document.get(eventOffset, eventLength);
    String filename = matchedText.split(":")[0];
    //ResourcesPlugin.getWorkspace().getRoot().findMember("/test/src/");
    String filepath = "";
    IFile file = null;
    for(IProject p: ResourcesPlugin.getWorkspace().getRoot().getProjects())
    {               
        for(java.io.File f: new java.io.File(p.getLocationURI().getPath()).listFiles())
        {
            if(f.isDirectory())
            {
              file = search(p.getFolder(f.getName()),filename);
              if(file!=null)
              {
                break;
              }
            }
            else
            {
              if(f.getName().equals(filename))
              {
                file = p.getFile(filename);
                break;
              }
            }                   
        }
        if(file!=null)
        {
          break;
        }
    }

    FileLink fileLink = new FileLink(file, null, -1, -1, Integer.parseInt(matchedText.split(":")[1]));
    (fConsole).addHyperlink(fileLink, eventOffset, eventLength);
  } catch (BadLocationException e){
    e.printStackTrace();
  } 
}
  }