com.intellij.ui.components.JBTextField Java Examples

The following examples show how to use com.intellij.ui.components.JBTextField. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RedisPanel.java    From nosql4idea with Apache License 2.0 6 votes vote down vote up
protected void buildQueryToolBar() {
    toolBarPanel.setLayout(new BorderLayout());

    filterField = new JBTextField("*");
    filterField.setColumns(10);

    NonOpaquePanel westPanel = new NonOpaquePanel();

    NonOpaquePanel filterPanel = new NonOpaquePanel();
    filterPanel.add(new JLabel("Filter: "), BorderLayout.WEST);
    filterPanel.add(filterField, BorderLayout.CENTER);
    filterPanel.add(Box.createHorizontalStrut(5), BorderLayout.EAST);
    westPanel.add(filterPanel, BorderLayout.WEST);

    toolBarPanel.add(westPanel, BorderLayout.WEST);

    addCommonsActions();
}
 
Example #2
Source File: UserTemplateDialog.java    From idea-gitignore with MIT License 6 votes vote down vote up
/**
 * Factory method. It creates panel with dialog options. Options panel is located at the
 * center of the dialog's content pane. The implementation can return <code>null</code>
 * value. In this case there will be no options panel.
 *
 * @return center panel
 */
@Nullable
@Override
protected JComponent createCenterPanel() {
    final JPanel centerPanel = new JPanel(new BorderLayout());
    centerPanel.setPreferredSize(new Dimension(600, 300));

    previewDocument = EditorFactory.getInstance().createDocument(content);
    preview = Utils.createPreviewEditor(previewDocument, project, false);
    name = new JBTextField(IgnoreBundle.message("dialog.userTemplate.name.value"));

    JLabel nameLabel = new JLabel(IgnoreBundle.message("dialog.userTemplate.name"));
    nameLabel.setBorder(JBUI.Borders.emptyRight(10));

    JPanel namePanel = new JPanel(new BorderLayout());
    namePanel.add(nameLabel, BorderLayout.WEST);
    namePanel.add(name, BorderLayout.CENTER);

    JComponent previewComponent = preview.getComponent();
    previewComponent.setBorder(JBUI.Borders.emptyTop(10));

    centerPanel.add(namePanel, BorderLayout.NORTH);
    centerPanel.add(previewComponent, BorderLayout.CENTER);

    return centerPanel;
}
 
Example #3
Source File: GraphQLConfigVariableAwareEndpoint.java    From js-graphql-intellij-plugin with MIT License 5 votes vote down vote up
@Nullable
@Override
protected JComponent createCenterPanel() {
    textField = new JBTextField();
    textField.setText(previousVariables.getOrDefault(variableName, ""));
    myPreferredFocusedComponent = textField;
    JBLabel hint = new JBLabel("<html><b>Hint</b>: Specify environment variables using <code>-DvarName=varValue</code> on the IDE command line.<div style=\"margin-top: 6\">This dialog stores the entered value until the IDE is restarted.</div></html>");
    return FormBuilder.createFormBuilder().addLabeledComponent(variableName, textField).addComponent(hint).getPanel();
}
 
Example #4
Source File: TextFieldWithBrowseButton.java    From consulo with Apache License 2.0 5 votes vote down vote up
public TextFieldWithBrowseButton(JTextField field, @Nullable ActionListener browseActionListener, @Nullable Disposable parent) {
  super(field, browseActionListener);
  if (!(field instanceof JBTextField)) {
    UIUtil.addUndoRedoActions(field);
  }
  installPathCompletion(FileChooserDescriptorFactory.createSingleLocalFileDescriptor(), parent);
}
 
Example #5
Source File: OptionsDialogWrapper.java    From intellij-thrift with Apache License 2.0 5 votes vote down vote up
public OptionsDialogWrapper(Project project, Generator generator) {
  super(project, false, IdeModalityType.IDE);
  myProject = project;
  myGenerator = generator;
  myOutputFolderChooser = new TextFieldWithBrowseButton(new JBTextField());
  setTitle("Generator configuration");
  getPeer().getWindow().setMinimumSize(new Dimension(400, 40));
  setResizable(false);
  init();
}
 
