Search in sources :

Example 1 with RichTextControlBuilder

use of org.jetbrains.plugins.gradle.ui.RichTextControlBuilder in project intellij-community by JetBrains.

the class GradleToolWindowPanel method initContent.

public void initContent() {
    final ActionManager actionManager = ActionManager.getInstance();
    final ActionGroup actionGroup = (ActionGroup) actionManager.getAction(TOOL_WINDOW_TOOLBAR_ID);
    ActionToolbar actionToolbar = actionManager.createActionToolbar(myPlace, actionGroup, true);
    JPanel toolbarControl = new JPanel(new GridBagLayout());
    GridBagConstraints constraints = new GridBagConstraints();
    constraints.gridwidth = GridBagConstraints.REMAINDER;
    constraints.weightx = 1;
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.anchor = GridBagConstraints.WEST;
    toolbarControl.add(actionToolbar.getComponent(), constraints);
    for (JComponent component : getToolbarControls()) {
        component.setBorder(IdeBorderFactory.createBorder(SideBorder.TOP));
        toolbarControl.add(component, constraints);
    }
    setToolbar(toolbarControl);
    final JComponent payloadControl = buildContent();
    JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(payloadControl);
    JScrollBar scrollBar = scrollPane.getVerticalScrollBar();
    myContent.add(scrollPane, CONTENT_CARD_NAME);
    RichTextControlBuilder builder = new RichTextControlBuilder();
    builder.setBackgroundColor(payloadControl.getBackground());
    builder.setForegroundColor(UIUtil.getInactiveTextColor());
    builder.setFont(payloadControl.getFont());
    builder.setText(GradleBundle.message("gradle.toolwindow.text.no.linked.project"));
    final JComponent noLinkedProjectControl = builder.build();
    myContent.add(noLinkedProjectControl, NON_LINKED_CARD_NAME);
    update();
}
Also used : ActionManager(com.intellij.openapi.actionSystem.ActionManager) ActionGroup(com.intellij.openapi.actionSystem.ActionGroup) RichTextControlBuilder(org.jetbrains.plugins.gradle.ui.RichTextControlBuilder) ActionToolbar(com.intellij.openapi.actionSystem.ActionToolbar)

Example 2 with RichTextControlBuilder

use of org.jetbrains.plugins.gradle.ui.RichTextControlBuilder in project intellij-community by JetBrains.

the class RichTextControlBuilderTest method setUp.

@Before
public void setUp() {
    myBuilder = new RichTextControlBuilder();
    myMockery = new JUnit4Mockery() {

        {
            setImposteriser(ClassImposteriser.INSTANCE);
        }
    };
    myProcessor = myMockery.mock(RichTextControlBuilder.RichTextProcessor.class);
    myMockery.checking(new Expectations() {

        {
            allowing(myProcessor).getKey();
            will(returnValue(META_KEY));
        }
    });
    myBuilder.registerProcessor(myProcessor);
}
Also used : Expectations(org.jmock.Expectations) JUnit4Mockery(org.jmock.integration.junit4.JUnit4Mockery) RichTextControlBuilder(org.jetbrains.plugins.gradle.ui.RichTextControlBuilder) Before(org.junit.Before)

Aggregations

RichTextControlBuilder (org.jetbrains.plugins.gradle.ui.RichTextControlBuilder)2 ActionGroup (com.intellij.openapi.actionSystem.ActionGroup)1 ActionManager (com.intellij.openapi.actionSystem.ActionManager)1 ActionToolbar (com.intellij.openapi.actionSystem.ActionToolbar)1 Expectations (org.jmock.Expectations)1 JUnit4Mockery (org.jmock.integration.junit4.JUnit4Mockery)1 Before (org.junit.Before)1