List of usage examples for org.eclipse.jface.bindings.keys IKeyLookup M1_NAME
String M1_NAME
To view the source code for org.eclipse.jface.bindings.keys IKeyLookup M1_NAME.
Click Source Link
From source file:org.eclipse.mylyn.internal.tasks.ui.actions.ToggleWorkingSetAction.java
License:Open Source License
@Override public void runWithEvent(Event event) { Set<IWorkingSet> newList = new HashSet<IWorkingSet>(Arrays.asList(TaskWorkingSetUpdater.getEnabledSets())); boolean modified = false; if (event != null) { modified = (event.stateMask//from w w w. ja v a 2s . c om & KeyLookupFactory.getDefault().formalModifierLookup(IKeyLookup.M1_NAME)) != 0; } if (!modified) { // Default behavior is to act as a radio button. Set<IWorkingSet> tempList = new HashSet<IWorkingSet>(); Iterator<IWorkingSet> iter = newList.iterator(); while (iter.hasNext()) { IWorkingSet workingSet = iter.next(); if (workingSet != null && workingSet.getId() != null && workingSet.getId().equalsIgnoreCase(TaskWorkingSetUpdater.ID_TASK_WORKING_SET)) { tempList.add(workingSet); } } newList.removeAll(tempList); if (isChecked()) { newList.add(workingSet); } else { // If multiples were previously selected, make this action active if (!TaskWorkingSetUpdater.isOnlyTaskWorkingSetEnabled(workingSet)) { newList.add(workingSet); } } } else { // If modifier key is pressed, de/selections are additive. if (isChecked()) { newList.add(workingSet); } else { newList.remove(workingSet); } } TaskWorkingSetUpdater.applyWorkingSetsToAllWindows(newList); }
From source file:org.review_board.ereviewboard.ui.internal.control.EnhancedAutoCompleteField.java
License:Open Source License
public EnhancedAutoCompleteField(Text control, Proposal[] proposals) { KeyStroke activationKeyStroke; try {//from w w w . ja va2s .c o m activationKeyStroke = KeyStroke.getInstance(IKeyLookup.M1_NAME + "+" + IKeyLookup.SPACE_NAME); } catch (ParseException e) { activationKeyStroke = null; } proposalProvider = new SimpleContentProposalProvider(proposals); adapter = new ContentProposalAdapter(control, new TextContentAdapter(), proposalProvider, activationKeyStroke, COMPLETION_CHARS); adapter.setPropagateKeys(true); adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE); UiUtils.installContentAssistControlDecoration(control); }