com.intellij.util.ui.SwingHelper Java Examples

The following examples show how to use com.intellij.util.ui.SwingHelper. 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: PackagesNotificationPanel.java    From consulo with Apache License 2.0 6 votes vote down vote up
public PackagesNotificationPanel() {
  myHtmlViewer = SwingHelper.createHtmlViewer(true, null, null, null);
  myHtmlViewer.setVisible(false);
  myHtmlViewer.setOpaque(true);
  myHtmlViewer.addHyperlinkListener(new HyperlinkAdapter() {
    @Override
    protected void hyperlinkActivated(HyperlinkEvent e) {
      final Runnable handler = myLinkHandlers.get(e.getDescription());
      if (handler != null) {
        handler.run();
      }
      else if (myErrorTitle != null && myErrorDescription != null) {
        showError(myErrorTitle, myErrorDescription);
      }
    }
  });
}
 
Example #2
Source File: SassLintSettingsPage.java    From sass-lint-plugin with MIT License 5 votes vote down vote up
private void configLintBinField() {
    configWithDefaults(sasslintBinField);
    SwingHelper.addHistoryOnExpansion(sasslintBinField.getChildComponent(), new NotNullProducer<List<String>>() {
        @NotNull
        public List<String> produce() {
            List<File> newFiles = SassLintFinder.searchForSassLintExe(getProjectPath());
            return FileUtils.toAbsolutePath(newFiles);
        }
    });
    SwingHelper.installFileCompletionAndBrowseDialog(project, sasslintBinField, "Select Sass Lint Exe", FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor());
}
 
Example #3
Source File: SassLintSettingsPage.java    From sass-lint-plugin with MIT License 5 votes vote down vote up
private void configConfigFileField() {
    TextFieldWithHistory textFieldWithHistory = configWithDefaults(sassLintConfigFile);
    SwingHelper.addHistoryOnExpansion(textFieldWithHistory, new NotNullProducer<List<String>>() {
        @NotNull
        public List<String> produce() {
            return SassLintFinder.searchForConfigFiles(getProjectPath());
        }
    });
    SwingHelper.installFileCompletionAndBrowseDialog(project, sassLintConfigFile, "Select Sass Lint Config", FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor());
}
 
Example #4
Source File: SassLintSettingsPage.java    From sass-lint-plugin with MIT License 5 votes vote down vote up
private void configNodeField() {
    TextFieldWithHistory textFieldWithHistory = configWithDefaults(nodeInterpreterField);
    SwingHelper.addHistoryOnExpansion(textFieldWithHistory, new NotNullProducer<List<String>>() {
        @NotNull
        public List<String> produce() {
            List<File> newFiles = NodeDetectionUtil.listAllPossibleNodeInterpreters();
            return FileUtils.toAbsolutePath(newFiles);
        }
    });
    SwingHelper.installFileCompletionAndBrowseDialog(project, nodeInterpreterField, "Select Node Interpreter", FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor());
}
 
Example #5
Source File: BlazeUserSettingsConfigurable.java    From intellij with Apache License 2.0 5 votes vote down vote up
@Override
public JComponent createComponent() {
  return SwingHelper.newLeftAlignedVerticalPanel(
      getFocusBehaviorSettingsUi(),
      createVerticalPanel(
          COLLAPSE_PROJECT_VIEW,
          FORMAT_BUILD_FILES_ON_SAVE,
          SHOW_ADD_FILE_TO_PROJECT,
          BLAZE_BINARY_PATH,
          BAZEL_BINARY_PATH));
}
 
Example #6
Source File: SettingComponent.java    From intellij with Apache License 2.0 5 votes vote down vote up
@Override
public JComponent getRootComponent() {
  if (rootPanel == null) {
    rootPanel =
        SwingHelper.newHorizontalPanel(
            Component.CENTER_ALIGNMENT,
            label,
            Box.createRigidArea(new Dimension(5, 0)),
            component);
    rootPanel.setVisible(component.isVisible());
  }
  return rootPanel;
}
 
Example #7
Source File: SassLintSettingsPage.java    From sass-lint-plugin with MIT License 4 votes vote down vote up
private void createUIComponents() {
    // TODO: place custom component creation code here
    usageLink = SwingHelper.createWebHyperlink(HOW_TO_USE_SASS_LINT, HOW_TO_USE_LINK);
}
 
Example #8
Source File: AddDirectoryToProjectAction.java    From intellij with Apache License 2.0 4 votes vote down vote up
OpenBlazeWorkspaceFileActionDialog(
    Project project, ProjectViewSet projectView, WorkspacePathResolver workspacePathResolver) {
  super(project, /* canBeParent= */ false, IdeModalityType.PROJECT);
  this.project = project;
  this.projectView = projectView;
  this.workspacePathResolver = workspacePathResolver;

  FileChooserDescriptor descriptor =
      FileChooserDescriptorFactory.createSingleFolderDescriptor();
  fileTextField =
      WorkspaceFileTextField.create(
          workspacePathResolver, descriptor, PATH_FIELD_WIDTH, myDisposable);
  JBLabel directoryLabel = new JBLabel("Directory:", Nodes.Package, SwingConstants.LEFT);
  JPanel directoryPanel =
      SwingHelper.newHorizontalPanel(
          Component.TOP_ALIGNMENT, directoryLabel, fileTextField.getField());

  boolean autoDeriveTargets = autoDeriveTargets();
  addTargetsCheckBox = new JBCheckBox("Add build targets to the project", !autoDeriveTargets);
  JBLabel warning =
      new JBLabel(
          "<html>" + ADD_TARGETS_WARNING_TEXT + "</html>",
          AllIcons.General.BalloonWarning,
          SwingConstants.LEFT);
  warning.setPreferredSize(new Dimension(800, 100));

  addTargetsCheckBox.addChangeListener(
      e -> {
        String warningText;
        if (autoDeriveTargets || addTargetsCheckBox.isSelected()) {
          warningText = ADD_TARGETS_WARNING_TEXT;
        } else {
          warningText = NO_TARGETS_WARNING_TEXT;
        }
        warning.setText("<html>" + warningText + "</html>");
      });

  if (autoDeriveTargets) {
    addTargetsCheckBox.setVisible(false);
  }

  component =
      SwingHelper.newLeftAlignedVerticalPanel(
          directoryPanel, addTargetsCheckBox, warning, Box.createVerticalGlue());

  setTitle("Add Directory to Project");

  init();
}
 
Example #9
Source File: ManagePackagesDialog.java    From consulo with Apache License 2.0 4 votes vote down vote up
private void createUIComponents() {
  myFilter = new MyPackageFilter();
  myDescriptionTextArea = SwingHelper.createHtmlViewer(true, null, null, null);
}