• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java BrowseFilesListener类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.intellij.ide.util.BrowseFilesListener的典型用法代码示例。如果您正苦于以下问题:Java BrowseFilesListener类的具体用法?Java BrowseFilesListener怎么用?Java BrowseFilesListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



BrowseFilesListener类属于com.intellij.ide.util包,在下文中一共展示了BrowseFilesListener类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createUIComponents

import com.intellij.ide.util.BrowseFilesListener; //导入依赖的package包/类
private void createUIComponents() {
  myLanguageLevelCombo = new LanguageLevelCombo(JavaCoreBundle.message("default.language.level.description")) {
    @Override
    protected LanguageLevel getDefaultLevel() {
      Sdk sdk = myProjectJdkConfigurable.getSelectedProjectJdk();
      if (sdk == null) return null;
      JavaSdkVersion version = JavaSdk.getInstance().getVersion(sdk);
      return version == null ? null : version.getMaxLanguageLevel();
    }
  };
  final JTextField textField = new JTextField();
  final FileChooserDescriptor outputPathsChooserDescriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
  InsertPathAction.addTo(textField, outputPathsChooserDescriptor);
  outputPathsChooserDescriptor.setHideIgnored(false);
  BrowseFilesListener listener = new BrowseFilesListener(textField, "", ProjectBundle.message("project.compiler.output"), outputPathsChooserDescriptor);
  myProjectCompilerOutput = new FieldPanel(textField, null, null, listener, EmptyRunnable.getInstance());
  FileChooserFactory.getInstance().installFileCompletion(myProjectCompilerOutput.getTextField(), outputPathsChooserDescriptor, true, null);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:ProjectConfigurable.java


示例2: getAdditionalSettings

import com.intellij.ide.util.BrowseFilesListener; //导入依赖的package包/类
public JComponent getAdditionalSettings(final WizardContext wizardContext) {
  JTextField tfModuleFilePath = new JTextField();
  final String productName = ApplicationNamesInfo.getInstance().getProductName();
  final String message = IdeBundle.message("prompt.select.module.file.to.import", productName);
  final BrowseFilesListener listener = new BrowseFilesListener(tfModuleFilePath, message, null, new ModuleFileChooserDescriptor()) {
    @Override
    protected VirtualFile getFileToSelect() {
      final VirtualFile fileToSelect = super.getFileToSelect();
      if (fileToSelect != null) {
        return fileToSelect;
      }
      final Project project = wizardContext.getProject();
      return project != null ? project.getBaseDir() : null;
    }
  };
  myModulePathFieldPanel = new TextFieldWithBrowseButton(tfModuleFilePath, listener);
  onChosen(false);
  return myModulePathFieldPanel;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:ImportImlMode.java


示例3: createComponent

import com.intellij.ide.util.BrowseFilesListener; //导入依赖的package包/类
public JComponent createComponent() {
  // all listeners will be removed when dialog is closed
  mavenHomeComponent.getComponent().addBrowseFolderListener(ProjectBundle.message("maven.select.maven.home.directory"),
                                                            "",
                                                            null, BrowseFilesListener.SINGLE_DIRECTORY_DESCRIPTOR,
                                                            TextComponentAccessor.TEXT_FIELD_WITH_HISTORY_WHOLE_TEXT);
  mavenHomeField.addDocumentListener(new DocumentAdapter() {
    protected void textChanged(DocumentEvent e) {
      updateMavenVersionLabel();
    }
  });

  settingsFileComponent.getComponent().addBrowseFolderListener(ProjectBundle.message("maven.select.maven.settings.file"), "", null,
                                                               FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor());
  localRepositoryComponent.getComponent().addBrowseFolderListener(ProjectBundle.message("maven.select.local.repository"), "", null,
                                                                  FileChooserDescriptorFactory.createSingleFolderDescriptor());
  return panel;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:MavenEnvironmentForm.java


示例4: createComponent

import com.intellij.ide.util.BrowseFilesListener; //导入依赖的package包/类
public JComponent createComponent() {
  myPluginXML.addActionListener(new BrowseFilesListener(myPluginXML.getTextField(), DevKitBundle.message("deployment.directory.location", META_INF), DevKitBundle.message("saved.message.common", META_INF + File.separator + PLUGIN_XML), BrowseFilesListener.SINGLE_DIRECTORY_DESCRIPTOR));
  myManifest.addActionListener(new BrowseFilesListener(myManifest.getTextField(), DevKitBundle.message("deployment.view.select", MANIFEST_MF), DevKitBundle.message("manifest.selection", MANIFEST_MF), BrowseFilesListener.SINGLE_FILE_DESCRIPTOR));
  myManifest.setEnabled(myBuildProperties.isUseUserManifest());
  myUseUserManifest.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      final boolean selected = myUseUserManifest.isSelected();

      myManifest.setEnabled(selected);
    }
  });
  final GridBagConstraints gc = new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST,
                                                       GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0);
  myWholePanel.add(myPluginXMLLabel, gc);
  myWholePanel.add(myPluginXML, gc);
  JPanel manifestPanel = new JPanel(new GridBagLayout());
  manifestPanel.setBorder(IdeBorderFactory.createTitledBorder(DevKitBundle.message("manifest.settings"), true));
  gc.insets.left = 0;
  manifestPanel.add(myUseUserManifest, gc);
  gc.insets.left = 2;
  gc.weighty = 1.0;
  manifestPanel.add(myManifest, gc);
  myWholePanel.add(manifestPanel, gc);
  myWholePanel.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
  return myWholePanel;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:PluginModuleBuildConfEditor.java


