Search in sources :

Example 1 with StatusText

use of com.intellij.util.ui.StatusText in project intellij-community by JetBrains.

the class SvnHistoryProvider method getUICustomization.

@Override
public VcsDependentHistoryComponents getUICustomization(final VcsHistorySession session, JComponent forShortcutRegistration) {
    final ColumnInfo[] columns;
    final Consumer<VcsFileRevision> listener;
    final JComponent addComp;
    if (((SvnHistorySession) session).isHaveMergeSources()) {
        final MergeSourceColumnInfo mergeSourceColumn = new MergeSourceColumnInfo((SvnHistorySession) session);
        columns = new ColumnInfo[] { new CopyFromColumnInfo(), mergeSourceColumn };
        final JTextArea field = new JTextArea() {

            final StatusText statusText = new StatusText(this) {

                @Override
                protected boolean isStatusVisible() {
                    return getDocument().getLength() == 0;
                }
            };

            @Override
            public Color getBackground() {
                return UIUtil.getEditorPaneBackground();
            }

            {
                statusText.setText("Merge sources");
                setWrapStyleWord(true);
                setLineWrap(true);
            }

            @Override
            protected void paintComponent(Graphics g) {
                super.paintComponent(g);
                statusText.paint(this, g);
            }
        };
        field.setEditable(false);
        field.setOpaque(false);
        field.setWrapStyleWord(true);
        listener = vcsFileRevision -> {
            field.setText(mergeSourceColumn.getText(vcsFileRevision));
            field.setCaretPosition(0);
            field.repaint();
        };
        final MergeSourceDetailsAction sourceAction = new MergeSourceDetailsAction();
        sourceAction.registerSelf(forShortcutRegistration);
        JPanel fieldPanel = new ToolbarDecorator() {

            @Override
            protected JComponent getComponent() {
                return field;
            }

            @Override
            protected void updateButtons() {
            }

            @Override
            protected void installDnDSupport() {
            }

            @Override
            protected boolean isModelEditable() {
                return false;
            }
        }.initPosition().addExtraAction(AnActionButton.fromAction(sourceAction)).createPanel();
        fieldPanel.setBorder(IdeBorderFactory.createEmptyBorder());
        addComp = fieldPanel;
    } else {
        columns = new ColumnInfo[] { new CopyFromColumnInfo() };
        addComp = null;
        listener = null;
    }
    return new VcsDependentHistoryComponents(columns, listener, addComp);
}
Also used : StatusText(com.intellij.util.ui.StatusText) ColumnInfo(com.intellij.util.ui.ColumnInfo)

Example 2 with StatusText

use of com.intellij.util.ui.StatusText in project intellij-community by JetBrains.

the class ColorOptionsTree method setEmptyText.

public void setEmptyText(@NotNull String text, @Nullable ActionListener linkListener) {
    StatusText statusText = getEmptyText();
    if (linkListener != null) {
        statusText.clear();
        statusText.appendText(text + ' ');
        statusText.appendText("More...", SimpleTextAttributes.LINK_ATTRIBUTES, linkListener);
    } else {
        statusText.setText(text);
    }
}
Also used : StatusText(com.intellij.util.ui.StatusText)

Example 3 with StatusText

use of com.intellij.util.ui.StatusText in project intellij-community by JetBrains.

the class UpdateInfoTree method setChangeLists.

public void setChangeLists(final List<CommittedChangeList> receivedChanges) {
    final boolean hasEmptyCaches = CommittedChangesCache.getInstance(myProject).hasEmptyCaches();
    ApplicationManager.getApplication().invokeLater(new Runnable() {

        public void run() {
            if (myLoadingChangeListsLabel != null) {
                remove(myLoadingChangeListsLabel);
                myLoadingChangeListsLabel = null;
            }
            myCommittedChangeLists = receivedChanges;
            myTreeBrowser.setItems(myCommittedChangeLists, CommittedChangesBrowserUseCase.UPDATE);
            if (hasEmptyCaches) {
                final StatusText statusText = myTreeBrowser.getEmptyText();
                statusText.clear();
                statusText.appendText("Click ").appendText("Refresh", SimpleTextAttributes.LINK_ATTRIBUTES, new ActionListener() {

                    public void actionPerformed(final ActionEvent e) {
                        RefreshIncomingChangesAction.doRefresh(myProject);
                    }
                }).appendText(" to initialize repository changes cache");
            }
        }
    }, myProject.getDisposed());
}
Also used : ActionListener(java.awt.event.ActionListener) StatusText(com.intellij.util.ui.StatusText) ActionEvent(java.awt.event.ActionEvent)

Example 4 with StatusText

use of com.intellij.util.ui.StatusText in project intellij-community by JetBrains.

the class JrePathEditor method updateDefaultJrePresentation.

private void updateDefaultJrePresentation() {
    StatusText text = myComboboxEditor.getEmptyText();
    text.clear();
    text.appendText(DEFAULT_JRE_TEXT, SimpleTextAttributes.REGULAR_ATTRIBUTES);
    text.appendText(myDefaultJreSelector.getDescriptionString(), SimpleTextAttributes.GRAY_ATTRIBUTES);
}
Also used : StatusText(com.intellij.util.ui.StatusText)

Aggregations

StatusText (com.intellij.util.ui.StatusText)4 ColumnInfo (com.intellij.util.ui.ColumnInfo)1 ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1