Search in sources :

Example 1 with COConfigurationListener

use of com.biglybt.core.config.COConfigurationListener in project BiglyBT by BiglySoftware.

the class FileUtil method convertOSSpecificChars.

public static String convertOSSpecificChars(String file_name_in, boolean is_folder) {
    char[] mapping;
    synchronized (FileUtil.class) {
        if (char_conversion_mapping == null) {
            COConfigurationManager.addAndFireListener(new COConfigurationListener() {

                @Override
                public void configurationSaved() {
                    synchronized (FileUtil.class) {
                        String map = COConfigurationManager.getStringParameter("File.Character.Conversions");
                        String[] bits = map.split(",");
                        List<Character> chars = new ArrayList<>();
                        for (String bit : bits) {
                            bit = bit.trim();
                            if (bit.length() == 3) {
                                char from = bit.charAt(0);
                                char to = bit.charAt(2);
                                chars.add(from);
                                chars.add(to);
                            }
                        }
                        char[] new_map = new char[chars.size()];
                        for (int i = 0; i < new_map.length; i++) {
                            new_map[i] = chars.get(i);
                        }
                        char_conversion_mapping = new_map;
                    }
                }
            });
        }
        mapping = char_conversion_mapping;
    }
    // this rule originally from DiskManager
    char[] chars = file_name_in.toCharArray();
    if (mapping.length == 2) {
        // default case
        char from = mapping[0];
        char to = mapping[1];
        for (int i = 0; i < chars.length; i++) {
            if (chars[i] == from) {
                chars[i] = to;
            }
        }
    } else if (mapping.length > 0) {
        for (int i = 0; i < chars.length; i++) {
            char c = chars[i];
            for (int j = 0; j < mapping.length; j += 2) {
                if (c == mapping[j]) {
                    chars[i] = mapping[j + 1];
                }
            }
        }
    }
    if (!Constants.isOSX) {
        if (Constants.isWindows) {
            // this rule originally from DiskManager
            // The definitive list of characters permitted for Windows is defined here:
            // http://support.microsoft.com/kb/q120138/
            String not_allowed = "\\/:?*<>|";
            for (int i = 0; i < chars.length; i++) {
                if (not_allowed.indexOf(chars[i]) != -1) {
                    chars[i] = '_';
                }
            }
            if (is_folder) {
                for (int i = chars.length - 1; i >= 0 && (chars[i] == '.' || chars[i] == ' '); chars[i] = '_', i--) ;
            }
        }
        for (int i = 0; i < chars.length; i++) {
            char c = chars[i];
            if (c == '/' || c == '\r' || c == '\n') {
                chars[i] = ' ';
            }
        }
    }
    String file_name_out = new String(chars);
    try {
        if (Constants.isWindows) {
            while (file_name_out.endsWith(" ")) {
                file_name_out = file_name_out.substring(0, file_name_out.length() - 1);
            }
        } else {
            String str = new File(file_name_out).getCanonicalFile().toString();
            int p = str.lastIndexOf(File.separator);
            file_name_out = str.substring(p + 1);
        }
    } catch (Throwable e) {
    // ho hum, carry on, it'll fail later
    // e.printStackTrace();
    }
    return (file_name_out);
}
Also used : COConfigurationListener(com.biglybt.core.config.COConfigurationListener)

Example 2 with COConfigurationListener

use of com.biglybt.core.config.COConfigurationListener in project BiglyBT by BiglySoftware.

the class FileLogging method initialize.

public void initialize() {
    // Shorten from COConfigurationManager To make code more readable
    final ConfigurationManager config = ConfigurationManager.getInstance();
    boolean overrideLog = System.getProperty(SystemProperties.SYSPROP_OVERRIDELOG) != null;
    for (int i = 0; i < ignoredComponents.length; i++) {
        ignoredComponents[i] = new ArrayList();
    }
    if (!overrideLog) {
        config.addListener(new COConfigurationListener() {

            @Override
            public void configurationSaved() {
                checkLoggingConfig();
            }
        });
    }
    checkLoggingConfig();
    config.addParameterListener(CFG_ENABLELOGTOFILE, new ParameterListener() {

        @Override
        public void parameterChanged(String parameterName) {
            FileLogging.this.reloadLogToFileParam();
        }
    });
}
Also used : COConfigurationListener(com.biglybt.core.config.COConfigurationListener) ArrayList(java.util.ArrayList) ParameterListener(com.biglybt.core.config.ParameterListener) ConfigurationManager(com.biglybt.core.config.impl.ConfigurationManager)

