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