directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r491710 - /directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/BrowserUIPlugin.java
Date Mon, 01 Jan 2007 23:56:14 GMT
Author: seelmann
Date: Mon Jan  1 15:56:14 2007
New Revision: 491710

URL: http://svn.apache.org/viewvc?view=rev&rev=491710
Log:
Added method to determine if plugin runs in IDE or RCP environment

Modified:
    directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/BrowserUIPlugin.java

Modified: directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/BrowserUIPlugin.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/BrowserUIPlugin.java?view=diff&rev=491710&r1=491709&r2=491710
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/BrowserUIPlugin.java
(original)
+++ directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/BrowserUIPlugin.java
Mon Jan  1 15:56:14 2007
@@ -28,8 +28,11 @@
 
 import org.apache.directory.ldapstudio.browser.core.BrowserCorePlugin;
 import org.apache.directory.ldapstudio.browser.core.events.EventRegistry;
-
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
 import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
 import org.eclipse.jface.resource.ColorRegistry;
 import org.eclipse.jface.resource.FontRegistry;
 import org.eclipse.jface.resource.ImageDescriptor;
@@ -435,4 +438,42 @@
         return this.uiPreferences;
     }
 
+    
+    /**
+     * Checks, if this plugins runs in the Eclipse IDE or in RCP environment.
+     * This is done by looking for the Resource perspective extensions.
+     *
+     * @return true if this plugin runs in IDE environment
+     */
+    public static boolean isIDEEnvironment()
+    {
+        IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(
+            "org.eclipse.ui.perspectives" );
+        if ( extensionPoint != null )
+        {
+            IExtension[] extensions = extensionPoint.getExtensions();
+            if ( extensions != null )
+            {
+                for ( int i = 0; i < extensions.length; i++ )
+                {
+                    IExtension extension = extensions[i];
+                    IConfigurationElement[] elements = extension.getConfigurationElements();
+                    for ( int j = 0; j < elements.length; j++ )
+                    {
+                        IConfigurationElement element = elements[j];
+                        if ( element.getName().equals( "perspective" ) )
+                        {
+                            if ( "org.eclipse.ui.resourcePerspective".equals( element.getAttribute(
"id" ) ) )
+                            {
+                                return true;
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        
+        return false;
+    }
+    
 }



Mime
View raw message