directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r478175 - in /directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser: controller/ view/views/
Date Wed, 22 Nov 2006 14:48:58 GMT
Author: pamarcelot
Date: Wed Nov 22 06:48:57 2006
New Revision: 478175

URL: http://svn.apache.org/viewvc?view=rev&rev=478175
Log:
Delegating some UI listener registrations to the controllers of the views.

Modified:
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/controller/AttributesViewController.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/controller/BrowserViewController.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/AttributesView.java
    directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/BrowserView.java

Modified: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/controller/AttributesViewController.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/controller/AttributesViewController.java?view=diff&rev=478175&r1=478174&r2=478175
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/controller/AttributesViewController.java
(original)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/controller/AttributesViewController.java
Wed Nov 22 06:48:57 2006
@@ -24,6 +24,7 @@
 import org.apache.directory.ldapstudio.browser.controller.actions.AttributeDeleteAction;
 import org.apache.directory.ldapstudio.browser.controller.actions.AttributeEditAction;
 import org.apache.directory.ldapstudio.browser.controller.actions.AttributeNewAction;
+import org.apache.directory.ldapstudio.browser.controller.actions.RenameAttributeAction;
 import org.apache.directory.ldapstudio.browser.view.views.AttributesView;
 import org.apache.directory.ldapstudio.browser.view.views.BrowserView;
 import org.apache.directory.ldapstudio.browser.view.views.wrappers.ConnectionWrapper;
@@ -34,6 +35,8 @@
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.widgets.Table;
 import org.eclipse.ui.ISelectionListener;
 import org.eclipse.ui.IWorkbenchPart;
@@ -81,9 +84,31 @@
      * Sets the controlled View
      * @param view the controlled View
      */
-    public void setView( AttributesView view )
+    public void setView( final AttributesView view )
     {
         this.view = view;
+        
+        // Handling selection of the Browser View to update this view
+        view.getSite().getPage().addPostSelectionListener( BrowserView.ID, new ISelectionListener()
+        {
+            public void selectionChanged( IWorkbenchPart part, ISelection selection )
+            {
+                // Setting the new input
+                view.setInput( ( ( TreeSelection ) selection ).getFirstElement() );
+
+                // Resizing columns to fit
+                view.resizeColumsToFit();
+            }
+        } );
+        
+        // Handling the double click modification
+        view.getViewer().getTable().addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetDefaultSelected( SelectionEvent e )
+            {
+                new RenameAttributeAction( view, view.getViewer().getTable(), "Rename" ).run();
+            }
+        } );
     }
 
 

Modified: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/controller/BrowserViewController.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/controller/BrowserViewController.java?view=diff&rev=478175&r1=478174&r2=478175
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/controller/BrowserViewController.java
(original)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/controller/BrowserViewController.java
Wed Nov 22 06:48:57 2006
@@ -34,7 +34,10 @@
 import org.eclipse.jface.action.IMenuListener;
 import org.eclipse.jface.action.IMenuManager;
 import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
 import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.jface.viewers.TreeSelection;
 import org.eclipse.ui.ISelectionListener;
 import org.eclipse.ui.IWorkbenchPart;
@@ -101,9 +104,24 @@
      * Sets the controlled View
      * @param view the controlled View
      */
-    public void setView( BrowserView view )
+    public void setView( final BrowserView view )
     {
         this.view = view;
+        
+        // Adding DoubleClick behavior
+        view.getViewer().addDoubleClickListener( new IDoubleClickListener()
+        {
+            public void doubleClick( DoubleClickEvent event )
+            {
+                // What we get from the treeViewer is a StructuredSelection
+                StructuredSelection selection = ( StructuredSelection ) event.getSelection();
+
+                // Here's the real object
+                Object objectSelection = selection.getFirstElement();
+
+                view.getViewer().setExpandedState( objectSelection, !view.getViewer().getExpandedState(
objectSelection ) );
+            }
+        } );
     }
 
 

