From 01c044ffa9b4985697c6a4dc6fa678cbdb2dbb8f Mon Sep 17 00:00:00 2001 From: Mikhail Mazurkevich Date: Thu, 25 Nov 2021 18:51:50 +0300 Subject: [PATCH] [jps caches] Cleanup commented code and add CRLF check for Windows GitOrigin-RevId: f09d51b424563420f198fd33e0c4fedee919afb4 --- .../cache/JpsCacheStartupActivity.java | 58 ++++++++------ .../compiler/cache/git/GitRepositoryUtil.java | 42 ++++++++-- .../compiler/server/BuildManager.java | 5 +- .../messages/JavaCompilerBundle.properties | 5 +- .../action/JpsForceUpdateCachesAction.java | 18 ----- .../cache/action/JpsUpdateCachesAction.java | 18 ----- .../jps/cache/client/JpsCachesDownloader.java | 45 +---------- .../jps/cache/client/JpsServerClient.java | 1 - .../jps/cache/client/JpsServerClientImpl.java | 1 - .../jps/cache/loader/JpsCacheLoader.java | 1 - .../cache/loader/JpsOutputLoaderManager.java | 70 +---------------- .../jps/cache/ui/JpsLoaderNotifications.java | 13 ---- .../ui/SegmentedProgressIndicatorManager.java | 78 ------------------- 13 files changed, 81 insertions(+), 274 deletions(-) delete mode 100644 jps/jps-builders/src/org/jetbrains/jps/cache/action/JpsForceUpdateCachesAction.java delete mode 100644 jps/jps-builders/src/org/jetbrains/jps/cache/action/JpsUpdateCachesAction.java delete mode 100644 jps/jps-builders/src/org/jetbrains/jps/cache/ui/JpsLoaderNotifications.java delete mode 100644 jps/jps-builders/src/org/jetbrains/jps/cache/ui/SegmentedProgressIndicatorManager.java diff --git a/java/compiler/impl/src/com/intellij/compiler/cache/JpsCacheStartupActivity.java b/java/compiler/impl/src/com/intellij/compiler/cache/JpsCacheStartupActivity.java index 107c0faa5e72..4c04c9ad4bda 100644 --- a/java/compiler/impl/src/com/intellij/compiler/cache/JpsCacheStartupActivity.java +++ b/java/compiler/impl/src/com/intellij/compiler/cache/JpsCacheStartupActivity.java @@ -2,45 +2,59 @@ package com.intellij.compiler.cache; import com.intellij.compiler.cache.client.JpsServerAuthExtension; import com.intellij.compiler.cache.git.GitRepositoryUtil; +import com.intellij.ide.browsers.BrowserLauncher; +import com.intellij.notification.NotificationAction; +import com.intellij.notification.NotificationType; +import com.intellij.openapi.Disposable; +import com.intellij.openapi.compiler.JavaCompilerBundle; +import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; import com.intellij.openapi.startup.StartupActivity; +import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.util.registry.Registry; import org.jetbrains.annotations.NotNull; -//import static com.intellij.jps.cache.JpsCachesPluginUtil.INTELLIJ_REPO_NAME; -//import static com.intellij.jps.cache.ui.JpsLoaderNotifications.ATTENTION; +import static com.intellij.compiler.cache.ui.JpsLoaderNotifications.ATTENTION; -public final class JpsCacheStartupActivity implements StartupActivity.Background { +public final class JpsCacheStartupActivity implements StartupActivity.Background, Disposable { + private static final Logger LOG = Logger.getInstance(JpsCacheStartupActivity.class); private static final String NOT_ASK_AGAIN = "JpsCaches.NOT_ASK_AGAIN"; private static boolean lineEndingsConfiguredCorrectly = true; @Override public void runActivity(@NotNull Project project) { - if (Registry.is("compiler.process.use.portable.caches") && GitRepositoryUtil.isIntelliJRepository(project)) { - JpsServerAuthExtension.checkAuthenticatedInBackgroundThread(project, project, () -> { - System.out.println("All Ok"); - }); - checkWindowsCRLF(project); - checkAutoBuildEnabled(project); + if (!Registry.is("compiler.process.use.portable.caches")) { + LOG.debug("JPS Caches registry key is not enabled"); + return; } + if (!GitRepositoryUtil.isIntelliJRepository(project)) { + LOG.debug("Not an Intellij project, JPS Caches will not be available"); + return; + } + JpsServerAuthExtension.checkAuthenticatedInBackgroundThread(this, project, () -> { + LOG.info("User authentication for JPS Cache download complete successfully"); + }); + checkWindowsCRLF(project); + checkAutoBuildEnabled(project); } private static void checkWindowsCRLF(@NotNull Project project) { - //if (!SystemInfo.isWindows) return; - //GitRepository intellijRepository = GitRepositoryUtil.getRepositoryByName(project, INTELLIJ_REPO_NAME); - //if (intellijRepository == null) return; - //if (!GitRepositoryUtil.isAutoCrlfSetRight(intellijRepository)) { - // lineEndingsConfiguredCorrectly = false; - // ATTENTION - // .createNotification(JpsCacheBundle.message("notification.title.git.crlf.config"), - // JpsCacheBundle.message("notification.content.git.crlf.config"), - // NotificationType.WARNING) - // .addAction(NotificationAction.createSimple(JpsCacheBundle.message("notification.action.git.crlf.config"), - // () -> BrowserLauncher.getInstance().open("https://confluence.jetbrains.com/pages/viewpage.action?title=Git+Repository&spaceKey=IDEA"))) - // .notify(project); - //} + if (!SystemInfo.isWindows) return; + if (!GitRepositoryUtil.isAutoCrlfSetRight(project)) { + lineEndingsConfiguredCorrectly = false; + ATTENTION + .createNotification(JavaCompilerBundle.message("notification.title.git.crlf.config"), + JavaCompilerBundle.message("notification.content.git.crlf.config"), + NotificationType.WARNING) + .addAction(NotificationAction.createSimple(JavaCompilerBundle.message("notification.action.git.crlf.config"), + () -> BrowserLauncher.getInstance().open("https://confluence.jetbrains.com/pages/viewpage.action?title=Git+Repository&spaceKey=IDEA"))) + .notify(project); + } } + @Override + public void dispose() { } + private static void checkAutoBuildEnabled(@NotNull Project project) { //PropertiesComponent propertiesComponent = PropertiesComponent.getInstance(project); //if (propertiesComponent.getBoolean(NOT_ASK_AGAIN)) { diff --git a/java/compiler/impl/src/com/intellij/compiler/cache/git/GitRepositoryUtil.java b/java/compiler/impl/src/com/intellij/compiler/cache/git/GitRepositoryUtil.java index 9713837a4e86..cd72bcc1db67 100644 --- a/java/compiler/impl/src/com/intellij/compiler/cache/git/GitRepositoryUtil.java +++ b/java/compiler/impl/src/com/intellij/compiler/cache/git/GitRepositoryUtil.java @@ -169,6 +169,41 @@ public final class GitRepositoryUtil { return processOutput.toString(); } + public static boolean isAutoCrlfSetRight(@NotNull Project project) { + String projectBasePath = project.getBasePath(); + if (projectBasePath == null) return true; + GeneralCommandLine commandLine = new GeneralCommandLine() + .withParentEnvironmentType(GeneralCommandLine.ParentEnvironmentType.CONSOLE) + .withWorkDirectory(projectBasePath) + .withExePath("git") + .withParameters("config") + .withParameters("--get") + .withParameters("core.autocrlf"); + + StringBuilder processOutput = new StringBuilder(); + try { + OSProcessHandler handler = new OSProcessHandler(commandLine.withCharset(StandardCharsets.UTF_8)); + handler.addProcessListener(new CapturingProcessAdapter() { + @Override + public void processTerminated(@NotNull ProcessEvent event) { + if (event.getExitCode() != 0) { + LOG.warn("Couldn't fetch repository remote name: " + getOutput().getStderr()); + } else { + processOutput.append(getOutput().getStdout()); + } + } + }); + handler.startNotify(); + handler.waitFor(); + } + catch (ExecutionException e) { + LOG.warn("Couldn't execute command for getting remote name", e); + } + String value = processOutput.toString().lines().findFirst().orElse(""); + LOG.info("CRLF configuration for " + project.getName() + " project: " + value); + return value.equalsIgnoreCase("input"); + } + public static void saveLatestDownloadedCommit(@NotNull String latestDownloadedCommit) { PropertiesComponent.getInstance().setValue(LATEST_COMMIT_ID, latestDownloadedCommit); LOG.info("Saving latest downloaded commit: " + latestDownloadedCommit); @@ -210,11 +245,4 @@ public final class GitRepositoryUtil { // LOG.info("Project doesn't contain Git repository"); // return null; //} - - //public static boolean isAutoCrlfSetRight(@NotNull GitRepository gitRepository) { - // GitCommandResult result = Git.getInstance().config(gitRepository, GitConfigUtil.CORE_AUTOCRLF); - // String value = result.getOutputAsJoinedString(); - // LOG.info("CRLF configuration for " + gitRepository + " project: " + value); - // return value.equalsIgnoreCase("input"); - //} } \ No newline at end of file diff --git a/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java b/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java index 3a8a69742316..fc74b3aa61cc 100644 --- a/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java +++ b/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java @@ -8,6 +8,7 @@ import com.intellij.compiler.CompilerConfiguration; import com.intellij.compiler.CompilerConfigurationImpl; import com.intellij.compiler.CompilerWorkspaceConfiguration; import com.intellij.compiler.YourKitProfilerService; +import com.intellij.compiler.cache.JpsCacheStartupActivity; import com.intellij.compiler.cache.git.GitRepositoryUtil; import com.intellij.compiler.impl.CompilerUtil; import com.intellij.compiler.impl.javaCompiler.BackendCompiler; @@ -1406,7 +1407,9 @@ public final class BuildManager implements Disposable { } // portable caches - if (Registry.is("compiler.process.use.portable.caches") && GitRepositoryUtil.isIntelliJRepository(project)) { + if ( Registry.is("compiler.process.use.portable.caches") + && GitRepositoryUtil.isIntelliJRepository(project) + && JpsCacheStartupActivity.isLineEndingsConfiguredCorrectly()) { //cmdLine.addParameter("-Didea.resizeable.file.truncate.on.close=true"); //cmdLine.addParameter("-Dkotlin.jps.non.caching.storage=true"); cmdLine.addParameter("-D" + ProjectStamps.PORTABLE_CACHES_PROPERTY + "=true"); diff --git a/java/compiler/openapi/resources/messages/JavaCompilerBundle.properties b/java/compiler/openapi/resources/messages/JavaCompilerBundle.properties index 21f0da10190c..4905b65719f6 100644 --- a/java/compiler/openapi/resources/messages/JavaCompilerBundle.properties +++ b/java/compiler/openapi/resources/messages/JavaCompilerBundle.properties @@ -332,4 +332,7 @@ notification.group.compiler=Build finished notification.title.jps.caches.downloader=Jps caches downloader notification.content.internal.authentication.plugin.required.for.correct.work=JetBrains Internal Authentication is required for the correct work of JPS Caches -internal.authentication.plugin.missing.token=Unexpected state: jetbrains.team token is missing. Please report this exception and perform actions 'Logout from JetBrains.team' and 'Login to JetBrains.team' as a workaround \ No newline at end of file +internal.authentication.plugin.missing.token=Unexpected state: jetbrains.team token is missing. Please report this exception and perform actions 'Logout from JetBrains.team' and 'Login to JetBrains.team' as a workaround +notification.title.git.crlf.config=Wrong Git line-endings configuration +notification.content.git.crlf.config=Git line-endings not properly configured for the project. Portable JPS caches can't work correctly with such config. +notification.action.git.crlf.config=Open config description \ No newline at end of file diff --git a/jps/jps-builders/src/org/jetbrains/jps/cache/action/JpsForceUpdateCachesAction.java b/jps/jps-builders/src/org/jetbrains/jps/cache/action/JpsForceUpdateCachesAction.java deleted file mode 100644 index a45410748ab1..000000000000 --- a/jps/jps-builders/src/org/jetbrains/jps/cache/action/JpsForceUpdateCachesAction.java +++ /dev/null @@ -1,18 +0,0 @@ -//package org.jetbrains.jps.cache.action; -// -//import com.intellij.jps.cache.client.JpsServerAuthExtension; -//import com.intellij.jps.cache.loader.JpsOutputLoaderManager; -//import com.intellij.openapi.actionSystem.AnActionEvent; -//import com.intellij.openapi.project.DumbAwareAction; -//import com.intellij.openapi.project.Project; -//import org.jetbrains.annotations.NotNull; -// -//public class JpsForceUpdateCachesAction extends DumbAwareAction { -// @Override -// public void actionPerformed(@NotNull AnActionEvent actionEvent) { -// Project project = actionEvent.getProject(); -// if (project == null) return; -// JpsOutputLoaderManager outputLoaderManager = JpsOutputLoaderManager.getInstance(project); -// JpsServerAuthExtension.checkAuthenticatedInBackgroundThread(outputLoaderManager, project, () -> outputLoaderManager.load(true, true)); -// } -//} diff --git a/jps/jps-builders/src/org/jetbrains/jps/cache/action/JpsUpdateCachesAction.java b/jps/jps-builders/src/org/jetbrains/jps/cache/action/JpsUpdateCachesAction.java deleted file mode 100644 index fd6a425d06d6..000000000000 --- a/jps/jps-builders/src/org/jetbrains/jps/cache/action/JpsUpdateCachesAction.java +++ /dev/null @@ -1,18 +0,0 @@ -//package org.jetbrains.jps.cache.action; -// -//import com.intellij.jps.cache.client.JpsServerAuthExtension; -//import com.intellij.jps.cache.loader.JpsOutputLoaderManager; -//import com.intellij.openapi.actionSystem.AnActionEvent; -//import com.intellij.openapi.project.DumbAwareAction; -//import com.intellij.openapi.project.Project; -//import org.jetbrains.annotations.NotNull; -// -//public class JpsUpdateCachesAction extends DumbAwareAction { -// @Override -// public void actionPerformed(@NotNull AnActionEvent actionEvent) { -// Project project = actionEvent.getProject(); -// if (project == null) return; -// JpsOutputLoaderManager outputLoaderManager = JpsOutputLoaderManager.getInstance(project); -// JpsServerAuthExtension.checkAuthenticatedInBackgroundThread(outputLoaderManager, project, () -> outputLoaderManager.load(false, true)); -// } -//} \ No newline at end of file diff --git a/jps/jps-builders/src/org/jetbrains/jps/cache/client/JpsCachesDownloader.java b/jps/jps-builders/src/org/jetbrains/jps/cache/client/JpsCachesDownloader.java index 403c832941ab..6bc3d66e938f 100644 --- a/jps/jps-builders/src/org/jetbrains/jps/cache/client/JpsCachesDownloader.java +++ b/jps/jps-builders/src/org/jetbrains/jps/cache/client/JpsCachesDownloader.java @@ -33,6 +33,7 @@ import java.util.concurrent.Future; import java.util.concurrent.atomic.AtomicLong; import static org.jetbrains.jps.cache.JpsCachesPluginUtil.EXECUTOR_SERVICE; +import static org.jetbrains.jps.cache.client.JpsServerConnectionUtil.saveToFile; class JpsCachesDownloader { private static final Logger LOG = Logger.getInstance(JpsCachesDownloader.class); @@ -200,48 +201,4 @@ class JpsCachesDownloader { } return result; } - - public @NotNull Path saveToFile(@NotNull Path file, HttpEntity responseEntity) throws IOException { - NioFiles.createDirectories(file.getParent()); - - boolean deleteFile = true; - try (OutputStream out = Files.newOutputStream(file)) { - copyStreamContent(responseEntity.getContent(), out, responseEntity.getContentLength()); - deleteFile = false; - } - finally { - if (deleteFile) { - Files.deleteIfExists(file); - } - } - - return file; - } - - private long copyStreamContent(@NotNull InputStream inputStream, - @NotNull OutputStream outputStream, - long expectedContentLength) throws IOException, ProcessCanceledException { - - CountingGZIPInputStream gzipStream = inputStream instanceof CountingGZIPInputStream ? (CountingGZIPInputStream)inputStream : null; - byte[] buffer = new byte[StreamUtil.BUFFER_SIZE]; - int count; - long bytesWritten = 0; - long bytesRead = 0; - while ((count = inputStream.read(buffer)) > 0) { - outputStream.write(buffer, 0, count); - bytesWritten += count; - bytesRead = gzipStream != null ? gzipStream.getCompressedBytesRead() : bytesWritten; - - } - if (gzipStream != null) { - // Amount of read bytes may have changed when 'inputStream.read(buffer)' returns -1 - // E.g. reading GZIP trailer doesn't produce inflated stream data. - bytesRead = gzipStream.getCompressedBytesRead(); - } - - if (bytesRead < expectedContentLength) { - throw new IOException("Connection closed at byte " + bytesRead + ". Expected " + expectedContentLength + " bytes."); - } - return bytesWritten; - } } \ No newline at end of file diff --git a/jps/jps-builders/src/org/jetbrains/jps/cache/client/JpsServerClient.java b/jps/jps-builders/src/org/jetbrains/jps/cache/client/JpsServerClient.java index 5b087e3013db..c7ee689bd4bd 100644 --- a/jps/jps-builders/src/org/jetbrains/jps/cache/client/JpsServerClient.java +++ b/jps/jps-builders/src/org/jetbrains/jps/cache/client/JpsServerClient.java @@ -5,7 +5,6 @@ import org.jetbrains.annotations.Nullable; import org.jetbrains.jps.cache.model.AffectedModule; import org.jetbrains.jps.cache.model.JpsLoaderContext; import org.jetbrains.jps.cache.model.OutputLoadResult; -import org.jetbrains.jps.cache.ui.SegmentedProgressIndicatorManager; import java.io.File; import java.util.List; diff --git a/jps/jps-builders/src/org/jetbrains/jps/cache/client/JpsServerClientImpl.java b/jps/jps-builders/src/org/jetbrains/jps/cache/client/JpsServerClientImpl.java index e5d4195c3c24..d13d42de9de4 100644 --- a/jps/jps-builders/src/org/jetbrains/jps/cache/client/JpsServerClientImpl.java +++ b/jps/jps-builders/src/org/jetbrains/jps/cache/client/JpsServerClientImpl.java @@ -22,7 +22,6 @@ import org.jetbrains.jps.cache.model.AffectedModule; import org.jetbrains.jps.cache.model.DownloadableFileUrl; import org.jetbrains.jps.cache.model.JpsLoaderContext; import org.jetbrains.jps.cache.model.OutputLoadResult; -import org.jetbrains.jps.cache.ui.SegmentedProgressIndicatorManager; import java.io.File; import java.io.IOException; diff --git a/jps/jps-builders/src/org/jetbrains/jps/cache/loader/JpsCacheLoader.java b/jps/jps-builders/src/org/jetbrains/jps/cache/loader/JpsCacheLoader.java index 82e01e02bf19..09796ad05c05 100644 --- a/jps/jps-builders/src/org/jetbrains/jps/cache/loader/JpsCacheLoader.java +++ b/jps/jps-builders/src/org/jetbrains/jps/cache/loader/JpsCacheLoader.java @@ -9,7 +9,6 @@ import org.jetbrains.annotations.Nullable; import org.jetbrains.jps.builders.JpsBuildBundle; import org.jetbrains.jps.cache.client.JpsServerClient; import org.jetbrains.jps.cache.model.JpsLoaderContext; -import org.jetbrains.jps.cache.ui.SegmentedProgressIndicatorManager; import org.jetbrains.jps.incremental.Utils; import java.io.File; diff --git a/jps/jps-builders/src/org/jetbrains/jps/cache/loader/JpsOutputLoaderManager.java b/jps/jps-builders/src/org/jetbrains/jps/cache/loader/JpsOutputLoaderManager.java index f61cc1319234..3c64f6640059 100644 --- a/jps/jps-builders/src/org/jetbrains/jps/cache/loader/JpsOutputLoaderManager.java +++ b/jps/jps-builders/src/org/jetbrains/jps/cache/loader/JpsOutputLoaderManager.java @@ -104,41 +104,9 @@ public class JpsOutputLoaderManager implements Disposable { myNettyClient.saveLatestBuiltCommit(); } - //public void load(boolean isForceUpdate, boolean verbose) { - // Task.Backgroundable task = new Task.Backgroundable(myProject, JpsCacheBundle.message("progress.title.updating.compiler.caches")) { - // @Override - // public void run(@NotNull ProgressIndicator indicator) { - // Pair commitInfo = getNearestCommit(isForceUpdate, verbose); - // if (commitInfo != null) { - // assert myProject != null; - // myProject.getMessageBus().syncPublisher(PortableCachesLoadListener.TOPIC).loadingStarted(); - // // Drop JPS metadata to force plugin for downloading all compilation outputs - // if (isForceUpdate) { - // myMetadataLoader.dropCurrentProjectMetadata(); - // File outDir = new File(myBuildOutDir); - // if (outDir.exists()) { - // indicator.setText(JpsCacheBundle.message("progress.text.clean.output.directories")); - // FileUtil.delete(outDir); - // } - // LOG.info("Compilation output folder empty"); - // } - // startLoadingForCommit(commitInfo.first); - // } - // hasRunningTask.set(false); - // } - // }; - // - // if (!canRunNewLoading()) return; - // BackgroundableProcessIndicator processIndicator = new BackgroundableProcessIndicator(task); - // processIndicator.setIndeterminate(false); - // ProgressManager.getInstance().runProcessWithProgressAsynchronously(task, processIndicator); - //} - @Nullable private Pair getNearestCommit(boolean isForceUpdate, boolean verbose) { Map> availableCommitsPerRemote = myServerClient.getCacheKeysPerRemote(myNettyClient); - - //String latestDownloadedCommit = PropertiesComponent.getInstance().getValue(LATEST_COMMIT_ID); //List repositoryList = GitRepositoryUtil.getCommitsIterator(myProject, availableCommitsPerRemote.keySet()); GitCommitsIterator commitsIterator = new GitCommitsIterator(myNettyClient, INTELLIJ_REPO_NAME); @@ -211,10 +179,7 @@ public class JpsOutputLoaderManager implements Disposable { // Calculate downloads Map> currentSourcesState = myMetadataLoader.loadCurrentProjectMetadata(); - int totalDownloads = - getLoaders().stream().mapToInt(loader -> loader.calculateDownloads(commitSourcesState, currentSourcesState)).sum(); - //indicator.setFraction(0.01); - + int totalDownloads = getLoaders().stream().mapToInt(loader -> loader.calculateDownloads(commitSourcesState, currentSourcesState)).sum(); try { // Computation with loaders results. If at least one of them failed rollback all job initLoaders(commitId, totalDownloads, commitSourcesState, currentSourcesState).thenAccept(loaderStatus -> { @@ -242,39 +207,6 @@ public class JpsOutputLoaderManager implements Disposable { } } - //@Nullable - //private static String getBuildOutDir(@NotNull Project project) { - // VirtualFile projectFile = project.getProjectFile(); - // String projectBasePath = project.getBasePath(); - // if (projectFile == null || projectBasePath == null) { - // LOG.warn("Project files doesn't exist"); - // return null; - // } - // String fileExtension = projectFile.getExtension(); - // if (fileExtension != null && fileExtension.equals("irp")) { - // LOG.warn("File base project not supported"); - // return null; - // } - // - // Path configFile = Paths.get(FileUtil.toCanonicalPath(projectFile.getPath())); - // Element componentTag = JDomSerializationUtil.findComponent(JpsLoaderBase.tryLoadRootElement(configFile), "ProjectRootManager"); - // if (componentTag == null) { - // LOG.warn("Component tag in config file doesn't exist"); - // return null; - // } - // Element output = componentTag.getChild(OUTPUT_TAG); - // if (output == null) { - // LOG.warn("Output tag in config file doesn't exist"); - // return null; - // } - // String url = output.getAttributeValue(URL_ATTRIBUTE); - // if (url == null) { - // LOG.warn("URL attribute in output tag doesn't exist"); - // return null; - // } - // return JpsPathUtil.urlToPath(url).replace("$" + PathMacroUtil.PROJECT_DIR_MACRO_NAME + "$", projectBasePath); - //} - @Nullable private static String getBuildDirPath(@NotNull JpsProject project) { JpsJavaProjectExtension projectExtension = JpsJavaExtensionService.getInstance().getProjectExtension(project); diff --git a/jps/jps-builders/src/org/jetbrains/jps/cache/ui/JpsLoaderNotifications.java b/jps/jps-builders/src/org/jetbrains/jps/cache/ui/JpsLoaderNotifications.java deleted file mode 100644 index d494bacfaf24..000000000000 --- a/jps/jps-builders/src/org/jetbrains/jps/cache/ui/JpsLoaderNotifications.java +++ /dev/null @@ -1,13 +0,0 @@ -//package org.jetbrains.jps.cache.ui; -// -//import com.intellij.notification.NotificationDisplayType; -//import com.intellij.notification.NotificationGroup; -// -//public final class JpsLoaderNotifications { -// public static final NotificationGroup ATTENTION = new NotificationGroup("Compile Output Loader: Attention", -// NotificationDisplayType.STICKY_BALLOON, true); -// public static final NotificationGroup STANDARD = new NotificationGroup("Compile Output Loader: Standard", -// NotificationDisplayType.BALLOON, true); -// public static final NotificationGroup EVENT_LOG = new NotificationGroup("Compile Output Loader: Event Log", -// NotificationDisplayType.NONE, true); -//} diff --git a/jps/jps-builders/src/org/jetbrains/jps/cache/ui/SegmentedProgressIndicatorManager.java b/jps/jps-builders/src/org/jetbrains/jps/cache/ui/SegmentedProgressIndicatorManager.java deleted file mode 100644 index 94e28029fdf3..000000000000 --- a/jps/jps-builders/src/org/jetbrains/jps/cache/ui/SegmentedProgressIndicatorManager.java +++ /dev/null @@ -1,78 +0,0 @@ -package org.jetbrains.jps.cache.ui; - -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class SegmentedProgressIndicatorManager { - private static final Object myLock = new Object(); - private final double mySegmentSize; - private final int myTasksCount; - - public SegmentedProgressIndicatorManager() { - this(1, 1); - } - - public SegmentedProgressIndicatorManager(int tasksCount, double segmentSize) { - mySegmentSize = segmentSize; - myTasksCount = tasksCount; - } - - public SubTaskProgressIndicator createSubTaskIndicator() { - assert myTasksCount != 0; - return new SubTaskProgressIndicator(this); - } - - public void updateFraction(double value) { - double fractionValue = value / myTasksCount * mySegmentSize; - - } - - public void setText(@NotNull Object obj, @Nullable String text) { - - } - - public void setText2(@NotNull SubTaskProgressIndicator subTask, @Nullable String text) { - - } - - public void finished(Object obj) { - setText(obj, null); - } - - //public ProgressIndicator getProgressIndicator() { - // return myProgressIndicator; - //} - - public static final class SubTaskProgressIndicator { - private final SegmentedProgressIndicatorManager myProgressManager; - private double myFraction; - - private SubTaskProgressIndicator(SegmentedProgressIndicatorManager progressManager) { - myProgressManager = progressManager; - myFraction = 0; - } - - public void setFraction(double newValue) { - double diffFraction = newValue - myFraction; - myProgressManager.updateFraction(diffFraction); - myFraction = newValue; - } - - public void setText2(String text) { - myProgressManager.setText2(this, text); - } - - public void setText(String text) { - myProgressManager.setText(this, text); - } - - public double getFraction() { - return myFraction; - } - - public void finished() { - setFraction(1); - myProgressManager.setText2(this, null); - } - } -}