Java 类com.intellij.openapi.ui.LabeledComponent 实例源码

项目:intellij-propertiessort    文件:SortDialog.java   
public SortDialog(Project project) {
    super(project);

    cbSpace = new JCheckBox("Add space around delimiter", null, true);
    cbSplit = new JCheckBox("Split in Groups", null, true);
    cbRearrangeAll = new JCheckBox("Rearrange intention over all", null, false);
    cbRearrangeGroup = new JCheckBox("Rearrange intention in groups", null, true);

    setTitle("Sort Properties");
    JPanel panel = new JPanel();
    panel.setBounds(61, 11, 81, 140);
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    panel.add(cbSpace);
    panel.add(cbSplit);
    panel.add(cbRearrangeAll);
    panel.add(cbRearrangeGroup);

    component = LabeledComponent.create(panel, "Sort Options");

    init();
}
项目:intellij-ce-playground    文件:TypeMigrationDialog.java   
@Override
protected JComponent createCenterPanel() {
  final JPanel panel = new JPanel(new GridBagLayout());
  final GridBagConstraints gc = new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1, 0, GridBagConstraints.NORTHWEST,
                                                       GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 0), 0, 0);
  final PsiType type = getRootType();
  final String typeText = type != null ? type.getPresentableText() : "<unknown>";
  panel.add(new JLabel("Migrate " + getElementPresentation(myRoot) + " \"" + typeText + "\" to"), gc);
  panel.add(myToTypeEditor, gc);

  LabeledComponent<ScopeChooserCombo> scopeChooserComponent = new LabeledComponent<ScopeChooserCombo>();
  scopeChooserComponent.setComponent(myScopeChooserCombo);
  scopeChooserComponent.setText("Choose scope where change signature may occur");
  panel.add(scopeChooserComponent, gc);
  return panel;
}
项目:intellij-ce-playground    文件:RawCommandLineEditor.java   
public RawCommandLineEditor(final Function<String, List<String>> lineParser, final Function<List<String>, String> lineJoiner) {
  super(new BorderLayout());
  myTextField = new TextFieldWithBrowseButton(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      if (myDialogCaption == null) {
        Container parent = getParent();
        if (parent instanceof LabeledComponent) {
          parent = parent.getParent();
        }
        LOG.error("Did not call RawCommandLineEditor.setDialogCaption() in " + parent);
        myDialogCaption = "Parameters";
      }
      Messages.showTextAreaDialog(myTextField.getTextField(), myDialogCaption, "EditParametersPopupWindow", lineParser, lineJoiner);
    }
  });
  myTextField.setButtonIcon(AllIcons.Actions.ShowViewer);
  add(myTextField, BorderLayout.CENTER);
  setDescriptor(null);
}
项目:intellij-ce-playground    文件:SetupTaskDialog.java   
public List<String> getCommandLine() {
  if (myCurrentCard.equals(CARD_COMMAND_LINE)) {
    return StringUtil.split(myCommandLineField.getText(), " ");
  }
  List<String> result = new ArrayList<String>();
  for (Map.Entry<SetupTask.Option, JComponent> entry : myOptionComponents.entrySet()) {
    final SetupTask.Option option = entry.getKey();
    if (option.checkbox) {
      JCheckBox checkBox = (JCheckBox)entry.getValue();
      if (checkBox.isSelected() != option.negative) {
        result.add(option.name);
      }
    }
    else {
      LabeledComponent<JTextField> textField = (LabeledComponent<JTextField>)entry.getValue();
      String text = textField.getComponent().getText();
      if (text.length() > 0) {
        result.add("--" + option.name + text);
      }
    }
  }
  return result;
}
项目:intellij-ce-playground    文件:DependsOnGroupsInspection.java   
@Nullable
public JComponent createOptionsPanel() {
  final LabeledComponent<JTextField> definedGroups = new LabeledComponent<JTextField>();
  definedGroups.setText("&Defined Groups");
  final JTextField textField = new JTextField(StringUtil.join(ArrayUtil.toStringArray(groups), ","));
  textField.getDocument().addDocumentListener(new DocumentAdapter() {
    protected void textChanged(final DocumentEvent e) {
      groups.clear();
      final String[] groupsFromString = textField.getText().split("[, ]");
      ContainerUtil.addAll(groups, groupsFromString);
    }
  });
  definedGroups.setComponent(textField);
  final JPanel optionsPanel = new JPanel(new BorderLayout());
  optionsPanel.add(definedGroups, BorderLayout.NORTH);
  return optionsPanel;
}
项目:intellij-ce-playground    文件:MavenEnvironmentForm.java   
private void createUIComponents() {
  mavenHomeField = new TextFieldWithHistory();
  mavenHomeField.setHistorySize(-1);
  final ArrayList<String> foundMavenHomes = new ArrayList<String>();
  foundMavenHomes.add(MavenServerManager.BUNDLED_MAVEN_2);
  foundMavenHomes.add(MavenServerManager.BUNDLED_MAVEN_3);
  final File mavenHomeDirectory = MavenUtil.resolveMavenHomeDirectory(null);
  if (mavenHomeDirectory != null) {
    foundMavenHomes.add(FileUtil.toSystemIndependentName(mavenHomeDirectory.getPath()));
  }
  mavenHomeField.setHistory(foundMavenHomes);
  mavenHomeComponent = LabeledComponent.create(
    new ComponentWithBrowseButton<TextFieldWithHistory>(mavenHomeField, null), "Maven &amp;home directory");

  final JBLabel versionLabel = new JBLabel();
  versionLabel.setOpaque(true);
  versionLabel.setVerticalAlignment(SwingConstants.TOP);
  versionLabel.setVerticalTextPosition(SwingConstants.TOP);
  mavenVersionLabelComponent = LabeledComponent.create(versionLabel, "");
}
项目:intellij-ce-playground    文件:ProjectSettingsPanel.java   
public JComponent getMainComponent() {

    final LabeledComponent<JComboBox> component = new LabeledComponent<JComboBox>();
    component.setText("Default &project copyright:");
    component.setLabelLocation(BorderLayout.WEST);
    component.setComponent(myProfilesComboBox);
    ElementProducer<ScopeSetting> producer = new ElementProducer<ScopeSetting>() {
      @Override
      public ScopeSetting createElement() {
        return new ScopeSetting(DefaultScopesProvider.getAllScope(), myProfilesModel.getAllProfiles().values().iterator().next());
      }

      @Override
      public boolean canCreateElement() {
        return !myProfilesModel.getAllProfiles().isEmpty();
      }
    };
    ToolbarDecorator decorator = ToolbarDecorator.createDecorator(myScopeMappingTable, producer);
    return JBUI.Panels.simplePanel(0, 10)
      .addToTop(component)
      .addToCenter(decorator.createPanel())
      .addToBottom(myScopesLink);
  }
