當前位置: 首頁>>代碼示例>>Java>>正文


Java ICommandService.refreshElements方法代碼示例

本文整理匯總了Java中org.eclipse.ui.commands.ICommandService.refreshElements方法的典型用法代碼示例。如果您正苦於以下問題:Java ICommandService.refreshElements方法的具體用法?Java ICommandService.refreshElements怎麽用?Java ICommandService.refreshElements使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.ui.commands.ICommandService的用法示例。


在下文中一共展示了ICommandService.refreshElements方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: execute

import org.eclipse.ui.commands.ICommandService; //導入方法依賴的package包/類
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
  this.decoratorManager = Activator.getDefault().getWorkbench().getDecoratorManager();

  if (!this.isHidden) {
    this.isHidden = true;
    this.setStore(false);
    this.setDecorator(false);
  } else {
    this.isHidden = false;
    this.setStore(true);
    this.setDecorator(true);
  }
  this.store.needsSaving();

  final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
  final ICommandService commandService = window.getService(ICommandService.class);
  if (commandService != null) {
    commandService.refreshElements(COMMAND_ID, null);
  }
  return null;
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:23,代碼來源:MarkerVisibilityHandler.java

示例2: setCoolBarVisibility

import org.eclipse.ui.commands.ICommandService; //導入方法依賴的package包/類
public static void setCoolBarVisibility(boolean visible)
{
	IWorkbenchWindow activeWorkbenchWindow = getActiveWorkbenchWindow();
	if (activeWorkbenchWindow instanceof WorkbenchWindow)
	{
		WorkbenchWindow workbenchWindow = (WorkbenchWindow) activeWorkbenchWindow;
		workbenchWindow.setCoolBarVisible(visible);
		workbenchWindow.setPerspectiveBarVisible(visible);

		// Try to force a refresh of the text on the action
		IWorkbenchPart activePart = getActivePart();
		if (activePart != null)
		{
			ICommandService cmdService = (ICommandService) activePart.getSite().getService(ICommandService.class);
			cmdService.refreshElements("org.eclipse.ui.ToggleCoolbarAction", null); //$NON-NLS-1$
		}
	}
}
 
開發者ID:apicloudcom,項目名稱:APICloud-Studio,代碼行數:19,代碼來源:UIUtils.java

示例3: execute

import org.eclipse.ui.commands.ICommandService; //導入方法依賴的package包/類
/**
 * @throws ExecutionException  
 */
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	IEditorPart editor = HandlerUtil.getActiveEditor(event);
	IEditorInput editorInput = editor.getEditorInput();
	PlanEditorModel model = PlanEditorModelRegistry.getPlanEditorModel(editorInput);
	EPlan plan = model.getEPlan();
	PlanModifierMember planModifierMember = PlanModifierMember.get(plan);
	String factoryName = event.getParameter("name");
	PlanModifierFactory factory = (factoryName != null ? getNamedFactory(factoryName) : getNextFactory(planModifierMember));
	if (factory != null) {
		IPlanModifier modifier = factory.instantiateModifier();
		modifier.initialize(plan);
		planModifierMember.setModifier(modifier);
		ICommandService commandService = (ICommandService)editor.getSite().getService(ICommandService.class);
		commandService.refreshElements(event.getCommand().getId(), null);
	}
	return null;
}
 
開發者ID:nasa,項目名稱:OpenSPIFe,代碼行數:22,代碼來源:PlanModifierHandler.java

示例4: execute

import org.eclipse.ui.commands.ICommandService; //導入方法依賴的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

示例5: execute

import org.eclipse.ui.commands.ICommandService; //導入方法依賴的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

示例6: execute

import org.eclipse.ui.commands.ICommandService; //導入方法依賴的package包/類
/**
 * Execute the command, read the regional code from the parameter passed by the plugin file and
 * call the method to write the regional code to the configuration. If the configuration is modified
 * than call a restart
 */
