com.intellij.ui.HyperlinkLabel Java Examples

The following examples show how to use com.intellij.ui.HyperlinkLabel. 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: SassLintInspection.java    From sass-lint-plugin with MIT License 6 votes vote down vote up
@NotNull
    private HyperlinkLabel createHyperLink() {
//        List path = ContainerUtil.newArrayList(JSBundle.message("settings.javascript.root.configurable.name"), JSBundle.message("settings.javascript.linters.configurable.name"), getDisplayName());
        List path = ContainerUtil.newArrayList("JavaScript", SassLintBundle.message("sasslint.inspection.group.name"), getDisplayName());

        String title = Joiner.on(" / ").join(path);
        final HyperlinkLabel settingsLink = new HyperlinkLabel(title);
        settingsLink.addHyperlinkListener(new HyperlinkAdapter() {
            public void hyperlinkActivated(HyperlinkEvent e) {
                DataContext dataContext = DataManager.getInstance().getDataContext(settingsLink);
                OptionsEditor optionsEditor = OptionsEditor.KEY.getData(dataContext);
                if (optionsEditor == null) {
                    Project project = CommonDataKeys.PROJECT.getData(dataContext);
                    if (project != null) {
                        showSettings(project);
                    }
                    return;
                }
                Configurable configurable = optionsEditor.findConfigurableById(SassLintInspection.this.getId());
                if (configurable != null) {
                    optionsEditor.clearSearchAndSelect(configurable);
                }
            }
        });
        return settingsLink;
    }
 
Example #2
Source File: EnvironmentVariablesTextFieldWithBrowseButton.java    From consulo with Apache License 2.0 6 votes vote down vote up
protected MyEnvironmentVariablesDialog() {
  super(EnvironmentVariablesTextFieldWithBrowseButton.this, true);
  myEnvVariablesTable = new EnvVariablesTable();
  myEnvVariablesTable.setValues(convertToVariables(myData.getEnvs(), false));

  myUseDefaultCb.setSelected(isPassParentEnvs());
  myWholePanel.add(myEnvVariablesTable.getComponent(), BorderLayout.CENTER);
  JPanel useDefaultPanel = new JPanel(new BorderLayout());
  useDefaultPanel.add(myUseDefaultCb, BorderLayout.CENTER);
  HyperlinkLabel showLink = new HyperlinkLabel(ExecutionBundle.message("env.vars.show.system"));
  useDefaultPanel.add(showLink, BorderLayout.EAST);
  showLink.addHyperlinkListener(new HyperlinkListener() {
    @Override
    public void hyperlinkUpdate(HyperlinkEvent e) {
      if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
        showParentEnvironmentDialog(MyEnvironmentVariablesDialog.this.getWindow());
      }
    }
  });

  myWholePanel.add(useDefaultPanel, BorderLayout.SOUTH);
  setTitle(ExecutionBundle.message("environment.variables.dialog.title"));
  init();
}
 
Example #3
Source File: ESLintInspection.java    From eslint-plugin with MIT License 6 votes vote down vote up
@NotNull
    private HyperlinkLabel createHyperLink() {
        List path = ContainerUtil.newArrayList(JSBundle.message("settings.javascript.root.configurable.name"), JSBundle.message("settings.javascript.linters.configurable.name"), getDisplayName());

        String title = Joiner.on(" / ").join(path);
        final HyperlinkLabel settingsLink = new HyperlinkLabel(title);
        settingsLink.addHyperlinkListener(new HyperlinkAdapter() {
            public void hyperlinkActivated(HyperlinkEvent e) {
//                DataContext dataContext = DataManager.getInstance().getDataContext(settingsLink);
//                OptionsEditor optionsEditor = OptionsEditor.KEY.getData(dataContext);
//                if (optionsEditor == null) {
//                    Project project = CommonDataKeys.PROJECT.getData(dataContext);
//                    if (project != null) {
//                        showSettings(project);
//                    }
//                    return;
//                }
//                Configurable configurable = optionsEditor.findConfigurableById(ESLintInspection.this.getId());
//                if (configurable != null) {
//                    optionsEditor.clearSearchAndSelect(configurable);
//                }
            }
        });
        return settingsLink;
    }
 