Example #6
Source File: RunAnythingPopupUI.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static void adjustEmptyText(@Nonnull TextBoxWithExtensions textEditor, @Nonnull BooleanFunction<JBTextField> function, @Nonnull String leftText, @Nonnull String rightText) {
  textEditor.setPlaceholder(leftText);

  //textEditor.putClientProperty("StatusVisibleFunction", function);
  //StatusText statusText = textEditor.getEmptyText();
  //statusText.setIsVerticalFlow(false);
  //statusText.setShowAboveCenter(false);
  //statusText.setText(leftText, SimpleTextAttributes.GRAY_ATTRIBUTES);
  //statusText.appendSecondaryText(rightText, SimpleTextAttributes.GRAY_ATTRIBUTES, null);
  //statusText.setFont(UIUtil.getLabelFont(UIUtil.FontSize.SMALL));
}
 
Example #7
Source File: StringWithNewLinesCellEditor.java    From consulo with Apache License 2.0 5 votes vote down vote up
public StringWithNewLinesCellEditor() {
  super(new JBTextField() {
    @Override
    public void setDocument(Document doc) {
      super.setDocument(doc);
      doc.putProperty("filterNewlines", Boolean.FALSE);
    }
  });
}
 
Example #8
Source File: SortTokensGui.java    From StringManipulation with Apache License 2.0 5 votes vote down vote up
private List<String> getSeparators() {
	ArrayList<String> strings = new ArrayList<String>(textfields.getComponentCount());
	Component[] components = textfields.getComponents();
	for (Component component : components) {
		JPanel panel = (JPanel) component;
		JBTextField field = (JBTextField) panel.getComponent(0);
		String text = field.getText();
		if (!isEmpty(text)) {
			strings.add(text);
		}
	}
	return strings;
}
 
Example #9
Source File: AlignToColumnsForm.java    From StringManipulation with Apache License 2.0 5 votes vote down vote up
private List<String> getSeparators() {
	ArrayList<String> strings = new ArrayList<String>(textfields.getComponentCount());
	Component[] components = textfields.getComponents();
	for (Component component : components) {
		JPanel panel = (JPanel) component;
		JBTextField field = (JBTextField) panel.getComponent(0);
		String text = field.getText();
		if (!isEmpty(text)) {
			strings.add(text);
		}
	}
	return strings;
}
 
Example #10
Source File: ServiceAuthDialog.java    From consulo with Apache License 2.0 5 votes vote down vote up
public ServiceAuthDialog() {
  super(null);
  setTitle("Service Authorization");
  myRoot = new JPanel(new VerticalFlowLayout(0, 0));

  myServiceAuthConfiguration = ServiceAuthConfiguration.getInstance();

  myAsAnonymousButton = new JBRadioButton("Logged as anonymous");
  myLogAsButton = new JBRadioButton("Log as user");

  JPanel loginPanel = new JPanel(new VerticalFlowLayout(0, 0));
  myEmailField = new JBTextField();
  loginPanel.add(LabeledComponent.left(myEmailField, "Email"));

  ButtonGroup group = new ButtonGroup();
  group.add(myAsAnonymousButton);
  group.add(myLogAsButton);

  myLogAsButton.addItemListener(e -> UIUtil.setEnabled(loginPanel, e.getStateChange() == ItemEvent.SELECTED, true));

  myRoot.add(myAsAnonymousButton);
  myRoot.add(myLogAsButton);
  myRoot.add(loginPanel);

  String email = myServiceAuthConfiguration.getEmail();
  if (email == null) {
    myAsAnonymousButton.setSelected(true);
  }
  else {
    myLogAsButton.setSelected(true);
    myEmailField.setText(email);
  }

  pack();
  init();
}
 
Example #11
Source File: ChooseExtractedRuleName.java    From intellij-plugin-v4 with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
protected JComponent createCenterPanel() {
	nameField = new JBTextField("newRule");
	double h = nameField.getSize().getHeight();
	nameField.setPreferredSize(new Dimension(250,(int)h));
	setTitle("Name the extracted rule");
	nameField.selectAll();
	return nameField;
}
 
