Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 87817 invoked from network); 3 Oct 2007 21:30:08 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Oct 2007 21:30:07 -0000 Received: (qmail 94940 invoked by uid 500); 3 Oct 2007 21:29:57 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 94903 invoked by uid 500); 3 Oct 2007 21:29:57 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 94892 invoked by uid 99); 3 Oct 2007 21:29:57 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Oct 2007 14:29:57 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Oct 2007 21:30:07 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id E59E61A9832; Wed, 3 Oct 2007 14:29:46 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r581728 - in /directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets: ConnectionConfiguration.java ConnectionSorter.java ConnectionWidget.java Date: Wed, 03 Oct 2007 21:29:46 -0000 To: commits@directory.apache.org From: seelmann@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20071003212946.E59E61A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: seelmann Date: Wed Oct 3 14:29:45 2007 New Revision: 581728 URL: http://svn.apache.org/viewvc?rev=581728&view=rev Log: DIRSTUDIO-187: added sorter to connections view Added: directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionSorter.java Modified: directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionConfiguration.java directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionWidget.java Modified: directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionConfiguration.java URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionConfiguration.java?rev=581728&r1=581727&r2=581728&view=diff ============================================================================== --- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionConfiguration.java (original) +++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionConfiguration.java Wed Oct 3 14:29:45 2007 @@ -47,6 +47,9 @@ /** The label provider. */ private ConnectionLabelProvider labelProvider; + /** The sorter. */ + private ConnectionSorter sorter; + /** The context menu manager. */ private MenuManager contextMenuManager; @@ -142,6 +145,22 @@ } return labelProvider; + } + + + /** + * Gets the sorter. + * + * @return the sorter + */ + public ConnectionSorter getSorter() + { + if ( sorter == null ) + { + sorter = new ConnectionSorter(); + } + + return sorter; } } Added: directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionSorter.java URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionSorter.java?rev=581728&view=auto ============================================================================== --- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionSorter.java (added) +++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionSorter.java Wed Oct 3 14:29:45 2007 @@ -0,0 +1,82 @@ +/* + * 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.connection.ui.widgets; + + +import org.apache.directory.studio.connection.core.ConnectionFolder; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.jface.viewers.ViewerSorter; + + +/** + * The ConnectionSorter implements the sorter for the connection widget. + * + * @author Apache Directory Project + * @version $Rev$, $Date$ + */ +public class ConnectionSorter extends ViewerSorter +{ + + /** + * Creates a new instance of ConnectionSorter. + */ + public ConnectionSorter() + { + } + + + /** + * Connects the tree viewer to this sorter. + * + * @param viewer the tree viewer + */ + public void connect( TreeViewer viewer ) + { + viewer.setSorter( this ); + } + + + /** + * Disposes this sorter. + */ + public void dispose() + { + } + + + /** + * {@inheritDoc} + * + * This method is used to categorize connection folders and connections. + */ + public int category( Object element ) + { + if ( element instanceof ConnectionFolder ) + { + return 1; + } + else + { + return 2; + } + } + +} Modified: directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionWidget.java URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionWidget.java?rev=581728&r1=581727&r2=581728&view=diff ============================================================================== --- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionWidget.java (original) +++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/ConnectionWidget.java Wed Oct 3 14:29:45 2007 @@ -153,6 +153,9 @@ tree.setLayoutData( data ); viewer = new TreeViewer( tree ); + // setup sorter + configuration.getSorter().connect( viewer ); + // setup providers viewer.setContentProvider( configuration.getContentProvider( viewer ) ); viewer.setLabelProvider( configuration.getLabelProvider( viewer ) );