@NotNull private HyperlinkLabel createHyperLink() { List<String> path = ContainerUtil.newArrayList(StylintBundle.message("stylint.inspections.group.name"), StylintBundle.message("stylint.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); } } }); return settingsLink; }
@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; }
public static HyperlinkLabel createTooltip(final String message) { final HyperlinkLabel link = new HyperlinkLabel(""); link.setIcon(AllIcons.General.Help_small); link.setUseIconAsLink(true); link.setIconTextGap(0); link.addHyperlinkListener(new HyperlinkAdapter() { @Override protected void hyperlinkActivated(HyperlinkEvent e) { final JLabel label = new JLabel(message); label.setBorder(HintUtil.createHintBorder()); label.setBackground(HintUtil.INFORMATION_COLOR); label.setOpaque(true); HintManager.getInstance() .showHint(label, RelativePoint.getSouthEastOf(link), HintManager.HIDE_BY_ANY_KEY | HintManager.HIDE_BY_TEXT_CHANGE, -1); } }); return link; }
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(); }
private void createNdkDownloadLink() { myNdkDownloadHyperlinkLabel = new HyperlinkLabel(); myNdkDownloadHyperlinkLabel.setHyperlinkText("", "Download", " Android NDK."); myNdkDownloadHyperlinkLabel.addHyperlinkListener(new HyperlinkAdapter() { @Override protected void hyperlinkActivated(HyperlinkEvent e) { List<IPkgDesc> requested = ImmutableList.of(PkgDesc.Builder.newNdk(FullRevision.NOT_SPECIFIED).create()); SdkQuickfixWizard wizard = new SdkQuickfixWizard(null, null, requested); wizard.init(); if (wizard.showAndGet()) { File ndk = IdeSdks.getAndroidNdkPath(); if (ndk != null) { myNdkLocationTextField.setText(ndk.getPath()); } validateState(); } } }); }
private void addToLinkPanel(@NotNull String text, @NotNull final URI uri) { HyperlinkLabel hyperlinkLabel = new HyperlinkLabel(text); hyperlinkLabel.addHyperlinkListener(new HyperlinkAdapter() { @Override protected void hyperlinkActivated(HyperlinkEvent e) { try { Desktop.getDesktop().browse(uri); } catch (IOException ex) { // Don't care } } }); // Setting the padding on myLinksPanel puts in ugly leading space, so we instead space links // apart using invisible rigid areas instead. if (myLinksPanel.getComponentCount() > 0) { myLinksPanel.add(Box.createRigidArea(new Dimension(10, 0))); } myLinksPanel.add(hyperlinkLabel); }
public HyperlinkLabel addLink(@NotNull String text, @NotNull final URI uri) { HyperlinkLabel linkLabel = new HyperlinkLabel(text); linkLabel.addHyperlinkListener(new HyperlinkListener() { @Override public void hyperlinkUpdate(HyperlinkEvent e) { try { Desktop.getDesktop().browse(uri); } catch (IOException e1) { // Don't care } } }); addComponent(linkLabel); return linkLabel; }
private static void configureHyperLinkLabelForClassName(final RenderingParameters renderingParameters, HyperlinkLabel link, @Nullable final String className) { link.setOpaque(false); if (className == null) { return; } link.setHyperlinkText(className.substring(1 + className.lastIndexOf('.'))); link.addHyperlinkListener(new HyperlinkListener() { @Override public void hyperlinkUpdate(HyperlinkEvent hyperlinkEvent) { PsiClass psiClass = NavigationEditorUtils.getPsiClass(renderingParameters.configuration.getModule(), className); if (psiClass != null) { AndroidRootComponent.launchEditor(renderingParameters, psiClass.getContainingFile(), false); } } }); }
private static void configureHyperlinkForXMLFile(final RenderingParameters renderingParameters, HyperlinkLabel link, @Nullable final String linkText, @Nullable final String xmlFileName, final boolean isMenu) { link.setOpaque(false); link.setHyperlinkText(linkText == null ? "" : linkText); link.addHyperlinkListener(new HyperlinkListener() { @Override public void hyperlinkUpdate(HyperlinkEvent hyperlinkEvent) { PsiFile layoutXmlFile = NavigationView.getLayoutXmlFile(isMenu, xmlFileName, renderingParameters.configuration, renderingParameters.project); AndroidRootComponent.launchEditor(renderingParameters, layoutXmlFile, false); } }); }
public AvdEditWizardFixture editAvdWithName(@NotNull String name) { final TableView tableView = robot().finder().findByType(target(), TableView.class, true); JTableFixture tableFixture = new JTableFixture(robot(), tableView); JTableCellFixture cell = tableFixture.cell(name); final TableCell actionCell = TableCell.row(cell.row()).column(7); JTableCellFixture actionCellFixture = tableFixture.cell(actionCell); execute(new GuiTask() { @Override protected void executeInEDT() throws Throwable { tableView.editCellAt(actionCell.row, actionCell.column); } }); JPanel actionPanel = (JPanel)actionCellFixture.editor(); HyperlinkLabel editButtonLabel = robot().finder().find(actionPanel, new GenericTypeMatcher<HyperlinkLabel>(HyperlinkLabel.class) { @Override protected boolean isMatching(@NotNull HyperlinkLabel component) { return "Edit this AVD".equals(component.getToolTipText()); } }); robot().click(editButtonLabel); return AvdEditWizardFixture.find(robot()); }
@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; }
@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", CoffeeLintBundle.message("coffeelint.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(CoffeeLintInspection.this.getId()); if (configurable != null) { optionsEditor.clearSearchAndSelect(configurable); } } }); return settingsLink; }
@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; }
private static void addLicenses(JPanel panel, Set<License> licenses) { if (licenses == null) { return; } JPanel licensesPanel = new JBPanel(new HorizontalLayout(1)); licensesPanel.setBackground(UIUtil.getTableBackground()); for (License license : licenses) { if (CollectionUtils.isEmpty(license.moreInfoUrl)) { licensesPanel.add(createJTextArea(createLicenseString(license), false)); continue; } HyperlinkLabel hyperlinkLabel = new HyperlinkLabel(createLicenseString(license)); hyperlinkLabel.setBackground(UIUtil.getTableBackground()); hyperlinkLabel.setHyperlinkTarget(license.moreInfoUrl.get(0)); licensesPanel.add(hyperlinkLabel); } JBLabel headerLabel = new JBLabel("Licenses:"); headerLabel.setBackground(UIUtil.getTableBackground()); headerLabel.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.NORTHWEST; c.ipadx = 20; c.ipady = 3; c.gridy = 4; panel.add(headerLabel, c); c.gridx = 1; c.weightx = 0.9; panel.add(licensesPanel, c); }
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; }
public ConfigurableHandler(HyperlinkLabel label, final UnnamedConfigurable serverConfigurable, C serverConfiguration, ServerType<C> serverType) { myServerConfigurable = serverConfigurable; myServerConfiguration = serverConfiguration; myServerType = serverType; label.setHyperlinkText("Upload Public SSH Key"); label.addHyperlinkListener(this); myLabel = label; }
@NotNull public static HyperlinkLabel createWebHyperlink(@NotNull String text, @NotNull String url) { HyperlinkLabel hyperlink = new HyperlinkLabel(text); hyperlink.setHyperlinkTarget(url); DefaultActionGroup actionGroup = new DefaultActionGroup(); actionGroup.add(new OpenLinkInBrowser(url)); actionGroup.add(new CopyLinkAction(url)); hyperlink.setComponentPopupMenu(ActionManager.getInstance().createActionPopupMenu("web hyperlink", actionGroup).getComponent()); return hyperlink; }
@Nullable @Override public JComponent createOptionsPanel() { final HyperlinkLabel codeStyleHyperlink = new HyperlinkLabel("Edit Code Style settings"); codeStyleHyperlink.addHyperlinkListener(new HyperlinkListener() { @Override public void hyperlinkUpdate(HyperlinkEvent e) { DataManager.getInstance().getDataContextFromFocus().doWhenDone(new Consumer<DataContext>() { @Override public void consume(DataContext context) { if (context != null) { final Settings settings = Settings.KEY.getData(context); if (settings != null) { settings.select(settings.find(CodeStyleSchemesConfigurable.class)); } else { ShowSettingsUtil.getInstance() .showSettingsDialog(CommonDataKeys.PROJECT.getData(context), CodeStyleSchemesConfigurable.class); } } } }); } }); final JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); panel.add(codeStyleHyperlink, BorderLayout.NORTH); return panel; }
private void createNdkResetLink() { myNdkResetHyperlinkLabel = new HyperlinkLabel(); myNdkResetHyperlinkLabel.setHyperlinkText("", "Select", " default NDK"); myNdkResetHyperlinkLabel.addHyperlinkListener(new HyperlinkAdapter() { @Override protected void hyperlinkActivated(HyperlinkEvent e) { // known non-null since otherwise we won't show the link //noinspection ConstantConditions myNdkLocationTextField.setText(IdeSdks.getAndroidNdkPath().getPath()); } }); }
private void parseUiItemTag(@NotNull Attributes attributes) { parseGridCoords(attributes); String type = requireAttr(attributes, Schema.UiItem.ATTR_TYPE); if (type.equals(Schema.UiItem.Type.VALUE_BUTTON)) { JButton button = myPanelBuilder.addButton(); bindButtonProperties(button, attributes); bindComponentProperties(button, attributes); } else if (type.equals(Schema.UiItem.Type.VALUE_CHECKBOX)) { JCheckBox checkbox = myPanelBuilder.addCheckbox(); bindComponentProperties(checkbox, attributes); bindCheckboxProperties(checkbox, attributes); } else if (type.equals(Schema.UiItem.Type.VALUE_INPUT)) { JTextField field = myPanelBuilder.addField(); bindComponentProperties(field, attributes); bindFieldProperties(field, attributes); } else if (type.equals(Schema.UiItem.Type.VALUE_LABEL)) { JLabel label = myPanelBuilder.addLabel(); bindComponentProperties(label, attributes); bindLabelProperties(label, attributes); } else if (type.equals(Schema.UiItem.Type.VALUE_LINK)) { HyperlinkLabel link = myPanelBuilder.addLink(requireAttr(attributes, Schema.UiItem.Type.Text.ATTR_TEXT), toUri(requireAttr(attributes, Schema.UiItem.Type.Link.ATTR_URL))); bindComponentProperties(link, attributes); } else if (type.equals(Schema.UiItem.Type.VALUE_PULLDOWN)) { String listKey = requireAttr(attributes, Schema.UiItem.Type.Pulldown.ATTR_LIST); ObservableList<String> backingList = getList(listKey); JComboBox comboBox = myPanelBuilder.addComboBox(backingList); bindComponentProperties(comboBox, attributes); bindComboBoxProperties(comboBox, attributes); } }
@NotNull private static HyperlinkLabel createHyperlinkLabel(@NotNull String beforeLinkText, @NotNull String linkText, @NotNull String afterLinkText, @NotNull String target) { HyperlinkLabel label = new HyperlinkLabel(); label.setHyperlinkText(beforeLinkText, linkText, afterLinkText); label.setHyperlinkTarget(target); return label; }
public HaxmAlert() { myErrorInstructionsLink = new HyperlinkLabel(); myWarningMessage = new JBLabel() { @Override public Dimension getPreferredSize() { // Since this contains auto-wrapped text, the preferred height will not be set until repaint(). The below will set it as soon // as the actual width is known. This allows the wizard dialog to be set to the correct size even before this step is shown. final View view = (View)getClientProperty("html"); Component parent = getParent(); if (view != null && parent != null && parent.getWidth() > 0) { view.setSize(parent.getWidth(), 0); return new Dimension((int)view.getPreferredSpan(View.X_AXIS), (int)view.getPreferredSpan(View.Y_AXIS)); } return super.getPreferredSize(); } }; this.setLayout(new GridLayoutManager(2, 1)); GridConstraints constraints = new GridConstraints(); constraints.setAnchor(GridConstraints.ANCHOR_WEST); add(myWarningMessage, constraints); constraints.setRow(1); add(myErrorInstructionsLink, constraints); myErrorInstructionsLink.setOpaque(false); myWarningMessage.setForeground(JBColor.RED); myWarningMessage.setHorizontalAlignment(SwingConstants.LEFT); setOpaque(false); this.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("Recommendation"), BorderFactory.createEmptyBorder(0, 5, 3, 5))); }
private void findCompatibleSdk(final FormFactor formFactor, final int minSdkLevel, final HyperlinkLabel link, final JPanel cardPanel) { final SdkState state = SdkState.getInstance(AndroidSdkUtils.tryToChooseAndroidSdk()); Runnable onComplete = new Runnable() { @Override public void run() { ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { List<RemotePkgInfo> packageList = Lists.newArrayList(state.getPackages().getNewPkgs()); Collections.sort(packageList); Iterator<RemotePkgInfo> result = Iterables.filter(packageList, FormFactorUtils.getMinSdkPackageFilter(formFactor, minSdkLevel)).iterator(); if (result.hasNext()) { showDownloadLink(link, result.next(), cardPanel); } else { cardPanel.setVisible(false); } } }, ModalityState.any()); } }; Runnable onError = new Runnable() { @Override public void run() { ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { cardPanel.setVisible(false); } }, ModalityState.any()); } }; state.loadAsync(SdkState.DEFAULT_EXPIRATION_PERIOD_MS, false, null, onComplete, onError, false); }
private void showDownloadLink(final HyperlinkLabel link, final RemotePkgInfo remote, final JPanel cardPanel) { link.addHyperlinkListener(new HyperlinkAdapter() { @Override protected void hyperlinkActivated(HyperlinkEvent e) { showDownloadWizard(remote.getPkgDesc()); populateAdditionalFormFactors(); myFormFactorPanel.validate(); } }); ((JBCardLayout)cardPanel.getLayout()).show(cardPanel, DOWNLOAD_LINK_CARD); }
@Override protected void configureInspector(final Inspector inspector) { myState.accept(new State.Visitor() { @Override public void visit(ActivityState activity) { final Module module = myRenderingParameters.configuration.getModule(); ActivityInspector activityInspector = new ActivityInspector(); HyperlinkLabel classNameLink = activityInspector.classNameLabel; final String className = activity.getClassName(); configureHyperLinkLabelForClassName(myRenderingParameters, classNameLink, className); HyperlinkLabel xmlFileLink = activityInspector.xmlFileNameLabel; String xmlFileName = Analyser.getXMLFileName(module, activity.getClassName(), true); configureHyperlinkForXMLFile(myRenderingParameters, xmlFileLink, xmlFileName, false); JPanel fragmentList = activityInspector.fragmentList; fragmentList.removeAll(); fragmentList.setLayout(new BoxLayout(fragmentList, BoxLayout.Y_AXIS)); for (FragmentEntry entry : activity.getFragments()) { HyperlinkLabel hyperlinkLabel = new HyperlinkLabel(); configureHyperLinkLabelForClassName(myRenderingParameters, hyperlinkLabel, entry.className); fragmentList.add(hyperlinkLabel); } inspector.setInspectorComponent(activityInspector.container); } @Override public void visit(MenuState menu) { MenuInspector menuInspector = new MenuInspector(); configureHyperLinkLabelForClassName(myRenderingParameters, menuInspector.classNameLabel, menu.getClassName()); configureHyperlinkForXMLFile(myRenderingParameters, menuInspector.xmlFileNameLabel, menu.getXmlResourceName(), true); inspector.setInspectorComponent(menuInspector.container); } }); }
public void performAction(@NotNull final String label) { HyperlinkLabel link = robot().finder().find(target(), new GenericTypeMatcher<HyperlinkLabel>(HyperlinkLabel.class) { @Override protected boolean isMatching(@NotNull HyperlinkLabel hyperlinkLabel) { // IntelliJ's HyperLinkLabel class does not expose the getText method (it is package private) return hyperlinkLabel.isShowing() && label.equals(Reflection.method("getText").withReturnType(String.class).in(hyperlinkLabel).invoke()); } }); driver().click(link); }
private AppEngineSupportConfigurable(FrameworkSupportModel model) { myFrameworkSupportModel = model; mySdkEditor = new AppEngineSdkEditor(model.getProject()); mySdkPanel.add(LabeledComponent.create(mySdkEditor.getMainComponent(), "Google App Engine SDK:"), BorderLayout.CENTER); PersistenceApiComboboxUtil.setComboboxModel(myPersistenceApiComboBox, true); if (model.isFrameworkSelected(JPA_FRAMEWORK_ID)) { myPersistenceApiComboBox.setSelectedItem(PersistenceApi.JPA.getDisplayName()); } model.addFrameworkListener(this); myErrorLabel = new HyperlinkLabel(); myErrorLabel.setIcon(AllIcons.RunConfigurations.ConfigurationWarning); myErrorLabel.setVisible(false); myErrorLabel.setHyperlinkTarget(AppEngineSdkUtil.APP_ENGINE_DOWNLOAD_URL); myErrorPanel.add(BorderLayout.CENTER, myErrorLabel); final Component component = mySdkEditor.getComboBox().getEditor().getEditorComponent(); if (component instanceof JTextComponent) { ((JTextComponent)component).getDocument().addDocumentListener(new DocumentAdapter() { @Override protected void textChanged(DocumentEvent e) { checkSdk(); } }); } checkSdk(); }
private void createUIComponents() { // TODO mnemonic myProxyPasswordLabel = new HyperlinkLabel() { @Override protected void applyRenderingHints(Graphics g) { // do nothing, otherwise label text will be antialiased } }; }
public AppEngineApplicationInfoPanel() { super(new BorderLayout(COMPONENTS_HORIZONTAL_PADDING, COMPONENTS_VERTICAL_PADDING)); errorIcon = new JLabel(AllIcons.Ide.Error); errorIcon.setVisible(false); messageText = new HyperlinkLabel(); messageText.setOpaque(false); add(errorIcon, BorderLayout.WEST); add(messageText); }
/** * Creates a clickable label with URL link and the given description text. */ public static HyperlinkLabel createHyperLinkLabel(JComponent parent, String description, final String url) { HyperlinkLabel label = new HyperlinkLabel(description); label.addHyperlinkListener(new HyperlinkListener() { @Override public void hyperlinkUpdate(HyperlinkEvent e) { BrowserUtil.open(url); } }); parent.add(label); return label; }
private AppEngineSupportConfigurable(FrameworkSupportModel model) { super(AppEngineSupportProvider.this, model); mySdkEditor = new AppEngineSdkEditor(model.getProject()); mySdkPanel.add(LabeledComponent.create(mySdkEditor.getMainComponent(), "Google App Engine SDK:"), BorderLayout.CENTER); PersistenceApiComboboxUtil.setComboboxModel(myPersistenceApiComboBox, true); if (model.isFrameworkSelected(JPA_PROVIDER_ID)) { myPersistenceApiComboBox.setSelectedItem(PersistenceApi.JPA.getDisplayName()); } model.addFrameworkListener(this); myErrorLabel = new HyperlinkLabel(); myErrorLabel.setIcon(AllIcons.RunConfigurations.ConfigurationWarning); myErrorLabel.setVisible(false); myErrorLabel.setHyperlinkTarget(AppEngineSdkUtil.APP_ENGINE_DOWNLOAD_URL); myErrorPanel.add(BorderLayout.CENTER, myErrorLabel); final Component component = mySdkEditor.getComboBox().getEditor().getEditorComponent(); if (component instanceof JTextComponent) { ((JTextComponent)component).getDocument().addDocumentListener(new DocumentAdapter() { @Override protected void textChanged(DocumentEvent e) { checkSdk(); } }); } checkSdk(); }
public HyperlinkLabel createActionLabel(@NotNull final AnAction anAction) { Icon icon = anAction.getTemplatePresentation().getIcon(); HyperlinkLabel label = new HyperlinkLabel(icon == null ? anAction.getTemplatePresentation().getText() : ""); if (icon != null) { label.setIcon(icon); label.setUseIconAsLink(true); } label.addHyperlinkListener(new HyperlinkAdapter() { protected void hyperlinkActivated(HyperlinkEvent e) { executeAction(anAction); } }); this.myLinksPanel.add(label); return label; }
@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; }