示例5: JavaFxEditCertificatesDialog

import com.intellij.ide.util.BrowseFilesListener; //导入依赖的package包/类
protected JavaFxEditCertificatesDialog(JComponent parent, JavaFxArtifactProperties properties, Project project) {
  super(parent, true);
  setTitle("Choose Certificate");
  init();
  final ActionListener actionListener = new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      UIUtil.setEnabled(myPanel.myKeysPanel, !myPanel.mySelfSignedRadioButton.isSelected(), true);
    }
  };
  myPanel.mySelfSignedRadioButton.addActionListener(actionListener);
  myPanel.mySignedByKeyRadioButton.addActionListener(actionListener);
  final boolean selfSigning = properties.isSelfSigning();
  UIUtil.setEnabled(myPanel.myKeysPanel, !selfSigning, true);
  myPanel.mySelfSignedRadioButton.setSelected(selfSigning);
  myPanel.mySignedByKeyRadioButton.setSelected(!selfSigning);

  myPanel.myAliasTF.setText(properties.getAlias());
  myPanel.myKeystore.setText(properties.getKeystore());
  final String keypass = properties.getKeypass();
  myPanel.myKeypassTF.setText(keypass != null ? Base64Converter.decode(keypass) : "");
  final String storepass = properties.getStorepass();
  myPanel.myStorePassTF.setText(storepass != null ? Base64Converter.decode(storepass) : "");
  myPanel.myKeystore.addBrowseFolderListener("Choose Keystore File", "Select file containing generated keys", project, BrowseFilesListener.SINGLE_FILE_DESCRIPTOR);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:JavaFxEditCertificatesDialog.java


示例6: GroovyRunConfigurationEditor

import com.intellij.ide.util.BrowseFilesListener; //导入依赖的package包/类
public GroovyRunConfigurationEditor() {

    scriptPathField = new JTextField();
    final BrowseFilesListener scriptBrowseListener = new BrowseFilesListener(scriptPathField,
        "Script Path",
        "Specify path to script",
        new FileChooserDescriptor(true, false, false, false, false, false) {
          public boolean isFileSelectable(VirtualFile file) {
            return file.getFileType() == GroovyFileType.GROOVY_FILE_TYPE;
          }
        });
    final FieldPanel scriptFieldPanel = new FieldPanel(scriptPathField, null, null, scriptBrowseListener, null);
    scriptPathPanel.setLayout(new BorderLayout());
    scriptPathPanel.add(scriptFieldPanel, BorderLayout.CENTER);

    workDirField = new JTextField();
    final BrowseFilesListener workDirBrowseFilesListener = new BrowseFilesListener(workDirField,
        "Working directory",
        "Specify working directory",
        BrowseFilesListener.SINGLE_DIRECTORY_DESCRIPTOR);
    final FieldPanel workDirFieldPanel = new FieldPanel(workDirField, null, null, workDirBrowseFilesListener, null);
    workDirPanel.setLayout(new BorderLayout());
    workDirPanel.add(workDirFieldPanel, BorderLayout.CENTER);

    setAnchor(myEnvVariables.getLabel());
  }
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:27,代码来源:GroovyRunConfigurationEditor.java