public Object execute(ExecutionEvent event) throws ExecutionException {
	String locale = event.getParameter("com.jaspersoft.studio.switchlanguage.locale"); //$NON-NLS-1$
	boolean needToRestart = changeLocale(locale);
	if (needToRestart) {
		MessageDialog dialog = new MessageDialog(UIUtils.getShell(), Messages.SwitchLanguageHandler_restartTitle, null,
				Messages.SwitchLanguageHandler_restartMessage, MessageDialog.QUESTION, new String[] { Messages.common_yes , Messages.common_no}, 1); 
		int selection = dialog.open();
		if (selection == 0){
			//Some OS (linux\mac) dosen't reload the configuration file after the restart. So when eclipse is 
			//re-launched it is done with the -nl parameter to the new locale. Essentially it's like it is launched
			//from command line with the explicit nl parameter
			String command_line = buildCommandLine(locale);
			System.setProperty(PROP_EXIT_DATA, command_line);
			System.setProperty(PROP_EXIT_CODE, IApplication.EXIT_RELAUNCH.toString());
			return new RestartWorkbenchHandler().execute(event);
		} else {
			//Request an update of the locale provider and force the update of the menu item, in this way the language
			//menu is show updated even without a restart
			IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
			ISourceProviderService service = (ISourceProviderService) window.getService(ISourceProviderService.class);
			LocaleSourceProvider sessionSourceProvider = (LocaleSourceProvider) service.getSourceProvider(LocaleSourceProvider.ACTUAL_LOCALE);
			sessionSourceProvider.forceRefreshLocale();
			ICommandService commandService = (ICommandService)window.getService(ICommandService.class); 
			commandService.refreshElements("com.jaspersoft.studio.switchlanguage.command", null);
		}
	}
	return null;
}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:34,代碼來源:SwitchLanguageHandler.java

示例7: execute

import org.eclipse.ui.commands.ICommandService; //導入方法依賴的package包/類
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
	GamaPreferences.Runtime.CORE_SHOW_ERRORS.set(!GamaPreferences.Runtime.CORE_SHOW_ERRORS.getValue());
	final ICommandService service =
			HandlerUtil.getActiveWorkbenchWindowChecked(event).getService(ICommandService.class);
	service.refreshElements(event.getCommand().getId(), null);
	if (GamaPreferences.Runtime.CORE_SHOW_ERRORS.getValue()) {
		GAMA.getGui().showView(null, ErrorView.ID, null, IWorkbenchPage.VIEW_VISIBLE);
	} else {
		WorkbenchHelper.hideView(ErrorView.ID);
	}
	return null;
}
 
開發者ID:gama-platform,項目名稱:gama,代碼行數:14,代碼來源:ShowErrors.java

示例8: execute

import org.eclipse.ui.commands.ICommandService; //導入方法依賴的package包/類
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
	GamaPreferences.Runtime.CORE_REVEAL_AND_STOP.set(!GamaPreferences.Runtime.CORE_REVEAL_AND_STOP.getValue());
	final ICommandService service =
			HandlerUtil.getActiveWorkbenchWindowChecked(event).getService(ICommandService.class);
	service.refreshElements(event.getCommand().getId(), null);
	return null;
}
 
開發者ID:gama-platform,項目名稱:gama,代碼行數:9,代碼來源:ErrorsPauseAndEdit.java

示例9: execute

import org.eclipse.ui.commands.ICommandService; //導入方法依賴的package包/類
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
	GamaPreferences.Runtime.CORE_WARNINGS.set(!GamaPreferences.Runtime.CORE_WARNINGS.getValue());
	final ICommandService service =
			HandlerUtil.getActiveWorkbenchWindowChecked(event).getService(ICommandService.class);
	service.refreshElements(event.getCommand().getId(), null);
	return null;
}
 
開發者ID:gama-platform,項目名稱:gama,代碼行數:9,代碼來源:TreatWarningsAsErrors.java

示例10: setCommandState

import org.eclipse.ui.commands.ICommandService; //導入方法依賴的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

示例11: execute

import org.eclipse.ui.commands.ICommandService; //導入方法依賴的package包/類
/**
 * @throws ExecutionException
 */
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	IToggleFlattenEditor editor = getMergeEditor(HandlerUtil.getActiveEditor(event));
	editor.toggleFlatten();
	IEditorSite editorSite = editor.getEditorSite();
	ICommandService commandService = (ICommandService)editorSite.getService(ICommandService.class);
	commandService.refreshElements(event.getCommand().getId(), null);
	return null;
}
 