Example #12
Source File: QuarkusModuleInfoStep.java    From intellij-quarkus with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void _init() {
    ProgressIndicator indicator = new EmptyProgressIndicator() {
        @Override
        public void setText(String text) {
            SwingUtilities.invokeLater(() -> panel.setLoadingText(text));
        }
    };
    try {
        QuarkusModel model = QuarkusModelRegistry.INSTANCE.load(context.getUserData(QuarkusConstants.WIZARD_ENDPOINT_URL_KEY), indicator);
        context.putUserData(QuarkusConstants.WIZARD_MODEL_KEY, model);
        final FormBuilder formBuilder = new FormBuilder();
        final CollectionComboBoxModel<ToolDelegate> toolModel = new CollectionComboBoxModel<>(Arrays.asList(ToolDelegate.getDelegates()));
        toolComboBox = new ComboBox<>(toolModel);
        toolComboBox.setRenderer(new ColoredListCellRenderer<ToolDelegate>() {
            @Override
            protected void customizeCellRenderer(@NotNull JList<? extends ToolDelegate> list, ToolDelegate toolDelegate, int index, boolean selected, boolean hasFocus) {
                this.append(toolDelegate.getDisplay());
            }
        });
        formBuilder.addLabeledComponent("Tool:", toolComboBox);
        groupIdField = new JBTextField("org.acme");
        formBuilder.addLabeledComponent("Group:", groupIdField);
        artifactIdField = new JBTextField("code-with-quarkus");
        formBuilder.addLabeledComponent("Artifact:", artifactIdField);
        versionField = new JBTextField("1.0.0-SNAPSHOT");
        formBuilder.addLabeledComponent("Version:", versionField);
        classNameField = new JBTextField("org.acme.ExampleResource");
        formBuilder.addLabeledComponent("Class name:", classNameField);
        pathField = new JBTextField("/hello");
        formBuilder.addLabeledComponent("Path:", pathField);
        panel.add(ScrollPaneFactory.createScrollPane(formBuilder.getPanel(), true), "North");
    } catch (IOException e) {
        LOGGER.error(e.getLocalizedMessage(), e);
        throw new RuntimeException(e);
    }
}
 
Example #13
Source File: BuckSettingsUI.java    From buck with Apache License 2.0 5 votes vote down vote up
private TextFieldWithBrowseButton createTextFieldWithBrowseButton(
    String emptyText, String title, String description, Project project) {
  JBTextField textField = new JBTextField();
  textField.getEmptyText().setText(emptyText);
  TextFieldWithBrowseButton field = new TextFieldWithBrowseButton(textField);
  FileChooserDescriptor fileChooserDescriptor =
      new FileChooserDescriptor(true, false, false, false, false, false);
  field.addBrowseFolderListener(
      title,
      description,
      project,
      fileChooserDescriptor,
      TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT);
  return field;
}
 
Example #14
Source File: GuiUtils.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static JTextField createUndoableTextField() {
  return new JBTextField();
}
 
Example #15
Source File: TestConfigurationEditor.java    From buck with Apache License 2.0 4 votes vote down vote up
public TestConfigurationEditor() {
  root = new JPanel(new GridBagLayout());
  final JBLabel targetLabel = new JBLabel();
  targetLabel.setText("Targets");
  mTargets = new JBTextField();
  mTargets.getEmptyText().setText("Specify buck targets to test");

  final JBLabel testSelectorLabel = new JBLabel();
  testSelectorLabel.setText("Test selectors (--test-selectors)");
  mTestSelectors = new JBTextField();
  mTestSelectors
      .getEmptyText()
      .setText("Select tests to run using <class>, <#method> or <class#method>.");

  final JBLabel additionalParamsLabel = new JBLabel();
  additionalParamsLabel.setText("Additional params");
  mAdditionalParams = new JBTextField();
  mAdditionalParams.getEmptyText().setText("May be empty");

  final GridBagConstraints constraints =
      new GridBagConstraints(
          0,
          0,
          1,
          1,
          0,
          0,
          GridBagConstraints.WEST,
          GridBagConstraints.NONE,
          JBUI.emptyInsets(),
          0,
          0);
  constraints.insets = JBUI.insetsRight(8);
  root.add(targetLabel, constraints);
  constraints.gridx = 1;
  constraints.gridy = 0;
  constraints.weightx = 1;
  constraints.fill = GridBagConstraints.HORIZONTAL;
  root.add(mTargets, constraints);

  constraints.gridx = 0;
  constraints.gridy = 1;
  constraints.weightx = 0;
  constraints.fill = GridBagConstraints.NONE;
  root.add(testSelectorLabel, constraints);

  constraints.gridx = 1;
  constraints.gridy = 1;
  constraints.weightx = 1;
  constraints.fill = GridBagConstraints.HORIZONTAL;
  root.add(mTestSelectors, constraints);

  constraints.gridx = 0;
  constraints.gridy = 2;
  constraints.weightx = 0;
  constraints.fill = GridBagConstraints.NONE;
  root.add(additionalParamsLabel, constraints);

  constraints.gridx = 1;
  constraints.gridy = 2;
  constraints.weightx = 1;
  constraints.fill = GridBagConstraints.HORIZONTAL;
  root.add(mAdditionalParams, constraints);
}
 
