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


Java IContributionItem類代碼示例

本文整理匯總了Java中org.eclipse.jface.action.IContributionItem的典型用法代碼示例。如果您正苦於以下問題:Java IContributionItem類的具體用法?Java IContributionItem怎麽用?Java IContributionItem使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: changeIcon

import org.eclipse.jface.action.IContributionItem; //導入依賴的package包/類
private static void changeIcon(final IMenuManager menu, final IContributionItem item,
		final ImageDescriptor image) {
	if (item instanceof ActionContributionItem) {
		((ActionContributionItem) item).getAction().setImageDescriptor(image);
	} else if (item instanceof CommandContributionItem) {
		final CommandContributionItemParameter data = ((CommandContributionItem) item).getData();
		data.commandId = ((CommandContributionItem) item).getCommand().getId();
		data.icon = image;
		final CommandContributionItem newItem = new CommandContributionItem(data);
		newItem.setId(item.getId());
		menu.insertAfter(item.getId(), newItem);
		menu.remove(item);
		item.dispose();
	} else if (item instanceof ActionSetContributionItem) {
		changeIcon(menu, ((ActionSetContributionItem) item).getInnerItem(), image);
	} else if (item instanceof MenuManager) {
		((MenuManager) item).setImageDescriptor(image);
	}
}
 
開發者ID:gama-platform,項目名稱:gama,代碼行數:20,代碼來源:CleanupHelper.java

示例2: tearDown

