diff options
author | Dani Megert | 2011-03-18 14:20:33 +0000 |
---|---|---|
committer | Dani Megert | 2011-03-18 14:20:33 +0000 |
commit | 7cf215ea8862f1564f1dbeae7dacbe04353eeac1 (patch) | |
tree | a01575e961df3b614e1885d6651a15468dc6d417 /org.eclipse.search | |
parent | 7b7a0fd50952579c83bb635723cc323847b3b8e4 (diff) | |
download | eclipse.platform.text-7cf215ea8862f1564f1dbeae7dacbe04353eeac1.tar.gz eclipse.platform.text-7cf215ea8862f1564f1dbeae7dacbe04353eeac1.tar.xz eclipse.platform.text-7cf215ea8862f1564f1dbeae7dacbe04353eeac1.zip |
Removed useless skipFiltered flag.
Diffstat (limited to 'org.eclipse.search')
4 files changed, 17 insertions, 26 deletions
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileSearchPage.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileSearchPage.java index 4a10d52c554..2e8c6606da0 100644 --- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileSearchPage.java +++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/FileSearchPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2010 IBM Corporation and others. + * Copyright (c) 2000, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -207,12 +207,12 @@ public class FileSearchPage extends AbstractTextSearchViewPage implements IAdapt if (query.getSearchString().length() > 0) { IStructuredSelection selection= (IStructuredSelection) getViewer().getSelection(); if (!selection.isEmpty()) { - ReplaceAction replaceSelection= new ReplaceAction(getSite().getShell(), (FileSearchResult) getInput(), selection.toArray(), true); + ReplaceAction replaceSelection= new ReplaceAction(getSite().getShell(), (FileSearchResult)getInput(), selection.toArray()); replaceSelection.setText(SearchMessages.ReplaceAction_label_selected); mgr.appendToGroup(IContextMenuConstants.GROUP_REORGANIZE, replaceSelection); } - ReplaceAction replaceAll= new ReplaceAction(getSite().getShell(), (FileSearchResult) getInput(), null, true); + ReplaceAction replaceAll= new ReplaceAction(getSite().getShell(), (FileSearchResult)getInput(), null); replaceAll.setText(SearchMessages.ReplaceAction_label_all); mgr.appendToGroup(IContextMenuConstants.GROUP_REORGANIZE, replaceAll); } diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/ReplaceAction.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/ReplaceAction.java index 69d885c7939..62c474184c6 100644 --- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/ReplaceAction.java +++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/ReplaceAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2008 IBM Corporation and others. + * Copyright (c) 2007, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -36,7 +36,6 @@ public class ReplaceAction extends Action { private final FileSearchResult fResult; private final Object[] fSelection; - private final boolean fSkipFiltered; private final Shell fShell; /** @@ -44,13 +43,11 @@ public class ReplaceAction extends Action { * @param shell the parent shell * @param result the file search page to * @param selection the selected entries or <code>null</code> to replace all - * @param skipFiltered if set to <code>true</code>, filtered matches will not be replaced */ - public ReplaceAction(Shell shell, FileSearchResult result, Object[] selection, boolean skipFiltered) { + public ReplaceAction(Shell shell, FileSearchResult result, Object[] selection) { fShell= shell; fResult= result; fSelection= selection; - fSkipFiltered= skipFiltered; } /* (non-Javadoc) @@ -58,7 +55,7 @@ public class ReplaceAction extends Action { */ public void run() { try { - ReplaceRefactoring refactoring= new ReplaceRefactoring(fResult, fSelection, fSkipFiltered); + ReplaceRefactoring refactoring= new ReplaceRefactoring(fResult, fSelection); ReplaceWizard refactoringWizard= new ReplaceWizard(refactoring); if (fSelection == null) { refactoringWizard.setDefaultPageTitle(SearchMessages.ReplaceAction_title_all); diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/ReplaceRefactoring.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/ReplaceRefactoring.java index 00d27e92ce8..e6598b153d4 100644 --- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/ReplaceRefactoring.java +++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/ReplaceRefactoring.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 IBM Corporation and others. + * Copyright (c) 2007, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -65,6 +65,7 @@ import org.eclipse.ltk.core.refactoring.TextEditChangeGroup; import org.eclipse.ltk.core.refactoring.TextFileChange; import org.eclipse.ltk.core.refactoring.participants.ResourceChangeChecker; + public class ReplaceRefactoring extends Refactoring { private static class MatchGroup { @@ -144,22 +145,23 @@ public class ReplaceRefactoring extends Refactoring { private final FileSearchResult fResult; private final Object[] fSelection; - private final boolean fSkipFiltered; private HashMap/*<IFile,Set<Match>*/ fMatches; + private ArrayList fAffectedLocations; + private String fReplaceString; private Change fChange; - public ReplaceRefactoring(FileSearchResult result, Object[] selection, boolean skipFiltered) { + public ReplaceRefactoring(FileSearchResult result, Object[] selection) { Assert.isNotNull(result); fResult= result; fSelection= selection; - fSkipFiltered= skipFiltered; fMatches= new HashMap(); + fAffectedLocations= new ArrayList(selection != null ? selection.length : result.getElements().length); fReplaceString= null; } @@ -207,9 +209,7 @@ public class ReplaceRefactoring extends Refactoring { FileMatch[] matches= lineElement.getMatches(fResult); for (int i= 0; i < matches.length; i++) { FileMatch fileMatch= matches[i]; - if (!isSkipped(fileMatch)) { - getBucket(fileMatch.getFile()).add(fileMatch); - } + getBucket(fileMatch.getFile()).add(fileMatch); } } else if (object instanceof IContainer) { IContainer container= (IContainer) object; @@ -223,12 +223,10 @@ public class ReplaceRefactoring extends Refactoring { Collection bucket= null; for (int i= 0; i < matches.length; i++) { FileMatch fileMatch= (FileMatch) matches[i]; - if (!isSkipped(fileMatch)) { - if (bucket == null) { - bucket= getBucket((IFile) object); - } - bucket.add(fileMatch); + if (bucket == null) { + bucket= getBucket((IFile)object); } + bucket.add(fileMatch); } } } @@ -251,10 +249,6 @@ public class ReplaceRefactoring extends Refactoring { return !fMatches.isEmpty(); } - private boolean isSkipped(FileMatch match) { - return !fSkipFiltered && match.isFiltered(); - } - private Collection getBucket(IFile file) { Collection col= (Collection) fMatches.get(file); if (col == null) { diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchPage.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchPage.java index 1438613dd7f..de128faab92 100644 --- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchPage.java +++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchPage.java @@ -270,7 +270,7 @@ public class TextSearchPage extends DialogPage implements ISearchPage, IReplaceP ISearchResultPage page= view.getActivePage(); if (page instanceof FileSearchPage) { FileSearchPage filePage= (FileSearchPage) page; - new ReplaceAction(filePage.getSite().getShell(), (FileSearchResult) filePage.getInput(), null, true).run(); + new ReplaceAction(filePage.getSite().getShell(), (FileSearchResult)filePage.getInput(), null).run(); } } } |