Search in sources :

Example 1 with ModulesComboBox

use of com.intellij.application.options.ModulesComboBox in project intellij-community by JetBrains.

the class TestNGConfigurationEditor method createView.

private void createView() {
    commonParametersPanel.add(commonJavaParameters, BorderLayout.CENTER);
    classField.setComponent(new EditorTextFieldWithBrowseButton(project, true, new JavaCodeFragment.VisibilityChecker() {

        @Override
        public Visibility isDeclarationVisible(PsiElement declaration, PsiElement place) {
            if (declaration instanceof PsiClass && place.getParent() instanceof PsiJavaCodeReferenceElement) {
                return Visibility.VISIBLE;
            }
            try {
                if (declaration instanceof PsiClass && new TestClassBrowser(project, TestNGConfigurationEditor.this).getFilter().isAccepted((PsiClass) declaration)) {
                    return Visibility.VISIBLE;
                }
            } catch (MessageInfoException e) {
                return Visibility.NOT_VISIBLE;
            }
            return Visibility.NOT_VISIBLE;
        }
    }));
    final EditorTextFieldWithBrowseButton methodEditorTextField = new EditorTextFieldWithBrowseButton(project, true, JavaCodeFragment.VisibilityChecker.EVERYTHING_VISIBLE, PlainTextLanguage.INSTANCE.getAssociatedFileType());
    methodField.setComponent(methodEditorTextField);
    groupField.setComponent(new TextFieldWithBrowseButton.NoPathCompletion());
    suiteField.setComponent(new TextFieldWithBrowseButton());
    packageField.setVisible(true);
    packageField.setEnabled(true);
    packageField.setComponent(new EditorTextFieldWithBrowseButton(project, false));
    TextFieldWithBrowseButton outputDirectoryButton = new TextFieldWithBrowseButton();
    outputDirectory.setComponent(outputDirectoryButton);
    outputDirectoryButton.addBrowseFolderListener("TestNG", "Select test output directory", project, FileChooserDescriptorFactory.createSingleFolderDescriptor());
    moduleClasspath.setEnabled(true);
    moduleClasspath.setComponent(new ModulesComboBox());
    propertiesTableModel = new TestNGParametersTableModel();
    listenerModel = new TestNGListenersTableModel();
    TextFieldWithBrowseButton textFieldWithBrowseButton = new TextFieldWithBrowseButton();
    propertiesFile.setComponent(textFieldWithBrowseButton);
    FileChooserDescriptor propertiesFileDescriptor = new FileChooserDescriptor(true, false, false, false, false, false) {

        @Override
        public boolean isFileVisible(VirtualFile virtualFile, boolean showHidden) {
            if (!showHidden && virtualFile.getName().charAt(0) == '.')
                return false;
            return virtualFile.isDirectory() || "properties".equals(virtualFile.getExtension());
        }
    };
    textFieldWithBrowseButton.addBrowseFolderListener("TestNG", "Select .properties file for test properties", project, propertiesFileDescriptor);
    propertiesTableView = new TableView(propertiesTableModel);
    myPropertiesPanel.add(ToolbarDecorator.createDecorator(propertiesTableView).setAddAction(new AnActionButtonRunnable() {

        @Override
        public void run(AnActionButton button) {
            propertiesTableModel.addParameter();
            int index = propertiesTableModel.getRowCount() - 1;
            propertiesTableView.setRowSelectionInterval(index, index);
        }
    }).setRemoveAction(new AnActionButtonRunnable() {

        @Override
        public void run(AnActionButton button) {
            int idx = propertiesTableView.getSelectedRow() - 1;
            for (int row : propertiesTableView.getSelectedRows()) {
                propertiesTableModel.removeProperty(row);
            }
            if (idx > -1)
                propertiesTableView.setRowSelectionInterval(idx, idx);
        }
    }).disableUpDownActions().createPanel(), BorderLayout.CENTER);
    myListenersList = new JBList(listenerModel);
    myListenersPanel.add(ToolbarDecorator.createDecorator(myListenersList).setAddAction(new AddActionButtonRunnable()).setRemoveAction(new AnActionButtonRunnable() {

        @Override
        public void run(AnActionButton button) {
            int idx = myListenersList.getSelectedIndex() - 1;
            for (int row : myListenersList.getSelectedIndices()) {
                listenerModel.removeListener(row);
            }
            if (idx > -1)
                myListenersList.setSelectedIndex(idx);
        }
    }).setAddActionUpdater(new AnActionButtonUpdater() {

        @Override
        public boolean isEnabled(AnActionEvent e) {
            return !project.isDefault();
        }
    }).disableUpDownActions().createPanel(), BorderLayout.CENTER);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) FileChooserDescriptor(com.intellij.openapi.fileChooser.FileChooserDescriptor) AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) MessageInfoException(com.theoryinpractice.testng.MessageInfoException) ModulesComboBox(com.intellij.application.options.ModulesComboBox) TestClassBrowser(com.theoryinpractice.testng.configuration.browser.TestClassBrowser) JBList(com.intellij.ui.components.JBList) TableView(com.intellij.ui.table.TableView)

