Search in sources :

Example 6 with JBLoadingPanel

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;
}
Also used : JBLoadingPanel(com.intellij.ui.components.JBLoadingPanel) AndroidDebugBridge(com.android.ddmlib.AndroidDebugBridge) Nullable(org.jetbrains.annotations.Nullable)

Example 7 with JBLoadingPanel

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());
        }
    });
}
Also used : ArrayList(java.util.ArrayList) JBLoadingPanel(com.intellij.ui.components.JBLoadingPanel)

Example 8 with JBLoadingPanel

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;
}
Also used : MultiLineLabelUI(com.intellij.openapi.ui.MultiLineLabelUI) JBLoadingPanel(com.intellij.ui.components.JBLoadingPanel) File(java.io.File) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

JBLoadingPanel (com.intellij.ui.components.JBLoadingPanel)8 Nullable (org.jetbrains.annotations.Nullable)3 AndroidDebugBridge (com.android.ddmlib.AndroidDebugBridge)2 File (java.io.File)2 DeviceContext (com.android.tools.idea.ddms.DeviceContext)1 DevicePanel (com.android.tools.idea.ddms.DevicePanel)1 OpenVmTraceHandler (com.android.tools.idea.ddms.OpenVmTraceHandler)1 AndroidLogcatView (com.android.tools.idea.logcat.AndroidLogcatView)1 ConsoleView (com.intellij.execution.ui.ConsoleView)1 RunnerLayoutUi (com.intellij.execution.ui.RunnerLayoutUi)1 FileEditor (com.intellij.openapi.fileEditor.FileEditor)1 FileEditorManager (com.intellij.openapi.fileEditor.FileEditorManager)1 OpenFileDescriptor (com.intellij.openapi.fileEditor.OpenFileDescriptor)1 EmptyProgressIndicator (com.intellij.openapi.progress.EmptyProgressIndicator)1 Project (com.intellij.openapi.project.Project)1 MultiLineLabelUI (com.intellij.openapi.ui.MultiLineLabelUI)1 ToolWindow (com.intellij.openapi.wm.ToolWindow)1 Content (com.intellij.ui.content.Content)1 ContentManager (com.intellij.ui.content.ContentManager)1 ContentManagerAdapter (com.intellij.ui.content.ContentManagerAdapter)1