Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarin Wright2009-12-21 19:09:22 +0000
committerDarin Wright2009-12-21 19:09:22 +0000
commit4262ac3c400110d31876c7d23406fade05e65a6c (patch)
tree928361b0e453bb3a9f44dac963ffd6595b447a20 /org.eclipse.debug.ui/ui/org/eclipse/debug
parent113e9c0626d04e2fdcf1b69ff408a8275fdcde4b (diff)
downloadeclipse.platform.debug-4262ac3c400110d31876c7d23406fade05e65a6c.tar.gz
eclipse.platform.debug-4262ac3c400110d31876c7d23406fade05e65a6c.tar.xz
eclipse.platform.debug-4262ac3c400110d31876c7d23406fade05e65a6c.zip
Bug 290288 - Detail panes/editors for Java breakpoints
Diffstat (limited to 'org.eclipse.debug.ui/ui/org/eclipse/debug')
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java44
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DetailPaneProxy.java127
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDetailPane3.java46
3 files changed, 214 insertions, 3 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java
index aa37726b7..3ef7c511f 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java
@@ -100,6 +100,8 @@ import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.IPerspectiveDescriptor;
import org.eclipse.ui.IPerspectiveListener;
+import org.eclipse.ui.IPropertyListener;
+import org.eclipse.ui.ISaveablePart;
import org.eclipse.ui.IViewSite;
import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.IWorkbenchPage;
@@ -120,7 +122,7 @@ import org.eclipse.ui.texteditor.IUpdate;
public class VariablesView extends AbstractDebugView implements IDebugContextListener,
IPropertyChangeListener, IDebugExceptionHandler,
IPerspectiveListener, IModelChangedListener,
- IViewerUpdateListener, IDetailPaneContainer2 {
+ IViewerUpdateListener, IDetailPaneContainer2, ISaveablePart {
/**
* Selection provider wrapping an exchangeable active selection provider.
@@ -461,6 +463,11 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
getSite().setSelectionProvider(fSelectionProvider);
fDetailPane = new DetailPaneProxy(this);
+ fDetailPane.addProperyListener(new IPropertyListener() {
+ public void propertyChanged(Object source, int propId) {
+ firePropertyChange(propId);
+ }
+ });
fDetailPane.display(null); // Bring up the default pane so the user doesn't see an empty composite
createOrientationActions(variablesViewer);
@@ -1228,4 +1235,39 @@ public class VariablesView extends AbstractDebugView implements IDebugContextLis
// change active provider
fSelectionProvider.setActiveProvider(provider);
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.ISaveablePart#doSave(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public void doSave(IProgressMonitor monitor) {
+ fDetailPane.doSave(monitor);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.ISaveablePart#doSaveAs()
+ */
+ public void doSaveAs() {
+ fDetailPane.doSaveAs();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.ISaveablePart#isDirty()
+ */
+ public boolean isDirty() {
+ return fDetailPane.isDirty();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.ISaveablePart#isSaveAsAllowed()
+ */
+ public boolean isSaveAsAllowed() {
+ return fDetailPane.isSaveAsAllowed();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.ISaveablePart#isSaveOnCloseNeeded()
+ */
+ public boolean isSaveOnCloseNeeded() {
+ return fDetailPane.isSaveOnCloseNeeded();
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DetailPaneProxy.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DetailPaneProxy.java
index 251e5c628..5dd5443d9 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DetailPaneProxy.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/details/DetailPaneProxy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2008 IBM Corporation and others.
+ * Copyright (c) 2006, 2009 IBM Corporation 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
@@ -13,11 +13,14 @@ package org.eclipse.debug.internal.ui.views.variables.details;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.ListenerList;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.ui.IDetailPane;
import org.eclipse.debug.ui.IDetailPane2;
+import org.eclipse.debug.ui.IDetailPane3;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.SWT;
@@ -26,6 +29,8 @@ import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.IPropertyListener;
+import org.eclipse.ui.ISaveablePart;
import org.eclipse.ui.IWorkbenchPartSite;
import com.ibm.icu.text.MessageFormat;
@@ -43,7 +48,7 @@ import com.ibm.icu.text.MessageFormat;
* @see DetailPaneManager
* @since 3.3
*/
-public class DetailPaneProxy {
+public class DetailPaneProxy implements ISaveablePart {
/**
* The IDetailPane currently being used to display detailed information.
@@ -61,6 +66,11 @@ public class DetailPaneProxy {
private IDetailPaneContainer fParentContainer;
/**
+ * Property listeners
+ */
+ private ListenerList fListeners = new ListenerList();
+
+ /**
* Constructor that sets up the detail pane for a view. Note that no default pane
* is created, so a control will not be created until <code>display</code> is called.
*
@@ -80,8 +90,18 @@ public class DetailPaneProxy {
*/
public void display(IStructuredSelection selection){
+ IDetailPane3 saveable = getSaveable();
+ boolean clean = false;
+ if (saveable != null && saveable.isDirty() && saveable.isSaveOnCloseNeeded()) {
+ // save the contents before changing
+ saveable.doSave(null);
+ }
+
if ((selection == null || selection.isEmpty()) && fCurrentPane != null){
fCurrentPane.display(selection);
+ if (clean) {
+ fireDirty();
+ }
return;
}
@@ -90,6 +110,9 @@ public class DetailPaneProxy {
// Don't change anything if the preferred pane is the current pane
if (fCurrentPane != null && preferredPaneID != null && preferredPaneID.equals(fCurrentPane.getID())){
fCurrentPane.display(selection);
+ if (clean) {
+ fireDirty();
+ }
return;
}
@@ -97,10 +120,23 @@ public class DetailPaneProxy {
// Inform the container that a new detail pane is being used
fParentContainer.paneChanged(preferredPaneID);
+ if (clean) {
+ fireDirty();
+ }
}
/**
+ * Fires dirty property change.
+ */
+ private void fireDirty() {
+ Object[] listeners = fListeners.getListeners();
+ for (int i = 0; i < listeners.length; i++) {
+ ((IPropertyListener)listeners[i]).propertyChanged(this, PROP_DIRTY);
+ }
+ }
+
+ /**
* Tells the current detail pane (if one exists) that it is gaining focus.
*
* @return true if the current pane successfully set focus to a control, false otherwise
@@ -162,6 +198,13 @@ public class DetailPaneProxy {
if (fCurrentPane != null){
final IWorkbenchPartSite workbenchPartSite = fParentContainer.getWorkbenchPartSite();
fCurrentPane.init(workbenchPartSite);
+ IDetailPane3 saveable = getSaveable();
+ if (saveable != null) {
+ Object[] listeners = fListeners.getListeners();
+ for (int i = 0; i < listeners.length; i++) {
+ saveable.addPropertyListener((IPropertyListener) listeners[i]);
+ }
+ }
fCurrentControl = fCurrentPane.createControl(fParentContainer.getParentComposite());
if (fCurrentControl != null){
fParentContainer.getParentComposite().layout(true);
@@ -225,5 +268,85 @@ public class DetailPaneProxy {
fCurrentControl = errorLabel;
fParentContainer.getParentComposite().layout();
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.ISaveablePart#doSave(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public void doSave(IProgressMonitor monitor) {
+ ISaveablePart saveable = getSaveable();
+ if (saveable != null) {
+ saveable.doSave(monitor);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.ISaveablePart#doSaveAs()
+ */
+ public void doSaveAs() {
+ ISaveablePart saveable = getSaveable();
+ if (saveable != null) {
+ saveable.doSaveAs();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.ISaveablePart#isDirty()
+ */
+ public boolean isDirty() {
+ ISaveablePart saveable = getSaveable();
+ if (saveable != null) {
+ return saveable.isDirty();
+ }
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.ISaveablePart#isSaveAsAllowed()
+ */
+ public boolean isSaveAsAllowed() {
+ ISaveablePart saveable = getSaveable();
+ if (saveable != null) {
+ return saveable.isSaveAsAllowed();
+ }
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.ISaveablePart#isSaveOnCloseNeeded()
+ */
+ public boolean isSaveOnCloseNeeded() {
+ ISaveablePart saveable = getSaveable();
+ if (saveable != null) {
+ return saveable.isSaveOnCloseNeeded();
+ }
+ return false;
+ }
+ /**
+ * Returns the active saveable part or <code>null</code> if none.
+ *
+ * @return saveable part or <code>null</code>
+ */
+ IDetailPane3 getSaveable() {
+ if (fCurrentPane instanceof IDetailPane3) {
+ return (IDetailPane3) fCurrentPane;
+ }
+ return null;
+ }
+
+ public void addProperyListener(IPropertyListener listener) {
+ fListeners.add(listener);
+ IDetailPane3 saveable = getSaveable();
+ if (saveable != null) {
+ saveable.addPropertyListener(listener);
+ }
+ }
+
+ public void removePropertyListener(IPropertyListener listener) {
+ fListeners.remove(listener);
+ IDetailPane3 saveable = getSaveable();
+ if (saveable != null) {
+ saveable.removePropertyListener(listener);
+ }
+ }
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDetailPane3.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDetailPane3.java
new file mode 100644
index 000000000..fd299c9c4
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDetailPane3.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2009 IBM Corporation 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.ui;
+
+import org.eclipse.ui.IPropertyListener;
+import org.eclipse.ui.ISaveablePart;
+import org.eclipse.ui.IWorkbenchPartConstants;
+
+/**
+ * An extension to the detail pane interface which allows implementors to
+ * save contents of the details pane.
+ * <p>
+ * Clients may implement this interface.
+ * </p>
+ *
+ * @since 3.6
+ */
+public interface IDetailPane3 extends IDetailPane, ISaveablePart {
+
+ /**
+ * Adds a listener for changes to properties in this detail pane.
+ * Has no effect if an identical listener is already registered.
+ * <p>
+ * The property ids are defined in {@link IWorkbenchPartConstants}.
+ * </p>
+ *
+ * @param listener a property listener
+ */
+ public void addPropertyListener(IPropertyListener listener);
+
+ /**
+ * Removes the given property listener from this workbench part.
+ * Has no affect if an identical listener is not registered.
+ *
+ * @param listener a property listener
+ */
+ public void removePropertyListener(IPropertyListener listener);
+}

Back to the top