diff --git a/platform/vcs-api/src/com/intellij/vcsUtil/UIVcsUtil.java b/platform/vcs-api/src/com/intellij/vcsUtil/UIVcsUtil.java index c4856811e3f0..00f1887f1d1b 100644 --- a/platform/vcs-api/src/com/intellij/vcsUtil/UIVcsUtil.java +++ b/platform/vcs-api/src/com/intellij/vcsUtil/UIVcsUtil.java @@ -27,6 +27,7 @@ public class UIVcsUtil { private UIVcsUtil() { } + @SuppressWarnings("unused") // Required for compatibility with external plugins. public static JPanel errorPanel(final String text, boolean isError) { final JLabel label = new JLabel(XmlStringUtil.wrapInHtml(escapeXmlAndAddBr(text))); label.setForeground(isError ? SimpleTextAttributes.ERROR_ATTRIBUTES.getFgColor() : UIUtil.getInactiveTextColor()); diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/AbstractRefreshablePanel.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/AbstractRefreshablePanel.java index 7eca447bc921..8d9dcf9e8c1d 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/AbstractRefreshablePanel.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/AbstractRefreshablePanel.java @@ -24,6 +24,7 @@ import com.intellij.openapi.ui.MessageType; import com.intellij.openapi.util.Comparing; import com.intellij.openapi.vcs.VcsException; import com.intellij.openapi.vcs.ui.VcsBalloonProblemNotifier; +import com.intellij.ui.components.JBLoadingPanel; import com.intellij.util.continuation.ModalityIgnorantBackgroundableTask; import org.jetbrains.annotations.CalledInAwt; import org.jetbrains.annotations.CalledInBackground; @@ -31,6 +32,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; +import java.awt.*; /** * For presentation, which is itself in GenericDetails (not necessarily) - shown from time to time, but cached, and @@ -48,7 +50,7 @@ public abstract class AbstractRefreshablePanel implements RefreshablePanel { private Ticket myCurrentlySelected; private Ticket mySetId; private final Ticket myTicket; - private final DetailsPanel myDetailsPanel; + private final JBLoadingPanel myDetailsPanel; private final BackgroundTaskQueue myQueue; private volatile boolean myDisposed; @@ -57,8 +59,8 @@ public abstract class AbstractRefreshablePanel implements RefreshablePanel { myLoadingTitle = loadingTitle; myQueue = queue; myTicket = new Ticket(); - myDetailsPanel = new DetailsPanel(); - myDetailsPanel.loading(); + myDetailsPanel = new JBLoadingPanel(new BorderLayout(), this); + myDetailsPanel.setLoadingText("Loading..."); } @CalledInAwt @@ -75,7 +77,7 @@ public abstract class AbstractRefreshablePanel implements RefreshablePanel { myQueue.run(new Loader(myProject, myLoadingTitle, copy)); } - myDetailsPanel.loading(); + myDetailsPanel.startLoading(); } else { refreshPresentation(); } @@ -91,12 +93,13 @@ public abstract class AbstractRefreshablePanel implements RefreshablePanel { @CalledInAwt private void acceptData(final T t) { - myDetailsPanel.data(dataToPresentation(t)); + myDetailsPanel.add(dataToPresentation(t)); + myDetailsPanel.stopLoading(); } @Override public JPanel getPanel() { - return myDetailsPanel.getPanel(); + return myDetailsPanel; } private class Loader extends ModalityIgnorantBackgroundableTask { diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/DetailsPanel.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/DetailsPanel.java deleted file mode 100644 index e067e6012ae0..000000000000 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/DetailsPanel.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2000-2011 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.openapi.vcs.changes; - -import com.intellij.util.ui.JBUI; -import com.intellij.vcsUtil.UIVcsUtil; - -import javax.swing.*; -import java.awt.*; - -public class DetailsPanel { - private CardLayout myLayout; - private JPanel myPanel; - - public DetailsPanel() { - myPanel = new JPanel(); - myLayout = new CardLayout(); - myPanel.setLayout(myLayout); - myPanel.add(UIVcsUtil.errorPanel("Loading...", false), Layer.loading.name()); - myPanel.add(JBUI.Panels.simplePanel(), Layer.data.name()); - } - - public void loading() { - myLayout.show(myPanel, Layer.loading.name()); - } - - public void data(JPanel panel) { - myPanel.add(panel, Layer.data.name()); - myLayout.show(myPanel, Layer.data.name()); - } - - private enum Layer { - loading, - data, - } - - public JPanel getPanel() { - return myPanel; - } -}