Java 类com.intellij.ui.EditorTextFieldWithBrowseButton 实例源码

项目:livingdoc-intellij    文件:RunConfigurationEditor.java   
private void createUIComponents() {
    myMainClass = new LabeledComponent<>();
    myMainClass.setComponent(new EditorTextFieldWithBrowseButton(myProject, true, (declaration, place) -> {

        if (declaration instanceof PsiClass) {
            final PsiClass aClass = (PsiClass) declaration;
            if (ConfigurationUtil.MAIN_CLASS.value(aClass) && PsiMethodUtil.findMainMethod(aClass) != null) {
                return JavaCodeFragment.VisibilityChecker.Visibility.VISIBLE;
            }
        }
        return JavaCodeFragment.VisibilityChecker.Visibility.NOT_VISIBLE;
    }
    ));
}
项目:intellij-ce-playground    文件:ApplicationConfigurable.java   
private void createUIComponents() {
  myMainClass = new LabeledComponent<EditorTextFieldWithBrowseButton>();
  myMainClass.setComponent(new EditorTextFieldWithBrowseButton(myProject, true, new JavaCodeFragment.VisibilityChecker() {
    @Override
    public Visibility isDeclarationVisible(PsiElement declaration, PsiElement place) {
      if (declaration instanceof PsiClass) {
        final PsiClass aClass = (PsiClass)declaration;
        if (ConfigurationUtil.MAIN_CLASS.value(aClass) && PsiMethodUtil.findMainMethod(aClass) != null || place.getParent() != null && myModuleSelector.findClass(((PsiClass)declaration).getQualifiedName()) != null) {
          return Visibility.VISIBLE;
        }
      }
      return Visibility.NOT_VISIBLE;
    }
  }));
}
项目:intellij-ce-playground    文件:ConfigurationsTest.java   
public void testEditJUnitConfiguration() throws ConfigurationException {
  if (PlatformTestUtil.COVERAGE_ENABLED_BUILD) return;

  PsiClass testA = findTestA(getModule2());
  JUnitConfiguration configuration = createConfiguration(testA);
  JUnitConfigurable editor = new JUnitConfigurable(myProject);
  try {
    Configurable configurable = new RunConfigurationConfigurableAdapter(editor, configuration);
    configurable.reset();
    final EditorTextFieldWithBrowseButton component =
      ((LabeledComponent<EditorTextFieldWithBrowseButton>)editor.getTestLocation(JUnitConfigurationModel.CLASS)).getComponent();
    assertEquals(testA.getQualifiedName(), component.getText());
    PsiClass otherTest = findClass(getModule2(), "test2.Test2");
    component.setText(otherTest.getQualifiedName());
    configurable.apply();
    assertEquals(otherTest.getName(), configuration.getName());
    String specialName = "My name";
    configuration.setName(specialName);
    configuration.setNameChangedByUser(true);
    configurable.reset();
    component.setText(testA.getQualifiedName());
    configurable.apply();
    assertEquals(specialName, configuration.getName());
  }
  finally {
    Disposer.dispose(editor);
  }
}
项目:intellij-ce-playground    文件:TestRunParameters.java   
TestRunParameters(Project project, ConfigurationModuleSelector moduleSelector) {
  myProject = project;
  myModuleSelector = moduleSelector;

  myPackageComponent.setComponent(new EditorTextFieldWithBrowseButton(project, false));
  bind(myPackageComponent, new MyPackageBrowser());

  myClassComponent
    .setComponent(new EditorTextFieldWithBrowseButton(project, true, new AndroidTestClassVisibilityChecker(moduleSelector)));

  bind(myClassComponent,
       new AndroidTestClassBrowser(project, moduleSelector, AndroidBundle.message("android.browse.test.class.dialog.title"), false));

  myRunnerComponent.setComponent(new EditorTextFieldWithBrowseButton(project, true,
                                                                     new AndroidInheritingClassVisibilityChecker(myProject, moduleSelector,
                                                                                                       AndroidUtils.INSTRUMENTATION_RUNNER_BASE_CLASS)));
  bind(myRunnerComponent, new AndroidInheritingClassBrowser(project, moduleSelector, AndroidUtils.INSTRUMENTATION_RUNNER_BASE_CLASS,
                                                  AndroidBundle.message("android.browse.instrumentation.class.dialog.title"), true
  ));
  bind(myMethodComponent, new MyMethodBrowser());

  addTestingType(TEST_ALL_IN_MODULE, myAllInModuleButton);
  addTestingType(TEST_ALL_IN_PACKAGE, myAllInPackageButton);
  addTestingType(TEST_CLASS, myClassButton);
  addTestingType(TEST_METHOD, myTestMethodButton);

  setAnchor(myPackageComponent.getLabel());
}
项目:embeddedlinux-jvmdebugger-intellij    文件:RunConfigurationEditor.java   
/**
 * Creates UI Components
 */
