Search in sources :

Example 56 with DataContext

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

the class NlComponentTreeTest method testCopyIntoRootWhenNothingIsSelected.

public void testCopyIntoRootWhenNothingIsSelected() {
    copy(myTextView);
    DataContext context = mock(DataContext.class);
    assertThat(myTree.isPasteEnabled(context)).isTrue();
    assertThat(myTree.isPastePossible(context)).isTrue();
    myTree.performPaste(context);
    assertThat(toTree()).isEqualTo("<RelativeLayout>  [expanded]\n" + "    <TextView>\n" + "    <LinearLayout>  [expanded]\n" + "        <Button>\n" + "    <TextView>\n" + "    <AbsoluteLayout>\n");
}
Also used : DataContext(com.intellij.openapi.actionSystem.DataContext)

Example 57 with DataContext

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");
}
Also used : DataContext(com.intellij.openapi.actionSystem.DataContext)

Example 58 with DataContext

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");
}
Also used : DataContext(com.intellij.openapi.actionSystem.DataContext)

Example 59 with DataContext

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");
}
Also used : DataContext(com.intellij.openapi.actionSystem.DataContext) Transferable(java.awt.datatransfer.Transferable)

Example 60 with DataContext

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;
}
Also used : DataContext(com.intellij.openapi.actionSystem.DataContext) Configurable(com.intellij.openapi.options.Configurable) SearchableConfigurable(com.intellij.openapi.options.SearchableConfigurable) Settings(com.intellij.openapi.options.ex.Settings)

Aggregations

DataContext (com.intellij.openapi.actionSystem.DataContext)204 Project (com.intellij.openapi.project.Project)73 VirtualFile (com.intellij.openapi.vfs.VirtualFile)29 NotNull (org.jetbrains.annotations.NotNull)23 IpnbFileEditor (org.jetbrains.plugins.ipnb.editor.IpnbFileEditor)23 Editor (com.intellij.openapi.editor.Editor)22 Nullable (org.jetbrains.annotations.Nullable)21 FileEditor (com.intellij.openapi.fileEditor.FileEditor)20 PsiFile (com.intellij.psi.PsiFile)17 IpnbFilePanel (org.jetbrains.plugins.ipnb.editor.panels.IpnbFilePanel)16 Module (com.intellij.openapi.module.Module)13 PsiElement (com.intellij.psi.PsiElement)13 SimpleDataContext (com.intellij.openapi.actionSystem.impl.SimpleDataContext)11 Presentation (com.intellij.openapi.actionSystem.Presentation)10 DataManager (com.intellij.ide.DataManager)9 AnActionEvent (com.intellij.openapi.actionSystem.AnActionEvent)9 List (java.util.List)9 Consumer (com.intellij.util.Consumer)7 AnAction (com.intellij.openapi.actionSystem.AnAction)6 Transferable (java.awt.datatransfer.Transferable)6