Search in sources :

Example 6 with ModuleConfigurationEditor

use of com.intellij.openapi.module.ModuleConfigurationEditor in project android by JetBrains.

the class AndroidModuleEditor method getPanel.

@NotNull
public JComponent getPanel() {
    Module module = GradleUtil.findModuleByGradlePath(myProject, myName);
    if (module == null || GradleUtil.getGradleBuildFile(module) == null) {
        return new JPanel();
    }
    final NamedObjectPanel.PanelGroup panelGroup = new NamedObjectPanel.PanelGroup();
    if (myGenericSettingsPanel == null) {
        myEditors.clear();
        if (AndroidPluginGeneration.find(module) == COMPONENT) {
            myEditors.add(new GenericEditor<>("Information", DslNotSupportedPanel::new));
        } else {
            AndroidFacet facet = AndroidFacet.getInstance(module);
            if (facet != null && facet.requiresAndroidModel() && isBuildWithGradle(module)) {
                myEditors.add(new GenericEditor<>("Properties", () -> {
                    SingleObjectPanel panel = new SingleObjectPanel(myProject, myName, null, BUILD_FILE_GENERIC_PROPERTIES);
                    panel.init();
                    return panel;
                }));
                myEditors.add(new GenericEditor<>(SIGNING_TAB_TITLE, () -> {
                    NamedObjectPanel panel = new NamedObjectPanel(myProject, myName, BuildFileKey.SIGNING_CONFIGS, "config", panelGroup);
                    panel.init();
                    return panel;
                }));
                myEditors.add(new GenericEditor<>(FLAVORS_TAB_TITLE, () -> {
                    NamedObjectPanel panel = new NamedObjectPanel(myProject, myName, BuildFileKey.FLAVORS, "flavor", panelGroup);
                    panel.init();
                    return panel;
                }));
                myEditors.add(new GenericEditor<>(BUILD_TYPES_TAB_TITLE, () -> {
                    NamedObjectPanel panel = new NamedObjectPanel(myProject, myName, BuildFileKey.BUILD_TYPES, "buildType", panelGroup);
                    panel.init();
                    return panel;
                }));
            }
        }
        myEditors.add(new GenericEditor<>(ProjectBundle.message("modules.classpath.title"), () -> new ModuleDependenciesPanel(myProject, myName)));
        myTabbedPane = new JBTabbedPane(TOP);
        for (ModuleConfigurationEditor editor : myEditors) {
            JComponent component = editor.createComponent();
            if (component != null) {
                myTabbedPane.addTab(editor.getDisplayName(), component);
                editor.reset();
            }
        }
        myTabbedPane.addChangeListener(e -> {
            String tabName = myEditors.get(myTabbedPane.getSelectedIndex()).getDisplayName();
            String appId = getApplicationId(myProject);
            if (appId != null) {
                UsageTracker.getInstance().log(AndroidStudioEvent.newBuilder().setCategory(AndroidStudioEvent.EventCategory.PROJECT_STRUCTURE_DIALOG).setKind(AndroidStudioEvent.EventKind.PROJECT_STRUCTURE_DIALOG_TOP_TAB_CLICK).setProjectId(AndroidStudioUsageTracker.anonymizeUtf8(appId)));
            }
        });
        myGenericSettingsPanel = myTabbedPane;
    }
    return myGenericSettingsPanel;
}
Also used : JBTabbedPane(com.intellij.ui.components.JBTabbedPane) AndroidFacet(org.jetbrains.android.facet.AndroidFacet) ModuleConfigurationEditor(com.intellij.openapi.module.ModuleConfigurationEditor) Module(com.intellij.openapi.module.Module) NotNull(org.jetbrains.annotations.NotNull)

Example 7 with ModuleConfigurationEditor

use of com.intellij.openapi.module.ModuleConfigurationEditor in project Intellij-Plugin by getgauge.

the class GaugeModuleConfigurationProvider method createEditors.

@Override
public ModuleConfigurationEditor[] createEditors(ModuleConfigurationState state) {
    final Module module = state.getRootModel().getModule();
    final ModuleType moduleType = ModuleType.get(module);
    if (!(moduleType instanceof GaugeModuleType)) {
        return ModuleConfigurationEditor.EMPTY;
    }
    final DefaultModuleConfigurationEditorFactory editorFactory = DefaultModuleConfigurationEditorFactory.getInstance();
    List<ModuleConfigurationEditor> editors = new ArrayList<>();
    editors.add(editorFactory.createModuleContentRootsEditor(state));
    editors.add(editorFactory.createOutputEditor(state));
    editors.add(editorFactory.createClasspathEditor(state));
    return editors.toArray(new ModuleConfigurationEditor[editors.size()]);
}
Also used : DefaultModuleConfigurationEditorFactory(com.intellij.openapi.roots.ui.configuration.DefaultModuleConfigurationEditorFactory) ModuleType(com.intellij.openapi.module.ModuleType) ModuleConfigurationEditor(com.intellij.openapi.module.ModuleConfigurationEditor) ArrayList(java.util.ArrayList) Module(com.intellij.openapi.module.Module)