示例7: createOutputPathPanel

import com.intellij.ide.util.BrowseFilesListener; //导入依赖的package包/类
private CommitableFieldPanel createOutputPathPanel(final String title, final CommitPathRunnable commitPathRunnable) {
  final JTextField textField = new JTextField();
  final FileChooserDescriptor outputPathsChooserDescriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
  outputPathsChooserDescriptor.setHideIgnored(false);
  InsertPathAction.addTo(textField, outputPathsChooserDescriptor);
  FileChooserFactory.getInstance().installFileCompletion(textField, outputPathsChooserDescriptor, true, null);

  CommitableFieldPanel commitableFieldPanel =
          new CommitableFieldPanel(textField, null, null, new BrowseFilesListener(textField, title, "", outputPathsChooserDescriptor), null);
  commitableFieldPanel.myCommitRunnable = new Runnable() {
    @Override
    public void run() {
      if (!getModel().isWritable()) {
        return;
      }
      String url = commitableFieldPanel.getUrl();
      commitPathRunnable.saveUrl(url);
    }
  };
  return commitableFieldPanel;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:22,代码来源:BuildElementsEditor.java


示例8: LuaCommonOptionsForm

import com.intellij.ide.util.BrowseFilesListener; //导入依赖的package包/类
public LuaCommonOptionsForm(LuaRunConfiguration luaRunConfiguration) {
    luaInterpreterEdit.addBrowseFolderListener("Select Lua Interpreter", "", luaRunConfiguration.getProject(), BrowseFilesListener.SINGLE_FILE_DESCRIPTOR);
    workingDirEdit.addBrowseFolderListener("Select Working Directory", "", luaRunConfiguration.getProject(), BrowseFilesListener.SINGLE_DIRECTORY_DESCRIPTOR);

    useSDKCheckbox.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            updateInterpreterOptionsWidgets();
        }
    });
}
 
开发者ID:internetisalie,项目名称:lua-for-idea,代码行数:12,代码来源:LuaCommonOptionsForm.java


示例9: GroovyRunConfigurationEditor

import com.intellij.ide.util.BrowseFilesListener; //导入依赖的package包/类
public GroovyRunConfigurationEditor() {

    scriptPathField = new JTextField();
    final BrowseFilesListener scriptBrowseListener = new BrowseFilesListener(scriptPathField,
        "Script Path",
        "Specify path to script",
        new FileChooserDescriptor(true, false, false, false, false, false) {
          @Override
          public boolean isFileSelectable(VirtualFile file) {
            return file.getFileType() == GroovyFileType.GROOVY_FILE_TYPE;
          }
        });
    final FieldPanel scriptFieldPanel = new FieldPanel(scriptPathField, null, null, scriptBrowseListener, null);
    scriptPathPanel.setLayout(new BorderLayout());
    scriptPathPanel.add(scriptFieldPanel, BorderLayout.CENTER);

    workDirField = new JTextField();
    final BrowseFilesListener workDirBrowseFilesListener = new BrowseFilesListener(workDirField,
        "Working directory",
        "Specify working directory",
        BrowseFilesListener.SINGLE_DIRECTORY_DESCRIPTOR);
    final FieldPanel workDirFieldPanel = new FieldPanel(workDirField, null, null, workDirBrowseFilesListener, null);
    workDirPanel.setLayout(new BorderLayout());
    workDirPanel.add(workDirFieldPanel, BorderLayout.CENTER);

    setAnchor(myEnvVariables.getLabel());
  }
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:GroovyRunConfigurationEditor.java


示例10: FileSelectorWithStoredHistory