private void createUIComponents() {
    myMainClass = new LabeledComponent<>();
    myMainClass.setComponent(new EditorTextFieldWithBrowseButton(myProject, true, (declaration, place) -> {
        if (declaration instanceof PsiClass) {
            final PsiClass aClass = (PsiClass)declaration;
            if (ConfigurationUtil.MAIN_CLASS.value(aClass) && PsiMethodUtil.findMainMethod(aClass) != null || place.getParent() != null && myModuleSelector.findClass(((PsiClass)declaration).getQualifiedName()) != null) {
                return JavaCodeFragment.VisibilityChecker.Visibility.VISIBLE;
            }
        }
        return JavaCodeFragment.VisibilityChecker.Visibility.NOT_VISIBLE;
    }));
}
项目:tools-idea    文件:ApplicationConfigurable.java   
private void createUIComponents() {
  myMainClass = new LabeledComponent<EditorTextFieldWithBrowseButton>();
  myMainClass.setComponent(new EditorTextFieldWithBrowseButton(myProject, true, new JavaCodeFragment.VisibilityChecker() {
    @Override
    public Visibility isDeclarationVisible(PsiElement declaration, PsiElement place) {
      if (declaration instanceof PsiClass) {
        final PsiClass aClass = (PsiClass)declaration;
        if (ConfigurationUtil.MAIN_CLASS.value(aClass) && PsiMethodUtil.findMainMethod(aClass) != null) {
          return Visibility.VISIBLE;
        }
      }
      return Visibility.NOT_VISIBLE;
    }
  }));
}
项目:tools-idea    文件:ConfigurationsTest.java   
public void testEditJUnitConfiguration() throws ConfigurationException {
  if (IdeaTestUtil.COVERAGE_ENABLED_BUILD) return;

  PsiClass testA = findTestA(getModule2());
  JUnitConfiguration configuration = createConfiguration(testA);
  JUnitConfigurable editor = new JUnitConfigurable(myProject);
  try {
    Configurable configurable = new RunConfigurationConfigurableAdapter(editor, configuration);
    configurable.reset();
    final EditorTextFieldWithBrowseButton component =
      ((LabeledComponent<EditorTextFieldWithBrowseButton>)editor.getTestLocation(JUnitConfigurationModel.CLASS)).getComponent();
    assertEquals(testA.getQualifiedName(), component.getText());
    PsiClass otherTest = findClass(getModule2(), "test2.Test2");
    component.setText(otherTest.getQualifiedName());
    configurable.apply();
    assertEquals(otherTest.getName(), configuration.getName());
    String specialName = "My name";
    configuration.setName(specialName);
    configuration.setNameChangedByUser(true);
    configurable.reset();
    component.setText(testA.getQualifiedName());
    configurable.apply();
    assertEquals(specialName, configuration.getName());
  }
  finally {
    Disposer.dispose(editor);
  }
}
项目:consulo-java    文件:DefaultJreSelector.java   
private static <T extends ComboBox<?>> boolean isClassInProductionSources(T moduleComboBox, Function<T, Module> getSelectedModule, EditorTextFieldWithBrowseButton classSelector)
{
    Module module = getSelectedModule.apply(moduleComboBox);
    if(module == null)
    {
        return false;
    }
    return ObjectUtil.notNull(JavaParametersUtil.isClassInProductionSources(classSelector.getText(), module), Boolean.FALSE);
}
项目:intellij-ce-playground    文件:ApplicationConfigurable.java   
public EditorTextFieldWithBrowseButton getMainClassField() {
  return myMainClass.getComponent();
}
项目:PageObjectEvaluator    文件:PageObjectConfigurable.java   
private void createClassTextField() {
    myClass = new LabeledComponent<EditorTextFieldWithBrowseButton>();
    EditorTextFieldWithBrowseButton myClassBrowseTextField = new EditorTextFieldWithBrowseButton(project, true, JavaCodeFragment.VisibilityChecker.PROJECT_SCOPE_VISIBLE);
    myClass.setComponent(myClassBrowseTextField);
}
项目:tools-idea    文件:ApplicationConfigurable.java   
public EditorTextFieldWithBrowseButton getMainClassField() {
  return myMainClass.getComponent();
}
项目:tools-idea    文件:JUnitConfigurable.java   
private void createUIComponents() {
  myPackage = new LabeledComponent<EditorTextFieldWithBrowseButton>();
  myPackage.setComponent(new EditorTextFieldWithBrowseButton(myProject, false));

  myClass = new LabeledComponent<EditorTextFieldWithBrowseButton>();
  final TestClassBrowser classBrowser = new TestClassBrowser(myProject);
  myClass.setComponent(new EditorTextFieldWithBrowseButton(myProject, true, new JavaCodeFragment.VisibilityChecker() {
    @Override
    public Visibility isDeclarationVisible(PsiElement declaration, PsiElement place) {
      try {
        if (declaration instanceof PsiClass && classBrowser.getFilter().isAccepted(((PsiClass)declaration))) {
          return Visibility.VISIBLE;
        }
      }
      catch (ClassBrowser.NoFilterException e) {
        return Visibility.NOT_VISIBLE;
      }
      return Visibility.NOT_VISIBLE;
    }
  }));

  myMethod = new LabeledComponent<EditorTextFieldWithBrowseButton>();
  final EditorTextFieldWithBrowseButton textFieldWithBrowseButton = new EditorTextFieldWithBrowseButton(myProject, true, 
                                                                                                        JavaCodeFragment.VisibilityChecker.EVERYTHING_VISIBLE, 
                                                                                                        PlainTextLanguage.INSTANCE.getAssociatedFileType());
  new TextFieldCompletionProvider() {
    @Override
    protected void addCompletionVariants(@NotNull String text, int offset, @NotNull String prefix, @NotNull CompletionResultSet result) {
      final String className = getClassName();
      if (className.trim().length() == 0) {
        return;
      }
      final PsiClass testClass = getModuleSelector().findClass(className);
      if (testClass == null) return;
      final JUnitUtil.TestMethodFilter filter = new JUnitUtil.TestMethodFilter(testClass);
      for (PsiMethod psiMethod : testClass.getAllMethods()) {
        if (filter.value(psiMethod)) {
          result.addElement(LookupElementBuilder.create(psiMethod.getName()));
        }
      }
    }
  }.apply(textFieldWithBrowseButton.getChildComponent());
  myMethod.setComponent(textFieldWithBrowseButton);
}
项目:tools-idea    文件:JUnitConfigurable.java   
private String getClassName() {
  return ((LabeledComponent<EditorTextFieldWithBrowseButton>)getTestLocation(JUnitConfigurationModel.CLASS)).getComponent().getText();
}
项目:tools-idea    文件:JUnitConfigurable.java   
private void setPackage(final PsiPackage aPackage) {
  if (aPackage == null) return;
  ((LabeledComponent<EditorTextFieldWithBrowseButton>)getTestLocation(JUnitConfigurationModel.ALL_IN_PACKAGE)).getComponent()
    .setText(aPackage.getQualifiedName());
}
项目:consulo-java    文件:ApplicationConfigurable.java   
public EditorTextFieldWithBrowseButton getMainClassField()
{
    return myMainClassField;
}
项目:consulo-java    文件:DefaultJreSelector.java   
public SdkFromSourceRootDependencies(T moduleComboBox, Function<T, Module> getSelectedModule, EditorTextFieldWithBrowseButton classSelector)
{
    super(moduleComboBox, getSelectedModule, () -> isClassInProductionSources(moduleComboBox, getSelectedModule, classSelector));
    myClassSelector = classSelector;
}
项目:consulo-java    文件:DefaultJreSelector.java   
@NotNull
public static DefaultJreSelector fromSourceRootsDependencies(ModulesComboBox modulesCombobox, EditorTextFieldWithBrowseButton classSelector)
{
    return new SdkFromSourceRootDependencies<>(modulesCombobox, ModulesComboBox::getSelectedModule, classSelector);
}
项目:consulo-java    文件:DefaultJreSelector.java   
@NotNull
public static DefaultJreSelector fromSourceRootsDependencies(ModuleDescriptionsComboBox modulesCombobox, EditorTextFieldWithBrowseButton classSelector)
{
    return new SdkFromSourceRootDependencies<>(modulesCombobox, ModuleDescriptionsComboBox::getSelectedModule, classSelector);
}
项目:consulo-java    文件:AppletConfigurable.java   
private EditorTextFieldWithBrowseButton getClassNameComponent()
{
    return myClassName;
}
项目:consulo-java    文件:AppletConfigurable.java   
private void createUIComponents()
{
    myClassName = new EditorTextFieldWithBrowseButton(myProject, true);
}
项目:embeddedlinux-jvmdebugger-intellij    文件:RunConfigurationEditor.java   
/**
 * Gets the main class to execute java app against
 * @return
 */
public EditorTextFieldWithBrowseButton getMainClassField() {
    return myMainClass.getComponent();
}