Search in sources :

Example 1 with UIHelper

use of org.csstudio.utility.singlesource.UIHelper in project yamcs-studio by yamcs.

the class OPIBuilderPlugin method start.

@Override
public void start(BundleContext context) throws Exception {
    super.start(context);
    resources = new ResourceHelper();
    ui = new UIHelper();
    // set this to resolve Xincludes in XMLs
    System.setProperty("org.apache.xerces.xni.parser.XMLParserConfiguration", "org.apache.xerces.parsers.XIncludeParserConfiguration");
    ScriptService.getInstance();
    if (PreferencesHelper.isDisplaySystemOutput()) {
        ConsoleService.getInstance().turnOnSystemOutput();
    }
    preferenceLisener = new IPropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent event) {
            if (event.getProperty().equals(PreferencesHelper.COLOR_FILE))
                MediaService.getInstance().reloadColorFile();
            else if (event.getProperty().equals(PreferencesHelper.FONT_FILE))
                MediaService.getInstance().reloadFontFile();
            else if (event.getProperty().equals(PreferencesHelper.OPI_GUI_REFRESH_CYCLE))
                GUIRefreshThread.getInstance(true).reLoadGUIRefreshCycle();
            else if (event.getProperty().equals(PreferencesHelper.DISABLE_ADVANCED_GRAPHICS)) {
                // $NON-NLS-1$ //$NON-NLS-2$
                String disabled = PreferencesHelper.isAdvancedGraphicsDisabled() ? "true" : "false";
                // for swt.widgets
                System.setProperty("org.csstudio.swt.widget.prohibit_advanced_graphics", // $NON-NLS-1$
                disabled);
                // for XYGraph
                // $NON-NLS-1$
                System.setProperty("prohibit_advanced_graphics", disabled);
            } else if (event.getProperty().equals(PreferencesHelper.URL_FILE_LOADING_TIMEOUT))
                System.setProperty(// $NON-NLS-1$
                "org.csstudio.swt.widget.url_file_load_timeout", Integer.toString(PreferencesHelper.getURLFileLoadingTimeout()));
            else if (event.getProperty().equals(PreferencesHelper.SCHEMA_OPI)) {
                SchemaService.getInstance().reLoad();
            } else if (event.getProperty().equals(PreferencesHelper.DISPLAY_SYSTEM_OUTPUT)) {
                if (PreferencesHelper.isDisplaySystemOutput())
                    ConsoleService.getInstance().turnOnSystemOutput();
                else
                    ConsoleService.getInstance().turnOffSystemOutput();
            }
        }
    };
    getPluginPreferences().addPropertyChangeListener(preferenceLisener);
    @SuppressWarnings("serial")
    class HackPropertyChangeEvent extends PropertyChangeEvent {

        public HackPropertyChangeEvent(Object source, String property, Object oldValue, Object newValue) {
            super(source, property, oldValue, newValue);
        }
    }
    preferenceLisener.propertyChange(new HackPropertyChangeEvent(this, PreferencesHelper.DISABLE_ADVANCED_GRAPHICS, null, null));
    preferenceLisener.propertyChange(new HackPropertyChangeEvent(this, PreferencesHelper.URL_FILE_LOADING_TIMEOUT, null, null));
}
Also used : IPropertyChangeListener(org.eclipse.core.runtime.Preferences.IPropertyChangeListener) PropertyChangeEvent(org.eclipse.core.runtime.Preferences.PropertyChangeEvent) ResourceHelper(org.csstudio.utility.singlesource.ResourceHelper) UIHelper(org.csstudio.utility.singlesource.UIHelper)

Aggregations

ResourceHelper (org.csstudio.utility.singlesource.ResourceHelper)1 UIHelper (org.csstudio.utility.singlesource.UIHelper)1 IPropertyChangeListener (org.eclipse.core.runtime.Preferences.IPropertyChangeListener)1 PropertyChangeEvent (org.eclipse.core.runtime.Preferences.PropertyChangeEvent)1