Example #16
Source File: SearchTextField.java    From consulo with Apache License 2.0 4 votes vote down vote up
public JBTextField getTextEditor() {
  return myTextField;
}
 
Example #17
Source File: ExternalSystemTaskSettingsControl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void fillUi(@Nonnull final PaintAwarePanel canvas, int indentLevel) {
  myProjectPathLabel = new JBLabel(ExternalSystemBundle.message(
    "run.configuration.settings.label.project", myExternalSystemId.getReadableName()
  ));
  ExternalSystemManager<?, ?, ?, ?, ?> manager = ExternalSystemApiUtil.getManager(myExternalSystemId);
  FileChooserDescriptor projectPathChooserDescriptor = null;
  if (manager instanceof ExternalSystemUiAware) {
    projectPathChooserDescriptor = ((ExternalSystemUiAware)manager).getExternalProjectConfigDescriptor();
  }
  if (projectPathChooserDescriptor == null) {
    projectPathChooserDescriptor = FileChooserDescriptorFactory.createSingleLocalFileDescriptor();
  }
  String title = ExternalSystemBundle.message("settings.label.select.project", myExternalSystemId.getReadableName());
  myProjectPathField = new ExternalProjectPathField(myProject, myExternalSystemId, projectPathChooserDescriptor, title) {
    @Override
    public Dimension getPreferredSize() {
      return myVmOptionsEditor == null ? super.getPreferredSize() : myVmOptionsEditor.getTextField().getPreferredSize();
    }
  };
  canvas.add(myProjectPathLabel, ExternalSystemUiUtil.getLabelConstraints(0));
  canvas.add(myProjectPathField, ExternalSystemUiUtil.getFillLineConstraints(0));

  myTasksLabel = new JBLabel(ExternalSystemBundle.message("run.configuration.settings.label.tasks"));
  myTasksTextField = new JBTextField(ExternalSystemConstants.TEXT_FIELD_WIDTH_IN_COLUMNS);
  canvas.add(myTasksLabel, ExternalSystemUiUtil.getLabelConstraints(0));
  GridBag c = ExternalSystemUiUtil.getFillLineConstraints(0);
  c.insets.right = myProjectPathField.getButton().getPreferredSize().width + 8 /* street magic, sorry */;
  canvas.add(myTasksTextField, c);

  myVmOptionsLabel = new JBLabel(ExternalSystemBundle.message("run.configuration.settings.label.vmoptions"));
  myVmOptionsEditor = new RawCommandLineEditor();
  myVmOptionsEditor.setDialogCaption(ExternalSystemBundle.message("run.configuration.settings.label.vmoptions"));
  canvas.add(myVmOptionsLabel, ExternalSystemUiUtil.getLabelConstraints(0));
  canvas.add(myVmOptionsEditor, ExternalSystemUiUtil.getFillLineConstraints(0));
  myScriptParametersLabel = new JBLabel(ExternalSystemBundle.message("run.configuration.settings.label.script.parameters"));
  myScriptParametersEditor = new RawCommandLineEditor();
  myScriptParametersEditor.setDialogCaption(ExternalSystemBundle.message("run.configuration.settings.label.script.parameters"));
  canvas.add(myScriptParametersLabel, ExternalSystemUiUtil.getLabelConstraints(0));
  canvas.add(myScriptParametersEditor, ExternalSystemUiUtil.getFillLineConstraints(0));
}
 
Example #18
Source File: TextFieldPlaceholderFunction.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static void install(JBTextField textField) {
  textField.putClientProperty("StatusVisibleFunction", INSTANCE);
}
 
Example #19
Source File: TextFieldPlaceholderFunction.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public boolean fun(JBTextField textField) {
  return textField.getText().length() == 0;
}
 
Example #20
Source File: DesktopTextBoxWithExtensions.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public JBTextField getTextField() {
  return myTextField;
}
 
