Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDani Megert2001-08-30 16:48:54 +0000
committerDani Megert2001-08-30 16:48:54 +0000
commit0d4d99e2f88d368f1a7f6de38237795c1b3d10b2 (patch)
treeb3dd96e967700121f6b7c67784016990a144cc69
parent7523cf9db2452886c4b114998a9dee0df4837ce3 (diff)
downloadeclipse.platform.text-0d4d99e2f88d368f1a7f6de38237795c1b3d10b2.tar.gz
eclipse.platform.text-0d4d99e2f88d368f1a7f6de38237795c1b3d10b2.tar.xz
eclipse.platform.text-0d4d99e2f88d368f1a7f6de38237795c1b3d10b2.zip
NLS fixes for Hebrew (2.0)v0_2_0_stream_31_08_2001
-rw-r--r--org.eclipse.search/icons/basic/cview16/searchres.gifbin904 -> 118 bytes
-rw-r--r--org.eclipse.search/icons/basic/eview16/searchres.gifbin148 -> 100 bytes
-rw-r--r--org.eclipse.search/icons/full/cview16/searchres.gifbin904 -> 154 bytes
-rw-r--r--org.eclipse.search/icons/full/eview16/searchres.gifbin148 -> 149 bytes
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/Search.java62
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SearchMessages.java14
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SearchMessages.properties6
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultViewer.java16
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchOperation.java2
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchResultCollector.java24
-rw-r--r--org.eclipse.search/search/org/eclipse/search/ui/ISearchResultView.java14
11 files changed, 73 insertions, 65 deletions
diff --git a/org.eclipse.search/icons/basic/cview16/searchres.gif b/org.eclipse.search/icons/basic/cview16/searchres.gif
index e96afc6d0..ff1bb3af7 100644
--- a/org.eclipse.search/icons/basic/cview16/searchres.gif
+++ b/org.eclipse.search/icons/basic/cview16/searchres.gif
Binary files differ
diff --git a/org.eclipse.search/icons/basic/eview16/searchres.gif b/org.eclipse.search/icons/basic/eview16/searchres.gif
index 90908913d..4c675e2e3 100644
--- a/org.eclipse.search/icons/basic/eview16/searchres.gif
+++ b/org.eclipse.search/icons/basic/eview16/searchres.gif
Binary files differ
diff --git a/org.eclipse.search/icons/full/cview16/searchres.gif b/org.eclipse.search/icons/full/cview16/searchres.gif
index e96afc6d0..b9aeb759c 100644
--- a/org.eclipse.search/icons/full/cview16/searchres.gif
+++ b/org.eclipse.search/icons/full/cview16/searchres.gif
Binary files differ
diff --git a/org.eclipse.search/icons/full/eview16/searchres.gif b/org.eclipse.search/icons/full/eview16/searchres.gif
index 90908913d..70c0f183e 100644
--- a/org.eclipse.search/icons/full/eview16/searchres.gif
+++ b/org.eclipse.search/icons/full/eview16/searchres.gif
Binary files differ
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/Search.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/Search.java
index 4c9bbf9d5..bf807a93d 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/Search.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/Search.java
@@ -9,6 +9,8 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import org.eclipse.core.resources.IWorkspaceDescription;
+
import org.eclipse.swt.widgets.Shell;
import org.eclipse.jface.action.IAction;
@@ -18,9 +20,6 @@ import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.util.Assert;
import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.core.resources.IWorkspaceDescription;
-import org.eclipse.core.runtime.CoreException;
-
import org.eclipse.search.internal.ui.util.ExceptionHandler;
import org.eclipse.search.ui.IContextMenuContributor;
import org.eclipse.search.ui.IGroupByKeyComputer;
@@ -57,20 +56,12 @@ class Search extends Object {
if (fDescription == null)
return ""; //$NON-NLS-1$
- String text= fDescription;
+ // try to replace "{0}" with the match count
int i= fDescription.lastIndexOf("{0}"); //$NON-NLS-1$
- if (i != -1) {
- // replace "{0}" with the match count
- int count= getItemCount();
- text= fDescription.substring(0, i);
- text += count;
- // cut away last 's' if count is 1
- if (count == 1 && fDescription.lastIndexOf('s') == (fDescription.length() - 1))
- text += fDescription.substring(i + 3, fDescription.length() - 1);
- else
- text += fDescription.substring(i + 3);
- }
- return text;
+ if (i < 0)
+ return fDescription;
+ else
+ return fDescription.substring(0, i) + getItemCount()+ fDescription.substring(Math.min(i + 3, fDescription.length()));
}
/**
* Returns a short description of the search.
@@ -81,36 +72,17 @@ class Search extends Object {
String getShortDescription() {
if (fDescription == null)
return ""; //$NON-NLS-1$
-
- String text= fDescription;
- int i= fDescription.lastIndexOf("{0}"); //$NON-NLS-1$
- if (i != -1) {
- // replace "{0}" with the match count
- int count= getItemCount();
- // minimize length infront of " - " to 20 and add ...
- if (i > 20 + 3) {
- if (fDescription.indexOf('"') == 0 && fDescription.indexOf('"', 1) == i - 4)
- text= fDescription.substring(0, 21) + "\"... - "; //$NON-NLS-1$
- else
- text= fDescription.substring(0, 20) + "... - "; //$NON-NLS-1$
- }
- else
- text= fDescription.substring(0, i);
- text += count;
- // cut away last 's' if count is 1
- if (count == 1 && fDescription.lastIndexOf('s') == (fDescription.length() - 1))
- text += fDescription.substring(i + 3, fDescription.length() - 1);
- else
- text += fDescription.substring(i + 3);
- }
- else {
- // minimize length to 30 and add ...
- if (fDescription.length() > 30)
- text= fDescription.substring(0, 30) + "... "; //$NON-NLS-1$
- }
- return text;
+ String text= getFullDescription();
+ int separatorPos= text.indexOf(" - "); //$NON-NLS-1$
+ if (separatorPos < 1)
+ return text.substring(0, Math.min(50, text.length())) + "..."; // use first 50 characters //$NON-NLS-1$
+ if (separatorPos < 30)
+ return text; // don't cut
+ if (text.charAt(0) == '"') //$NON-NLS-1$
+ return text.substring(0, Math.min(30, text.length())) + "...\" - " + text.substring(Math.min(separatorPos + 3, text.length())); //$NON-NLS-1$
+ else
+ return text.substring(0, Math.min(30, text.length())) + "... - " + text.substring(Math.min(separatorPos + 3, text.length())); //$NON-NLS-1$
}
-
/** Image used when search is displayed in a list */
ImageDescriptor getImageDescriptor() {
return fImageDescriptor;
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchMessages.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchMessages.java
index 94a43bf5a..a1b4aa9be 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchMessages.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchMessages.java
@@ -40,4 +40,18 @@ public class SearchMessages {
arg= ""; //$NON-NLS-1$
return MessageFormat.format(format, new Object[] { arg });
}
+ /**
+ * Gets a string from the resource bundle and formats it with the argument
+ *
+ * @param key the string used to get the bundle value, must not be null
+ */
+ public static String getFormattedString(String key, Object[] args) {
+ String format= null;
+ try {
+ format= fgResourceBundle.getString(key);
+ } catch (MissingResourceException e) {
+ return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
+ }
+ return MessageFormat.format(format, args);
+ }
}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchMessages.properties b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchMessages.properties
index 57080a074..d84b0fee0 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchMessages.properties
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchMessages.properties
@@ -13,6 +13,8 @@ SearchManager.resourceDeleted=Some of the resources no longer exist. Correspondi
SearchManager.updating=Updating...
SearchResultView.title=Search
+SearchResultView.titleWithOneMatch=Search (1 match)
+SearchResultView.titleWithMatches=Search ({0} matches)
SearchResultView.matches=matches
SearchResultView.removed_resource=<removed resource>
SearchResultView.removeAllResults.text=Remove &All
@@ -76,6 +78,7 @@ Search.Error.incorrectIconLocation.title=Search Error
Search.Error.incorrectIconLocation.message=Invalid icon location
SearchResultCollector.matches=matches
+SearchResultCollector.match=match
SearchResultCollector.done=Search done
SearchPage.expression.label=Se&arch Expression
@@ -101,7 +104,8 @@ OtherSearchesDialog.message=&Select one of the searches
PreviousSearchesDialog.title=Previous Searches
PreviousSearchesDialog.message=&Select one of the searches
-TextSearchOperation.descriptionPostfix=\ - {0} Occurrences
+# The first argument will be replaced by the pattern, the second by the count
+TextSearchOperation.descriptionPostfix="{0}" - Occurrences: {1}
TypedResourceVisitor.unknownResourceType=Unknown resource type
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultViewer.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultViewer.java
index 14154d1f9..629100ada 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultViewer.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchResultViewer.java
@@ -45,8 +45,7 @@ import org.eclipse.search.ui.ISearchResultViewEntry;
*/
class SearchResultViewer extends TableViewer {
- private static final String MATCHES_POSTFIX= " " + SearchMessages.getString("SearchResultView.matches") + ")"; //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$
- private SearchResultView fOuterPart;
+ private SearchResultView fOuterPart;
private boolean fFirstTime= true;
private ShowNextResultAction fShowNextResultAction;
private ShowPreviousResultAction fShowPreviousResultAction;
@@ -363,10 +362,15 @@ class SearchResultViewer extends TableViewer {
protected void updateTitle(boolean showZero) {
int count= SearchManager.getDefault().getCurrentItemCount();
boolean hasCurrentSearch= SearchManager.getDefault().getCurrentSearch() != null;
- String title= SearchMessages.getString("SearchResultView.title"); //$NON-NLS-1$
- if (showZero && (count > 0 || hasCurrentSearch))
- title= title + " (" + count + MATCHES_POSTFIX; //$NON-NLS-1$
- if (!title.equals(fOuterPart.getTitle()))
+ String title;
+ if (showZero && (count > 0 || hasCurrentSearch)) {
+ if (count == 1)
+ title= SearchMessages.getString("SearchResultView.titleWithOneMatch"); //$NON-NLS-1$
+ else
+ title= SearchMessages.getFormattedString("SearchResultView.titleWithMatches", new Integer(count)); //$NON-NLS-1$
+ } else
+ title= SearchMessages.getString("SearchResultView.title"); //$NON-NLS-1$
+ if (title == null || !title.equals(fOuterPart.getTitle()))
fOuterPart.setTitle(title);
String toolTip= null;
if (hasCurrentSearch)
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchOperation.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchOperation.java
index d560596b8..971a2f585 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchOperation.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchOperation.java
@@ -55,7 +55,7 @@ public class TextSearchOperation extends WorkspaceModifyOperation {
}
String getDescription() {
- return "\"" + fPattern + "\"" + SearchMessages.getString("TextSearchOperation.descriptionPostfix"); //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$
+ return SearchMessages.getFormattedString("TextSearchOperation.descriptionPostfix", new String[] {fPattern, "{0}"}); //$NON-NLS-2$ //$NON-NLS-1$
}
ImageDescriptor getImageDescriptor() {
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchResultCollector.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchResultCollector.java
index b505391ff..87a0429d5 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchResultCollector.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/TextSearchResultCollector.java
@@ -19,6 +19,7 @@ import org.eclipse.search.internal.ui.SearchMessages;
public class TextSearchResultCollector implements ITextSearchResultCollector {
+ private static final String SPACE_MATCH= " " + SearchMessages.getString("SearchResultCollector.match"); //$NON-NLS-2$ //$NON-NLS-1$
private static final String SPACE_MATCHES= " " + SearchMessages.getString("SearchResultCollector.matches"); //$NON-NLS-2$ //$NON-NLS-1$
private IProgressMonitor fMonitor;
@@ -70,18 +71,31 @@ public class TextSearchResultCollector implements ITextSearchResultCollector {
String description= resource.getFullPath().lastSegment();
if (description == null)
- description= "";
+ description= ""; //$NON-NLS-1$
fView.addMatch(description, resource, resource, marker);
- if (!getProgressMonitor().isCanceled())
- getProgressMonitor().subTask(++fMatchCount + SPACE_MATCHES);
+ fMatchCount= fMatchCount + 1;
+ if (!getProgressMonitor().isCanceled()) {
+ String text;
+ if (fMatchCount == 1)
+ text= fMatchCount + SPACE_MATCH;
+ else
+ text= fMatchCount + SPACE_MATCHES;
+ getProgressMonitor().subTask(text);
+ }
}
/**
* Called when the search has ended.
*/
public void done() {
- if (!getProgressMonitor().isCanceled())
- getProgressMonitor().setTaskName(SearchMessages.getString("SearchResultCollector.done") + ": " + fMatchCount + SPACE_MATCHES + " "); //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$
+ if (!getProgressMonitor().isCanceled()) {
+ String matchString;
+ if (fMatchCount == 1)
+ matchString= fMatchCount + SPACE_MATCH;
+ else
+ matchString= fMatchCount + SPACE_MATCHES;
+ getProgressMonitor().setTaskName(SearchMessages.getString("SearchResultCollector.done") + ": " + matchString + " "); //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$
+ }
if (fView != null)
fView.searchFinished();
diff --git a/org.eclipse.search/search/org/eclipse/search/ui/ISearchResultView.java b/org.eclipse.search/search/org/eclipse/search/ui/ISearchResultView.java
index 06560d9d6..c18abd800 100644
--- a/org.eclipse.search/search/org/eclipse/search/ui/ISearchResultView.java
+++ b/org.eclipse.search/search/org/eclipse/search/ui/ISearchResultView.java
@@ -43,7 +43,7 @@ public interface ISearchResultView extends IViewPart {
* If every match should show up in the search result view then the match
* itself can be used as key.
*
- * @param pageId the id of the search page which started the search
+ * @param pageId the id of the search page which started the search
* @param label the label to be used for this search occurrence
* @param imageDescriptor the image descriptor to be used for this search occurrence,
* or <code>null</code> if this search should not have an image
@@ -57,13 +57,13 @@ public interface ISearchResultView extends IViewPart {
* @param operation the runnable used by the view to repeat the search
*/
public void searchStarted(
- String pageId,
- String label,
- ImageDescriptor imageDescriptor,
+ String pageId,
+ String label,
+ ImageDescriptor imageDescriptor,
IContextMenuContributor contributor,
- ILabelProvider labelProvider,
- IAction gotoAction,
- IGroupByKeyComputer groupByKeyComputer,
+ ILabelProvider labelProvider,
+ IAction gotoAction,
+ IGroupByKeyComputer groupByKeyComputer,
IRunnableWithProgress operation);
/**
* Informs the view that the search has finished.

Back to the top