• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java RegistryToggleState类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.eclipse.ui.handlers.RegistryToggleState的典型用法代码示例。如果您正苦于以下问题:Java RegistryToggleState类的具体用法?Java RegistryToggleState怎么用?Java RegistryToggleState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



RegistryToggleState类属于org.eclipse.ui.handlers包,在下文中一共展示了RegistryToggleState类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: setEnabled

import org.eclipse.ui.handlers.RegistryToggleState; //导入依赖的package包/类
@Override
public void setEnabled(final Object evaluationContext) {

	super.setEnabled(evaluationContext);

	if (_isAppPhotoFilterInitialized == false) {

		_isAppPhotoFilterInitialized = true;

		/*
		 * initialize app photo filter, this is a hack because the whole app startup should be
		 * sometimes be streamlined, it's more and more confusing
		 */
		final Command command = ((ICommandService) PlatformUI//
				.getWorkbench()
				.getService(ICommandService.class))//
				.getCommand(ActionHandlerPhotoFilter.COMMAND_ID);

		final State state = command.getState(RegistryToggleState.STATE_ID);
		final Boolean isPhotoFilterActive = (Boolean) state.getValue();

		TourbookPlugin.setActivePhotoFilter(isPhotoFilterActive);
	}
}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:25,代码来源:ActionHandlerPhotoFilter.java


示例2: test