Example #21
Source File: TextFieldWithBrowseButton.java    From consulo with Apache License 2.0 4 votes vote down vote up
public TextFieldWithBrowseButton(ActionListener browseActionListener, Disposable parent) {
  this(new JBTextField(10/* to prevent field to be infinitely resized in grid-box layouts */), browseActionListener, parent);
}
 
Example #22
Source File: BuckSettingsUI.java    From buck with Apache License 2.0 4 votes vote down vote up
private JPanel initInstallSettingsSection() {
  runAfterInstall = new JCheckBox("Run after install (-r)");
  multiInstallMode = new JCheckBox("Multi-install mode (-x)");
  uninstallBeforeInstall = new JCheckBox("Uninstall before installing (-u)");
  customizedInstallSetting = new JCheckBox("Use customized install setting:  ");
  customizedInstallSettingField = new JBTextField();
  customizedInstallSettingField.getEmptyText().setText(CUSTOMIZED_INSTALL_FLAGS_HINT);
  customizedInstallSettingField.setEnabled(false);

  JPanel panel = new JPanel(new GridBagLayout());
  panel.setBorder(IdeBorderFactory.createTitledBorder("Install Settings", true));

  GridBagConstraints leftSide = new GridBagConstraints();
  leftSide.fill = GridBagConstraints.NONE;
  leftSide.anchor = GridBagConstraints.LINE_START;
  leftSide.gridx = 0;
  leftSide.weightx = 0;

  GridBagConstraints rightSide = new GridBagConstraints();
  rightSide.fill = GridBagConstraints.HORIZONTAL;
  rightSide.anchor = GridBagConstraints.LINE_START;
  leftSide.gridx = 1;
  rightSide.weightx = 1;

  leftSide.gridy = rightSide.gridy = 0;
  panel.add(runAfterInstall, leftSide);

  leftSide.gridy = rightSide.gridy = 1;
  panel.add(multiInstallMode, leftSide);

  leftSide.gridy = rightSide.gridy = 2;
  panel.add(uninstallBeforeInstall, leftSide);

  leftSide.gridy = rightSide.gridy = 3;
  panel.add(customizedInstallSetting, leftSide);
  panel.add(customizedInstallSettingField, rightSide);

  customizedInstallSetting.addItemListener(
      e -> {
        if (e.getStateChange() == ItemEvent.SELECTED) {
          customizedInstallSettingField.setEnabled(true);
          runAfterInstall.setEnabled(false);
          multiInstallMode.setEnabled(false);
          uninstallBeforeInstall.setEnabled(false);
        } else {
          customizedInstallSettingField.setEnabled(false);
          runAfterInstall.setEnabled(true);
          multiInstallMode.setEnabled(true);
          uninstallBeforeInstall.setEnabled(true);
        }
      });
  return panel;
}
 
Example #23
Source File: ReferencePointTab.java    From saros with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Creates a panel to specify how a shared reference point is represented locally.
 *
 * @param referencePointName the name of the shared reference point contained in the resource
 *     negotiation data
 */
ReferencePointTab(
    @NotNull String referencePointName,
    @NotNull ReferencePointTabStateListener referencePointTabStateListener) {

  this.referencePointName = referencePointName;
  this.referencePointTabStateListener = referencePointTabStateListener;

  this.referencePointTabPanel = new JPanel();
  this.projectComboBox = new ComboBox<>();
  this.createNewDirectoryRadioButton = new JBRadioButton();
  this.useExistingDirectoryRadioButton = new JBRadioButton();

  this.newDirectoryNameTextField = new JBTextField();
  this.newDirectoryBasePathTextField = new TextFieldWithBrowseButton();
  this.existingDirectoryPathTextField = new TextFieldWithBrowseButton();

  this.newDirectoryNameTextFieldShownAsValid = true;
  this.newDirectoryNameTextFieldDefaultBorder = newDirectoryNameTextField.getBorder();
  this.newDirectoryNameTextFieldErrorBorder =
      BorderFactory.createCompoundBorder(
          newDirectoryNameTextFieldDefaultBorder, BorderFactory.createLineBorder(JBColor.RED));

  this.newDirectoryBasePathTextFieldShownAsValid = true;
  this.newDirectoryBasePathTextFieldDefaultBorder =
      newDirectoryBasePathTextField.getTextField().getBorder();
  this.newDirectoryBasePathTextFieldErrorBorder =
      BorderFactory.createCompoundBorder(
          newDirectoryBasePathTextFieldDefaultBorder,
          BorderFactory.createLineBorder(JBColor.RED));

  this.existingDirectoryPathTextFieldShownAsValid = true;
  this.existingDirectoryPathTextFieldDefaultBorder =
      existingDirectoryPathTextField.getTextField().getBorder();
  this.existingDirectoryPathTextFieldErrorBorder =
      BorderFactory.createCompoundBorder(
          existingDirectoryPathTextFieldDefaultBorder,
          BorderFactory.createLineBorder(JBColor.RED));

  this.hasValidInput = false;

  initPanel();

  fillProjectComboBox();
  setUpRadioButtons();
  setUpFolderChooser();

  setInitialInput();

  addProjectComboBoxListener();
  addCreateNewDirectoryFieldListeners();
  addUseExistingDirectoryFieldListeners();
}
 
