Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2013-11-19 04:36:01 -0500
committerUwe Stieber2013-11-19 04:37:56 -0500
commit46afd862a66197df3a2260d2d912e7e12438b78b (patch)
tree8c86a177586054dcbccec519f88de1f9df153675 /target_explorer
parent181a4ce486e6acd8ced7a5764f39997f4ef9a877 (diff)
downloadorg.eclipse.tcf-46afd862a66197df3a2260d2d912e7e12438b78b.tar.gz
org.eclipse.tcf-46afd862a66197df3a2260d2d912e7e12438b78b.tar.xz
org.eclipse.tcf-46afd862a66197df3a2260d2d912e7e12438b78b.zip
Target Explorer: Fix part listener not installed for default window
Diffstat (limited to 'target_explorer')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/internal/listeners/PartListener.java3
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/listeners/AbstractWindowListener.java252
2 files changed, 133 insertions, 122 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/internal/listeners/PartListener.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/internal/listeners/PartListener.java
index e12f3cf02..5655086a2 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/internal/listeners/PartListener.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/internal/listeners/PartListener.java
@@ -44,6 +44,9 @@ public class PartListener implements IPartListener2 {
*/
@Override
public void partActivated(IWorkbenchPartReference partRef) {
+ if (IDebugUIConstants.ID_DEBUG_VIEW.equals(partRef.getId()) && partRef instanceof IViewReference && registrations.get(partRef) == null) {
+ partOpened(partRef);
+ }
}
/* (non-Javadoc)
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/listeners/AbstractWindowListener.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/listeners/AbstractWindowListener.java
index cba524a21..8addd6a99 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/listeners/AbstractWindowListener.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.views/src/org/eclipse/tcf/te/ui/views/listeners/AbstractWindowListener.java
@@ -1,122 +1,130 @@
-/*******************************************************************************
- * Copyright (c) 2013 Wind River Systems, Inc. and others. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tcf.te.ui.views.listeners;
-
-import org.eclipse.ui.IPartListener2;
-import org.eclipse.ui.IPartService;
-import org.eclipse.ui.IPerspectiveListener;
-import org.eclipse.ui.IWindowListener;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPartReference;
-import org.eclipse.ui.IWorkbenchWindow;
-
-/**
- * Abstract window listener implementation.
- */
-public abstract class AbstractWindowListener implements IWindowListener {
- // The part listener instance
- protected final IPartListener2 partListener;
- // The perspective listener instance
- protected final IPerspectiveListener perspectiveListener;
-
- /**
- * Constructor
- */
- public AbstractWindowListener() {
- // Create the part listener instance
- partListener = createPartListener();
- // Create the perspective listener instance
- perspectiveListener = createPerspectiveListener();
- }
-
- /**
- * Creates a new part listener instance.
- * <p>
- * <b>Note:</b> The default implementation returns <code>null</code>.
- *
- * @return The part listener instance or <code>null</code>.
- */
- protected IPartListener2 createPartListener() {
- return null;
- }
-
- /**
- * Creates a new perspective listener instance.
- * <p>
- * <b>Note:</b> The default implementation returns <code>null</code>.
- *
- * @return The perspective listener instance or <code>null</code>.
- */
- protected IPerspectiveListener createPerspectiveListener() {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWindowListener#windowActivated(org.eclipse.ui.IWorkbenchWindow)
- */
- @Override
- public void windowActivated(IWorkbenchWindow window) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWindowListener#windowDeactivated(org.eclipse.ui.IWorkbenchWindow)
- */
- @Override
- public void windowDeactivated(IWorkbenchWindow window) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWindowListener#windowClosed(org.eclipse.ui.IWorkbenchWindow)
- */
- @Override
- public void windowClosed(IWorkbenchWindow window) {
- // On close, remove the listeners from the window
- if (window != null) {
- if (window.getPartService() != null && partListener != null) {
- window.getPartService().removePartListener(partListener);
- }
-
- if (perspectiveListener != null) window.removePerspectiveListener(perspectiveListener);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWindowListener#windowOpened(org.eclipse.ui.IWorkbenchWindow)
- */
- @Override
- public void windowOpened(IWorkbenchWindow window) {
- if (window != null) {
- // On open, register the part listener to the window
- if (window.getPartService() != null && partListener != null) {
- // Get the part service
- IPartService service = window.getPartService();
- // Unregister the part listener, just in case
- service.removePartListener(partListener);
- // Register the part listener
- service.addPartListener(partListener);
- // Signal the active part to the part listener after registration
- IWorkbenchPage page = window.getActivePage();
- if (page != null) {
- IWorkbenchPartReference partRef = page.getActivePartReference();
- if (partRef != null) partListener.partActivated(partRef);
- }
- }
-
- // Register the perspective listener
- if (perspectiveListener != null) {
- window.addPerspectiveListener(perspectiveListener);
- // Signal the active perspective to the perspective listener after registration
- if (window.getActivePage() != null) {
- perspectiveListener.perspectiveActivated(window.getActivePage(), window.getActivePage().getPerspective());
- }
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2013 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.ui.views.listeners;
+
+import org.eclipse.ui.IPartListener2;
+import org.eclipse.ui.IPartService;
+import org.eclipse.ui.IPerspectiveListener;
+import org.eclipse.ui.IWindowListener;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPartReference;
+import org.eclipse.ui.IWorkbenchWindow;
+
+/**
+ * Abstract window listener implementation.
+ */
+public abstract class AbstractWindowListener implements IWindowListener {
+ // The part listener instance
+ protected final IPartListener2 partListener;
+ // The perspective listener instance
+ protected final IPerspectiveListener perspectiveListener;
+
+ // Flag to remember if the initialization is done or not
+ private boolean initialized = false;
+
+ /**
+ * Constructor
+ */
+ public AbstractWindowListener() {
+ // Create the part listener instance
+ partListener = createPartListener();
+ // Create the perspective listener instance
+ perspectiveListener = createPerspectiveListener();
+ }
+
+ /**
+ * Creates a new part listener instance.
+ * <p>
+ * <b>Note:</b> The default implementation returns <code>null</code>.
+ *
+ * @return The part listener instance or <code>null</code>.
+ */
+ protected IPartListener2 createPartListener() {
+ return null;
+ }
+
+ /**
+ * Creates a new perspective listener instance.
+ * <p>
+ * <b>Note:</b> The default implementation returns <code>null</code>.
+ *
+ * @return The perspective listener instance or <code>null</code>.
+ */
+ protected IPerspectiveListener createPerspectiveListener() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWindowListener#windowActivated(org.eclipse.ui.IWorkbenchWindow)
+ */
+ @Override
+ public void windowActivated(IWorkbenchWindow window) {
+ if (!initialized && window != null) {
+ windowOpened(window);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWindowListener#windowDeactivated(org.eclipse.ui.IWorkbenchWindow)
+ */
+ @Override
+ public void windowDeactivated(IWorkbenchWindow window) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWindowListener#windowClosed(org.eclipse.ui.IWorkbenchWindow)
+ */
+ @Override
+ public void windowClosed(IWorkbenchWindow window) {
+ // On close, remove the listeners from the window
+ if (window != null) {
+ if (window.getPartService() != null && partListener != null) {
+ window.getPartService().removePartListener(partListener);
+ }
+
+ if (perspectiveListener != null) window.removePerspectiveListener(perspectiveListener);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWindowListener#windowOpened(org.eclipse.ui.IWorkbenchWindow)
+ */
+ @Override
+ public void windowOpened(IWorkbenchWindow window) {
+ if (window != null) {
+ // On open, register the part listener to the window
+ if (window.getPartService() != null && partListener != null) {
+ // Get the part service
+ IPartService service = window.getPartService();
+ // Unregister the part listener, just in case
+ service.removePartListener(partListener);
+ // Register the part listener
+ service.addPartListener(partListener);
+ // Signal the active part to the part listener after registration
+ IWorkbenchPage page = window.getActivePage();
+ if (page != null) {
+ IWorkbenchPartReference partRef = page.getActivePartReference();
+ if (partRef != null) partListener.partActivated(partRef);
+ }
+ }
+
+ // Register the perspective listener
+ if (perspectiveListener != null) {
+ window.addPerspectiveListener(perspectiveListener);
+ // Signal the active perspective to the perspective listener after registration
+ if (window.getActivePage() != null) {
+ perspectiveListener.perspectiveActivated(window.getActivePage(), window.getActivePage().getPerspective());
+ }
+ }
+
+ initialized = true;
+ }
+ }
+}

Back to the top