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();
    }
示例#2
0
  @NotNull
  private static JPanel createLayerConfigurationPanel(@NotNull final ModuleEditor moduleEditor) {
    BorderLayoutPanel panel = JBUI.Panels.simplePanel();

    ModifiableRootModel moduleRootModel = moduleEditor.getModifiableRootModelProxy();

    final MutableCollectionComboBoxModel<String> model =
        new MutableCollectionComboBoxModel<String>(
            new ArrayList<String>(moduleRootModel.getLayers().keySet()),
            moduleRootModel.getCurrentLayerName());

    final ComboBox comboBox = new ComboBox(model);
    comboBox.setEnabled(model.getSize() > 1);

    moduleEditor.addChangeListener(
        new ModuleEditor.ChangeListener() {
          @Override
          public void moduleStateChanged(ModifiableRootModel moduleRootModel) {
            model.update(new ArrayList<String>(moduleRootModel.getLayers().keySet()));
            model.setSelectedItem(moduleRootModel.getCurrentLayerName());
            model.update();

            comboBox.setEnabled(comboBox.getItemCount() > 1);
          }
        });

    comboBox.addItemListener(
        new ItemListener() {
          @Override
          public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
              moduleEditor
                  .getModifiableRootModelProxy()
                  .setCurrentLayer((String) comboBox.getSelectedItem());
            }
          }
        });

    DefaultActionGroup group = new DefaultActionGroup();
    group.add(new NewLayerAction(moduleEditor, false));
    group.add(new DeleteLayerAction(moduleEditor));
    group.add(new NewLayerAction(moduleEditor, true));

    ActionToolbar actionToolbar =
        ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, group, true);
    JComponent toolbarComponent = actionToolbar.getComponent();
    toolbarComponent.setBorder(JBUI.Borders.empty());

    panel.addToLeft(LabeledComponent.left(comboBox, "Layer")).addToRight(toolbarComponent);
    return panel;
  }
 private void initAirRuntimeChooser() {
   final FileChooserDescriptor descriptor =
       new FileChooserDescriptor(true, true, true, false, false, false) {
         public boolean isFileVisible(final VirtualFile file, final boolean showHiddenFiles) {
           return super.isFileVisible(file, showHiddenFiles)
               && (file.isDirectory() || ("zip".equalsIgnoreCase(file.getExtension())));
         }
       };
   myAirRuntimeComponent
       .getComponent()
       .addBrowseFolderListener(
           "Select AIR Runtime",
           "Select AIR Runtime as a directory like <Flex SDK>/runtimes/AIR/win/ or as a .zip file",
           null,
           descriptor);
 }
    private void initAdlChooser() {
      final FileChooserDescriptor descriptor =
          new FileChooserDescriptor(true, false, false, false, false, false) {
            public boolean isFileVisible(final VirtualFile file, final boolean showHiddenFiles) {
              return super.isFileVisible(file, showHiddenFiles)
                  && (file.isDirectory()
                      || (file.getName().startsWith("adl")
                          && isExecutableExtension(file.getExtension())));
            }

            private boolean isExecutableExtension(final String extension) {
              return SystemInfo.isWindows
                  ? "exe".equalsIgnoreCase(extension)
                  : extension == null || "uexe".equalsIgnoreCase(extension);
            }
          };

      myAdlComponent
          .getComponent()
          .addBrowseFolderListener(
              "Select ADL executable file",
              null,
              null,
              descriptor,
              new TextComponentAccessor<JTextField>() {
                public void setText(final JTextField component, @NotNull final String text) {
                  component.setText(text);
                  final String adlPath = FileUtil.toSystemDependentName(text);
                  if (adlPath.endsWith(FlexSdkUtils.ADL_RELATIVE_PATH)) {
                    final String runtimePath =
                        adlPath.substring(
                                0, adlPath.length() - FlexSdkUtils.ADL_RELATIVE_PATH.length())
                            + FlexSdkUtils.AIR_RUNTIME_RELATIVE_PATH;
                    myAirRuntimeComponent.getComponent().setText(runtimePath);
                  }
                }

                public String getText(final JTextField component) {
                  return component.getText();
                }
              });
    }
 String getAirRuntimePath() {
   return FileUtil.toSystemIndependentName(
       myAirRuntimeComponent.getComponent().getText().trim());
 }
 void setAirRuntimePath(final String airRuntimePath) {
   myAirRuntimeComponent.getComponent().setText(FileUtil.toSystemDependentName(airRuntimePath));
 }
 String getAdlPath() {
   return FileUtil.toSystemIndependentName(myAdlComponent.getComponent().getText().trim());
 }
 void setAdlPath(final String adlPath) {
   myAdlComponent.getComponent().setText(FileUtil.toSystemDependentName(adlPath));
 }