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());
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;
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
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;
myLoadingTitle = loadingTitle;
myQueue = queue;
myTicket = new Ticket();
- myDetailsPanel = new DetailsPanel();
- myDetailsPanel.loading();
+ myDetailsPanel = new JBLoadingPanel(new BorderLayout(), this);
+ myDetailsPanel.setLoadingText("Loading...");
}
@CalledInAwt
myQueue.run(new Loader(myProject, myLoadingTitle, copy));
}
- myDetailsPanel.loading();
+ myDetailsPanel.startLoading();
} else {
refreshPresentation();
}
@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 {
+++ /dev/null
-/*
- * 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;
- }
-}