Modified: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/AttributesView.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/AttributesView.java?view=diff&rev=478175&r1=478174&r2=478175
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/AttributesView.java
(original)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/AttributesView.java
Wed Nov 22 06:48:57 2006
@@ -23,22 +23,16 @@
 
 import org.apache.directory.ldapstudio.browser.Activator;
 import org.apache.directory.ldapstudio.browser.controller.AttributesViewController;
-import org.apache.directory.ldapstudio.browser.controller.actions.RenameAttributeAction;
 import org.eclipse.jface.action.IToolBarManager;
 import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.TableViewer;
 import org.eclipse.jface.viewers.TreeSelection;
 import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Table;
 import org.eclipse.swt.widgets.TableColumn;
 import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.ui.ISelectionListener;
-import org.eclipse.ui.IWorkbenchPart;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.part.ViewPart;
 
@@ -52,7 +46,6 @@
     public static final String ID = Activator.PLUGIN_ID + ".AttributesView";
     private Table table;
     private TableViewer viewer;
-    private AttributesView instance;
     private AttributesViewController controller;
 
 
@@ -65,8 +58,6 @@
     @Override
     public void createPartControl( Composite parent )
     {
-        instance = this;
-
         table = new Table( parent, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL );
         table.setLayoutData( new GridData( GridData.FILL, GridData.FILL, true, true ) );
         table.setLinesVisible( true );
@@ -95,29 +86,6 @@
 
         // Registering the Viewer, so other views can be notified when the viewer selection
changes
         getSite().setSelectionProvider( viewer );
-
-        // Handling selection of the Browser View to update this view TODO This should be
done by the controller
-        getSite().getPage().addPostSelectionListener( BrowserView.ID, new ISelectionListener()
-        {
-            public void selectionChanged( IWorkbenchPart part, ISelection selection )
-            {
-                // Setting the new input
-                setInput( ( ( TreeSelection ) selection ).getFirstElement() );
-
-                // Resizing columns to fit
-                resizeColumsToFit();
-            }
-        } );
-
-        // Handling the double click modification
-        table.addSelectionListener( new SelectionAdapter()
-        {
-
-            public void widgetDefaultSelected( SelectionEvent e )
-            {
-                new RenameAttributeAction( instance, table, "Rename" ).run();
-            }
-        } );
 
         createContextMenu();
 

Modified: directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/BrowserView.java
URL: http://svn.apache.org/viewvc/directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/BrowserView.java?view=diff&rev=478175&r1=478174&r2=478175
==============================================================================
--- directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/BrowserView.java
(original)
+++ directory/sandbox/pamarcelot/ldapstudio/ldapstudio-browser/src/main/java/org/apache/directory/ldapstudio/browser/view/views/BrowserView.java
Wed Nov 22 06:48:57 2006
@@ -30,10 +30,7 @@
 import org.eclipse.jface.action.IToolBarManager;
 import org.eclipse.jface.action.MenuManager;
 import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.viewers.DoubleClickEvent;
 import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.jface.viewers.TreeViewer;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.Composite;
@@ -62,21 +59,6 @@
         // Initializing ContentProvider and LabelProvider
         viewer.setContentProvider( new BrowserViewContentProvider() );
         viewer.setLabelProvider( new BrowserViewLabelProvider() );
-
-        // Adding DoubleClick behavior TODO This handling should be in the controller
-        viewer.addDoubleClickListener( new IDoubleClickListener()
-        {
-            public void doubleClick( DoubleClickEvent event )
-            {
-                // What we get from the treeViewer is a StructuredSelection
-                StructuredSelection selection = ( StructuredSelection ) event.getSelection();
-
-                // Here's the real object
-                Object objectSelection = selection.getFirstElement();
-
-                viewer.setExpandedState( objectSelection, !viewer.getExpandedState( objectSelection
) );
-            }
-        } );
 
         // Creating the controller, registering the view to the controller and creating the
Actions
         controller = BrowserViewController.getInstance();



Mime
View raw message