Search in sources :

Example 56 with StringSelection

use of java.awt.datatransfer.StringSelection in project android by JetBrains.

the class PTableTest method testPasteIsNotAvailableWhenNothingIsSelected.

public void testPasteIsNotAvailableWhenNothingIsSelected() {
    when(myCopyPasteManager.getContents()).thenReturn(new StringSelection("new value"));
    assertThat(myTable.isPastePossible(myContext)).isFalse();
    assertThat(myTable.isPasteEnabled(myContext)).isTrue();
    myTable.performPaste(myContext);
    assertHasOriginalValues();
}
Also used : StringSelection(java.awt.datatransfer.StringSelection)

Example 57 with StringSelection

use of java.awt.datatransfer.StringSelection in project android by JetBrains.

the class PTableTest method testPasteIsNotAvailableToGroupNode.

public void testPasteIsNotAvailableToGroupNode() throws Exception {
    when(myCopyPasteManager.getContents()).thenReturn(new StringSelection("new value"));
    myTable.setRowSelectionInterval(2, 2);
    assertThat(myTable.isPastePossible(myContext)).isFalse();
    assertThat(myTable.isPasteEnabled(myContext)).isTrue();
    myTable.performPaste(myContext);
    assertHasOriginalValues();
}
Also used : StringSelection(java.awt.datatransfer.StringSelection)

Example 58 with StringSelection

use of java.awt.datatransfer.StringSelection in project android by JetBrains.

the class GenerateLayoutTestSkeletonAction method actionPerformed.

@Override
public void actionPerformed(@NotNull AnActionEvent event) {
    NlModel model = getModel(event.getProject());
    if (model == null) {
        return;
    }
    int option = Messages.showDialog(model.getProject(), "Generate LayoutTest skeleton with the current layout components.", "Generate LayoutTest Skeleton", new String[] { "Copy to Clipboard", "Cancel" }, 0, AndroidIcons.AndroidTestRoot);
    if (option == 0) {
        CopyPasteManager.getInstance().setContents(new StringSelection(generateModelFixture(model)));
    }
}
Also used : NlModel(com.android.tools.idea.uibuilder.model.NlModel) StringSelection(java.awt.datatransfer.StringSelection)

Example 59 with StringSelection

use of java.awt.datatransfer.StringSelection in project android by JetBrains.

the class PTable method performCopy.

@Override
public void performCopy(@NotNull DataContext dataContext) {
    PTableItem item = getSelectedNonGroupItem();
    if (item == null) {
        return;
    }
    myCopyPasteManager.setContents(new StringSelection(item.getValue()));
}
Also used : StringSelection(java.awt.datatransfer.StringSelection)

Example 60 with StringSelection

use of java.awt.datatransfer.StringSelection in project intellij-community by JetBrains.

the class DumpLookupElementWeights method dumpLookupElementWeights.

public static void dumpLookupElementWeights(final LookupImpl lookup) {
    LookupElement selected = lookup.getCurrentItem();
    String sb = "selected: " + selected;
    if (selected != null) {
        sb += "\nprefix: " + lookup.itemPattern(selected);
    }
    sb += "\nweights:\n" + StringUtil.join(getLookupElementWeights(lookup, true), "\n");
    System.out.println(sb);
    LOG.info(sb);
    try {
        CopyPasteManager.getInstance().setContents(new StringSelection(sb));
    } catch (Exception ignore) {
    }
}
Also used : LookupElement(com.intellij.codeInsight.lookup.LookupElement) StringSelection(java.awt.datatransfer.StringSelection)

Aggregations

StringSelection (java.awt.datatransfer.StringSelection)99 Clipboard (java.awt.datatransfer.Clipboard)28 ActionEvent (java.awt.event.ActionEvent)11 Transferable (java.awt.datatransfer.Transferable)7 IOException (java.io.IOException)7 ArrayList (java.util.ArrayList)7 JTextArea (javax.swing.JTextArea)7 Test (org.junit.Test)7 JPanel (javax.swing.JPanel)6 ActionListener (java.awt.event.ActionListener)5 JScrollPane (javax.swing.JScrollPane)5 Editor (com.intellij.openapi.editor.Editor)4 Project (com.intellij.openapi.project.Project)4 PsiFile (com.intellij.psi.PsiFile)4 ClipboardOwner (java.awt.datatransfer.ClipboardOwner)4 JMenuItem (javax.swing.JMenuItem)4 BibEntry (org.jabref.model.entry.BibEntry)4 AnAction (com.intellij.openapi.actionSystem.AnAction)3 PsiElement (com.intellij.psi.PsiElement)3 BorderLayout (java.awt.BorderLayout)3