directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r1602678 - in /directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui: actions/ views/connection/
Date Sun, 15 Jun 2014 09:35:58 GMT
Author: seelmann
Date: Sun Jun 15 09:35:58 2014
New Revision: 1602678

URL: http://svn.apache.org/r1602678
Log:
DIRSTUDIO-980: Add 'Reload Schema' menu item to connection context menu

Added:
    directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/ReloadSchemaAction.java
Modified:
    directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/messages.properties
    directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/messages_de.properties
    directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/messages_fr.properties
    directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/connection/ConnectionViewActionGroup.java

Added: directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/ReloadSchemaAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/ReloadSchemaAction.java?rev=1602678&view=auto
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/ReloadSchemaAction.java
(added)
+++ directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/ReloadSchemaAction.java
Sun Jun 15 09:35:58 2014
@@ -0,0 +1,117 @@
+/*
+ *  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.ldapbrowser.ui.actions;
+
+
+import org.apache.directory.studio.connection.core.Connection;
+import org.apache.directory.studio.ldapbrowser.common.actions.BrowserAction;
+import org.apache.directory.studio.ldapbrowser.core.BrowserCorePlugin;
+import org.apache.directory.studio.ldapbrowser.core.jobs.ReloadSchemaRunnable;
+import org.apache.directory.studio.ldapbrowser.core.jobs.StudioBrowserJob;
+import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
+import org.apache.directory.studio.ldapbrowser.ui.BrowserUIConstants;
+import org.apache.directory.studio.ldapbrowser.ui.BrowserUIPlugin;
+import org.eclipse.jface.resource.ImageDescriptor;
+
+
+/**
+ * This Action launches the schema reload.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class ReloadSchemaAction extends BrowserAction
+{
+    /**
+     * Creates a new instance of ReloadSchemaAction.
+     */
+    public ReloadSchemaAction()
+    {
+        super();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void run()
+    {
+        IBrowserConnection connection = getConnectionToRefresh();
+        if ( connection != null )
+        {
+            new StudioBrowserJob( new ReloadSchemaRunnable( connection ) ).execute();
+        }
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getText()
+    {
+        return Messages.getString( "ReloadSchemaAction.ReloadSchema" ); //$NON-NLS-1$
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public ImageDescriptor getImageDescriptor()
+    {
+        return BrowserUIPlugin.getDefault().getImageDescriptor( BrowserUIConstants.IMG_REFRESH
);
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getCommandId()
+    {
+        return null;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isEnabled()
+    {
+        return getConnectionToRefresh() != null;
+    }
+
+
+    private IBrowserConnection getConnectionToRefresh()
+    {
+        Connection[] connections = getSelectedConnections();
+        if ( connections.length != 1 )
+        {
+            return null;
+        }
+        Connection connection = connections[0];
+        if ( !connection.getConnectionWrapper().isConnected() )
+        {
+            return null;
+        }
+        IBrowserConnection browserConnection = BrowserCorePlugin.getDefault().getConnectionManager()
+            .getBrowserConnection( connection );
+        return browserConnection;
+    }
+
+}

Modified: directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/messages.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/messages.properties?rev=1602678&r1=1602677&r2=1602678&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/messages.properties
(original)
+++ directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/messages.properties
Sun Jun 15 09:35:58 2014
@@ -96,3 +96,4 @@ BrowserPasteAction.PasteValue=Paste Valu
 BrowserPasteAction.PasteValues=Paste Values
 BrowserPasteAction.SelectCopyDepth=Select Copy Depth
 PropertiesAction.PropertiesForX=Properties for {0}
+ReloadSchemaAction.ReloadSchema=Reload Schema

Modified: directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/messages_de.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/messages_de.properties?rev=1602678&r1=1602677&r2=1602678&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/messages_de.properties
(original)
+++ directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/messages_de.properties
Sun Jun 15 09:35:58 2014
@@ -94,3 +94,4 @@ BrowserPasteAction.PasteValue=Wert einf\
 BrowserPasteAction.PasteValues=Werte einf\u00FCgen
 BrowserPasteAction.SelectCopyDepth=Kopiertiefe ausw\u00E4hlen
 PropertiesAction.PropertiesForX=Eigenschaften f\u00FCr {0}
+ReloadSchemaAction.ReloadSchema=Schema neu laden

Modified: directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/messages_fr.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/messages_fr.properties?rev=1602678&r1=1602677&r2=1602678&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/messages_fr.properties
(original)
+++ directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/messages_fr.properties
Sun Jun 15 09:35:58 2014
@@ -96,3 +96,4 @@ BrowserPasteAction.PasteValue=Coller la 
 BrowserPasteAction.PasteValues=Coller les valeurs
 BrowserPasteAction.SelectCopyDepth=S\u00E9lectionner la profondeur de copie
 PropertiesAction.PropertiesForX=Propri\u00E9t\u00E9s pour {0}
+ReloadSchemaAction.ReloadSchema=Recharger le sch\u00E9ma

Modified: directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/connection/ConnectionViewActionGroup.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/connection/ConnectionViewActionGroup.java?rev=1602678&r1=1602677&r2=1602678&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/connection/ConnectionViewActionGroup.java
(original)
+++ directory/studio/trunk/plugins/ldapbrowser.ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/connection/ConnectionViewActionGroup.java
Sun Jun 15 09:35:58 2014
@@ -27,6 +27,7 @@ import org.apache.directory.studio.ldapb
 import org.apache.directory.studio.ldapbrowser.ui.actions.ImportConnectionsAction;
 import org.apache.directory.studio.ldapbrowser.ui.actions.ImportExportAction;
 import org.apache.directory.studio.ldapbrowser.ui.actions.OpenSchemaBrowserAction;
+import org.apache.directory.studio.ldapbrowser.ui.actions.ReloadSchemaAction;
 import org.eclipse.jface.action.IAction;
 import org.eclipse.jface.action.IMenuManager;
 import org.eclipse.jface.action.MenuManager;
@@ -79,6 +80,9 @@ public class ConnectionViewActionGroup e
     /** The Constant openSchemaBrowserAction. */
     private static final String openSchemaBrowserAction = "openSchemaBrowserAction"; //$NON-NLS-1$
 
+    /** The Constant reloadSchemaAction. */
+    private static final String reloadSchemaAction = "reloadSchemaAction"; //$NON-NLS-1$
+
 
     /**
      * Creates a new instance of ConnectionViewActionGroup and creates
@@ -114,6 +118,8 @@ public class ConnectionViewActionGroup e
 
         connectionActionMap.put( openSchemaBrowserAction, new ConnectionViewActionProxy(
viewer, this,
             new OpenSchemaBrowserAction() ) );
+        connectionActionMap.put( reloadSchemaAction, new ConnectionViewActionProxy( viewer,
this,
+            new ReloadSchemaAction() ) );
     }
 
 
@@ -155,6 +161,7 @@ public class ConnectionViewActionGroup e
         menuManager.add( new Separator() );
 
         menuManager.add( ( IAction ) connectionActionMap.get( openSchemaBrowserAction ) );
+        menuManager.add( ( IAction ) connectionActionMap.get( reloadSchemaAction ) );
         menuManager.add( new Separator() );
 
         // copy/paste/...



Mime
View raw message