当前位置: 首页>>代码示例>>Java>>正文


Java CopyPasteManager类代码示例

本文整理汇总了Java中com.intellij.openapi.ide.CopyPasteManager的典型用法代码示例。如果您正苦于以下问题:Java CopyPasteManager类的具体用法?Java CopyPasteManager怎么用?Java CopyPasteManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CopyPasteManager类属于com.intellij.openapi.ide包,在下文中一共展示了CopyPasteManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: actionPerformed

import com.intellij.openapi.ide.CopyPasteManager; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
    final Project project = getEventProject(e);
    final List<SutrFile> sutrFiles = ActionUtil.getFiles(e);
    if (project == null || sutrFiles.isEmpty()) return;

    StringBuilder builder = null;

    try {
        builder = SutrGenerator.buildPythonLauncher(sutrFiles);
        CopyPasteManager.getInstance().setContents(new StringSelection(builder.toString()));
    } catch (SutrGeneratorException e1) {
        ActionUtil.ShowErrorMessage(e1.getMessage(), e);
    }

}
 
开发者ID:SlalomConsulting,项目名称:sutr-io,代码行数:17,代码来源:GeneratePythonLauncher.java

示例2: actionPerformed

import com.intellij.openapi.ide.CopyPasteManager; //导入依赖的package包/类
@Override
    public void actionPerformed(AnActionEvent e) {
        final Project project = getEventProject(e);
        final List<SutrFile> sutrFiles = ActionUtil.getFiles(e);
        if (project == null || sutrFiles.isEmpty()) return;

        try {
            SutrConfigProvider config = SutrPluginUtil.getConfigProvider();

//            String handlerTemplateLocation = config.handlerTemplateLocation;

//            String template = config.getCurrentHandlerTemplatePath();

            String template =  "C:\\Users\\stryderc\\dev\\sources\\sutr-io\\src\\resources\\templates\\python.mustache";

            SutrMustacheModelBuilder modelBuilder = new SutrMustacheModelBuilder(template);
            modelBuilder.Build(sutrFiles);
            StringSelection transferable = new StringSelection(modelBuilder.Compile());

            CopyPasteManager.getInstance().setContents(transferable);

        } catch (SutrMustacheBuilderException | SutrGeneratorException e1) {
            e1.printStackTrace();
        }
    }
 
开发者ID:SlalomConsulting,项目名称:sutr-io,代码行数:26,代码来源:GenerateHandler.java

示例3: actionPerformed

import com.intellij.openapi.ide.CopyPasteManager; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
    final Project project = getEventProject(e);
    final List<SutrFile> sutrFiles = ActionUtil.getFiles(e);
    if (project == null || sutrFiles.isEmpty()) return;

    try {
        final StringBuilder builder = SutrGenerator.buildUtterances(sutrFiles);
        CopyPasteManager.getInstance().setContents(new StringSelection(builder.toString()));
        ActionUtil.ShowInfoMessage("Sutr Utterances copied to clipboard", e);
    } catch (SutrGeneratorException e1) {
        ActionUtil.ShowErrorMessage(e1.getMessage(), e);
    }


}
 
开发者ID:SlalomConsulting,项目名称:sutr-io,代码行数:17,代码来源:CopyUtterances.java

示例4: actionPerformed

import com.intellij.openapi.ide.CopyPasteManager; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
    SutrCustomType customType = ActionUtil.getCustomTypeUnderCaret(e);
    if (customType == null) {
        ActionUtil.ShowErrorMessage("No slotType slotName found.", e);
        return;
    }

    try {
        final StringBuilder result = SutrGenerator.buildCustomTypeItems(customType);
        CopyPasteManager.getInstance().setContents(new StringSelection(result.toString()));
        ActionUtil.ShowInfoMessage("Custom types list for " + customType.getTypeName().getText() + " copied to clipboard", e);
    } catch (SutrGeneratorException e1) {
        ActionUtil.ShowErrorMessage(e1.getMessage(), e);
    }
}
 
开发者ID:SlalomConsulting,项目名称:sutr-io,代码行数:17,代码来源:CopyCustomType.java

示例5: executeWriteAction

import com.intellij.openapi.ide.CopyPasteManager; //导入依赖的package包/类
@Override
public void executeWriteAction(Editor editor, Caret caret, DataContext dataContext) {
    CommandProcessor.getInstance().setCurrentCommandGroupId(EditorActionUtil.DELETE_COMMAND_GROUP);
    CopyPasteManager.getInstance().stopKillRings();

    boolean camelMode = editor.getSettings().isCamelWords();
    if (myNegateCamelMode) {
        camelMode = !camelMode;
    }

    if (editor.getSelectionModel().hasSelection()) {
        EditHelpers.deleteSelectedText(editor);
        return;
    }

    deleteToWordEnd(editor, camelMode);
}
 
开发者ID:vsch,项目名称:MissingInActions,代码行数:18,代码来源:DeleteToWordEndNotEolActionHandler.java

示例6: delete

