Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Aeschlimann2006-02-08 18:11:30 +0000
committerMartin Aeschlimann2006-02-08 18:11:30 +0000
commit195932f5396c687804bdbed93cb64dd4d6ce1edb (patch)
tree6c9e9a49a88186729be3d9ea4246b043f3962eff
parent79708d949f9a7eb1f0422ac93d14fecfa6412362 (diff)
downloadeclipse.platform.text-195932f5396c687804bdbed93cb64dd4d6ce1edb.tar.gz
eclipse.platform.text-195932f5396c687804bdbed93cb64dd4d6ce1edb.tar.xz
eclipse.platform.text-195932f5396c687804bdbed93cb64dd4d6ce1edb.zip
126751 Provide various view orientations for the new TextSearchUI
-rw-r--r--org.eclipse.search/icons/full/dlcl16/automaticOrientation.gifbin0 -> 338 bytes
-rw-r--r--org.eclipse.search/icons/full/dlcl16/horizontalOrientation.gifbin0 -> 245 bytes
-rw-r--r--org.eclipse.search/icons/full/dlcl16/singleOrientation.gifbin0 -> 222 bytes
-rw-r--r--org.eclipse.search/icons/full/dlcl16/verticalOrientation.gifbin0 -> 222 bytes
-rw-r--r--org.eclipse.search/icons/full/elcl16/automaticOrientation.gifbin0 -> 358 bytes
-rw-r--r--org.eclipse.search/icons/full/elcl16/horizontalOrientation.gifbin0 -> 374 bytes
-rw-r--r--org.eclipse.search/icons/full/elcl16/singleOrientation.gifbin0 -> 370 bytes
-rw-r--r--org.eclipse.search/icons/full/elcl16/verticalOrientation.gifbin0 -> 352 bytes
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchMessages.java5
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchMessages.properties7
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/IRetrieverKeys.java1
-rw-r--r--org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/RetrieverPage.java142
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPluginImages.java4
13 files changed, 156 insertions, 3 deletions
diff --git a/org.eclipse.search/icons/full/dlcl16/automaticOrientation.gif b/org.eclipse.search/icons/full/dlcl16/automaticOrientation.gif
new file mode 100644
index 000000000..1b93aaca7
--- /dev/null
+++ b/org.eclipse.search/icons/full/dlcl16/automaticOrientation.gif
Binary files differ
diff --git a/org.eclipse.search/icons/full/dlcl16/horizontalOrientation.gif b/org.eclipse.search/icons/full/dlcl16/horizontalOrientation.gif
new file mode 100644
index 000000000..05da6248e
--- /dev/null
+++ b/org.eclipse.search/icons/full/dlcl16/horizontalOrientation.gif
Binary files differ
diff --git a/org.eclipse.search/icons/full/dlcl16/singleOrientation.gif b/org.eclipse.search/icons/full/dlcl16/singleOrientation.gif
new file mode 100644
index 000000000..530345b36
--- /dev/null
+++ b/org.eclipse.search/icons/full/dlcl16/singleOrientation.gif
Binary files differ
diff --git a/org.eclipse.search/icons/full/dlcl16/verticalOrientation.gif b/org.eclipse.search/icons/full/dlcl16/verticalOrientation.gif
new file mode 100644
index 000000000..0a52f1de2
--- /dev/null
+++ b/org.eclipse.search/icons/full/dlcl16/verticalOrientation.gif
Binary files differ
diff --git a/org.eclipse.search/icons/full/elcl16/automaticOrientation.gif b/org.eclipse.search/icons/full/elcl16/automaticOrientation.gif
new file mode 100644
index 000000000..45469ad67
--- /dev/null
+++ b/org.eclipse.search/icons/full/elcl16/automaticOrientation.gif
Binary files differ
diff --git a/org.eclipse.search/icons/full/elcl16/horizontalOrientation.gif b/org.eclipse.search/icons/full/elcl16/horizontalOrientation.gif
new file mode 100644
index 000000000..d59047044
--- /dev/null
+++ b/org.eclipse.search/icons/full/elcl16/horizontalOrientation.gif
Binary files differ
diff --git a/org.eclipse.search/icons/full/elcl16/singleOrientation.gif b/org.eclipse.search/icons/full/elcl16/singleOrientation.gif
new file mode 100644
index 000000000..42fca3fcc
--- /dev/null
+++ b/org.eclipse.search/icons/full/elcl16/singleOrientation.gif
Binary files differ
diff --git a/org.eclipse.search/icons/full/elcl16/verticalOrientation.gif b/org.eclipse.search/icons/full/elcl16/verticalOrientation.gif
new file mode 100644
index 000000000..dee0cbca0
--- /dev/null
+++ b/org.eclipse.search/icons/full/elcl16/verticalOrientation.gif
Binary files differ
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchMessages.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchMessages.java
index fd6397896..b10587969 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchMessages.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchMessages.java
@@ -190,5 +190,10 @@ public final class SearchMessages extends NLS {
public static String SelectedResourcesScopeDescription_projectName;
public static String SelectedResourcesScopeDescription_multiProjectName;
public static String RetrieverFindTab_choosePatterns;
+ public static String RetrieverPage_ViewOrientation;
+ public static String RetrieverPage_Horizontal;
+ public static String RetrieverPage_Vertical;
+ public static String RetrieverPage_Automatic;
+ public static String RetrieverPage_ResultsViewOnly;
} \ No newline at end of file
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchMessages.properties b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchMessages.properties
index 3b7638efe..488390d61 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchMessages.properties
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/SearchMessages.properties
@@ -91,7 +91,7 @@ RetrieverFilterTab_Preprocessor_text=&Preprocessor
RetrieverFilterTab_String_text=&String
RetrieverFilterTab_TextFilter_text=&Text filter:
RetrieverFindTab_caseSensitive=&Case sensitive
-RetrieverFindTab_choosePatterns=C&hoose
+RetrieverFindTab_choosePatterns=C&hoose...
RetrieverFindTab_choose=Ch&oose...
RetrieverFindTab_Error_emptySearchString=Search string must not be empty.
RetrieverFindTab_selectedResourcesTitle=Search Scope
@@ -126,6 +126,9 @@ RetrieverPage_ErrorDialog_title=Input Error
RetrieverPage_FilterTab_text=Filter
RetrieverPage_FindTab_text=Find
RetrieverPage_filterPlural={0} (Filter shows {1} of {2} matches)
+RetrieverPage_Horizontal=Horizontal View Orientation
+RetrieverPage_Vertical=Vertical View Orientation
+RetrieverPage_Automatic=Automatic View Orientation
RetrieverPage_InformationDialog_title=Information
RetrieverPage_LoadQuery_text=Import Search...
RetrieverPage_LoadQuery_tooltip=Imports the definition of a search.
@@ -133,6 +136,8 @@ RetrieverPage_question_overwriteWorkingSet=Working set exists, do you want to ov
ReplaceOperation_error_cannotLocateMatchAt=Cannot locate match in {0} at line {1}
RetrieverPage_QuestionDialog_title=Question
RetrieverPage_ReplaceTab_text=Replace
+RetrieverPage_ViewOrientation=View Orientation
+RetrieverPage_ResultsViewOnly=Results View Only
RetrieverPage_SaveQuery_text=Export Search...
RetrieverPage_filterSingular={0} (Filter shows {1} of {2} match)
RetrieverQuery_statusMessage=Problems encountered during text search
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/IRetrieverKeys.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/IRetrieverKeys.java
index a7f40277e..7a95f7062 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/IRetrieverKeys.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/IRetrieverKeys.java
@@ -20,6 +20,7 @@ interface IRetrieverKeys {
final String KEY_SPLITTER_W2= "splitter.w2"; //$NON-NLS-1$
final String KEY_USE_FLAT_LAYOUT= "flat-layout"; //$NON-NLS-1$
+ final String KEY_VIEW_ORIENTATION= "view-orientation"; //$NON-NLS-1$
final String KEY_CASE_SENSITIVE_SEARCH= "case-sensitive"; //$NON-NLS-1$
final String KEY_REGULAR_EXPRESSION_SEARCH= "regular-expression"; //$NON-NLS-1$
diff --git a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/RetrieverPage.java b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/RetrieverPage.java
index f564ff431..e7843e557 100644
--- a/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/RetrieverPage.java
+++ b/org.eclipse.search/new search/org/eclipse/search2/internal/ui/text2/RetrieverPage.java
@@ -38,9 +38,12 @@ import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.custom.ViewForm;
import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.events.ControlListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
@@ -54,6 +57,8 @@ import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.jface.dialogs.MessageDialog;
@@ -110,6 +115,10 @@ public class RetrieverPage extends AbstractTextSearchViewPage implements IQueryL
public static final String ID= "org.eclipse.search.text.RetrieverPage"; //$NON-NLS-1$
private static final String QUERY_EXTENSION = ".txtSearch"; //$NON-NLS-1$
+ private static final int ORIENTATION_AUTOMATIC = 0;
+ private static final int ORIENTATION_HORIZONTAL = 1;
+ private static final int ORIENTATION_VERTICAL = 2;
+ private static final int ORIENTATION_SINGLE = 3;
private static final Collator COLLATOR= Collator.getInstance();
@@ -151,10 +160,17 @@ public class RetrieverPage extends AbstractTextSearchViewPage implements IQueryL
private RetrieverViewerSorter fSorter;
private boolean fUseFlatLayout;
+ private int fRequestedViewOrientation= 0;
+ private int fCurrentViewOrientation= -1;
private RetrieverLabelProvider fLabelProvider;
private ISearchResultViewPart fViewPart;
private RetrieverFilter fRecentFilter;
+ private boolean fInComputeOrientation;
+ private Action fHorizontalOrientation;
+ private Action fVerticalOrientation;
+ private Action fAutomaticOrientation;
+ private Action fSingleOrientation;
public RetrieverPage() {
super(FLAG_LAYOUT_TREE);
@@ -181,7 +197,7 @@ public class RetrieverPage extends AbstractTextSearchViewPage implements IQueryL
fSplitter.setWeights(new int[] {60, 40});
-
+ restoreCurrentOrientation();
createListeners();
restoreValues();
}
@@ -204,6 +220,16 @@ public class RetrieverPage extends AbstractTextSearchViewPage implements IQueryL
mm.appendToGroup(IContextMenuConstants.GROUP_SEARCH, fConsiderDerivedResources);
mm.appendToGroup(IContextMenuConstants.GROUP_VIEWER_SETUP, fFlatAction);
mm.appendToGroup(IContextMenuConstants.GROUP_VIEWER_SETUP, fHierarchicalAction);
+
+ mm.appendToGroup(IContextMenuConstants.GROUP_VIEWER_SETUP, new Separator());
+
+ MenuManager submenu= new MenuManager(SearchMessages.RetrieverPage_ViewOrientation);
+ submenu.add(fHorizontalOrientation);
+ submenu.add(fVerticalOrientation);
+ submenu.add(fAutomaticOrientation);
+ submenu.add(fSingleOrientation);
+
+ mm.appendToGroup(IContextMenuConstants.GROUP_VIEWER_SETUP, submenu);
actionBars.updateActionBars();
}
@@ -320,6 +346,14 @@ public class RetrieverPage extends AbstractTextSearchViewPage implements IQueryL
}
private void createListeners() {
+ fSplitter.addControlListener(new ControlListener() {
+ public void controlMoved(ControlEvent e) {
+ }
+ public void controlResized(ControlEvent e) {
+ computeOrientation();
+ }
+ });
+
fTabFolder.addSelectionListener(new SelectionAdapter(){
public void widgetSelected(SelectionEvent e) {
onTabChanged();
@@ -387,6 +421,42 @@ public class RetrieverPage extends AbstractTextSearchViewPage implements IQueryL
}
};
fConsiderDerivedResources.setText(SearchMessages.RetrieverPage_ConsiderDerived_text);
+
+ fHorizontalOrientation= new Action(SearchMessages.RetrieverPage_Horizontal, IAction.AS_RADIO_BUTTON) {
+ public void run() {
+ onViewOrientationChanged(ORIENTATION_HORIZONTAL);
+ }
+ };
+ SearchPluginImages.setImageDescriptors(fHorizontalOrientation, SearchPluginImages.T_LCL, SearchPluginImages.IMG_LCL_SEARCH_HORIZONTAL_ORIENTATION);
+
+ fVerticalOrientation= new Action(SearchMessages.RetrieverPage_Vertical, IAction.AS_RADIO_BUTTON) {
+ public void run() {
+ onViewOrientationChanged(ORIENTATION_VERTICAL);
+ }
+ };
+ SearchPluginImages.setImageDescriptors(fVerticalOrientation, SearchPluginImages.T_LCL, SearchPluginImages.IMG_LCL_SEARCH_VERTICAL_ORIENTATION);
+
+ fAutomaticOrientation= new Action(SearchMessages.RetrieverPage_Automatic, IAction.AS_RADIO_BUTTON) {
+ public void run() {
+ onViewOrientationChanged(ORIENTATION_AUTOMATIC);
+ }
+ };
+ SearchPluginImages.setImageDescriptors(fAutomaticOrientation, SearchPluginImages.T_LCL, SearchPluginImages.IMG_LCL_SEARCH_AUTOMATIC_ORIENTATION);
+
+ fSingleOrientation= new Action(SearchMessages.RetrieverPage_ResultsViewOnly, IAction.AS_RADIO_BUTTON) {
+ public void run() {
+ onViewOrientationChanged(ORIENTATION_SINGLE);
+ }
+ };
+ SearchPluginImages.setImageDescriptors(fSingleOrientation, SearchPluginImages.T_LCL, SearchPluginImages.IMG_LCL_SEARCH_SINGLE_ORIENTATION);
+ }
+
+ protected void onViewOrientationChanged(int orientation) {
+ if (fRequestedViewOrientation != orientation) {
+ fRequestedViewOrientation= orientation;
+ fDialogSettings.put(KEY_VIEW_ORIENTATION, orientation);
+ computeOrientation();
+ }
}
protected void onConsiderDerivedResources() {
@@ -567,7 +637,74 @@ public class RetrieverPage extends AbstractTextSearchViewPage implements IQueryL
fUseFlatLayout= fDialogSettings.getBoolean(KEY_USE_FLAT_LAYOUT);
}
}
-
+
+ private void restoreCurrentOrientation() {
+ if (fDialogSettings.get(KEY_VIEW_ORIENTATION) == null) {
+ fRequestedViewOrientation= ORIENTATION_AUTOMATIC;
+ } else {
+ fRequestedViewOrientation= fDialogSettings.getInt(KEY_VIEW_ORIENTATION);
+ }
+ computeOrientation();
+ switch(fRequestedViewOrientation) {
+ case ORIENTATION_HORIZONTAL:
+ fHorizontalOrientation.setChecked(true);
+ break;
+ case ORIENTATION_VERTICAL:
+ fVerticalOrientation.setChecked(true);
+ break;
+ case ORIENTATION_SINGLE:
+ fSingleOrientation.setChecked(true);
+ break;
+ default:
+ fRequestedViewOrientation= ORIENTATION_AUTOMATIC;
+ fAutomaticOrientation.setChecked(true);
+ break;
+ }
+ }
+
+ public void setOrientation(int orientation) {
+ if (fCurrentViewOrientation != orientation) {
+ if (fInputForm != null && !fInputForm.isDisposed() &&
+ fSplitter != null && !fSplitter.isDisposed()) {
+ if (orientation == ORIENTATION_SINGLE) {
+ fInputForm.setVisible(false);
+ } else {
+ if (fCurrentViewOrientation == ORIENTATION_SINGLE) {
+ fInputForm.setVisible(true);
+ }
+ boolean horizontal= orientation == ORIENTATION_HORIZONTAL;
+ fSplitter.setOrientation(horizontal ? SWT.HORIZONTAL : SWT.VERTICAL);
+ }
+ fSplitter.layout();
+ }
+ fCurrentViewOrientation= orientation;
+ }
+ }
+
+ void computeOrientation() {
+ // avoid recursive calls of compute orientation
+ if (fInComputeOrientation) {
+ return;
+ }
+ fInComputeOrientation= true;
+ try {
+ if (fRequestedViewOrientation != ORIENTATION_AUTOMATIC) {
+ setOrientation(fRequestedViewOrientation);
+ }
+ else {
+ Point size= fSplitter.getSize();
+ if (size.x != 0 && size.y != 0) {
+ if (2*size.x > 3*size.y)
+ setOrientation(ORIENTATION_HORIZONTAL);
+ else
+ setOrientation(ORIENTATION_VERTICAL);
+ }
+ }
+ } finally {
+ fInComputeOrientation= false;
+ }
+ }
+
private void restoreValues() {
int[] weights= new int[] {0,0};
try {
@@ -760,6 +897,7 @@ public class RetrieverPage extends AbstractTextSearchViewPage implements IQueryL
}
}
super.setInput(result, viewState);
+ fCreateWSAction.setEnabled(getInput() != null);
updateEnablementOnTabs();
setFocus();
}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPluginImages.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPluginImages.java
index 3f19118fa..8dea5015f 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPluginImages.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchPluginImages.java
@@ -58,6 +58,10 @@ public class SearchPluginImages {
public static final String IMG_LCL_SEARCH_HISTORY= NAME_PREFIX + "search_history.gif"; //$NON-NLS-1$
public static final String IMG_LCL_SEARCH_FLAT_LAYOUT= NAME_PREFIX + "flatLayout.gif"; //$NON-NLS-1$
public static final String IMG_LCL_SEARCH_HIERARCHICAL_LAYOUT= NAME_PREFIX + "hierarchicalLayout.gif"; //$NON-NLS-1$
+ public static final String IMG_LCL_SEARCH_HORIZONTAL_ORIENTATION= NAME_PREFIX + "horizontalOrientation.gif"; //$NON-NLS-1$
+ public static final String IMG_LCL_SEARCH_VERTICAL_ORIENTATION= NAME_PREFIX + "verticalOrientation.gif"; //$NON-NLS-1$
+ public static final String IMG_LCL_SEARCH_AUTOMATIC_ORIENTATION= NAME_PREFIX + "automaticOrientation.gif"; //$NON-NLS-1$
+ public static final String IMG_LCL_SEARCH_SINGLE_ORIENTATION= NAME_PREFIX + "singleOrientation.gif"; //$NON-NLS-1$
public static final String IMG_LCL_SEARCH_CANCEL= NAME_PREFIX + "stop.gif"; //$NON-NLS-1$
public static final String IMG_LCL_SEARCH_COLLAPSE_ALL= NAME_PREFIX + "collapseall.gif"; //$NON-NLS-1$
public static final String IMG_LCL_SEARCH_EXPAND_ALL= NAME_PREFIX + "expandall.gif"; //$NON-NLS-1$

Back to the top