Java Code Examples for com.intellij.util.ui.UIUtil#setEnabled()

The following examples show how to use com.intellij.util.ui.UIUtil#setEnabled() . 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: HaxePullUpDialog.java    From intellij-haxe with Apache License 2.0 6 votes vote down vote up
@Override
protected void addCustomElementsToCentralPanel(JPanel panel) {
  myJavaDocPanel = new DocCommentPanel(RefactoringBundle.message("javadoc.for.abstracts"));
  myJavaDocPanel.setPolicy(JavaRefactoringSettings.getInstance().PULL_UP_MEMBERS_JAVADOC);
  boolean hasJavadoc = false;
  for (MemberInfo info : myMemberInfos) {
    final PsiMember member = info.getMember();
    if (myMemberInfoModel.isAbstractEnabled(info)) {
      info.setToAbstract(myMemberInfoModel.isAbstractWhenDisabled(info));
      if (!hasJavadoc &&
          member instanceof PsiDocCommentOwner &&
          ((PsiDocCommentOwner)member).getDocComment() != null) {
        hasJavadoc = true;
      }
    }
  }
  UIUtil.setEnabled(myJavaDocPanel, hasJavadoc, true);
  panel.add(myJavaDocPanel, BorderLayout.EAST);
}
 
Example 2
Source File: VcsGeneralConfigurationPanel.java    From consulo with Apache License 2.0 6 votes vote down vote up
public void updateAvailableOptions(final Collection<AbstractVcs> activeVcses) {
  for (VcsShowOptionsSettingImpl setting : myPromptOptions.keySet()) {
    final JCheckBox checkBox = myPromptOptions.get(setting);
    checkBox.setEnabled(setting.isApplicableTo(activeVcses) || myProject.isDefault());
    if (!myProject.isDefault()) {
      checkBox.setToolTipText(VcsBundle.message("tooltip.text.action.applicable.to.vcses", composeText(setting.getApplicableVcses())));
    }
  }

  if (!myProject.isDefault()) {
    final ProjectLevelVcsManagerEx vcsManager = ProjectLevelVcsManagerEx.getInstanceEx(myProject);
    final VcsShowConfirmationOptionImpl addConfirmation = vcsManager.getConfirmation(VcsConfiguration.StandardConfirmation.ADD);
    UIUtil.setEnabled(myAddConfirmationPanel, addConfirmation.isApplicableTo(activeVcses), true);
    myAddConfirmationPanel.setToolTipText(
      VcsBundle.message("tooltip.text.action.applicable.to.vcses", composeText(addConfirmation.getApplicableVcses())));

    final VcsShowConfirmationOptionImpl removeConfirmation = vcsManager.getConfirmation(VcsConfiguration.StandardConfirmation.REMOVE);
    UIUtil.setEnabled(myRemoveConfirmationPanel, removeConfirmation.isApplicableTo(activeVcses), true);
    myRemoveConfirmationPanel.setToolTipText(
      VcsBundle.message("tooltip.text.action.applicable.to.vcses", composeText(removeConfirmation.getApplicableVcses())));
  }
}
 
Example 3
Source File: TemplateCommentPanel.java    From consulo with Apache License 2.0 6 votes vote down vote up
private void enableFormattingOptions(boolean enable) {
  if (enable) {
    rbBlockComment.setEnabled(true);
    rbLineComment.setEnabled(true);
    cbPrefixLines.setEnabled(myAllowBlock);
    cbSeparatorBefore.setEnabled(true);
    cbSeparatorAfter.setEnabled(true);
    lblLengthBefore.setEnabled(cbSeparatorBefore.isSelected());
    txtLengthBefore.setEnabled(cbSeparatorBefore.isSelected());
    lblLengthAfter.setEnabled(cbSeparatorAfter.isSelected());
    txtLengthAfter.setEnabled(cbSeparatorAfter.isSelected());
    mySeparatorCharLabel.setEnabled(true);
    updateBox();
  }
  else {
    UIUtil.setEnabled(myCommentTypePanel, enable, true);
    UIUtil.setEnabled(myBorderPanel, enable, true);
  }
}
 
Example 4
Source File: SingleInspectionProfilePanel.java    From consulo with Apache License 2.0 6 votes vote down vote up
private static void setConfigPanel(final JPanel configPanelAnchor, final ScopeToolState state) {
  configPanelAnchor.removeAll();
  final JComponent additionalConfigPanel = state.getAdditionalConfigPanel();
  if (additionalConfigPanel != null) {
    final JScrollPane pane = ScrollPaneFactory.createScrollPane(additionalConfigPanel, SideBorder.NONE);
    FocusManager.getCurrentManager().addPropertyChangeListener("focusOwner", new PropertyChangeListener() {
      @Override
      public void propertyChange(PropertyChangeEvent evt) {
        if (!(evt.getNewValue() instanceof JComponent)) {
          return;
        }
        final JComponent component = (JComponent)evt.getNewValue();
        if (component.isAncestorOf(pane)) {
          pane.scrollRectToVisible(component.getBounds());
        }
      }
    });
    configPanelAnchor.add(pane);
  }
  UIUtil.setEnabled(configPanelAnchor, state.isEnabled(), true);
}
 
Example 5
Source File: XDebuggerExpressionComboBox.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void setEnabled(boolean enable) {
  if (enable == myComboBox.isEnabled()) return;

  UIUtil.setEnabled(myComponent, enable, true);
  //myComboBox.setEditable(enable);

  if (enable) {
    //initEditor();
  }
  else {
    myExpression = getExpression();
  }
}
 