Example #4
Source File: RTInspection.java    From react-templates-plugin with MIT License 6 votes vote down vote up
@NotNull
    private HyperlinkLabel createHyperLink() {
        //JSBundle.message("settings.javascript.root.configurable.name")
        List<String> path = ContainerUtil.newArrayList("HTML", getDisplayName());

        String title = Joiner.on(" / ").join(path);
        final HyperlinkLabel settingsLink = new HyperlinkLabel(title);
        settingsLink.addHyperlinkListener(new HyperlinkAdapter() {
            public void hyperlinkActivated(HyperlinkEvent e) {
//                DataContext dataContext = DataManager.getInstance().getDataContext(settingsLink);
//                OptionsEditor optionsEditor = OptionsEditor.KEY.getData(dataContext);
//                if (optionsEditor == null) {
//                    Project project = CommonDataKeys.PROJECT.getData(dataContext);
//                    if (project != null) {
//                        showSettings(project);
//                    }
//                    return;
//                }
//                Configurable configurable = optionsEditor.findConfigurableById(RTInspection.this.getId());
//                if (configurable != null) {
//                    optionsEditor.clearSearchAndSelect(configurable);
//                }
            }
        });
        return settingsLink;
    }
 
Example #5
Source File: RTInspection.java    From react-templates-plugin with MIT License 6 votes vote down vote up
@NotNull
    private HyperlinkLabel createHyperLink() {
        //JSBundle.message("settings.javascript.root.configurable.name")
        List<String> path = ContainerUtil.newArrayList("HTML", getDisplayName());

        String title = Joiner.on(" / ").join(path);
        final HyperlinkLabel settingsLink = new HyperlinkLabel(title);
        settingsLink.addHyperlinkListener(new HyperlinkAdapter() {
            public void hyperlinkActivated(HyperlinkEvent e) {
//                DataContext dataContext = DataManager.getInstance().getDataContext(settingsLink);
//                OptionsEditor optionsEditor = OptionsEditor.KEY.getData(dataContext);
//                if (optionsEditor == null) {
//                    Project project = CommonDataKeys.PROJECT.getData(dataContext);
//                    if (project != null) {
//                        showSettings(project);
//                    }
//                    return;
//                }
//                Configurable configurable = optionsEditor.findConfigurableById(RTInspection.this.getId());
//                if (configurable != null) {
//                    optionsEditor.clearSearchAndSelect(configurable);
//                }
            }
        });
        return settingsLink;
    }
 
Example #6
Source File: FlutterSampleActionsPanel.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
FlutterSampleActionsPanel(@NotNull List<FlutterSample> samples) {
  super(EditorColors.GUTTER_BACKGROUND);

  icon(FlutterIcons.Flutter);
  text("View hosted code sample");

  for (int i = 0; i < samples.size(); i++) {
    if (i != 0) {
      myLinksPanel.add(new JSeparator(SwingConstants.VERTICAL));
    }

    final FlutterSample sample = samples.get(i);

    final HyperlinkLabel label = createActionLabel(sample.getClassName(), () -> browseTo(sample));
    label.setToolTipText(sample.getHostedDocsUrl());
  }
}
 
Example #7
Source File: FlutterSampleActionsPanel.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
FlutterSampleActionsPanel(@NotNull List<FlutterSample> samples) {
  super(EditorColors.GUTTER_BACKGROUND);

  icon(FlutterIcons.Flutter);
  text("View hosted code sample");

  for (int i = 0; i < samples.size(); i++) {
    if (i != 0) {
      myLinksPanel.add(new JSeparator(SwingConstants.VERTICAL));
    }

    final FlutterSample sample = samples.get(i);

    final HyperlinkLabel label = createActionLabel(sample.getClassName(), () -> browseTo(sample));
    label.setToolTipText(sample.getHostedDocsUrl());
  }
}
 
