@Nullable @Override protected JComponent createCenterPanel() { ToolbarDecorator decorator = ToolbarDecorator.createDecorator(myTree). addExtraAction(new SelectAllButton()). addExtraAction(new UnselectAllButton()). addExtraAction(new ShowSelectedOnlyButton()). addExtraAction(new SelectRequiredButton()). setToolbarPosition(ActionToolbarPosition.BOTTOM). setToolbarBorder(IdeBorderFactory.createEmptyBorder()); contentPanel.add(decorator.createPanel()); loadingPanel = new JBLoadingPanel(new BorderLayout(), getDisposable()); loadingPanel.add(mainPanel, BorderLayout.CENTER); return loadingPanel; }
public FrameBufferController(@NotNull GfxTraceEditor editor, @NotNull JBRunnerTabs bufferTabs, @NotNull JBScrollPane colorScrollPane, @NotNull JBScrollPane wireframePane, @NotNull JBScrollPane depthScrollPane) { myEditor = editor; myBufferTabs = bufferTabs; myBufferScrollPanes = new JBScrollPane[]{colorScrollPane, wireframePane, depthScrollPane}; assert (myBufferScrollPanes.length == BufferType.length); for (int i = 0; i < myBufferScrollPanes.length; ++i) { myBufferScrollPanes[i].getVerticalScrollBar().setUnitIncrement(20); myBufferScrollPanes[i].getHorizontalScrollBar().setUnitIncrement(20); myBufferScrollPanes[i].setBorder(BorderFactory.createLineBorder(JBColor.border())); myLoadingPanels[i] = new JBLoadingPanel(new BorderLayout(), myEditor.getProject()); myBufferScrollPanes[i].setViewportView(myLoadingPanels[i]); } // TODO: Add a way to pan the viewport with the keyboard. }
public StringResourceViewPanel(AndroidFacet facet, Disposable parentDisposable) { myFacet = facet; myLoadingPanel = new JBLoadingPanel(new BorderLayout(), parentDisposable, 200); myLoadingPanel.add(myContainer); ActionToolbar toolbar = createToolbar(); myToolbarPanel.add(toolbar.getComponent(), BorderLayout.CENTER); if (!HIDE_TRANSLATION_ORDER_LINK) { HyperlinkLabel hyperlinkLabel = new HyperlinkLabel("Order a translation..."); myToolbarPanel.add(hyperlinkLabel, BorderLayout.EAST); hyperlinkLabel.addHyperlinkListener(this); myToolbarPanel.setBorder(IdeBorderFactory.createBorder(SideBorder.BOTTOM)); } myDefaultValueWithBrowseBtn.setButtonIcon(AllIcons.Actions.ShowViewer); myTranslationWithBrowseBtn.setButtonIcon(AllIcons.Actions.ShowViewer); ActionListener showMultilineActionListener = new ShowMultilineActionListener(); myDefaultValueWithBrowseBtn.addActionListener(showMultilineActionListener); myTranslationWithBrowseBtn.addActionListener(showMultilineActionListener); myDefaultValue = myDefaultValueWithBrowseBtn.getTextField(); myTranslation = myTranslationWithBrowseBtn.getTextField(); initEditPanel(); initTable(); myTableModel = new StringResourceTableModel(null); myTable.setModel(myTableModel); myLoadingPanel.setLoadingText("Loading string resource data"); myLoadingPanel.startLoading(); new ParseTask("Loading string resource data").queue(); }
public AtomController(@NotNull Project project, @NotNull JBScrollPane scrollPane) { scrollPane.getHorizontalScrollBar().setUnitIncrement(20); scrollPane.getVerticalScrollBar().setUnitIncrement(20); myTree = new SimpleTree(); myTree.setRowHeight(TreeUtil.TREE_ROW_HEIGHT); myTree.setRootVisible(false); myTree.setLineStyleAngled(); myTree.getEmptyText().setText(SELECT_CAPTURE); myLoadingPanel = new JBLoadingPanel(new BorderLayout(), project); myLoadingPanel.add(myTree); scrollPane.setViewportView(myLoadingPanel); myAtomTreeRenderer = new AtomTreeRenderer(); }
public StateController(@NotNull GfxTraceEditor editor, @NotNull JBScrollPane scrollPane) { myEditor = editor; myTree = new SimpleTree(); myTree.setRowHeight(TreeUtil.TREE_ROW_HEIGHT); myTree.setRootVisible(false); myTree.setCellRenderer(new StateTreeRenderer()); myTree.getEmptyText().setText(SELECT_CAPTURE); myLoadingPanel = new JBLoadingPanel(new BorderLayout(), editor.getProject()); myLoadingPanel.add(myTree); scrollPane.setViewportView(myLoadingPanel); }
@Override public void clearCache() { for (JBLoadingPanel panel : myLoadingPanels) { panel.getContentPanel().removeAll(); } myCurrentFetchAtomId.set(-1); }
private void stopLoading() { for (JBLoadingPanel panel : myLoadingPanels) { if (panel.isLoading()) { panel.stopLoading(); } } }
public void reloadModel(final boolean userForcedRefresh) { myUpdating.set(true); myTable.getEmptyText().setText(StatusText.DEFAULT_EMPTY_TEXT); final JBLoadingPanel loadingPanel = getLoadingPanel(); loadingPanel.startLoading(); ApplicationManager.getApplication().executeOnPooledThread(new Runnable() { public void run() { try { myUpdater = new Updater(loadingPanel, 100); myUpdater.start(); myTree = new DTree(null, "", true); mySrc.refresh(userForcedRefresh); myTrg.refresh(userForcedRefresh); scan(mySrc, myTree, true); scan(myTrg, myTree, false); } catch (final IOException e) { LOG.warn(e); reportException(VcsBundle.message("refresh.failed.message", StringUtil.decapitalize(e.getLocalizedMessage()))); } finally { if (myTree != null) { myTree.setSource(mySrc); myTree.setTarget(myTrg); myTree.update(mySettings); applySettings(); } } } }); }
public GitPushDialog(@NotNull Project project) { super(project); myProject = project; myPusher = new GitPusher(myProject, ServiceManager.getService(project, GitPlatformFacade.class), new EmptyProgressIndicator()); myRepositoryManager = GitUtil.getRepositoryManager(myProject); myRepositories = getRepositoriesWithRemotes(); myLoadingPanel = new JBLoadingPanel(new BorderLayout(), this.getDisposable()); myListPanel = new GitPushLog(myProject, myRepositories, new RepositoryCheckboxListener()); myRefspecPanel = new GitManualPushToBranch(myRepositories, new RefreshButtonListener()); if (GitManualPushToBranch.getRemotesWithCommonNames(myRepositories).isEmpty()) { myRefspecPanel.setVisible(false); setErrorText("Can't push, because no remotes are defined"); setOKActionEnabled(false); myPushPossible = false; } else { myPushPossible = true; } init(); setOKButtonText("Push"); setOKButtonMnemonic('P'); setTitle("Git Push"); }
public void reloadModel(final boolean userForcedRefresh) { myUpdating.set(true); myTable.getEmptyText().setText(StatusText.DEFAULT_EMPTY_TEXT); final JBLoadingPanel loadingPanel = getLoadingPanel(); loadingPanel.startLoading(); final ModalityState modalityState = ModalityState.current(); ApplicationManager.getApplication().executeOnPooledThread(() -> { EmptyProgressIndicator indicator = new EmptyProgressIndicator(modalityState); ProgressManager.getInstance().executeProcessUnderProgress(() -> { try { if (myDisposed) return; myUpdater = new Updater(loadingPanel, 100); myUpdater.start(); text.set("Loading..."); myTree = new DTree(null, "", true); mySrc.refresh(userForcedRefresh); myTrg.refresh(userForcedRefresh); scan(mySrc, myTree, true); scan(myTrg, myTree, false); } catch (final IOException e) { LOG.warn(e); reportException(VcsBundle.message("refresh.failed.message", StringUtil.decapitalize(e.getLocalizedMessage()))); } finally { if (myTree != null) { myTree.setSource(mySrc); myTree.setTarget(myTrg); myTree.update(mySettings); applySettings(); } } }, indicator); }); }
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()); } }); }
private static String getComponentType(JComponent component) { return component instanceof JTree ? "tree" : component instanceof JList ? "list" : component instanceof JTable ? "table" : component instanceof JViewport ? "viewport" : component instanceof ActionToolbar ? "toolbar" : component instanceof EditorComponentImpl ? "editor" : component instanceof EditorGutterComponentEx ? "editor" : component instanceof JBLoadingPanel ? "loading" : component instanceof JBTabs ? "tabs" : component instanceof JBPanelWithEmptyText ? "panel" : component instanceof JPanel && ourKnownNames.contains(component.getName()) ? component.getName() : null; }
@Override public void createToolWindowContent(@NotNull final Project project, @NotNull final ToolWindow toolWindow) { final File adb = AndroidSdkUtils.getAdb(project); ExecutionManager.getInstance(project).getContentManager(); RunnerLayoutUi layoutUi = RunnerLayoutUi.Factory.getInstance(project).create("LogViewer", TOOL_WINDOW_ID, "Logview Tools", project); toolWindow.setIcon(LogviewerPluginIcons.TOOL_ICON); toolWindow.setAvailable(true, null); toolWindow.setToHideOnEmptyContent(true); toolWindow.setTitle(TOOL_WINDOW_ID); DeviceContext deviceContext = new DeviceContext(); Content logcatContent = createLogcatContent(layoutUi, project, deviceContext); final LogView logcatView = logcatContent.getUserData(LOG_VIEW_KEY); layoutUi.addContent(logcatContent, 0, PlaceInGrid.center, false); final JBLoadingPanel loadingPanel = new JBLoadingPanel(new BorderLayout(), project); loadingPanel.add(layoutUi.getComponent(), BorderLayout.CENTER); final ContentManager contentManager = toolWindow.getContentManager(); Content c = contentManager.getFactory().createContent(loadingPanel, "", true); c.putUserData(LOG_VIEW_KEY, logcatView); contentManager.addContent(c); ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { logcatView.activate(); } }, project.getDisposed()); if (adb != null) { loadingPanel.setLoadingText("Initializing ADB"); loadingPanel.startLoading(); ListenableFuture<AndroidDebugBridge> future = AdbService.getInstance().getDebugBridge(adb); Futures.addCallback(future, new FutureCallback<AndroidDebugBridge>() { @Override public void onSuccess(@Nullable AndroidDebugBridge bridge) { Logger.getInstance(LogviewFactory.class).info("Successfully obtained debug bridge"); loadingPanel.stopLoading(); } @Override public void onFailure(@NotNull Throwable t) { loadingPanel.stopLoading(); Logger.getInstance(LogviewFactory.class).info("Unable to obtain debug bridge", t); String msg; if (t.getMessage() != null) { msg = t.getMessage(); } else { msg = String.format("Unable to establish a connection to adb", ApplicationNamesInfo.getInstance().getProductName(), adb.getAbsolutePath()); } Messages.showErrorDialog(msg, "ADB Connection Error"); } }, EdtExecutor.INSTANCE); } else { logcatView.showHint("No adb connection!.\n\nDrag and drop log files to view them."); } }
public void reloadModel(final boolean userForcedRefresh) { myUpdating.set(true); myTable.getEmptyText().setText(StatusText.DEFAULT_EMPTY_TEXT); final JBLoadingPanel loadingPanel = getLoadingPanel(); loadingPanel.startLoading(); final ModalityState modalityState = ModalityState.current(); ApplicationManager.getApplication().executeOnPooledThread(new Runnable() { public void run() { EmptyProgressIndicator indicator = new EmptyProgressIndicator() { @NotNull @Override public ModalityState getModalityState() { return modalityState; } }; ProgressManager.getInstance().executeProcessUnderProgress(new Runnable() { @Override public void run() { try { if (myDisposed) return; myUpdater = new Updater(loadingPanel, 100); myUpdater.start(); text.set("Loading..."); myTree = new DTree(null, "", true); mySrc.refresh(userForcedRefresh); myTrg.refresh(userForcedRefresh); scan(mySrc, myTree, true); scan(myTrg, myTree, false); } catch (final IOException e) { LOG.warn(e); reportException(VcsBundle.message("refresh.failed.message", StringUtil.decapitalize(e.getLocalizedMessage()))); } finally { if (myTree != null) { myTree.setSource(mySrc); myTree.setTarget(myTrg); myTree.update(mySettings); applySettings(); } } } }, indicator); } }); }
private JBLoadingPanel getLoadingPanel() { return (JBLoadingPanel)myTable.getClientProperty(DECORATOR); }
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(new Runnable() { public void run() { if (myDisposed) return; myTree.updateVisibility(mySettings); final ArrayList<DirDiffElementImpl> elements = new ArrayList<DirDiffElementImpl>(); fillElements(myTree, elements); final Runnable uiThread = new Runnable() { public void run() { if (myDisposed) return; clear(); myElements.addAll(elements); myUpdating.set(false); fireTableDataChanged(); DirDiffTableModel.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()); } } }); }
Updater(JBLoadingPanel loadingPanel, int sleep) { super("Loading Updater"); myLoadingPanel = loadingPanel; mySleep = sleep; }
public MainFrame(@NotNull VcsLogDataHolder logDataHolder, @NotNull VcsLogUiImpl vcsLogUI, @NotNull Project project, @NotNull VcsLogSettings settings, @NotNull VcsLogUiProperties uiProperties, @NotNull VcsLog log, @NotNull VisiblePack initialDataPack) { // collect info myLogDataHolder = logDataHolder; myUI = vcsLogUI; myProject = project; myUiProperties = uiProperties; myLog = log; myFilterUi = new VcsLogClassicFilterUi(myUI, logDataHolder, uiProperties, initialDataPack); // initialize components myGraphTable = new VcsLogGraphTable(vcsLogUI, logDataHolder, initialDataPack); myBranchesPanel = new BranchesPanel(logDataHolder, vcsLogUI, initialDataPack.getRefsModel()); myBranchesPanel.setVisible(settings.isShowBranchesPanel()); myDetailsPanel = new DetailsPanel(logDataHolder, myGraphTable, vcsLogUI.getColorManager(), initialDataPack); myChangesBrowser = new RepositoryChangesBrowser(project, null, Collections.<Change>emptyList(), null); myChangesBrowser.getDiffAction().registerCustomShortcutSet(myChangesBrowser.getDiffAction().getShortcutSet(), getGraphTable()); myChangesBrowser.getEditSourceAction().registerCustomShortcutSet(CommonShortcuts.getEditSource(), getGraphTable()); setDefaultEmptyText(myChangesBrowser); myChangesLoadingPane = new JBLoadingPanel(new BorderLayout(), project); myChangesLoadingPane.add(myChangesBrowser); final CommitSelectionListener selectionChangeListener = new CommitSelectionListener(myChangesBrowser); myGraphTable.getSelectionModel().addListSelectionListener(selectionChangeListener); myGraphTable.getSelectionModel().addListSelectionListener(myDetailsPanel); updateWhenDetailsAreLoaded(selectionChangeListener); // layout myToolbar = createActionsToolbar(); myDetailsSplitter = new Splitter(true, 0.7f); myDetailsSplitter.setFirstComponent(setupScrolledGraph()); setupDetailsSplitter(myUiProperties.isShowDetails()); JComponent toolbars = new JPanel(new BorderLayout()); toolbars.add(myToolbar, BorderLayout.NORTH); toolbars.add(myBranchesPanel, BorderLayout.CENTER); JComponent toolbarsAndTable = new JPanel(new BorderLayout()); toolbarsAndTable.add(toolbars, BorderLayout.NORTH); toolbarsAndTable.add(myDetailsSplitter, BorderLayout.CENTER); final Splitter changesBrowserSplitter = new Splitter(false, 0.7f); changesBrowserSplitter.setFirstComponent(toolbarsAndTable); changesBrowserSplitter.setSecondComponent(myChangesLoadingPane); setLayout(new BorderLayout()); add(changesBrowserSplitter); Disposer.register(logDataHolder, new Disposable() { public void dispose() { myDetailsSplitter.dispose(); changesBrowserSplitter.dispose(); } }); myGraphTable.resetDefaultFocusTraversalKeys(); setFocusTraversalPolicyProvider(true); setFocusTraversalPolicy(new MyFocusPolicy()); }
DetailsPanel(@NotNull VcsLogDataHolder logDataHolder, @NotNull VcsLogGraphTable graphTable, @NotNull VcsLogColorManager colorManager, @NotNull VisiblePack initialDataPack) { myLogDataHolder = logDataHolder; myGraphTable = graphTable; myColorManager = colorManager; myDataPack = initialDataPack; myReferencesPanel = new ReferencesPanel(myColorManager); myCommitDetailsPanel = new DataPanel(logDataHolder.getProject(), logDataHolder.isMultiRoot(), logDataHolder); myScrollPane = new JBScrollPane(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); myMainContentPanel = new JPanel(new MigLayout("flowy, ins 0, hidemode 3, gapy 0")) { @Override public Dimension getPreferredSize() { Dimension size = super.getPreferredSize(); size.width = myScrollPane.getViewport().getWidth() - 5; return size; } }; myMainContentPanel.setOpaque(false); myScrollPane.setOpaque(false); myScrollPane.getViewport().setOpaque(false); myScrollPane.setViewportView(myMainContentPanel); myMainContentPanel.add(myReferencesPanel, ""); myMainContentPanel.add(myCommitDetailsPanel, ""); myLoadingPanel = new JBLoadingPanel(new BorderLayout(), logDataHolder, ProgressWindow.DEFAULT_PROGRESS_DIALOG_POSTPONE_TIME_MILLIS) { @Override public Color getBackground() { return getDetailsBackground(); } }; myLoadingPanel.add(myScrollPane); myMessagePanel = new MessagePanel(); setLayout(new CardLayout()); add(myLoadingPanel, STANDARD_LAYER); add(myMessagePanel, MESSAGE_LAYER); showMessage("No commits selected"); }
@Nullable protected JComponent createCenterPanel() { JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); GridBagConstraints gb = new GridBagConstraints(); // top label. gb.insets = new Insets(2, 2, 2, 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; }
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(new Runnable() { public void run() { myTree.updateVisibility(mySettings); final ArrayList<DirDiffElementImpl> elements = new ArrayList<DirDiffElementImpl>(); fillElements(myTree, elements); final Runnable uiThread = new Runnable() { public void run() { clear(); myElements.addAll(elements); myUpdating.set(false); fireTableDataChanged(); DirDiffTableModel.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()); } } }); }
protected CommitSelectionListener(@Nonnull VcsLogData data, @Nonnull VcsLogGraphTable table, @Nonnull JBLoadingPanel panel) { myLogData = data; myGraphTable = table; myLoadingPanel = panel; }