Search in sources :

Example 1 with AbstractPreferenceStore

use of org.jkiss.dbeaver.model.impl.preferences.AbstractPreferenceStore in project dbeaver by serge-rider.

the class DataSourcePreferenceStore method firePropertyChangeEvent.

@Override
public void firePropertyChangeEvent(String name, Object oldValue, Object newValue) {
    super.firePropertyChangeEvent(name, oldValue, newValue);
    // Forward event to global DS prefs store
    DBPPreferenceStore gps = DBWorkbench.getPlatform().getDataSourceProviderRegistry().getGlobalDataSourcePreferenceStore();
    if (gps instanceof AbstractPreferenceStore) {
        ((AbstractPreferenceStore) gps).firePropertyChangeEvent(this, name, oldValue, newValue);
    }
}
Also used : AbstractPreferenceStore(org.jkiss.dbeaver.model.impl.preferences.AbstractPreferenceStore) DBPPreferenceStore(org.jkiss.dbeaver.model.preferences.DBPPreferenceStore)

Example 2 with AbstractPreferenceStore

use of org.jkiss.dbeaver.model.impl.preferences.AbstractPreferenceStore in project dbeaver by dbeaver.

the class BasePlatformImpl method initialize.

protected void initialize() {
    log.debug("Initialize base platform...");
    DBPPreferenceStore prefsStore = getPreferenceStore();
    // Global pref events forwarder
    prefsStore.addPropertyChangeListener(event -> {
        // Forward event to all data source preferences
        for (DBPDataSourceContainer ds : DataSourceRegistry.getAllDataSources()) {
            ((AbstractPreferenceStore) ds.getPreferenceStore()).firePropertyChangeEvent(prefsStore, event.getProperty(), event.getOldValue(), event.getNewValue());
        }
    });
    this.localSystem = new OSDescriptor(Platform.getOS(), Platform.getOSArch());
    {
        this.language = PlatformLanguageRegistry.getInstance().getLanguage(Locale.getDefault());
        if (this.language == null) {
            log.debug("Language for locale '" + Locale.getDefault() + "' not found. Use default.");
            this.language = PlatformLanguageRegistry.getInstance().getLanguage(Locale.ENGLISH);
        }
    }
    // Navigator model
    this.navigatorModel = new DBNModel(this, null);
    this.navigatorModel.initialize();
    // Activate plugin services
    for (IPluginService pluginService : PluginServiceRegistry.getInstance().getServices()) {
        try {
            pluginService.activateService();
            activatedServices.add(pluginService);
        } catch (Throwable e) {
            log.error("Error activating plugin service", e);
        }
    }
    // Keep-alive job
    new KeepAliveListenerJob(this).scheduleMonitor();
}
Also used : AbstractPreferenceStore(org.jkiss.dbeaver.model.impl.preferences.AbstractPreferenceStore) KeepAliveListenerJob(org.jkiss.dbeaver.runtime.jobs.KeepAliveListenerJob) IPluginService(org.jkiss.dbeaver.runtime.IPluginService) DBPPreferenceStore(org.jkiss.dbeaver.model.preferences.DBPPreferenceStore) DBPDataSourceContainer(org.jkiss.dbeaver.model.DBPDataSourceContainer) OSDescriptor(org.jkiss.dbeaver.model.runtime.OSDescriptor) DBNModel(org.jkiss.dbeaver.model.navigator.DBNModel)

Example 3 with AbstractPreferenceStore

use of org.jkiss.dbeaver.model.impl.preferences.AbstractPreferenceStore in project dbeaver by dbeaver.

the class DataSourcePreferenceStore method firePropertyChangeEvent.

@Override
public void firePropertyChangeEvent(String name, Object oldValue, Object newValue) {
    super.firePropertyChangeEvent(name, oldValue, newValue);
    // Forward event to global DS prefs store
    DBPPreferenceStore gps = DBWorkbench.getPlatform().getDataSourceProviderRegistry().getGlobalDataSourcePreferenceStore();
    if (gps instanceof AbstractPreferenceStore) {
        ((AbstractPreferenceStore) gps).firePropertyChangeEvent(this, name, oldValue, newValue);
    }
}
Also used : AbstractPreferenceStore(org.jkiss.dbeaver.model.impl.preferences.AbstractPreferenceStore) DBPPreferenceStore(org.jkiss.dbeaver.model.preferences.DBPPreferenceStore)

Example 4 with AbstractPreferenceStore

use of org.jkiss.dbeaver.model.impl.preferences.AbstractPreferenceStore in project dbeaver by serge-rider.

the class BasePlatformImpl method initialize.

protected void initialize() {
    log.debug("Initialize base platform...");
    DBPPreferenceStore prefsStore = getPreferenceStore();
    // Global pref events forwarder
    prefsStore.addPropertyChangeListener(event -> {
        // Forward event to all data source preferences
        for (DBPDataSourceContainer ds : DataSourceRegistry.getAllDataSources()) {
            ((AbstractPreferenceStore) ds.getPreferenceStore()).firePropertyChangeEvent(prefsStore, event.getProperty(), event.getOldValue(), event.getNewValue());
        }
    });
    this.localSystem = new OSDescriptor(Platform.getOS(), Platform.getOSArch());
    {
        this.language = PlatformLanguageRegistry.getInstance().getLanguage(Locale.getDefault());
        if (this.language == null) {
            log.debug("Language for locale '" + Locale.getDefault() + "' not found. Use default.");
            this.language = PlatformLanguageRegistry.getInstance().getLanguage(Locale.ENGLISH);
        }
    }
    // Navigator model
    this.navigatorModel = new DBNModel(this, null);
    this.navigatorModel.initialize();
    // Activate plugin services
    for (IPluginService pluginService : PluginServiceRegistry.getInstance().getServices()) {
        try {
            pluginService.activateService();
            activatedServices.add(pluginService);
        } catch (Throwable e) {
            log.error("Error activating plugin service", e);
        }
    }
    // Keep-alive job
    new KeepAliveListenerJob(this).scheduleMonitor();
}
Also used : AbstractPreferenceStore(org.jkiss.dbeaver.model.impl.preferences.AbstractPreferenceStore) KeepAliveListenerJob(org.jkiss.dbeaver.runtime.jobs.KeepAliveListenerJob) IPluginService(org.jkiss.dbeaver.runtime.IPluginService) DBPPreferenceStore(org.jkiss.dbeaver.model.preferences.DBPPreferenceStore) DBPDataSourceContainer(org.jkiss.dbeaver.model.DBPDataSourceContainer) OSDescriptor(org.jkiss.dbeaver.model.runtime.OSDescriptor) DBNModel(org.jkiss.dbeaver.model.navigator.DBNModel)

Aggregations

AbstractPreferenceStore (org.jkiss.dbeaver.model.impl.preferences.AbstractPreferenceStore)4 DBPPreferenceStore (org.jkiss.dbeaver.model.preferences.DBPPreferenceStore)4 DBPDataSourceContainer (org.jkiss.dbeaver.model.DBPDataSourceContainer)2 DBNModel (org.jkiss.dbeaver.model.navigator.DBNModel)2 OSDescriptor (org.jkiss.dbeaver.model.runtime.OSDescriptor)2 IPluginService (org.jkiss.dbeaver.runtime.IPluginService)2 KeepAliveListenerJob (org.jkiss.dbeaver.runtime.jobs.KeepAliveListenerJob)2