org.eclipse.debug.ui.console.FileLink Java Examples

The following examples show how to use org.eclipse.debug.ui.console.FileLink. 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: CppStyleConsoleViewer.java    From CppStyle with MIT License 6 votes vote down vote up
@Override
public void mouseDoubleClick(MouseEvent e) {
	StyledText widget = getTextWidget();
	if (widget != null) {
		int offset = -1;
		try {
			Point p = new Point(e.x, e.y);
			offset = widget.getOffsetAtLocation(p);
			FileLink link = getFileLink(offset);

			if (link != null) {
				link.linkActivated();
			}

		} catch (IllegalArgumentException ex) {
		}
	}
}
 
Example #2
Source File: CppStyleConsolePatternMatchListener.java    From CppStyle with MIT License 6 votes vote down vote up
@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 #3
Source File: CppStyleMessageConsole.java    From CppStyle with MIT License 5 votes vote down vote up
public FileLink getFileLink(int offset) {
	try {
		IDocument document = getDocument();
		if (document != null) {
			Position[] positions = document.getPositions(ERROR_MARKER_CATEGORY);
			Position position = findPosition(offset, positions);
			if (position instanceof MarkerPosition) {
				return ((MarkerPosition) position).getFileLink();
			}
		}
	} catch (BadPositionCategoryException e) {
	}
	return null;
}
 
Example #4
Source File: CppStyleConsoleViewer.java    From CppStyle with MIT License 4 votes vote down vote up
public FileLink getFileLink(int offset) {
	if (offset >= 0 && console != null) {
		return console.getFileLink(offset);
	}
	return null;
}
 
Example #5
Source File: CppStyleMessageConsole.java    From CppStyle with MIT License 4 votes vote down vote up
public MarkerPosition(FileLink link, int offset, int length) {
	super(offset, length);
	this.link = link;
}
 
Example #6
Source File: CppStyleMessageConsole.java    From CppStyle with MIT License 4 votes vote down vote up
public FileLink getFileLink() {
	return link;
}