org.eclipse.ui.internal.console.IOConsoleViewer Java Examples

The following examples show how to use org.eclipse.ui.internal.console.IOConsoleViewer. 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: EmacsPlusConsole.java    From e4macs with Eclipse Public License 1.0 6 votes vote down vote up
private StyledText getWidget() {
	// we have to delay this, as the widget/viewer are not set up 
	// until after the console has finished all its delayed Jobs
	if (myWidget == null && myPage != null) {
		myViewer = myPage.getViewer();
		if (myViewer != null) {
			myWidget = myPage.getViewer().getTextWidget();
			myWidget.setEditable(false);
			// restricted: It is lame that we have to cast to internal class to remove this behavior
			if (myViewer instanceof IOConsoleViewer) {
				((IOConsoleViewer)myViewer).setAutoScroll(false);
			}
		}
	}
	return myWidget;
}
 
Example #2
Source File: ConsoleView.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void ownCreatePartControl(final Composite parent) {
	msgConsole = new IOConsole("GAMA Console", null);
	setCharacterLimit(GamaPreferences.Interface.CORE_CONSOLE_SIZE.getValue());
	GamaPreferences.Interface.CORE_CONSOLE_SIZE.onChange(newValue -> setCharacterLimit(newValue));
	viewer = new IOConsoleViewer(parent, msgConsole);
	viewer.setWordWrap(GamaPreferences.Interface.CORE_CONSOLE_WRAP.getValue());
}
 
Example #3
Source File: ConsoleAutoScrollPageParticipant.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
/**
 * @param viewer
 * @param toolBarManager
 * @param scrollLockAction
 */
private ConsoleListener(IOConsoleViewer viewer, IToolBarManager toolBarManager, IAction scrollLockAction)
{
	this.viewer = viewer;
	this.toolBarManager = toolBarManager;
	this.scrollLockAction = scrollLockAction;
}
 
Example #4
Source File: ConsoleAutoScrollPageParticipant.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public void init(IPageBookViewPage page, IConsole console)
{
	if (console.getType() != IDebugUIConstants.ID_PROCESS_CONSOLE_TYPE || !(page instanceof TextConsolePage))
	{
		return;
	}
	TextConsolePage consolePage = (TextConsolePage) page;
	TextConsoleViewer textViewer = consolePage.getViewer();
	if (!(textViewer instanceof IOConsoleViewer))
	{
		return;
	}
	final IOConsoleViewer viewer = (IOConsoleViewer) textViewer;
	scrollActionEnabled = viewer.isAutoScroll();
	final IToolBarManager toolBarManager = consolePage.getSite().getActionBars().getToolBarManager();
	IAction slAction = null;
	// Look for the ScrollLockAction
	for (IContributionItem item : toolBarManager.getItems())
	{
		if (item instanceof ActionContributionItem)
		{
			IAction action = ((ActionContributionItem) item).getAction();
			if (action instanceof ScrollLockAction)
			{
				slAction = action;
				break;
			}
		}
	}
	textWidget = viewer.getTextWidget();
	listener = new ConsoleListener(viewer, toolBarManager, slAction);

	// Based on Eclipse Snippet191 - Detects scrolling that were initiated by the user.
	textWidget.addListener(SWT.MouseDown, listener);
	textWidget.addListener(SWT.MouseMove, listener);
	textWidget.addListener(SWT.MouseUp, listener);
	textWidget.addListener(SWT.KeyDown, listener);
	textWidget.addListener(SWT.KeyUp, listener);
	ScrollBar vBar = textWidget.getVerticalBar();
	if (vBar != null)
	{
		vBar.addListener(SWT.Selection, listener);
	}
}