use of com.intellij.ui.EditorTextFieldWithBrowseButton in project intellij-community by JetBrains.
the class ApplicationConfigurable method createUIComponents.
private void createUIComponents() {
myMainClass = new LabeledComponent<>();
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;
}
}));
}
use of com.intellij.ui.EditorTextFieldWithBrowseButton in project intellij-community by JetBrains.
the class ConfigurationsTest method testEditJUnitConfiguration.
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);
}
}
use of com.intellij.ui.EditorTextFieldWithBrowseButton in project intellij-plugins by JetBrains.
the class CucumberJavaApplicationConfigurable method createUIComponents.
private void createUIComponents() {
myMainClass = new LabeledComponent<>();
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;
}
}));
}
Aggregations