Search in sources :

Example 1 with ContextModel

use of org.eclipse.ui.internal.keys.model.ContextModel in project translationstudio8 by heartsome.

the class KeyController2 method init.

public void init(IServiceLocator locator, List<String> lstRemove) {
    getEventManager().clear();
    this.serviceLocator = locator;
    //	filterDupliteBind();
    fBindingManager = loadModelBackend(serviceLocator);
    contextModel = new ContextModel(this);
    contextModel.init(serviceLocator);
    fSchemeModel = new SchemeModel(this);
    fSchemeModel.init(fBindingManager);
    bindingModel = new BindingModel2(this);
    bindingModel.init(serviceLocator, fBindingManager, contextModel);
    HashSet<BindingElement> set = bindingModel.getBindings();
    Iterator<BindingElement> iterator = set.iterator();
    while (iterator.hasNext()) {
        BindingElement bindingElement = iterator.next();
        if (lstRemove.contains(bindingElement.getId())) {
            iterator.remove();
        }
    }
    bindingModel.setBindings(set);
    Map<Binding, BindingElement> mapBBe = bindingModel.getBindingToElement();
    Iterator<Entry<Binding, BindingElement>> it = mapBBe.entrySet().iterator();
    while (it.hasNext()) {
        Entry<Binding, BindingElement> entry = (Entry<Binding, BindingElement>) it.next();
        if (lstRemove.contains(entry.getValue().getId())) {
            it.remove();
        }
    }
    bindingModel.setBindingToElement(mapBBe);
    conflictModel = new ConflictModel2(this);
    conflictModel.init(fBindingManager, bindingModel);
    addSetContextListener();
    addSetBindingListener();
    addSetConflictListener();
    addSetKeySequenceListener();
    addSetSchemeListener();
    addSetModelObjectListener();
}
Also used : KeyBinding(org.eclipse.jface.bindings.keys.KeyBinding) Binding(org.eclipse.jface.bindings.Binding) Entry(java.util.Map.Entry) ContextModel(org.eclipse.ui.internal.keys.model.ContextModel) BindingElement(org.eclipse.ui.internal.keys.model.BindingElement) SchemeModel(org.eclipse.ui.internal.keys.model.SchemeModel)

Aggregations

Entry (java.util.Map.Entry)1 Binding (org.eclipse.jface.bindings.Binding)1 KeyBinding (org.eclipse.jface.bindings.keys.KeyBinding)1 BindingElement (org.eclipse.ui.internal.keys.model.BindingElement)1 ContextModel (org.eclipse.ui.internal.keys.model.ContextModel)1 SchemeModel (org.eclipse.ui.internal.keys.model.SchemeModel)1