private FileObject getRefactoringSource(AbstractRefactoring refactoring) { FileObject source = refactoring.getRefactoringSource().lookup(FileObject.class); if (source != null) { return source; } TreePathHandle tph = refactoring.getRefactoringSource().lookup(TreePathHandle.class); if (tph != null) { return tph.getFileObject(); } NonRecursiveFolder folder = refactoring.getRefactoringSource().lookup(NonRecursiveFolder.class); if (folder != null) { return folder.getFolder(); } return null; }
protected CsmModificationRefactoringPlugin(AbstractRefactoring refactoring) { this.refactoring = refactoring; this.startReferenceObject = refactoring.getRefactoringSource().lookup(CsmObject.class); this.editorContext = refactoring.getRefactoringSource().lookup(CsmContext.class); assert startReferenceObject != null || editorContext != null: "no start reference or editor context"; modificationHooks = new ArrayList<CheckModificationHook>(refactoring.getContext().lookupAll(CheckModificationHook.class)); if (modificationHooks.isEmpty()) { modificationHooks.add(new DefaultHookImpl()); } }
@Override public RefactoringPlugin createInstance(AbstractRefactoring refactoring) { if (refactoring instanceof RenameRefactoring) { if (null != refactoring.getRefactoringSource().lookup(RefactoringElementContext.class)) { return new CPRenameRefactoringPlugin((RenameRefactoring)refactoring); } else { //folder refactoring - not yet supported // FileObject file = refactoring.getRefactoringSource().lookup(FileObject.class); // if(file != null && file.isFolder()) { // return new CPRenameRefactoringPlugin((RenameRefactoring)refactoring); // } } } else if(refactoring instanceof WhereUsedQuery) { if (null != refactoring.getRefactoringSource().lookup(RefactoringElementContext.class)) { return new CPWhereUsedQueryPlugin((WhereUsedQuery)refactoring); } } return null; } }
@Override public RefactoringPlugin createInstance(AbstractRefactoring refactoring) { if (refactoring instanceof RenameRefactoring || refactoring instanceof MoveRefactoring || refactoring instanceof SingleCopyRefactoring) { Lookup sourceLookup = refactoring.getRefactoringSource(); FileObject srcFile = sourceLookup.lookup(FileObject.class); NonRecursiveFolder pkg = sourceLookup.lookup(NonRecursiveFolder.class); if ((srcFile != null && isJavaFile(srcFile)) || pkg != null) { return new RefactoringPluginImpl(refactoring); } } return null; }
private TreePathHandle resolveTreePathHandle(final AbstractRefactoring refactoring){ TreePathHandle tph = refactoring.getRefactoringSource().lookup(TreePathHandle.class); if (tph != null) { return tph; FileObject sourceFO = refactoring.getRefactoringSource().lookup(FileObject.class); if (sourceFO == null || !RefactoringUtil.isJavaFile(sourceFO)){ return null;
public RefactoringPlugin createInstance(AbstractRefactoring refactoring) { Lookup look = refactoring.getRefactoringSource(); FileObject file = look.lookup(FileObject.class); JsElementCtx handle = look.lookup(JsElementCtx.class); if (refactoring instanceof WhereUsedQuery) { if (handle!=null) { return new JsWhereUsedQueryPlugin((WhereUsedQuery) refactoring); } } else if (refactoring instanceof RenameRefactoring) { if (handle!=null || ((file!=null) && RetoucheUtils.isJsFile(file))) { //rename java file, class, method etc.. return new RenameRefactoringPlugin((RenameRefactoring)refactoring); } } return null; } }
tphs.addAll(refactoring.getRefactoringSource().lookupAll(TreePathHandle.class)); if (tphs.isEmpty()) { Collection<? extends FileObject> fos = refactoring.getRefactoringSource().lookupAll(FileObject.class); for (FileObject each : fos){ TreePathHandle handle = resolveHandle(each);
@Override public void doRefactoringBypass() throws IOException { DataObject dob = null; if (byPassFolder != null) { dob = DataFolder.findFolder(byPassFolder); } else { dob = DataObject.find(refactoring.getRefactoringSource().lookup(FileObject.class)); } dob.rename(panel.getNameValue()); } }
public void doRefactoringBypass() throws IOException { DataObject dob = null; if (byPassFolder != null) { dob = DataFolder.findFolder(byPassFolder); } else { dob = DataObject.find(refactoring.getRefactoringSource().lookup(FileObject.class)); } dob.rename(getPanelName()); } }
public Problem handleChange(RefactoringElementImplementation proposedChange, Collection<RefactoringElementImplementation> replacements, Collection<Transaction> transaction) { FileObject changedFileObject = proposedChange.getParentFile(); TreePathHandle handle = myRefactoring.getRefactoringSource().lookup( TreePathHandle.class ); boolean flag = ( handle!= null ) && handle.getFileObject()!=null && handle.getFileObject().equals( changedFileObject ); if ( flag ) { //proposedChange.setStatus(RefactoringElementImplementation.NORMAL); //proposedChange.setEnabled( false ); proposedChange = new GuardedElementImplementation(proposedChange); } replacements.add(proposedChange); return null; }
@Override public RefactoringPlugin createInstance(AbstractRefactoring refactoring) { CsmContext editorContext = refactoring.getRefactoringSource().lookup(CsmContext.class); CsmObject ref = CsmRefactoringUtils.findContextObject(refactoring.getRefactoringSource()); if (ref != null || editorContext != null) { if (refactoring instanceof WhereUsedQuery) { return new CsmWhereUsedQueryPlugin((WhereUsedQuery) refactoring); } else if (refactoring instanceof RenameRefactoring) { return new CsmRenameRefactoringPlugin((RenameRefactoring)refactoring); } else if (refactoring instanceof ChangeParametersRefactoring) { return new ChangeParametersPlugin((ChangeParametersRefactoring) refactoring); } else if (refactoring instanceof EncapsulateFieldRefactoring) { return new EncapsulateFieldRefactoringPlugin((EncapsulateFieldRefactoring) refactoring); } else if (refactoring instanceof EncapsulateFieldsRefactoring) { return new EncapsulateFieldsPlugin((EncapsulateFieldsRefactoring) refactoring); } } return null; } }
@Override public Problem checkParameters() { final Problem[] result = new Problem[1]; final TreePathHandle tph = refactoring.getRefactoringSource().lookup(TreePathHandle.class); if (tph != null) { FileObject fo = tph.getFileObject();
public RefactoringPlugin createInstance(AbstractRefactoring refactoring) { NonRecursiveFolder pkg = refactoring.getRefactoringSource().lookup(NonRecursiveFolder.class); FileObject sourceFO = refactoring.getRefactoringSource().lookup(FileObject.class); TreePathHandle handle = resolveTreePathHandle(refactoring);
FileObject fileObject = getRefactoring().getRefactoringSource().lookup(FileObject.class); if (fileObject != null) { if (FacesRefactoringUtils.isJavaFileObjectOfInterest(fileObject)) {
FileObject primaryFile = null; String oldName = null; Lookup sourceLookup = refactoring.getRefactoringSource(); FileObject file = sourceLookup.lookup(FileObject.class); NonRecursiveFolder pkgFolder = sourceLookup.lookup(NonRecursiveFolder.class); Collection<? extends FileObject> files = refactoring.getRefactoringSource().lookupAll(FileObject.class); for (FileObject file : files) { if (RefactoringInfo.isJavaFile(file) && isOnSourceClasspath(file)) { Collection<? extends FileObject> files = refactoring.getRefactoringSource().lookupAll(FileObject.class); for (FileObject file : files) { if (RefactoringInfo.isJavaFileOfForm(file) && isOnSourceClasspath(file)) { Collection<? extends FileObject> files = refactoring.getRefactoringSource().lookupAll(FileObject.class); for (FileObject file : files) { if (file != null && RefactoringInfo.isJavaFileOfForm(file) && isOnSourceClasspath(file)) {
@Override public Problem prepare(RefactoringElementsBag refactoringElements) { Lookup sourceLookup = refactoring.getRefactoringSource(); NonRecursiveFolder pkg = sourceLookup.lookup(NonRecursiveFolder.class); if (pkg == null) {
FileObject fileObject = getRefactoring().getRefactoringSource().lookup(FileObject.class); if (fileObject != null) { if (FacesRefactoringUtils.isFolderPageBeanRoot(fileObject)) { NonRecursiveFolder nonRecursiveFolder = getRefactoring().getRefactoringSource().lookup(NonRecursiveFolder.class); if (nonRecursiveFolder != null) { fileObject = nonRecursiveFolder.getFolder();
FileObject fileObject = getRefactoring().getRefactoringSource().lookup(FileObject.class); String newName = getRenameRefactoring().getNewName(); if (fileObject != null) {
Lookup refactoringSource = refactoring.getRefactoringSource();
@Override public Problem prepare(RefactoringElementsBag refactoringElements){ FileObject refactoringSourcefileObject = getRefactoring().getRefactoringSource().lookup(FileObject.class); if (refactoringSourcefileObject != null) { Project project = FileOwnerQuery.getOwner(refactoringSourcefileObject);