Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] static methods in CUIPlugin

This patch changes the getActiveWorkbenchWindow() and getActiveWorkbenchShell() into static methods. This is for consistency sake with JDT to make porting code simpler.

I can't forsee any ill effects other than a few compiler warnings where code that was calling CUIPlugin.getDefault().getActiveWorkbenchWindow() should now call CUIPlugin.getActiveWorkbenchWindow().

-Chris

Index: CUIPlugin.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CUIPlugin.java,v
retrieving revision 1.33
diff -u -r1.33 CUIPlugin.java
--- CUIPlugin.java	7 Apr 2004 00:32:13 -0000	1.33
+++ CUIPlugin.java	13 Apr 2004 15:12:15 -0000
@@ -148,24 +148,25 @@
 	public static ResourceBundle getResourceBundle() {
 		return fgResourceBundle;
 	}
-
-	public IWorkbenchWindow getActiveWorkbenchWindow() {
+	
+	public static IWorkbenchWindow getActiveWorkbenchWindow() {
 		return getDefault().getWorkbench().getActiveWorkbenchWindow();
 	}
 
-	/**
-	 * @return
-	 */
 	public static IWorkbenchPage getActivePage() {
-		IWorkbenchWindow window = getDefault().getActiveWorkbenchWindow();
+		IWorkbenchWindow window = getActiveWorkbenchWindow();
 		if (window != null) {
 			return window.getActivePage();
 		}
 		return null;
 	}
 
-	public Shell getActiveWorkbenchShell() {
-		return getActiveWorkbenchWindow().getShell();
+	public static Shell getActiveWorkbenchShell() {
+		 IWorkbenchWindow window= getActiveWorkbenchWindow();
+		 if (window != null) {
+		 	return window.getShell();
+		 }
+		 return null;
 	}
 
 	public static CUIPlugin getDefault() {

Back to the top