当前位置: 首页>>代码示例>>Java>>正文


Java PatternMatchEvent类代码示例

本文整理汇总了Java中org.eclipse.ui.console.PatternMatchEvent的典型用法代码示例。如果您正苦于以下问题:Java PatternMatchEvent类的具体用法?Java PatternMatchEvent怎么用?Java PatternMatchEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PatternMatchEvent类属于org.eclipse.ui.console包,在下文中一共展示了PatternMatchEvent类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: matchFound

import org.eclipse.ui.console.PatternMatchEvent; //导入依赖的package包/类
@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);
	}
}
 
开发者ID:wangzw,项目名称:CppStyle,代码行数:21,代码来源:CppStyleConsolePatternMatchListener.java

示例2: matchFound

import org.eclipse.ui.console.PatternMatchEvent; //导入依赖的package包/类
@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);	
	}

}
 
开发者ID:jesusc,项目名称:eclectic,代码行数:21,代码来源:PatternMatchListenerDelegate.java

示例3: matchFound

import org.eclipse.ui.console.PatternMatchEvent; //导入依赖的package包/类
@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();
    }
}
 
开发者ID:smaccm,项目名称:smaccm,代码行数:18,代码来源:AgreePatternListener.java

示例4: matchFound

import org.eclipse.ui.console.PatternMatchEvent; //导入依赖的package包/类
@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);
    }
  }
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:15,代码来源:PatternToHyperlinkConverter.java

示例5: matchFound

import org.eclipse.ui.console.PatternMatchEvent; //导入依赖的package包/类
@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);
	}
}
 
开发者ID:mjwach,项目名称:ErrorLinkyThing,代码行数:29,代码来源:ErrorLinkyPatternMatchListenerDelegate.java

示例6: matchFound

import org.eclipse.ui.console.PatternMatchEvent; //导入依赖的package包/类
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;
}
 
开发者ID:eclipse,项目名称:cft,代码行数:7,代码来源:AbstractConsoleMonitorAppStateTracker.java

示例7: matchFound

import org.eclipse.ui.console.PatternMatchEvent; //导入依赖的package包/类
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();
  } 
}
  }
 
开发者ID:umple,项目名称:umple,代码行数:48,代码来源:UmplePatternMatcher.java


注:本文中的org.eclipse.ui.console.PatternMatchEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。