use of com.intellij.openapi.actionSystem.impl.ActionButton in project android by JetBrains.
the class EditMultipleSourcesAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
Project project = e.getData(CommonDataKeys.PROJECT);
assert project != null;
final Navigatable[] files = e.getData(CommonDataKeys.NAVIGATABLE_ARRAY);
assert files != null && files.length > 0;
if (files.length > 1) {
DefaultListModel listModel = new DefaultListModel();
for (int i = 0; i < files.length; ++i) {
assert files[i] instanceof PsiClassNavigation;
//noinspection unchecked
listModel.add(i, ((PsiClassNavigation) files[i]).getPsiFile());
}
final JBList list = new JBList(listModel);
int width = WindowManager.getInstance().getFrame(project).getSize().width;
list.setCellRenderer(new GotoFileCellRenderer(width));
JBPopup popup = JBPopupFactory.getInstance().createListPopupBuilder(list).setTitle("Choose Target File").setItemChoosenCallback(new Runnable() {
@Override
public void run() {
Object selectedValue = list.getSelectedValue();
PsiClassNavigation navigationWrapper = null;
for (Navigatable file : files) {
if (selectedValue == ((PsiClassNavigation) file).getPsiFile()) {
navigationWrapper = (PsiClassNavigation) file;
break;
}
}
assert navigationWrapper != null;
if (navigationWrapper.canNavigate()) {
navigationWrapper.navigate(true);
}
}
}).createPopup();
if (e.getInputEvent().getSource() instanceof ActionButton) {
popup.showUnderneathOf((ActionButton) e.getInputEvent().getSource());
} else {
popup.showInBestPositionFor(e.getDataContext());
}
} else {
assert files[0] instanceof PsiClassNavigation;
PsiClassNavigation file = (PsiClassNavigation) files[0];
if (file.canNavigate()) {
file.navigate(true);
}
}
}
use of com.intellij.openapi.actionSystem.impl.ActionButton in project android by JetBrains.
the class AttachedToolWindowTest method testHideFromButtonInHeader.
@Test
public void testHideFromButtonInHeader() {
myToolWindow.setFloating(false);
ActionButton button = findButtonByName(myToolWindow.getComponent(), "Hide");
assertThat(button).isNotNull();
button.click();
assertThat(myToolWindow.isMinimized()).isTrue();
verify(myModel).update(eq(myToolWindow), eq(PropertyType.MINIMIZED));
}
use of com.intellij.openapi.actionSystem.impl.ActionButton in project android by JetBrains.
the class AttachedToolWindowTest method testAdditionalActionFromButtonInHeader.
@Test
public void testAdditionalActionFromButtonInHeader() {
PalettePanelToolContent panel = (PalettePanelToolContent) myToolWindow.getContent();
assert panel != null;
ActionButton button = findButtonByName(myToolWindow.getComponent(), "AdditionalAction");
assertThat(button).isNotNull();
button.click();
assertThat(panel.isAdditionalActionPerformed()).isTrue();
}
use of com.intellij.openapi.actionSystem.impl.ActionButton in project android by JetBrains.
the class AttachedToolWindowTest method testSearchButtonInHeader.
@Test
public void testSearchButtonInHeader() {
JLabel header = findHeaderLabel(myToolWindow.getComponent());
assertThat(header.isVisible()).isTrue();
SearchTextField searchField = findHeaderSearchField(myToolWindow.getComponent());
assertThat(searchField.isVisible()).isFalse();
ActionButton button = findButtonByName(myToolWindow.getComponent(), "Search");
assertThat(button).isNotNull();
button.click();
assertThat(header.isVisible()).isFalse();
assertThat(searchField.isVisible()).isTrue();
fireFocusLost(searchField.getTextEditor());
assertThat(header.isVisible()).isTrue();
assertThat(searchField.isVisible()).isFalse();
}
use of com.intellij.openapi.actionSystem.impl.ActionButton in project android by JetBrains.
the class ProjectStructureDialogFixture method clickAddButtonImpl.
protected void clickAddButtonImpl() {
ActionButton addButton = robot().finder().find(target(), new GenericTypeMatcher<ActionButton>(ActionButton.class) {
@Override
protected boolean isMatching(@NotNull ActionButton button) {
String toolTipText = button.getToolTipText();
return button.isShowing() && toolTipText != null && toolTipText.startsWith("Add");
}
});
robot().click(addButton);
}
Aggregations