Example 3 with COConfigurationListener

use of com.biglybt.core.config.COConfigurationListener in project BiglyBT by BiglySoftware.

the class ConfigurationManager method save.

public void save(String filename) {
    if (propertiesMap == null) {
        return;
    }
    /**
     * Note - propertiesMap isn't synchronised! We'll clone the map
     * now, because we need to modify it. The BEncoding code will
     * create a new map object (TreeMap) because it needs to be
     * sorted, so we might as well do it here too.
     */
    TreeMap<String, Object> properties_clone = propertiesMap.toTreeMap();
    // Remove any transient parameters.
    if (!this.transient_properties.isEmpty()) {
        properties_clone.keySet().removeAll(this.transient_properties);
    }
    FileUtil.writeResilientConfigFile(filename, properties_clone);
    List<COConfigurationListener> listeners_copy;
    synchronized (listenerz) {
        listeners_copy = new ArrayList<>(listenerz);
    }
    for (int i = 0; i < listeners_copy.size(); i++) {
        COConfigurationListener l = (COConfigurationListener) listeners_copy.get(i);
        if (l != null) {
            try {
                l.configurationSaved();
            } catch (Throwable e) {
                Debug.printStackTrace(e);
            }
        } else {
            Debug.out("COConfigurationListener is null");
        }
    }
    if (exported_parameters_dirty) {
        exportParameters();
    }
}
Also used : COConfigurationListener(com.biglybt.core.config.COConfigurationListener)

Example 4 with COConfigurationListener

use of com.biglybt.core.config.COConfigurationListener in project BiglyBT by BiglySoftware.

the class ConfigSectionIPFilter method configSectionCreate.

