当前位置: 首页>>代码示例>>Java>>正文


Java TextConsolePage.getViewer方法代码示例

本文整理汇总了Java中org.eclipse.ui.console.TextConsolePage.getViewer方法的典型用法代码示例。如果您正苦于以下问题:Java TextConsolePage.getViewer方法的具体用法?Java TextConsolePage.getViewer怎么用?Java TextConsolePage.getViewer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.ui.console.TextConsolePage的用法示例。


在下文中一共展示了TextConsolePage.getViewer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import org.eclipse.ui.console.TextConsolePage; //导入方法依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
public void init(IPageBookViewPage page, IConsole console)
{
	if (console instanceof TextConsole)
	{
		TextConsole textConsole = (TextConsole) console;
		Object themeConsoleStreamToColor = textConsole.getAttribute(THEME_CONSOLE_STREAM_TO_COLOR_ATTRIBUTE);
		if (themeConsoleStreamToColor instanceof Map<?, ?>)
		{
			Map m = (Map) themeConsoleStreamToColor;
			Set<Map.Entry> entrySet = m.entrySet();
			for (Map.Entry entry : entrySet)
			{
				if (!(entry.getKey() instanceof IOConsoleOutputStream) || !(entry.getValue() instanceof String))
				{
					return; // Cannot handle it.
				}
			}
			this.extension = new ConsoleThemer(textConsole, (Map) themeConsoleStreamToColor);
		}
		if (page instanceof TextConsolePage)
		{
			TextConsolePage tcp = (TextConsolePage) page;
			TextViewerThemer themer = new TextViewerThemer(tcp.getViewer());
			themer.apply();
		}
	}
	this.page = page;
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:30,代码来源:ConsoleThemePageParticipant.java

示例2: init

import org.eclipse.ui.console.TextConsolePage; //导入方法依赖的package包/类
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);
	}
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:45,代码来源:ConsoleAutoScrollPageParticipant.java


注:本文中的org.eclipse.ui.console.TextConsolePage.getViewer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。