Example 2 with ModulesComboBox

use of com.intellij.application.options.ModulesComboBox in project liferay-ide by liferay.

the class LiferayServerConfigurable method resetEditorFrom.

public void resetEditorFrom(@NotNull LiferayServerConfiguration configuration) {
    _vmParams.setText(configuration.getVMParameters());
    _liferayServer.setText(configuration.getLiferayBundle());
    _jrePath.setPathOrName(configuration.getAlternativeJrePath(), configuration.isAlternativeJrePathEnabled());
    ModulesComboBox modulesComboBox = _modules.getComponent();
    modulesComboBox.setSelectedModule(configuration.getModule());
}
Also used : ModulesComboBox(com.intellij.application.options.ModulesComboBox)

Example 3 with ModulesComboBox

use of com.intellij.application.options.ModulesComboBox in project ballerina by ballerina-lang.

the class BallerinaRemoteSettingsEditor method createUIComponents.

private void createUIComponents() {
    myWorkingDirectoryField = new LabeledComponent<>();
    myWorkingDirectoryField.setComponent(new TextFieldWithBrowseButton());
    myParamsField = new LabeledComponent<>();
    myParamsField.setComponent(new RawCommandLineEditor());
    myModulesComboBox = new LabeledComponent<>();
    myModulesComboBox.setComponent(new ModulesComboBox());
    myHost = new LabeledComponent<>();
    myHostField = new EditorTextField();
    myHostField.setPreferredWidth(300);
    myHost.setComponent(myHostField);
    myPort = new LabeledComponent<>();
    myPortField = new EditorTextField();
    myPortField.setPreferredWidth(100);
    myPort.setComponent(myPortField);
}
Also used : ModulesComboBox(com.intellij.application.options.ModulesComboBox) TextFieldWithBrowseButton(com.intellij.openapi.ui.TextFieldWithBrowseButton) EditorTextField(com.intellij.ui.EditorTextField) RawCommandLineEditor(com.intellij.ui.RawCommandLineEditor)

Example 4 with ModulesComboBox

use of com.intellij.application.options.ModulesComboBox in project google-cloud-intellij by GoogleCloudPlatform.

the class GoogleCloudApiSelectorPanel method createUIComponents.

/**
 * Initializes some UI components in this panel that require special set-up.
 *
 * <p>This is automatically called by the IDEA SDK and should not be directly invoked.
 */
private void createUIComponents() {
    modulesComboBox = new ModulesComboBox();
    modulesComboBox.fillModules(project);
    ApplicationManager.getApplication().runReadAction(() -> {
        Module[] modules = ModuleManager.getInstance(project).getSortedModules();
        if (modules.length > 0) {
            // Defaults to the first, top-level module in this project.
            modulesComboBox.setSelectedModule(modules[0]);
        }
    });
    cloudLibrariesTable = new CloudLibraryTable(libraries);
    cloudLibrariesTable.setTableHeader(null);
    cloudLibrariesTable.getSelectionModel().addListSelectionListener(this::onClientLibrarySelection);
    addTableModelListener(e -> updateManagementUI());
    projectSelector = new ProjectSelector(project);
    projectSelector.addProjectSelectionListener(cloudProject -> updateManagementUI());
}
Also used : ModulesComboBox(com.intellij.application.options.ModulesComboBox) Module(com.intellij.openapi.module.Module) ProjectSelector(com.google.cloud.tools.intellij.project.ProjectSelector)

Example 5 with ModulesComboBox

use of com.intellij.application.options.ModulesComboBox in project liferay-ide by liferay.

the class LiferayServerConfigurable method applyEditorTo.

public void applyEditorTo(@NotNull LiferayServerConfiguration configuration) throws ConfigurationException {
    configuration.setAlternativeJrePath(_jrePath.getJrePathOrName());
    configuration.setAlternativeJrePathEnabled(_jrePath.isAlternativeJreSelected());
    ModulesComboBox modulesComboBox = _modules.getComponent();
    configuration.setModule(modulesComboBox.getSelectedModule());
    configuration.setLiferayBundle(_liferayServer.getText());
    configuration.setVMParameters(_vmParams.getText());
}
Also used : ModulesComboBox(com.intellij.application.options.ModulesComboBox)

Aggregations

ModulesComboBox (com.intellij.application.options.ModulesComboBox)7 TextFieldWithBrowseButton (com.intellij.openapi.ui.TextFieldWithBrowseButton)3 RawCommandLineEditor (com.intellij.ui.RawCommandLineEditor)3 ProjectSelector (com.google.cloud.tools.intellij.project.ProjectSelector)1 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)1 FileChooserDescriptor (com.intellij.openapi.fileChooser.FileChooserDescriptor)1 Module (com.intellij.openapi.module.Module)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 EditorTextField (com.intellij.ui.EditorTextField)1 JBList (com.intellij.ui.components.JBList)1 TableView (com.intellij.ui.table.TableView)1 MessageInfoException (com.theoryinpractice.testng.MessageInfoException)1 TestClassBrowser (com.theoryinpractice.testng.configuration.browser.TestClassBrowser)1