Author: rob.stryker(a)jboss.com
Date: 2007-09-14 18:14:46 -0400 (Fri, 14 Sep 2007)
New Revision: 3643
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/util/
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/util/ViewUtilityMethods.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/DescriptorXPathViewProvider.java
Log:
Moved bringing properties to front into a utility class for other view-related utils.
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/DescriptorXPathViewProvider.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/DescriptorXPathViewProvider.java 2007-09-14
22:13:38 UTC (rev 3642)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/DescriptorXPathViewProvider.java 2007-09-14
22:14:46 UTC (rev 3643)
@@ -62,6 +62,7 @@
import org.jboss.ide.eclipse.as.ui.views.server.extensions.JBossServerViewExtension;
import org.jboss.ide.eclipse.as.ui.views.server.extensions.ServerViewProvider;
import
org.jboss.ide.eclipse.as.ui.views.server.providers.descriptors.DescriptorXPathPropertySheetPage;
+import org.jboss.ide.eclipse.as.ui.views.server.util.ViewUtilityMethods;
public class DescriptorXPathViewProvider extends JBossServerViewExtension {
@@ -88,40 +89,11 @@
JBossServerView.addExtensionFrameListener(
new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
- activatePropertiesView();
+ ViewUtilityMethods.activatePropertiesView(propertyPage);
}
});
}
- protected void activatePropertiesView() {
- Object o =
JBossServerView.getDefault().getExtensionFrame().getViewer().getSelectedElement();
- if( o instanceof XPathCategory ) {
- // show properties view
- String propsId = "org.eclipse.ui.views.PropertySheet";
- try {
- IWorkbench work = PlatformUI.getWorkbench();
- IWorkbenchWindow window = work.getActiveWorkbenchWindow();
- if( !isPropertiesOnTop()) {
- window.getActivePage().showView(propsId);
- if( propertyPage != null ) {
- propertyPage.selectionChanged(JBossServerView.getDefault().getViewSite().getPart(),
JBossServerView.getDefault().getExtensionFrame().getViewer().getSelection());
- }
- }
- } catch( PartInitException pie ) {
- }
- }
- }
-
- protected boolean isPropertiesOnTop() {
- String propsId = "org.eclipse.ui.views.PropertySheet";
- IWorkbench work = PlatformUI.getWorkbench();
- IWorkbenchWindow window = work.getActiveWorkbenchWindow();
- IWorkbenchPage page = window.getActivePage();
- IViewReference ref = window.getActivePage().findViewReference(propsId);
- if( ref == null ) return false;
- IWorkbenchPart part = ref.getPart(false);
- return ( part != null && page.isPartVisible(part));
- }
public void setActiveCategory(XPathCategory o) {
if( o != null && o != activeCategory) {
activeCategory = o;
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/util/ViewUtilityMethods.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/util/ViewUtilityMethods.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/util/ViewUtilityMethods.java 2007-09-14
22:14:46 UTC (rev 3643)
@@ -0,0 +1,46 @@
+package org.jboss.ide.eclipse.as.ui.views.server.util;
+
+import org.eclipse.ui.IViewReference;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.views.properties.IPropertySheetPage;
+import org.jboss.ide.eclipse.as.core.extensions.descriptors.XPathCategory;
+import org.jboss.ide.eclipse.as.ui.views.server.JBossServerView;
+
+public class ViewUtilityMethods {
+
+
+ public static void activatePropertiesView(IPropertySheetPage propertyPage) {
+ Object o =
JBossServerView.getDefault().getExtensionFrame().getViewer().getSelectedElement();
+ if( o instanceof XPathCategory ) {
+ // show properties view
+ String propsId = "org.eclipse.ui.views.PropertySheet";
+ try {
+ IWorkbench work = PlatformUI.getWorkbench();
+ IWorkbenchWindow window = work.getActiveWorkbenchWindow();
+ if( !isPropertiesOnTop()) {
+ window.getActivePage().showView(propsId);
+ if( propertyPage != null ) {
+ propertyPage.selectionChanged(JBossServerView.getDefault().getViewSite().getPart(),
JBossServerView.getDefault().getExtensionFrame().getViewer().getSelection());
+ }
+ }
+ } catch( PartInitException pie ) {
+ }
+ }
+ }
+
+ protected static boolean isPropertiesOnTop() {
+ String propsId = "org.eclipse.ui.views.PropertySheet";
+ IWorkbench work = PlatformUI.getWorkbench();
+ IWorkbenchWindow window = work.getActiveWorkbenchWindow();
+ IWorkbenchPage page = window.getActivePage();
+ IViewReference ref = window.getActivePage().findViewReference(propsId);
+ if( ref == null ) return false;
+ IWorkbenchPart part = ref.getPart(false);
+ return ( part != null && page.isPartVisible(part));
+ }
+}
Show replies by date