Example 6
Source File: ChangelistConflictConfigurable.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void reset() {
  super.reset();
  Collection<String> conflicts = myConflictTracker.getIgnoredConflicts();
  myIgnoredFiles.setListData(ArrayUtil.toStringArray(conflicts));
  myClearButton.setEnabled(!conflicts.isEmpty());
  UIUtil.setEnabled(myOptionsPanel, myEnableCheckBox.isSelected(), true);    
}
 
Example 7
Source File: BackgroundTaskByVfsChangePanel.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void reset(@Nonnull BackgroundTaskByVfsParameters parameters) {
  myProgramParametersPanel.reset(parameters);
  myExePath.setText(FileUtil.toSystemDependentName(StringUtil.notNullize(parameters.getExePath())));
  myOutPath.setText(FileUtil.toSystemDependentName(StringUtil.notNullize(parameters.getOutPath())));
  myShowConsoleCheckBox.setSelected(parameters.isShowConsole());
  UIUtil.setEnabled(this, parameters != BackgroundTaskByVfsParametersImpl.EMPTY, true);
}
 
Example 8
Source File: BuildElementsEditor.java    From consulo with Apache License 2.0 5 votes vote down vote up
private void enableCompilerSettings(final boolean enabled) {
  UIUtil.setEnabled(myOutputPathPanel, enabled, true);
  UIUtil.setEnabled(myOutputLabel, enabled, true);
  UIUtil.setEnabled(myTestsOutputPathPanel, enabled, true);
  UIUtil.setEnabled(myTestOutputLabel, enabled, true);
  UIUtil.setEnabled(myResourcesOutputPathPanel, enabled, true);
  UIUtil.setEnabled(myResourceOutputLabel, enabled, true);
  UIUtil.setEnabled(myTestResourceOutputLabel, enabled, true);
  UIUtil.setEnabled(myTestResourcesOutputPathPanel, enabled, true);
  myCbExcludeOutput.setEnabled(enabled);
  ModuleCompilerPathsManager moduleCompilerPathsManager = ModuleCompilerPathsManager.getInstance(getModule());
  moduleCompilerPathsManager.setInheritedCompilerOutput(!enabled);
  updateOutputPathPresentation();
}
 
Example 9
Source File: AdvancedSettingsAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
public JComponent createCustomComponent(final boolean selected) {
  JPanel panel = new JPanel();
  panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
  final JComponent baseComponent = createBaseComponent();
  panel.add(baseComponent);
  final JLabel descriptionLabel = new JLabel(myDescription);
  UIUtil.applyStyle(UIUtil.ComponentStyle.MINI, descriptionLabel);
  panel.add(installLeftIndentToLabel(descriptionLabel));
  UIUtil.setEnabled(panel, enabled(), true);

  panel.setBackground(selected ? UIUtil.getListSelectionBackground() : UIUtil.getListBackground());
  descriptionLabel.setForeground(selected ? UIUtil.getListSelectionForeground() : UIUtil.getListForeground());
  baseComponent.setForeground(selected ? UIUtil.getListSelectionForeground() : UIUtil.getListForeground());
  return panel;
}
 
Example 10
Source File: FlutterCreateAdditionalSettingsFields.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private void changeVisibility(boolean areLanguageFeaturesVisible) {
  orgField.setEnabled(areLanguageFeaturesVisible);
  UIUtil.setEnabled(androidLanguageRadios.getComponent(), areLanguageFeaturesVisible, true, true);
  UIUtil.setEnabled(iosLanguageRadios.getComponent(), areLanguageFeaturesVisible, true, true);
}
 
Example 11
Source File: FlutterCreateAdditionalSettingsFields.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private void changeVisibility(boolean areLanguageFeaturesVisible) {
  orgField.setEnabled(areLanguageFeaturesVisible);
  UIUtil.setEnabled(androidLanguageRadios.getComponent(), areLanguageFeaturesVisible, true, true);
  UIUtil.setEnabled(iosLanguageRadios.getComponent(), areLanguageFeaturesVisible, true, true);
}
 
Example 12
Source File: ExternalDiffSettingsConfigurable.java    From consulo with Apache License 2.0 4 votes vote down vote up
private void updateEnabledEffect() {
  UIUtil.setEnabled(myTextField, isEnabled(), true);
}
 
Example 13
Source File: PasswordPromptComponent.java    From consulo with Apache License 2.0 4 votes vote down vote up
private void setUserInputVisible(boolean visible) {
  UIUtil.setEnabled(myUserPanel, visible, true);
  myUserPanel.setVisible(visible);
}
 
Example 14
Source File: XDebuggerExpressionEditor.java    From consulo with Apache License 2.0 4 votes vote down vote up
public void setEnabled(boolean enable) {
  if (enable == myComponent.isEnabled()) return;
  UIUtil.setEnabled(myComponent, enable, true);
}
 
Example 15
Source File: CompositeCommittedChangesProvider.java    From consulo with Apache License 2.0 4 votes vote down vote up
private void updateVcsEnabled(JCheckBox checkBox, ChangesBrowserSettingsEditor editor) {
  UIUtil.setEnabled(editor.getComponent(), checkBox.isSelected(), true);
  if (checkBox.isSelected()) {
    editor.updateEnabledControls();
  }
}
 
Example 16
Source File: ScopeEditorPanel.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void setSelected(AnActionEvent event, boolean flag) {
  DependencyUISettings.getInstance().UI_FILTER_LEGALS = flag;
  UIUtil.setEnabled(myLegendPanel, !flag, true);
  myUpdate.run();
}