Java Code Examples for org.eclipse.core.commands.State#getValue()

The following examples show how to use org.eclipse.core.commands.State#getValue() . 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: CommonEditorPlugin.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
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);
	}
}
 
Example 2
Source File: SelectNextOccurrenceHandler.java    From eclipse-multicursor with Eclipse Public License 1.0 5 votes vote down vote up
private SelectInProgress getCurrentState() {
	State state = getState(ID_SELECTS_IN_PROGRESS);
	if (state == null) {
		return null;
	} else {
		return (SelectInProgress) state.getValue();
	}
}
 
Example 3
Source File: MedicationViewHelper.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
public static ViewerSortOrder getSelectedComparator(){
	ICommandService service =
		(ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
	Command command = service.getCommand(ApplyCustomSortingHandler.CMD_ID);
	State state = command.getState(ApplyCustomSortingHandler.STATE_ID);
	
	if ((Boolean) state.getValue()) {
		return ViewerSortOrder.getSortOrderPerValue(ViewerSortOrder.MANUAL.val);
	} else {
		return ViewerSortOrder.getSortOrderPerValue(ViewerSortOrder.DEFAULT.val);
	}
}
 
Example 4
Source File: PrintTakingsListHandler.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
public SorterAdapter(ExecutionEvent event){
	ICommandService commandService = (ICommandService) HandlerUtil.getActiveSite(event)
		.getService(ICommandService.class);
	if (commandService != null) {
		Command command = commandService.getCommand(ApplyCustomSortingHandler.CMD_ID);
		State state = command.getState(ApplyCustomSortingHandler.STATE_ID);
		if (state.getValue() instanceof Boolean) {
			if ((Boolean) state.getValue()) {
				mode = SorterAdapter.CompareMode.MANUAL;
			}
		}
	}
}