use of com.intellij.ui.components.JBLoadingPanel in project android by JetBrains.
the class DeployTargetPickerDialog method createCenterPanel.
@Nullable
@Override
protected JComponent createCenterPanel() {
final JBLoadingPanel loadingPanel = new JBLoadingPanel(new BorderLayout(), getDisposable());
loadingPanel.add(myDeployTargetProvider == null ? myDevicesPanel : myContentPane);
loadingPanel.setLoadingText("Initializing ADB");
if (!myAdbFuture.isDone()) {
loadingPanel.startLoading();
Futures.addCallback(myAdbFuture, new FutureCallback<AndroidDebugBridge>() {
@Override
public void onSuccess(AndroidDebugBridge result) {
loadingPanel.stopLoading();
Logger.getInstance(DeployTargetPickerDialog.class).info("Successfully obtained debug bridge");
}
@Override
public void onFailure(Throwable t) {
loadingPanel.stopLoading();
Logger.getInstance(DeployTargetPickerDialog.class).info("Unable to obtain debug bridge", t);
// TODO: show an inline banner to restart adb?
}
}, EdtExecutor.INSTANCE);
}
return loadingPanel;
}
use of com.intellij.ui.components.JBLoadingPanel in project intellij-community by JetBrains.
the class DirDiffTableModel method applySettings.
public void applySettings() {
if (!myUpdating.get())
myUpdating.set(true);
final JBLoadingPanel loadingPanel = getLoadingPanel();
if (!loadingPanel.isLoading()) {
loadingPanel.startLoading();
if (myUpdater == null) {
myUpdater = new Updater(loadingPanel, 100);
myUpdater.start();
}
}
final Application app = ApplicationManager.getApplication();
app.executeOnPooledThread(() -> {
if (myDisposed)
return;
myTree.updateVisibility(mySettings);
final ArrayList<DirDiffElementImpl> elements = new ArrayList<>();
fillElements(myTree, elements);
final Runnable uiThread = () -> {
if (myDisposed)
return;
clear();
myElements.addAll(elements);
myUpdating.set(false);
fireTableDataChanged();
this.text.set("");
if (loadingPanel.isLoading()) {
loadingPanel.stopLoading();
}
if (mySelectionConfig == null) {
selectFirstRow();
} else {
mySelectionConfig.restore();
}
myPanel.update(true);
};
if (myProject == null || myProject.isDefault()) {
SwingUtilities.invokeLater(uiThread);
} else {
app.invokeLater(uiThread, ModalityState.any());
}
});
}
use of com.intellij.ui.components.JBLoadingPanel in project intellij-community by JetBrains.
the class UpgradeFormatDialog method createCenterPanel.
@Nullable
protected JComponent createCenterPanel() {
JPanel panel = new JPanel();
panel.setLayout(new GridBagLayout());
GridBagConstraints gb = new GridBagConstraints();
// top label.
gb.insets = JBUI.insets(2);
gb.weightx = 1;
gb.weighty = 0;
gb.gridwidth = 2;
gb.gridheight = 1;
gb.gridx = 0;
gb.gridy = 0;
gb.anchor = GridBagConstraints.WEST;
gb.fill = GridBagConstraints.HORIZONTAL;
File adminPath = new File(myPath, SVNFileUtil.getAdminDirectoryName());
final boolean adminPathIsDirectory = adminPath.isDirectory();
final String label = getMiddlePartOfResourceKey(adminPathIsDirectory);
JLabel topLabel = new JLabel(getTopMessage(label));
topLabel.setUI(new MultiLineLabelUI());
panel.add(topLabel, gb);
gb.gridy += 1;
registerFormat(WorkingCopyFormat.ONE_DOT_SIX, label, panel, gb);
registerFormat(WorkingCopyFormat.ONE_DOT_SEVEN, label, panel, gb);
registerFormat(WorkingCopyFormat.ONE_DOT_EIGHT, label, panel, gb);
final JPanel auxiliaryPanel = getBottomAuxiliaryPanel();
if (auxiliaryPanel != null) {
panel.add(auxiliaryPanel, gb);
gb.gridy += 1;
}
myLoadingPanel = new JBLoadingPanel(new BorderLayout(), getDisposable());
myLoadingPanel.add(panel, BorderLayout.CENTER);
return myLoadingPanel;
}
Aggregations