You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by pa...@apache.org on 2007/08/03 12:56:05 UTC
svn commit: r562406 - in
/directory/studio/trunk/studio-apacheds-schemaeditor: resources/icons/
src/main/java/org/apache/directory/studio/apacheds/schemaeditor/
src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/
src/main/java/o...
Author: pamarcelot
Date: Fri Aug 3 03:56:03 2007
New Revision: 562406
URL: http://svn.apache.org/viewvc?view=rev&rev=562406
Log:
Improved SearchView.
Added RunCurrentSearchAgain and ShowSearchHistory Actions.
Added:
directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/run_current_search_again.gif (with props)
directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/search.gif (with props)
directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/show_search_history.gif (with props)
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/RunCurrentSearchAgainAction.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ShowSearchHistoryAction.java
Modified:
directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/show_search_field.gif
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/PluginConstants.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SearchViewController.java
directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SearchView.java
Added: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/run_current_search_again.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/run_current_search_again.gif?view=auto&rev=562406
==============================================================================
Binary file - no diff available.
Propchange: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/run_current_search_again.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/search.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/search.gif?view=auto&rev=562406
==============================================================================
Binary file - no diff available.
Propchange: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/search.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/show_search_field.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/show_search_field.gif?view=diff&rev=562406&r1=562405&r2=562406
==============================================================================
Binary files - no diff available.
Added: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/show_search_history.gif
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/show_search_history.gif?view=auto&rev=562406
==============================================================================
Binary file - no diff available.
Propchange: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/show_search_history.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/PluginConstants.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/PluginConstants.java?view=diff&rev=562406&r1=562405&r2=562406
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/PluginConstants.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/PluginConstants.java Fri Aug 3 03:56:03 2007
@@ -83,6 +83,7 @@
public static final String IMG_PROJECT_OFFLINE = "resources/icons/project_offline.gif";
public static final String IMG_PROJECT_OFFLINE_CLOSED = "resources/icons/project_offline_closed.gif";
public static final String IMG_RENAME = "resources/icons/rename.gif";
+ public static final String IMG_RUN_CURRENT_SEARCH_AGAIN = "resources/icons/run_current_search_again.gif";
public static final String IMG_SCHEMA = "resources/icons/schema.gif";
public static final String IMG_SCHEMA_NEW = "resources/icons/schema_new.gif";
public static final String IMG_SCHEMA_NEW_WIZARD = "resources/icons/schema_new_wizard.png";
@@ -92,7 +93,9 @@
public static final String IMG_SCHEMAS_EXPORT_WIZARD = "resources/icons/schemas_export_wizard.png";
public static final String IMG_SCHEMAS_IMPORT = "resources/icons/schemas_import.gif";
public static final String IMG_SCHEMAS_IMPORT_WIZARD = "resources/icons/schemas_import_wizard.png";
+ public static final String IMG_SEARCH = "resources/icons/search.gif";
public static final String IMG_SHOW_SEARCH_FIELD = "resources/icons/show_search_field.gif";
+ public static final String IMG_SHOW_SEARCH_HISTORY = "resources/icons/show_search_history.gif";
public static final String IMG_SHOW_SUBTYPE_HIERARCHY = "resources/icons/hierarchy_subtype.gif";
public static final String IMG_SHOW_SUPERTYPE_HIERARCHY = "resources/icons/hierarchy_supertype.gif";
public static final String IMG_SORTING = "resources/icons/sorting.gif";
@@ -132,7 +135,9 @@
public static final String CMD_NEW_PROJECT = Activator.PLUGIN_ID + ".commands.newProject";
public static final String CMD_NEW_SCHEMA = Activator.PLUGIN_ID + ".commands.newSchema";
public static final String CMD_RENAME_PROJECT = Activator.PLUGIN_ID + ".commands.renameProject";
+ public static final String CMD_RUN_CURRENT_SEARCH_AGAIN = Activator.PLUGIN_ID + ".commands.runCurrentSearchAgain";
public static final String CMD_SHOW_SEARCH_FIELD = Activator.PLUGIN_ID + ".commands.showSearchField";
+ public static final String CMD_SHOW_SEARCH_HISTORY = Activator.PLUGIN_ID + ".commands.showSearchHistory";
public static final String CMD_SHOW_SUBTYPE_HIERARCHY = Activator.PLUGIN_ID + ".commands.showSubTypeHierarchy";
public static final String CMD_SHOW_SUPERTYPE_HIERARCHY = Activator.PLUGIN_ID + ".commands.showSuperTypeHierarchy";
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SearchViewController.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SearchViewController.java?view=diff&rev=562406&r1=562405&r2=562406
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SearchViewController.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/SearchViewController.java Fri Aug 3 03:56:03 2007
@@ -20,62 +20,12 @@
package org.apache.directory.studio.apacheds.schemaeditor.controller;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.directory.studio.apacheds.schemaeditor.Activator;
-import org.apache.directory.studio.apacheds.schemaeditor.PluginConstants;
-import org.apache.directory.studio.apacheds.schemaeditor.controller.actions.CollapseAllAction;
-import org.apache.directory.studio.apacheds.schemaeditor.controller.actions.ConnectAction;
-import org.apache.directory.studio.apacheds.schemaeditor.controller.actions.DeleteSchemaElementAction;
-import org.apache.directory.studio.apacheds.schemaeditor.controller.actions.ExportSchemasAsOpenLdapAction;
-import org.apache.directory.studio.apacheds.schemaeditor.controller.actions.ExportSchemasAsXmlAction;
-import org.apache.directory.studio.apacheds.schemaeditor.controller.actions.ExportSchemasForADSAction;
-import org.apache.directory.studio.apacheds.schemaeditor.controller.actions.ImportSchemasFromOpenLdapAction;
-import org.apache.directory.studio.apacheds.schemaeditor.controller.actions.ImportSchemasFromXmlAction;
-import org.apache.directory.studio.apacheds.schemaeditor.controller.actions.LinkWithEditorSchemaViewAction;
-import org.apache.directory.studio.apacheds.schemaeditor.controller.actions.NewAttributeTypeAction;
-import org.apache.directory.studio.apacheds.schemaeditor.controller.actions.NewObjectClassAction;
-import org.apache.directory.studio.apacheds.schemaeditor.controller.actions.NewSchemaAction;
-import org.apache.directory.studio.apacheds.schemaeditor.controller.actions.OpenElementAction;
-import org.apache.directory.studio.apacheds.schemaeditor.controller.actions.OpenSchemaViewPreferenceAction;
-import org.apache.directory.studio.apacheds.schemaeditor.controller.actions.OpenSchemaViewSortingDialogAction;
-import org.apache.directory.studio.apacheds.schemaeditor.controller.actions.OpenTypeHierarchyAction;
+import org.apache.directory.studio.apacheds.schemaeditor.controller.actions.RunCurrentSearchAgainAction;
import org.apache.directory.studio.apacheds.schemaeditor.controller.actions.ShowSearchFieldAction;
-import org.apache.directory.studio.apacheds.schemaeditor.model.AttributeTypeImpl;
-import org.apache.directory.studio.apacheds.schemaeditor.model.ObjectClassImpl;
-import org.apache.directory.studio.apacheds.schemaeditor.model.Project;
-import org.apache.directory.studio.apacheds.schemaeditor.model.Schema;
-import org.apache.directory.studio.apacheds.schemaeditor.view.editors.attributetype.AttributeTypeEditor;
-import org.apache.directory.studio.apacheds.schemaeditor.view.editors.attributetype.AttributeTypeEditorInput;
-import org.apache.directory.studio.apacheds.schemaeditor.view.editors.objectclass.ObjectClassEditor;
-import org.apache.directory.studio.apacheds.schemaeditor.view.editors.objectclass.ObjectClassEditorInput;
-import org.apache.directory.studio.apacheds.schemaeditor.view.views.SchemaView;
+import org.apache.directory.studio.apacheds.schemaeditor.controller.actions.ShowSearchHistoryAction;
import org.apache.directory.studio.apacheds.schemaeditor.view.views.SearchView;
-import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.AttributeTypeWrapper;
-import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.Folder;
-import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.ObjectClassWrapper;
-import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.SchemaWrapper;
-import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.TreeNode;
-import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.Folder.FolderType;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IMenuListener;
-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.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
/**
@@ -91,6 +41,8 @@
// The Actions
private ShowSearchFieldAction showSearchField;
+ private RunCurrentSearchAgainAction runCurrentSearchAgain;
+ private ShowSearchHistoryAction searchHistory;
/**
@@ -105,7 +57,6 @@
initActions();
initToolbar();
- initMenu();
}
@@ -115,6 +66,8 @@
private void initActions()
{
showSearchField = new ShowSearchFieldAction( view );
+ runCurrentSearchAgain = new RunCurrentSearchAgainAction( view );
+ searchHistory = new ShowSearchHistoryAction( view );
}
@@ -125,14 +78,8 @@
{
IToolBarManager toolbar = view.getViewSite().getActionBars().getToolBarManager();
toolbar.add( showSearchField );
- }
-
-
- /**
- * Initializes the Menu.
- */
- private void initMenu()
- {
- IMenuManager menu = view.getViewSite().getActionBars().getMenuManager();
+ toolbar.add( new Separator() );
+ toolbar.add( runCurrentSearchAgain );
+ toolbar.add( searchHistory );
}
}
Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/RunCurrentSearchAgainAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/RunCurrentSearchAgainAction.java?view=auto&rev=562406
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/RunCurrentSearchAgainAction.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/RunCurrentSearchAgainAction.java Fri Aug 3 03:56:03 2007
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.studio.apacheds.schemaeditor.controller.actions;
+
+
+import org.apache.directory.studio.apacheds.schemaeditor.Activator;
+import org.apache.directory.studio.apacheds.schemaeditor.PluginConstants;
+import org.apache.directory.studio.apacheds.schemaeditor.view.views.SearchView;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This action is used to link the with the view with the frontmost editor.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class RunCurrentSearchAgainAction extends Action implements IWorkbenchWindowActionDelegate
+{
+ /** The associated view */
+ private SearchView view;
+
+
+ /**
+ * Creates a new instance of ShowSearchFieldAction.
+ */
+ public RunCurrentSearchAgainAction( SearchView view )
+ {
+ super( "Run the Current Search Again" );
+ setToolTipText( getText() );
+ setId( PluginConstants.CMD_RUN_CURRENT_SEARCH_AGAIN );
+ setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+ PluginConstants.IMG_RUN_CURRENT_SEARCH_AGAIN ) );
+ setEnabled( true );
+ this.view = view;
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ public void run()
+ {
+
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ */
+ public void run( IAction action )
+ {
+ run();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
+ */
+ public void dispose()
+ {
+ // Nothing to do
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
+ */
+ public void init( IWorkbenchWindow window )
+ {
+ // Nothing to do
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+ */
+ public void selectionChanged( IAction action, ISelection selection )
+ {
+ // Nothing to do
+ }
+}
Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ShowSearchHistoryAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ShowSearchHistoryAction.java?view=auto&rev=562406
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ShowSearchHistoryAction.java (added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/controller/actions/ShowSearchHistoryAction.java Fri Aug 3 03:56:03 2007
@@ -0,0 +1,172 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.directory.studio.apacheds.schemaeditor.controller.actions;
+
+
+import org.apache.directory.studio.apacheds.schemaeditor.Activator;
+import org.apache.directory.studio.apacheds.schemaeditor.PluginConstants;
+import org.apache.directory.studio.apacheds.schemaeditor.view.views.SearchView;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuCreator;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This action is used to link the with the view with the frontmost editor.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ShowSearchHistoryAction extends Action implements IWorkbenchWindowActionDelegate
+{
+ /** The associated view */
+ private SearchView view;
+
+
+ /**
+ * Creates a new instance of ShowSearchFieldAction.
+ */
+ public ShowSearchHistoryAction( SearchView view )
+ {
+ super( "Search History", AS_DROP_DOWN_MENU );
+ setToolTipText( getText() );
+ setId( PluginConstants.CMD_SHOW_SEARCH_HISTORY );
+ setImageDescriptor( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+ PluginConstants.IMG_SHOW_SEARCH_HISTORY ) );
+ setEnabled( true );
+ this.view = view;
+ setMenuCreator( new MenuCreator() );
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ public void run()
+ {
+ System.out.println( "run" );
+ }
+
+
+ @Override
+ public IMenuCreator getMenuCreator()
+ {
+ System.out.println( "getMenuCreator" );
+ // TODO Auto-generated method stub
+ return super.getMenuCreator();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ */
+ public void run( IAction action )
+ {
+ run();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
+ */
+ public void dispose()
+ {
+ // Nothing to do
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
+ */
+ public void init( IWorkbenchWindow window )
+ {
+ // Nothing to do
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+ */
+ public void selectionChanged( IAction action, ISelection selection )
+ {
+ // Nothing to do
+ }
+}
+
+class MenuCreator implements IMenuCreator
+{
+ /** The menu */
+ private Menu menu;
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.IMenuCreator#dispose()
+ */
+ public void dispose()
+ {
+ if ( menu != null )
+ {
+ menu.dispose();
+ menu = null;
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Control)
+ */
+ public Menu getMenu( Control parent )
+ {
+ menu = new Menu( parent );
+
+ MenuItem item = new MenuItem( menu, SWT.RADIO );
+ item.setText( "searchString1" );
+ item = new MenuItem( menu, SWT.RADIO );
+ item.setText( "searchString2" );
+ item.setSelection( true );
+ item = new MenuItem( menu, SWT.SEPARATOR );
+ item = new MenuItem( menu, SWT.PUSH );
+ item.setText( "History..." );
+ item = new MenuItem( menu, SWT.PUSH );
+ item.setText( "Clear History" );
+
+ return menu;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Menu)
+ */
+ public Menu getMenu( Menu parent )
+ {
+ return null;
+ }
+}
Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SearchView.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SearchView.java?view=diff&rev=562406&r1=562405&r2=562406
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SearchView.java (original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SearchView.java Fri Aug 3 03:56:03 2007
@@ -22,20 +22,30 @@
import org.apache.directory.studio.apacheds.schemaeditor.Activator;
+import org.apache.directory.studio.apacheds.schemaeditor.PluginConstants;
import org.apache.directory.studio.apacheds.schemaeditor.controller.SearchViewController;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.ViewPart;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
/**
@@ -77,6 +87,9 @@
private Composite searchFieldComposite;
+ /** The scope */
+ public static final String SCOPE = "Scope";
+
/** The Search All scope */
public static final String SEARCH_ALL = "All Metadata";
@@ -134,7 +147,7 @@
// Search Results Label
Label searchResultsLabel = new Label( parent, SWT.NONE );
- searchResultsLabel.setText( "'searchString' - X matches in Schema" );
+ searchResultsLabel.setText( "'searchString' - X matches in workspace" );
searchResultsLabel.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
// Separator Label
@@ -162,36 +175,52 @@
*/
private void createSearchField()
{
+ // Search Inner Composite
searchFieldInnerComposite = new Composite( searchFieldComposite, SWT.NONE );
GridLayout searchFieldInnerCompositeGridLayout = new GridLayout( 4, false );
- searchFieldInnerCompositeGridLayout.horizontalSpacing = 3;
- searchFieldInnerCompositeGridLayout.verticalSpacing = 3;
+ searchFieldInnerCompositeGridLayout.horizontalSpacing = 1;
+ searchFieldInnerCompositeGridLayout.verticalSpacing = 1;
+ searchFieldInnerCompositeGridLayout.marginHeight = 1;
+ searchFieldInnerCompositeGridLayout.marginWidth = 2;
searchFieldInnerComposite.setLayout( searchFieldInnerCompositeGridLayout );
searchFieldInnerComposite.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
+ // Search Label
Label searchFieldLabel = new Label( searchFieldInnerComposite, SWT.NONE );
searchFieldLabel.setText( "Search:" );
- searchField = new Text( searchFieldInnerComposite, SWT.DROP_DOWN | SWT.BORDER );
+ // Search Text Field
+ searchField = new Text( searchFieldInnerComposite, SWT.BORDER );
searchField.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
- Label inLabel = new Label( searchFieldInnerComposite, SWT.NONE );
- inLabel.setText( "Scope:" );
-
- scopeCombo = new Combo( searchFieldInnerComposite, SWT.READ_ONLY | SWT.SINGLE );
- scopeCombo.addSelectionListener( new SelectionAdapter()
+ // Search Scope Toolbar
+ final ToolBar scopeToolBar = new ToolBar( searchFieldInnerComposite, SWT.HORIZONTAL | SWT.FLAT );
+ // Creating the Search Scope ToolItem
+ final ToolItem scopeToolItem = new ToolItem( scopeToolBar, SWT.DROP_DOWN );
+ scopeToolItem.setText( "Scope" );
+ // Creating the associated Menu
+ final Menu scopeMenu = new Menu( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.POP_UP );
+ // Adding the action to display the Menu when the item is clicked
+ scopeToolItem.addSelectionListener( new SelectionAdapter()
{
- public void widgetSelected( SelectionEvent e )
+ public void widgetSelected( SelectionEvent event )
{
- currentSearchScope = scopeCombo.getText();
- resultsTableViewer.refresh();
+ Rectangle rect = scopeToolItem.getBounds();
+ Point pt = new Point( rect.x, rect.y + rect.height );
+ pt = scopeToolBar.toDisplay( pt );
+ scopeMenu.setLocation( pt.x, pt.y );
+ scopeMenu.setVisible( true );
}
} );
- scopeCombo.add( SEARCH_ALL, 0 );
- scopeCombo.add( SEARCH_NAME, 1 );
- scopeCombo.add( SEARCH_OID, 2 );
- scopeCombo.add( SEARCH_DESC, 3 );
- scopeCombo.select( 0 );
+ MenuItem item = new MenuItem( scopeMenu, SWT.CHECK );
+ item.setSelection( true );
+ item.setText( "Aliases" );
+
+ // Search Button
+ Button searchButton = new Button( searchFieldInnerComposite, SWT.PUSH | SWT.DOWN );
+ searchButton.setImage( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+ PluginConstants.IMG_SEARCH ).createImage() );
+ searchButton.setToolTipText( "Search" );
// Separator Label
separatorLabel = new Label( searchFieldComposite, SWT.SEPARATOR | SWT.HORIZONTAL );
@@ -455,6 +484,7 @@
{
createSearchField();
parent.layout( true, true );
+ searchField.setFocus();
}
@@ -474,5 +504,6 @@
separatorLabel = null;
}
parent.layout( true, true );
+ resultsTable.setFocus();
}
}