Lines 15-29
Link Here
|
15 |
import java.util.ArrayList; |
15 |
import java.util.ArrayList; |
16 |
import java.util.Collection; |
16 |
import java.util.Collection; |
17 |
import java.util.Iterator; |
17 |
import java.util.Iterator; |
|
|
18 |
import java.util.List; |
18 |
import org.netbeans.modules.javacore.api.JavaModel; |
19 |
import org.netbeans.modules.javacore.api.JavaModel; |
19 |
import org.netbeans.modules.javacore.JMManager; |
20 |
import org.netbeans.modules.javacore.JMManager; |
20 |
import org.netbeans.modules.refactoring.APIAccessor; |
21 |
import org.netbeans.modules.refactoring.APIAccessor; |
21 |
import org.netbeans.modules.refactoring.ProgressSupport; |
22 |
import org.netbeans.modules.refactoring.ProgressSupport; |
|
|
23 |
import org.netbeans.modules.refactoring.SPIAccessor; |
22 |
import org.netbeans.modules.refactoring.spi.GuardedBlockHandler; |
24 |
import org.netbeans.modules.refactoring.spi.GuardedBlockHandler; |
23 |
import org.netbeans.modules.refactoring.spi.GuardedBlockHandlerFactory; |
25 |
import org.netbeans.modules.refactoring.spi.GuardedBlockHandlerFactory; |
24 |
import org.netbeans.modules.refactoring.spi.ProgressProvider; |
26 |
import org.netbeans.modules.refactoring.spi.ProgressProvider; |
|
|
27 |
import org.netbeans.modules.refactoring.spi.ReadOnlyFilesHandler; |
25 |
import org.netbeans.modules.refactoring.spi.RefactoringPlugin; |
28 |
import org.netbeans.modules.refactoring.spi.RefactoringPlugin; |
26 |
import org.netbeans.modules.refactoring.spi.RefactoringPluginFactory; |
29 |
import org.netbeans.modules.refactoring.spi.RefactoringPluginFactory; |
|
|
30 |
import org.openide.ErrorManager; |
27 |
import org.openide.util.Lookup; |
31 |
import org.openide.util.Lookup; |
28 |
import org.netbeans.modules.refactoring.spi.RefactoringElementsBag; |
32 |
import org.netbeans.modules.refactoring.spi.RefactoringElementsBag; |
29 |
|
33 |
|
Lines 271-277
Link Here
|
271 |
if (problem!=null && problem.isFatal()) |
275 |
if (problem!=null && problem.isFatal()) |
272 |
return problem; |
276 |
return problem; |
273 |
} |
277 |
} |
|
|
278 |
ReadOnlyFilesHandler handler = getROHandler(); |
279 |
if (handler!=null) { |
280 |
Collection files = SPIAccessor.DEFAULT.getReadOnlyFiles(elements); |
281 |
problem = chainProblems(handler.createProblem(files), problem); |
282 |
} |
283 |
|
274 |
return problem; |
284 |
return problem; |
|
|
285 |
} |
286 |
|
287 |
private ReadOnlyFilesHandler getROHandler() { |
288 |
Lookup.Result result = Lookup.getDefault().lookup(new Lookup.Template(ReadOnlyFilesHandler.class)); |
289 |
List handlers = (List) result.allInstances(); |
290 |
if (handlers.size() == 0) { |
291 |
return null; |
292 |
} |
293 |
if (handlers.size() > 1) { |
294 |
ErrorManager.getDefault().log(ErrorManager.WARNING, "Multiple instances of ReadOnlyFilesHandler found in Lookup; only using first one: " + handlers); //NOI18N |
295 |
} |
296 |
return (ReadOnlyFilesHandler) handlers.get(0); |
275 |
} |
297 |
} |
276 |
|
298 |
|
277 |
private Problem pluginsCheckParams(Problem problem) { |
299 |
private Problem pluginsCheckParams(Problem problem) { |