Search in sources :

Example 1 with FrameworkInstanceDefinition

use of org.osmorc.frameworkintegration.FrameworkInstanceDefinition in project intellij-plugins by JetBrains.

the class OsgiRunConfigurationEditor method onAddClick.

private void onAddClick() {
    FrameworkInstanceDefinition instance = (FrameworkInstanceDefinition) myFrameworkInstances.getSelectedItem();
    BundleSelector selector = new BundleSelector(myProject, instance, getBundlesToRun());
    if (selector.showAndGet()) {
        RunConfigurationTableModel model = getTableModel();
        for (SelectedBundle aModule : selector.getSelectedBundles()) {
            model.addBundle(aModule);
        }
    }
}
Also used : FrameworkInstanceDefinition(org.osmorc.frameworkintegration.FrameworkInstanceDefinition)

Example 2 with FrameworkInstanceDefinition

use of org.osmorc.frameworkintegration.FrameworkInstanceDefinition 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)

Example 3 with FrameworkInstanceDefinition

use of org.osmorc.frameworkintegration.FrameworkInstanceDefinition in project intellij-plugins by JetBrains.

the class ProjectSettingsEditorComponent method refreshFrameworkInstanceCombobox.

private void refreshFrameworkInstanceCombobox() {
    myFrameworkInstance.removeAllItems();
    myFrameworkInstance.addItem(null);
    List<FrameworkInstanceDefinition> instanceDefinitions = ApplicationSettings.getInstance().getActiveFrameworkInstanceDefinitions();
    String frameworkInstanceName = mySettings.getFrameworkInstanceName();
    FrameworkInstanceDefinition projectFrameworkInstance = null;
    for (FrameworkInstanceDefinition instanceDefinition : instanceDefinitions) {
        myFrameworkInstance.addItem(instanceDefinition);
        if (instanceDefinition.getName().equals(frameworkInstanceName)) {
            projectFrameworkInstance = instanceDefinition;
        }
    }
    // add it, but it will be marked red.
    if (projectFrameworkInstance == null && frameworkInstanceName != null) {
        projectFrameworkInstance = new FrameworkInstanceDefinition();
        projectFrameworkInstance.setName(frameworkInstanceName);
        myFrameworkInstance.addItem(projectFrameworkInstance);
    }
    myFrameworkInstance.setSelectedItem(projectFrameworkInstance);
}
Also used : FrameworkInstanceDefinition(org.osmorc.frameworkintegration.FrameworkInstanceDefinition)

Example 4 with FrameworkInstanceDefinition

use of org.osmorc.frameworkintegration.FrameworkInstanceDefinition in project intellij-plugins by JetBrains.

the class FrameworkDefinitionsEditorComponent method addFrameworkInstance.

private void addFrameworkInstance(FrameworkIntegrator integrator) {
    FrameworkInstanceDefinition instance = new FrameworkInstanceDefinition();
    instance.setFrameworkIntegratorName(integrator.getDisplayName());
    CreateFrameworkInstanceDialog dialog = new CreateFrameworkInstanceDialog(instance, myModel);
    dialog.pack();
    if (dialog.showAndGet()) {
        instance = dialog.createDefinition();
        myModel.addElement(instance);
        myFrameworkInstances.setSelectedIndex(myModel.getSize() - 1);
        myModified.add(Pair.create(null, instance));
    }
}
Also used : FrameworkInstanceDefinition(org.osmorc.frameworkintegration.FrameworkInstanceDefinition)

Example 5 with FrameworkInstanceDefinition

use of org.osmorc.frameworkintegration.FrameworkInstanceDefinition in project intellij-plugins by JetBrains.

the class FrameworkDefinitionsEditorComponent method editFrameworkInstance.

private void editFrameworkInstance() {
    int index = myFrameworkInstances.getSelectedIndex();
    if (index != -1) {
        FrameworkInstanceDefinition instance = myModel.get(index);
        CreateFrameworkInstanceDialog dialog = new CreateFrameworkInstanceDialog(instance, myModel);
        dialog.pack();
        if (dialog.showAndGet()) {
            FrameworkInstanceDefinition newInstance = dialog.createDefinition();
            myModel.set(index, newInstance);
            myModified.add(Pair.create(instance, newInstance));
        }
    }
}
Also used : FrameworkInstanceDefinition(org.osmorc.frameworkintegration.FrameworkInstanceDefinition)

Aggregations

FrameworkInstanceDefinition (org.osmorc.frameworkintegration.FrameworkInstanceDefinition)10 Nullable (org.jetbrains.annotations.Nullable)2 PersistentStateComponent (com.intellij.openapi.components.PersistentStateComponent)1 ServiceManager (com.intellij.openapi.components.ServiceManager)1 State (com.intellij.openapi.components.State)1 Storage (com.intellij.openapi.components.Storage)1 Condition (com.intellij.openapi.util.Condition)1 ContainerUtil (com.intellij.util.containers.ContainerUtil)1 XmlSerializerUtil (com.intellij.util.xmlb.XmlSerializerUtil)1 AbstractCollection (com.intellij.util.xmlb.annotations.AbstractCollection)1 List (java.util.List)1 NotNull (org.jetbrains.annotations.NotNull)1 LibraryBundlificationRule (org.jetbrains.osgi.jps.model.LibraryBundlificationRule)1 FrameworkIntegrator (org.osmorc.frameworkintegration.FrameworkIntegrator)1 FrameworkIntegratorRegistry (org.osmorc.frameworkintegration.FrameworkIntegratorRegistry)1 OsgiRunConfigurationChecker (org.osmorc.run.OsgiRunConfigurationChecker)1 OsgiRunConfigurationCheckerProvider (org.osmorc.run.OsgiRunConfigurationCheckerProvider)1