Search in sources :

Example 31 with MessageBoxShell

use of com.biglybt.ui.swt.shells.MessageBoxShell in project BiglyBT by BiglySoftware.

the class MultiTrackerEditor method createWindow.

private void createWindow(Shell parent_shell) {
    if (parent_shell == null) {
        this.shell = ShellFactory.createMainShell(SWT.DIALOG_TRIM | SWT.RESIZE);
    } else {
        this.shell = ShellFactory.createShell(parent_shell, SWT.DIALOG_TRIM | SWT.RESIZE);
    }
    Messages.setLanguageText(this.shell, anonymous ? "wizard.multitracker.edit.title" : "wizard.multitracker.template.title");
    Utils.setShellIcon(shell);
    GridLayout layout = new GridLayout();
    layout.numColumns = 3;
    shell.setLayout(layout);
    GridData gridData;
    if (!anonymous) {
        Label labelName = new Label(shell, SWT.NULL);
        Messages.setLanguageText(labelName, "wizard.multitracker.edit.name");
        textName = new Text(shell, SWT.BORDER);
        textName.setText(currentName);
        gridData = new GridData(GridData.FILL_HORIZONTAL);
        gridData.horizontalSpan = 2;
        textName.setLayoutData(gridData);
        textName.addModifyListener(new ModifyListener() {

            @Override
            public void modifyText(ModifyEvent arg0) {
                currentName = textName.getText();
                computeSaveEnable();
            }
        });
    }
    treeGroups = new Tree(shell, SWT.BORDER);
    gridData = new GridData(GridData.FILL_BOTH);
    gridData.horizontalSpan = 3;
    gridData.heightHint = 150;
    treeGroups.setLayoutData(gridData);
    treeGroups.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseDoubleClick(MouseEvent arg0) {
            if (treeGroups.getSelectionCount() == 1) {
                TreeItem treeItem = treeGroups.getSelection()[0];
                String type = (String) treeItem.getData("type");
                if (type.equals("tracker")) {
                    editTreeItem(treeItem);
                }
            }
        }
    });
    if (showTemplates) {
        // template operations
        Composite cTemplate = new Composite(shell, SWT.NONE);
        gridData = new GridData(GridData.FILL_HORIZONTAL);
        gridData.horizontalSpan = 3;
        cTemplate.setLayoutData(gridData);
        GridLayout layoutTemplate = new GridLayout();
        layoutTemplate.numColumns = 5;
        cTemplate.setLayout(layoutTemplate);
        final Label labelTitle = new Label(cTemplate, SWT.NULL);
        Messages.setLanguageText(labelTitle, "Search.menu.engines");
        final Combo configList = new Combo(cTemplate, SWT.READ_ONLY);
        gridData = new GridData(GridData.FILL_HORIZONTAL);
        configList.setLayoutData(gridData);
        final List<Button> buttons = new ArrayList<>();
        String sel_str = COConfigurationManager.getStringParameter("multitrackereditor.last.selection", null);
        final String[] currentTemplate = { sel_str == null || sel_str.length() == 0 ? null : sel_str };
        final Runnable updateSelection = new Runnable() {

            @Override
            public void run() {
                int selection = configList.getSelectionIndex();
                boolean enabled = selection != -1;
                String sel_str = currentTemplate[0] = enabled ? configList.getItem(selection) : null;
                COConfigurationManager.setParameter("multitrackereditor.last.selection", sel_str == null ? "" : sel_str);
                Iterator<Button> it = buttons.iterator();
                // skip the new button
                it.next();
                while (it.hasNext()) {
                    it.next().setEnabled(enabled);
                }
            }
        };
        final Runnable updateTemplates = new Runnable() {

            @Override
            public void run() {
                Map<String, List<List<String>>> multiTrackers = TrackersUtil.getInstance().getMultiTrackers();
                configList.removeAll();
                List<String> names = new ArrayList<String>(multiTrackers.keySet());
                Collections.sort(names, new FormattersImpl().getAlphanumericComparator(true));
                for (String str : names) {
                    configList.add(str);
                }
                String toBeSelected = currentTemplate[0];
                if (toBeSelected != null) {
                    int selection = configList.indexOf(toBeSelected);
                    if (selection != -1) {
                        configList.select(selection);
                    } else if (configList.getItemCount() > 0) {
                        currentTemplate[0] = configList.getItem(0);
                        configList.select(0);
                    }
                }
                updateSelection.run();
            }
        };
        final TrackerEditorListener templateTEL = new TrackerEditorListener() {

            @Override
            public void trackersChanged(String oldName, String newName, List<List<String>> trackers) {
                TrackersUtil util = TrackersUtil.getInstance();
                if (oldName != null && !oldName.equals(newName)) {
                    util.removeMultiTracker(oldName);
                }
                util.addMultiTracker(newName, trackers);
                currentTemplate[0] = newName;
                updateTemplates.run();
            }
        };
        final Button btnNew = new Button(cTemplate, SWT.PUSH);
        buttons.add(btnNew);
        Messages.setLanguageText(btnNew, "wizard.multitracker.new");
        btnNew.addListener(SWT.Selection, new Listener() {

            @Override
            public void handleEvent(Event e) {
                List group = new ArrayList();
                List tracker = new ArrayList();
                group.add(tracker);
                new MultiTrackerEditor(btnNew.getShell(), null, group, templateTEL);
            }
        });
        configList.addListener(SWT.Selection, new Listener() {

            @Override
            public void handleEvent(Event e) {
                updateSelection.run();
            }
        });
        final Button btnEdit = new Button(cTemplate, SWT.PUSH);
        buttons.add(btnEdit);
        Messages.setLanguageText(btnEdit, "wizard.multitracker.edit");
        btnEdit.addListener(SWT.Selection, new Listener() {

            @Override
            public void handleEvent(Event e) {
                Map multiTrackers = TrackersUtil.getInstance().getMultiTrackers();
                String selected = currentTemplate[0];
                new MultiTrackerEditor(btnEdit.getShell(), selected, (List) multiTrackers.get(selected), templateTEL);
            }
        });
        final Button btnDelete = new Button(cTemplate, SWT.PUSH);
        buttons.add(btnDelete);
        Messages.setLanguageText(btnDelete, "wizard.multitracker.delete");
        btnDelete.addListener(SWT.Selection, new Listener() {

            @Override
            public void handleEvent(Event e) {
                final String selected = currentTemplate[0];
                MessageBoxShell mb = new MessageBoxShell(MessageText.getString("message.confirm.delete.title"), MessageText.getString("message.confirm.delete.text", new String[] { selected }), new String[] { MessageText.getString("Button.yes"), MessageText.getString("Button.no") }, 1);
                mb.open(new UserPrompterResultListener() {

                    @Override
                    public void prompterClosed(int result) {
                        if (result == 0) {
                            TrackersUtil.getInstance().removeMultiTracker(selected);
                            updateTemplates.run();
                        }
                    }
                });
            }
        });
        Label labelApply = new Label(cTemplate, SWT.NULL);
        gridData = new GridData(GridData.FILL_HORIZONTAL);
        gridData.horizontalSpan = 2;
        labelApply.setLayoutData(gridData);
        Messages.setLanguageText(labelApply, "apply.selected.template");
        final Button btnReplace = new Button(cTemplate, SWT.PUSH);
        buttons.add(btnReplace);
        Messages.setLanguageText(btnReplace, "label.replace");
        btnReplace.addListener(SWT.Selection, new Listener() {

            @Override
            public void handleEvent(Event e) {
                Map<String, List<List<String>>> multiTrackers = TrackersUtil.getInstance().getMultiTrackers();
                String selected = currentTemplate[0];
                trackers = TorrentUtils.getClone(multiTrackers.get(selected));
                refresh();
                computeSaveEnable();
            }
        });
        final Button btnMerge = new Button(cTemplate, SWT.PUSH);
        buttons.add(btnMerge);
        Messages.setLanguageText(btnMerge, "label.merge");
        btnMerge.addListener(SWT.Selection, new Listener() {

            @Override
            public void handleEvent(Event e) {
                Map<String, List<List<String>>> multiTrackers = TrackersUtil.getInstance().getMultiTrackers();
                String selected = currentTemplate[0];
                trackers = TorrentUtils.mergeAnnounceURLs(trackers, multiTrackers.get(selected));
                refresh();
                computeSaveEnable();
            }
        });
        final Button btnRemove = new Button(cTemplate, SWT.PUSH);
        buttons.add(btnRemove);
        Messages.setLanguageText(btnRemove, "Button.remove");
        btnRemove.addListener(SWT.Selection, new Listener() {

            @Override
            public void handleEvent(Event e) {
                Map<String, List<List<String>>> multiTrackers = TrackersUtil.getInstance().getMultiTrackers();
                String selected = currentTemplate[0];
                trackers = TorrentUtils.removeAnnounceURLs(trackers, multiTrackers.get(selected), false);
                refresh();
                computeSaveEnable();
            }
        });
        updateTemplates.run();
        Utils.makeButtonsEqualWidth(buttons);
    }
    Label labelSeparator = new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 3;
    labelSeparator.setLayoutData(gridData);
    // button row
    Composite cButtons = new Composite(shell, SWT.NONE);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 3;
    cButtons.setLayoutData(gridData);
    GridLayout layoutButtons = new GridLayout();
    layoutButtons.numColumns = 5;
    cButtons.setLayout(layoutButtons);
    List<Button> buttons = new ArrayList<>();
    final Button btnedittext = new Button(cButtons, SWT.PUSH);
    buttons.add(btnedittext);
    gridData = new GridData();
    gridData.horizontalAlignment = GridData.END;
    btnedittext.setLayoutData(gridData);
    Messages.setLanguageText(btnedittext, "wizard.multitracker.edit.text");
    btnedittext.addListener(SWT.Selection, new Listener() {

        @Override
        public void handleEvent(Event e) {
            btnSave.setEnabled(false);
            btnedittext.setEnabled(false);
            trackers = new ArrayList();
            TreeItem[] groupItems = treeGroups.getItems();
            for (int i = 0; i < groupItems.length; i++) {
                TreeItem group = groupItems[i];
                TreeItem[] trackerItems = group.getItems();
                List groupList = new ArrayList(group.getItemCount());
                for (int j = 0; j < trackerItems.length; j++) {
                    groupList.add(trackerItems[j].getText());
                }
                trackers.add(groupList);
            }
            final String old_text = TorrentUtils.announceGroupsToText(trackers);
            final TextViewerWindow viewer = new TextViewerWindow(shell, "wizard.multitracker.edit.text.title", "wizard.multitracker.edit.text.msg", old_text, false, false);
            viewer.setEditable(true);
            viewer.addListener(new TextViewerWindow.TextViewerWindowListener() {

                @Override
                public void closed() {
                    try {
                        if (viewer.getOKPressed()) {
                            String new_text = viewer.getText();
                            if (!old_text.equals(new_text)) {
                                String[] lines = new_text.split("\n");
                                StringBuilder valid_text = new StringBuilder(new_text.length() + 1);
                                for (String line : lines) {
                                    line = line.trim();
                                    if (line.length() > 0) {
                                        if (!validURL(line)) {
                                            continue;
                                        }
                                    }
                                    valid_text.append(line);
                                    valid_text.append("\n");
                                }
                                trackers = TorrentUtils.announceTextToGroups(valid_text.toString());
                                refresh();
                            }
                        }
                    } finally {
                        computeSaveEnable();
                        btnedittext.setEnabled(true);
                    }
                }
            });
        }
    });
    final Button btnAddTrackerList = new Button(cButtons, SWT.PUSH);
    buttons.add(btnAddTrackerList);
    gridData = new GridData();
    gridData.horizontalAlignment = GridData.END;
    btnAddTrackerList.setLayoutData(gridData);
    Messages.setLanguageText(btnAddTrackerList, "wizard.multitracker.add.trackerlist");
    btnAddTrackerList.addListener(SWT.Selection, new Listener() {

        @Override
        public void handleEvent(Event e) {
            SimpleTextEntryWindow entryWindow = new SimpleTextEntryWindow("enter.url", "enter.trackerlist.url");
            entryWindow.prompt(new UIInputReceiverListener() {

                @Override
                public void UIInputReceiverClosed(UIInputReceiver receiver) {
                    if (!receiver.hasSubmittedInput()) {
                        return;
                    }
                    String url = receiver.getSubmittedInput().trim();
                    if (!url.isEmpty()) {
                        TreeItem group = newGroup();
                        TreeItem itemTracker = newTracker(group, "trackerlist:" + url.trim());
                    }
                }
            });
        }
    });
    Label label = new Label(cButtons, SWT.NULL);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    label.setLayoutData(gridData);
    btnSave = new Button(cButtons, SWT.PUSH);
    buttons.add(btnSave);
    gridData = new GridData();
    gridData.horizontalAlignment = GridData.END;
    btnSave.setLayoutData(gridData);
    Messages.setLanguageText(btnSave, "wizard.multitracker.edit.save");
    btnSave.addListener(SWT.Selection, new Listener() {

        @Override
        public void handleEvent(Event e) {
            update();
            shell.dispose();
        }
    });
    btnCancel = new Button(cButtons, SWT.PUSH);
    buttons.add(btnCancel);
    gridData = new GridData();
    gridData.horizontalAlignment = GridData.END;
    btnCancel.setLayoutData(gridData);
    Messages.setLanguageText(btnCancel, "Button.cancel");
    btnCancel.addListener(SWT.Selection, new Listener() {

        @Override
        public void handleEvent(Event e) {
            shell.dispose();
        }
    });
    Utils.makeButtonsEqualWidth(buttons);
    shell.setDefaultButton(btnSave);
    shell.addListener(SWT.Traverse, new Listener() {

        @Override
        public void handleEvent(Event e) {
            if (e.character == SWT.ESC) {
                shell.dispose();
            }
        }
    });
    computeSaveEnable();
    refresh();
    constructMenu();
    editor = new TreeEditor(treeGroups);
    treeGroups.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent arg0) {
            if (itemEdited != null && !itemEdited.isDisposed() && !editor.getEditor().isDisposed()) {
                itemEdited.setText(((Text) editor.getEditor()).getText());
            }
            removeEditor();
        }
    });
    Point size = shell.computeSize(500, SWT.DEFAULT);
    shell.setSize(size);
    Utils.centreWindow(shell);
    shell.open();
}
Also used : UserPrompterResultListener(com.biglybt.ui.UserPrompterResultListener) UIInputReceiverListener(com.biglybt.pif.ui.UIInputReceiverListener) ArrayList(java.util.ArrayList) GridLayout(org.eclipse.swt.layout.GridLayout) SimpleTextEntryWindow(com.biglybt.ui.swt.SimpleTextEntryWindow) TrackersUtil(com.biglybt.core.util.TrackersUtil) ArrayList(java.util.ArrayList) List(java.util.List) TextViewerWindow(com.biglybt.ui.swt.TextViewerWindow) TreeEditor(org.eclipse.swt.custom.TreeEditor) MessageBoxShell(com.biglybt.ui.swt.shells.MessageBoxShell) MessageText(com.biglybt.core.internat.MessageText) Point(org.eclipse.swt.graphics.Point) FormattersImpl(com.biglybt.pifimpl.local.utils.FormattersImpl) Point(org.eclipse.swt.graphics.Point) UserPrompterResultListener(com.biglybt.ui.UserPrompterResultListener) UIInputReceiver(com.biglybt.pif.ui.UIInputReceiver) GridData(org.eclipse.swt.layout.GridData) UIInputReceiverListener(com.biglybt.pif.ui.UIInputReceiverListener) Map(java.util.Map)

