org.eclipse.ltk.core.refactoring.participants.ValidateEditChecker Java Examples
The following examples show how to use
org.eclipse.ltk.core.refactoring.participants.ValidateEditChecker.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JavaRenameProcessor.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 6 votes |
@Override public final RefactoringStatus checkFinalConditions(IProgressMonitor pm, CheckConditionsContext context) throws CoreException, OperationCanceledException { ResourceChangeChecker checker= context.getChecker(ResourceChangeChecker.class); IResourceChangeDescriptionFactory deltaFactory= checker.getDeltaFactory(); RefactoringStatus result= doCheckFinalConditions(pm, context); if (result.hasFatalError()) { return result; } IFile[] changed= getChangedFiles(); for (int i= 0; i < changed.length; i++) { deltaFactory.change(changed[i]); } fRenameModifications= computeRenameModifications(); fRenameModifications.buildDelta(deltaFactory); fRenameModifications.buildValidateEdits(context.getChecker(ValidateEditChecker.class)); return result; }
Example #2
Source File: ReorgPolicyFactory.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 6 votes |
@Override public RefactoringStatus checkFinalConditions(IProgressMonitor pm, CheckConditionsContext context, IReorgQueries reorgQueries) throws CoreException { Assert.isNotNull(reorgQueries); ResourceChangeChecker checker= context.getChecker(ResourceChangeChecker.class); IFile[] allModifiedFiles= getAllModifiedFiles(); RefactoringModifications modifications= getModifications(); IResourceChangeDescriptionFactory deltaFactory= checker.getDeltaFactory(); for (int i= 0; i < allModifiedFiles.length; i++) { deltaFactory.change(allModifiedFiles[i]); } if (modifications != null) { modifications.buildDelta(deltaFactory); modifications.buildValidateEdits(context.getChecker(ValidateEditChecker.class)); } return new RefactoringStatus(); }
Example #3
Source File: JavaRenameProcessor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@Override public final RefactoringStatus checkFinalConditions(IProgressMonitor pm, CheckConditionsContext context) throws CoreException, OperationCanceledException { ResourceChangeChecker checker= (ResourceChangeChecker) context.getChecker(ResourceChangeChecker.class); IResourceChangeDescriptionFactory deltaFactory= checker.getDeltaFactory(); RefactoringStatus result= doCheckFinalConditions(pm, context); if (result.hasFatalError()) return result; IFile[] changed= getChangedFiles(); for (int i= 0; i < changed.length; i++) { deltaFactory.change(changed[i]); } fRenameModifications= computeRenameModifications(); fRenameModifications.buildDelta(deltaFactory); fRenameModifications.buildValidateEdits((ValidateEditChecker)context.getChecker(ValidateEditChecker.class)); return result; }
Example #4
Source File: RenameModifications.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
@Override public void buildValidateEdits(ValidateEditChecker checker) { for (Iterator<Object> iter= fRename.iterator(); iter.hasNext();) { Object element= iter.next(); if (element instanceof ICompilationUnit) { ICompilationUnit unit= (ICompilationUnit)element; IResource resource= unit.getResource(); if (resource != null && resource.getType() == IResource.FILE) { checker.addFile((IFile)resource); } } } }
Example #5
Source File: MoveModifications.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
@Override public void buildValidateEdits(ValidateEditChecker checker) { for (Iterator<Object> iter= fMoves.iterator(); iter.hasNext();) { Object element= iter.next(); if (element instanceof ICompilationUnit) { ICompilationUnit unit= (ICompilationUnit)element; IResource resource= unit.getResource(); if (resource != null && resource.getType() == IResource.FILE) { checker.addFile((IFile)resource); } } } }
Example #6
Source File: RenameModifications.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override public void buildValidateEdits(ValidateEditChecker checker) { for (Iterator<Object> iter= fRename.iterator(); iter.hasNext();) { Object element= iter.next(); if (element instanceof ICompilationUnit) { ICompilationUnit unit= (ICompilationUnit)element; IResource resource= unit.getResource(); if (resource != null && resource.getType() == IResource.FILE) { checker.addFile((IFile)resource); } } } }
Example #7
Source File: MoveModifications.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override public void buildValidateEdits(ValidateEditChecker checker) { for (Iterator<Object> iter= fMoves.iterator(); iter.hasNext();) { Object element= iter.next(); if (element instanceof ICompilationUnit) { ICompilationUnit unit= (ICompilationUnit)element; IResource resource= unit.getResource(); if (resource != null && resource.getType() == IResource.FILE) { checker.addFile((IFile)resource); } } } }
Example #8
Source File: ReorgPolicyFactory.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public RefactoringStatus checkFinalConditions(IProgressMonitor pm, CheckConditionsContext context, IReorgQueries reorgQueries) throws CoreException { Assert.isNotNull(reorgQueries); ResourceChangeChecker checker= (ResourceChangeChecker) context.getChecker(ResourceChangeChecker.class); IFile[] allModifiedFiles= getAllModifiedFiles(); RefactoringModifications modifications= getModifications(); IResourceChangeDescriptionFactory deltaFactory= checker.getDeltaFactory(); for (int i= 0; i < allModifiedFiles.length; i++) { deltaFactory.change(allModifiedFiles[i]); } if (modifications != null) { modifications.buildDelta(deltaFactory); modifications.buildValidateEdits((ValidateEditChecker) context.getChecker(ValidateEditChecker.class)); } return new RefactoringStatus(); }
Example #9
Source File: RenameRefactoringProcessor.java From xds-ide with Eclipse Public License 1.0 | 4 votes |
protected RefactoringStatus findMatches(IProgressMonitor monitor, CheckConditionsContext context) { ifile2SymbolMatches.clear(); IModulaSymbol symbol = renameRefactoringInfo.getSymbolFromSelection(); IFile activeIFile = renameRefactoringInfo.getActiveIFile(); if (symbol.isAttributeSet(SymbolAttribute.ALREADY_DEFINED)) { if (symbol instanceof IBlockSymbolTextBinding) { IBlockSymbolTextBinding binding = (IBlockSymbolTextBinding) symbol; Collection<ITextRegion> nameTextRegions = binding.getNameTextRegions(); for (ITextRegion textRegion : nameTextRegions) { putMatchIfAbsent(new ModulaSymbolMatch(activeIFile, symbol, new TextPosition(-1, -1, textRegion.getOffset()))); } } else { putMatchIfAbsent(new ModulaSymbolMatch(activeIFile, symbol, symbol.getPosition())); } } else { SymbolModelManager.instance().waitUntilModelIsUpToDate(); ModulaSearchInput m2SearchInput = new ModulaSearchInput(ResourceUtils.getProject(activeIFile)); m2SearchInput.setLimitTo(ModulaSearchInput.LIMIT_TO_USAGES | ModulaSearchInput.LIMIT_TO_DECLARATIONS); m2SearchInput.setSearchFor(ModulaSearchInput.SEARCH_FOR_ANY_ELEMENT); m2SearchInput.setSearchInFlags(ModulaSearchInput.SEARCH_IN_ALL_SOURCES); m2SearchInput.setSearchModifiers(ModulaSearchInput.MODIFIER_ALL_NAME_OCCURENCES); IProject project = renameRefactoringInfo.getProject(); m2SearchInput.setSearchScope(FileTextSearchScope.newSearchScope(new IResource[]{project}, new String[]{"*"}, false)); //$NON-NLS-1$ m2SearchInput.setSearchFor(ModulaSearchUtils.getSearchForConstant(symbol)); Set<String> symbolQualifiedNames = ModulaSearchUtils.getSymbolQualifiedNames(symbol); m2SearchInput.setSymbolQualifiedNames(symbolQualifiedNames); ISearchResultCollector searchResultCollector = new ISearchResultCollector() { @Override public void accept(Object objMatch) { if (objMatch instanceof ModulaSymbolMatch) { ModulaSymbolMatch match = (ModulaSymbolMatch)objMatch; putMatchIfAbsent(match); } } }; ModulaSearchOperation op = new ModulaSearchOperation(m2SearchInput, searchResultCollector); MultiStatus status = new MultiStatus(CoreRefactoringPlugin.PLUGIN_ID, IStatus.OK, Messages.RenameRefactoringProcessor_ErrorWhileComputingLocationsToRename, null); op.execute(monitor, status); SymbolModelManager.instance().waitUntilModelIsUpToDate(); if (ifile2SymbolMatches.keySet().size() > 0) { IConditionChecker checker = context.getChecker( ValidateEditChecker.class ); ValidateEditChecker editChecker = ( ValidateEditChecker )checker; editChecker.addFiles( ifile2SymbolMatches.keySet().toArray(new IFile[0]) ); } monitor.done(); } return new RefactoringStatus(); }
Example #10
Source File: RefactoringModifications.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 2 votes |
/** * Implementors add all resources that need a validate edit * @param checker the validate edit checker */ public void buildValidateEdits(ValidateEditChecker checker) { // Default implementation does nothing. }
Example #11
Source File: RefactoringModifications.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 2 votes |
/** * Implementors add all resources that need a validate edit * @param checker the validate edit checker */ public void buildValidateEdits(ValidateEditChecker checker) { // Default implementation does nothing. }