Example #24
Source File: GtForm.java    From GitToolBox with Apache License 2.0 4 votes vote down vote up
private void updateCurrentDecorationPartPostfix(JBTextField textField) {
  getCurrentDecorationPart().ifPresent(current -> {
    current.postfix = textField.getText();
    repaintDecorationPart();
  });
}
 
Example #25
Source File: GtForm.java    From GitToolBox with Apache License 2.0 4 votes vote down vote up
private void updateCurrentDecorationPartPrefix(JBTextField textField) {
  getCurrentDecorationPart().ifPresent(current -> {
    current.prefix = textField.getText();
    repaintDecorationPart();
  });
}
 
Example #26
Source File: CodeDialogBuilder.java    From android-codegenerator-plugin-intellij with Apache License 2.0 4 votes vote down vote up
public void addPackageSection(String defaultText) {
    topPanel.add(new JLabel(StringResources.PACKAGE_LABEL));
    packageText = new JBTextField(defaultText);
    topPanel.add(packageText);
}
 
Example #27
Source File: BuckSettingsUI.java    From Buck-IntelliJ-Plugin with Apache License 2.0 4 votes vote down vote up
private void init() {
  setLayout(new BorderLayout());
  JPanel container = this;

  mBuckPathField = new TextFieldWithBrowseButton();
  FileChooserDescriptor fileChooserDescriptor =
      new FileChooserDescriptor(true, false, false, false, false, false);
  mBuckPathField.addBrowseFolderListener(
      "",
      "Buck Executable Path",
      null,
      fileChooserDescriptor,
      TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT,
      false
  );
  mCustomizedInstallSettingField = new JBTextField();
  mCustomizedInstallSettingField.getEmptyText().setText(CUSTOMIZED_INSTALL_COMMAND_HINT);
  mCustomizedInstallSettingField.setEnabled(false);

  mRunAfterInstall = new JCheckBox("Run after install (-r)");
  mMultiInstallMode = new JCheckBox("Multi-install mode (-x)");
  mUninstallBeforeInstall = new JCheckBox("Uninstall before installing (-u)");
  mCustomizedInstallSetting = new JCheckBox("Use customized install setting:  ");
  initCustomizedInstallCommandListener();

  JPanel buckSettings = new JPanel(new GridBagLayout());
  buckSettings.setBorder(IdeBorderFactory.createTitledBorder("Buck Settings", true));
  container.add(container = new JPanel(new BorderLayout()), BorderLayout.NORTH);
  container.add(buckSettings, BorderLayout.NORTH);
  final GridBagConstraints constraints = new GridBagConstraints(0, 0, 1, 1, 0, 0,
      GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0);

  buckSettings.add(new JLabel("Buck Executable Path:"), constraints);
  constraints.gridx = 1;
  constraints.weightx = 1;
  constraints.fill = GridBagConstraints.HORIZONTAL;
  buckSettings.add(mBuckPathField, constraints);

  JPanel installSettings = new JPanel(new BorderLayout());
  installSettings.setBorder(IdeBorderFactory.createTitledBorder("Buck Install Settings", true));
  container.add(container = new JPanel(new BorderLayout()), BorderLayout.SOUTH);
  container.add(installSettings, BorderLayout.NORTH);

  installSettings.add(mRunAfterInstall, BorderLayout.NORTH);
  installSettings.add(installSettings = new JPanel(new BorderLayout()), BorderLayout.SOUTH);

  installSettings.add(mMultiInstallMode, BorderLayout.NORTH);
  installSettings.add(installSettings = new JPanel(new BorderLayout()), BorderLayout.SOUTH);

  installSettings.add(mUninstallBeforeInstall, BorderLayout.NORTH);
  installSettings.add(installSettings = new JPanel(new BorderLayout()), BorderLayout.SOUTH);

  final GridBagConstraints customConstraints = new GridBagConstraints(0, 0, 1, 1, 0, 0,
      GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0);
  JPanel customizedInstallSetting = new JPanel(new GridBagLayout());
  customizedInstallSetting.add(mCustomizedInstallSetting, customConstraints);
  customConstraints.gridx = 1;
  customConstraints.weightx = 1;
  customConstraints.fill = GridBagConstraints.HORIZONTAL;
  customizedInstallSetting.add(mCustomizedInstallSettingField, customConstraints);
  installSettings.add(customizedInstallSetting, BorderLayout.NORTH);
}
 
