From 2d899e3ab05a2a6c4f9947a832fad91512d50e0d Mon Sep 17 00:00:00 2001 From: Alexandr Evstigneev Date: Fri, 10 Feb 2017 15:24:50 +0300 Subject: [PATCH 01/81] implemented VcsFileUtil.addFilesToVcsWithConfirmation method IDEA-CR-18124 --- .../src/messages/VcsBundle.properties | 2 + .../src/com/intellij/vcsUtil/VcsFileUtil.java | 92 ++++++++++++++++++- 2 files changed, 92 insertions(+), 2 deletions(-) diff --git a/platform/platform-resources-en/src/messages/VcsBundle.properties b/platform/platform-resources-en/src/messages/VcsBundle.properties index eeef9e62167d..24f92ac5d9fa 100644 --- a/platform/platform-resources-en/src/messages/VcsBundle.properties +++ b/platform/platform-resources-en/src/messages/VcsBundle.properties @@ -543,6 +543,8 @@ dialog.enable.version.control.integration.select.vcs.label.text=Select a version dialog.enable.version.control.integration.hint.text=Version control settings can be configured in 'Settings | Version Control' confirmation.text.add.file=Do you want to schedule the following file for addition to VCS?\n{0} confirmation.title.add.file=Schedule for Addition +confirmation.title.add.file.to=Add file to {0}? +confirmation.title.add.files.to=Add files to {0}? confirmation.title.add.multiple.files=Select Files to Add to VCS waiting.changelists.update.for.show.commit.dialog.message=Commit dialog add.confirmation.label.text=When files are created with {0}: diff --git a/platform/vcs-impl/src/com/intellij/vcsUtil/VcsFileUtil.java b/platform/vcs-impl/src/com/intellij/vcsUtil/VcsFileUtil.java index 98a3d84eb6c2..d8848fbb51a8 100644 --- a/platform/vcs-impl/src/com/intellij/vcsUtil/VcsFileUtil.java +++ b/platform/vcs-impl/src/com/intellij/vcsUtil/VcsFileUtil.java @@ -15,15 +15,18 @@ */ package com.intellij.vcsUtil; +import com.google.common.collect.ArrayListMultimap; +import com.google.common.collect.Multimap; +import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.util.ThrowableNotNullFunction; import com.intellij.openapi.util.io.FileUtil; -import com.intellij.openapi.vcs.FilePath; -import com.intellij.openapi.vcs.VcsException; +import com.intellij.openapi.vcs.*; import com.intellij.openapi.vcs.changes.VcsDirtyScopeManager; +import com.intellij.openapi.vcs.checkin.CheckinEnvironment; import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.ThrowableConsumer; @@ -33,6 +36,7 @@ import org.jetbrains.annotations.Nullable; import java.io.File; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.List; @@ -379,4 +383,88 @@ public class VcsFileUtil { return null; } + + public static void addFilesToVcsWithConfirmation(@NotNull Project project, VirtualFile... virtualFiles) { + addFilesToVcsWithConfirmation(project, Arrays.asList(virtualFiles)); + } + + public static void addFilesToVcsWithConfirmation(@NotNull Project project, @NotNull Collection virtualFiles) { + addFilesToVcsWithConfirmation(project, virtualFiles, null); + } + + /** + * Finds all VCSs related to the passed files, suggests user to add files to the respected VCSs honoring addition and silence settings + * and adds them if user or settings confirmed addition + * + * @param project project we work in + * @param virtualFiles collection of virtual files to add; directories being added recursively + * @param exceptionsProcessor optional exceptions processor + */ + public static void addFilesToVcsWithConfirmation(@NotNull Project project, + @NotNull Collection virtualFiles, + @Nullable VcsExceptionsProcessor exceptionsProcessor) { + if (virtualFiles.isEmpty()) { + return; + } + ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(project); + Multimap vcsMap = ArrayListMultimap.create(); + for (VirtualFile createdFile : virtualFiles) { + AbstractVcs vcs = vcsManager.getVcsFor(createdFile); + if (vcs == null) { + continue; + } + VfsUtil.processFileRecursivelyWithoutIgnored(createdFile, (virtualFile) -> vcsMap.put(vcs, virtualFile)); + } + + for (AbstractVcs vcs : vcsMap.keySet()) { + VcsShowConfirmationOption addOption = + vcsManager.getStandardConfirmation(VcsConfiguration.StandardConfirmation.ADD, vcs); + if (addOption.getValue() == VcsShowConfirmationOption.Value.DO_NOTHING_SILENTLY) return; + List filesList = new ArrayList<>(vcsMap.get(vcs)); + if (addOption.getValue() == VcsShowConfirmationOption.Value.DO_ACTION_SILENTLY) { + performAdding(vcs, filesList, exceptionsProcessor); + } + else { + AbstractVcsHelper helper = AbstractVcsHelper.getInstance(project); + + ApplicationManager.getApplication().invokeLater(() -> { + Collection filesToAdd = + helper + .selectFilesToProcess( + new ArrayList<>(filesList), + VcsBundle.message("confirmation.title.add.files.to", vcs.getDisplayName()), + null, + VcsBundle.message("confirmation.title.add.file.to", vcs.getDisplayName()), + null, + addOption); + + if (filesToAdd != null) { + ApplicationManager.getApplication().executeOnPooledThread(() -> { + performAdding(vcs, new ArrayList<>(filesToAdd), exceptionsProcessor); + }); + } + }); + } + } + } + + private static void performAdding(@NotNull AbstractVcs vcs, + @NotNull List value, + @Nullable VcsExceptionsProcessor exceptionsProcessor) { + CheckinEnvironment checkinEnvironment = vcs.getCheckinEnvironment(); + if (checkinEnvironment == null) { + return; + } + List exceptions = checkinEnvironment.scheduleUnversionedFilesForAddition(value); + if (exceptions == null || exceptionsProcessor == null) { + return; + } + for (VcsException exception : exceptions) { + exceptionsProcessor.process(vcs, exception); + } + } + + public interface VcsExceptionsProcessor { + void process(@NotNull AbstractVcs vcs, @NotNull VcsException exception); + } } From a04928a02e2b52d7ada07111495963865501a64e Mon Sep 17 00:00:00 2001 From: DMP9 Date: Sat, 11 Feb 2017 19:32:41 +0000 Subject: [PATCH 02/81] Fernflower readme markdown --- .../engine/{readme.txt => README.md} | 67 +++++++++---------- 1 file changed, 33 insertions(+), 34 deletions(-) rename plugins/java-decompiler/engine/{readme.txt => README.md} (60%) diff --git a/plugins/java-decompiler/engine/readme.txt b/plugins/java-decompiler/engine/README.md similarity index 60% rename from plugins/java-decompiler/engine/readme.txt rename to plugins/java-decompiler/engine/README.md index cd4765664b06..28b82dcb9a55 100644 --- a/plugins/java-decompiler/engine/readme.txt +++ b/plugins/java-decompiler/engine/README.md @@ -1,4 +1,4 @@ -1. About the decompiler +## About fernflower Fernflower is the first actually working analytical decompiler for Java and probably for a high-level programming language in general. Naturally it is still @@ -6,12 +6,11 @@ under development, please send your bug reports and improvement suggestions at fernflower.decompiler@gmail.com -2. License +## Licence -http://www.apache.org/licenses/LICENSE-2.0 +Fernflower is licenced under the Apache Licence Version 2.0. It can be found here: http://www.apache.org/licenses/LICENSE-2.0 - -3. Running from the command line +## Running from command line java -jar fernflower.jar [-