[jbosstools-commits] JBoss Tools SVN: r44124 - in trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central: actions and 1 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Fri Sep 28 16:02:35 EDT 2012


Author: snjeza
Date: 2012-09-28 16:02:35 -0400 (Fri, 28 Sep 2012)
New Revision: 44124

Modified:
   trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/JBossCentralActivator.java
   trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/ShowJBossCentral.java
   trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/ShowJBossCentralHandler.java
   trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/RefreshDiscoveryJob.java
Log:
JBDS-2338 -  on installation of JBDS Core Features feature (BYOE) Central appears on top of Welcome screen 

Modified: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/JBossCentralActivator.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/JBossCentralActivator.java	2012-09-28 19:36:54 UTC (rev 44123)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/JBossCentralActivator.java	2012-09-28 20:02:35 UTC (rev 44124)
@@ -25,18 +25,21 @@
 import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.jface.resource.ImageDescriptor;
 import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.browser.Browser;
 import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.ui.IEditorInput;
 import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IViewReference;
 import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.browser.IWebBrowser;
 import org.eclipse.ui.browser.IWorkbenchBrowserSupport;
+import org.eclipse.ui.internal.WorkbenchWindow;
 import org.eclipse.ui.internal.browser.WebBrowserPreference;
 import org.eclipse.ui.internal.browser.WorkbenchBrowserSupport;
 import org.eclipse.ui.menus.CommandContributionItem;
@@ -277,41 +280,44 @@
 		return new CommandContributionItem(parameter);
 	}
 
-	public static JBossCentralEditor getJBossCentralEditor() {
-		final IWorkbenchWindow window = PlatformUI
+	public static JBossCentralEditor getJBossCentralEditor(boolean activate) {
+		final WorkbenchWindow window = (WorkbenchWindow) PlatformUI
 				.getWorkbench().getActiveWorkbenchWindow();
 		final IWorkbenchPage page = window.getActivePage();
-//		if (page.findView(ORG_ECLIPSE_UI_INTERNAL_INTROVIEW) != null
-//				&& !window.getCoolBarVisible()
-//				&& !window.getPerspectiveBarVisible()) {
-//			IViewReference viewRef = page
-//					.findViewReference(ORG_ECLIPSE_UI_INTERNAL_INTROVIEW);
-//			if (page.getPartState(viewRef) == IWorkbenchPage.STATE_MAXIMIZED) {
-//				window.addPropertyChangeListener(new IPropertyChangeListener() {
-//
-//					@Override
-//					public void propertyChange(PropertyChangeEvent event) {
-//						String property = event.getProperty();
-//						if (WorkbenchWindow.PROP_COOLBAR_VISIBLE
-//								.equals(property)
-//								|| WorkbenchWindow.PROP_COOLBAR_VISIBLE
-//										.equals(property)) {
-//							Object newValue = event.getNewValue();
-//							if (newValue instanceof Boolean
-//									&& ((Boolean) newValue).booleanValue()) {
-//								openJBossCentralEditor(page);
-//								window.removePropertyChangeListener(this);
-//							}
-//						}
-//					}
-//				});
-//			} else {
-//				return openJBossCentralEditor(page);
-//			}
-//		} else {
-//			return openJBossCentralEditor(page);
-//		}
-		return openJBossCentralEditor(page);
+		if (activate) {
+			return openJBossCentralEditor(page);
+		}
+		if (page.findView(ORG_ECLIPSE_UI_INTERNAL_INTROVIEW) != null
+				&& !window.getCoolBarVisible()
+				&& !window.getPerspectiveBarVisible()) {
+			IViewReference viewRef = page
+					.findViewReference(ORG_ECLIPSE_UI_INTERNAL_INTROVIEW);
+			if (page.getPartState(viewRef) == IWorkbenchPage.STATE_MAXIMIZED) {
+				window.addPropertyChangeListener(new IPropertyChangeListener() {
+
+					@Override
+					public void propertyChange(PropertyChangeEvent event) {
+						String property = event.getProperty();
+						if (WorkbenchWindow.PROP_COOLBAR_VISIBLE
+								.equals(property)
+								|| WorkbenchWindow.PROP_COOLBAR_VISIBLE
+										.equals(property)) {
+							Object newValue = event.getNewValue();
+							if (newValue instanceof Boolean
+									&& ((Boolean) newValue).booleanValue()) {
+								openJBossCentralEditor(page);
+								window.removePropertyChangeListener(this);
+							}
+						}
+					}
+				});
+			} else {
+				return openJBossCentralEditor(page);
+			}
+		} else {
+			return openJBossCentralEditor(page);
+		}
+		return null;
 	}
 
 	protected static JBossCentralEditor openJBossCentralEditor(

Modified: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/ShowJBossCentral.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/ShowJBossCentral.java	2012-09-28 19:36:54 UTC (rev 44123)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/ShowJBossCentral.java	2012-09-28 20:02:35 UTC (rev 44124)
@@ -65,7 +65,7 @@
 
 			@Override
 			public void run() {
-				JBossCentralActivator.getJBossCentralEditor();
+				JBossCentralActivator.getJBossCentralEditor(false);
 			}
 		});
 	}

Modified: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/ShowJBossCentralHandler.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/ShowJBossCentralHandler.java	2012-09-28 19:36:54 UTC (rev 44123)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/actions/ShowJBossCentralHandler.java	2012-09-28 20:02:35 UTC (rev 44124)
@@ -26,13 +26,13 @@
 public class ShowJBossCentralHandler extends AbstractHandler implements IWorkbenchWindowActionDelegate {
 
 	public Object execute(ExecutionEvent event) throws ExecutionException {
-		JBossCentralActivator.getJBossCentralEditor();
+		JBossCentralActivator.getJBossCentralEditor(true);
 		return null;
 	}
 
 	@Override
 	public void run(IAction action) {
-		JBossCentralActivator.getJBossCentralEditor();
+		JBossCentralActivator.getJBossCentralEditor(true);
 	}
 
 	@Override

Modified: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/RefreshDiscoveryJob.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/RefreshDiscoveryJob.java	2012-09-28 19:36:54 UTC (rev 44123)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/jobs/RefreshDiscoveryJob.java	2012-09-28 20:02:35 UTC (rev 44124)
@@ -42,7 +42,7 @@
 			
 			@Override
 			public void run() {
-				editors[0] = JBossCentralActivator.getJBossCentralEditor();
+				editors[0] = JBossCentralActivator.getJBossCentralEditor(false);
 			}
 		});
 		if (editors[0] != null) {



More information about the jbosstools-commits mailing list