import com.intellij.ide.util.BrowseFilesListener; //导入依赖的package包/类
private FileSelectorWithStoredHistory(TextFieldWithStoredHistory textField, String title) {
  super(textField, null);

  addBrowseFolderListener(
      title,
      "",
      null,
      BrowseFilesListener.SINGLE_FILE_DESCRIPTOR,
      TextComponentAccessor.TEXT_FIELD_WITH_STORED_HISTORY_WHOLE_TEXT);
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:11,代码来源:FileSelectorWithStoredHistory.java


示例11: AlternativeJREPanel

import com.intellij.ide.util.BrowseFilesListener; //导入依赖的package包/类
public AlternativeJREPanel() {
  myCbEnabled = new JBCheckBox(ExecutionBundle.message("run.configuration.use.alternate.jre.checkbox"));

  myFieldWithHistory = new TextFieldWithHistory();
  final ArrayList<String> foundJDKs = new ArrayList<String>();
  for (JreProvider provider : JreProvider.EP_NAME.getExtensions()) {
    String path = provider.getJrePath();
    if (!StringUtil.isEmpty(path)) {
      foundJDKs.add(path);
    }
  }
  final Sdk[] allJDKs = ProjectJdkTable.getInstance().getAllJdks();
  for (Sdk jdk : allJDKs) {
    foundJDKs.add(jdk.getHomePath());
  }
  myFieldWithHistory.setHistory(foundJDKs);
  myPathField = new ComponentWithBrowseButton<TextFieldWithHistory>(myFieldWithHistory, null);
  myPathField.addBrowseFolderListener(ExecutionBundle.message("run.configuration.select.alternate.jre.label"),
                                      ExecutionBundle.message("run.configuration.select.jre.dir.label"),
                                      null, BrowseFilesListener.SINGLE_DIRECTORY_DESCRIPTOR,
                                      TextComponentAccessor.TEXT_FIELD_WITH_HISTORY_WHOLE_TEXT);

  setLayout(new MigLayout("ins 0, gap 10, fill, flowx"));
  add(myCbEnabled, "shrinkx");
  add(myPathField, "growx, pushx");

  InsertPathAction.addTo(myFieldWithHistory.getTextEditor());

  myCbEnabled.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      enabledChanged();
    }
  });
  enabledChanged();

  setAnchor(myCbEnabled);

  updateUI();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:40,代码来源:AlternativeJREPanel.java


示例12: createUIComponents

import com.intellij.ide.util.BrowseFilesListener; //导入依赖的package包/类
private void createUIComponents() {
  myLanguageLevelCombo = new LanguageLevelCombo();
  final JTextField textField = new JTextField();
  final FileChooserDescriptor outputPathsChooserDescriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
  InsertPathAction.addTo(textField, outputPathsChooserDescriptor);
  outputPathsChooserDescriptor.setHideIgnored(false);
  BrowseFilesListener listener = new BrowseFilesListener(textField, "", ProjectBundle.message("project.compiler.output"), outputPathsChooserDescriptor);
  myProjectCompilerOutput = new FieldPanel(textField, null, null, listener, EmptyRunnable.getInstance());
  FileChooserFactory.getInstance().installFileCompletion(myProjectCompilerOutput.getTextField(), outputPathsChooserDescriptor, true, null);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:11,代码来源:ProjectConfigurable.java


示例13: addSourcePath

import com.intellij.ide.util.BrowseFilesListener; //导入依赖的package包/类
private void addSourcePath(SettingsStep settingsStep) {
  Project project = settingsStep.getContext().getProject();
  ComponentWithBrowseButton.BrowseFolderActionListener<JTextField> listener =
    new ComponentWithBrowseButton.BrowseFolderActionListener<JTextField>(
      IdeBundle.message("prompt.select.source.directory"), null, mySourcePath, project, BrowseFilesListener.SINGLE_DIRECTORY_DESCRIPTOR,
      TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT)
    {
      @Override
      protected void onFileChoosen(VirtualFile chosenFile) {
        String contentEntryPath = myModuleBuilder.getContentEntryPath();
        String path = chosenFile.getPath();
        if (contentEntryPath != null) {

          int i = StringUtil.commonPrefixLength(contentEntryPath, path);
          mySourcePath.setText(path.substring(i));
        }
        else {
          mySourcePath.setText(path);
        }
      }
    };
  mySourcePath.addBrowseFolderListener(project, listener);
  myCreateSourceRoot.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      mySourcePath.setEnabled(myCreateSourceRoot.isSelected());
    }
  });
  settingsStep.addExpertPanel(myPanel);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:31,代码来源:JavaSettingsStep.java


示例14: AlternativeJREPanel

