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(); }
private void addErrorMessage(final FixableMessageInfo message, Icon icon) { if (message.myLinkText.length() > 0 || message.myAfterLinkText.length() > 0) { HyperlinkLabel warnLabel = new HyperlinkLabel(); warnLabel.setOpaque(false); warnLabel.setHyperlinkText( message.myBeforeLinkText, message.myLinkText, message.myAfterLinkText); warnLabel.setIcon(icon); if (message.myQuickFix != null) { warnLabel.addHyperlinkListener( new HyperlinkListener() { public void hyperlinkUpdate(final HyperlinkEvent e) { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { message.myQuickFix.run(); } } }); } myErrorMessages.add(warnLabel); } else { JBLabel warnLabel = new JBLabel(); warnLabel.setOpaque(false); warnLabel.setText( "<html><body>" + message.myBeforeLinkText.replace("\n", "<br>") + "</body></html>"); warnLabel.setIcon(icon); myErrorMessages.add(warnLabel); } if (message.myAdditionalFixes != null && message.myAdditionalFixes.size() > 0) { JPanel fixesPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0)); fixesPanel.setBorder(IdeBorderFactory.createEmptyBorder(3, 0, 10, 0)); fixesPanel.setOpaque(false); fixesPanel.add(Box.createHorizontalStrut(icon.getIconWidth())); for (Pair<String, Runnable> pair : message.myAdditionalFixes) { HyperlinkLabel fixLabel = new HyperlinkLabel(); fixLabel.setOpaque(false); fixLabel.setHyperlinkText(pair.getFirst()); final Runnable fix = pair.getSecond(); fixLabel.addHyperlinkListener( new HyperlinkListener() { @Override public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { fix.run(); } } }); fixesPanel.add(fixLabel); } myErrorMessages.add(fixesPanel); } }