项目:PerlRun    文件:Form.java   
@Override
protected void addComponents() {
    interpreterNameField = new TextFieldWithBrowseButton();
    interpreterNameField.addBrowseFolderListener("Choose interpreter...", "", getProject(), FileChooserDescriptorFactory.createSingleLocalFileDescriptor());
    LabeledComponent<JComponent> interpreterNameComponent = LabeledComponent.create(createComponentWithMacroBrowse(interpreterNameField), "Interpreter:");
    interpreterNameComponent.setLabelLocation(BorderLayout.WEST);
    add(interpreterNameComponent);

    interpreterOptionsComponent = LabeledComponent.create(new RawCommandLineEditor(), "Interpreter options");
    interpreterOptionsComponent.setLabelLocation(BorderLayout.WEST);
    add(interpreterOptionsComponent);

    programNameField = new TextFieldWithBrowseButton();
    programNameField.addBrowseFolderListener("Choose script...", "", getProject(), FileChooserDescriptorFactory.createSingleLocalFileDescriptor());
    LabeledComponent<JComponent> programNameComponent = LabeledComponent.create(createComponentWithMacroBrowse(programNameField), "Script:");
    programNameComponent.setLabelLocation(BorderLayout.WEST);
    add(programNameComponent);

    programParametersComponent = LabeledComponent.create(new RawCommandLineEditor(), "Script parameters:");
    programParametersComponent.setLabelLocation(BorderLayout.WEST);
    add(programParametersComponent);
}
项目:JHelper    文件:EditTestsDialog.java   
private JPanel generateTestPanel() {
    JPanel testPanel = new JPanel(new GridLayout(2, 1, GRID_LAYOUT_GAP, GRID_LAYOUT_GAP));

    input = generateSavingTextArea();
    JPanel inputPanel = LabeledComponent.create(new JBScrollPane(input), "Input");

    output = generateSavingTextArea();
    outputPanel = LabeledComponent.create(new JBScrollPane(output), "Output");

    knowAnswer = new JCheckBox("Know answer?");
    knowAnswer.addActionListener(e -> saveCurrentTest());
    JPanel outputAndCheckBoxPanel = new JPanel(new BorderLayout());
    outputAndCheckBoxPanel.add(knowAnswer, BorderLayout.NORTH);
    outputAndCheckBoxPanel.add(outputPanel, BorderLayout.CENTER);
    testPanel.add(inputPanel);
    testPanel.add(outputAndCheckBoxPanel);
    return testPanel;
}
项目:consulo-nodejs    文件:NodeJSConfigurationPanelBase.java   
@Override
protected void initComponents()
{
    myModuleBox = new ComboBox();
    myModuleBox.setRenderer(new ModuleListCellRenderer());

    myVmParametersComponent = LabeledComponent.create(new RawCommandLineEditor(), "VM arguments");
    myVmParametersComponent.setLabelLocation(BorderLayout.WEST);
    copyDialogCaption(myVmParametersComponent);

    myUseAlternativeBundleCheckBox = new JCheckBox("Use alternative bundle: ");
    ProjectSdksModel projectSdksModel = new ProjectSdksModel();
    projectSdksModel.reset();

    myAlternativeBundleComboBox = new SdkComboBox(projectSdksModel, Conditions.<SdkTypeId>is(NodeJSBundleType.getInstance()), true);
    myAlternativeBundleComboBox.setEnabled(false);
    myUseAlternativeBundleCheckBox.addItemListener(new ItemListener()
    {
        @Override
        public void itemStateChanged(ItemEvent e)
        {
            myAlternativeBundleComboBox.setEnabled(myUseAlternativeBundleCheckBox.isSelected());
        }
    });
    super.initComponents();
}
项目:tools-idea    文件:RawCommandLineEditor.java   
public RawCommandLineEditor(final Function<String, List<String>> lineParser, final Function<List<String>, String> lineJoiner) {
  super(new BorderLayout());
  myTextField = new TextFieldWithBrowseButton(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      if (myDialogCaption == null) {
        Container parent = getParent();
        if (parent instanceof LabeledComponent) {
          parent = parent.getParent();
        }
        LOG.error("Did not call RawCommandLineEditor.setDialogCaption() in " + parent);
        myDialogCaption = "Parameters";
      }
      Messages.showTextAreaDialog(myTextField.getTextField(), myDialogCaption, "EditParametersPopupWindow", lineParser, lineJoiner);
    }
  });
  myTextField.setButtonIcon(AllIcons.Actions.ShowViewer);
  add(myTextField, BorderLayout.CENTER);
  setDescriptor(null);
}
项目:tools-idea    文件:DependsOnGroupsInspection.java   
@Nullable
public JComponent createOptionsPanel() {
  final LabeledComponent<JTextField> definedGroups = new LabeledComponent<JTextField>();
  definedGroups.setText("&Defined Groups");
  final JTextField textField = new JTextField(StringUtil.join(ArrayUtil.toStringArray(groups), ","));
  textField.getDocument().addDocumentListener(new DocumentAdapter() {
    protected void textChanged(final DocumentEvent e) {
      groups.clear();
      final String[] groupsFromString = textField.getText().split("[, ]");
      ContainerUtil.addAll(groups, groupsFromString);
    }
  });
  definedGroups.setComponent(textField);
  final JPanel optionsPanel = new JPanel(new BorderLayout());
  optionsPanel.add(definedGroups, BorderLayout.NORTH);
  return optionsPanel;
}
项目:tools-idea    文件:ProjectSettingsPanel.java   
public JComponent getMainComponent() {
  final JPanel panel = new JPanel(new BorderLayout(0, 10));
  final LabeledComponent<JComboBox> component = new LabeledComponent<JComboBox>();
  component.setText("Default &project copyright:");
  component.setLabelLocation(BorderLayout.WEST);
  component.setComponent(myProfilesComboBox);
  panel.add(component, BorderLayout.NORTH);
  ElementProducer<ScopeSetting> producer = new ElementProducer<ScopeSetting>() {
    @Override
    public ScopeSetting createElement() {
      return new ScopeSetting(DefaultScopesProvider.getAllScope(), myProfilesModel.getAllProfiles().values().iterator().next());
    }

    @Override
    public boolean canCreateElement() {
      return !myProfilesModel.getAllProfiles().isEmpty();
    }
  };
  ToolbarDecorator decorator = ToolbarDecorator.createDecorator(myScopeMappingTable, producer);
  panel.add(decorator.createPanel(), BorderLayout.CENTER);
  panel.add(myScopesLink, BorderLayout.SOUTH);
  return panel;
}
项目:consulo-javaee    文件:JavaEEServerConfigurationEditor.java   
@NotNull
@Override
protected JComponent createEditor()
{
    JPanel verticalLayout = new JPanel(new VerticalFlowLayout(0, 0));

    ProjectSdksModel model = new ProjectSdksModel();
    model.reset();

    myBundleBox = new SdkComboBox(model, Conditions.equalTo(myBundleType), true);
    verticalLayout.add(LabeledComponent.left(myBundleBox, J2EEBundle.message("label.run.configuration.properties.application.server")));

    JPanel openBrowserPanel = new JPanel();
    openBrowserPanel.setBorder(IdeBorderFactory.createTitledBorder("Open browser"));
    verticalLayout.add(openBrowserPanel);

    if(myBundleType.isJreCustomizable())
    {
        AlternativeJREPanel panel = new AlternativeJREPanel();
        verticalLayout.add(panel);
    }

    verticalLayout.add(mySettingsWrapper);

    return verticalLayout;
}
项目:consulo-dotnet    文件:DotNetCoverageConfigurationEditor.java   
public DotNetCoverageConfigurationEditor()
{
    myPanel.add(myEnabledCheckBox);
    myPanel.add(LabeledComponent.left(myRunnersBox, "Runner"));
    myRunnersBox.setRenderer(new ColoredListCellRendererWrapper<Object>()
    {
        @Override
        protected void doCustomize(JList list, Object value, int index, boolean selected, boolean hasFocus)
        {
            if(value == null)
            {
                append("<none>");
            }
            else if(value instanceof String)
            {
                append((String) value, SimpleTextAttributes.ERROR_ATTRIBUTES);
            }
            else if(value instanceof CoverageRunner)
            {
                append(((CoverageRunner) value).getPresentableName());
            }
        }
    });
}
项目:consulo    文件:RawCommandLineEditor.java   
public RawCommandLineEditor(final Function<String, List<String>> lineParser, final Function<List<String>, String> lineJoiner) {
  super(new BorderLayout());
  myTextField = new TextFieldWithBrowseButton(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      if (StringUtil.isEmpty(myDialogCaption)) {
        Container parent = getParent();
        if (parent instanceof LabeledComponent) {
          parent = parent.getParent();
        }
        LOG.error("Did not call RawCommandLineEditor.setDialogCaption() in " + parent);
        myDialogCaption = "Parameters";
      }
      Messages.showTextAreaDialog(myTextField.getTextField(), myDialogCaption, "EditParametersPopupWindow", lineParser, lineJoiner);
    }
  });
  myTextField.setButtonIcon(AllIcons.Actions.ShowViewer);
  add(myTextField, BorderLayout.CENTER);
  setDescriptor(null);
}
项目:consulo    文件:ProjectSettingsPanel.java   
public JComponent getMainComponent() {
  final JPanel panel = new JPanel(new BorderLayout(0, 10));
  final LabeledComponent<JComboBox> component = new LabeledComponent<JComboBox>();
  component.setText("Default &project copyright:");
  component.setLabelLocation(BorderLayout.WEST);
  component.setComponent(myProfilesComboBox);
  panel.add(component, BorderLayout.NORTH);
  ElementProducer<ScopeSetting> producer = new ElementProducer<ScopeSetting>() {
    @Override
    public ScopeSetting createElement() {
      return new ScopeSetting(DefaultScopesProvider.getAllScope(), myProfilesModel.getAllProfiles().values().iterator().next());
    }

    @Override
    public boolean canCreateElement() {
      return !myProfilesModel.getAllProfiles().isEmpty();
    }
  };
  ToolbarDecorator decorator = ToolbarDecorator.createDecorator(myScopeMappingTable, producer);
  panel.add(decorator.createPanel(), BorderLayout.CENTER);
  panel.add(myScopesLink, BorderLayout.SOUTH);
  return panel;
}
项目:consulo    文件:ArtifactConfigurable.java   
@Override
protected JComponent createTopRightComponent(final JTextField nameField) {
  final ComboBox artifactTypeBox = new ComboBox();
  for (ArtifactType type : ArtifactType.EP_NAME.getExtensions()) {
    artifactTypeBox.addItem(type);
  }

  artifactTypeBox.setRenderer(new ArtifactTypeCellRenderer(artifactTypeBox.getRenderer()));

  artifactTypeBox.setSelectedItem(getArtifact().getArtifactType());
  artifactTypeBox.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      final ArtifactType selected = (ArtifactType)artifactTypeBox.getSelectedItem();
      if (selected != null && !Comparing.equal(selected, getArtifact().getArtifactType())) {
        getEditor().setArtifactType(selected);
      }
    }
  });

  return LabeledComponent.left(artifactTypeBox, "Type");
}
项目:consulo    文件:CommonProgramParametersPanel.java   
protected void initComponents() {
  myProgramParametersComponent = LabeledComponent.create(new RawCommandLineEditor(),
                                                         ExecutionBundle.message("run.configuration.program.parameters"));

  FileChooserDescriptor fileChooserDescriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
  //noinspection DialogTitleCapitalization
  fileChooserDescriptor.setTitle(ExecutionBundle.message("select.working.directory.message"));
  myWorkingDirectoryComboBox = new MacroComboBoxWithBrowseButton(fileChooserDescriptor, getProject());

  myWorkingDirectoryComponent = LabeledComponent.create(myWorkingDirectoryComboBox, ExecutionBundle.message("run.configuration.working.directory.label"));
  myEnvVariablesComponent = new EnvironmentVariablesComponent();

  myEnvVariablesComponent.setLabelLocation(BorderLayout.WEST);
  myProgramParametersComponent.setLabelLocation(BorderLayout.WEST);
  myWorkingDirectoryComponent.setLabelLocation(BorderLayout.WEST);

  addComponents();

  setPreferredSize(new Dimension(10, 10));

  copyDialogCaption(myProgramParametersComponent);
}
项目:consulo    文件:RunConfigurable.java   
private void showFolderField(final ConfigurationType type, final DefaultMutableTreeNode node, final String folderName) {
  myRightPanel.removeAll();
  JPanel panel = new JPanel(new VerticalFlowLayout(0, 0));
  final JTextField textField = new JTextField(folderName);
  textField.getDocument().addDocumentListener(new DocumentAdapter() {
    @Override
    protected void textChanged(DocumentEvent e) {
      node.setUserObject(textField.getText());
      myTreeModel.reload(node);
    }
  });
  panel.add(LabeledComponent.left(textField, "Folder name"));
  panel.add(new JLabel(ExecutionBundle.message("run.configuration.rename.folder.disclaimer")));

  myRightPanel.add(panel);
  myRightPanel.revalidate();
  myRightPanel.repaint();
  if (isFolderCreating) {
    textField.selectAll();
    IdeFocusManager.getGlobalInstance().doForceFocusWhenFocusSettlesDown(textField);
  }
}
项目:android-parcelable-intellij-plugin    文件:GenerateDialog.java   
protected GenerateDialog(final PsiClass psiClass) {
    super(psiClass.getProject());
    setTitle("Select Fields for Parcelable Generation");

    fieldsCollection = new CollectionListModel<PsiField>();
    final JBList fieldList = new JBList(fieldsCollection);
    fieldList.setCellRenderer(new DefaultPsiElementCellRenderer());
    final ToolbarDecorator decorator = ToolbarDecorator.createDecorator(fieldList).disableAddAction();
    final JPanel panel = decorator.createPanel();

    fieldsComponent = LabeledComponent.create(panel, "Fields to include in Parcelable");

    includeSubclasses = new JBCheckBox("Include fields from base classes");
    setupCheckboxClickAction(psiClass);
    showCheckbox = psiClass.getFields().length != psiClass.getAllFields().length;

    updateFieldsDisplay(psiClass);
    init();
}
项目:educational-plugin    文件:PyStudyDirectoryProjectGenerator.java   
@Nullable
@Override
public LabeledComponent<JComponent> getLanguageSettingsComponent(@NotNull Course selectedCourse) {
  final Project project = ProjectManager.getInstance().getDefaultProject();
  PyConfigurableInterpreterList instance = PyConfigurableInterpreterList.getInstance(project);
  if (instance == null) {
    return null;
  }
  final List<Sdk> sdks = instance.getAllPythonSdks();
  VirtualEnvProjectFilter.removeAllAssociated(sdks);
  // by default we create new virtual env in project, we need to add this non-existing sdk to sdk list
  ProjectJdkImpl fakeSdk = createFakeSdk(selectedCourse);
  if (fakeSdk != null) {
    sdks.add(0, fakeSdk);
  }
  PythonSdkChooserCombo combo = new PythonSdkChooserCombo(project, sdks, sdk -> true);
  if (fakeSdk != null) {
    patchRenderer(fakeSdk, combo);
    combo.getComboBox().setSelectedItem(fakeSdk);
  }
  if (SystemInfo.isMac && !UIUtil.isUnderDarcula()) {
    combo.putClientProperty("JButton.buttonType", null);
  }
  combo.setButtonIcon(PythonIcons.Python.InterpreterGear);
  combo.addChangedListener(e -> {
    Sdk selectedSdk = (Sdk)combo.getComboBox().getSelectedItem();
    mySettings.setSdk(selectedSdk == fakeSdk ? null : selectedSdk);
  });
  return LabeledComponent.create(combo, "Interpreter", BorderLayout.WEST);
}
项目:educational-plugin    文件:EduIntellijCourseProjectGeneratorBase.java   
@Nullable
@Override
public LabeledComponent<JComponent> getLanguageSettingsComponent(@NotNull Course selectedCourse) {
  myModel = ProjectStructureConfigurable.getInstance(ProjectManager.getInstance().getDefaultProject()).getProjectJdksModel();
  myJdkComboBox = new JdkComboBox(myModel, sdkTypeId -> sdkTypeId instanceof JavaSdkType && !((JavaSdkType)sdkTypeId).isDependent(), sdk -> true, sdkTypeId -> sdkTypeId instanceof JavaSdkType && !((JavaSdkType)sdkTypeId).isDependent(), true);
  ComboboxWithBrowseButton comboboxWithBrowseButton = new ComboboxWithBrowseButton(myJdkComboBox);
  FixedSizeButton setupButton = comboboxWithBrowseButton.getButton();
  myJdkComboBox.setSetupButton(setupButton, null, myModel, (JdkComboBox.JdkComboBoxItem) myJdkComboBox.getModel().getSelectedItem(), null, false);
  return LabeledComponent.create(comboboxWithBrowseButton, "Jdk", BorderLayout.WEST);
}
项目:livingdoc-intellij    文件:RunConfigurationEditor.java   
private void createUIComponents() {
    myMainClass = new LabeledComponent<>();
    myMainClass.setComponent(new EditorTextFieldWithBrowseButton(myProject, true, (declaration, place) -> {

        if (declaration instanceof PsiClass) {
            final PsiClass aClass = (PsiClass) declaration;
            if (ConfigurationUtil.MAIN_CLASS.value(aClass) && PsiMethodUtil.findMainMethod(aClass) != null) {
                return JavaCodeFragment.VisibilityChecker.Visibility.VISIBLE;
            }
        }
        return JavaCodeFragment.VisibilityChecker.Visibility.NOT_VISIBLE;
    }
    ));
}
项目:dimenify    文件:SingleDimenDialog.java   
private void initializePanel(boolean isDp) {
    controlPanel = new JPanel();


    addInitialFields(isDp);
    layout = new GroupLayout(controlPanel);
    controlPanel.setLayout(layout);
    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);
    setLayoutConstraints();
    component = LabeledComponent.create(controlPanel, "");
}
项目:dimenify    文件:BulkDimenDialog.java   
private void initializePanel() {
    controlPanel = new JPanel();
    addInitialFields();
    layout = new GroupLayout(controlPanel);
    controlPanel.setLayout(layout);
    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);
    setLayoutConstraints();
    component = LabeledComponent.create(controlPanel, "");
}
项目:intellij-ce-playground    文件:JarApplicationConfigurable.java   
private void createUIComponents() {
  myJarPathComponent = new LabeledComponent<TextFieldWithBrowseButton>();
  TextFieldWithBrowseButton textFieldWithBrowseButton = new TextFieldWithBrowseButton();
  textFieldWithBrowseButton.addBrowseFolderListener("Choose JAR File", null, myProject,
                                                    new FileChooserDescriptor(false, false, true, true, false, false));
  myJarPathComponent.setComponent(textFieldWithBrowseButton);
}
项目:intellij-ce-playground    文件:ApplicationConfigurable.java   
private void createUIComponents() {
  myMainClass = new LabeledComponent<EditorTextFieldWithBrowseButton>();
  myMainClass.setComponent(new EditorTextFieldWithBrowseButton(myProject, true, new JavaCodeFragment.VisibilityChecker() {
    @Override
    public Visibility isDeclarationVisible(PsiElement declaration, PsiElement place) {
      if (declaration instanceof PsiClass) {
        final PsiClass aClass = (PsiClass)declaration;
        if (ConfigurationUtil.MAIN_CLASS.value(aClass) && PsiMethodUtil.findMainMethod(aClass) != null || place.getParent() != null && myModuleSelector.findClass(((PsiClass)declaration).getQualifiedName()) != null) {
          return Visibility.VISIBLE;
        }
      }
      return Visibility.NOT_VISIBLE;
    }
  }));
}
项目:intellij-ce-playground    文件:CommonJavaParametersPanel.java   
@Override
protected void addComponents() {
  myVMParametersComponent = LabeledComponent.create(new RawCommandLineEditor(),
                                           ExecutionBundle.message("run.configuration.java.vm.parameters.label"));
  copyDialogCaption(myVMParametersComponent);

  myVMParametersComponent.setLabelLocation(BorderLayout.WEST);

  add(myVMParametersComponent);
  super.addComponents();
}
项目:intellij-ce-playground    文件:InplaceIntroduceParameterUI.java   
@Override
protected JPanel createReplaceFieldsWithGettersPanel() {
  final LabeledComponent<JComboBox> component = new LabeledComponent<JComboBox>();
  myReplaceFieldsCb = new JComboBox(new Integer[]{IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_ALL,
    IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE,
    IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE});
  myReplaceFieldsCb.setRenderer(new ListCellRendererWrapper<Integer>() {
    @Override
    public void customize(JList list, Integer value, int index, boolean selected, boolean hasFocus) {
      switch (value) {
        case IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE:
          setText(UIUtil.removeMnemonic(RefactoringBundle.message("do.not.replace")));
          break;
        case IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE:
          setText(UIUtil.removeMnemonic(RefactoringBundle.message("replace.fields.inaccessible.in.usage.context")));
          break;
        default:
          setText(UIUtil.removeMnemonic(RefactoringBundle.message("replace.all.fields")));
      }
    }
  });
  myReplaceFieldsCb.setSelectedItem(JavaRefactoringSettings.getInstance().INTRODUCE_PARAMETER_REPLACE_FIELDS_WITH_GETTERS);
  KeyboardComboSwitcher.setupActions(myReplaceFieldsCb, myProject);
  component.setComponent(myReplaceFieldsCb);
  component.setText(RefactoringBundle.message("replace.fields.used.in.expressions.with.their.getters"));
  component.getLabel().setDisplayedMnemonic('u');
  component.setLabelLocation(BorderLayout.NORTH);
  component.setBorder(IdeBorderFactory.createEmptyBorder(3, 3, 2, 2));
  return component;
}
项目:intellij-ce-playground    文件:ConfigurationsTest.java   
public void testEditJUnitConfiguration() throws ConfigurationException {
  if (PlatformTestUtil.COVERAGE_ENABLED_BUILD) return;

  PsiClass testA = findTestA(getModule2());
  JUnitConfiguration configuration = createConfiguration(testA);
  JUnitConfigurable editor = new JUnitConfigurable(myProject);
  try {
    Configurable configurable = new RunConfigurationConfigurableAdapter(editor, configuration);
    configurable.reset();
    final EditorTextFieldWithBrowseButton component =
      ((LabeledComponent<EditorTextFieldWithBrowseButton>)editor.getTestLocation(JUnitConfigurationModel.CLASS)).getComponent();
    assertEquals(testA.getQualifiedName(), component.getText());
    PsiClass otherTest = findClass(getModule2(), "test2.Test2");
    component.setText(otherTest.getQualifiedName());
    configurable.apply();
    assertEquals(otherTest.getName(), configuration.getName());
    String specialName = "My name";
    configuration.setName(specialName);
    configuration.setNameChangedByUser(true);
    configurable.reset();
    component.setText(testA.getQualifiedName());
    configurable.apply();
    assertEquals(specialName, configuration.getName());
  }
  finally {
    Disposer.dispose(editor);
  }
}
项目:intellij-ce-playground    文件:MergePanel2.java   
public MergePanel2(DialogBuilder builder, @NotNull Disposable parent) {
  ArrayList<EditorPlace> editorPlaces = new ArrayList<EditorPlace>();
  EditorPlace.EditorListener placeListener = new EditorPlace.EditorListener() {
    public void onEditorCreated(EditorPlace place) {
      if (myDuringCreation) return;
      disposeMergeList();
      myDuringCreation = true;
      try {
        tryInitView();
      }
      finally {
        myDuringCreation = false;
      }
    }

    public void onEditorReleased(Editor releasedEditor) {
      LOG.assertTrue(!myDuringCreation);
      disposeMergeList();
    }
  };
  for (int i = 0; i < EDITORS_COUNT; i++) {
    EditorPlace editorPlace = new EditorPlace(new DiffEditorState(i), indexToColumn(i), this);
    Disposer.register(parent, editorPlace);
    editorPlaces.add(editorPlace);
    editorPlace.addListener(placeListener);
    myEditorsPanels[i] = new LabeledComponent();
    myEditorsPanels[i].setLabelLocation(BorderLayout.NORTH);
    myEditorsPanels[i].setComponent(editorPlace);
  }
  FontSizeSynchronizer.attachTo(editorPlaces);
  myPanel = new DiffPanelOuterComponent(TextDiffType.MERGE_TYPES, createToolbar());
  myPanel.insertDiffComponent(new ThreePanels(myEditorsPanels, myDividers), new MyScrollingPanel());
  myProvider = new MyDataProvider();
  myPanel.setDataProvider(myProvider);
  myBuilder = builder;
}
项目:intellij-ce-playground    文件:MergePanel2.java   
@NotNull
private Collection<EditorPlace> getEditorPlaces() {
  Collection<EditorPlace> editorPlaces = new ArrayList<EditorPlace>(3);
  for (LabeledComponent editorsPanel : myEditorsPanels) {
    editorPlaces.add((EditorPlace) editorsPanel.getComponent());
  }
  return editorPlaces;
}
项目:intellij-ce-playground    文件:MergePanel2.java   
public void setDiffRequest(DiffRequest data) {
  setTitle(data.getWindowTitle());
  disposeMergeList();
  for (int i = 0; i < EDITORS_COUNT; i++) {
    getEditorPlace(i).setDocument(null);
  }
  LOG.assertTrue(!myDuringCreation);
  myDuringCreation = true;
  myProvider.putData(data.getGenericData());
  try {
    myData = data;
    String[] titles = myData.getContentTitles();
    for (int i = 0; i < myEditorsPanels.length; i++) {
      LabeledComponent editorsPanel = myEditorsPanels[i];
      editorsPanel.getLabel().setText(titles[i].isEmpty() ? " " : titles[i]);
    }
    createMergeList();
    data.customizeToolbar(myPanel.resetToolbar());
    myPanel.registerToolbarActions();
    if ( data instanceof MergeRequestImpl && myBuilder != null){
      Convertor<DialogWrapper, Boolean> preOkHook = new Convertor<DialogWrapper, Boolean>() {
        @Override
        public Boolean convert(DialogWrapper dialog) {
          ChangeCounter counter = ChangeCounter.getOrCreate(myMergeList);
          int changes = counter.getChangeCounter();
          int conflicts = counter.getConflictCounter();
          if (changes == 0 && conflicts == 0) return true;
          return Messages.showYesNoDialog(dialog.getRootPane(),
                                          DiffBundle.message("merge.dialog.apply.partially.resolved.changes.confirmation.message", changes, conflicts),
                                          DiffBundle.message("apply.partially.resolved.merge.dialog.title"),
                                          Messages.getQuestionIcon()) == Messages.YES;
        }
      };
      ((MergeRequestImpl)data).setActions(myBuilder, this, preOkHook);
    }
  }
  finally {
    myDuringCreation = false;
  }
}
项目:intellij-ce-playground    文件:ExportToHTMLDialog.java   
public static LabeledComponent<TextFieldWithBrowseButton> assignLabel(TextFieldWithBrowseButton targetDirectoryField, Project project) {
  LabeledComponent<TextFieldWithBrowseButton> labeledComponent = new LabeledComponent<TextFieldWithBrowseButton>();
  labeledComponent.setText(CodeEditorBundle.message("export.to.html.output.directory.label"));
  targetDirectoryField.addBrowseFolderListener(CodeEditorBundle.message("export.to.html.select.output.directory.title"),
                                               CodeEditorBundle.message("export.to.html.select.output.directory.description"),
                                               project, FileChooserDescriptorFactory.createSingleFolderDescriptor());
  labeledComponent.setComponent(targetDirectoryField);
  return labeledComponent;
}
项目:intellij-ce-playground    文件:CommonProgramParametersPanel.java   
protected void initComponents() {
  myProgramParametersComponent = LabeledComponent.create(new RawCommandLineEditor(),
                                                         ExecutionBundle.message("run.configuration.program.parameters"));

  FileChooserDescriptor fileChooserDescriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
  //noinspection DialogTitleCapitalization
  fileChooserDescriptor.setTitle(ExecutionBundle.message("select.working.directory.message"));
  myWorkingDirectoryField = new TextFieldWithBrowseButton();
  myWorkingDirectoryField.addBrowseFolderListener(new MacroAwareTextBrowseFolderListener(fileChooserDescriptor, getProject()) {
    @Override
    public void actionPerformed(ActionEvent e) {
      myFileChooserDescriptor.putUserData(LangDataKeys.MODULE_CONTEXT, myModuleContext);
      setProject(getProject());
      super.actionPerformed(e);
    }
  });

  myWorkingDirectoryComponent = LabeledComponent.create(createComponentWithMacroBrowse(myWorkingDirectoryField), ExecutionBundle.message("run.configuration.working.directory.label"));
  myEnvVariablesComponent = new EnvironmentVariablesComponent();

  myEnvVariablesComponent.setLabelLocation(BorderLayout.WEST);
  myProgramParametersComponent.setLabelLocation(BorderLayout.WEST);
  myWorkingDirectoryComponent.setLabelLocation(BorderLayout.WEST);

  addComponents();

  setPreferredSize(new Dimension(10, 10));

  setAnchor(myEnvVariablesComponent.getLabel());
}
项目:intellij-ce-playground    文件:SetupTaskDialog.java   
@Override
public JComponent getPreferredFocusedComponent() {
  if (myCurrentCard.equals(CARD_OPTIONS)) {
    if (myOptionComponents.size() > 0) {
      final JComponent component = myOptionComponents.values().iterator().next();
      return component instanceof LabeledComponent ? ((LabeledComponent)component).getComponent() : component;
    }
    return super.getPreferredFocusedComponent();
  }
  return myCommandLineField;
}
项目:intellij-ce-playground    文件:ProjectSpecificSettingsStep.java   
@Override
protected JPanel createBasePanel() {
  final JPanel panel = super.createBasePanel();

  final Project project = ProjectManager.getInstance().getDefaultProject();
  final List<Sdk> sdks = PyConfigurableInterpreterList.getInstance(project).getAllPythonSdks();
  VirtualEnvProjectFilter.removeAllAssociated(sdks);
  Sdk compatibleSdk = sdks.isEmpty() ? null : sdks.iterator().next();
  DirectoryProjectGenerator generator = getProjectGenerator();
  if (generator instanceof PyFrameworkProjectGenerator && !((PyFrameworkProjectGenerator)generator).supportsPython3()) {
    if (compatibleSdk != null && PythonSdkType.getLanguageLevelForSdk(compatibleSdk).isPy3K()) {
      Sdk python2Sdk = PythonSdkType.findPython2Sdk(sdks);
      if (python2Sdk != null) {
        compatibleSdk = python2Sdk;
      }
    }
  }

  final Sdk preferred = compatibleSdk;
  mySdkCombo = new PythonSdkChooserCombo(project, sdks, new Condition<Sdk>() {
    @Override
    public boolean value(Sdk sdk) {
      return sdk == preferred;
    }
  });
  mySdkCombo.setButtonIcon(PythonIcons.Python.InterpreterGear);

  final LabeledComponent<PythonSdkChooserCombo> labeled = LabeledComponent.create(mySdkCombo, "Interpreter");
  labeled.setLabelLocation(BorderLayout.WEST);
  UIUtil.mergeComponentsWithAnchor(labeled, (PanelWithAnchor)panel.getComponent(0));
  panel.add(labeled);
  final JPanel basePanelExtension = extendBasePanel();
  if (basePanelExtension != null) {
    panel.add(basePanelExtension);
  }

  return panel;
}
项目:intellij-ce-playground    文件:AppEngineSupportProvider.java   
private AppEngineSupportConfigurable(FrameworkSupportModel model) {
  myFrameworkSupportModel = model;
  mySdkEditor = new AppEngineSdkEditor(model.getProject());
  mySdkPanel.add(LabeledComponent.create(mySdkEditor.getMainComponent(), "Google App Engine SDK:"), BorderLayout.CENTER);
  PersistenceApiComboboxUtil.setComboboxModel(myPersistenceApiComboBox, true);
  if (model.isFrameworkSelected(JPA_FRAMEWORK_ID)) {
    myPersistenceApiComboBox.setSelectedItem(PersistenceApi.JPA.getDisplayName());
  }
  model.addFrameworkListener(this);

  myErrorLabel = new HyperlinkLabel();
  myErrorLabel.setIcon(AllIcons.RunConfigurations.ConfigurationWarning);
  myErrorLabel.setVisible(false);
  myErrorLabel.setHyperlinkTarget(AppEngineSdkUtil.APP_ENGINE_DOWNLOAD_URL);
  myErrorPanel.add(BorderLayout.CENTER, myErrorLabel);

  final Component component = mySdkEditor.getComboBox().getEditor().getEditorComponent();
  if (component instanceof JTextComponent) {
    ((JTextComponent)component).getDocument().addDocumentListener(new DocumentAdapter() {
      @Override
      protected void textChanged(DocumentEvent e) {
        checkSdk();
      }
    });
  }
  checkSdk();
}
项目:intellij-ce-playground    文件:MavenEnvironmentForm.java   
public PathOverrider(final LabeledComponent<TextFieldWithBrowseButton> component,
                     final JCheckBox checkBox,
                     DocumentListener docListener,
                     PathProvider pathProvider) {
  this.component = component.getComponent();
  this.component.getTextField().getDocument().addDocumentListener(docListener);
  this.checkBox = checkBox;
  this.pathProvider = pathProvider;
  checkBox.addActionListener(new ActionListener() {
    public void actionPerformed(final ActionEvent e) {
      update();
    }
  });
}