開發者ID:nasa,項目名稱:OpenSPIFe,代碼行數:13,代碼來源:FlattenHandler.java

示例12: refreshEditorCommand

import org.eclipse.ui.commands.ICommandService; //導入方法依賴的package包/類
/**
 * Refresh the editor command UI representation through refreshElements.
 * 
 * @param editorPartReference
 * @return
 */
protected IEditorPart refreshEditorCommand(IEditorReference editorPartReference) {
	if (editorPartReference == null) {
		return null;
	}
	IEditorPart newEditor = editorPartReference.getEditor(false);
	if (newEditor != null) {
		IEditorSite editorSite = newEditor.getEditorSite();
		ICommandService commandService = (ICommandService) editorSite.getService(ICommandService.class);
		IWorkbenchWindow activeWindow = editorSite.getPage().getWorkbenchWindow();
		Map<String, IWorkbenchWindow> refreshFilter = Collections.singletonMap(IServiceScopes.WINDOW_SCOPE, activeWindow);
		commandService.refreshElements(commandId, refreshFilter);
	}
	return newEditor;
}
 
開發者ID:nasa,項目名稱:OpenSPIFe,代碼行數:21,代碼來源:CommandRefreshingActiveEditorPartListener.java

示例13: changeLayout

import org.eclipse.ui.commands.ICommandService; //導入方法依賴的package包/類
/**
 * 改變當前布局 ;
 */
public void changeLayout() {
	isHorizontalLayout = !isHorizontalLayout;
	changeLayout(isHorizontalLayout);
	// 刷新工具欄的改變布局按鈕的圖片
	ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
	commandService.refreshElements("net.heartsome.cat.ts.ui.handlers.ChangeXliffEditorModelCommand", null);
}
 
開發者ID:heartsome,項目名稱:translationstudio8,代碼行數:11,代碼來源:XLIFFEditorImplWithNatTable.java

示例14: postWindowOpen

import org.eclipse.ui.commands.ICommandService; //導入方法依賴的package包/類
@Override
	public void postWindowOpen() {
		IWorkbenchWindow workbenchWindow = getWindowConfigurer().getWindow();
//		workbenchWindow.getShell().setMaximized(true);
		
		restorEditorHistory();
		saveEditorHistory();
		
		final ICommandService commandService = (ICommandService) workbenchWindow.getService(ICommandService.class);
	
		// 在程序主體窗口打開之前,更新打開工具欄的菜單,讓它初始化菜單圖片 --robert 2012-03-19
		commandService.refreshElements("net.heartsome.cat.ts.openToolBarCommand", null);

		// 添加監聽
		addViewPartVisibleListener(workbenchWindow);

		addWorkplaceListener();
		// 自動檢查更新
		automaticCheckUpdate();
		
		// 設置將文件拖到導航視圖時的模式為直接複製
		setDragModle();
		
		setListenerToPespective(commandService);
		
		setIdToHelpSystem();
		
		setProgressIndicatorVisible(false);
		
		setInitLinkEnable();
		
		// 處理 hunspell 內置詞典內置文件
		try {
			CommonFunction.unZipHunspellDics();
		} catch (Exception e) {
			e.printStackTrace();
		}
		
	}
 
開發者ID:heartsome,項目名稱:translationstudio8,代碼行數:40,代碼來源:ApplicationWorkbenchWindowAdvisor.java

示例15: execute

import org.eclipse.ui.commands.ICommandService; //導入方法依賴的package包/類
public Object execute(ExecutionEvent event) throws ExecutionException {

		IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore();
		boolean oldValue = preferenceStore.getBoolean(TsPreferencesConstant.TS_statusBar_status);
		
		ApplicationWorkbenchWindowAdvisor configurer = ApplicationWorkbenchAdvisor.WorkbenchWindowAdvisor;
        configurer.setStatusVisible(!oldValue);
		
		preferenceStore.setValue(TsPreferencesConstant.TS_statusBar_status, !oldValue);
		ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
		commandService.refreshElements(event.getCommand().getId(), null);
		
		return null;
	}
 
開發者ID:heartsome,項目名稱:translationstudio8,代碼行數:15,代碼來源:OpenStatusBarHandler.java


注:本文中的org.eclipse.ui.commands.ICommandService.refreshElements方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。