@Override
public Composite configSectionCreate(final Composite parent) {
    if (!CoreFactory.isCoreRunning()) {
        Composite cSection = new Composite(parent, SWT.NULL);
        cSection.setLayout(new FillLayout());
        Label lblNotAvail = new Label(cSection, SWT.WRAP);
        Messages.setLanguageText(lblNotAvail, "core.not.available");
        return cSection;
    }
    ImageLoader imageLoader = ImageLoader.getInstance();
    Image imgOpenFolder = imageLoader.getImage("openFolderButton");
    String sCurConfigID;
    GridData gridData;
    int userMode = COConfigurationManager.getIntParameter("User Mode");
    final IpFilterManager ipFilterManager = CoreFactory.getSingleton().getIpFilterManager();
    filter = ipFilterManager.getIPFilter();
    Composite gFilter = new Composite(parent, SWT.NULL);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    gFilter.setLayout(layout);
    gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL);
    Utils.setLayoutData(gFilter, gridData);
    // start controls
    // row: enable filter + allow/deny
    gridData = new GridData();
    BooleanParameter enabled = new BooleanParameter(gFilter, "Ip Filter Enabled");
    enabled.setLayoutData(gridData);
    Messages.setLanguageText(enabled.getControl(), "ConfigView.section.ipfilter.enable");
    gridData = new GridData();
    BooleanParameter deny = new BooleanParameter(gFilter, "Ip Filter Allow");
    deny.setLayoutData(gridData);
    Messages.setLanguageText(deny.getControl(), "ConfigView.section.ipfilter.allow");
    deny.addChangeListener(new ParameterChangeAdapter() {

        @Override
        public void parameterChanged(Parameter p, boolean caused_internally) {
            setPercentageBlocked();
        }
    });
    // row persist banning
    gridData = new GridData();
    BooleanParameter persist_bad_data_banning = new BooleanParameter(gFilter, "Ip Filter Banning Persistent");
    persist_bad_data_banning.setLayoutData(gridData);
    Messages.setLanguageText(persist_bad_data_banning.getControl(), "ConfigView.section.ipfilter.persistblocking");
    BooleanParameter disableForUpdates = new BooleanParameter(gFilter, "Ip Filter Disable For Updates");
    Messages.setLanguageText(disableForUpdates.getControl(), "ConfigView.section.ipfilter.disable.for.updates");
    Group gBlockBanning = new Group(gFilter, SWT.NULL);
    Messages.setLanguageText(gBlockBanning, "ConfigView.section.ipfilter.peerblocking.group");
    layout = new GridLayout();
    layout.numColumns = 2;
    gBlockBanning.setLayout(layout);
    // row block bad + group ban
    BooleanParameter enable_bad_data_banning = new BooleanParameter(gBlockBanning, "Ip Filter Enable Banning", "ConfigView.section.ipfilter.enablebanning");
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    enable_bad_data_banning.setLayoutData(gridData);
    Label discard_label = new Label(gBlockBanning, SWT.NULL);
    Messages.setLanguageText(discard_label, "ConfigView.section.ipfilter.discardbanning");
    FloatParameter discard_ratio = new FloatParameter(gBlockBanning, "Ip Filter Ban Discard Ratio");
    gridData = new GridData();
    discard_ratio.setLayoutData(gridData);
    Composite cIndent = new Composite(gBlockBanning, SWT.NONE);
    gridData = new GridData(GridData.FILL_BOTH);
    gridData.horizontalSpan = 2;
    gridData.horizontalIndent = 15;
    Utils.setLayoutData(cIndent, gridData);
    layout = new GridLayout(3, false);
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    cIndent.setLayout(layout);
    Image img = imageLoader.getImage("subitem");
    Label label = new Label(cIndent, SWT.NULL);
    gridData = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
    Utils.setLayoutData(label, gridData);
    label.setImage(img);
    Label discard_min_label = new Label(cIndent, SWT.NULL);
    Messages.setLanguageText(discard_min_label, "ConfigView.section.ipfilter.discardminkb", new String[] { DisplayFormatters.getUnit(DisplayFormatters.UNIT_KB) });
    IntParameter discard_min = new IntParameter(cIndent, "Ip Filter Ban Discard Min KB");
    gridData = new GridData();
    discard_min.setLayoutData(gridData);
    // block banning
    Label block_label = new Label(gBlockBanning, SWT.NULL);
    Messages.setLanguageText(block_label, "ConfigView.section.ipfilter.blockbanning");
    IntParameter block_banning = new IntParameter(gBlockBanning, "Ip Filter Ban Block Limit", 0, 256);
    gridData = new GridData();
    block_banning.setLayoutData(gridData);
    // triggers
    enable_bad_data_banning.setAdditionalActionPerformer(new ChangeSelectionActionPerformer(new Control[] { block_banning.getControl(), block_label, discard_ratio.getControl(), discard_label, discard_min.getControl(), discard_min_label }));
    Group gAutoLoad = new Group(gFilter, SWT.NONE);
    Messages.setLanguageText(gAutoLoad, "ConfigView.section.ipfilter.autoload.group");
    FormLayout flayout = new FormLayout();
    flayout.marginHeight = flayout.marginWidth = 5;
    gAutoLoad.setLayout(flayout);
    gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    gridData.widthHint = 500;
    Utils.setLayoutData(gAutoLoad, gridData);
    FormData fd;
    // Load from file
    sCurConfigID = "Ip Filter Autoload File";
    // allConfigIDs.add(sCurConfigID);
    Label lblDefaultDir = new Label(gAutoLoad, SWT.NONE);
    Messages.setLanguageText(lblDefaultDir, "ConfigView.section.ipfilter.autoload.file");
    fd = new FormData();
    Utils.setLayoutData(lblDefaultDir, fd);
    final StringParameter pathParameter = new StringParameter(gAutoLoad, sCurConfigID);
    Button browse = new Button(gAutoLoad, SWT.PUSH);
    browse.setImage(imgOpenFolder);
    imgOpenFolder.setBackground(browse.getBackground());
    browse.addListener(SWT.Selection, new Listener() {

        @Override
        public void handleEvent(Event event) {
            FileDialog dialog = new FileDialog(parent.getShell(), SWT.APPLICATION_MODAL);
            dialog.setFilterPath(pathParameter.getValue());
            dialog.setText(MessageText.getString("ConfigView.section.ipfilter.autoload.file"));
            dialog.setFilterExtensions(new String[] { "*.dat" + File.pathSeparator + "*.p2p" + File.pathSeparator + "*.p2b" + File.pathSeparator + "*.txt", "*.*" });
            dialog.setFileName("ipfilter.dat");
            String file = dialog.open();
            if (file != null) {
                pathParameter.setValue(file);
            }
        }
    });
    final Button btnLoadNow = new Button(gAutoLoad, SWT.PUSH);
    Messages.setLanguageText(btnLoadNow, "ConfigView.section.ipfilter.autoload.loadnow");
    btnLoadNow.addListener(SWT.Selection, new Listener() {

        @Override
        public void handleEvent(Event event) {
            btnLoadNow.setEnabled(false);
            COConfigurationManager.setParameter(IpFilterAutoLoaderImpl.CFG_AUTOLOAD_LAST, 0);
            Utils.getOffOfSWTThread(new AERunnable() {

                @Override
                public void runSupport() {
                    try {
                        filter.reloadSync();
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                    Utils.execSWTThread(new AERunnable() {

                        @Override
                        public void runSupport() {
                            if (!btnLoadNow.isDisposed()) {
                                btnLoadNow.setEnabled(true);
                            }
                        }
                    });
                }
            });
        }
    });
    fd = new FormData();
    fd.right = new FormAttachment(100, 0);
    Utils.setLayoutData(btnLoadNow, fd);
    fd = new FormData();
    fd.right = new FormAttachment(btnLoadNow, -5);
    Utils.setLayoutData(browse, fd);
    fd = new FormData();
    fd.left = new FormAttachment(lblDefaultDir, 5);
    fd.right = new FormAttachment(browse, -5);
    pathParameter.setLayoutData(fd);
    // reload period
    Label l_reload_period = new Label(gAutoLoad, SWT.NULL);
    Messages.setLanguageText(l_reload_period, "ConfigView.section.ipfilter.autoload.period");
    int initial_reload_period = COConfigurationManager.getIntParameter(IpFilterAutoLoaderImpl.CFG_AUTOLOAD_DAYS);
    IntParameter reload_period = new IntParameter(gAutoLoad, IpFilterAutoLoaderImpl.CFG_AUTOLOAD_DAYS, 1, 31);
    reload_period.addChangeListener(new ParameterChangeAdapter() {

        private boolean added_listener = false;

        @Override
        public void parameterChanged(Parameter p, boolean caused_internally) {
            if (!added_listener) {
                added_listener = true;
                COConfigurationManager.addListener(new COConfigurationListener() {

                    @Override
                    public void configurationSaved() {
                        COConfigurationManager.removeListener(this);
                        added_listener = false;
                        int period = reload_period.getValue();
                        if (period != initial_reload_period) {
                            Utils.getOffOfSWTThread(new AERunnable() {

                                @Override
                                public void runSupport() {
                                    try {
                                        ipFilterManager.getIPFilter().reload();
                                    } catch (Throwable e) {
                                        Debug.out(e);
                                    }
                                }
                            });
                        }
                    }
                });
            }
        }
    });
    fd = new FormData();
    fd.top = new FormAttachment(btnLoadNow, 3);
    fd.left = new FormAttachment(0, 20);
    Utils.setLayoutData(l_reload_period, fd);
    fd = new FormData();
    fd.top = new FormAttachment(btnLoadNow, 3);
    fd.left = new FormAttachment(l_reload_period, 5);
    Utils.setLayoutData(reload_period.getControl(), fd);
    // reload info
    Label lblAutoLoadInfo = new Label(gAutoLoad, SWT.WRAP);
    Messages.setLanguageText(lblAutoLoadInfo, "ConfigView.section.ipfilter.autoload.info");
    fd = new FormData();
    fd.top = new FormAttachment(reload_period.getControl(), 3);
    fd.left = new FormAttachment(0, 0);
    fd.right = new FormAttachment(100, 0);
    Utils.setLayoutData(lblAutoLoadInfo, fd);
    BooleanParameter clear_on_reload = new BooleanParameter(gAutoLoad, "Ip Filter Clear On Reload");
    fd = new FormData();
    fd.top = new FormAttachment(lblAutoLoadInfo, 3);
    fd.left = new FormAttachment(0, 0);
    fd.right = new FormAttachment(100, 0);
    clear_on_reload.setLayoutData(fd);
    Messages.setLanguageText(clear_on_reload.getControl(), "ConfigView.section.ipfilter.clear.on.reload");
    if (userMode > 0) {
        gridData = new GridData();
        BooleanParameter enableDesc = new BooleanParameter(gFilter, "Ip Filter Enable Description Cache");
        enableDesc.setLayoutData(gridData);
        Messages.setLanguageText(enableDesc.getControl(), "ConfigView.section.ipfilter.enable.descriptionCache");
    }
    // table
    table = new Table(gFilter, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION | SWT.VIRTUAL);
    String[] headers = { "label.description", "ConfigView.section.ipfilter.start", "ConfigView.section.ipfilter.end" };
    int[] sizes = { 110, 110, 110 };
    int[] aligns = { SWT.LEFT, SWT.CENTER, SWT.CENTER };
    for (int i = 0; i < headers.length; i++) {
        TableColumn tc = new TableColumn(table, aligns[i]);
        tc.setText(headers[i]);
        tc.setWidth(Utils.adjustPXForDPI(sizes[i]));
        // $NON-NLS-1$
        Messages.setLanguageText(tc, headers[i]);
    }
    TableColumn[] columns = table.getColumns();
    columns[0].setData(new Integer(FilterComparator.FIELD_NAME));
    columns[1].setData(new Integer(FilterComparator.FIELD_START_IP));
    columns[2].setData(new Integer(FilterComparator.FIELD_END_IP));
    Listener listener = new Listener() {

        @Override
        public void handleEvent(Event e) {
            TableColumn tc = (TableColumn) e.widget;
            int field = ((Integer) tc.getData()).intValue();
            comparator.setField(field);
            if (field == FilterComparator.FIELD_NAME && !bIsCachingDescriptions) {
                ipFilterManager.cacheAllDescriptions();
                bIsCachingDescriptions = true;
            }
            ipRanges = getSortedRanges(filter.getRanges());
            table.setItemCount(ipRanges.length);
            table.clearAll();
            // bug 69398 on Windows
            table.redraw();
        }
    };
    columns[0].addListener(SWT.Selection, listener);
    columns[1].addListener(SWT.Selection, listener);
    columns[2].addListener(SWT.Selection, listener);
    table.setHeaderVisible(true);
    gridData = new GridData(GridData.FILL_BOTH);
    gridData.heightHint = table.getHeaderHeight() * 3;
    gridData.widthHint = 200;
    Utils.setLayoutData(table, gridData);
    Composite cArea = new Composite(gFilter, SWT.NULL);
    layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.numColumns = 4;
    cArea.setLayout(layout);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    Utils.setLayoutData(cArea, gridData);
    Button add = new Button(cArea, SWT.PUSH);
    gridData = new GridData(GridData.CENTER);
    gridData.widthHint = 100;
    Utils.setLayoutData(add, gridData);
    Messages.setLanguageText(add, "Button.add");
    add.addListener(SWT.Selection, new Listener() {

        @Override
        public void handleEvent(Event arg0) {
            addRange();
        }
    });
    Button remove = new Button(cArea, SWT.PUSH);
    gridData = new GridData(GridData.CENTER);
    gridData.widthHint = 100;
    Utils.setLayoutData(remove, gridData);
    Messages.setLanguageText(remove, "ConfigView.section.ipfilter.remove");
    remove.addListener(SWT.Selection, new Listener() {

        @Override
        public void handleEvent(Event arg0) {
            TableItem[] selection = table.getSelection();
            if (selection.length == 0)
                return;
            removeRange((IpRange) selection[0].getData());
            ipRanges = getSortedRanges(filter.getRanges());
            table.setItemCount(ipRanges.length);
            table.clearAll();
            table.redraw();
        }
    });
    Button edit = new Button(cArea, SWT.PUSH);
    gridData = new GridData(GridData.CENTER);
    gridData.widthHint = 100;
    Utils.setLayoutData(edit, gridData);
    Messages.setLanguageText(edit, "Button.edit");
    edit.addListener(SWT.Selection, new Listener() {

        @Override
        public void handleEvent(Event arg0) {
            TableItem[] selection = table.getSelection();
            if (selection.length == 0)
                return;
            editRange((IpRange) selection[0].getData());
        }
    });
    percentage_blocked = new Label(cArea, SWT.WRAP | SWT.RIGHT);
    gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.FILL_HORIZONTAL);
    Utils.setLayoutData(percentage_blocked, gridData);
    Utils.setLayoutData(percentage_blocked, Utils.getWrappableLabelGridData(1, GridData.HORIZONTAL_ALIGN_FILL));
    setPercentageBlocked();
    table.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseDoubleClick(MouseEvent arg0) {
            TableItem[] selection = table.getSelection();
            if (selection.length == 0)
                return;
            editRange((IpRange) selection[0].getData());
        }
    });
    Control[] controls = new Control[3];
    controls[0] = add;
    controls[1] = remove;
    controls[2] = edit;
    IAdditionalActionPerformer enabler = new ChangeSelectionActionPerformer(controls);
    enabled.setAdditionalActionPerformer(enabler);
    ipRanges = getSortedRanges(filter.getRanges());
    table.addListener(SWT.SetData, new Listener() {

        @Override
        public void handleEvent(Event event) {
            TableItem item = (TableItem) event.item;
            int index = table.indexOf(item);
            if (index < 0 || index >= ipRanges.length) {
                return;
            }
            IpRange range = ipRanges[index];
            item.setText(0, range.getDescription());
            item.setText(1, range.getStartIp());
            item.setText(2, range.getEndIp());
            item.setData(range);
        }
    });
    table.setItemCount(ipRanges.length);
    table.clearAll();
    // bug 69398 on Windows
    table.redraw();
    table.addListener(SWT.Resize, new Listener() {

        @Override
        public void handleEvent(Event e) {
            resizeTable();
        }
    });
    gFilter.addListener(SWT.Resize, new Listener() {

        @Override
        public void handleEvent(Event e) {
            resizeTable();
        }
    });
    filterListener = new IPFilterListener() {

        @Override
        public void IPFilterEnabledChanged(boolean is_enabled) {
        }

        @Override
        public boolean canIPBeBanned(String ip) {
            return true;
        }

        @Override
        public void IPBanned(BannedIp ip) {
        }

        @Override
        public void IPBlockedListChanged(final IpFilter filter) {
            Utils.execSWTThread(new AERunnable() {

                @Override
                public void runSupport() {
                    if (table.isDisposed()) {
                        filter.removeListener(filterListener);
                        return;
                    }
                    ipRanges = getSortedRanges(filter.getRanges());
                    table.setItemCount(ipRanges.length);
                    table.clearAll();
                    table.redraw();
                }
            });
        }

        @Override
        public boolean canIPBeBlocked(String ip, byte[] torrent_hash) {
            return true;
        }
    };
    filter.addListener(filterListener);
    return gFilter;
}
Also used : AERunnable(com.biglybt.core.util.AERunnable) COConfigurationListener(com.biglybt.core.config.COConfigurationListener) COConfigurationListener(com.biglybt.core.config.COConfigurationListener) Image(org.eclipse.swt.graphics.Image) MouseEvent(org.eclipse.swt.events.MouseEvent) MouseAdapter(org.eclipse.swt.events.MouseAdapter) MouseEvent(org.eclipse.swt.events.MouseEvent) ImageLoader(com.biglybt.ui.swt.imageloader.ImageLoader)

