From c836710da37555e81ea50ec183c13f6b112d7bd8 Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Mon, 3 Jun 2013 14:28:47 +0200 Subject: [PATCH] Annoying compaction progress on splash --- .../lang-impl/src/com/intellij/psi/stubs/StubIndexImpl.java | 3 ++- .../src/com/intellij/util/indexing/FileBasedIndexImpl.java | 4 +++- .../com/intellij/openapi/ui/impl/DialogWrapperPeerImpl.java | 6 ++++++ platform/platform-impl/src/com/intellij/ui/Splash.java | 4 +++- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/psi/stubs/StubIndexImpl.java b/platform/lang-impl/src/com/intellij/psi/stubs/StubIndexImpl.java index e4b44bd1c7cc..995ff03b08fb 100644 --- a/platform/lang-impl/src/com/intellij/psi/stubs/StubIndexImpl.java +++ b/platform/lang-impl/src/com/intellij/psi/stubs/StubIndexImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -143,6 +143,7 @@ public class StubIndexImpl extends StubIndex implements ApplicationComponent, Pe .getInstance().runProcessWithProgressSynchronously(new ThrowableComputable, IOException>() { @Override public MapIndexStorage compute() throws IOException { + ProgressManager.getInstance().getProgressIndicator().setIndeterminate(true); return new MapIndexStorage( IndexInfrastructure.getStorageFile(indexKey), extension.getKeyDescriptor(), diff --git a/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java b/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java index 1035bfeb3618..2440356d1615 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -409,6 +409,7 @@ public class FileBasedIndexImpl extends FileBasedIndex { .getInstance().runProcessWithProgressSynchronously(new ThrowableComputable, IOException>() { @Override public MapIndexStorage compute() throws IOException { + ProgressManager.getInstance().getProgressIndicator().setIndeterminate(true); return new MapIndexStorage( IndexInfrastructure.getStorageFile(name), extension.getKeyDescriptor(), @@ -523,6 +524,7 @@ public class FileBasedIndexImpl extends FileBasedIndex { new ThrowableComputable>, IOException>() { @Override public PersistentHashMap> compute() throws IOException { + ProgressManager.getInstance().getProgressIndicator().setIndeterminate(true); return createIdToDataKeysIndex(indexId, keyDescriptor, storage); } }; diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/impl/DialogWrapperPeerImpl.java b/platform/platform-impl/src/com/intellij/openapi/ui/impl/DialogWrapperPeerImpl.java index 0e952e3b0916..4731f5e04915 100644 --- a/platform/platform-impl/src/com/intellij/openapi/ui/impl/DialogWrapperPeerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/ui/impl/DialogWrapperPeerImpl.java @@ -23,6 +23,7 @@ import com.intellij.openapi.Disposable; import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.application.Application; import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.application.ex.ApplicationManagerEx; import com.intellij.openapi.application.impl.LaterInvocator; import com.intellij.openapi.command.CommandProcessor; import com.intellij.openapi.command.CommandProcessorEx; @@ -760,6 +761,11 @@ public class DialogWrapperPeerImpl extends DialogWrapperPeer implements FocusTra setBackground(UIUtil.getPanelBackground()); + if (!ApplicationManagerEx.getApplicationEx().isLoaded()) { + final Point loc = getLocation(); + loc.y += Splash.SIZE.getHeight() / 2 + 42; // half splash + progress header + setLocation(loc); + } super.show(); } diff --git a/platform/platform-impl/src/com/intellij/ui/Splash.java b/platform/platform-impl/src/com/intellij/ui/Splash.java index f7bad9dad142..d5f114dea56f 100644 --- a/platform/platform-impl/src/com/intellij/ui/Splash.java +++ b/platform/platform-impl/src/com/intellij/ui/Splash.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,6 +42,7 @@ import java.util.List; * @author Konstantin Bulenkov */ public class Splash extends JDialog implements StartupProgress { + public static Dimension SIZE; private final Icon myImage; private int myProgressHeight = 2; private Color myProgressColor = null; @@ -61,6 +62,7 @@ public class Splash extends JDialog implements StartupProgress { setFocusableWindowState(false); Icon originalImage = IconLoader.getIcon(imageName); + SIZE = new Dimension(originalImage.getIconWidth(), originalImage.getIconHeight()); myImage = new SplashImage(originalImage, textColor); myLabel = new JLabel(myImage) { @Override