import com.intellij.ide.util.BrowseFilesListener; //导入依赖的package包/类
public AlternativeJREPanel() {
  myCbEnabled = new JBCheckBox(ExecutionBundle.message("run.configuration.use.alternate.jre.checkbox"));

  myFieldWithHistory = new TextFieldWithHistory();
  final ArrayList<String> foundJDKs = new ArrayList<String>();
  final Sdk[] allJDKs = SdkTable.getInstance().getAllSdks();
  for (Sdk jdk : allJDKs) {
    foundJDKs.add(jdk.getHomePath());
  }
  myFieldWithHistory.setHistory(foundJDKs);
  myPathField = new ComponentWithBrowseButton<TextFieldWithHistory>(myFieldWithHistory, null);
  myPathField.addBrowseFolderListener(ExecutionBundle.message("run.configuration.select.alternate.jre.label"),
                                      ExecutionBundle.message("run.configuration.select.jre.dir.label"),
                                      null, BrowseFilesListener.SINGLE_DIRECTORY_DESCRIPTOR,
                                      TextComponentAccessor.TEXT_FIELD_WITH_HISTORY_WHOLE_TEXT);

  setLayout(new MigLayout("ins 0, gap 10, fill, flowx"));
  add(myCbEnabled, "shrinkx");
  add(myPathField, "growx, pushx");

  InsertPathAction.addTo(myFieldWithHistory.getTextEditor());

  myCbEnabled.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      enabledChanged();
    }
  });
  enabledChanged();

  setAnchor(myCbEnabled);

  updateUI();
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:34,代码来源:AlternativeJREPanel.java


示例15: createUIComponents

import com.intellij.ide.util.BrowseFilesListener; //导入依赖的package包/类
private void createUIComponents() {
    textField = new JTextField();
    browseFilesListener = new BrowseFilesListener(textField, "Select Directory for Default Grav Installation", "", FileChooserDescriptorFactory.createSingleFileDescriptor());
    fieldPanel = ModuleWizardStep.createFieldPanel(textField, "", browseFilesListener);
}
 
开发者ID:PioBeat,项目名称:GravSupport,代码行数:6,代码来源:ApplicationConfigForm.java


示例16: JrePathEditor

import com.intellij.ide.util.BrowseFilesListener; //导入依赖的package包/类
/**
 * This constructor can be used in UI forms. <strong>Don't forget to call {@link #setDefaultJreSelector(DefaultJreSelector)}!</strong>
 */