Example 8 with ModuleConfigurationEditor

use of com.intellij.openapi.module.ModuleConfigurationEditor in project intellij-community by JetBrains.

the class TabbedModuleEditor method createCenterPanel.

@Override
protected JComponent createCenterPanel() {
    myTabbedPane = new TabbedPaneWrapper(this);
    for (ModuleConfigurationEditor editor : myEditors) {
        myTabbedPane.addTab(editor.getDisplayName(), editor.createComponent());
        editor.reset();
    }
    restoreSelectedEditor();
    myTabbedPane.addChangeListener(new javax.swing.event.ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent e) {
            saveSelectedEditor();
            if (myHistory != null) {
                myHistory.pushQueryPlace();
            }
        }
    });
    return myTabbedPane.getComponent();
}
Also used : ChangeEvent(javax.swing.event.ChangeEvent) TabbedPaneWrapper(com.intellij.ui.TabbedPaneWrapper) ModuleConfigurationEditor(com.intellij.openapi.module.ModuleConfigurationEditor)

Example 9 with ModuleConfigurationEditor

use of com.intellij.openapi.module.ModuleConfigurationEditor in project intellij-community by JetBrains.

the class DefaultModuleEditorsProvider method createEditors.

@Override
public ModuleConfigurationEditor[] createEditors(ModuleConfigurationState state) {
    ModifiableRootModel rootModel = state.getRootModel();
    Module module = rootModel.getModule();
    if (!(ModuleType.get(module) instanceof JavaModuleType)) {
        return ModuleConfigurationEditor.EMPTY;
    }
    String moduleName = module.getName();
    List<ModuleConfigurationEditor> editors = new ArrayList<>();
    editors.add(new ContentEntriesEditor(moduleName, state));
    editors.add(new OutputEditor(state));
    editors.add(new ClasspathEditor(state));
    return editors.toArray(new ModuleConfigurationEditor[editors.size()]);
}
Also used : ModifiableRootModel(com.intellij.openapi.roots.ModifiableRootModel) ModuleConfigurationEditor(com.intellij.openapi.module.ModuleConfigurationEditor) JavaModuleType(com.intellij.openapi.module.JavaModuleType) ArrayList(java.util.ArrayList) Module(com.intellij.openapi.module.Module)

Example 10 with ModuleConfigurationEditor

use of com.intellij.openapi.module.ModuleConfigurationEditor in project intellij-community by JetBrains.

the class HeaderHidingTabbedModuleEditor method createCenterPanel.

@Override
protected JComponent createCenterPanel() {
    ModuleConfigurationEditor singleEditor = getSingleEditor();
    if (singleEditor != null) {
        final JComponent component = singleEditor.createComponent();
        singleEditor.reset();
        return component;
    } else {
        return super.createCenterPanel();
    }
}
Also used : ModuleConfigurationEditor(com.intellij.openapi.module.ModuleConfigurationEditor)

Aggregations

ModuleConfigurationEditor (com.intellij.openapi.module.ModuleConfigurationEditor)14 Module (com.intellij.openapi.module.Module)6 ArrayList (java.util.ArrayList)4 DefaultModuleConfigurationEditorFactory (com.intellij.openapi.roots.ui.configuration.DefaultModuleConfigurationEditorFactory)3 ModifiableRootModel (com.intellij.openapi.roots.ModifiableRootModel)2 GoModuleType (com.goide.GoModuleType)1 JavaModuleType (com.intellij.openapi.module.JavaModuleType)1 ModuleType (com.intellij.openapi.module.ModuleType)1 Configurable (com.intellij.openapi.options.Configurable)1 ModuleConfigurableEP (com.intellij.openapi.options.ModuleConfigurableEP)1 TabbedPaneWrapper (com.intellij.ui.TabbedPaneWrapper)1 JBTabbedPane (com.intellij.ui.components.JBTabbedPane)1 ChangeEvent (javax.swing.event.ChangeEvent)1 AndroidFacet (org.jetbrains.android.facet.AndroidFacet)1 NotNull (org.jetbrains.annotations.NotNull)1 PluginModuleBuildConfEditor (org.jetbrains.idea.devkit.build.PluginModuleBuildConfEditor)1