Example #28
Source File: IdeaUIComponentFactory.java    From netbeans-mmd-plugin with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public JTextField makeTextField() {
  return new JBTextField();
}
 
Example #29
Source File: PackageTemplateWrapper.java    From PackageTemplates with Apache License 2.0 4 votes vote down vote up
private void buildProperties() {
    // Header
    JLabel jlName = new JLabel(Localizer.get("Name"));
    JLabel jlDescription = new JLabel(Localizer.get("Description"));

    jtfName = new JBTextField(packageTemplate.getName());
    jtaDescription = new JTextArea(packageTemplate.getDescription());

    panelProperties.add(jlName, new CC().wrap().spanX().pad(0, 0, 0, 8).gapY("0", "4pt"));
    panelProperties.add(jtfName, new CC().spanX().growX().pushX().wrap());
    panelProperties.add(jlDescription, new CC().wrap().spanX().pad(0, 0, 0, 8).gapY("4pt", "4pt"));
    panelProperties.add(jtaDescription, new CC().spanX().growX().pushX().wrap().gapY("0", "4pt"));

    //FileTemplate Source
    ArrayList<FileTemplateSource> actionTypes = new ArrayList<>();
    actionTypes.add(FileTemplateSource.DEFAULT_ONLY);
    actionTypes.add(FileTemplateSource.PROJECT_ONLY);
    actionTypes.add(FileTemplateSource.PROJECT_PRIORITY);
    actionTypes.add(FileTemplateSource.DEFAULT_PRIORITY);

    cboxFileTemplateSource = new ComboBox(actionTypes.toArray());
    cboxFileTemplateSource.setRenderer(new FileTemplateSourceCellRenderer());
    cboxFileTemplateSource.setSelectedItem(packageTemplate.getFileTemplateSource());
    cboxFileTemplateSource.addActionListener(e -> {
        packageTemplate.setFileTemplateSource((FileTemplateSource) cboxFileTemplateSource.getSelectedItem());
    });

    if (mode == ViewMode.USAGE) {
        jtfName.setEditable(false);
        jtaDescription.setEditable(false);
        cboxFileTemplateSource.setEnabled(false);
    } else {
        // Properties
        cbShouldRegisterAction = new JBCheckBox(Localizer.get("property.ShouldRegisterAction"), packageTemplate.isShouldRegisterAction());
        cbSkipDefiningNames = new JBCheckBox(Localizer.get("property.SkipPresettings"), packageTemplate.isSkipDefiningNames());
        panelProperties.add(cbShouldRegisterAction, new CC().wrap().spanX());
        panelProperties.add(cbSkipDefiningNames, new CC().wrap().spanX());
    }

    // Properties
    cbSkipRootDirectory = new JBCheckBox(Localizer.get("property.SkipRootDirectory"), packageTemplate.isSkipRootDirectory());
    cbSkipRootDirectory.addItemListener(e -> {
        collectDataFromFields();
        reBuildElements();
    });
    cbShowReportDialog = new JBCheckBox(Localizer.get("property.ShowReportDialog"), packageTemplate.shouldShowReport());

    panelProperties.add(cbSkipRootDirectory, new CC().spanX().wrap());
    panelProperties.add(cbShowReportDialog, new CC().spanX().wrap());
    panelProperties.add(new JLabel(Localizer.get("FileTemplateSource")), new CC().spanX().split(2));
    panelProperties.add(cboxFileTemplateSource, new CC().pushX().growX().wrap());

}