本文整理匯總了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);
}
}
示例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);
}
示例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);
}
示例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);
}
}
}
}
}
示例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);
}
}
}
}
}
示例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);
}
}
}
}
}
示例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 );
}
}
}
}
}
示例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 ()] );
}
示例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;
}
示例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);
}