Search in sources :

Example 1 with ActionLink

use of com.intellij.ui.components.labels.ActionLink in project intellij-community by JetBrains.

the class RunConfigurable method drawPressAddButtonMessage.

private void drawPressAddButtonMessage(final ConfigurationType configurationType) {
    JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
    panel.setBorder(new EmptyBorder(30, 0, 0, 0));
    panel.add(new JLabel("Press the"));
    ActionLink addIcon = new ActionLink("", ADD_ICON, myAddAction);
    addIcon.setBorder(new EmptyBorder(0, 0, 0, 5));
    panel.add(addIcon);
    final String configurationTypeDescription = configurationType != null ? configurationType.getConfigurationTypeDescription() : ExecutionBundle.message("run.configuration.default.type.description");
    panel.add(new JLabel(ExecutionBundle.message("empty.run.configuration.panel.text.label3", configurationTypeDescription)));
    JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(panel, true);
    myRightPanel.removeAll();
    myRightPanel.add(scrollPane, BorderLayout.CENTER);
    if (configurationType == null) {
        JPanel settingsPanel = new JPanel(new GridBagLayout());
        GridBag grid = new GridBag().setDefaultAnchor(GridBagConstraints.NORTHWEST);
        for (Pair<UnnamedConfigurable, JComponent> each : myAdditionalSettings) {
            settingsPanel.add(each.second, grid.nextLine().next());
        }
        settingsPanel.add(createSettingsPanel(), grid.nextLine().next());
        JPanel wrapper = new JPanel(new BorderLayout());
        wrapper.add(settingsPanel, BorderLayout.WEST);
        wrapper.add(Box.createGlue(), BorderLayout.CENTER);
        myRightPanel.add(wrapper, BorderLayout.SOUTH);
    }
    myRightPanel.revalidate();
    myRightPanel.repaint();
}
Also used : EmptyBorder(javax.swing.border.EmptyBorder) ActionLink(com.intellij.ui.components.labels.ActionLink)

Example 2 with ActionLink

use of com.intellij.ui.components.labels.ActionLink in project intellij-community by JetBrains.

the class AbstractGithubTagDownloadedProjectGenerator method createGitHubLink.

public ActionLink createGitHubLink() {
    final ActionLink link = new ActionLink(getName() + " on GitHub", new AnAction() {

        @Override
        public void actionPerformed(AnActionEvent e) {
            BrowserUtil.open("https://github.com/" + getGithubUserName() + "/" + getGithubRepositoryName());
        }
    });
    link.setFont(UIUtil.getLabelFont(UIUtil.FontSize.SMALL));
    return link;
}
Also used : AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) AnAction(com.intellij.openapi.actionSystem.AnAction) ActionLink(com.intellij.ui.components.labels.ActionLink)

Example 3 with ActionLink

use of com.intellij.ui.components.labels.ActionLink in project intellij-community by JetBrains.

the class ActionLinkFixture method findByActionId.

@NotNull
public static ActionLinkFixture findByActionId(@NotNull final String actionId, @NotNull final Robot robot, @NotNull final Container container) {
    final Ref<ActionLink> actionLinkRef = new Ref<ActionLink>();
    pause(new Condition("Find ActionLink with ID '" + actionId + "'") {

        @Override
        public boolean test() {
            Collection<ActionLink> found = robot.finder().findAll(container, new GenericTypeMatcher<ActionLink>(ActionLink.class) {

                @Override
                protected boolean isMatching(@NotNull ActionLink actionLink) {
                    if (actionLink.isVisible()) {
                        AnAction action = actionLink.getAction();
                        String id = ActionManager.getInstance().getId(action);
                        return actionId.equals(id);
                    }
                    return false;
                }
            });
            if (found.size() == 1) {
                actionLinkRef.set(getFirstItem(found));
                return true;
            }
            return false;
        }
    }, SHORT_TIMEOUT);
    ActionLink actionLink = actionLinkRef.get();
    if (actionLink == null) {
        throw new ComponentLookupException("Failed to find ActionLink with ID '" + actionId + "'");
    }
    return new ActionLinkFixture(robot, actionLink);
}
Also used : Condition(org.fest.swing.timing.Condition) Ref(com.intellij.openapi.util.Ref) Collection(java.util.Collection) ComponentLookupException(org.fest.swing.exception.ComponentLookupException) GenericTypeMatcher(org.fest.swing.core.GenericTypeMatcher) NotNull(org.jetbrains.annotations.NotNull) AnAction(com.intellij.openapi.actionSystem.AnAction) ActionLink(com.intellij.ui.components.labels.ActionLink) NotNull(org.jetbrains.annotations.NotNull)

