directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r549036 - 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/view/views/ src/main/java/o...
Date Wed, 20 Jun 2007 09:56:23 GMT
Author: pamarcelot
Date: Wed Jun 20 02:56:22 2007
New Revision: 549036

URL: http://svn.apache.org/viewvc?view=rev&rev=549036
Log:
Added the DifferencesWidget, a Widget that displays the given Difference Objects.

Added:
    directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_add.png
  (with props)
    directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_modify.png
  (with props)
    directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_remove.png
  (with props)
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidget.java
    directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetLabelProvider.java
Modified:
    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/view/views/SchemaView.java

Added: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_add.png
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_add.png?view=auto&rev=549036
==============================================================================
Binary file - no diff available.

Propchange: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_add.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_modify.png
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_modify.png?view=auto&rev=549036
==============================================================================
Binary file - no diff available.

Propchange: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_modify.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_remove.png
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_remove.png?view=auto&rev=549036
==============================================================================
Binary file - no diff available.

Propchange: directory/studio/trunk/studio-apacheds-schemaeditor/resources/icons/difference_remove.png
------------------------------------------------------------------------------
    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=549036&r1=549035&r2=549036
==============================================================================
--- 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
Wed Jun 20 02:56:22 2007
@@ -32,11 +32,15 @@
     public static final String IMG_ATTRIBUTE_TYPE = "resources/icons/attribute_type.gif";
     public static final String IMG_CONNECT = "resources/icons/connect.gif";
     public static final String IMG_DISCONNECT = "resources/icons/disconnect.gif";
+    public static final String IMG_DIFFERENCE_ADD = "resources/icons/difference_add.png";
+    public static final String IMG_DIFFERENCE_MODIFY = "resources/icons/difference_modify.png";
+    public static final String IMG_DIFFERENCE_REMOVE = "resources/icons/difference_remove.png";
     public static final String IMG_FOLDER = "resources/icons/folder.gif";
     public static final String IMG_FOLDER_AT = "resources/icons/folder_at.gif";
     public static final String IMG_FOLDER_OC = "resources/icons/folder_oc.gif";
     public static final String IMG_OBJECT_CLASS = "resources/icons/object_class.gif";
     public static final String IMG_SCHEMA = "resources/icons/schema.gif";
+    public static final String IMG_TOOLBAR_MENU = "resources/icons/toolbar_menu.gif";
     
     // Commands
     public static final String CMD_CONNECT= Activator.PLUGIN_ID +".connect";

Modified: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaView.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaView.java?view=diff&rev=549036&r1=549035&r2=549036
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaView.java
(original)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/views/SchemaView.java
Wed Jun 20 02:56:22 2007
@@ -20,8 +20,16 @@
 package org.apache.directory.studio.apacheds.schemaeditor.view.views;
 
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.apache.directory.studio.apacheds.schemaeditor.Activator;
 import org.apache.directory.studio.apacheds.schemaeditor.controller.SchemaViewController;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AddAliasDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.Difference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.ModifyCollectiveDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.RemoveAliasDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.view.widget.DifferencesWidget;
 import org.apache.directory.studio.apacheds.schemaeditor.view.wrappers.SchemaViewRoot;
 import org.eclipse.jface.viewers.DecoratingLabelProvider;
 import org.eclipse.jface.viewers.TreeViewer;
@@ -62,6 +70,15 @@
 
         // Adding the controller
         new SchemaViewController( this );
