1 /*
2  * SetEditorCommandBindingsEvent.java
3  *
4  * Copyright (C) 2021 by RStudio, PBC
5  *
6  * Unless you have received this program directly from RStudio pursuant
7  * to the terms of a commercial license agreement with RStudio, then
8  * this program is licensed to you under the terms of version 3 of the
9  * GNU Affero General Public License. This program is distributed WITHOUT
10  * ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT,
11  * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the
12  * AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details.
13  *
14  */
15 package org.rstudio.studio.client.application.events;
16 
17 import java.util.List;
18 
19 import org.rstudio.core.client.command.KeySequence;
20 
21 import com.google.gwt.event.shared.EventHandler;
22 import com.google.gwt.event.shared.GwtEvent;
23 
24 public class SetEditorCommandBindingsEvent extends GwtEvent<SetEditorCommandBindingsEvent.Handler>
25 {
26    public interface Handler extends EventHandler
27    {
onSetEditorCommandBindings(SetEditorCommandBindingsEvent event)28       void onSetEditorCommandBindings(SetEditorCommandBindingsEvent event);
29    }
30 
SetEditorCommandBindingsEvent(String id, List<KeySequence> keys)31    public SetEditorCommandBindingsEvent(String id, List<KeySequence> keys)
32    {
33       id_ = id;
34       keys_ = keys;
35    }
36 
getId()37    public String getId() { return id_; }
getKeySequences()38    public List<KeySequence> getKeySequences() { return keys_; }
39 
40    private final String id_;
41    private final List<KeySequence> keys_;
42 
43    @Override
getAssociatedType()44    public Type<Handler> getAssociatedType()
45    {
46       return TYPE;
47    }
48 
49    @Override
dispatch(Handler handler)50    protected void dispatch(Handler handler)
51    {
52       handler.onSetEditorCommandBindings(this);
53    }
54 
55    public static final Type<Handler> TYPE = new Type<>();
56 }
57