Example 32 with MessageBoxShell

use of com.biglybt.ui.swt.shells.MessageBoxShell in project BiglyBT by BiglySoftware.

the class MenuFactory method BencodeToJSON.

private static void BencodeToJSON() {
    final Shell shell = Utils.findAnyShell();
    FileDialog dialog = new FileDialog(shell, SWT.SYSTEM_MODAL | SWT.OPEN);
    dialog.setFilterExtensions(new String[] { "*.config", "*.torrent", "*.tor", Constants.FILE_WILDCARD });
    dialog.setFilterNames(new String[] { "*.config", "*.torrent", "*.tor", Constants.FILE_WILDCARD });
    dialog.setFilterPath(TorrentOpener.getFilterPathTorrent());
    dialog.setText(MessageText.getString("bencode.file.browse"));
    String str = dialog.open();
    if (str != null) {
        try {
            BufferedInputStream bis = new BufferedInputStream(new FileInputStream(str));
            try {
                Map map = BDecoder.decode(bis);
                if (map == null) {
                    throw (new Exception("BDecode failed"));
                }
                final String json = BEncoder.encodeToJSON(map);
                Utils.execSWTThreadLater(1, new Runnable() {

                    @Override
                    public void run() {
                        FileDialog dialog2 = new FileDialog(shell, SWT.SYSTEM_MODAL | SWT.SAVE);
                        dialog2.setFilterPath(TorrentOpener.getFilterPathTorrent());
                        dialog2.setFilterExtensions(new String[] { "*.json" });
                        String str2 = dialog2.open();
                        if (str2 != null) {
                            if (!(str2.toLowerCase(Locale.US).endsWith(".json"))) {
                                str2 += ".json";
                            }
                            try {
                                if (!FileUtil.writeStringAsFile(new File(str2), json)) {
                                    throw (new Exception("Failed to write output file"));
                                }
                            } catch (Throwable e) {
                                MessageBoxShell mb = new MessageBoxShell(SWT.ERROR, MessageText.getString("ConfigView.section.security.resetkey.error.title"), Debug.getNestedExceptionMessage(e));
                                mb.setParent(shell);
                                mb.open(null);
                            }
                        }
                    }
                });
            } finally {
                bis.close();
            }
        } catch (Throwable e) {
            MessageBoxShell mb = new MessageBoxShell(SWT.ERROR, MessageText.getString("ConfigView.section.security.resetkey.error.title"), Debug.getNestedExceptionMessage(e));
            mb.setParent(shell);
            mb.open(null);
        }
    }
}
Also used : MessageBoxShell(com.biglybt.ui.swt.shells.MessageBoxShell) BufferedInputStream(java.io.BufferedInputStream) MessageBoxShell(com.biglybt.ui.swt.shells.MessageBoxShell) Map(java.util.Map) HashMap(java.util.HashMap) TOTorrentFile(com.biglybt.core.torrent.TOTorrentFile) File(java.io.File) FileInputStream(java.io.FileInputStream)

