diff options
author | cvs2svn | 2003-05-07 14:14:13 +0000 |
---|---|---|
committer | cvs2svn | 2003-05-07 14:14:13 +0000 |
commit | cdf85364c749bd90b4b42169071238c52f094cbc (patch) | |
tree | 85bb4b17138e55f53e758befed2b3c56dcf2741d | |
parent | a0bf45fbe133bd18e05c5906c1b590fa3dfd1350 (diff) | |
download | eclipse.platform.text-cdf85364c749bd90b4b42169071238c52f094cbc.tar.gz eclipse.platform.text-cdf85364c749bd90b4b42169071238c52f094cbc.tar.xz eclipse.platform.text-cdf85364c749bd90b4b42169071238c52f094cbc.zip |
This commit was manufactured by cvs2svn to create tag 'R2_1_1'.v20030528_R2_1_mv20030521_R2_1_mv20030514_R2_1_mR2_1_2R2_1_1
Sprout from master 2003-03-27 17:56:39 UTC Dani Megert <dmegert> 'Updated copyright to 2003'
Cherrypick from master 2003-04-23 13:33:50 UTC Kai Maetzel <kmaetzel> '*** empty log message ***':
org.eclipse.text/src/org/eclipse/jface/text/IDocument.java
Cherrypick from R2_1_maintenance 2003-05-07 14:14:12 UTC Dani Megert <dmegert> 'Fixed bug 37224':
org.eclipse.search/plugin.xml
org.eclipse.search/scripts/exportplugin.xml
org.eclipse.search/search/org/eclipse/search/internal/core/text/TextSearchVisitor.java
org.eclipse.search/search/org/eclipse/search/internal/ui/ShowSearchesAction.java
5 files changed, 48 insertions, 30 deletions
diff --git a/org.eclipse.search/plugin.xml b/org.eclipse.search/plugin.xml index e7a58b3d94c..432bbc7d727 100644 --- a/org.eclipse.search/plugin.xml +++ b/org.eclipse.search/plugin.xml @@ -7,7 +7,7 @@ name="%pluginName" id="org.eclipse.search" - version="2.1.0" + version="2.1.1" provider-name="%providerName" class="org.eclipse.search.internal.ui.SearchPlugin"> diff --git a/org.eclipse.search/scripts/exportplugin.xml b/org.eclipse.search/scripts/exportplugin.xml index fafcb59d014..c98cd1bb81f 100644 --- a/org.eclipse.search/scripts/exportplugin.xml +++ b/org.eclipse.search/scripts/exportplugin.xml @@ -3,7 +3,7 @@ <tstamp/> <property name="destdir" value="../../plugin-export" /> <property name="plugin" value="org.eclipse.search" /> - <property name="version" value="_2.1.0" /> + <property name="version" value="_2.1.1" /> <property name="dest" value="${destdir}/${plugin}${version}" /> </target> diff --git a/org.eclipse.search/search/org/eclipse/search/internal/core/text/TextSearchVisitor.java b/org.eclipse.search/search/org/eclipse/search/internal/core/text/TextSearchVisitor.java index 38805f40ecf..521b7a11790 100644 --- a/org.eclipse.search/search/org/eclipse/search/internal/core/text/TextSearchVisitor.java +++ b/org.eclipse.search/search/org/eclipse/search/internal/core/text/TextSearchVisitor.java @@ -37,6 +37,7 @@ import org.eclipse.core.runtime.Status; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IEditorReference; import org.eclipse.ui.IFileEditorInput; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPage; @@ -60,8 +61,7 @@ public class TextSearchVisitor extends TypedResourceVisitor { private String fPattern; private ISearchScope fScope; private ITextSearchResultCollector fCollector; - private String fOptions; - private IEditorPart[] fDirtyEditors; + private IEditorPart[] fEditors; private IProgressMonitor fProgressMonitor; private StringMatcher fMatcher; @@ -81,11 +81,6 @@ public class TextSearchVisitor extends TypedResourceVisitor { fScope= scope; fCollector= collector; fPushback= false; - if (options != null) - fOptions= options; - else - fOptions= ""; //$NON-NLS-1$ - fProgressMonitor= collector.getProgressMonitor(); fMatcher= new StringMatcher(pattern, options.indexOf('i') != -1, false); fNumberOfScannedFiles= 0; @@ -109,9 +104,9 @@ public class TextSearchVisitor extends TypedResourceVisitor { * Returns an array of all editors that have an unsaved content. If the identical content is * presented in more than one editor, only one of those editor parts is part of the result. * - * @return an array of all dirty editor parts. + * @return an array of all editor parts. */ - public static IEditorPart[] getDirtyEditors() { + public static IEditorPart[] getEditors() { Set inputs= new HashSet(); List result= new ArrayList(0); IWorkbench workbench= SearchPlugin.getDefault().getWorkbench(); @@ -119,13 +114,16 @@ public class TextSearchVisitor extends TypedResourceVisitor { for (int i= 0; i < windows.length; i++) { IWorkbenchPage[] pages= windows[i].getPages(); for (int x= 0; x < pages.length; x++) { - IEditorPart[] editors= pages[x].getDirtyEditors(); - for (int z= 0; z < editors.length; z++) { - IEditorPart ep= editors[z]; - IEditorInput input= ep.getEditorInput(); - if (!inputs.contains(input)) { - inputs.add(input); - result.add(ep); + // see bug 37224 + IEditorReference[] editorRefs= pages[x].getEditorReferences(); + for (int z= 0; z < editorRefs.length; z++) { + IEditorPart ep= editorRefs[z].getEditor(false); + if (ep != null) { + IEditorInput input= ep.getEditorInput(); + if (!inputs.contains(input)) { + inputs.add(input); + result.add(ep); + } } } } @@ -150,7 +148,7 @@ public class TextSearchVisitor extends TypedResourceVisitor { IFile file= (IFile)proxy.requestResource(); try { BufferedReader reader= null; - ITextEditor editor= findDirtyEditorFor(file); + ITextEditor editor= findEditorFor(file); if (editor != null) { String s= editor.getDocumentProvider().getDocument(editor.getEditorInput()).get(); reader= new BufferedReader(new StringReader(s)); @@ -213,14 +211,14 @@ public class TextSearchVisitor extends TypedResourceVisitor { throw new OperationCanceledException(SearchMessages.getString("TextSearchVisitor.canceled")); //$NON-NLS-1$ } - private ITextEditor findDirtyEditorFor(IFile file) { + private ITextEditor findEditorFor(IFile file) { int i= 0; - while (i < fDirtyEditors.length) { - IEditorPart dirtyEditor= fDirtyEditors[i]; - IEditorInput input= dirtyEditor.getEditorInput(); - if (input instanceof IFileEditorInput && dirtyEditor instanceof ITextEditor) + while (i < fEditors.length) { + IEditorPart editor= fEditors[i]; + IEditorInput input= editor.getEditorInput(); + if (input instanceof IFileEditorInput && editor instanceof ITextEditor) if (((IFileEditorInput)input).getFile().equals(file)) - return (ITextEditor)dirtyEditor; + return (ITextEditor)editor; i++; } return null; @@ -257,7 +255,7 @@ public class TextSearchVisitor extends TypedResourceVisitor { * @see IResourceProxyVisitor#visit(IResourceProxy) */ public boolean visit(IResourceProxy proxy) { - fDirtyEditors= getDirtyEditors(); + fEditors= getEditors(); return super.visit(proxy); } } diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/ShowSearchesAction.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/ShowSearchesAction.java index 5705c94513d..8dec8a3da46 100644 --- a/org.eclipse.search/search/org/eclipse/search/internal/ui/ShowSearchesAction.java +++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/ShowSearchesAction.java @@ -18,6 +18,7 @@ import java.util.List; import org.eclipse.swt.graphics.Image; import org.eclipse.jface.action.Action; +import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.search.internal.ui.util.ListDialog; @@ -28,7 +29,10 @@ import org.eclipse.search.internal.ui.util.ListDialog; */ class ShowSearchesAction extends Action { - private static final LabelProvider fgLabelProvider= new LabelProvider() { + private static final class SearchesLabelProvider extends LabelProvider { + + private ArrayList fImages= new ArrayList(); + public String getText(Object element) { if (!(element instanceof ShowSearchAction)) return ""; //$NON-NLS-1$ @@ -37,7 +41,23 @@ class ShowSearchesAction extends Action { public Image getImage(Object element) { if (!(element instanceof ShowSearchAction)) return null; - return ((ShowSearchAction)element).getImageDescriptor().createImage(); + + ImageDescriptor imageDescriptor= ((ShowSearchAction)element).getImageDescriptor(); + if (imageDescriptor == null) + return null; + + Image image= imageDescriptor.createImage(); + fImages.add(image); + + return image; + } + + public void dispose() { + Iterator iter= fImages.iterator(); + while (iter.hasNext()) + ((Image)iter.next()).dispose(); + + fImages= null; } }; @@ -88,7 +108,7 @@ class ShowSearchesAction extends Action { title= SearchMessages.getString("OtherSearchesDialog.title"); //$NON-NLS-1$ message= SearchMessages.getString("OtherSearchesDialog.message"); //$NON-NLS-1$ } - ListDialog dlg= new ListDialog(SearchPlugin.getActiveWorkbenchShell(),input, title, message, new SearchResultContentProvider(), fgLabelProvider); + ListDialog dlg= new ListDialog(SearchPlugin.getActiveWorkbenchShell(),input, title, message, new SearchResultContentProvider(), new SearchesLabelProvider()); if (selectedAction != null) { Object[] selected= new Object[1]; selected[0]= selectedAction; diff --git a/org.eclipse.text/src/org/eclipse/jface/text/IDocument.java b/org.eclipse.text/src/org/eclipse/jface/text/IDocument.java index a6aa5353285..5cad2a15177 100644 --- a/org.eclipse.text/src/org/eclipse/jface/text/IDocument.java +++ b/org.eclipse.text/src/org/eclipse/jface/text/IDocument.java @@ -44,7 +44,7 @@ package org.eclipse.jface.text; * updated on every document manipulation and ensured to be up-to-date when the document * listeners are informed. A document uses an <code>IDocumentPartitioner</code> to * manage its partitions. A document may be unpartitioned which happens when there is no - * partitioner. In this case, the document is considered as one singloe partition of a + * partitioner. In this case, the document is considered as one single partition of a * default type. The default type is specified by this interface. If a document change * changes the document's partitioning all registered partitioning listeners are * informed exactly once.<p> |