use of com.intellij.openapi.application.WriteAction in project intellij-community by JetBrains.
the class AppEngineCodeInsightTestCase method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
final TestFixtureBuilder<IdeaProjectTestFixture> fixtureBuilder = JavaTestFixtureFactory.createFixtureBuilder(getName());
myModuleBuilder = fixtureBuilder.addModule(JavaModuleFixtureBuilder.class);
myProjectFixture = fixtureBuilder.getFixture();
myCodeInsightFixture = createCodeInsightFixture(getBaseDirectoryPath());
new WriteAction() {
@Override
protected void run(@NotNull final Result result) {
addAppEngineSupport(myProjectFixture.getModule());
}
}.execute();
}
use of com.intellij.openapi.application.WriteAction in project intellij-community by JetBrains.
the class DependenciesImportingTest method testSaveJdkPosition.
public void testSaveJdkPosition() throws Exception {
createProjectPom("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<packaging>pom</packaging>" + "<version>1</version>" + "<modules>" + " <module>m1</module>" + " <module>m2</module>" + "</modules>");
createModulePom("m1", "<groupId>test</groupId>" + "<artifactId>m1</artifactId>" + "<version>1</version>" + "<dependencies>" + " <dependency>" + " <groupId>test</groupId>" + " <artifactId>m2</artifactId>" + " <version>1</version>" + " </dependency>" + " <dependency>" + " <groupId>junit</groupId>" + " <artifactId>junit</artifactId>" + " <version>4.0</version>" + " </dependency>" + "</dependencies>");
createModulePom("m2", "<groupId>test</groupId>" + "<artifactId>m2</artifactId>" + "<version>1</version>");
importProject();
new WriteAction() {
@Override
protected void run(@NotNull Result result) throws Throwable {
ModifiableRootModel rootModel = ModuleRootManager.getInstance(getModule("m1")).getModifiableModel();
OrderEntry[] orderEntries = rootModel.getOrderEntries().clone();
assert orderEntries.length == 4;
assert orderEntries[0] instanceof JdkOrderEntry;
assert orderEntries[1] instanceof ModuleSourceOrderEntry;
assert ((ModuleOrderEntry) orderEntries[2]).getModuleName().equals("m2");
assert "Maven: junit:junit:4.0".equals(((LibraryOrderEntry) orderEntries[3]).getLibraryName());
rootModel.rearrangeOrderEntries(new OrderEntry[] { orderEntries[2], orderEntries[3], orderEntries[0], orderEntries[1] });
rootModel.commit();
}
}.execute();
resolveDependenciesAndImport();
// JDK position was saved
OrderEntry[] orderEntries = ModuleRootManager.getInstance(getModule("m1")).getOrderEntries();
assert orderEntries.length == 4;
assert ((ModuleOrderEntry) orderEntries[0]).getModuleName().equals("m2");
assert "Maven: junit:junit:4.0".equals(((LibraryOrderEntry) orderEntries[1]).getLibraryName());
assert orderEntries[2] instanceof JdkOrderEntry;
assert orderEntries[3] instanceof ModuleSourceOrderEntry;
}
use of com.intellij.openapi.application.WriteAction in project intellij-community by JetBrains.
the class MavenModuleBuilderTest method createNewModule.
private void createNewModule(MavenId id) throws Exception {
myBuilder.setProjectId(id);
new WriteAction() {
protected void run(@NotNull Result result) throws Throwable {
ModifiableModuleModel model = ModuleManager.getInstance(myProject).getModifiableModel();
myBuilder.createModule(model);
model.commit();
}
}.execute();
resolveDependenciesAndImport();
}
use of com.intellij.openapi.application.WriteAction in project intellij-community by JetBrains.
the class MergeFromTheirsResolver method applyBinaryChanges.
private void applyBinaryChanges() throws VcsException {
List<FilePath> dirtyPaths = newArrayList();
for (Change change : myTheirsBinaryChanges) {
RunResult result = new WriteAction() {
@Override
protected void run(@NotNull Result result) throws Throwable {
dirtyPaths.add(getFilePath(change));
try {
applyBinaryChange(change);
} catch (IOException e) {
throw new VcsException(e);
}
}
}.execute();
if (result.hasException()) {
processBinaryChangeError(result.getThrowable());
}
}
VcsDirtyScopeManager.getInstance(myVcs.getProject()).filePathsDirty(dirtyPaths, null);
}
use of com.intellij.openapi.application.WriteAction in project intellij-community by JetBrains.
the class AddExternalLibraryToDependenciesQuickFix method invoke.
@Override
public void invoke(@NotNull Project project, final Editor editor, PsiFile file) throws IncorrectOperationException {
DependencyScope scope = suggestScopeByLocation(myCurrentModule, myReference.getElement());
JavaProjectModelModificationService.getInstance(project).addDependency(myCurrentModule, myLibraryDescriptor, scope).done(aVoid -> new WriteAction() {
protected void run(@NotNull final Result result) {
try {
importClass(myCurrentModule, editor, myReference, myQualifiedClassName);
} catch (IndexNotReadyException e) {
LOG.info(e);
}
}
}.execute());
}
Aggregations