Example 33 with MessageBoxShell

use of com.biglybt.ui.swt.shells.MessageBoxShell in project BiglyBT by BiglySoftware.

the class SystemWarningWindow method openWindow.

protected void openWindow() {
    Display display = parent.getDisplay();
    // shell = new Shell(parent, SWT.TOOL | SWT.TITLE | SWT.CLOSE);
    // shell.setText("Warning (X of X)");
    shell = new Shell(parent, SWT.TOOL);
    shell.setLayout(new FormLayout());
    shell.setBackground(Colors.getSystemColor(display, SWT.COLOR_INFO_BACKGROUND));
    shell.setForeground(Colors.getSystemColor(display, SWT.COLOR_INFO_FOREGROUND));
    Menu menu = new Menu(shell);
    MenuItem menuItem = new MenuItem(menu, SWT.PUSH);
    Messages.setLanguageText(menuItem, "MyTorrentsView.menu.thisColumn.toClipboard");
    menuItem.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            ClipboardCopy.copyToClipBoard(logAlert.text + (logAlert.details == null ? "" : "\n" + logAlert.details));
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
    shell.setMenu(menu);
    ImageLoader imageLoader = ImageLoader.getInstance();
    imgClose = imageLoader.getImage("image.systemwarning.closeitem");
    boundsClose = imgClose.getBounds();
    GC gc = new GC(shell);
    FontData[] fontdata = gc.getFont().getFontData();
    fontdata[0].setHeight(fontdata[0].getHeight() + 1);
    fontdata[0].setStyle(SWT.BOLD);
    fontTitle = new Font(display, fontdata);
    fontdata = gc.getFont().getFontData();
    fontdata[0].setHeight(fontdata[0].getHeight() - 1);
    fontCount = new Font(display, fontdata);
    shell.addDisposeListener(new DisposeListener() {

        @Override
        public void widgetDisposed(DisposeEvent e) {
            Utils.disposeSWTObjects(new Object[] { fontTitle, fontCount });
            numWarningWindowsOpen--;
        }
    });
    Rectangle printArea = new Rectangle(BORDER_X, 0, WIDTH - (BORDER_X * 2), 5000);
    spText = new GCStringPrinter(gc, text, printArea, true, false, SWT.WRAP);
    spText.setUrlColor(Colors.blues[Colors.FADED_DARKEST]);
    spText.calculateMetrics();
    gc.setFont(fontCount);
    String sCount = MessageText.getString("label.xOfTotal", new String[] { "" + historyPosition + 1, "" + getWarningCount() });
    spCount = new GCStringPrinter(gc, sCount, printArea, true, false, SWT.WRAP);
    spCount.calculateMetrics();
    gc.setFont(fontTitle);
    spTitle = new GCStringPrinter(gc, title, printArea, true, false, SWT.WRAP);
    spTitle.calculateMetrics();
    gc.dispose();
    sizeText = spText.getCalculatedSize();
    sizeTitle = spTitle.getCalculatedSize();
    sizeCount = spCount.getCalculatedSize();
    FormData fd;
    Button btnDismiss = new Button(shell, SWT.PUSH);
    Messages.setLanguageText(btnDismiss, "Button.dismiss");
    final int btnHeight = btnDismiss.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
    Button btnPrev = new Button(shell, SWT.PUSH);
    btnPrev.setText("<");
    Button btnNext = new Button(shell, SWT.PUSH);
    btnNext.setText(">");
    fd = new FormData();
    fd.bottom = new FormAttachment(100, -BORDER_Y1);
    fd.right = new FormAttachment(100, -BORDER_X);
    btnNext.setLayoutData(fd);
    fd = new FormData();
    fd.bottom = new FormAttachment(100, -BORDER_Y1);
    fd.right = new FormAttachment(btnNext, -BORDER_X);
    btnPrev.setLayoutData(fd);
    fd = new FormData();
    fd.bottom = new FormAttachment(100, -BORDER_Y1);
    fd.right = new FormAttachment(btnPrev, -BORDER_X);
    btnDismiss.setLayoutData(fd);
    height = BORDER_Y0 + sizeTitle.y + GAP_Y + sizeText.y + GAP_Y_TITLE_COUNT + sizeCount.y + GAP_BUTTON_Y + btnHeight + BORDER_Y1;
    Rectangle area = shell.computeTrim(ptBottomRight.x - WIDTH, ptBottomRight.y - height, WIDTH, height);
    shell.setBounds(area);
    shell.setLocation(ptBottomRight.x - area.width, ptBottomRight.y - area.height - 2);
    rectX = new Rectangle(area.width - BORDER_X - boundsClose.width, BORDER_Y0, boundsClose.width, boundsClose.height);
    shell.addMouseMoveListener(new MouseMoveListener() {

        int lastCursor = SWT.CURSOR_ARROW;

        @Override
        public void mouseMove(MouseEvent e) {
            if (shell == null || shell.isDisposed()) {
                return;
            }
            URLInfo hitUrl = spText.getHitUrl(e.x, e.y);
            int cursor = (rectX.contains(e.x, e.y)) || hitUrl != null ? SWT.CURSOR_HAND : SWT.CURSOR_ARROW;
            if (cursor != lastCursor) {
                lastCursor = cursor;
                shell.setCursor(e.display.getSystemCursor(cursor));
            }
        }
    });
    shell.addMouseListener(new MouseListener() {

        @Override
        public void mouseUp(MouseEvent e) {
            if (shell == null || shell.isDisposed()) {
                return;
            }
            if (rectX.contains(e.x, e.y)) {
                shell.dispose();
            }
            URLInfo hitUrl = spText.getHitUrl(e.x, e.y);
            if (hitUrl != null) {
                if (hitUrl.url.equals("details")) {
                    MessageBoxShell mb = new MessageBoxShell(Constants.APP_NAME, logAlert.details, new String[] { MessageText.getString("Button.ok") }, 0);
                    mb.setUseTextBox(true);
                    mb.setParent(Utils.findAnyShell());
                    mb.open(null);
                } else {
                    Utils.launch(hitUrl.url);
                }
            }
        }

        @Override
        public void mouseDown(MouseEvent e) {
        }

        @Override
        public void mouseDoubleClick(MouseEvent e) {
        }
    });
    shell.addPaintListener(new PaintListener() {

        @Override
        public void paintControl(PaintEvent e) {
            e.gc.drawImage(imgClose, WIDTH - BORDER_X - boundsClose.width, BORDER_Y0);
            Rectangle printArea;
            printArea = new Rectangle(BORDER_X, BORDER_Y0 + sizeTitle.y + GAP_Y_TITLE_COUNT, WIDTH, 100);
            String sCount = MessageText.getString("label.xOfTotal", new String[] { "" + (historyPosition + 1), "" + getWarningCount() });
            e.gc.setAlpha(180);
            Font lastFont = e.gc.getFont();
            e.gc.setFont(fontCount);
            spCount = new GCStringPrinter(e.gc, sCount, printArea, true, false, SWT.WRAP | SWT.TOP);
            spCount.printString();
            e.gc.setAlpha(255);
            sizeCount = spCount.getCalculatedSize();
            e.gc.setFont(lastFont);
            spText.printString(e.gc, new Rectangle(BORDER_X, BORDER_Y0 + sizeTitle.y + GAP_Y_TITLE_COUNT + sizeCount.y + GAP_Y, WIDTH - BORDER_X - BORDER_X, 5000), SWT.WRAP | SWT.TOP);
            e.gc.setFont(fontTitle);
            e.gc.setForeground(ColorCache.getColor(e.gc.getDevice(), "#54728c"));
            spTitle.printString(e.gc, new Rectangle(BORDER_X, BORDER_Y0, WIDTH - BORDER_X - BORDER_X, 5000), SWT.WRAP | SWT.TOP);
            e.gc.setLineStyle(SWT.LINE_DOT);
            e.gc.setLineWidth(1);
            e.gc.setAlpha(180);
            e.gc.drawLine(BORDER_X, height - btnHeight - (GAP_BUTTON_Y / 2) - BORDER_Y1, WIDTH - BORDER_X, height - btnHeight - (GAP_BUTTON_Y / 2) - BORDER_Y1);
        }
    });
    shell.addTraverseListener(new TraverseListener() {

        @Override
        public void keyTraversed(TraverseEvent e) {
            if (e.detail == SWT.TRAVERSE_ESCAPE) {
                shell.dispose();
                return;
            }
        }
    });
    btnPrev.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            ArrayList<LogAlert> alerts = Alerts.getUnviewedLogAlerts();
            int pos = historyPosition - 1;
            if (pos < 0 || pos >= alerts.size()) {
                return;
            }
            new SystemWarningWindow(alerts.get(pos), ptBottomRight, parent, pos);
            shell.dispose();
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
    btnPrev.setEnabled(historyPosition > 0);
    btnNext.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            ArrayList<LogAlert> alerts = Alerts.getUnviewedLogAlerts();
            int pos = historyPosition + 1;
            if (pos >= alerts.size()) {
                return;
            }
            new SystemWarningWindow(alerts.get(pos), ptBottomRight, parent, pos);
            shell.dispose();
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
    ArrayList<LogAlert> alerts = Alerts.getUnviewedLogAlerts();
    btnNext.setEnabled(alerts.size() != historyPosition + 1);
    btnDismiss.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            ArrayList<LogAlert> alerts = Alerts.getUnviewedLogAlerts();
            for (int i = 0; i < alerts.size() && i <= historyPosition; i++) {
                Alerts.markAlertAsViewed(alerts.get(i));
            }
            shell.dispose();
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
    shell.open();
    numWarningWindowsOpen++;
}
Also used : GCStringPrinter(com.biglybt.ui.swt.shells.GCStringPrinter) ArrayList(java.util.ArrayList) MessageBoxShell(com.biglybt.ui.swt.shells.MessageBoxShell) MessageBoxShell(com.biglybt.ui.swt.shells.MessageBoxShell) URLInfo(com.biglybt.ui.swt.shells.GCStringPrinter.URLInfo) LogAlert(com.biglybt.core.logging.LogAlert) ImageLoader(com.biglybt.ui.swt.imageloader.ImageLoader)