import org.eclipse.jface.action.IContributionItem; //導入依賴的package包/類
@Override
public void tearDown() throws Exception {
	super.tearDown();
	broker.resetState();
	waitForIdleState();

	final TreeItem[] treeItems = commonViewer.getTree().getItems();
	assertTrue("Expected empty Project Explorer. Input was: " + Arrays.toString(treeItems),
			Arrays2.isEmpty(treeItems));
	assertFalse("Expected projects as top level elements in navigator.", broker.isWorkingSetTopLevel());
	assertNull(
			"Select working set drop down contribution was visible when projects are configured as top level elements.",
			getWorkingSetDropDownContribution());

	IContributionItem showHiddenWorkingSetsItem = from(
			Arrays.asList(projectExplorer.getViewSite().getActionBars().getToolBarManager().getItems()))
					.firstMatch(i -> ShowHiddenWorkingSetsDropDownAction.class.getName().equals(i.getId()))
					.orNull();

	assertNull(
			"Show hidden working set drop down contribution was visible when projects are configured as top level elements.",
			showHiddenWorkingSetsItem);
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:24,代碼來源:GHOLD_101_WorkingSetsTest_PluginUITest.java

示例3: testTopLevelElementsEntryNoDuplicates

import org.eclipse.jface.action.IContributionItem; //導入依賴的package包/類
/**
 * Tests that the Top Level Elements
 */
@Test
public void testTopLevelElementsEntryNoDuplicates() {
	IActionBars actionBars = projectExplorer.getViewSite().getActionBars();
	IMenuManager menuManager = actionBars.getMenuManager();

	int topLevelElementsEntriesFound = 0;

	for (IContributionItem item : menuManager.getItems()) {
		if (item instanceof MenuManager) {
			String escapedMenuText = LegacyActionTools.removeMnemonics(((MenuManager) item).getMenuText());
			if (escapedMenuText.equals("Top Level Elements")) {
				topLevelElementsEntriesFound++;
			}
		}
	}

	assertEquals("There was more than one 'Top Level Elements' entry in the navigator action bar.",
			topLevelElementsEntriesFound, 1);
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:23,代碼來源:SelectAllProjectExplorer_PluginUITest.java

示例4: depopulateManager

import org.eclipse.jface.action.IContributionItem; //導入依賴的package包/類
/**
 * This removes from the specified <code>manager</code> all {@link org.eclipse.jface.action.ActionContributionItem}s
 * based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection.
 * <!-- begin-user-doc -->
    * <!-- end-user-doc -->
 * @generated
 */
   protected void depopulateManager(IContributionManager manager, Collection<? extends IAction> actions) {
	if (actions != null) {
		IContributionItem[] items = manager.getItems();
		for (int i = 0; i < items.length; i++) {
			// Look into SubContributionItems
			//
			IContributionItem contributionItem = items[i];
			while (contributionItem instanceof SubContributionItem) {
				contributionItem = ((SubContributionItem)contributionItem).getInnerItem();
			}

			// Delete the ActionContributionItems with matching action.
			//
			if (contributionItem instanceof ActionContributionItem) {
				IAction action = ((ActionContributionItem)contributionItem).getAction();
				if (actions.contains(action)) {
					manager.remove(contributionItem);
				}
			}
		}
	}
}
 
開發者ID:IncQueryLabs,項目名稱:smarthome-cep-demonstrator,代碼行數:30,代碼來源:SmarthomeActionBarContributor.java

示例5: depopulateManager

import org.eclipse.jface.action.IContributionItem; //導入依賴的package包/類
/**
 * This removes from the specified <code>manager</code> all {@link org.eclipse.jface.action.ActionContributionItem}s
 * based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void depopulateManager(IContributionManager manager, Collection<? extends IAction> actions) {
	if (actions != null) {
		IContributionItem[] items = manager.getItems();
		for (int i = 0; i < items.length; i++) {
			// Look into SubContributionItems
			//
			IContributionItem contributionItem = items[i];
			while (contributionItem instanceof SubContributionItem) {
				contributionItem = ((SubContributionItem)contributionItem).getInnerItem();
			}

			// Delete the ActionContributionItems with matching action.
			//
			if (contributionItem instanceof ActionContributionItem) {
				IAction action = ((ActionContributionItem)contributionItem).getAction();
				if (actions.contains(action)) {
					manager.remove(contributionItem);
				}
			}
		}
	}
}
 
開發者ID:cetic,項目名稱:SimQRI,代碼行數:30,代碼來源:MetamodelActionBarContributor.java

示例6: depopulateManager

import org.eclipse.jface.action.IContributionItem; //導入依賴的package包/類
/**
 * This removes from the specified <code>manager</code> all {@link org.eclipse.jface.action.ActionContributionItem}s
 * based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void depopulateManager(IContributionManager manager,
		Collection<? extends IAction> actions) {
	if (actions != null) {
		IContributionItem[] items = manager.getItems();
		for (int i = 0; i < items.length; i++) {
			// Look into SubContributionItems
			//
			IContributionItem contributionItem = items[i];
			while (contributionItem instanceof SubContributionItem) {
				contributionItem = ((SubContributionItem) contributionItem)
						.getInnerItem();
			}

			// Delete the ActionContributionItems with matching action.
			//
			if (contributionItem instanceof ActionContributionItem) {
				IAction action = ((ActionContributionItem) contributionItem)
						.getAction();
				if (actions.contains(action)) {
					manager.remove(contributionItem);
				}
			}
		}
	}
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:33,代碼來源:ChartActionBarContributor.java

示例7: depopulateManager

import org.eclipse.jface.action.IContributionItem; //導入依賴的package包/類
/**
 * This removes from the specified <code>manager</code> all {@link org.eclipse.jface.action.MenuManager}s and their
 * {@link org.eclipse.jface.action.ActionContributionItem}s based on the {@link org.eclipse.jface.action.IAction}s
 * contained in the <code>submenuActions</code> map.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected void depopulateManager ( IContributionManager manager, Map<String, Collection<IAction>> submenuActions )
{
    if ( submenuActions != null )
    {
        IContributionItem[] items = manager.getItems ();
        for ( int i = 0; i < items.length; i++ )
        {
            IContributionItem contributionItem = items[i];
            if ( contributionItem instanceof MenuManager )
            {
                MenuManager submenuManager = (MenuManager)contributionItem;
                if ( submenuActions.containsKey ( submenuManager.getMenuText () ) )
                {
                    depopulateManager ( submenuManager, submenuActions.get ( contributionItem ) );
                    manager.remove ( contributionItem );
                }
            }
        }
    }
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:29,代碼來源:DetailViewActionBarContributor.java

示例8: getContributionItems

import org.eclipse.jface.action.IContributionItem; //導入依賴的package包/類
@Override
protected IContributionItem[] getContributionItems ()
{
    final ISelectionService ss = this.serviceLocator.getService ( ISelectionService.class );

    if ( ss == null )
    {
        return new IContributionItem[0];
    }

    final ISelection sel = ss.getSelection ();

    final List<IContributionItem> items = new LinkedList<> ();

    addFromFileResource ( items, sel );

    return items.toArray ( new IContributionItem[items.size ()] );
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:19,代碼來源:ProfilesContribution.java

示例9: getPasteContribution

import org.eclipse.jface.action.IContributionItem; //導入依賴的package包/類
private ActionContributionItem getPasteContribution(IContributionItem[] items) {
	for (IContributionItem contributionItem : items) {
		if (StringUtils.equals(contributionItem.getId(),PASTE_ACTION_ID)) {
			return (ActionContributionItem) contributionItem;
		}
	}
	return null;
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:9,代碼來源:CustomEditActionProvider.java

示例10: doItemFill

import org.eclipse.jface.action.IContributionItem; //導入依賴的package包/類
@Override
protected void doItemFill(IContributionItem ci, int index) {
	
	StructuredSelection s=(StructuredSelection)SubJobUtility.getCurrentEditor().getViewer().getSelection();
		
		if (s.getFirstElement() instanceof ComponentEditPart && (StringUtils.equalsIgnoreCase(ci.getId(),team)||
			StringUtils.equalsIgnoreCase(ci.getId(),replaceWith)|| StringUtils.equalsIgnoreCase(ci.getId(),separator))){
				return;
		}

		if((StringUtils.equalsIgnoreCase(ci.getId(),runAs)||
			StringUtils.equalsIgnoreCase(ci.getId(),debugAs)||
			StringUtils.equalsIgnoreCase(ci.getId(),compareWith)||
			StringUtils.equalsIgnoreCase(ci.getId(),validate))){
				return ;
		}	
	super.doItemFill(ci, index);
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:19,代碼來源:ComponentsEditorContextMenuProvider.java


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