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(); }
@Override public void addSupport( @NotNull Module module, @NotNull ModifiableRootModel rootModel, @Nullable Library library) { AppEngineSupportProvider.this.addSupport( module, rootModel, myFrameworkSupportModel, mySdkEditor.getPath(), PersistenceApiComboboxUtil.getSelectedApi(myPersistenceApiComboBox)); }
private void checkSdk() { final String path = mySdkEditor.getPath(); if (StringUtil.isEmptyOrSpaces(path)) { myErrorLabel.setVisible(true); myErrorLabel.setHyperlinkText("App Engine SDK path not specified. ", "Download", ""); myMainPanel.repaint(); return; } final ValidationResult result = AppEngineSdkUtil.checkPath(path); myErrorLabel.setVisible(!result.isOk()); if (!result.isOk()) { myErrorLabel.setText("App Engine SDK path is not correct"); } myMainPanel.repaint(); }