Example 5 with COConfigurationListener

use of com.biglybt.core.config.COConfigurationListener in project BiglyBT by BiglySoftware.

the class PluginConfigImpl method addListener.

@Override
public void addListener(final PluginConfigListener l) {
    if (listenersPluginConfig != null && listenersPluginConfig.containsKey(l)) {
        return;
    }
    COConfigurationListener listener = new COConfigurationListener() {

        @Override
        public void configurationSaved() {
            l.configSaved();
        }
    };
    if (listenersPluginConfig == null) {
        listenersPluginConfig = new HashMap<>();
    }
    listenersPluginConfig.put(l, listener);
    COConfigurationManager.addListener(listener);
}
Also used : COConfigurationListener(com.biglybt.core.config.COConfigurationListener)

Aggregations

COConfigurationListener (com.biglybt.core.config.COConfigurationListener)5 ParameterListener (com.biglybt.core.config.ParameterListener)1 ConfigurationManager (com.biglybt.core.config.impl.ConfigurationManager)1 AERunnable (com.biglybt.core.util.AERunnable)1 ImageLoader (com.biglybt.ui.swt.imageloader.ImageLoader)1 ArrayList (java.util.ArrayList)1 MouseAdapter (org.eclipse.swt.events.MouseAdapter)1 MouseEvent (org.eclipse.swt.events.MouseEvent)1 Image (org.eclipse.swt.graphics.Image)1