import org.eclipse.ui.handlers.RegistryToggleState; //导入依赖的package包/类
public boolean test(final Object receiver, final String property,
		final Object[] args, final Object expectedValue) {
	if (receiver instanceof IServiceLocator && args.length == 1
			&& args[0] instanceof String) {
		final IServiceLocator locator = (IServiceLocator) receiver;
		if (TOGGLE_PROPERTY_NAME.equals(property)) {
			final String commandId = args[0].toString();
			final ICommandService commandService = (ICommandService) locator
					.getService(ICommandService.class);
			final Command command = commandService.getCommand(commandId);
			final State state = command
					.getState(RegistryToggleState.STATE_ID);
			if (state != null) {
				return state.getValue().equals(expectedValue);
			}
		}
	}
	return false;
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:20,代码来源:CommandsPropertyTester.java


示例3: setEnabled

import org.eclipse.ui.handlers.RegistryToggleState; //导入依赖的package包/类
@Override
public void setEnabled(Object evaluationContext)
{
	Object activeSite = ((IEvaluationContext) evaluationContext).getVariable(ISources.ACTIVE_SITE_NAME);
	Object activeEditor = ((IEvaluationContext) evaluationContext).getVariable(ISources.ACTIVE_EDITOR_NAME);
	if (activeSite instanceof IWorkbenchSite && activeEditor instanceof AbstractThemeableEditor)
	{
		ICommandService commandService = (ICommandService) ((IWorkbenchSite) activeSite)
				.getService(ICommandService.class);
		Command command = commandService.getCommand(COMMAND_ID);
		State state = command.getState(RegistryToggleState.STATE_ID);
		state.setValue(((AbstractThemeableEditor) activeEditor).getWordWrapEnabled());
	}
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:15,代码来源:ToggleWordWrapHandler.java


示例4: selectionChanged

import org.eclipse.ui.handlers.RegistryToggleState; //导入依赖的package包/类
protected void selectionChanged(ISelection selection) {
	boolean enabled = isEnabledForSelection(selection);
	setBaseEnabled(enabled);
	Command command = getCommand();
	State state = command.getState(RegistryToggleState.STATE_ID);
	if (state != null) {
		boolean checked = isCheckedForSelection(selection);
		try {
			setCommandState(command, checked);
		} catch (ExecutionException e) {
			LogUtil.error(e);
		}
	}
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:15,代码来源:AbstractPlanEditorHandler.java


示例5: getCommandState

import org.eclipse.ui.handlers.RegistryToggleState; //导入依赖的package包/类
protected static boolean getCommandState(Command command) {
	State toggleState = command.getState(RegistryToggleState.STATE_ID);
	if (toggleState != null) {
		Object value = toggleState.getValue();
		if (CommonUtils.equals(Boolean.TRUE, value)) {
			return true;
		}
	}
	return false;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:11,代码来源:AbstractPlanEditorHandler.java


示例6: setCommandState

import org.eclipse.ui.handlers.RegistryToggleState; //导入依赖的package包/类
protected static void setCommandState(Command command, boolean newValue) throws ExecutionException {
	State state = command.getState(RegistryToggleState.STATE_ID);
	if(state == null)
		throw new ExecutionException("The command does not have a toggle state"); //$NON-NLS-1$
	 if(!(state.getValue() instanceof Boolean))
		throw new ExecutionException("The command's toggle state doesn't contain a boolean value"); //$NON-NLS-1$
	boolean oldValue = ((Boolean) state.getValue()).booleanValue();
	if (oldValue != newValue) {
		HandlerUtil.toggleCommandState(command);
	}
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:12,代码来源:AbstractPlanEditorHandler.java


示例7: createPartControl

import org.eclipse.ui.handlers.RegistryToggleState; //导入依赖的package包/类
@Override
public void createPartControl(final Composite parent) {
	view.createView(parent);
	
	final ICommandService commandService = (ICommandService)getSite().getService(ICommandService.class);
	final Command command = commandService.getCommand(UIConstants.TOGGLE_SHOW_ONLY_ERRORS_AND_WARNINGS_COMMAND_ID);
	setShowOnlyErrorsAndWarnings((Boolean)command.getState(RegistryToggleState.STATE_ID).getValue());
}
 
开发者ID:smaccm,项目名称:smaccm,代码行数:9,代码来源:PropertiesViewPart.java


示例8: setEnabled

import org.eclipse.ui.handlers.RegistryToggleState; //导入依赖的package包/类
@Override
	public void setEnabled(final Object evaluationContext) {

		super.setEnabled(evaluationContext);

		if (_isInitializedState && _isInitializedView) {
			return;
		}

		final IWorkbench wb = PlatformUI.getWorkbench();

		if (_isInitializedState == false) {

			/**
			 * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
			 * <p>
			 * getting the state works only the first time, otherwise it returns the OLD state
			 * <p>
			 * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
			 */

			final Command command = ((ICommandService) wb.getService(ICommandService.class)).getCommand(COMMAND_ID);

			final State state = command.getState(RegistryToggleState.STATE_ID);

			_isSyncPhotoWithTour = (Boolean) state.getValue();

			_isInitializedState = true;
		}

		/*
		 * get PicDirView
		 */
		PicDirView picDirView = null;

		for (final IWorkbenchWindow wbWindow : wb.getWorkbenchWindows()) {

			final IWorkbenchPage wbPage = wbWindow.getActivePage();

			if (wbPage != null) {

				for (final IViewReference viewRef : wbPage.getViewReferences()) {
					if (viewRef.getId().equals(PicDirView.ID)) {
						final IViewPart viewPart = viewRef.getView(false);
						if (viewPart instanceof PicDirView) {
							picDirView = (PicDirView) viewPart;
							break;
						}
					}
				}
			}
		}

		if (picDirView != null) {

			_isInitializedView = true;

			picDirView.setSelectionConverter(_isSyncPhotoWithTour ? _syncSelectionProvider : null);
		}

//		System.out.println(UI.timeStampNano() + " _isSyncPhotoWithTour " + _isSyncPhotoWithTour);
//		// TODO remove SYSTEM.OUT.PRINTLN
	}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:64,代码来源:ActionHandlerSyncPhotoWithTour.java


示例9: onSelectionChanged

import org.eclipse.ui.handlers.RegistryToggleState; //导入依赖的package包/类
private void onSelectionChanged(final ISelection selection, final IWorkbenchPart part) {

//		System.out.println(UI.timeStampNano() + " onSelectionChanged\t" + selection);
//		// TODO remove SYSTEM.OUT.PRINTLN

		if (selection instanceof SyncSelection) {

			final ISelection originalSelection = ((SyncSelection) selection).getSelection();

			if (originalSelection instanceof PhotoSelection) {
				showPhotosAndTours(((PhotoSelection) originalSelection).galleryPhotos);
			}

		} else if (selection instanceof PhotoSelection && part instanceof PicDirView) {

			/**
			 * accept photo selection ONLY from the pic dir view, otherwise other photo selections
			 * will cause a view update
			 */

			final PhotoSelection photoSelection = (PhotoSelection) selection;

			final Command command = _commandService.getCommand(ActionHandlerSyncPhotoWithTour.COMMAND_ID);
			final State state = command.getState(RegistryToggleState.STATE_ID);
			final boolean isSync = (Boolean) state.getValue();

			if (isSync) {
				showPhotosAndTours(photoSelection.galleryPhotos);
			}

		} else if (selection instanceof SelectionDeletedTours) {

			clearView();

			_photoMgr.resetTourStartEnd();
		}
	}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:38,代码来源:TourPhotoLinkView.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ParsedTupleQuery类代码示例发布时间:2022-05-22
下一篇:
Java ContentLengthStrategy类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap