com.intellij.openapi.options.UnnamedConfigurable Java Examples

The following examples show how to use com.intellij.openapi.options.UnnamedConfigurable. 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: VcsConfigurationsDialog.java    From consulo with Apache License 2.0 6 votes vote down vote up
public VcsConfigurationsDialog(Project project, @Nullable JComboBox vcses, VcsDescriptor selectedVcs) {
  super(project, false);
  myProject = project;

  VcsDescriptor[] abstractVcses = collectAvailableNames();
  initList(abstractVcses);

  initVcsConfigurable(abstractVcses);

  updateConfiguration();
  myVcsesToUpdate = vcses;
  for (String vcsName : myVcsNameToConfigurableMap.keySet()) {
     UnnamedConfigurable configurable = myVcsNameToConfigurableMap.get(vcsName);
     if (configurable != null && configurable.isModified()) configurable.reset();
  }
  updateConfiguration();
  if (selectedVcs != null){
    myVcses.setSelectedValue(selectedVcs, true);
  }
  init();
  setTitle(VcsBundle.message("dialog.title.version.control.configurations"));
}
 
Example #2
Source File: ExportToHTMLDialog.java    From consulo with Apache License 2.0 6 votes vote down vote up
public void apply() throws ConfigurationException {
  ExportToHTMLSettings exportToHTMLSettings = ExportToHTMLSettings.getInstance(myProject);

  if (myRbCurrentFile.isSelected()){
    exportToHTMLSettings.setPrintScope(PrintSettings.PRINT_FILE);
  }
  else if (myRbSelectedText.isSelected()){
    exportToHTMLSettings.setPrintScope(PrintSettings.PRINT_SELECTED_TEXT);
  }
  else if (myRbCurrentPackage.isSelected()){
    exportToHTMLSettings.setPrintScope(PrintSettings.PRINT_DIRECTORY);
  }

  exportToHTMLSettings.setIncludeSubpackages(myCbIncludeSubpackages.isSelected());
  exportToHTMLSettings.PRINT_LINE_NUMBERS = myCbLineNumbers.isSelected();
  exportToHTMLSettings.OPEN_IN_BROWSER = myCbOpenInBrowser.isSelected();
  exportToHTMLSettings.OUTPUT_DIRECTORY = myTargetDirectoryField.getText();
  for (UnnamedConfigurable printOption : myExtensions) {
    printOption.apply();
  }
}
 
Example #3
Source File: VcsMappingConfigurationDialog.java    From consulo with Apache License 2.0 6 votes vote down vote up
private void updateVcsConfigurable() {
  if (myVcsConfigurable != null) {
    myVcsConfigurablePlaceholder.remove(myVcsConfigurableComponent);
    myVcsConfigurable.disposeUIResources();
    myVcsConfigurable = null;
  }
  VcsDescriptor wrapper = (VcsDescriptor) myVCSComboBox.getSelectedItem();
  if (wrapper != null && (! wrapper.isNone())) {
    final AbstractVcs vcs = myVcsManager.findVcsByName(wrapper.getName());
    if (vcs != null) {
      UnnamedConfigurable configurable = vcs.getRootConfigurable(myMappingCopy);
      if (configurable != null) {
        myVcsConfigurable = configurable;
        myVcsConfigurableComponent = myVcsConfigurable.createComponent();
        myVcsConfigurablePlaceholder.add(myVcsConfigurableComponent, BorderLayout.CENTER);
      }
    }
  }
  pack();
}
 
Example #4
Source File: ExportToHTMLDialog.java    From consulo with Apache License 2.0 6 votes vote down vote up
public void reset() {
  ExportToHTMLSettings exportToHTMLSettings = ExportToHTMLSettings.getInstance(myProject);

  myRbSelectedText.setEnabled(myIsSelectedTextEnabled);
  myRbSelectedText.setSelected(myIsSelectedTextEnabled);
  myRbCurrentFile.setEnabled(myFileName != null);
  myRbCurrentFile.setSelected(myFileName != null && !myIsSelectedTextEnabled);
  myRbCurrentPackage.setEnabled(myDirectoryName != null);
  myRbCurrentPackage.setSelected(myDirectoryName != null && !myIsSelectedTextEnabled && myFileName == null);
  myCbIncludeSubpackages.setSelected(exportToHTMLSettings.isIncludeSubdirectories());
  myCbIncludeSubpackages.setEnabled(myRbCurrentPackage.isSelected());

  myCbLineNumbers.setSelected(exportToHTMLSettings.PRINT_LINE_NUMBERS);
  myCbOpenInBrowser.setSelected(exportToHTMLSettings.OPEN_IN_BROWSER);

  myTargetDirectoryField.setText(exportToHTMLSettings.OUTPUT_DIRECTORY);

  for (UnnamedConfigurable printOption : myExtensions) {
    printOption.reset();
  }
}
 
Example #5
Source File: ExportToHTMLDialog.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
protected JComponent createCenterPanel() {
  OptionGroup optionGroup = new OptionGroup(CodeEditorBundle.message("export.to.html.options.group"));

  myCbLineNumbers = new JCheckBox(CodeEditorBundle.message("export.to.html.options.show.line.numbers.checkbox"));
  optionGroup.add(myCbLineNumbers);

  for (UnnamedConfigurable printOption : myExtensions) {
    optionGroup.add(printOption.createComponent());
  }

  myCbOpenInBrowser = new JCheckBox(CodeEditorBundle.message("export.to.html.open.generated.html.checkbox"));
  optionGroup.add(myCbOpenInBrowser);

  return optionGroup.createPanel();
}
 
Example #6
Source File: HaxeConfigurationEditor.java    From intellij-haxe with Apache License 2.0 6 votes vote down vote up
private void initExtensions() {
  final HaxeModuleSettings settings = HaxeModuleSettings.getInstance(myModule);
  final HaxeModuleConfigurationExtensionPoint[] extensionPoints = HaxeModuleConfigurationExtensionPoint.EP_NAME.getExtensions();

  if (extensionPoints.length > 0) {
    final GridLayoutManager layoutManager = new GridLayoutManager(extensionPoints.length, 1);
    myAdditionalComponentPanel.setLayout(layoutManager);
  }
  for (int i = 0; i < extensionPoints.length; i++) {
    HaxeModuleConfigurationExtensionPoint extensionPoint = extensionPoints[i];
    final GridConstraints gridConstraints = new GridConstraints();
    gridConstraints.setFill(GridConstraints.FILL_HORIZONTAL);
    gridConstraints.setRow(i);

    final UnnamedConfigurable configurable = extensionPoint.createConfigurable(settings);
    configurables.add(configurable);
    myAdditionalComponentPanel.add(configurable.createComponent(), gridConstraints);
  }
}
 
Example #7
Source File: NamedItemsListEditor.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nullable
protected UnnamedConfigurable getItemConfigurable(final T item) {
  final Ref<UnnamedConfigurable> result = new Ref<UnnamedConfigurable>();
  TreeUtil.traverse((TreeNode)myTree.getModel().getRoot(), new TreeUtil.Traverse() {
    @Override
    public boolean accept(Object node) {
      final NamedConfigurable configurable = (NamedConfigurable)((DefaultMutableTreeNode)node).getUserObject();
      if (configurable.getEditableObject() == item) {
        result.set(((ItemConfigurable)configurable).myConfigurable);
        return false;
      }
      else {
        return true;
      }
    }
  });
  return result.get();
}
 
Example #8
Source File: BlazeUserSettingsCompositeConfigurable.java    From intellij with Apache License 2.0 5 votes vote down vote up
@Override
public JComponent createComponent() {
  JPanel panel = new JPanel(new VerticalLayout(/* gap= */ 0));
  for (UnnamedConfigurable configurable : getConfigurables()) {
    JComponent component = configurable.createComponent();
    if (component != null) {
      panel.add(component);
    }
  }
  return panel;
}
 
Example #9
Source File: VcsConfigurationsDialog.java    From consulo with Apache License 2.0 5 votes vote down vote up
private void updateConfiguration() {
  int selectedIndex = myVcses.getSelectionModel().getMinSelectionIndex();
  final VcsDescriptor currentVcs;
  currentVcs = selectedIndex >= 0 ? (VcsDescriptor)(myVcses.getModel()).getElementAt(selectedIndex) : null;
  String currentName = currentVcs == null ? NONE : currentVcs.getName();
  if (currentVcs != null) {
    final UnnamedConfigurable unnamedConfigurable = myVcsNameToConfigurableMap.get(currentName);
    unnamedConfigurable.createComponent();
    unnamedConfigurable.reset();
  }
  final CardLayout cardLayout = (CardLayout)myVcsConfigurationPanel.getLayout();
  cardLayout.show(myVcsConfigurationPanel, currentName);
}
 
Example #10
Source File: VcsConfigurationsDialog.java    From consulo with Apache License 2.0 5 votes vote down vote up
protected void doOKAction() {
  for (String vcsName : myVcsNameToConfigurableMap.keySet()) {
    UnnamedConfigurable configurable = myVcsNameToConfigurableMap.get(vcsName);
    if (configurable != null && configurable.isModified()) {
      try {
        configurable.apply();
      }
      catch (ConfigurationException e) {
        Messages.showErrorDialog(VcsBundle.message("message.text.unable.to.save.settings", e.getMessage()),
                                 VcsBundle.message("message.title.unable.to.save.settings"));
      }
    }
  }

  final JComboBox vcsesToUpdate = myVcsesToUpdate;
  if (vcsesToUpdate != null) {
    final VcsDescriptor wrapper = (VcsDescriptor) myVcses.getSelectedValue();
    vcsesToUpdate.setSelectedItem(wrapper);
    final ComboBoxModel model = vcsesToUpdate.getModel();
    for(int i = 0; i < model.getSize(); i++){
      final Object vcsWrapper = model.getElementAt(i);
      if (vcsWrapper instanceof VcsDescriptor){
        final VcsDescriptor defaultVcsWrapper = (VcsDescriptor) vcsWrapper;
        if (defaultVcsWrapper.equals(wrapper)){
          vcsesToUpdate.setSelectedIndex(i);
          break;
        }
      }
    }
  }

  super.doOKAction();
}
 
Example #11
Source File: EditorAppearanceConfigurable.java    From consulo with Apache License 2.0 5 votes vote down vote up
@RequiredUIAccess
@Override
public JComponent createComponent() {
  for (UnnamedConfigurable provider : getConfigurables()) {
    myAddonPanel.add(provider.createComponent(), new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 0, 0, GridBagConstraints.NORTHWEST,
                                                                          GridBagConstraints.NONE, new Insets(0,0,15,0), 0,0));
  }
  return myRootPanel;
}
 
Example #12
Source File: ConfigurableUIMigrationUtil.java    From consulo with Apache License 2.0 5 votes vote down vote up
@RequiredUIAccess
public static JComponent createComponent(@Nonnull UnnamedConfigurable configurable) {
  JComponent component = configurable.createComponent();
  if (component != null) {
    return component;
  }

  consulo.ui.Component uiComponent = configurable.createUIComponent();
  if (uiComponent != null) {
    return (JComponent)TargetAWT.to(uiComponent);
  }
  return null;
}
 
Example #13
Source File: ExportToHTMLDialog.java    From consulo with Apache License 2.0 5 votes vote down vote up
public ExportToHTMLDialog(String fileName, String directoryName, boolean isSelectedTextEnabled, Project project) {
  super(project, true);
  myProject = project;
  setOKButtonText(CodeEditorBundle.message("export.to.html.save.button"));
  myFileName = fileName;
  myDirectoryName = directoryName;
  this.myIsSelectedTextEnabled = isSelectedTextEnabled;
  setTitle(CodeEditorBundle.message("export.to.html.title"));
  myExtensions = new ArrayList<UnnamedConfigurable>();
  for (PrintOption extension : Extensions.getExtensions(PrintOption.EP_NAME)) {
    myExtensions.add(extension.createConfigurable());
  }
  init();
}
 
Example #14
Source File: ActiveConnectionPanel.java    From p4ic4idea with Apache License 2.0 5 votes vote down vote up
ConfigDialog(Project project, String dir, UnnamedConfigurable config) {
    super(project, false, IdeModalityType.MODELESS);
    this.config = config;
    init();
    setTitle(P4Bundle.message("vcsroot.dialog.title", dir));
    pack();
    centerRelativeToParent();
}
 
Example #15
Source File: ExportToHTMLDialog.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
protected void dispose() {
  for (UnnamedConfigurable extension : myExtensions) {
    extension.disposeUIResources();
  }
  super.dispose();
}
 
Example #16
Source File: SandServerType.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
public UnnamedConfigurable createConfigurable(@Nonnull SandServerConfiguration configuration) {
  return new UnnamedConfigurable() {
    @RequiredUIAccess
    @Override
    public boolean isModified() {
      return false;
    }

    @RequiredUIAccess
    @Nullable
    @Override
    public Component createUIComponent() {
      return Label.create("Sand stub UI");
    }

    @RequiredUIAccess
    @Override
    public void apply() throws ConfigurationException {

    }

    @RequiredUIAccess
    @Override
    public void reset() {

    }
  };
}
 
Example #17
Source File: EditorAppearanceConfigurable.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
protected List<UnnamedConfigurable> createConfigurables() {
  return ConfigurableWrapper.createConfigurables(EP_NAME);
}
 
Example #18
Source File: PrintOption.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
public abstract UnnamedConfigurable createConfigurable();
 
Example #19
Source File: ArrangementRuleAliasesListEditor.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
protected UnnamedConfigurable createConfigurable(StdArrangementRuleAliasToken item) {
  return new ArrangementRuleAliasConfigurable(mySettingsManager, myColorsProvider, item);
}
 
Example #20
Source File: SandRunConfigurationsSettings.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public UnnamedConfigurable createConfigurable() {
  return new TestConfiguration();
}
 