public JrePathEditor() {
  myLabel = new JBLabel(ExecutionBundle.message("run.configuration.jre.label"));

  myComboBoxModel = new SortedComboBoxModel<JreComboBoxItem>(new Comparator<JreComboBoxItem>() {
    @Override
    public int compare(JreComboBoxItem o1, JreComboBoxItem o2) {
      int result = Comparing.compare(o1.getOrder(), o2.getOrder());
      if (result != 0) {
        return result;
      }
      return o1.getPresentableText().compareToIgnoreCase(o2.getPresentableText());
    }
  });
  myDefaultJreItem = new DefaultJreItem();
  myComboBoxModel.add(myDefaultJreItem);
  final Sdk[] allJDKs = ProjectJdkTable.getInstance().getAllJdks();
  for (Sdk sdk : allJDKs) {
    myComboBoxModel.add(new SdkAsJreItem(sdk));
  }

  final Set<String> jrePaths = new HashSet<String>();
  for (JreProvider provider : JreProvider.EP_NAME.getExtensions()) {
    String path = provider.getJrePath();
    if (!StringUtil.isEmpty(path)) {
      jrePaths.add(path);
      myComboBoxModel.add(new CustomJreItem(path));
    }
  }

  for (Sdk jdk : allJDKs) {
    String homePath = jdk.getHomePath();

    if (!SystemInfo.isMac) {
      final File jre = new File(jdk.getHomePath(), "jre");
      if (jre.isDirectory()) {
        homePath = jre.getPath();
      }
    }
    if (jrePaths.add(homePath)) {
      myComboBoxModel.add(new CustomJreItem(homePath));
    }
  }
  ComboBox comboBox = new ComboBox(myComboBoxModel);
  comboBox.setEditable(true);
  comboBox.setRenderer(new ColoredListCellRendererWrapper<JreComboBoxItem>() {
    @Override
    protected void doCustomize(JList list, JreComboBoxItem value, int index, boolean selected, boolean hasFocus) {
      value.render(this, selected);
    }
  });
  myComboboxEditor = new JreComboboxEditor(myComboBoxModel);
  myComboboxEditor.getEditorComponent().setTextToTriggerEmptyTextStatus(DEFAULT_JRE_TEXT);
  comboBox.setEditor(myComboboxEditor);
  myPathField = new ComboboxWithBrowseButton(comboBox);
  myPathField.addBrowseFolderListener(ExecutionBundle.message("run.configuration.select.alternate.jre.label"),
                                      ExecutionBundle.message("run.configuration.select.jre.dir.label"),
                                      null, BrowseFilesListener.SINGLE_DIRECTORY_DESCRIPTOR,
                                      JreComboboxEditor.TEXT_COMPONENT_ACCESSOR);

  setLayout(new MigLayout("ins 0, gap 10, fill, flowx"));
  add(myLabel, "shrinkx");
  add(myPathField, "growx, pushx");

  InsertPathAction.addTo(myComboboxEditor.getEditorComponent());

  setAnchor(myLabel);

  updateUI();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:73,代码来源:JrePathEditor.java


示例17: AlternativeJREPanel

import com.intellij.ide.util.BrowseFilesListener; //导入依赖的package包/类
public AlternativeJREPanel() {
  myCbEnabled = new JBCheckBox(ExecutionBundle.message("run.configuration.use.alternate.jre.checkbox"));

  myFieldWithHistory = new TextFieldWithHistory();
  myFieldWithHistory.setHistorySize(-1);
  final ArrayList<String> foundJDKs = new ArrayList<String>();
  final Sdk[] allJDKs = ProjectJdkTable.getInstance().getAllJdks();

  for (Sdk sdk : allJDKs) {
    foundJDKs.add(sdk.getName());
  }

  for (JreProvider provider : JreProvider.EP_NAME.getExtensions()) {
    String path = provider.getJrePath();
    if (!StringUtil.isEmpty(path)) {
      foundJDKs.add(path);
    }
  }

  for (Sdk jdk : allJDKs) {
    String homePath = jdk.getHomePath();

    if (!SystemInfo.isMac) {
      final File jre = new File(jdk.getHomePath(), "jre");
      if (jre.isDirectory()) {
        homePath = jre.getPath();
      }
    }

    if (!foundJDKs.contains(homePath)) {
      foundJDKs.add(homePath);
    }
  }
  myFieldWithHistory.setHistory(foundJDKs);
  myPathField = new ComponentWithBrowseButton<TextFieldWithHistory>(myFieldWithHistory, null);
  myPathField.addBrowseFolderListener(ExecutionBundle.message("run.configuration.select.alternate.jre.label"),
                                      ExecutionBundle.message("run.configuration.select.jre.dir.label"),
                                      null, BrowseFilesListener.SINGLE_DIRECTORY_DESCRIPTOR,
                                      TextComponentAccessor.TEXT_FIELD_WITH_HISTORY_WHOLE_TEXT);

  setLayout(new MigLayout("ins 0, gap 10, fill, flowx"));
  add(myCbEnabled, "shrinkx");
  add(myPathField, "growx, pushx");

  InsertPathAction.addTo(myFieldWithHistory.getTextEditor());

  myCbEnabled.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      enabledChanged();
    }
  });
  enabledChanged();

  setAnchor(myCbEnabled);

  updateUI();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:58,代码来源:AlternativeJREPanel.java


示例18: NamePathComponent

import com.intellij.ide.util.BrowseFilesListener; //导入依赖的package包/类
public NamePathComponent(String nameLabelText,
                         String pathLabelText,
                         final String pathChooserTitle,
                         final String pathChooserDescription,
                         boolean hideIgnored,
                         boolean bold) {
  super(new GridBagLayout());

  myTfName = new JTextField();
  myTfName.setDocument(new NameFieldDocument());
  myTfName.setPreferredSize(new Dimension(200, myTfName.getPreferredSize().height));

  myTfPath = new JTextField();
  myTfPath.setDocument(new PathFieldDocument());
  myTfPath.setPreferredSize(new Dimension(200, myTfPath.getPreferredSize().height));

  myNameLabel = new JLabel(nameLabelText);
  if (bold) myNameLabel.setFont(UIUtil.getLabelFont().deriveFont(Font.BOLD));
  myNameLabel.setLabelFor(myTfName);
  Insets insets = new Insets(0, 0, 5, 4);
  this.add(myNameLabel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
                                               insets, 0, 0));

  insets = new Insets(0, 0, 5, 0);
  this.add(myTfName, new GridBagConstraints(1, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL,
                                            insets, 0, 0));
  // todo: review texts
  final FileChooserDescriptor chooserDescriptor = (FileChooserDescriptor)BrowseFilesListener.SINGLE_DIRECTORY_DESCRIPTOR.clone();
  chooserDescriptor.setHideIgnored(hideIgnored);
  final BrowseFilesListener browseButtonActionListener = new BrowseFilesListener(myTfPath, pathChooserTitle, pathChooserDescription, chooserDescriptor) {
    public void actionPerformed(ActionEvent e) {
      super.actionPerformed(e);
      myIsPathChangedByUser = true;
    }
  };
  myPathPanel = new FieldPanel(myTfPath, null, null, browseButtonActionListener, null);
  myPathLabel = new JLabel(pathLabelText);
  myPathLabel.setLabelFor(myTfPath);
  if (bold) myPathLabel.setFont(UIUtil.getLabelFont().deriveFont(Font.BOLD));
  insets = new Insets(0, 0, 5, 4);
  this.add(myPathLabel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE,
                                                 insets, 0, 0));
  insets = new Insets(0, 0, 5, 0);
  this.add(myPathPanel, new GridBagConstraints(1, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL,
                                               insets, 0, 0));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:47,代码来源:NamePathComponent.java


