Java Code Examples for org.eclipse.jface.bindings.TriggerSequence#format()

The following examples show how to use org.eclipse.jface.bindings.TriggerSequence#format() . 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: KeysPreferencePage.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example 2
Source File: KeysPreferencePage.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example 3
Source File: KeysPreferencePage.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
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;
}
 
Example 4
Source File: KeysPreferencePage.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
@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();
}
 
Example 5
Source File: KeysPreferencePage.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
@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();
}
 
Example 6
Source File: KeysPreferencePage.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
@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();
}
 
Example 7
Source File: CommandHelp.java    From e4macs with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Get the best binding (as determined by Eclipse) for the Command
 * 
 * @param cmd
 * @return the binding or null
 */
public static String getBestBinding(Command cmd) {
	String result = null;
	IBindingService binder = (IBindingService) PlatformUI.getWorkbench().getService(IBindingService.class);
	TriggerSequence bindingFor = binder.getBestActiveBindingFor(cmd.getId());
	if (bindingFor != null) {
		result = bindingFor.format(); 
	}
	return result;
}
 
Example 8
Source File: DefaultContentAssist.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
private String getIterationGesture() {
    TriggerSequence binding = KeyBindingHelper.getContentAssistProposalBinding();
    return binding != null ? binding.format() : "completion key";
}