Ejemplo n.º 1
0
 public SearchResults getAffectedNodes(final RefactoringContext refactoringContext) {
   SearchResults searchResults = new SearchResults();
   for (SNode selNode : ListSequence.fromList(refactoringContext.getSelectedNodes())) {
     searchResults.addAll(
         FindUtils.getSearchResults(
             new EmptyProgressMonitor(),
             selNode,
             GlobalScope.getInstance(),
             "jetbrains.mps.lang.structure.findUsages.NodeAndDescendantsUsages_Finder"));
   }
   return searchResults;
 }
Ejemplo n.º 2
0
 public void refactor(final RefactoringContext refactoringContext) {
   List<SNode> nodes = refactoringContext.getSelectedNodes();
   SModel targetModel = null;
   List<SNode> movedNodes = null;
   if (((Object) refactoringContext.getParameter("target")) instanceof SModel) {
     targetModel = ((SModel) ((Object) refactoringContext.getParameter("target")));
     movedNodes = refactoringContext.moveNodesToModel(nodes, targetModel);
   }
   if (((Object) refactoringContext.getParameter("target")) instanceof SNode) {
     SNode targetNode = (SNode) ((Object) refactoringContext.getParameter("target"));
     movedNodes =
         refactoringContext.moveNodesToNode(
             nodes, ListSequence.fromList(nodes).first().getRoleInParent(), targetNode);
     targetModel = SNodeOperations.getModel(targetNode);
   }
   if (targetModel != null) {
     refactoringContext.setParameter("nodeToOpen", ListSequence.fromList(movedNodes).first());
   }
 }