@@ -0,0 +1,2244 @@
+package com.samczsun.helios.gui;%0A%0Aimport org.eclipse.swt.events.MouseEvent;%0Aimport org.eclipse.swt.events.MouseListener;%0A%0Aimport java.util.function.BiConsumer;%0A%0A/**%0A * @author DarkSeraphim.%0A */%0Apublic class GenericClickListener implements MouseListener, java.awt.event.MouseListener %7B%0A%0A    enum ClickType %7B%0A        LEFT, MIDDLE, RIGHT;%0A        private static ClickType fromButton(int button) %7B%0A            return ClickType.values()%5Bbutton - 1%5D;%0A        %7D%0A    %7D%0A%0A    private final BiConsumer%3CClickType, Boolean%3E handler;%0A%0A    private final byte buttons;%0A%0A    private final boolean doubleClick;%0A%0A    public GenericClickListener(BiConsumer%3CClickType, Boolean%3E handler, ClickType type, ClickType...others) %7B%0A        this(handler, false, type, others);%0A    %7D%0A%0A    public GenericClickListener(BiConsumer%3CClickType, Boolean%3E handler, boolean doubleClick, ClickType type, ClickType...others) %7B%0A        this.handler = handler;%0A        this.doubleClick = doubleClick;%0A        int buttons = 1 %3C%3C type.ordinal();%0A        for (ClickType otherType : others) %7B%0A            buttons %7C= 1 %3C%3C otherType.ordinal();%0A        %7D%0A        this.buttons = (byte) buttons;%0A    %7D%0A%0A    /* *%0A     * SWT events%0A     * */%0A%0A    @Override%0A    public void mouseDoubleClick(MouseEvent event) %7B%0A        handle(ClickType.fromButton(event.button), true);%0A    %7D%0A%0A    @Override%0A    public void mouseDown(MouseEvent event) %7B%0A    %7D%0A%0A    private void handle(ClickType type, boolean doubleClick) %7B%0A        if (this.doubleClick == doubleClick && (this.buttons & (1 %3C%3C (type.ordinal()))) != 0) %7B%0A            this.handler.accept(type, doubleClick);%0A        %7D%0A    %7D%0A%0A    @Override%0A    public void mouseUp(MouseEvent event) %7B%0A        handle(ClickType.fromButton(event.button), false);%0A    %7D%0A%0A    /* *%0A     * AWT events%0A     * */%0A%0A    @Override%0A    public void mouseClicked(java.awt.event.MouseEvent e) %7B%0A        handle(ClickType.fromButton(e.getButton()), false);%0A    %7D%0A%0A    @Override%0A    public void mousePressed(java.awt.event.MouseEvent e) %7B%0A    %7D%0A%0A    @Override%0A    public void mouseReleased(java.awt.event.MouseEvent e) %7B%0A    %7D%0A%0A    @Override%0A    public void mouseEntered(java.awt.event.MouseEvent e) %7B%0A    %7D%0A%0A    @Override%0A    public void mouseExited(java.awt.event.MouseEvent e) %7B%0A    %7D%0A%7D%0A

Add generic click listener for AWT and SWT