use of com.intellij.ui.HyperlinkLabel in project android by JetBrains.
the class NlPropertiesPanel method createViewAllPropertiesLinkPanel.
@NotNull
private JComponent createViewAllPropertiesLinkPanel(boolean viewAllProperties) {
HyperlinkLabel textLink = new HyperlinkLabel();
textLink.setHyperlinkText(viewAllProperties ? ViewAllPropertiesAction.VIEW_ALL_PROPERTIES : ViewAllPropertiesAction.VIEW_FEWER_PROPERTIES);
textLink.addHyperlinkListener(event -> setAllPropertiesPanelVisible(event, viewAllProperties));
HyperlinkLabel iconLink = new HyperlinkLabel();
iconLink.setIcon(AndroidIcons.NeleIcons.ToggleProperties);
iconLink.setFocusable(false);
iconLink.setUseIconAsLink(true);
iconLink.addHyperlinkListener(event -> setAllPropertiesPanelVisible(event, viewAllProperties));
JPanel linkPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
linkPanel.setOpaque(false);
linkPanel.add(textLink);
linkPanel.add(iconLink);
return linkPanel;
}
use of com.intellij.ui.HyperlinkLabel in project android by JetBrains.
the class ConnectionDetailsView method update.
/**
* Updates the view to show given data. If given {@code httpData} is not null, show the details and set the view to be visible;
* otherwise, clears the view and set view to be invisible.
*/
public void update(@Nullable HttpData httpData) {
setBackground(JBColor.background());
myEditorPanel.removeAll();
myFieldsPanel.removeAll();
myCallstackView.setText("");
if (httpData != null) {
VirtualFile payloadVirtualFile = httpData.getResponsePayloadFile() != null ? LocalFileSystem.getInstance().findFileByIoFile(httpData.getResponsePayloadFile()) : null;
if (payloadVirtualFile != null) {
// TODO: Find proper project to refactor this.
Project project = ProjectManager.getInstance().getDefaultProject();
// TODO: Investigate when the editor provider is null.
FileEditorProvider[] editorProviders = FileEditorProviderManager.getInstance().getProviders(project, payloadVirtualFile);
FileEditor editor = editorProviders.length > 0 ? editorProviders[0].createEditor(project, payloadVirtualFile) : null;
if (editor != null) {
myEditorPanel.add(editor.getComponent(), BorderLayout.CENTER);
}
}
int row = 0;
myFieldsPanel.add(new NoWrapBoldLabel("Request"), new TabularLayout.Constraint(row, 0));
myFieldsPanel.add(new JLabel(HttpData.getUrlName(httpData.getUrl())), new TabularLayout.Constraint(row, 2));
String contentType = httpData.getResponseField(HttpData.FIELD_CONTENT_TYPE);
if (contentType != null) {
row++;
myFieldsPanel.add(new NoWrapBoldLabel("Content type"), new TabularLayout.Constraint(row, 0));
// Content type looks like "type/subtype;" or "type/subtype; parameters".
// Always convert to "type"
contentType = contentType.split(";")[0];
myFieldsPanel.add(new JLabel(contentType), new TabularLayout.Constraint(row, 2));
}
HyperlinkLabel urlLabel = new HyperlinkLabel(httpData.getUrl());
urlLabel.setHyperlinkTarget(httpData.getUrl());
row++;
myFieldsPanel.add(new NoWrapBoldLabel("URL"), new TabularLayout.Constraint(row, 0));
myFieldsPanel.add(urlLabel, new TabularLayout.Constraint(row, 2));
String contentLength = httpData.getResponseField(HttpData.FIELD_CONTENT_LENGTH);
if (contentLength != null) {
contentLength = contentLength.split(";")[0];
row++;
myFieldsPanel.add(new NoWrapBoldLabel("Content length"), new TabularLayout.Constraint(row, 0));
myFieldsPanel.add(new JLabel(contentLength), new TabularLayout.Constraint(row, 2));
}
// TODO: We are showing the callstack but we can't currently click on any of the links to
// navigate to the code.
myCallstackView.setText(httpData.getTrace());
repaint();
}
setVisible(httpData != null);
revalidate();
}
use of com.intellij.ui.HyperlinkLabel in project scss-lint-plugin by idok.
the class ScssLintInspection method createHyperLink.
@NotNull
private HyperlinkLabel createHyperLink() {
// List path = ContainerUtil.newArrayList(JSBundle.message("settings.javascript.root.configurable.name"), JSBundle.message("settings.javascript.linters.configurable.name"), getDisplayName());
List<String> path = ContainerUtil.newArrayList(ScssLintBundle.message("scss.inspections.group.name"), ScssLintBundle.message("scss.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);
Project project = CommonDataKeys.PROJECT.getData(dataContext);
if (project != null) {
showSettings(project);
// } else {
// new ScssLintSettingsPage(null).showSettings();
}
// Settings settings = (Settings) Settings.KEY.getData(dataContext);
// if (settings == null) {
// configurable.showEditDialog();
// } else {
// settings.select(settings.find(getId()));
// }
//
// 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(ScssLintInspection.this.getId());
// if (configurable != null) {
// optionsEditor.clearSearchAndSelect(configurable);
// }
//
//
//
// Project project = CommonDataKeys.PROJECT.getData(dataContext);
// if(project == null) {
// LOG.warn("No project found in data context");
// } else {
// JSLinterConfigurable configurable = JSLinterInspection.this.getExternalAnnotatorForBatchInspection().createSettingsConfigurable(project);
// Settings settings = (Settings)Settings.KEY.getData(dataContext);
// if(settings == null) {
// configurable.showEditDialog();
// } else {
// settings.select(settings.find(configurable.getId()));
// }
// }
}
});
return settingsLink;
}
use of com.intellij.ui.HyperlinkLabel in project scss-lint-plugin by idok.
the class ScssLintInspection method createOptionsPanel.
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;
}
use of com.intellij.ui.HyperlinkLabel in project intellij-community by JetBrains.
the class IntentionDescriptionPanel method setupPoweredByPanel.
private void setupPoweredByPanel(final IntentionActionMetaData actionMetaData) {
PluginId pluginId = actionMetaData == null ? null : actionMetaData.getPluginId();
JComponent owner;
if (pluginId == null) {
@NonNls String label = XmlStringUtil.wrapInHtml("<b>" + ApplicationNamesInfo.getInstance().getFullProductName() + "</b>");
owner = new JLabel(label);
} else {
final IdeaPluginDescriptor pluginDescriptor = PluginManager.getPlugin(pluginId);
HyperlinkLabel label = new HyperlinkLabel(CodeInsightBundle.message("powered.by.plugin", pluginDescriptor.getName()));
label.addHyperlinkListener(new HyperlinkListener() {
@Override
public void hyperlinkUpdate(HyperlinkEvent e) {
final ShowSettingsUtil util = ShowSettingsUtil.getInstance();
final PluginManagerConfigurable pluginConfigurable = new PluginManagerConfigurable(PluginManagerUISettings.getInstance());
final Project project = ProjectManager.getInstance().getDefaultProject();
util.editConfigurable(project, pluginConfigurable, () -> pluginConfigurable.select(pluginDescriptor));
}
});
owner = label;
}
//myPoweredByContainer.setVisible(true);
myPoweredByPanel.removeAll();
myPoweredByPanel.add(owner, BorderLayout.CENTER);
}
Aggregations