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


Java TriggerSequence类代码示例

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


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

示例1: getHotKey

import org.eclipse.jface.bindings.TriggerSequence; //导入依赖的package包/类
public static KeyStroke getHotKey(String commondID) throws ParseException {
    IBindingService bindingService = (IBindingService) PlatformUI.getWorkbench().getService(IBindingService.class);
    if (bindingService != null) {
        TriggerSequence trigger = bindingService.getBestActiveBindingFor(commondID);
        if (trigger != null) {
            Trigger[] tiggers = trigger.getTriggers();
            if (tiggers.length > 0) {
                Trigger tigger = tiggers[0];
                if (tigger instanceof KeyStroke) {
                    return (KeyStroke) tigger;
                }
            }
        }
    }
    return KeyStroke.getInstance("Ctrl+Space");
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:17,代码来源:HotKeyUtil.java

示例2: addAction

import org.eclipse.jface.bindings.TriggerSequence; //导入依赖的package包/类
@Override
public void addAction(final IAction action) {
    Check.notNull(action, "action"); //$NON-NLS-1$

    final String commandId = action.getActionDefinitionId();

    if (commandId == null) {
        throw new IllegalArgumentException("action does not have an action definition ID set"); //$NON-NLS-1$
    }

    final TriggerSequence[] bindings = bindingService.getActiveBindingsFor(commandId);

    if (bindings.length > 0) {
        final IHandler handler = new ActionHandler(action);
        /*
         * Call this deprecated overload for 3.1 support
         */
        final IHandlerActivation activation =
            handlerService.activateHandler(commandId, handler, expression, sourcePriorities);
        handlerActivations.add(activation);
    }
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:23,代码来源:ModernActionKeyBindingSupport.java

示例3: matchesKeybinding

import org.eclipse.jface.bindings.TriggerSequence; //导入依赖的package包/类
public static boolean matchesKeybinding(int keyCode, int stateMask, String commandId)
{
	final IBindingService bindingSvc = (IBindingService) PlatformUI.getWorkbench()
			.getAdapter(IBindingService.class);
	TriggerSequence[] activeBindingsFor = bindingSvc.getActiveBindingsFor(commandId);

	for (TriggerSequence seq : activeBindingsFor)
	{
		if (seq instanceof KeySequence)
		{
			if (matchesKeybinding(keyCode, stateMask, seq))
			{
				return true;
			}
		}
	}

	return false;
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:20,代码来源:KeyBindingHelper.java

示例4: internalMatchesKeybinding

import org.eclipse.jface.bindings.TriggerSequence; //导入依赖的package包/类
private static boolean internalMatchesKeybinding(int keyCode, int stateMask, TriggerSequence seq)
{
	KeySequence keySequence = (KeySequence) seq;
	KeyStroke[] keyStrokes = keySequence.getKeyStrokes();

	if (keyStrokes.length > 1)
	{
		return false; // Only handling one step binding... the code below does not support things as "CTRL+X R" for
						// redo.
	}
	for (KeyStroke keyStroke : keyStrokes)
	{
		if (keyStroke.getNaturalKey() == keyCode && keyStroke.getModifierKeys() == stateMask)
		{

			return true;
		}
	}
	return false;
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:21,代码来源:KeyBindingHelper.java

示例5: getKeyboardShortcut

import org.eclipse.jface.bindings.TriggerSequence; //导入依赖的package包/类
private static String getKeyboardShortcut(ParameterizedCommand command) {
	IBindingService bindingService= (IBindingService) PlatformUI.getWorkbench().getAdapter(IBindingService.class);
	fgLocalBindingManager.setBindings(bindingService.getBindings());
	try {
		Scheme activeScheme= bindingService.getActiveScheme();
		if (activeScheme != null)
			fgLocalBindingManager.setActiveScheme(activeScheme);
	} catch (NotDefinedException e) {
		JavaPlugin.log(e);
	}

	TriggerSequence[] bindings= fgLocalBindingManager.getActiveBindingsDisregardingContextFor(command);
	if (bindings.length > 0)
		return bindings[0].format();
	return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:17,代码来源:CodeAssistAdvancedConfigurationBlock.java

示例6: getColumnText

import org.eclipse.jface.bindings.TriggerSequence; //导入依赖的package包/类
public String getColumnText(Object element, int index) {
	BindingElement bindingElement = ((BindingElement) element);
	switch (index) {
	case COMMAND_NAME_COLUMN: {// name
		String name = bindingElement.getName();
		if (name != null && name.endsWith("()")) {
			name = name.substring(0, name.length() - 2);
		}
		return name;
	}
	case KEY_SEQUENCE_COLUMN: // keys
		TriggerSequence seq = bindingElement.getTrigger();
		return seq == null ? Util.ZERO_LENGTH_STRING : seq.format();
	case CATEGORY_COLUMN: // category
		String id = bindingElement.getId();
		if (id.equalsIgnoreCase("net.heartsome.cat.ts.command.preference")) {
			return Messages.getString("preferencepage.KeysPreferencePage.toolCategory");
		} else if (id.equalsIgnoreCase("org.eclipse.ui.window.lockToolBar")) {
			return Messages.getString("preferencepage.KeysPreferencePage.toolbarCategory");
		} else if (id.equalsIgnoreCase("org.eclipse.ui.window.showKeyAssist")) {
			return Messages.getString("preferencepage.KeysPreferencePage.helpCategory");
		}
		return bindingElement.getCategory();
	}
	return null;
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:27,代码来源:KeysPreferencePage.java

示例7: getAccelerator

import org.eclipse.jface.bindings.TriggerSequence; //导入依赖的package包/类
/**
 * @see org.eclipse.jface.action.ExternalActionManager.ICallback#getAccelerator(String)
 */
public final Integer getAccelerator(final String commandId) {
	final TriggerSequence triggerSequence = bindingManager
			.getBestActiveBindingFor(commandId);
	if (triggerSequence != null) {
		final Trigger[] triggers = triggerSequence.getTriggers();
		if (triggers.length == 1) {
			final Trigger trigger = triggers[0];
			if (trigger instanceof KeyStroke) {
				final KeyStroke keyStroke = (KeyStroke) trigger;
				final int accelerator = SWTKeySupport
						.convertKeyStrokeToAccelerator(keyStroke);
				return new Integer(accelerator);
			}
		}
	}

	return null;
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:22,代码来源:ExternalActionManager.java

示例8: getKeyBindingStrings

import org.eclipse.jface.bindings.TriggerSequence; //导入依赖的package包/类
/**
 * Get the displayable key-binding information for the command
 * 
 * @param com - the command
 * @param activep - if true, return only active bindings
 * 
 * @return a String array of binding sequence binding context information
 */
public static String[] getKeyBindingStrings(Command com, boolean activep) {
	String id = com.getId();

	TriggerSequence trigger;
	// Get platform bindings for Command 
	Binding[] bindings = getBindings(com,activep);

	List<String> bindingInfo = new ArrayList<String>();
	ParameterizedCommand c;
	for (Binding bind : bindings) {
		c = bind.getParameterizedCommand();
		if (c != null && c.getId().equals(id)) {
			trigger = bind.getTriggerSequence();
			bindingInfo.add(trigger.toString());
			bindingInfo.add(bind.getContextId());
		}
	}
	return bindingInfo.toArray(new String[0]);
}
 
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:28,代码来源:CommandHelp.java

示例9: matchesKeybinding

import org.eclipse.jface.bindings.TriggerSequence; //导入依赖的package包/类
public static boolean matchesKeybinding(int keyCode, int stateMask, String commandId) {
    final IBindingService bindingSvc = PlatformUI.getWorkbench()
            .getAdapter(IBindingService.class);
    TriggerSequence[] activeBindingsFor = bindingSvc.getActiveBindingsFor(commandId);

    for (TriggerSequence seq : activeBindingsFor) {
        if (seq instanceof KeySequence) {
            KeySequence keySequence = (KeySequence) seq;
            if (matchesKeybinding(keyCode, stateMask, keySequence)) {
                return true;
            }
        }
    }

    return false;
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:17,代码来源:KeyBindingHelper.java

示例10: getActiveContentAssistBinding

import org.eclipse.jface.bindings.TriggerSequence; //导入依赖的package包/类
/**
 * Returns the active key binding for content assist.
 *
 * If no binding is set null is returned.
 */
private KeyStroke getActiveContentAssistBinding() {
	IBindingService bindingService = PlatformUI.getWorkbench().getService(IBindingService.class);
	TriggerSequence[] activeBindingsFor = bindingService
			.getActiveBindingsFor(CONTENT_ASSIST_ECLIPSE_COMMAND_ID);

	if (activeBindingsFor.length > 0 && activeBindingsFor[0] instanceof KeySequence) {
		KeyStroke[] strokes = ((KeySequence) activeBindingsFor[0]).getKeyStrokes();
		if (strokes.length == 1) {
			return strokes[0];
		}
	}
	return null;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:19,代码来源:WorkspaceWizardPage.java

示例11: updateTooltip

import org.eclipse.jface.bindings.TriggerSequence; //导入依赖的package包/类
private void updateTooltip(String commandId, String tooltip, ToolItem item)
{
	List<TriggerSequence> bindings = fCommandToBinding.get(commandId);
	if (bindings != null && bindings.size() > 0)
	{
		item.setToolTipText(MessageFormat.format("{0} ({1})", tooltip, bindings.get(0))); //$NON-NLS-1$
	}
	else
	{
		item.setToolTipText(tooltip);
	}
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:13,代码来源:FindBarActions.java

示例12: getIterationBinding

import org.eclipse.jface.bindings.TriggerSequence; //导入依赖的package包/类
private KeySequence getIterationBinding() {
   final IBindingService bindingSvc= (IBindingService) PlatformUI.getWorkbench().getAdapter(IBindingService.class);
TriggerSequence binding= bindingSvc.getBestActiveBindingFor(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
if (binding instanceof KeySequence)
	return (KeySequence) binding;
return null;
  }
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:8,代码来源:ContentAssistProcessor.java

示例13: getShortCutString

import org.eclipse.jface.bindings.TriggerSequence; //导入依赖的package包/类
public static String getShortCutString(String proposalId) {
	if (proposalId != null) {
		IBindingService bindingService= (IBindingService) PlatformUI.getWorkbench().getAdapter(IBindingService.class);
		if (bindingService != null) {
			TriggerSequence[] activeBindingsFor= bindingService.getActiveBindingsFor(proposalId);
			if (activeBindingsFor.length > 0) {
				return activeBindingsFor[0].format();
			}
		}
	}
	return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:13,代码来源:CorrectionCommandHandler.java

示例14: getValue

import org.eclipse.jface.bindings.TriggerSequence; //导入依赖的package包/类
@Override
protected Object getValue(Object element) {
	// System.out.println(element);
	BindingElement bindingElement = ((BindingElement) element);
	TriggerSequence seq = bindingElement.getTrigger();
	return seq == null ? Util.ZERO_LENGTH_STRING : seq.format();
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:8,代码来源:KeysPreferencePage.java

示例15: getPrefixes

import org.eclipse.jface.bindings.TriggerSequence; //导入依赖的package包/类
public final TriggerSequence[] getPrefixes() {
	final int numberOfPrefixes = triggers.length;
	final TriggerSequence[] prefixes = new TriggerSequence[numberOfPrefixes];
	prefixes[0] = KeySequence.getInstance();
	for (int i = 0; i < numberOfPrefixes - 1; i++) {
		final KeyStroke[] prefixKeyStrokes = new KeyStroke[i + 1];
		System.arraycopy(triggers, 0, prefixKeyStrokes, 0, i + 1);
		prefixes[i + 1] = KeySequence.getInstance(prefixKeyStrokes);
	}

	return prefixes;
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:13,代码来源:KeySequence.java


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