use of com.intellij.openapi.project.Project in project intellij-community by JetBrains.
the class BaseSpellChecker method doLoadDictionaryAsync.
private void doLoadDictionaryAsync(Loader loader, Consumer<Dictionary> consumer) {
StartupManager.getInstance(myProject).runWhenProjectIsInitialized(() -> {
LOG.debug("Loading " + loader.getName());
Application app = ApplicationManager.getApplication();
app.executeOnPooledThread(() -> {
if (app.isDisposed())
return;
CompressedDictionary dictionary = CompressedDictionary.create(loader, transform);
LOG.debug(loader.getName() + " loaded!");
consumer.consume(dictionary);
while (!myDictionariesToLoad.isEmpty()) {
if (app.isDisposed())
return;
Pair<Loader, Consumer<Dictionary>> nextDictionary = myDictionariesToLoad.remove(0);
Loader nextDictionaryLoader = nextDictionary.getFirst();
dictionary = CompressedDictionary.create(nextDictionaryLoader, transform);
LOG.debug(nextDictionaryLoader.getName() + " loaded!");
nextDictionary.getSecond().consume(dictionary);
}
LOG.debug("Loading finished, restarting daemon...");
myLoadingDictionaries.set(false);
UIUtil.invokeLaterIfNeeded(() -> {
if (app.isDisposed())
return;
for (final Project project : ProjectManager.getInstance().getOpenProjects()) {
if (project.isInitialized() && project.isOpen() && !project.isDefault()) {
DaemonCodeAnalyzer instance = DaemonCodeAnalyzer.getInstance(project);
if (instance != null)
instance.restart();
}
}
});
});
});
}
use of com.intellij.openapi.project.Project in project intellij-community by JetBrains.
the class PyCommandLineTestCase method createConfiguration.
protected <T extends AbstractPythonRunConfiguration> T createConfiguration(final ConfigurationType configurationType, Class<T> cls) {
final ConfigurationFactory factory = configurationType.getConfigurationFactories()[0];
final Project project = myFixture.getProject();
return cls.cast(factory.createTemplateConfiguration(project));
}
use of com.intellij.openapi.project.Project in project intellij-community by JetBrains.
the class PyMoveTest method doMoveFileTest.
private void doMoveFileTest(String fileName, String toDirName) {
Project project = myFixture.getProject();
PsiManager manager = PsiManager.getInstance(project);
String root = "/refactoring/move/" + getTestName(true);
String rootBefore = root + "/before/src";
String rootAfter = root + "/after/src";
VirtualFile dir1 = myFixture.copyDirectoryToProject(rootBefore, "");
PsiDocumentManager.getInstance(project).commitAllDocuments();
VirtualFile virtualFile = dir1.findFileByRelativePath(fileName);
assertNotNull(virtualFile);
PsiElement file = manager.findFile(virtualFile);
if (file == null) {
file = manager.findDirectory(virtualFile);
}
assertNotNull(file);
VirtualFile toVirtualDir = dir1.findFileByRelativePath(toDirName);
assertNotNull(toVirtualDir);
PsiDirectory toDir = manager.findDirectory(toVirtualDir);
new MoveFilesOrDirectoriesProcessor(project, new PsiElement[] { file }, toDir, false, false, null, null).run();
VirtualFile dir2 = getVirtualFileByName(PythonTestUtil.getTestDataPath() + rootAfter);
try {
PlatformTestUtil.assertDirectoriesEqual(dir2, dir1);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
use of com.intellij.openapi.project.Project in project intellij-community by JetBrains.
the class XmlSchemaTypeInheritanceTest method testIndex.
public void testIndex() throws Exception {
myFixture.copyDirectoryToProject("", "");
final Project project = getProject();
final List<Set<SchemaTypeInfo>> childrenOfType = SchemaTypeInheritanceIndex.getWorker(project, null).apply("http://a.b.c", "baseSimpleType");
Assert.assertNotNull(childrenOfType);
final Set<SchemaTypeInfo> expected = new HashSet<>();
expected.add(new SchemaTypeInfo("extSimple4", true, "http://a.b.c"));
expected.add(new SchemaTypeInfo("extSimple1", true, "http://a.b.c"));
expected.add(new SchemaTypeInfo("extComplex2", true, "http://a.b.c"));
expected.add(new SchemaTypeInfo("extComplex2", true, "http://a.b.c.d"));
for (Set<SchemaTypeInfo> infos : childrenOfType) {
for (SchemaTypeInfo info : infos) {
expected.remove(info);
}
}
Assert.assertTrue(expected.isEmpty());
//
final List<Set<SchemaTypeInfo>> childrenOfSimple4Type = SchemaTypeInheritanceIndex.getWorker(project, null).apply("http://a.b.c", "extSimple4");
Assert.assertNotNull(childrenOfSimple4Type);
final Set<SchemaTypeInfo> expectedSimple4 = new HashSet<>();
expectedSimple4.add(new SchemaTypeInfo("extSimple5", true, "http://a.b.c"));
expectedSimple4.add(new SchemaTypeInfo("wiseElement", false, "http://a.b.c"));
for (Set<SchemaTypeInfo> infos : childrenOfSimple4Type) {
for (SchemaTypeInfo info : infos) {
expectedSimple4.remove(info);
}
}
Assert.assertTrue(expectedSimple4.isEmpty());
}
use of com.intellij.openapi.project.Project in project Main by SpartanRefactoring.
the class ToolBoxController method applyListener.
private void applyListener() {
List<String> updateList = new ArrayList<>();
for (int i = 0; i < list.getNumOfElements(); i++) {
JCheckBox checkbox = (JCheckBox) list.getModel().getElementAt(i);
if (checkbox.isSelected()) {
updateList.add(checkbox.getText());
}
}
Toolbox.getInstance().updateTipperList(updateList);
Project p = Utils.getProject();
DaemonCodeAnalyzer.getInstance(p).restart();
}
Aggregations