示例19: createFieldPanel

import com.intellij.ide.util.BrowseFilesListener; //导入依赖的package包/类
public static FieldPanel createFieldPanel(final JTextField field, final String labelText, final BrowseFilesListener browseButtonActionListener) {
  final FieldPanel fieldPanel = new FieldPanel(field, labelText, null, browseButtonActionListener, null);
  fieldPanel.getFieldLabel().setFont(UIUtil.getLabelFont().deriveFont(Font.BOLD));
  return fieldPanel;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:ModuleWizardStep.java


示例20: AlternativeJREPanel

import com.intellij.ide.util.BrowseFilesListener; //导入依赖的package包/类
public AlternativeJREPanel() {
    myCbEnabled = new JBCheckBox(ExecutionBundle.message("run.configuration.use.alternate.jre.checkbox"));

    myFieldWithHistory = new TextFieldWithHistory();
    myFieldWithHistory.setHistorySize(-1);
    final List<String> foundJDKs = new ArrayList<>();
    final Sdk[] allJDKs = ProjectJdkTable.getInstance().getAllJdks();

    String javaHomeOfCurrentProcess = System.getProperty("java.home");
    if (javaHomeOfCurrentProcess != null && !javaHomeOfCurrentProcess.isEmpty()) {
        foundJDKs.add(javaHomeOfCurrentProcess);
    }

    for (Sdk sdk : allJDKs) {
        String name = sdk.getName();
        if (!foundJDKs.contains(name)) {
            foundJDKs.add(name);
        }
    }

    for (Sdk jdk : allJDKs) {
        String homePath = jdk.getHomePath();

        if (!SystemInfo.isMac) {
            final File jre = new File(jdk.getHomePath(), "jre");
            if (jre.isDirectory()) {
                homePath = jre.getPath();
            }
        }

        if (!foundJDKs.contains(homePath)) {
            foundJDKs.add(homePath);
        }
    }

    myFieldWithHistory.setHistory(foundJDKs);
    myPathField = new ComponentWithBrowseButton<>(myFieldWithHistory, null);
    myPathField.addBrowseFolderListener(ExecutionBundle.message("run.configuration.select.alternate.jre.label"),
            ExecutionBundle.message("run.configuration.select.jre.dir.label"),
            null, BrowseFilesListener.SINGLE_DIRECTORY_DESCRIPTOR,
            TextComponentAccessor.TEXT_FIELD_WITH_HISTORY_WHOLE_TEXT);

    setLayout(new MigLayout("ins 0, gap 10, fill, flowx"));
    add(myCbEnabled, "shrinkx");
    add(myPathField, "growx, pushx");

    InsertPathAction.addTo(myFieldWithHistory.getTextEditor());

    myCbEnabled.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            enabledChanged();
        }
    });
    enabledChanged();

    setAnchor(myCbEnabled);

    updateUI();
}
 
开发者ID:ligasgr,项目名称:intellij-xquery,代码行数:60,代码来源:AlternativeJREPanel.java



注:本文中的com.intellij.ide.util.BrowseFilesListener类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PathException类代码示例发布时间:2022-05-21
下一篇:
Java ILaunchConfigurationDelegate类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap