Author: rob.stryker(a)jboss.com
Date: 2007-07-18 21:19:02 -0400 (Wed, 18 Jul 2007)
New Revision: 2514
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/DescriptorXPathViewProvider.java
Log:
Fixed a UI issue where the properties view wasn't updating and showing itself
properly.
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-07-19
00:48:10 UTC (rev 2513)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/DescriptorXPathViewProvider.java 2007-07-19
01:19:02 UTC (rev 2514)
@@ -39,8 +39,10 @@
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.ISharedImages;
+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;
@@ -63,7 +65,6 @@
import org.jboss.ide.eclipse.as.ui.views.server.extensions.ServerViewProvider;
import
org.jboss.ide.eclipse.as.ui.views.server.providers.descriptors.DescriptorXPathPropertySheetPage;
-// TODO FIX ME
public class DescriptorXPathViewProvider extends JBossServerViewExtension {
private XPathTreeContentProvider contentProvider;
@@ -90,24 +91,39 @@
JBossServerView.getDefault().getExtensionFrame().getViewer().
addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
- 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();
- window.getActivePage().showView(propsId);
- if( propertyPage != null ) {
- propertyPage.selectionChanged(JBossServerView.getDefault().getViewSite().getPart(),
JBossServerView.getDefault().getExtensionFrame().getViewer().getSelection());
- }
- } catch( PartInitException pie ) {
- }
- }
+ activatePropertiesView();
}
- });
+ });
}
+ 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);
+ IWorkbenchPart part = ref.getPart(false);
+ return ( part != null && page.isPartVisible(part));
+ }
public void setActiveCategory(XPathCategory o) {
if( o != null && o != activeCategory) {
activeCategory = o;
Show replies by date