import com.intellij.openapi.ide.CopyPasteManager; //导入依赖的package包/类
public static void delete(@NotNull Editor editor, @NotNull Caret caret, int start, int end, boolean clearOnly) {
    CopyPasteManager.getInstance().stopKillRings();
    if (clearOnly) {
        editor.getDocument().replaceString(start, end, RepeatedCharSequence.of(" ", end - start));
    } else {
        LineSelectionManager manager = LineSelectionManager.getInstance(editor);
        manager.guard(() -> {
            EditorCaret editorCaret = manager.getEditorCaret(caret);
            if (editorCaret.isLine()) {
                EditorPositionFactory f = manager.getPositionFactory();
                EditorPosition pos = f.fromPosition(caret.getLogicalPosition());
                EditorPosition selStart = f.fromOffset(start);

                editor.getDocument().deleteString(start, end);

                // in case the caret was in the virtual space, we force it to go back to the real offset
                caret.moveToLogicalPosition(selStart.atColumn(pos.column));
            } else {
                editor.getDocument().deleteString(start, end);
                // in case the caret was in the virtual space, we force it to go back to the real offset
                caret.moveToOffset(start);
            }
            EditorModificationUtil.scrollToCaret(editor);
        });
    }
}
 
开发者ID:vsch,项目名称:MissingInActions,代码行数:27,代码来源:EditHelpers.java

示例7: executeWriteAction

