本文整理汇总了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);
}
}
示例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();
}
}
示例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);
}
}
}
示例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();
}
}
}