Example #8
Source File: FlutterPubspecNotificationProvider.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
FlutterPubspecActionsPanel(@NotNull Project project, @NotNull VirtualFile file) {
  super(EditorColors.GUTTER_BACKGROUND);

  this.project = project;
  myFile = file;

  icon(FlutterIcons.Flutter);
  text("Flutter commands");

  // "flutter.pub.get"
  HyperlinkLabel label = createActionLabel("Pub get", () -> runPubGet(false));
  label.setToolTipText("Install referenced packages");

  // "flutter.pub.upgrade"
  label = createActionLabel("Pub upgrade", () -> runPubGet(true));
  label.setToolTipText("Upgrade referenced packages to the latest versions");

  // If the SDK is the right version, add a 'flutter pub outdated' command.
  final FlutterSdk sdk = FlutterSdk.getFlutterSdk(project);
  if (sdk != null && sdk.getVersion().isPubOutdatedSupported()) {
    // "flutter.pub.outdated"
    label = createActionLabel("Pub outdated", this::runPubOutdated);
    label.setToolTipText("Analyze packages to determine which ones can be upgraded");
  }

  myLinksPanel.add(new JSeparator(SwingConstants.VERTICAL));
  label = createActionLabel("Flutter doctor", "flutter.doctor");
  label.setToolTipText("Validate installed tools and their versions");
}
 
Example #9
Source File: SassLintInspection.java    From sass-lint-plugin with MIT License 5 votes vote down vote up
public JComponent createOptionsPanel() {
    JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    HyperlinkLabel settingsLink = createHyperLink();
    panel.setBorder(IdeBorderFactory.createTitledBorder(getDisplayName() + " options"));
    panel.add(settingsLink);
    return panel;
}
 
Example #10
Source File: QuarkusCodeEndpointChooserStep.java    From intellij-quarkus with Eclipse Public License 2.0 5 votes vote down vote up
public JComponent getComponent() {
    ButtonGroup group = new ButtonGroup();
    group.add(this.defaultRadioButton);
    group.add(this.customRadioButton);
    ActionListener listener = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            QuarkusCodeEndpointChooserStep.this.updateCustomUrl();
        }
    };
    this.defaultRadioButton.addActionListener(listener);
    this.customRadioButton.addActionListener(listener);
    FormBuilder builder = new FormBuilder();
    builder.addComponent(new JBLabel("Choose Quarkus Code endpoint URL."));
    BorderLayoutPanel defaultPanel = JBUI.Panels.simplePanel(10, 0);
    defaultPanel.addToLeft(this.defaultRadioButton);
    HyperlinkLabel label = new HyperlinkLabel(QUARKUS_CODE_URL);
    label.setHyperlinkTarget(QUARKUS_CODE_URL);
    defaultPanel.addToCenter(label);
    builder.addComponent(defaultPanel);
    BorderLayoutPanel customPanel = JBUI.Panels.simplePanel(10, 0);
    customPanel.addToLeft(this.customRadioButton);
    this.customUrlWithBrowseButton.setButtonIcon(AllIcons.Actions.ShowViewer);
    customPanel.addToCenter(this.customUrlWithBrowseButton);
    builder.addComponent(customPanel);
    builder.addTooltip("Make sure your network connection is active before continuing.");
    JPanel panel = new JPanel(new BorderLayout());
    panel.add(builder.getPanel(), "North");
    return panel;
}
 
Example #11
Source File: RTInspection.java    From react-templates-plugin with MIT License 5 votes vote down vote up
public JComponent createOptionsPanel() {
    JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    HyperlinkLabel settingsLink = createHyperLink();
    panel.setBorder(IdeBorderFactory.createTitledBorder(getDisplayName() + " options"));
    panel.add(settingsLink);
    return panel;
}
 