Example #21
Source File: ServerType.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
public abstract UnnamedConfigurable createConfigurable(@Nonnull C configuration);
 
Example #22
Source File: RunConfigurationsSettings.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
UnnamedConfigurable createConfigurable();
 
Example #23
Source File: HaxeFlexSDKExtension.java    From intellij-haxe with Apache License 2.0 4 votes vote down vote up
@Override
public UnnamedConfigurable createConfigurable(@NotNull HaxeModuleSettings settings) {
  return new HaxeFlexSDKConfigurable(settings);
}
 
Example #24
Source File: SyncProjectDialog.java    From p4ic4idea with Apache License 2.0 4 votes vote down vote up
public SyncProjectDialog(@NotNull Project project) {
    this.project = project;


    this.directoryMapping = createDirectoryMapping(project);
    final UnnamedConfigurable configurable =
            P4Vcs.getInstance(project).getRootConfigurable(directoryMapping);
    if (!(configurable instanceof P4VcsRootConfigurable)) {
        this.setupProblem = P4Bundle.getString("checkout.config.error.invalid-project");
        this.directoryField = null;
        this.dialog = null;
        this.configurable = null;
        return;
    }
    this.configurable = (P4VcsRootConfigurable) configurable;

    JComponent component = configurable.createComponent();
    if (component == null) {
        this.setupProblem = P4Bundle.getString("checkout.config.error.invalid-project");
        this.directoryField = null;
        this.dialog = null;
        return;
    }

    this.setupProblem = null;
    JPanel dirPanel = new JPanel(new BorderLayout());
    this.directoryField = new TextFieldWithBrowseButton();
    dirPanel.add(directoryField, BorderLayout.CENTER);
    directoryField.setButtonEnabled(true);
    directoryField.addBrowseFolderListener(
            P4Bundle.getString("checkout.config.directory.chooser.title"),
            P4Bundle.getString("checkout.config.directory.chooser.desc"),
            project,
            FileChooserDescriptorFactory.createSingleLocalFileDescriptor()
    );
    JLabel dirLabel = SwingUtil.createLabelFor(P4Bundle.getString("checkout.config.directory"), directoryField);
    dirPanel.add(dirLabel, BorderLayout.WEST);

    this.dialog = new DialogBuilder(project)
            .centerPanel(component)
            .title(P4Bundle.getString("checkout.config.title"));
    dialog.setNorthPanel(dirPanel);
}
 
Example #25
Source File: BlazeJavaUserSettingsConfigurable.java    From intellij with Apache License 2.0 4 votes vote down vote up
@Override
public UnnamedConfigurable getConfigurable() {
  return new BlazeJavaUserSettingsConfigurable();
}
 
Example #26
Source File: BlazeUserSettingsConfigurable.java    From intellij with Apache License 2.0 4 votes vote down vote up
@Override
public UnnamedConfigurable getConfigurable() {
  return new BlazeUserSettingsConfigurable();
}
 
Example #27
Source File: BlazeUserSettingsCompositeConfigurable.java    From intellij with Apache License 2.0 4 votes vote down vote up
@Override
protected List<UnnamedConfigurable> createConfigurables() {
  return Arrays.stream(UiContributor.EP_NAME.getExtensions())
      .map(UiContributor::getConfigurable)
      .collect(toImmutableList());
}
 
Example #28
Source File: AbstractVcs.java    From consulo with Apache License 2.0 2 votes vote down vote up
/**
 * Returns the configurable to be shown in the VCS directory mapping dialog which should be displayed
 * for configuring VCS-specific settings for the specified root, or null if no such configuration is required.
 * The VCS-specific settings are stored in {@link VcsDirectoryMapping#getRootSettings()}.
 *
 * @param mapping the mapping being configured
 * @return the configurable instance, or null if no configuration is required.
 */
@Nullable
public UnnamedConfigurable getRootConfigurable(VcsDirectoryMapping mapping) {
  return null;
}
 
Example #29
Source File: P4Vcs.java    From p4ic4idea with Apache License 2.0 2 votes vote down vote up
/**
 * Returns the configurable to be shown in the VCS directory mapping dialog which should be displayed
 * for configuring VCS-specific settings for the specified root, or null if no such configuration is required.
 * The VCS-specific settings are stored in {@link VcsDirectoryMapping#getRootSettings()}.
 *
 * @param mapping the mapping being configured
 * @return the configurable instance, or null if no configuration is required.
 */
@Override
public UnnamedConfigurable getRootConfigurable(VcsDirectoryMapping mapping) {
    return new P4VcsRootConfigurable(getProject(), mapping);
}
 
Example #30
Source File: NamedItemsListEditor.java    From consulo with Apache License 2.0 votes vote down vote up
protected abstract UnnamedConfigurable createConfigurable(T item);