当前位置: 首页>>代码示例>>Java>>正文


Java LegacyActionTools类代码示例

本文整理汇总了Java中org.eclipse.jface.action.LegacyActionTools的典型用法代码示例。如果您正苦于以下问题:Java LegacyActionTools类的具体用法?Java LegacyActionTools怎么用?Java LegacyActionTools使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


LegacyActionTools类属于org.eclipse.jface.action包,在下文中一共展示了LegacyActionTools类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testTopLevelElementsEntryNoDuplicates

import org.eclipse.jface.action.LegacyActionTools; //导入依赖的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

示例2: getContextMenuContributions

import org.eclipse.jface.action.LegacyActionTools; //导入依赖的package包/类
/**
 * Returns the menu contribution titles of the project navigator context menu.
 *
 * This only includes {@link ActionContributionItem}s and {@link MenuManager}s.
 */
private List<String> getContextMenuContributions() {
	MenuManager menu = new MenuManager();
	projectExplorer.getNavigatorActionService().fillContextMenu(menu);
	return Arrays.asList(menu.getItems()).stream()
			.map(i -> {
				if (i instanceof ActionContributionItem) {
					// use action name
					return ((ActionContributionItem) i).getAction().getText();
				} else if (i instanceof MenuManager) {
					// use sub-menu title
					return ((MenuManager) i).getMenuText();
				} else {
					// null for other types of contributions
					return null;
				}
			})
			.filter(t -> null != t)
			// remove mnemonics (e.g. Close &Project -> Close Project))
			.map(text -> LegacyActionTools.removeMnemonics(text))
			.collect(Collectors.toList());
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:27,代码来源:SelectAllProjectExplorer_PluginUITest.java

示例3: normalizeMenuLabel

import org.eclipse.jface.action.LegacyActionTools; //导入依赖的package包/类
private static String normalizeMenuLabel(String label, char mnemonic, int accel) {
    label = addMnemonic(label, mnemonic);
    
    int defaultSize = 30;
    int size = Math.max(label.length(), defaultSize);
    StringBuffer sb = new StringBuffer(label);
    while (sb.length() < size) {
        sb.append(' ');
    }
    
    if (accel != -1) {
        sb.append("\t").append(LegacyActionTools.convertAccelerator(accel));
    }
    
    return sb.toString();
}
 
开发者ID:chfoo,项目名称:areca-backup-release-mirror,代码行数:17,代码来源:AppAction.java

示例4: AppAction

import org.eclipse.jface.action.LegacyActionTools; //导入依赖的package包/类
public AppAction(String resPrefixKey, Image image, Image bigImage, String actionCommand) {
    // Mnemonic
    mnemonic = RM.getChar(resPrefixKey + ".mnemonic");
    
    // Accelerator
    String strAccel = RM.getLabel(resPrefixKey + ".accel", (String)null);
    if (strAccel != null) {
        accel = LegacyActionTools.convertAccelerator(strAccel);
    } 
    
    // Label
    label = normalizeMenuLabel(RM.getLabel(resPrefixKey + ".label"), mnemonic, accel);
    
    // Icon
    if (image != null) {
        icon = image;
    }

    if (bigImage != null) {
        bigIcon = bigImage;
    }

    // Tooltip
    toolTip = RM.getLabel(resPrefixKey + ".tooltip", (String)null);
    
    command = actionCommand;
}
 
开发者ID:chfoo,项目名称:areca-backup-release-mirror,代码行数:28,代码来源:AppAction.java

示例5: PreferenceTreeNode

import org.eclipse.jface.action.LegacyActionTools; //导入依赖的package包/类
/**
 * Constructs a new instance of PreferenceTreeNode according to the parameters.
 * <p>
 * The <code>label</code> and the <code>key</code> must not be <code>null</code> if the node
 * has a corresponding UI control.
 * </p>
 * 
 * @param label the label text
 * @param key the key
 * @param controlType the type of UI control.
 * @param showAllChildren tells whether all children should be shown even if just one child
 *            matches the filter.
 */
public PreferenceTreeNode(String label, Key key, int controlType, boolean showAllChildren) {
	super();
	if (controlType != NONE && (label == null || key == null)) {
		throw new IllegalArgumentException();
	}
	if (label == null) {
		label= ""; //$NON-NLS-1$
	}
	fLabel= LegacyActionTools.removeMnemonics(label);
	fKey= key;
	fControlType= controlType;
	fShowAllChildren= showAllChildren;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:27,代码来源:OptionsConfigurationBlock.java

示例6: PreferenceTreeNode

import org.eclipse.jface.action.LegacyActionTools; //导入依赖的package包/类
/**
 * Constructs a new instance of PreferenceTreeNode according to the parameters.
 * <p>
 * The <code>label</code> and the <code>key</code> must not be <code>null</code> if the node
 * has a corresponding UI control.
 * </p>
 *
 * @param label the label text
 * @param key the key
 * @param controlType the type of UI control.
 * @param showAllChildren tells whether all children should be shown even if just one child
 *            matches the filter.
 */
public PreferenceTreeNode(String label, Key key, int controlType, boolean showAllChildren) {
	super();
	if (controlType != NONE && (label == null || key == null)) {
		throw new IllegalArgumentException();
	}
	if (label == null) {
		label= ""; //$NON-NLS-1$
	}
	fLabel= LegacyActionTools.removeMnemonics(label);
	fKey= key;
	fControlType= controlType;
	fShowAllChildren= showAllChildren;
}
 
开发者ID:fabioz,项目名称:eclipse.spellchecker,代码行数:27,代码来源:OptionsConfigurationBlock.java

示例7: escape

import org.eclipse.jface.action.LegacyActionTools; //导入依赖的package包/类
private String escape(String text) {
    if (text == null)
        return text;
    return LegacyActionTools.escapeMnemonics(text);
}
 
开发者ID:yamcs,项目名称:yamcs-studio,代码行数:6,代码来源:StatusLineContributionItem.java

示例8: removeMnemonicIndicator

import org.eclipse.jface.action.LegacyActionTools; //导入依赖的package包/类
public static String removeMnemonicIndicator(String string) {
	return LegacyActionTools.removeMnemonics(string);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:4,代码来源:Strings.java

示例9: setText

import org.eclipse.jface.action.LegacyActionTools; //导入依赖的package包/类
/**
 * Sets the action's label text to the given value.
 */
public void setText(String text) {
	super.setText(text);
	acceleratorText = LegacyActionTools.extractAcceleratorText(text);
	defaultText = text;
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:9,代码来源:LabelRetargetAction.java

示例10: doRefresh

import org.eclipse.jface.action.LegacyActionTools; //导入依赖的package包/类
/**
 * Sets the given text and image to the label.
 *
 * @param text
 *            the new text or null
 * @param image
 *            the new image
 */
private void doRefresh(String text, Image image) {
	if ( text != null ) {
		text = LegacyActionTools.escapeMnemonics(text);
	}
	label.setText(text);
	label.setImage(image);
}
 
开发者ID:tlaplus,项目名称:tlaplus,代码行数:16,代码来源:FilteredItemsSelectionDialog.java

示例11: LabelRetargetAction

import org.eclipse.jface.action.LegacyActionTools; //导入依赖的package包/类
/**
 * Constructs a RetargetAction with the given action id, text and style.
 * 
 * @param actionID
 *            the retargetable action id
 * @param text
 *            the action's text, or <code>null</code> if there is no text
 * @param style
 *            one of <code>AS_PUSH_BUTTON</code>, <code>AS_CHECK_BOX</code>,
 *            <code>AS_DROP_DOWN_MENU</code>, <code>AS_RADIO_BUTTON</code>,
 *            and <code>AS_UNSPECIFIED</code>.
 * @since 3.0
 */
public LabelRetargetAction(String actionID, String text, int style) {
	super(actionID, text, style);
	this.defaultText = text;
	this.defaultToolTipText = text;
	acceleratorText = LegacyActionTools.extractAcceleratorText(text);
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:20,代码来源:LabelRetargetAction.java

示例12: getDisplayName

import org.eclipse.jface.action.LegacyActionTools; //导入依赖的package包/类
/**
 * Returns the name of the described extension
 * without mnemonic hint in order to be displayed
 * in a message.
 *
 * @return Returns the name
 */
public String getDisplayName() {
	return LegacyActionTools.removeMnemonics(fName);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:11,代码来源:CompletionProposalCategory.java


注:本文中的org.eclipse.jface.action.LegacyActionTools类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。