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


Java State.setValue方法代码示例

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


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

示例1: updateElement

import org.eclipse.core.commands.State; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
public void updateElement(UIElement element, Map parameters) {
	Activator activator = Activator.getDefault();
	if (activator.getSelectedProjects().size() == 1) {
		IProject project = activator.getSelectedProjects().iterator().next();
		String projectName = project.getName();

		boolean enabled = SpotterProjectSupport.isExpertViewEnabled(projectName);
		State state = getCommandState(null);
		state.setValue(Boolean.valueOf(enabled));

		String label = (enabled ? "Disable" : "Enable") + " Expert View";
		element.setText(label);
	}
}
 
开发者ID:sopeco,项目名称:DynamicSpotter,代码行数:17,代码来源:ExpertViewHandler.java

示例2: toggleButtonOff

import org.eclipse.core.commands.State; //导入方法依赖的package包/类
private void toggleButtonOff(){
	ICommandService commandService =
		(ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
	Command toggleCommand = commandService.getCommand(COMMAND_ID);
	
	State state = toggleCommand.getState("STYLE");
	boolean currentState = (Boolean) state.getValue();
	if (currentState) {
		// turn it off
		state.setValue(!currentState);
		UiDesk.getDisplay().syncExec(new Runnable() {
			
			public void run(){
				commandService.refreshElements(toggleCommand.getId(), null);
			}
		});
	}
}
 
开发者ID:elexis,项目名称:elexis-3-base,代码行数:19,代码来源:InputHandler.java

示例3: execute

import org.eclipse.core.commands.State; //导入方法依赖的package包/类
public final Object execute(ExecutionEvent event) throws ExecutionException {
	ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);

	// update toggled state
	State state = event.getCommand().getState(IMenuStateIds.STYLE);
	if (state == null)
		throw new ExecutionException(
				"You need to declare a ToggleState with id=STYLE for your command to use ToggleHandler!");
	boolean currentState = (Boolean) state.getValue();
	boolean newState = !currentState;
	state.setValue(newState);

	// trigger element update
	executeToggle(event, newState);
	commandService.refreshElements(event.getCommand().getId(), null);

	// return value is reserved for future apis
	return null;
}
 
开发者ID:elexis,项目名称:elexis-3-base,代码行数:20,代码来源:ToggleHandler.java

示例4: execute

import org.eclipse.core.commands.State; //导入方法依赖的package包/类
public final Object execute(ExecutionEvent event) throws ExecutionException {
	ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
	this.commandId = event.getCommand().getId();

	// update toggled state
	State state = event.getCommand().getState(IMenuStateIds.STYLE);
	if (state == null)
		throw new ExecutionException(
				"You need to declare a ToggleState with id=STYLE for your command to use ToggleHandler!");
	boolean currentState = (Boolean) state.getValue();
	boolean newState = !currentState;
	state.setValue(newState);

	// trigger element update
	executeToggle(event, newState);
	commandService.refreshElements(event.getCommand().getId(), null);

	// return value is reserved for future apis
	return null;
}
 
开发者ID:elexis,项目名称:elexis-3-base,代码行数:21,代码来源:ToggleHandler.java

示例5: setToggleCommandState

import org.eclipse.core.commands.State; //导入方法依赖的package包/类
public static void setToggleCommandState(String commandId, String stateId, boolean stateValue) throws ExecutionException
{
	ICommandService svc = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
	Command command = svc.getCommand(commandId);
	State state = command.getState("org.eclipse.ui.commands.toggleState");
	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$
	state.setValue(new Boolean(stateValue));
}
 
开发者ID:Spacecraft-Code,项目名称:SPELL,代码行数:12,代码来源:CommandHelper.java

示例6: setCommandState

import org.eclipse.core.commands.State; //导入方法依赖的package包/类
private void setCommandState(boolean state)
{
	ICommandService service = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
	Command command = service.getCommand(COMMAND_ID);
	State commandState = command.getState(COMMAND_STATE);
	if (((Boolean) commandState.getValue()) != state)
	{
		commandState.setValue(state);
		service.refreshElements(COMMAND_ID, null);
	}
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:12,代码来源:CommonEditorPlugin.java

示例7: setEnabled

import org.eclipse.core.commands.State; //导入方法依赖的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

示例8: changeButtonState

import org.eclipse.core.commands.State; //导入方法依赖的package包/类
public void changeButtonState(Boolean value) {
	ICommandService service = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
	Command command = service.getCommand(ZoomSweepToolHandler.COMMAND_ID);
	State state = command.getState(ZoomSweepToolHandler.ZOOM_SWEEP_TOOGLE_STATE);
	state.setValue(value);
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:7,代码来源:ZoomSweepTool.java

示例9: saveCurrentState

import org.eclipse.core.commands.State; //导入方法依赖的package包/类
private void saveCurrentState(SelectInProgress selectInProgress) {
	State state = new State();
	state.setValue(selectInProgress);
	state.setId(ID_SELECTS_IN_PROGRESS);
	addState(ID_SELECTS_IN_PROGRESS, state);
}
 
开发者ID:caspark,项目名称:eclipse-multicursor,代码行数:7,代码来源:SelectNextOccurrenceHandler.java


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