use of java.util.LinkedHashSet in project intellij-community by JetBrains.
the class TaskProjectConfiguration method getState.
public TaskProjectConfiguration getState() {
LinkedHashSet<SharedServer> set = new LinkedHashSet<>(this.servers);
for (TaskRepository repository : myManager.getAllRepositories()) {
if (repository.isShared()) {
SharedServer server = new SharedServer();
server.type = repository.getRepositoryType().getName();
server.url = repository.getUrl();
set.add(server);
}
}
servers.clear();
servers.addAll(set);
return this;
}
use of java.util.LinkedHashSet in project intellij-community by JetBrains.
the class GrFieldNameSuggester method suggestNames.
@NotNull
public LinkedHashSet<String> suggestNames() {
final GrExpression expression = myContext.getExpression();
final GrVariable var = myContext.getVar();
final StringPartInfo stringPart = myContext.getStringPart();
if (expression != null) {
return new LinkedHashSet<>(Arrays.asList(GroovyNameSuggestionUtil.suggestVariableNames(expression, myValidator, myForStatic)));
} else if (stringPart != null) {
return new LinkedHashSet<>(Arrays.asList(GroovyNameSuggestionUtil.suggestVariableNames(stringPart.getLiteral(), myValidator, myForStatic)));
} else {
assert var != null;
return new LinkedHashSet<>(Arrays.asList(GroovyNameSuggestionUtil.suggestVariableNameByType(var.getType(), myValidator)));
}
}
use of java.util.LinkedHashSet in project intellij-community by JetBrains.
the class AbstractTestNGPatternConfigurationProducer method setupConfigurationFromContext.
@Override
protected boolean setupConfigurationFromContext(TestNGConfiguration configuration, ConfigurationContext context, Ref<PsiElement> sourceElement) {
final LinkedHashSet<String> classes = new LinkedHashSet<>();
final PsiElement element = checkPatterns(context, classes);
if (element == null) {
return false;
}
sourceElement.set(element);
final TestData data = configuration.getPersistantData();
data.setPatterns(classes);
data.TEST_OBJECT = TestType.PATTERN.getType();
data.setScope(setupPackageConfiguration(context, configuration, data.getScope()));
configuration.setGeneratedName();
setupConfigurationParamName(configuration, context.getLocation());
return true;
}
use of java.util.LinkedHashSet in project intellij-community by JetBrains.
the class TestsPattern method createSearchingForTestsTask.
@Override
public SearchForTestsTask createSearchingForTestsTask() {
final JUnitConfiguration.Data data = getConfiguration().getPersistentData();
final Project project = getConfiguration().getProject();
final Set<String> classNames = new LinkedHashSet<>();
for (String className : data.getPatterns()) {
final PsiClass psiClass = getTestClass(project, className);
if (psiClass != null && JUnitUtil.isTestClass(psiClass)) {
classNames.add(className);
}
}
if (classNames.size() == data.getPatterns().size()) {
return new SearchForTestsTask(project, myServerSocket) {
@Override
protected void search() throws ExecutionException {
final Function<String, String> nameFunction = StringUtil.isEmpty(data.METHOD_NAME) ? FunctionUtil.<String>id() : (Function<String, String>) className -> className;
addClassesListToJavaParameters(classNames, nameFunction, "", false, getJavaParameters());
}
@Override
protected void onFound() {
}
};
}
return super.createSearchingForTestsTask();
}
use of java.util.LinkedHashSet in project intellij-community by JetBrains.
the class JUnitConfigurationModel method applyTo.
private void applyTo(final JUnitConfiguration.Data data, final Module module) {
final String testObject = getTestObject();
final String className = getJUnitTextValue(CLASS);
data.TEST_OBJECT = testObject;
if (testObject != JUnitConfiguration.TEST_PACKAGE && testObject != JUnitConfiguration.TEST_PATTERN && testObject != JUnitConfiguration.TEST_DIRECTORY && testObject != JUnitConfiguration.TEST_CATEGORY && testObject != JUnitConfiguration.BY_SOURCE_CHANGES) {
try {
data.METHOD_NAME = getJUnitTextValue(METHOD);
final PsiClass testClass = !myProject.isDefault() && !StringUtil.isEmptyOrSpaces(className) ? JUnitUtil.findPsiClass(className, module, myProject) : null;
if (testClass != null && testClass.isValid()) {
data.setMainClass(testClass);
} else {
data.MAIN_CLASS_NAME = className;
}
} catch (ProcessCanceledException | IndexNotReadyException e) {
data.MAIN_CLASS_NAME = className;
}
} else if (testObject != JUnitConfiguration.BY_SOURCE_CHANGES) {
if (testObject == JUnitConfiguration.TEST_PACKAGE) {
data.PACKAGE_NAME = getJUnitTextValue(ALL_IN_PACKAGE);
} else if (testObject == JUnitConfiguration.TEST_DIRECTORY) {
data.setDirName(getJUnitTextValue(DIR));
} else if (testObject == JUnitConfiguration.TEST_CATEGORY) {
data.setCategoryName(getJUnitTextValue(CATEGORY));
} else {
final LinkedHashSet<String> set = new LinkedHashSet<>();
final String[] patterns = getJUnitTextValue(PATTERN).split("\\|\\|");
for (String pattern : patterns) {
if (pattern.length() > 0) {
set.add(pattern);
}
}
data.setPatterns(set);
}
data.MAIN_CLASS_NAME = "";
data.METHOD_NAME = "";
}
}
Aggregations