Search in sources :

Example 1 with OsgiRunConfigurationChecker

use of org.osmorc.run.OsgiRunConfigurationChecker in project intellij-plugins by JetBrains.

the class OsgiRunConfigurationEditor method onFrameworkChange.

/**
   * Called when the framework is changed. This will create a new editor for framework properties and will also remove
   * any framework bundles from the list, as they are no longer in classpath.
   */
private void onFrameworkChange() {
    if (myFrameworkInstances.getSelectedItem() != null) {
        FrameworkInstanceDefinition instance = (FrameworkInstanceDefinition) myFrameworkInstances.getSelectedItem();
        FrameworkIntegrator integrator = FrameworkIntegratorRegistry.getInstance().findIntegratorByInstanceDefinition(instance);
        assert integrator != null : instance;
        // clear the panel
        myAdditionalPropertiesPanel.removeAll();
        // create and install a new editor (if present)
        myCurrentRunPropertiesEditor = integrator.createRunPropertiesEditor();
        if (myCurrentRunPropertiesEditor != null) {
            myAdditionalPropertiesPanel.removeAll();
            myAdditionalPropertiesPanel.add(myCurrentRunPropertiesEditor.getUI(), BorderLayout.CENTER);
            if (myRunConfiguration != null) {
                myCurrentRunPropertiesEditor.resetEditorFrom(myRunConfiguration);
                OsgiRunConfigurationChecker checker = null;
                if (integrator instanceof OsgiRunConfigurationCheckerProvider) {
                    checker = ((OsgiRunConfigurationCheckerProvider) integrator).getOsgiRunConfigurationChecker();
                }
                myRunConfiguration.setAdditionalChecker(checker);
            }
        }
        // remove all framework bundles from the list
        RunConfigurationTableModel model = getTableModel();
        model.removeAllOfType(SelectedBundle.BundleType.FrameworkBundle);
    }
}
Also used : FrameworkInstanceDefinition(org.osmorc.frameworkintegration.FrameworkInstanceDefinition) OsgiRunConfigurationCheckerProvider(org.osmorc.run.OsgiRunConfigurationCheckerProvider) OsgiRunConfigurationChecker(org.osmorc.run.OsgiRunConfigurationChecker) FrameworkIntegrator(org.osmorc.frameworkintegration.FrameworkIntegrator)

Aggregations

FrameworkInstanceDefinition (org.osmorc.frameworkintegration.FrameworkInstanceDefinition)1 FrameworkIntegrator (org.osmorc.frameworkintegration.FrameworkIntegrator)1 OsgiRunConfigurationChecker (org.osmorc.run.OsgiRunConfigurationChecker)1 OsgiRunConfigurationCheckerProvider (org.osmorc.run.OsgiRunConfigurationCheckerProvider)1