use of com.intellij.openapi.application.WriteAction in project kotlin by JetBrains.
the class GradleImportingTestCase method configureWrapper.
private void configureWrapper() throws IOException, URISyntaxException {
URI distributionUri = new AbstractModelBuilderTest.DistributionLocator().getDistributionFor(GradleVersion.version(gradleVersion));
myProjectSettings.setDistributionType(DistributionType.DEFAULT_WRAPPED);
final VirtualFile wrapperJarFrom = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(wrapperJar());
assert wrapperJarFrom != null;
final VirtualFile wrapperJarFromTo = createProjectSubFile("gradle/wrapper/gradle-wrapper.jar");
new WriteAction() {
@Override
protected void run(@NotNull Result result) throws Throwable {
wrapperJarFromTo.setBinaryContent(wrapperJarFrom.contentsToByteArray());
}
}.execute().throwException();
Properties properties = new Properties();
properties.setProperty("distributionBase", "GRADLE_USER_HOME");
properties.setProperty("distributionPath", "wrapper/dists");
properties.setProperty("zipStoreBase", "GRADLE_USER_HOME");
properties.setProperty("zipStorePath", "wrapper/dists");
properties.setProperty("distributionUrl", distributionUri.toString());
StringWriter writer = new StringWriter();
properties.store(writer, null);
createProjectSubFile("gradle/wrapper/gradle-wrapper.properties", writer.toString());
}
use of com.intellij.openapi.application.WriteAction in project intellij-community by JetBrains.
the class LibraryOptionsPanel method doConfigure.
private void doConfigure() {
switch(myButtonEnumModel.getSelected()) {
case DOWNLOAD:
final LibraryDownloadSettings oldDownloadSettings = mySettings.getDownloadSettings();
LOG.assertTrue(oldDownloadSettings != null);
final LibraryDownloadSettings newDownloadSettings = DownloadingOptionsDialog.showDialog(myPanel, oldDownloadSettings, mySettings.getCompatibleVersions(), true);
if (newDownloadSettings != null) {
mySettings.setDownloadSettings(newDownloadSettings);
}
break;
case USE_LIBRARY:
final Object item = myExistingLibraryComboBox.getSelectedItem();
if (item instanceof LibraryEditor) {
EditLibraryDialog dialog = new EditLibraryDialog(myPanel, mySettings, (LibraryEditor) item);
dialog.show();
if (item instanceof ExistingLibraryEditor) {
new WriteAction() {
protected void run(@NotNull final Result result) {
((ExistingLibraryEditor) item).commit();
}
}.execute();
}
}
break;
case USE_FROM_PROVIDER:
case SETUP_LIBRARY_LATER:
break;
}
updateState();
}
use of com.intellij.openapi.application.WriteAction in project intellij-community by JetBrains.
the class AddCustomLibraryDialog method doOKAction.
@Override
protected void doOKAction() {
final LibraryCompositionSettings settings = myPanel.apply();
if (settings != null && settings.downloadFiles(myPanel.getMainPanel())) {
if (myModifiableRootModel == null) {
final ModifiableRootModel model = ModuleRootManager.getInstance(myModule).getModifiableModel();
new WriteAction() {
@Override
protected void run(@NotNull final Result result) {
addLibraries(model, settings);
model.commit();
}
}.execute();
} else {
addLibraries(myModifiableRootModel, settings);
}
}
super.doOKAction();
}
use of com.intellij.openapi.application.WriteAction in project intellij-community by JetBrains.
the class CreateNewLibraryDialog method createLibrary.
@NotNull
public Library createLibrary() {
final LibraryTable.ModifiableModel modifiableModel = getTableModifiableModel();
final LibraryType<?> type = myLibraryEditor.getType();
final Library library = modifiableModel.createLibrary(myLibraryEditor.getName(), type != null ? type.getKind() : null);
final LibraryEx.ModifiableModelEx model = (LibraryEx.ModifiableModelEx) library.getModifiableModel();
myLibraryEditor.applyTo(model);
new WriteAction() {
@Override
protected void run(@NotNull final Result result) {
model.commit();
}
}.execute();
return library;
}
use of com.intellij.openapi.application.WriteAction in project intellij-community by JetBrains.
the class CompilerTestUtil method enableExternalCompiler.
@TestOnly
public static void enableExternalCompiler() {
final JavaAwareProjectJdkTableImpl table = JavaAwareProjectJdkTableImpl.getInstanceEx();
new WriteAction() {
@Override
protected void run(@NotNull final Result result) {
table.addJdk(table.getInternalJdk());
}
}.execute();
}
Aggregations