use of com.intellij.openapi.actionSystem.DataContext in project android by JetBrains.
the class NlComponentTreeTest method testPasteIntoLayoutAsFirstChild.
public void testPasteIntoLayoutAsFirstChild() {
copy(myTextView);
DataContext context = mock(DataContext.class);
myModel.getSelectionModel().toggle(myLinearLayout);
assertThat(myTree.isPasteEnabled(context)).isTrue();
assertThat(myTree.isPastePossible(context)).isTrue();
myTree.performPaste(context);
assertThat(toTree()).isEqualTo("<RelativeLayout> [expanded]\n" + " <LinearLayout> [expanded] [selected]\n" + " <TextView>\n" + " <Button>\n" + " <TextView>\n" + " <AbsoluteLayout>\n");
}
use of com.intellij.openapi.actionSystem.DataContext in project android by JetBrains.
the class NlComponentTreeTest method testDelete.
public void testDelete() {
DataContext context = mock(DataContext.class);
myModel.getSelectionModel().toggle(myTextView);
assertThat(myTree.canDeleteElement(context)).isTrue();
myTree.deleteElement(context);
assertThat(CopyPasteManager.getInstance().getContents()).isNull();
assertThat(toTree()).isEqualTo("<RelativeLayout> [expanded]\n" + " <LinearLayout> [expanded]\n" + " <Button>\n" + " <AbsoluteLayout>\n");
}
use of com.intellij.openapi.actionSystem.DataContext in project android by JetBrains.
the class NlComponentTreeTest method testCutRemovesComponents.
public void testCutRemovesComponents() {
DataContext context = mock(DataContext.class);
myModel.getSelectionModel().toggle(myTextView);
assertThat(myTree.isCutVisible(context)).isTrue();
assertThat(myTree.isCutEnabled(context)).isTrue();
myTree.performCut(context);
verify(myCopyPasteManager).setContents(notNull(Transferable.class));
assertThat(toTree()).isEqualTo("<RelativeLayout> [expanded]\n" + " <LinearLayout> [expanded]\n" + " <Button>\n" + " <AbsoluteLayout>\n");
}
use of com.intellij.openapi.actionSystem.DataContext in project android by JetBrains.
the class SdkUpdaterConfigurable method isModified.
@Override
public boolean isModified() {
if (myPanel.isModified()) {
return true;
}
// If the user modifies the channel, comes back here, and then applies the change, we want to be able to update
// right away. Thus we mark ourselves as modified if UpdateSettingsConfigurable is modified, and then reload in
// apply().
DataContext dataContext = DataManager.getInstance().getDataContext(myPanel.getComponent());
Settings data = Settings.KEY.getData(dataContext);
if (data != null) {
Configurable updatesConfigurable = data.find("preferences.updates");
if (updatesConfigurable != null) {
return updatesConfigurable.isModified();
}
}
return false;
}
use of com.intellij.openapi.actionSystem.DataContext in project intellij-plugins by JetBrains.
the class DartSelectWordTest method doTest.
private void doTest(@NotNull final String before, @NotNull final String... after) {
myFixture.configureByText("file.dart", before);
final DataContext dataContext = DataManager.getInstance().getDataContext(myFixture.getEditor().getComponent());
final SelectWordHandler handler = new SelectWordHandler(null);
for (String text : after) {
handler.execute(myFixture.getEditor(), myFixture.getEditor().getCaretModel().getCurrentCaret(), dataContext);
myFixture.checkResult(text);
}
}
Aggregations