Search in sources :

Example 21 with JTextComponent

use of javax.swing.text.JTextComponent in project intellij-community by JetBrains.

the class DeleteAction method update.

@Override
public void update(AnActionEvent e) {
    Presentation presentation = e.getPresentation();
    if (ActionPlaces.PROJECT_VIEW_POPUP.equals(e.getPlace()) || ActionPlaces.COMMANDER_POPUP.equals(e.getPlace())) {
        presentation.setText(IdeBundle.message("action.delete.ellipsis"));
    } else {
        presentation.setText(IdeBundle.message("action.delete"));
    }
    if (e.getProject() == null) {
        presentation.setEnabled(false);
        return;
    }
    DataContext dataContext = e.getDataContext();
    DeleteProvider provider = getDeleteProvider(dataContext);
    if (e.getInputEvent() instanceof KeyEvent) {
        KeyEvent keyEvent = (KeyEvent) e.getInputEvent();
        Object component = PlatformDataKeys.CONTEXT_COMPONENT.getData(dataContext);
        // Do not override text deletion
        if (component instanceof JTextComponent)
            provider = null;
        if (keyEvent.getKeyCode() == KeyEvent.VK_BACK_SPACE) {
            // Do not override text deletion in speed search
            if (component instanceof JComponent) {
                SpeedSearchSupply searchSupply = SpeedSearchSupply.getSupply((JComponent) component);
                if (searchSupply != null)
                    provider = null;
            }
            String activeSpeedSearchFilter = SpeedSearchSupply.SPEED_SEARCH_CURRENT_QUERY.getData(dataContext);
            if (!StringUtil.isEmpty(activeSpeedSearchFilter)) {
                provider = null;
            }
        }
    }
    if (provider instanceof TitledHandler) {
        presentation.setText(((TitledHandler) provider).getActionTitle());
    }
    boolean canDelete = provider != null && provider.canDeleteElement(dataContext);
    if (ActionPlaces.isPopupPlace(e.getPlace())) {
        presentation.setVisible(canDelete);
    } else {
        presentation.setEnabled(canDelete);
    }
}
Also used : DeleteProvider(com.intellij.ide.DeleteProvider) KeyEvent(java.awt.event.KeyEvent) SpeedSearchSupply(com.intellij.ui.speedSearch.SpeedSearchSupply) JTextComponent(javax.swing.text.JTextComponent) TitledHandler(com.intellij.ide.TitledHandler)

Example 22 with JTextComponent

use of javax.swing.text.JTextComponent in project android by JetBrains.

the class ConfigureAndroidProjectStepFixture method enterPackageName.

@NotNull
public ConfigureAndroidProjectStepFixture enterPackageName(@NotNull String text) {
    LabelWithEditLink link = robot().finder().findByType(target(), LabelWithEditLink.class);
    HyperlinkLabel editLabel = robot().finder().findByType(link, HyperlinkLabel.class);
    robot().click(editLabel);
    JTextComponent textField = findTextFieldWithLabel("Package name:");
    replaceText(textField, text);
    // click "Done"
    robot().click(editLabel);
    return this;
}
Also used : LabelWithEditLink(com.android.tools.adtui.LabelWithEditLink) JTextComponent(javax.swing.text.JTextComponent) HyperlinkLabel(com.intellij.ui.HyperlinkLabel) NotNull(org.jetbrains.annotations.NotNull)

Example 23 with JTextComponent

use of javax.swing.text.JTextComponent in project android by JetBrains.

the class ConfigureBasicActivityStepFixture method undoTextFieldValue.

@NotNull
public ConfigureBasicActivityStepFixture undoTextFieldValue(@NotNull ActivityTextField activityField) {
    JTextComponent textField = findTextFieldWithLabel(activityField.getLabelText());
    robot().rightClick(textField);
    JMenuItem popup = GuiTests.waitUntilShowing(robot(), null, Matchers.byText(JMenuItem.class, "Restore default value"));
    robot().click(popup);
    return this;
}
Also used : JTextComponent(javax.swing.text.JTextComponent) NotNull(org.jetbrains.annotations.NotNull)

Example 24 with JTextComponent

use of javax.swing.text.JTextComponent in project android by JetBrains.

the class ConfigureAndroidProjectStepFixture method enterApplicationName.

@NotNull
public ConfigureAndroidProjectStepFixture enterApplicationName(@NotNull String text) {
    JTextComponent textField = findTextFieldWithLabel("Application name:");
    replaceText(textField, text);
    return this;
}
Also used : JTextComponent(javax.swing.text.JTextComponent) NotNull(org.jetbrains.annotations.NotNull)

Example 25 with JTextComponent

use of javax.swing.text.JTextComponent in project android by JetBrains.

the class InputDialogFixture method enterTextAndClickOk.

public void enterTextAndClickOk(@NotNull String text) {
    JTextComponent input = robot().finder().find(target(), JTextComponentMatcher.any());
    JTextComponentFixture inputFixture = new JTextComponentFixture(robot(), input);
    inputFixture.enterText(text);
    findAndClickOkButton(this);
}
Also used : JTextComponent(javax.swing.text.JTextComponent) JTextComponentFixture(org.fest.swing.fixture.JTextComponentFixture)

Aggregations

JTextComponent (javax.swing.text.JTextComponent)82 NotNull (org.jetbrains.annotations.NotNull)9 Component (java.awt.Component)6 DocumentEvent (javax.swing.event.DocumentEvent)6 DocumentAdapter (com.intellij.ui.DocumentAdapter)5 Disposable (com.intellij.openapi.Disposable)3 JButton (javax.swing.JButton)3 Project (com.intellij.openapi.project.Project)2 GraphicsConfig (com.intellij.openapi.ui.GraphicsConfig)2 FocusEvent (java.awt.event.FocusEvent)2 KeyEvent (java.awt.event.KeyEvent)2 File (java.io.File)2 ArrayList (java.util.ArrayList)2 Accessible (javax.accessibility.Accessible)2 Action (javax.swing.Action)2 JComboBox (javax.swing.JComboBox)2 JFrame (javax.swing.JFrame)2 JLabel (javax.swing.JLabel)2 JMenuItem (javax.swing.JMenuItem)2 JPopupMenu (javax.swing.JPopupMenu)2