Java源码示例:com.intellij.ui.HyperlinkLabel
示例1
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());
}
}
示例2
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());
}
}
示例3
@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;
}
示例4
@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;
}
示例5
@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;
}
示例6
@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;
}
示例7
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();
}
示例8
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;
}
示例9
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;
}
示例10
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");
}
示例11
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");
}
示例12
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");
}
示例13
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;
}
示例14
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;
}
示例15
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;
}
示例16
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;
}
示例17
@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;
}