mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
vcs: Used "JBLoadingPanel" instead of "DetailsPanel"
"DetailsPanel" provided just panel with "Loading..." text - so similar "JBLoadingPanel" is used instead. Removed "DetailsPanel".
This commit is contained in:
@@ -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());
|
||||
|
||||
+9
-6
@@ -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<T> 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<T> 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<T> implements RefreshablePanel {
|
||||
myQueue.run(new Loader(myProject, myLoadingTitle, copy));
|
||||
}
|
||||
|
||||
myDetailsPanel.loading();
|
||||
myDetailsPanel.startLoading();
|
||||
} else {
|
||||
refreshPresentation();
|
||||
}
|
||||
@@ -91,12 +93,13 @@ public abstract class AbstractRefreshablePanel<T> 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 {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user