Java Code Examples for org.eclipse.jface.action.IContributionItem#update()

The following examples show how to use org.eclipse.jface.action.IContributionItem#update() . 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: MendeleyOverlayDecorator.java    From slr-toolkit with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * THis method sets the main menu contribution 'Mendeley' to visible
 */
private void updateMenuContribution() {
	if(window instanceof WorkbenchWindow) {
		MenuManager menuManager = ((WorkbenchWindow)window).getMenuManager();
	    
	    //you'll need to find the id for the item
	    String mainMenuId = "de.tudresden.slr.model.mendeley.menus.mainMenu";
	    IContributionItem item = menuManager.find(mainMenuId);
	    item.update();
	    if (item != null) {
	        // clean old one
	        item.setVisible(true);

	        // refresh menu gui
	        menuManager.update();
	    }
	}
}
 
Example 2
Source File: KonsDetailView.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void setUnlocked(boolean unlocked){
	boolean hlMandantEnabled =
		actEncounter != null && BillingServiceHolder.get().isEditable(actEncounter).isOK()
			&& CoreHub.acl.request(AccessControlDefaults.KONS_REASSIGN) && unlocked;
	hlMandant.setEnabled(hlMandantEnabled);
	boolean cbFallEnabled = actEncounter != null
		&& BillingServiceHolder.get().isEditable(actEncounter).isOK() && unlocked;
	comboViewerFall.getCombo().setEnabled(cbFallEnabled);
	text.setEditable(unlocked);
	
	// update the UI
	IToolBarManager mgr = ((IViewSite) getSite()).getActionBars().getToolBarManager();
	IContributionItem[] items = mgr.getItems();
	for (IContributionItem iContributionItem : items) {
		iContributionItem.update();
	}
}
 
Example 3
Source File: ViewMenus.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
private void fillContextMenu(IMenuManager manager, List<IContributionItem> contributionItems){
	manager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
	for (IContributionItem contributionItem : contributionItems) {
		if (contributionItem == null) {
			manager.add(new Separator());
			continue;
		} else if (contributionItem instanceof ActionContributionItem) {
			ActionContributionItem ac = (ActionContributionItem) contributionItem;
			if (ac.getAction() instanceof RestrictedAction) {
				((RestrictedAction) ac.getAction()).reflectRight();
			}
		}
		contributionItem.update();
		manager.add(contributionItem);
	}
}
 
Example 4
Source File: ContractPropertySection.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void refresh() {
    super.refresh();
    for (final IContributionItem object : form.getToolBarManager().getItems()) {
        object.update();
    }
}
 
Example 5
Source File: VerrechnungsDisplay.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
private void updateUi(){
	if (toolBarManager != null) {
		for (IContributionItem contribution : toolBarManager.getItems()) {
			contribution.update();
		}
		toolBarManager.update(true);
	}
	viewer.getTable().setEnabled(actEncounter != null && actEncounter.isBillable());
}
 
Example 6
Source File: ArticleDefaultSignatureComposite.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
public void setArticleToBind(IArticle article, boolean lookup){
	if (!isDisposed()) {
		IArticleDefaultSignature signature = getSignature();
		if (signature != null) {
			// only save if the signature was saved before !?!?!?!?!?
			if (CoreModelServiceHolder.get()
				.load(signature.getId(), IArticleDefaultSignature.class).isPresent()) {
				CoreModelServiceHolder.get().save(signature);
			}
		}
		// update with new article signature
		this.article = article;
		if (lookup) {
			Optional<IArticleDefaultSignature> defSignature =
				MedicationServiceHolder.get().getDefaultSignature(article);
			
			if (!defSignature.isPresent()) {
				IArticleDefaultSignature transientSignature =
					MedicationServiceHolder.get().getTransientDefaultSignature(article);
				signatureItem.setValue(transientSignature);
			} else {
				signatureItem.setValue(defSignature.get());
			}
		} else {
			signatureItem
				.setValue(MedicationServiceHolder.get().getTransientDefaultSignature(article));
		}
		updateTargetNonDatabinding();
		// update the toolbar
		for (IContributionItem item : toolbarManager.getItems()) {
			item.update();
		}
	}
}
 
Example 7
Source File: MedicationTableViewerContentProvider.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
public void refresh(){
	if (contentProvider != null && contentProvider.input != null) {
		currentState.setText(contentProvider.currentPageOffset + " - "
			+ (contentProvider.currentPageOffset + contentProvider.pageSize) + " / "
			+ contentProvider.input.size());
	} else {
		currentState.setText(" / ");
	}
	layout();
	for (IContributionItem item : toolbarmgr.getItems()) {
		item.update();
	}
}