org.eclipse.ui.console.PatternMatchEvent Java Examples
The following examples show how to use
org.eclipse.ui.console.PatternMatchEvent.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CppStyleConsolePatternMatchListener.java From CppStyle with MIT License | 6 votes |
@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); } }
Example #2
Source File: N4JSExceptionConsoleTracker.java From n4js with Eclipse Public License 1.0 | 5 votes |
@Override public void matchFound(PatternMatchEvent event) { try { int offset = event.getOffset(); int length = event.getLength(); N4JSStackTraceHyperlink link = n4JSStackTraceHyperlinkProvider.get(); link.setTextConsole(console); console.addHyperlink(link, offset + 1, length - 2); } catch (BadLocationException e) { // no link to add } }
Example #3
Source File: ErrorLineMatcher.java From corrosion with Eclipse Public License 2.0 | 5 votes |
@Override public void matchFound(PatternMatchEvent event) { try { int offset = event.getOffset(); int length = event.getLength(); IProcess process = (IProcess) console.getAttribute(IDebugUIConstants.ATTR_CONSOLE_PROCESS); if (process != null) { ILaunch launch = process.getLaunch(); String projectAttribute = RustLaunchDelegateTools.PROJECT_ATTRIBUTE; String launchConfigurationType = launch.getLaunchConfiguration().getType().getIdentifier(); if (launchConfigurationType.equals(RustLaunchDelegateTools.CORROSION_DEBUG_LAUNCH_CONFIG_TYPE)) { // support debug launch configs projectAttribute = ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME; } String projectName = launch.getLaunchConfiguration().getAttribute(projectAttribute, ""); //$NON-NLS-1$ if (projectName.trim().isEmpty()) { return; // can't determine project so prevent error down } IWorkspaceRoot myWorkspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); IProject myProject = myWorkspaceRoot.getProject(projectName); String errorString = console.getDocument().get(event.getOffset(), event.getLength()); String[] coordinates = errorString.split(":"); //$NON-NLS-1$ IHyperlink link = makeHyperlink(myProject.getFile(coordinates[0]), Integer.parseInt(coordinates[1]), Integer.parseInt(coordinates[2])); console.addHyperlink(link, offset, length); } } catch (BadLocationException | CoreException e) { // ignore } }
Example #4
Source File: PatternToHyperlinkConverter.java From google-cloud-eclipse with Apache License 2.0 | 5 votes |
@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); } } }
Example #5
Source File: ConsoleHyperlinking.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
@Override public void matchFound(final PatternMatchEvent event) { try { final int offset = event.getOffset(); final int length = event.getLength(); String _get = this.console.getDocument().get(offset, length); final XtendFileHyperlink link = new XtendFileHyperlink(_get, this.workbench, this.console); this.console.addHyperlink(link, offset, length); } catch (final Throwable _t) { if (_t instanceof BadLocationException || _t instanceof NumberFormatException) { } else { throw Exceptions.sneakyThrow(_t); } } }