+        
+        DifferencesWidget differencesWidget = new DifferencesWidget();
+        differencesWidget.createWidget( parent );
+        
+        List<Difference> differences = new ArrayList<Difference>();
+        differences.add( new AddAliasDifference(null, null, "toto") );
+        differences.add( new ModifyCollectiveDifference(null, null, false, true) );
+        differences.add( new RemoveAliasDifference(null, null, "tata") );
+        differencesWidget.setInput( differences );
     }
 
 

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidget.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidget.java?view=auto&rev=549036
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidget.java
(added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidget.java
Wed Jun 20 02:56:22 2007
@@ -0,0 +1,144 @@
+/*
+ *  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.view.widget;
+
+
+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.model.difference.Difference;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+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.Composite;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This class represents the DifferencesWidget.
+ * <p>
+ * It is used to display a List of Difference given in input.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class DifferencesWidget
+{
+    /** The TableViewer */
+    private TableViewer viewer;
+
+
+    /**
+     * Creates the widget.
+     *
+     * @param parent
+     *      the parent Composite
+     */
+    public void createWidget( Composite parent )
+    {
+        // Composite
+        Composite composite = new Composite( parent, SWT.NONE );
+        GridLayout gridLayout = new GridLayout();
+        gridLayout.marginBottom = 0;
+        gridLayout.marginHeight = 0;
+        gridLayout.marginLeft = 0;
+        gridLayout.marginRight = 0;
+        gridLayout.marginTop = 0;
+        gridLayout.marginWidth = 0;
+        composite.setLayout( gridLayout );
+
+        // ToolBar
+        final ToolBar toolBar = new ToolBar( composite, SWT.HORIZONTAL );
+        toolBar.setLayoutData( new GridData( SWT.RIGHT, SWT.NONE, false, false ) );
+        // Creating the 'Menu' ToolBar item
+        final ToolItem menuToolItem = new ToolItem( toolBar, SWT.PUSH );
+        menuToolItem.setImage( AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+            PluginConstants.IMG_TOOLBAR_MENU ).createImage() );
+        menuToolItem.setToolTipText( "Menu" );
+        // Creating the associated Menu
+        final Menu menu = new Menu( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
SWT.POP_UP );
+        // Adding the action to display the Menu when the item is clicked
+        menuToolItem.addSelectionListener( new SelectionAdapter()
+        {
+            public void widgetSelected( SelectionEvent event )
+            {
+                Rectangle rect = menuToolItem.getBounds();
+                Point pt = new Point( rect.x, rect.y + rect.height );
+                pt = toolBar.toDisplay( pt );
+                menu.setLocation( pt.x, pt.y );
+                menu.setVisible( true );
+            }
+        } );
+        // Adding the 'Group By Property' MenuItem
+        MenuItem groupByPropertyItem = new MenuItem( menu, SWT.CHECK );
+        groupByPropertyItem.setText( "Sort By Property" );
+        groupByPropertyItem.setSelection( true );
+        // Adding the 'Group By Type' MenuItem
+        MenuItem groupByType = new MenuItem( menu, SWT.CHECK );
+        groupByType.setText( "Sort By Type" );
+        groupByType.setSelection( false );
+
+        // Table
+        Table table = new Table( composite, SWT.BORDER );
+        table.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
+
+        // TableViewer
+        viewer = new TableViewer( table );
+        viewer.setContentProvider( new ArrayContentProvider() );
+        viewer.setLabelProvider( new DifferencesWidgetLabelProvider() );
+    }
+
+
+    /**
+     * Sets the Input of the TableViewer.
+     *
+     * @param input
+     *      the input
+     */
+    public void setInput( List<Difference> input )
+    {
+        viewer.setInput( input );
+    }
+
+
+    /**
+     * Gets the TableViewer used in the Widget.
+     *
+     * @return
+     *      the TableViewer used in the Widget
+     */
+    public TableViewer getViewer()
+    {
+        return viewer;
+    }
+}

Added: directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetLabelProvider.java?view=auto&rev=549036
==============================================================================
--- directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetLabelProvider.java
(added)
+++ directory/studio/trunk/studio-apacheds-schemaeditor/src/main/java/org/apache/directory/studio/apacheds/schemaeditor/view/widget/DifferencesWidgetLabelProvider.java
Wed Jun 20 02:56:22 2007
@@ -0,0 +1,65 @@
+/*
+ *  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.view.widget;
+
+
+import org.apache.directory.studio.apacheds.schemaeditor.Activator;
+import org.apache.directory.studio.apacheds.schemaeditor.PluginConstants;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AbstractAddDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AbstractModifyDifference;
+import org.apache.directory.studio.apacheds.schemaeditor.model.difference.AbstractRemoveDifference;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * This class implements the LabelProvider for the DifferencesWidget.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class DifferencesWidgetLabelProvider extends LabelProvider
+{
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
+     */
+    public Image getImage( Object element )
+    {
+        if ( element instanceof AbstractAddDifference )
+        {
+            return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID, PluginConstants.IMG_DIFFERENCE_ADD
)
+                .createImage();
+        }
+        else if ( element instanceof AbstractModifyDifference )
+        {
+            return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+                PluginConstants.IMG_DIFFERENCE_MODIFY ).createImage();
+        }
+        else if ( element instanceof AbstractRemoveDifference )
+        {
+            return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
+                PluginConstants.IMG_DIFFERENCE_REMOVE ).createImage();
+        }
+
+        // Default
+        return null;
+    }
+}



Mime
View raw message