1 19 20 package org.netbeans.modules.refactoring.api.impl; 21 22 import org.netbeans.modules.refactoring.spi.ui.ActionsImplementationProvider; 23 import org.openide.util.Lookup; 24 25 28 public final class ActionsImplementationFactory { 29 30 private ActionsImplementationFactory(){} 31 32 private static final Lookup.Result<ActionsImplementationProvider> implementations = 33 Lookup.getDefault().lookup(new Lookup.Template(ActionsImplementationProvider.class)); 34 35 public static boolean canRename(Lookup lookup) { 36 for (ActionsImplementationProvider rafi: implementations.allInstances()) { 37 if (rafi.canRename(lookup)) { 38 return true; 39 } 40 } 41 return false; 42 } 43 44 public static void doRename(Lookup lookup) { 45 for (ActionsImplementationProvider rafi: implementations.allInstances()) { 46 if (rafi.canRename(lookup)) { 47 rafi.doRename(lookup); 48 } 49 } 50 } 51 52 public static boolean canFindUsages(Lookup lookup) { 53 for (ActionsImplementationProvider rafi: implementations.allInstances()) { 54 if (rafi.canFindUsages(lookup)) { 55 return true; 56 } 57 } 58 return false; 59 } 60 61 public static void doFindUsages(Lookup lookup) { 62 for (ActionsImplementationProvider rafi: implementations.allInstances()) { 63 if (rafi.canFindUsages(lookup)) { 64 rafi.doFindUsages(lookup); 65 } 66 } 67 } 68 public static boolean canDelete(Lookup lookup) { 69 for (ActionsImplementationProvider rafi: implementations.allInstances()) { 70 if (rafi.canDelete(lookup)) { 71 return true; 72 } 73 } 74 return false; 75 } 76 77 public static void doDelete(Lookup lookup) { 78 for (ActionsImplementationProvider rafi: implementations.allInstances()) { 79 if (rafi.canDelete(lookup)) { 80 rafi.doDelete(lookup); 81 } 82 } 83 } 84 85 public static void doMove(Lookup lookup) { 86 for (ActionsImplementationProvider rafi: implementations.allInstances()) { 87 if (rafi.canMove(lookup)) { 88 rafi.doMove(lookup); 89 } 90 } 91 } 92 93 public static boolean canMove(Lookup lookup) { 94 for (ActionsImplementationProvider rafi: implementations.allInstances()) { 95 if (rafi.canMove(lookup)) { 96 return true; 97 } 98 } 99 return false; 100 } 101 102 public static void doCopy(Lookup lookup) { 103 for (ActionsImplementationProvider rafi: implementations.allInstances()) { 104 if (rafi.canCopy(lookup)) { 105 rafi.doCopy(lookup); 106 } 107 } 108 } 109 110 public static boolean canCopy(Lookup lookup) { 111 for (ActionsImplementationProvider rafi: implementations.allInstances()) { 112 if (rafi.canCopy(lookup)) { 113 return true; 114 } 115 } 116 return false; 117 } 118 119 } 120 | Popular Tags |