import com.intellij.openapi.ide.CopyPasteManager; //导入依赖的package包/类
@Override
public void executeWriteAction(Editor editor, Caret caret, DataContext dataContext) {
  CommandProcessor.getInstance().setCurrentCommandGroupId(EditorActionUtil.DELETE_COMMAND_GROUP);
  CopyPasteManager.getInstance().stopKillRings();

  boolean camelMode = editor.getSettings().isCamelWords();
  if (myNegateCamelMode) {
    camelMode = !camelMode;
  }

  if (editor.getSelectionModel().hasSelection()) {
    EditorModificationUtil.deleteSelectedText(editor);
    return;
  }

  deleteToWordEnd(editor, camelMode);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:DeleteToWordEndAction.java

示例8: moveToLogicalPosition

import com.intellij.openapi.ide.CopyPasteManager; //导入依赖的package包/类
@Nullable
CaretEvent moveToLogicalPosition(@NotNull LogicalPosition pos,
                                         boolean locateBeforeSoftWrap,
                                         @Nullable StringBuilder debugBuffer,
                                         boolean fireListeners) {
  if (mySkipChangeRequests) {
    return null;
  }
  if (myReportCaretMoves) {
    LogMessageEx.error(LOG, "Unexpected caret move request");
  }
  if (!myEditor.isStickySelection() && !myEditor.getCaretModel().isDocumentChanged && !pos.equals(myLogicalCaret)) {
    CopyPasteManager.getInstance().stopKillRings();
  }

  myReportCaretMoves = true;
  try {
    return doMoveToLogicalPosition(pos, locateBeforeSoftWrap, debugBuffer, fireListeners);
  }
  finally {
    myReportCaretMoves = false;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:CaretImpl.java

示例9: doTest

import com.intellij.openapi.ide.CopyPasteManager; //导入依赖的package包/类
private void doTest(boolean columnMode) throws Exception {
  myFixture.configureByFile(getTestName(false) + ".java");
  if (columnMode) {
    myFixture.performEditorAction("EditorToggleColumnMode");
  }
  myFixture.performEditorAction("EditorCopy");
  Transferable contents = CopyPasteManager.getInstance().getContents();
  assertNotNull(contents);

  assertTrue(contents.isDataFlavorSupported(HtmlTransferableData.FLAVOR));
  String expectedHtml = getFileContents(getTestName(false) + ".html");
  String actualHtml = readFully((Reader)contents.getTransferData(HtmlTransferableData.FLAVOR));
  assertMatches("HTML contents differs", expectedHtml, actualHtml);

  assertTrue(contents.isDataFlavorSupported(RtfTransferableData.FLAVOR));
  String expectedRtf = getFileContents(getTestName(false) + ".rtf");
  String actualRtf = readFully((InputStream)contents.getTransferData(RtfTransferableData.FLAVOR));
  assertMatches("RTF contents differs", expectedRtf, actualRtf);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:RichCopyTest.java

示例10: handle

import com.intellij.openapi.ide.CopyPasteManager; //导入依赖的package包/类
@Override
protected void handle(final Project project, final String value, XDebuggerTree tree) {
  if (tree == null) return;
  List<? extends WatchNode> watchNodes = XWatchesTreeActionBase.getSelectedNodes(tree, WatchNode.class);
  if (watchNodes.isEmpty()) {
    CopyPasteManager.getInstance().setContents(new StringSelection(value));
  }
  else {
    CopyPasteManager.getInstance().setContents(
      new XWatchTransferable(value, ContainerUtil.map(watchNodes,
                                                      new Function<WatchNode, XExpression>() {
                                                        @Override
                                                        public XExpression fun(WatchNode node) {
                                                          return node.getExpression();
                                                        }
                                                      })));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:XCopyValueAction.java

示例11: performCopy

import com.intellij.openapi.ide.CopyPasteManager; //导入依赖的package包/类
public void performCopy(@NotNull DataContext dataContext) {
  List<TreePath> paths = ContainerUtil.sorted(Arrays.asList(ObjectUtils.assertNotNull(myTree.getSelectionPaths())),
                                              TreeUtil.getDisplayOrderComparator(myTree));
  CopyPasteManager.getInstance().setContents(new StringSelection(StringUtil.join(paths, new Function<TreePath, String>() {
    @Override
    public String fun(TreePath path) {
      Object node = path.getLastPathComponent();
      if (node instanceof ChangesBrowserNode) {
        return ((ChangesBrowserNode)node).getTextPresentation();
      }
      else {
        return node.toString();
      }
    }
  }, "\n")));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ChangesBrowserNodeCopyProvider.java

示例12: performCopy

import com.intellij.openapi.ide.CopyPasteManager; //导入依赖的package包/类
@Override
public void performCopy(@NotNull DataContext dataContext) {
  final Set<TemplateImpl> templates = myConfigurable.getSelectedTemplates().keySet();


  CopyPasteManager.getInstance().setContents(new StringSelection(StringUtil.join(templates, new Function<TemplateImpl, String>() {
    @Override
    public String fun(TemplateImpl template) {
      TemplateContext zeroContext = new TemplateContext();
      for (TemplateContextType type : TemplateContextType.EP_NAME.getExtensions()) {
        zeroContext.setEnabled(type, false);
      }
      return JDOMUtil.writeElement(TemplateSettings.serializeTemplate(template, zeroContext));
    }
  }, SystemProperties.getLineSeparator())));
  
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:LiveTemplateTree.java

示例13: createActions

import com.intellij.openapi.ide.CopyPasteManager; //导入依赖的package包/类
@NotNull
@Override
protected Action[] createActions() {
  AbstractAction copyPsi = new AbstractAction("Cop&y PSI") {
    @Override
    public void actionPerformed(@NotNull ActionEvent e) {
      PsiElement element = parseText(myEditor.getDocument().getText());
      List<PsiElement> allToParse = new ArrayList<PsiElement>();
      if (element instanceof PsiFile) {
        allToParse.addAll(((PsiFile)element).getViewProvider().getAllFiles());
      }
      else if (element != null) {
        allToParse.add(element);
      }
      String data = "";
      for (PsiElement psiElement : allToParse) {
        data += DebugUtil.psiToString(psiElement, !myShowWhiteSpacesBox.isSelected(), true);
      }
      CopyPasteManager.getInstance().setContents(new StringSelection(data));
    }
  };
  return ArrayUtil.mergeArrays(new Action[]{copyPsi}, super.createActions());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:PsiViewerDialog.java

示例14: ProjectListBuilder

import com.intellij.openapi.ide.CopyPasteManager; //导入依赖的package包/类
public ProjectListBuilder(final Project project,
                          final CommanderPanel panel,
                          final AbstractTreeStructure treeStructure,
                          final Comparator comparator,
                          final boolean showRoot) {
  super(project, panel.getList(), panel.getModel(), treeStructure, comparator, showRoot);

  myList.setCellRenderer(new ColoredCommanderRenderer(panel));
  myUpdateAlarm = new Alarm(Alarm.ThreadToUse.SWING_THREAD, myProject);

  myPsiTreeChangeListener = new MyPsiTreeChangeListener();
  PsiManager.getInstance(myProject).addPsiTreeChangeListener(myPsiTreeChangeListener);
  myFileStatusListener = new MyFileStatusListener();
  FileStatusManager.getInstance(myProject).addFileStatusListener(myFileStatusListener);
  myCopyPasteListener = new MyCopyPasteListener();
  CopyPasteManager.getInstance().addContentChangedListener(myCopyPasteListener);
  buildRoot();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:ProjectListBuilder.java

示例15: update

import com.intellij.openapi.ide.CopyPasteManager; //导入依赖的package包/类
@Override
public void update(PresentationData presentation) {
  String newName = getValue().getName();
  int nameEndOffset = newName.length();
  int todoItemCount = getTodoItemCount(getValue());
  int fileCount = getFileCount(getValue());
  newName = IdeBundle.message("node.todo.group", newName, todoItemCount, fileCount);
  myHighlightedRegions.clear();

  TextAttributes textAttributes = new TextAttributes();

  if (CopyPasteManager.getInstance().isCutElement(getValue())) {
    textAttributes.setForegroundColor(CopyPasteManager.CUT_COLOR);
  }
  myHighlightedRegions.add(new HighlightedRegion(0, nameEndOffset, textAttributes));

  EditorColorsScheme colorsScheme = UsageTreeColorsScheme.getInstance().getScheme();
  myHighlightedRegions.add(
    new HighlightedRegion(nameEndOffset, newName.length(), colorsScheme.getAttributes(UsageTreeColors.NUMBER_OF_USAGES)));
  presentation.setIcon(ModuleType.get(getValue()).getIcon());
  presentation.setPresentableText(newName);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:ModuleToDoNode.java


注:本文中的com.intellij.openapi.ide.CopyPasteManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。