Example 34 with MessageBoxShell

use of com.biglybt.ui.swt.shells.MessageBoxShell in project BiglyBT by BiglySoftware.

the class UIDebugGenerator method generate.

public static void generate(final String sourceRef, String additionalText) {
    final GeneratedResults gr = generate(null, new DebugPrompterListener() {

        @Override
        public boolean promptUser(GeneratedResults gr) {
            UIDebugGenerator.promptUser(false, gr);
            if (gr.message == null) {
                return false;
            }
            return true;
        }
    });
    if (gr != null) {
        MessageBoxShell mb = new MessageBoxShell(SWT.OK | SWT.CANCEL | SWT.ICON_INFORMATION | SWT.APPLICATION_MODAL, "UIDebugGenerator.complete", new String[] { gr.file.toString() });
        mb.open(new UserPrompterResultListener() {

            @Override
            public void prompterClosed(int result) {
                if (result == SWT.OK) {
                    try {
                        PlatformManagerFactory.getPlatformManager().showFile(gr.file.getAbsolutePath());
                    } catch (Exception e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                }
            }
        });
    }
}
Also used : UserPrompterResultListener(com.biglybt.ui.UserPrompterResultListener) MessageBoxShell(com.biglybt.ui.swt.shells.MessageBoxShell)

Example 35 with MessageBoxShell

use of com.biglybt.ui.swt.shells.MessageBoxShell in project BiglyBT by BiglySoftware.

the class BuddyPluginViewBetaChat method buildSupport2.

private void buildSupport2(Composite parent) {
    boolean public_chat = !chat.isPrivateChat();
    if (chat.getViewType() == BuddyPluginBeta.VIEW_TYPE_DEFAULT || chat.isReadOnly()) {
        GridLayout layout = new GridLayout();
        layout.numColumns = 2;
        layout.marginHeight = 0;
        layout.marginWidth = 0;
        parent.setLayout(layout);
        GridData grid_data = new GridData(GridData.FILL_BOTH);
        Utils.setLayoutData(parent, grid_data);
        Composite sash_area = new Composite(parent, SWT.NONE);
        layout = new GridLayout();
        layout.numColumns = 1;
        layout.marginHeight = 0;
        layout.marginWidth = 0;
        sash_area.setLayout(layout);
        grid_data = new GridData(GridData.FILL_BOTH);
        grid_data.horizontalSpan = 2;
        Utils.setLayoutData(sash_area, grid_data);
        final SashForm sash = new SashForm(sash_area, SWT.HORIZONTAL);
        grid_data = new GridData(GridData.FILL_BOTH);
        Utils.setLayoutData(sash, grid_data);
        final Composite lhs = new Composite(sash, SWT.NONE);
        layout = new GridLayout();
        layout.numColumns = 2;
        layout.marginHeight = 0;
        layout.marginWidth = 0;
        layout.marginTop = 4;
        layout.marginLeft = 4;
        lhs.setLayout(layout);
        grid_data = new GridData(GridData.FILL_BOTH);
        grid_data.widthHint = 300;
        Utils.setLayoutData(lhs, grid_data);
        buildStatus(parent, lhs);
        Composite log_holder = buildFTUX(lhs, SWT.BORDER);
        // LOG panel
        layout = new GridLayout();
        layout.numColumns = 1;
        layout.marginHeight = 0;
        layout.marginWidth = 0;
        layout.marginLeft = 4;
        log_holder.setLayout(layout);
        // grid_data = new GridData(GridData.FILL_BOTH );
        // grid_data.horizontalSpan = 2;
        // Utils.setLayoutData(log_holder, grid_data);
        log = new StyledText(log_holder, SWT.READ_ONLY | SWT.V_SCROLL | SWT.WRAP | SWT.NO_FOCUS);
        grid_data = new GridData(GridData.FILL_BOTH);
        grid_data.horizontalSpan = 1;
        // grid_data.horizontalIndent = 4;
        Utils.setLayoutData(log, grid_data);
        // log.setIndent( 4 );
        log.setEditable(false);
        log_holder.setBackground(log.getBackground());
        final Menu log_menu = new Menu(log);
        log.setMenu(log_menu);
        log.addMenuDetectListener(new MenuDetectListener() {

            @Override
            public void menuDetected(MenuDetectEvent e) {
                e.doit = false;
                boolean handled = false;
                for (MenuItem mi : log_menu.getItems()) {
                    mi.dispose();
                }
                try {
                    Point mapped = log.getDisplay().map(null, log, new Point(e.x, e.y));
                    int offset = log.getOffsetAtLocation(mapped);
                    final StyleRange sr = log.getStyleRangeAtOffset(offset);
                    if (sr != null) {
                        Object data = sr.data;
                        if (data instanceof ChatParticipant) {
                            ChatParticipant cp = (ChatParticipant) data;
                            List<ChatParticipant> cps = new ArrayList<>();
                            cps.add(cp);
                            buildParticipantMenu(log_menu, cps);
                            handled = true;
                        } else if (data instanceof String) {
                            String url_str = (String) sr.data;
                            String str = url_str;
                            if (str.length() > 50) {
                                str = str.substring(0, 50) + "...";
                            }
                            if (chat.isAnonymous() && url_str.toLowerCase(Locale.US).startsWith("magnet:")) {
                                String[] magnet_uri = { url_str };
                                Set<String> networks = UrlUtils.extractNetworks(magnet_uri);
                                String i2p_only_uri = magnet_uri[0] + "&net=" + UrlUtils.encode(AENetworkClassifier.AT_I2P);
                                String i2p_only_str = i2p_only_uri;
                                if (i2p_only_str.length() > 50) {
                                    i2p_only_str = i2p_only_str.substring(0, 50) + "...";
                                }
                                i2p_only_str = lu.getLocalisedMessageText("azbuddy.dchat.open.i2p.magnet") + ": " + i2p_only_str;
                                final MenuItem mi_open_i2p_vuze = new MenuItem(log_menu, SWT.PUSH);
                                mi_open_i2p_vuze.setText(i2p_only_str);
                                mi_open_i2p_vuze.setData(i2p_only_uri);
                                mi_open_i2p_vuze.addSelectionListener(new SelectionAdapter() {

                                    @Override
                                    public void widgetSelected(SelectionEvent e) {
                                        String url_str = (String) mi_open_i2p_vuze.getData();
                                        if (url_str != null) {
                                            TorrentOpener.openTorrent(url_str);
                                        }
                                    }
                                });
                                if (networks.size() == 1 && networks.iterator().next() == AENetworkClassifier.AT_I2P) {
                                // already done above
                                } else {
                                    str = lu.getLocalisedMessageText("azbuddy.dchat.open.magnet") + ": " + str;
                                    final MenuItem mi_open_vuze = new MenuItem(log_menu, SWT.PUSH);
                                    mi_open_vuze.setText(str);
                                    mi_open_vuze.setData(url_str);
                                    mi_open_vuze.addSelectionListener(new SelectionAdapter() {

                                        @Override
                                        public void widgetSelected(SelectionEvent e) {
                                            String url_str = (String) mi_open_vuze.getData();
                                            if (url_str != null) {
                                                TorrentOpener.openTorrent(url_str);
                                            }
                                        }
                                    });
                                }
                            } else {
                                str = lu.getLocalisedMessageText("azbuddy.dchat.open.in.vuze") + ": " + str;
                                final MenuItem mi_open_vuze = new MenuItem(log_menu, SWT.PUSH);
                                mi_open_vuze.setText(str);
                                mi_open_vuze.setData(url_str);
                                mi_open_vuze.addSelectionListener(new SelectionAdapter() {

                                    @Override
                                    public void widgetSelected(SelectionEvent e) {
                                        String url_str = (String) mi_open_vuze.getData();
                                        if (url_str != null) {
                                            String lc_url_str = url_str.toLowerCase(Locale.US);
                                            if (lc_url_str.startsWith("chat:")) {
                                                try {
                                                    beta.handleURI(url_str, true);
                                                } catch (Throwable f) {
                                                    Debug.out(f);
                                                }
                                            } else {
                                                TorrentOpener.openTorrent(url_str);
                                            }
                                        }
                                    }
                                });
                            }
                            final MenuItem mi_open_ext = new MenuItem(log_menu, SWT.PUSH);
                            mi_open_ext.setText(lu.getLocalisedMessageText("azbuddy.dchat.open.in.browser"));
                            mi_open_ext.addSelectionListener(new SelectionAdapter() {

                                @Override
                                public void widgetSelected(SelectionEvent e) {
                                    String url_str = (String) mi_open_ext.getData();
                                    Utils.launch(url_str);
                                }
                            });
                            new MenuItem(log_menu, SWT.SEPARATOR);
                            if (chat.isAnonymous() && url_str.toLowerCase(Locale.US).startsWith("magnet:")) {
                                String[] magnet_uri = { url_str };
                                Set<String> networks = UrlUtils.extractNetworks(magnet_uri);
                                String i2p_only_uri = magnet_uri[0] + "&net=" + UrlUtils.encode(AENetworkClassifier.AT_I2P);
                                final MenuItem mi_copy_i2p_clip = new MenuItem(log_menu, SWT.PUSH);
                                mi_copy_i2p_clip.setText(lu.getLocalisedMessageText("azbuddy.dchat.copy.i2p.magnet"));
                                mi_copy_i2p_clip.setData(i2p_only_uri);
                                mi_copy_i2p_clip.addSelectionListener(new SelectionAdapter() {

                                    @Override
                                    public void widgetSelected(SelectionEvent e) {
                                        String url_str = (String) mi_copy_i2p_clip.getData();
                                        if (url_str != null) {
                                            ClipboardCopy.copyToClipBoard(url_str);
                                        }
                                    }
                                });
                                if (networks.size() == 1 && networks.iterator().next() == AENetworkClassifier.AT_I2P) {
                                // already done above
                                } else {
                                    final MenuItem mi_copy_clip = new MenuItem(log_menu, SWT.PUSH);
                                    mi_copy_clip.setText(lu.getLocalisedMessageText("azbuddy.dchat.copy.magnet"));
                                    mi_copy_clip.setData(url_str);
                                    mi_copy_clip.addSelectionListener(new SelectionAdapter() {

                                        @Override
                                        public void widgetSelected(SelectionEvent e) {
                                            String url_str = (String) mi_copy_clip.getData();
                                            if (url_str != null) {
                                                ClipboardCopy.copyToClipBoard(url_str);
                                            }
                                        }
                                    });
                                }
                            } else {
                                final MenuItem mi_copy_clip = new MenuItem(log_menu, SWT.PUSH);
                                mi_copy_clip.setText(lu.getLocalisedMessageText("label.copy.to.clipboard"));
                                mi_copy_clip.setData(url_str);
                                mi_copy_clip.addSelectionListener(new SelectionAdapter() {

                                    @Override
                                    public void widgetSelected(SelectionEvent e) {
                                        String url_str = (String) mi_copy_clip.getData();
                                        if (url_str != null) {
                                            ClipboardCopy.copyToClipBoard(url_str);
                                        }
                                    }
                                });
                            }
                            if (url_str.toLowerCase().startsWith("http")) {
                                mi_open_ext.setData(url_str);
                                mi_open_ext.setEnabled(true);
                            } else {
                                mi_open_ext.setEnabled(false);
                            }
                            handled = true;
                        } else {
                            if (Constants.isCVSVersion()) {
                                if (sr instanceof MyStyleRange) {
                                    final MyStyleRange msr = (MyStyleRange) sr;
                                    MenuItem item = new MenuItem(log_menu, SWT.NONE);
                                    item.setText(MessageText.getString("label.copy.to.clipboard"));
                                    item.addSelectionListener(new SelectionAdapter() {

                                        @Override
                                        public void widgetSelected(SelectionEvent e) {
                                            ClipboardCopy.copyToClipBoard(msr.message.getMessage());
                                        }
                                    });
                                    handled = true;
                                }
                            }
                        }
                    }
                } catch (Throwable f) {
                }
                if (!handled) {
                    final String text = log.getSelectionText();
                    if (text != null && text.length() > 0) {
                        MenuItem item = new MenuItem(log_menu, SWT.NONE);
                        item.setText(MessageText.getString("label.copy.to.clipboard"));
                        item.addSelectionListener(new SelectionAdapter() {

                            @Override
                            public void widgetSelected(SelectionEvent e) {
                                ClipboardCopy.copyToClipBoard(text);
                            }
                        });
                        handled = true;
                    }
                }
                if (handled) {
                    e.doit = true;
                }
            }
        });
        log.addListener(SWT.MouseDoubleClick, new Listener() {

            @Override
            public void handleEvent(Event e) {
                try {
                    final int offset = log.getOffsetAtLocation(new Point(e.x, e.y));
                    for (int i = 0; i < log_styles.length; i++) {
                        StyleRange sr = log_styles[i];
                        Object data = sr.data;
                        if (data != null && offset >= sr.start && offset < sr.start + sr.length) {
                            boolean anon_chat = chat.isAnonymous();
                            if (data instanceof String) {
                                final String url_str = (String) data;
                                String lc_url_str = url_str.toLowerCase(Locale.US);
                                if (lc_url_str.startsWith("chat:")) {
                                    if (anon_chat && !lc_url_str.startsWith("chat:anon:")) {
                                        return;
                                    }
                                    try {
                                        beta.handleURI(url_str, true);
                                    } catch (Throwable f) {
                                        Debug.out(f);
                                    }
                                } else {
                                    if (anon_chat) {
                                        try {
                                            String host = new URL(lc_url_str).getHost();
                                            if (AENetworkClassifier.categoriseAddress(host) == AENetworkClassifier.AT_PUBLIC) {
                                                return;
                                            }
                                        } catch (Throwable f) {
                                            return;
                                        }
                                    }
                                    if (lc_url_str.contains(".torrent") || UrlUtils.parseTextForMagnets(url_str) != null) {
                                        TorrentOpener.openTorrent(url_str);
                                    } else {
                                        if (url_str.toLowerCase(Locale.US).startsWith("http")) {
                                            // without this backoff we end up with the text widget
                                            // being left in a 'mouse down' state when returning to it :(
                                            Utils.execSWTThreadLater(100, new Runnable() {

                                                @Override
                                                public void run() {
                                                    Utils.launch(url_str);
                                                }
                                            });
                                        } else {
                                            TorrentOpener.openTorrent(url_str);
                                        }
                                    }
                                }
                                log.setSelection(offset);
                                e.doit = false;
                            } else if (data instanceof ChatParticipant) {
                                ChatParticipant participant = (ChatParticipant) data;
                                addNickString(participant);
                            }
                        }
                    }
                } catch (Throwable f) {
                }
            }
        });
        log.addMouseTrackListener(new MouseTrackListener() {

            private StyleRange old_range;

            private StyleRange temp_range;

            private int temp_index;

            @Override
            public void mouseHover(MouseEvent e) {
                boolean active = false;
                try {
                    int offset = log.getOffsetAtLocation(new Point(e.x, e.y));
                    for (int i = 0; i < log_styles.length; i++) {
                        StyleRange sr = log_styles[i];
                        Object data = sr.data;
                        if (data != null && offset >= sr.start && offset < sr.start + sr.length) {
                            if (old_range != null) {
                                if (temp_index < log_styles.length && log_styles[temp_index] == temp_range) {
                                    log_styles[temp_index] = old_range;
                                    old_range = null;
                                }
                            }
                            sr = log_styles[i];
                            String tt_extra = "";
                            if (data instanceof String) {
                                try {
                                    URL url = new URL((String) data);
                                    String query = url.getQuery();
                                    if (query != null) {
                                        String[] bits = query.split("&");
                                        int seeds = -1;
                                        int leechers = -1;
                                        for (String bit : bits) {
                                            String[] temp = bit.split("=");
                                            String lhs = temp[0];
                                            if (lhs.equals("_s")) {
                                                seeds = Integer.parseInt(temp[1]);
                                            } else if (lhs.equals("_l")) {
                                                leechers = Integer.parseInt(temp[1]);
                                            }
                                        }
                                        if (seeds != -1 && leechers != -1) {
                                            tt_extra = ": seeds=" + seeds + ", leechers=" + leechers;
                                        }
                                    }
                                } catch (Throwable f) {
                                }
                            }
                            log.setToolTipText(MessageText.getString("label.right.click.for.options") + tt_extra);
                            StyleRange derp;
                            if (sr instanceof MyStyleRange) {
                                derp = new MyStyleRange((MyStyleRange) sr);
                            } else {
                                derp = new StyleRange(sr);
                            }
                            derp.start = sr.start;
                            derp.length = sr.length;
                            derp.borderStyle = SWT.BORDER_DASH;
                            old_range = sr;
                            temp_range = derp;
                            temp_index = i;
                            log_styles[i] = derp;
                            log.setStyleRanges(log_styles);
                            active = true;
                            break;
                        }
                    }
                } catch (Throwable f) {
                }
                if (!active) {
                    log.setToolTipText("");
                    if (old_range != null) {
                        if (temp_index < log_styles.length && log_styles[temp_index] == temp_range) {
                            log_styles[temp_index] = old_range;
                            old_range = null;
                            log.setStyleRanges(log_styles);
                        }
                    }
                }
            }

            @Override
            public void mouseExit(MouseEvent e) {
            // TODO Auto-generated method stub
            }

            @Override
            public void mouseEnter(MouseEvent e) {
            // TODO Auto-generated method stub
            }
        });
        log.addKeyListener(new KeyAdapter() {

            @Override
            public void keyPressed(KeyEvent event) {
                int key = event.character;
                if (key <= 26 && key > 0) {
                    key += 'a' - 1;
                }
                if (key == 'a' && event.stateMask == SWT.MOD1) {
                    event.doit = false;
                    log.selectAll();
                }
            }
        });
        Composite rhs = new Composite(sash, SWT.NONE);
        layout = new GridLayout();
        layout.numColumns = 1;
        layout.marginHeight = 0;
        layout.marginWidth = 0;
        layout.marginTop = 4;
        layout.marginRight = 4;
        rhs.setLayout(layout);
        grid_data = new GridData(GridData.FILL_VERTICAL);
        int rhs_width = Constants.isWindows ? 150 : 160;
        grid_data.widthHint = rhs_width;
        Utils.setLayoutData(rhs, grid_data);
        // options
        Composite top_right = buildHelp(rhs);
        // nick name
        Composite nick_area = new Composite(top_right, SWT.NONE);
        layout = new GridLayout();
        layout.numColumns = 4;
        layout.marginHeight = 0;
        layout.marginWidth = 0;
        if (!Constants.isWindows) {
            layout.horizontalSpacing = 2;
            layout.verticalSpacing = 2;
        }
        nick_area.setLayout(layout);
        grid_data = new GridData(GridData.FILL_HORIZONTAL);
        grid_data.horizontalSpan = 3;
        Utils.setLayoutData(nick_area, grid_data);
        Label label = new Label(nick_area, SWT.NULL);
        label.setText(lu.getLocalisedMessageText("azbuddy.dchat.nick"));
        grid_data = new GridData();
        // grid_data.horizontalIndent=4;
        Utils.setLayoutData(label, grid_data);
        nickname = new Text(nick_area, SWT.BORDER);
        grid_data = new GridData(GridData.FILL_HORIZONTAL);
        grid_data.horizontalSpan = 1;
        Utils.setLayoutData(nickname, grid_data);
        nickname.setText(chat.getNickname(false));
        nickname.setMessage(chat.getDefaultNickname());
        label = new Label(nick_area, SWT.NULL);
        label.setText(lu.getLocalisedMessageText("label.shared"));
        label.setToolTipText(lu.getLocalisedMessageText("azbuddy.dchat.shared.tooltip"));
        shared_nick_button = new Button(nick_area, SWT.CHECK);
        shared_nick_button.setSelection(chat.isSharedNickname());
        shared_nick_button.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent arg0) {
                boolean shared = shared_nick_button.getSelection();
                chat.setSharedNickname(shared);
            }
        });
        nickname.addListener(SWT.FocusOut, new Listener() {

            @Override
            public void handleEvent(Event event) {
                String nick = nickname.getText().trim();
                if (chat.isSharedNickname()) {
                    if (chat.getNetwork() == AENetworkClassifier.AT_PUBLIC) {
                        beta.setSharedPublicNickname(nick);
                    } else {
                        beta.setSharedAnonNickname(nick);
                    }
                } else {
                    chat.setInstanceNickname(nick);
                }
            }
        });
        table_header_left = new BufferedLabel(top_right, SWT.DOUBLE_BUFFERED);
        grid_data = new GridData(GridData.FILL_HORIZONTAL);
        grid_data.horizontalSpan = 2;
        if (!Constants.isWindows) {
            grid_data.horizontalIndent = 2;
        }
        Utils.setLayoutData(table_header_left, grid_data);
        table_header_left.setText(MessageText.getString("PeersView.state.pending"));
        LinkLabel link = new LinkLabel(top_right, "Views.plugins.azbuddy.title", new Runnable() {

            @Override
            public void run() {
                if (!plugin.isClassicEnabled()) {
                    plugin.setClassicEnabled(true);
                }
                beta.selectClassicTab();
            }
        });
        // table
        buddy_table = new Table(rhs, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION | SWT.VIRTUAL);
        String[] headers = { "azbuddy.ui.table.name" };
        int[] sizes = { rhs_width - 10 };
        int[] aligns = { SWT.LEFT };
        for (int i = 0; i < headers.length; i++) {
            TableColumn tc = new TableColumn(buddy_table, aligns[i]);
            tc.setWidth(Utils.adjustPXForDPI(sizes[i]));
            Messages.setLanguageText(tc, headers[i]);
        }
        buddy_table.setHeaderVisible(true);
        grid_data = new GridData(GridData.FILL_BOTH);
        // grid_data.heightHint = buddy_table.getHeaderHeight() * 3;
        Utils.setLayoutData(buddy_table, grid_data);
        buddy_table.addListener(SWT.SetData, new Listener() {

            @Override
            public void handleEvent(Event event) {
                TableItem item = (TableItem) event.item;
                setItemData(item);
            }
        });
        final Menu menu = new Menu(buddy_table);
        buddy_table.setMenu(menu);
        menu.addMenuListener(new MenuListener() {

            @Override
            public void menuShown(MenuEvent e) {
                MenuItem[] items = menu.getItems();
                for (int i = 0; i < items.length; i++) {
                    items[i].dispose();
                }
                final TableItem[] selection = buddy_table.getSelection();
                List<ChatParticipant> participants = new ArrayList<>(selection.length);
                for (int i = 0; i < selection.length; i++) {
                    TableItem item = selection[i];
                    ChatParticipant participant = (ChatParticipant) item.getData();
                    if (participant == null) {
                        // item data won't be set yet for items that haven't been
                        // visible...
                        participant = setItemData(item);
                    }
                    if (participant != null) {
                        participants.add(participant);
                    }
                }
                buildParticipantMenu(menu, participants);
            }

            @Override
            public void menuHidden(MenuEvent e) {
            }
        });
        buddy_table.addKeyListener(new KeyAdapter() {

            @Override
            public void keyPressed(KeyEvent event) {
                int key = event.character;
                if (key <= 26 && key > 0) {
                    key += 'a' - 1;
                }
                if (key == 'a' && event.stateMask == SWT.MOD1) {
                    event.doit = false;
                    buddy_table.selectAll();
                }
            }
        });
        buddy_table.addMouseListener(new MouseAdapter() {

            @Override
            public void mouseDoubleClick(MouseEvent e) {
                TableItem[] selection = buddy_table.getSelection();
                if (selection.length != 1) {
                    return;
                }
                TableItem item = selection[0];
                ChatParticipant participant = (ChatParticipant) item.getData();
                addNickString(participant);
            }
        });
        Utils.maintainSashPanelWidth(sash, rhs, new int[] { 700, 300 }, "azbuddy.dchat.ui.sash.pos");
        /*
		    Listener sash_listener=
		    	new Listener()
		    	{
		    		private int	lhs_weight;
		    		private int	lhs_width;
	
			    	public void
					handleEvent(
						Event ev )
					{
			    		if ( ev.widget == lhs ){
	
			    			int[] weights = sash.getWeights();
	
	
			    			if ( lhs_weight != weights[0] ){
	
			    					// sash has moved
	
			    				lhs_weight = weights[0];
	
			    					// keep track of the width
	
			    				lhs_width = lhs.getBounds().width;
			    			}
			    		}else{
	
			    				// resize
	
			    			if ( lhs_width > 0 ){
	
					            int width = sash.getClientArea().width;
	
					            double ratio = (double)lhs_width/width;
	
					            lhs_weight = (int)(ratio*1000 );
	
					            sash.setWeights( new int[]{ lhs_weight, 1000 - lhs_weight });
			    			}
			    		}
				    }
			    };
	
		    lhs.addListener(SWT.Resize, sash_listener );
		    sash.addListener(SWT.Resize, sash_listener );
		    */
        // bottom area
        Composite bottom_area = new Composite(parent, SWT.NULL);
        layout = new GridLayout();
        layout.numColumns = 2;
        layout.marginHeight = 0;
        layout.marginWidth = 0;
        bottom_area.setLayout(layout);
        grid_data = new GridData(GridData.FILL_HORIZONTAL);
        grid_data.horizontalSpan = 2;
        bottom_area.setLayoutData(grid_data);
        // Text
        input_area = new Text(bottom_area, SWT.MULTI | SWT.V_SCROLL | SWT.WRAP | SWT.BORDER);
        grid_data = new GridData(GridData.FILL_HORIZONTAL);
        grid_data.horizontalSpan = 1;
        grid_data.heightHint = 30;
        grid_data.horizontalIndent = 4;
        Utils.setLayoutData(input_area, grid_data);
        // input_area.setIndent( 4 );
        input_area.setTextLimit(MAX_MSG_OVERALL_LENGTH);
        input_area.addVerifyListener(new VerifyListener() {

            @Override
            public void verifyText(VerifyEvent ev) {
                if (ev.text.equals("\t")) {
                    ev.doit = false;
                }
            }
        });
        input_area.addKeyListener(new KeyListener() {

            private LinkedList<String> history = new LinkedList<>();

            private int history_pos = -1;

            private String buffered_message = "";

            @Override
            public void keyPressed(KeyEvent e) {
                if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) {
                    e.doit = false;
                    if ((e.stateMask & SWT.ALT) != 0) {
                        input_area.insert("\n");
                        return;
                    }
                    String message = input_area.getText().trim();
                    if (message.length() > 0) {
                        sendMessage(message, true);
                        history.addFirst(message);
                        if (history.size() > 32) {
                            history.removeLast();
                        }
                        history_pos = -1;
                        buffered_message = "";
                        input_area.setText("");
                        text_cache.put(chat.getNetAndKey(), "");
                    }
                } else if (e.keyCode == SWT.ARROW_UP) {
                    history_pos++;
                    if (history_pos < history.size()) {
                        if (history_pos == 0) {
                            buffered_message = input_area.getText().trim();
                        }
                        String msg = history.get(history_pos);
                        input_area.setText(msg);
                        input_area.setSelection(msg.length());
                    } else {
                        history_pos = history.size() - 1;
                    }
                    e.doit = false;
                } else if (e.keyCode == SWT.ARROW_DOWN) {
                    history_pos--;
                    if (history_pos >= 0) {
                        String msg = history.get(history_pos);
                        input_area.setText(msg);
                        input_area.setSelection(msg.length());
                    } else {
                        if (history_pos == -1) {
                            input_area.setText(buffered_message);
                            if (buffered_message.length() > 0) {
                                input_area.setSelection(buffered_message.length());
                                buffered_message = "";
                            }
                        } else {
                            history_pos = -1;
                        }
                    }
                    e.doit = false;
                } else {
                    if (e.stateMask == SWT.MOD1) {
                        int key = e.character;
                        if (key <= 26 && key > 0) {
                            key += 'a' - 1;
                        }
                        if (key == 'a') {
                            input_area.selectAll();
                        } else if (key == 'b' || key == 'i') {
                            String emp = key == 'b' ? "**" : "*";
                            String sel = input_area.getSelectionText();
                            Point p = input_area.getSelection();
                            while (sel.endsWith(" ")) {
                                sel = sel.substring(0, sel.length() - 1);
                                p.y--;
                            }
                            if (!sel.isEmpty()) {
                                /*
										int[] range = input_area.getSelectionRanges();
										
										int emp_len = emp.length();
										
										if ( sel.startsWith( emp ) && sel.endsWith( emp ) && sel.length() >= emp_len * 2 ){
											
											input_area.replaceTextRange( range[0], range[1], sel.substring(emp_len, sel.length() - emp_len ));
											
											input_area.setSelection( range[0], range[0] + range[1] - emp_len*2 );
											
										}else{
											
											input_area.replaceTextRange( range[0], range[1], emp + sel + emp );
											
											input_area.setSelection( range[0], range[0] + range[1] + emp_len*2 );
										}
										*/
                                int emp_len = emp.length();
                                String text = input_area.getText();
                                if (sel.startsWith(emp) && sel.endsWith(emp) && sel.length() >= emp_len * 2) {
                                    input_area.setText(text.substring(0, p.x) + sel.substring(emp_len, sel.length() - emp_len) + text.substring(p.y));
                                    p.y -= emp_len * 2;
                                } else {
                                    input_area.setText(text.substring(0, p.x) + emp + sel + emp + text.substring(p.y));
                                    p.y += emp_len * 2;
                                }
                                input_area.setSelection(p);
                            }
                        }
                    }
                }
            }

            @Override
            public void keyReleased(KeyEvent e) {
            }
        });
        input_area.addDisposeListener(new DisposeListener() {

            @Override
            public void widgetDisposed(DisposeEvent arg0) {
                if (input_area != null) {
                    String text = input_area.getText();
                    text_cache.put(chat.getNetAndKey(), text);
                }
            }
        });
        String cached_text = text_cache.get(chat.getNetAndKey());
        if (cached_text != null && !cached_text.isEmpty()) {
            input_area.setText(cached_text);
            input_area.setSelection(cached_text.length());
        }
        Composite button_area = new Composite(bottom_area, SWT.NULL);
        layout = new GridLayout();
        layout.numColumns = 1;
        layout.marginHeight = 0;
        layout.marginWidth = 0;
        layout.marginRight = 4;
        button_area.setLayout(layout);
        buildRSSButton(button_area);
        hookFTUXListener();
        if (chat.isReadOnly()) {
            input_area.setText(MessageText.getString("azbuddy.dchat.ro"));
        }
        setInputAvailability(true);
        if (!chat.isReadOnly()) {
            drop_targets = new DropTarget[] { new DropTarget(log, DND.DROP_COPY), new DropTarget(input_area, DND.DROP_COPY) };
            for (DropTarget drop_target : drop_targets) {
                drop_target.setTransfer(new Transfer[] { FixedURLTransfer.getInstance(), FileTransfer.getInstance(), TextTransfer.getInstance() });
                drop_target.addDropListener(new DropTargetAdapter() {

                    @Override
                    public void dropAccept(DropTargetEvent event) {
                        event.currentDataType = FixedURLTransfer.pickBestType(event.dataTypes, event.currentDataType);
                    }

                    @Override
                    public void dragEnter(DropTargetEvent event) {
                    }

                    @Override
                    public void dragOperationChanged(DropTargetEvent event) {
                    }

                    @Override
                    public void dragOver(DropTargetEvent event) {
                        if ((event.operations & DND.DROP_LINK) > 0)
                            event.detail = DND.DROP_LINK;
                        else if ((event.operations & DND.DROP_COPY) > 0)
                            event.detail = DND.DROP_COPY;
                        else if ((event.operations & DND.DROP_DEFAULT) > 0)
                            event.detail = DND.DROP_COPY;
                        event.feedback = DND.FEEDBACK_SELECT | DND.FEEDBACK_SCROLL | DND.FEEDBACK_EXPAND;
                    }

                    @Override
                    public void dragLeave(DropTargetEvent event) {
                    }

                    @Override
                    public void drop(DropTargetEvent event) {
                        handleDrop(event.data, new DropAccepter() {

                            @Override
                            public void accept(String link) {
                                input_area.setText(input_area.getText() + link);
                            }
                        });
                    }
                });
            }
        }
        Control[] focus_controls = { log, input_area, buddy_table, nickname, shared_nick_button };
        Listener focus_listener = new Listener() {

            @Override
            public void handleEvent(Event event) {
                activate();
            }
        };
        for (Control c : focus_controls) {
            c.addListener(SWT.FocusIn, focus_listener);
        }
        BuddyPluginBeta.ChatParticipant[] existing_participants = chat.getParticipants();
        synchronized (participants) {
            participants.addAll(Arrays.asList(existing_participants));
        }
        table_resort_required = true;
        updateTable(false);
        BuddyPluginBeta.ChatMessage[] history = chat.getHistory();
        logChatMessages(history);
        boolean can_popout = shell == null && public_chat;
        if (can_popout && !ftux_ok && !auto_ftux_popout_done) {
            auto_ftux_popout_done = true;
            try {
                createChatWindow(view, plugin, chat.getClone(), true);
            } catch (Throwable e) {
            }
        }
    } else {
        GridLayout layout = new GridLayout();
        layout.numColumns = 2;
        layout.marginHeight = 0;
        layout.marginWidth = 0;
        parent.setLayout(layout);
        GridData grid_data = new GridData(GridData.FILL_BOTH);
        Utils.setLayoutData(parent, grid_data);
        Composite status_area = new Composite(parent, SWT.NULL);
        grid_data = new GridData(GridData.FILL_HORIZONTAL);
        status_area.setLayoutData(grid_data);
        layout = new GridLayout();
        layout.numColumns = 3;
        layout.marginHeight = 0;
        layout.marginWidth = 0;
        layout.marginTop = 4;
        layout.marginLeft = 4;
        status_area.setLayout(layout);
        buildStatus(parent, status_area);
        buildHelp(status_area);
        Composite ftux_parent = new Composite(parent, SWT.NULL);
        layout = new GridLayout();
        layout.numColumns = 2;
        layout.marginHeight = 0;
        layout.marginWidth = 0;
        ftux_parent.setLayout(layout);
        grid_data = new GridData(GridData.FILL_BOTH);
        grid_data.horizontalSpan = 2;
        ftux_parent.setLayoutData(grid_data);
        Composite share_area_holder = buildFTUX(ftux_parent, SWT.NULL);
        layout = new GridLayout();
        layout.numColumns = 1;
        layout.marginHeight = 0;
        layout.marginWidth = 0;
        share_area_holder.setLayout(layout);
        Canvas share_area = new Canvas(share_area_holder, SWT.NO_BACKGROUND);
        grid_data = new GridData(GridData.FILL_BOTH);
        share_area.setLayoutData(grid_data);
        share_area.setBackground(Colors.white);
        share_area.addPaintListener(new PaintListener() {

            @Override
            public void paintControl(PaintEvent e) {
                GC gc = e.gc;
                gc.setAdvanced(true);
                gc.setAntialias(SWT.ON);
                Rectangle bounds = share_area.getBounds();
                int width = bounds.width;
                int height = bounds.height;
                gc.setBackground(Colors.white);
                gc.fillRectangle(0, 0, width, height);
                Rectangle text_area = new Rectangle(50, 50, width - 100, height - 100);
                gc.setLineWidth(8);
                gc.setLineStyle(SWT.LINE_DOT);
                gc.setForeground(Colors.light_grey);
                gc.drawRoundRectangle(40, 40, width - 80, height - 80, 25, 25);
                gc.setForeground(Colors.dark_grey);
                gc.setFont(big_font);
                String msg = MessageText.getString("dchat.share.dnd.info", new String[] { MessageText.getString(chat.getNetwork() == AENetworkClassifier.AT_PUBLIC ? "label.publicly" : "label.anonymously"), chat.getName() });
                GCStringPrinter p = new GCStringPrinter(gc, msg, text_area, 0, SWT.CENTER | SWT.WRAP);
                p.printString();
            }
        });
        input_area = new Text(share_area, SWT.MULTI | SWT.V_SCROLL | SWT.WRAP | SWT.BORDER);
        input_area.setVisible(false);
        hookFTUXListener();
        drop_targets = new DropTarget[] { new DropTarget(share_area, DND.DROP_COPY) };
        for (DropTarget drop_target : drop_targets) {
            drop_target.setTransfer(new Transfer[] { FixedURLTransfer.getInstance(), FileTransfer.getInstance(), TextTransfer.getInstance() });
            drop_target.addDropListener(new DropTargetAdapter() {

                @Override
                public void dropAccept(DropTargetEvent event) {
                    event.currentDataType = FixedURLTransfer.pickBestType(event.dataTypes, event.currentDataType);
                }

                @Override
                public void dragEnter(DropTargetEvent event) {
                }

                @Override
                public void dragOperationChanged(DropTargetEvent event) {
                }

                @Override
                public void dragOver(DropTargetEvent event) {
                    if ((event.operations & DND.DROP_LINK) > 0)
                        event.detail = DND.DROP_LINK;
                    else if ((event.operations & DND.DROP_COPY) > 0)
                        event.detail = DND.DROP_COPY;
                    else if ((event.operations & DND.DROP_DEFAULT) > 0)
                        event.detail = DND.DROP_COPY;
                    event.feedback = DND.FEEDBACK_SELECT | DND.FEEDBACK_SCROLL | DND.FEEDBACK_EXPAND;
                }

                @Override
                public void dragLeave(DropTargetEvent event) {
                }

                @Override
                public void drop(DropTargetEvent event) {
                    if (!chat_available) {
                        MessageBoxShell mb = new MessageBoxShell(MessageText.getString("dchat.share.dnd.wait.title"), MessageText.getString("dchat.share.dnd.wait.text"));
                        mb.setButtons(0, new String[] { MessageText.getString("Button.ok") }, new Integer[] { 0 });
                        mb.open(null);
                        return;
                    }
                    MessageBoxShell mb = new MessageBoxShell(MessageText.getString("dchat.share.dnd.prompt.title"), MessageText.getString("dchat.share.dnd.prompt.text", new String[] { MessageText.getString(chat.getNetwork() == AENetworkClassifier.AT_PUBLIC ? "label.publicly" : "label.anonymously"), chat.getName() }));
                    mb.setRemember("chat.dnd." + chat.getKey(), false, MessageText.getString("MessageBoxWindow.nomoreprompting"));
                    mb.setButtons(0, new String[] { MessageText.getString("Button.yes"), MessageText.getString("Button.no") }, new Integer[] { 0, 1 });
                    mb.setRememberOnlyIfButton(0);
                    mb.open(new UserPrompterResultListener() {

                        @Override
                        public void prompterClosed(int result) {
                            if (result == 0) {
                                handleDrop(event.data, new DropAccepter() {

                                    @Override
                                    public void accept(String link) {
                                        link = link.trim();
                                        sendMessage(link, false);
                                        String rendered = renderMessage(link);
                                        MessageBoxShell mb = new MessageBoxShell(MessageText.getString("dchat.share.dnd.shared.title"), MessageText.getString("dchat.share.dnd.shared.text", new String[] { rendered }));
                                        mb.setButtons(0, new String[] { MessageText.getString("Button.ok") }, new Integer[] { 0 });
                                        mb.open(null);
                                        checkSubscriptions(false);
                                    }
                                });
                            }
                        }
                    });
                }
            });
        }
    }
}
Also used : GCStringPrinter(com.biglybt.ui.swt.shells.GCStringPrinter) MouseTrackListener(org.eclipse.swt.events.MouseTrackListener) KeyAdapter(org.eclipse.swt.events.KeyAdapter) TableItem(org.eclipse.swt.widgets.TableItem) BufferedLabel(com.biglybt.ui.swt.components.BufferedLabel) Label(org.eclipse.swt.widgets.Label) LinkLabel(com.biglybt.ui.swt.components.LinkLabel) Rectangle(org.eclipse.swt.graphics.Rectangle) DisposeEvent(org.eclipse.swt.events.DisposeEvent) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) StyledText(org.eclipse.swt.custom.StyledText) VerifyListener(org.eclipse.swt.events.VerifyListener) PaintListener(org.eclipse.swt.events.PaintListener) Canvas(org.eclipse.swt.widgets.Canvas) DropTargetEvent(org.eclipse.swt.dnd.DropTargetEvent) TableColumn(org.eclipse.swt.widgets.TableColumn) DropTargetAdapter(org.eclipse.swt.dnd.DropTargetAdapter) MenuDetectEvent(org.eclipse.swt.events.MenuDetectEvent) DropTarget(org.eclipse.swt.dnd.DropTarget) DisposeListener(org.eclipse.swt.events.DisposeListener) UserPrompterResultListener(com.biglybt.ui.UserPrompterResultListener) PaintListener(org.eclipse.swt.events.PaintListener) ControlListener(org.eclipse.swt.events.ControlListener) Listener(org.eclipse.swt.widgets.Listener) UIInputReceiverListener(com.biglybt.pif.ui.UIInputReceiverListener) DisposeListener(org.eclipse.swt.events.DisposeListener) VerifyListener(org.eclipse.swt.events.VerifyListener) MouseTrackListener(org.eclipse.swt.events.MouseTrackListener) MenuListener(org.eclipse.swt.events.MenuListener) MenuDetectListener(org.eclipse.swt.events.MenuDetectListener) KeyListener(org.eclipse.swt.events.KeyListener) BufferedLabel(com.biglybt.ui.swt.components.BufferedLabel) MenuListener(org.eclipse.swt.events.MenuListener) StyleRange(org.eclipse.swt.custom.StyleRange) URL(java.net.URL) KeyEvent(org.eclipse.swt.events.KeyEvent) GridLayout(org.eclipse.swt.layout.GridLayout) Control(org.eclipse.swt.widgets.Control) Menu(org.eclipse.swt.widgets.Menu) GC(org.eclipse.swt.graphics.GC) VerifyEvent(org.eclipse.swt.events.VerifyEvent) MenuEvent(org.eclipse.swt.events.MenuEvent) MouseEvent(org.eclipse.swt.events.MouseEvent) Table(org.eclipse.swt.widgets.Table) PaintEvent(org.eclipse.swt.events.PaintEvent) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) MouseAdapter(org.eclipse.swt.events.MouseAdapter) MessageBoxShell(com.biglybt.ui.swt.shells.MessageBoxShell) MenuItem(org.eclipse.swt.widgets.MenuItem) StyledText(org.eclipse.swt.custom.StyledText) Text(org.eclipse.swt.widgets.Text) MessageText(com.biglybt.core.internat.MessageText) Point(org.eclipse.swt.graphics.Point) Point(org.eclipse.swt.graphics.Point) SashForm(org.eclipse.swt.custom.SashForm) UserPrompterResultListener(com.biglybt.ui.UserPrompterResultListener) LinkLabel(com.biglybt.ui.swt.components.LinkLabel) AERunnable(com.biglybt.core.util.AERunnable) GridData(org.eclipse.swt.layout.GridData) MenuDetectListener(org.eclipse.swt.events.MenuDetectListener) DropTargetEvent(org.eclipse.swt.dnd.DropTargetEvent) MenuEvent(org.eclipse.swt.events.MenuEvent) KeyEvent(org.eclipse.swt.events.KeyEvent) MouseEvent(org.eclipse.swt.events.MouseEvent) MenuDetectEvent(org.eclipse.swt.events.MenuDetectEvent) ControlEvent(org.eclipse.swt.events.ControlEvent) DisposeEvent(org.eclipse.swt.events.DisposeEvent) PaintEvent(org.eclipse.swt.events.PaintEvent) UIManagerEvent(com.biglybt.pif.ui.UIManagerEvent) Event(org.eclipse.swt.widgets.Event) VerifyEvent(org.eclipse.swt.events.VerifyEvent) SelectionEvent(org.eclipse.swt.events.SelectionEvent) KeyListener(org.eclipse.swt.events.KeyListener)

Aggregations

MessageBoxShell (com.biglybt.ui.swt.shells.MessageBoxShell)53 UserPrompterResultListener (com.biglybt.ui.UserPrompterResultListener)24 File (java.io.File)10 ArrayList (java.util.ArrayList)7 GridData (org.eclipse.swt.layout.GridData)7 DownloadManager (com.biglybt.core.download.DownloadManager)6 UIInputReceiverListener (com.biglybt.pif.ui.UIInputReceiverListener)6 GridLayout (org.eclipse.swt.layout.GridLayout)6 Map (java.util.Map)5 TOTorrent (com.biglybt.core.torrent.TOTorrent)4 TOTorrentFile (com.biglybt.core.torrent.TOTorrentFile)4 AERunnable (com.biglybt.core.util.AERunnable)4 UIInputReceiver (com.biglybt.pif.ui.UIInputReceiver)4 UIFunctionsSWT (com.biglybt.ui.swt.UIFunctionsSWT)4 URL (java.net.URL)4 HashMap (java.util.HashMap)4 List (java.util.List)4 MouseAdapter (org.eclipse.swt.events.MouseAdapter)4 MouseEvent (org.eclipse.swt.events.MouseEvent)4 Point (org.eclipse.swt.graphics.Point)4