Example 4 with ActionLink

use of com.intellij.ui.components.labels.ActionLink in project intellij-community by JetBrains.

the class ActionLinkFixture method findActionLinkByName.

@NotNull
public static ActionLinkFixture findActionLinkByName(@NotNull final String actionName, @NotNull final Robot robot, @NotNull final Container container, @NotNull final Timeout timeout) {
    final Ref<ActionLink> actionLinkRef = new Ref<ActionLink>();
    pause(new Condition("Find ActionLink with name '" + actionName + "'") {

        @Override
        public boolean test() {
            Collection<ActionLink> found = robot.finder().findAll(container, new GenericTypeMatcher<ActionLink>(ActionLink.class) {

                @Override
                protected boolean isMatching(@NotNull ActionLink actionLink) {
                    if (actionLink.isVisible()) {
                        return actionLink.getText().equals(actionName);
                    }
                    return false;
                }
            });
            if (found.size() == 1) {
                actionLinkRef.set(getFirstItem(found));
                return true;
            }
            return false;
        }
    }, timeout);
    ActionLink actionLink = actionLinkRef.get();
    if (actionLink == null) {
        throw new ComponentLookupException("Failed to find ActionLink with name '" + actionName + "'");
    }
    return new ActionLinkFixture(robot, actionLink);
}
Also used : Condition(org.fest.swing.timing.Condition) Ref(com.intellij.openapi.util.Ref) Collection(java.util.Collection) ComponentLookupException(org.fest.swing.exception.ComponentLookupException) GenericTypeMatcher(org.fest.swing.core.GenericTypeMatcher) NotNull(org.jetbrains.annotations.NotNull) ActionLink(com.intellij.ui.components.labels.ActionLink) NotNull(org.jetbrains.annotations.NotNull)

Example 5 with ActionLink

use of com.intellij.ui.components.labels.ActionLink in project intellij-community by JetBrains.

the class ChangeProjectIconForm method createUIComponents.

private void createUIComponents() {
    mySetIcon = new ActionLink("Change...", new ChangeProjectIcon(false));
    mySetIconDark = new ActionLink("Change...", new ChangeProjectIcon(true));
    myClear = new ActionLink("Reset", new ResetProjectIcon(false));
    myClearDark = new ActionLink("Reset", new ResetProjectIcon(true));
}
Also used : ActionLink(com.intellij.ui.components.labels.ActionLink)

Aggregations

ActionLink (com.intellij.ui.components.labels.ActionLink)8 AnAction (com.intellij.openapi.actionSystem.AnAction)5 NotNull (org.jetbrains.annotations.NotNull)4 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)3 Ref (com.intellij.openapi.util.Ref)3 ComponentLookupException (org.fest.swing.exception.ComponentLookupException)3 Collection (java.util.Collection)2 GenericTypeMatcher (org.fest.swing.core.GenericTypeMatcher)2 Condition (org.fest.swing.timing.Condition)2 ExecutionException (com.intellij.execution.ExecutionException)1 Project (com.intellij.openapi.project.Project)1 Pair (com.intellij.openapi.util.Pair)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 DownloadableFileDescription (com.intellij.util.download.DownloadableFileDescription)1 DownloadableFileService (com.intellij.util.download.DownloadableFileService)1 FileDownloader (com.intellij.util.download.FileDownloader)1 List (java.util.List)1 EmptyBorder (javax.swing.border.EmptyBorder)1