Search in sources :

Example 21 with ActionButton

use of com.intellij.openapi.actionSystem.impl.ActionButton in project android by JetBrains.

the class LibraryPropertiesDialog method createCenterPanel.

@Nullable
@Override
protected JComponent createCenterPanel() {
    myIconLabel.setIcon(AllIcons.Modules.Library);
    myNameLabel.setText(myLibrary.getName());
    LibraryEditor editor = new SourcesAndDocsOnlyEditor(myLibrary);
    myLibraryEditorComponent = new LibraryRootsComponent(myProject, editor) {

        @Override
        public void updatePropertiesLabel() {
            JComponent c = getComponent();
            if (c != null) {
                MultiLineLabel propertiesLabel = findComponentOfType(c, MultiLineLabel.class);
                if (propertiesLabel != null) {
                    propertiesLabel.setText("Add or remove source/Javadoc attachments");
                }
            }
        }
    };
    myLibraryEditorComponent.updatePropertiesLabel();
    JComponent c = myLibraryEditorComponent.getComponent();
    // Remove "Exclude" button. We don't support this in libraries.
    List<ActionButton> actionButtons = findComponentsOfType(c, ActionButton.class);
    for (ActionButton actionButton : actionButtons) {
        String text = actionButton.getAction().getTemplatePresentation().getText();
        if (text != null && text.startsWith("Exclude")) {
            actionButton.setVisible(false);
            break;
        }
    }
    MultiLineLabel propertiesLabel = findComponentOfType(c, MultiLineLabel.class);
    if (propertiesLabel != null) {
        propertiesLabel.setBorder(BorderFactory.createEmptyBorder(1, 1, 0, 1));
    }
    myTreePanel.add(c, BorderLayout.CENTER);
    myTreePanel.setBorder(customLine(OnePixelDivider.BACKGROUND, 1, 1, 1, 1));
    return myMainPanel;
}
Also used : ExistingLibraryEditor(com.intellij.openapi.roots.ui.configuration.libraryEditor.ExistingLibraryEditor) LibraryEditor(com.intellij.openapi.roots.ui.configuration.libraryEditor.LibraryEditor) ActionButton(com.intellij.openapi.actionSystem.impl.ActionButton) LibraryRootsComponent(com.intellij.openapi.roots.ui.configuration.libraryEditor.LibraryRootsComponent) MultiLineLabel(com.intellij.openapi.ui.ex.MultiLineLabel) Nullable(org.jetbrains.annotations.Nullable)

Example 22 with ActionButton

use of com.intellij.openapi.actionSystem.impl.ActionButton in project android by JetBrains.

the class LibraryPropertiesDialogFixture method addAttachment.

@NotNull
public LibraryPropertiesDialogFixture addAttachment(@NotNull File path) {
    ActionButton addButton = GuiTests.waitUntilShowing(robot(), target(), new GenericTypeMatcher<ActionButton>(ActionButton.class) {

        @Override
        protected boolean isMatching(@NotNull ActionButton button) {
            return "Add".equals(button.getAction().getTemplatePresentation().getDescription());
        }
    });
    new ActionButtonFixture(robot(), addButton).click();
    VirtualFile attachment = findFileByIoFile(path, true);
    FileChooserDialogFixture fileChooser = FileChooserDialogFixture.findDialog(robot(), new GenericTypeMatcher<JDialog>(JDialog.class) {

        @Override
        protected boolean isMatching(@NotNull JDialog dialog) {
            String title = dialog.getTitle();
            return isNotEmpty(title) && title.startsWith("Attach Files or Directories to Library");
        }
    });
    assertNotNull("Failed to find VirtualFile with path " + quote(path.getPath()), attachment);
    fileChooser.select(attachment).clickOk();
    return this;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) ActionButton(com.intellij.openapi.actionSystem.impl.ActionButton) Assert.assertNotNull(org.junit.Assert.assertNotNull) NotNull(org.jetbrains.annotations.NotNull)

Example 23 with ActionButton

use of com.intellij.openapi.actionSystem.impl.ActionButton in project android by JetBrains.

the class NlPropertyFixture method clickCustomizer.

public void clickCustomizer() {
    //JPanel
    //  TextEditor
    //  BrowsePanel
    //    ActionButton
    ActionButton button = GuiTests.waitUntilFound(myRobot, myValuePanel, Matchers.byType(ActionButton.class));
    new ComponentDriver(myRobot).click(button);
}
Also used : ActionButton(com.intellij.openapi.actionSystem.impl.ActionButton) ComponentDriver(org.fest.swing.driver.ComponentDriver)

Aggregations

ActionButton (com.intellij.openapi.actionSystem.impl.ActionButton)23 NotNull (org.jetbrains.annotations.NotNull)6 AnAction (com.intellij.openapi.actionSystem.AnAction)3 Test (org.junit.Test)3 ActionButtonFixture (com.android.tools.idea.tests.gui.framework.fixture.ActionButtonFixture)2 PresentationFactory (com.intellij.openapi.actionSystem.impl.PresentationFactory)2 Ref (com.intellij.openapi.util.Ref)2 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 ComponentLookupException (org.fest.swing.exception.ComponentLookupException)2 PropertiesComponent (com.intellij.ide.util.PropertiesComponent)1 GotoFileCellRenderer (com.intellij.ide.util.gotoByName.GotoFileCellRenderer)1 ActionButtonLook (com.intellij.openapi.actionSystem.ex.ActionButtonLook)1 InplaceActionButtonLook (com.intellij.openapi.actionSystem.impl.InplaceActionButtonLook)1 Project (com.intellij.openapi.project.Project)1 ExistingLibraryEditor (com.intellij.openapi.roots.ui.configuration.libraryEditor.ExistingLibraryEditor)1 LibraryEditor (com.intellij.openapi.roots.ui.configuration.libraryEditor.LibraryEditor)1 LibraryRootsComponent (com.intellij.openapi.roots.ui.configuration.libraryEditor.LibraryRootsComponent)1 ValidationInfo (com.intellij.openapi.ui.ValidationInfo)1 MultiLineLabel (com.intellij.openapi.ui.ex.MultiLineLabel)1 JBPopup (com.intellij.openapi.ui.popup.JBPopup)1