Example #12
Source File: FlutterPubspecNotificationProvider.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
FlutterPubspecActionsPanel(@NotNull Project project, @NotNull VirtualFile file) {
  super(EditorColors.GUTTER_BACKGROUND);

  this.project = project;
  myFile = file;

  icon(FlutterIcons.Flutter);
  text("Flutter commands");

  // "flutter.pub.get"
  HyperlinkLabel label = createActionLabel("Pub get", () -> runPubGet(false));
  label.setToolTipText("Install referenced packages");

  // "flutter.pub.upgrade"
  label = createActionLabel("Pub upgrade", () -> runPubGet(true));
  label.setToolTipText("Upgrade referenced packages to the latest versions");

  // If the SDK is the right version, add a 'flutter pub outdated' command.
  final FlutterSdk sdk = FlutterSdk.getFlutterSdk(project);
  if (sdk != null && sdk.getVersion().isPubOutdatedSupported()) {
    // "flutter.pub.outdated"
    label = createActionLabel("Pub outdated", this::runPubOutdated);
    label.setToolTipText("Analyze packages to determine which ones can be upgraded");
  }

  myLinksPanel.add(new JSeparator(SwingConstants.VERTICAL));
  label = createActionLabel("Flutter doctor", "flutter.doctor");
  label.setToolTipText("Validate installed tools and their versions");
}
 
Example #13
Source File: RTInspection.java    From react-templates-plugin with MIT License 5 votes vote down vote up
public JComponent createOptionsPanel() {
    JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    HyperlinkLabel settingsLink = createHyperLink();
    panel.setBorder(IdeBorderFactory.createTitledBorder(getDisplayName() + " options"));
    panel.add(settingsLink);
    return panel;
}
 
Example #14
Source File: ESLintInspection.java    From eslint-plugin with MIT License 5 votes vote down vote up
public JComponent createOptionsPanel() {
    JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    HyperlinkLabel settingsLink = createHyperLink();
    panel.setBorder(IdeBorderFactory.createTitledBorder(getDisplayName() + " options"));
    panel.add(settingsLink);
    return panel;
}
 
Example #15
Source File: ServerSelection.java    From intellij-spring-assistant with MIT License 5 votes vote down vote up
private void createUIComponents() {
  defaultHyperLink = new HyperlinkLabel(SPRING_IO_DEFAULT_INITIALIZR_SERVER_URL);
  defaultHyperLink.setHyperlinkTarget(SPRING_IO_DEFAULT_INITIALIZR_SERVER_URL);

  dataflowHyperLink = new HyperlinkLabel(SPRING_IO_DATAFLOW_INITIALIZR_SERVER_URL);
  dataflowHyperLink.setHyperlinkTarget(SPRING_IO_DATAFLOW_INITIALIZR_SERVER_URL);

  customTextFieldWithHistory =
      new TextFieldWithStoredHistory("spring.assistant.initializr.custom.server.url.history");
}
 
Example #16
Source File: DiffNotifications.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
public static JPanel createNotification(@Nonnull String text, @Nullable final Color background, boolean showHideAction) {
  final EditorNotificationPanel panel = new EditorNotificationPanel(background);
  panel.text(text);
  if (showHideAction) {
    HyperlinkLabel link = panel.createActionLabel("Hide", () -> panel.setVisible(false));
    link.setToolTipText("Hide this notification");
  }
  return panel;
}
 
Example #17
Source File: DependencyDetail.java    From intellij-spring-assistant with MIT License 5 votes vote down vote up
private HyperlinkLabel newHyperLink(DependencyLink dependencyLink, String bootVersion) {
  String title = dependencyLink.getTitle();
  String href = dependencyLink.getHrefAfterReplacement(bootVersion);
  String text = title != null ? title : href;
  HyperlinkLabel hyperlinkLabel = new HyperlinkLabel(text);
  hyperlinkLabel.setToolTipText(text);
  hyperlinkLabel.setHyperlinkTarget(href);
  hyperlinkLabel.setFont(smallFont());
  hyperlinkLabel.setBackground(JBColor.RED);
  hyperlinkLabel.setForeground(JBColor.YELLOW);
  return hyperlinkLabel;
}