1 /*
2  * FileChangeEvent.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.workbench.views.files.events;
16 
17 import com.google.gwt.event.shared.EventHandler;
18 import com.google.gwt.event.shared.GwtEvent;
19 import org.rstudio.studio.client.workbench.views.files.model.FileChange;
20 
21 public class FileChangeEvent extends GwtEvent<FileChangeEvent.Handler>
22 {
23    public static final Type<Handler> TYPE = new Type<>();
24 
25    public interface Handler extends EventHandler
26    {
onFileChange(FileChangeEvent event)27       void onFileChange(FileChangeEvent event);
28    }
29 
FileChangeEvent(FileChange fileChange)30    public FileChangeEvent(FileChange fileChange)
31    {
32       fileChange_ = fileChange;
33    }
34 
getFileChange()35    public FileChange getFileChange()
36    {
37       return fileChange_;
38    }
39 
40    @Override
dispatch(Handler handler)41    protected void dispatch(Handler handler)
42    {
43       handler.onFileChange(this);
44    }
45 
46    @Override
getAssociatedType()47    public Type<Handler> getAssociatedType()
48    {
49       return TYPE;
50    }
51 
52    private final FileChange fileChange_;
53 }
54