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


Java PatternMatchEvent.getLength方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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.getLength方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。