Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 301123 | Differences between
and this patch

Collapse All | Expand All

(-)ui/org/eclipse/debug/internal/ui/views/variables/details/DefaultDetailPaneFactory.java (-1 / +11 lines)
Lines 33-39 Link Here
33
	 * @see org.eclipse.debug.internal.ui.views.variables.IDetailsFactory#createDetailsArea(java.lang.String)
33
	 * @see org.eclipse.debug.internal.ui.views.variables.IDetailsFactory#createDetailsArea(java.lang.String)
34
	 */
34
	 */
35
	public IDetailPane createDetailPane(String id) {
35
	public IDetailPane createDetailPane(String id) {
36
		return new DefaultDetailPane();
36
		if (MessageDetailPane.ID.equals(id)) {
37
			return new MessageDetailPane();
38
		} else {
39
			return new DefaultDetailPane();
40
		}
37
	}
41
	}
38
42
39
	/* (non-Javadoc)
43
	/* (non-Javadoc)
Lines 60-65 Link Here
60
		if (id.equals(DefaultDetailPane.ID)){
64
		if (id.equals(DefaultDetailPane.ID)){
61
			return DefaultDetailPane.NAME;
65
			return DefaultDetailPane.NAME;
62
		}
66
		}
67
		if (id.equals(MessageDetailPane.ID)) {
68
			return MessageDetailPane.NAME;
69
		}
63
		return null;
70
		return null;
64
	}
71
	}
65
	
72
	
Lines 71-76 Link Here
71
		if (id.equals(DefaultDetailPane.ID)){
78
		if (id.equals(DefaultDetailPane.ID)){
72
			return DefaultDetailPane.DESCRIPTION;
79
			return DefaultDetailPane.DESCRIPTION;
73
		}
80
		}
81
		if (id.equals(MessageDetailPane.ID)) {
82
			return MessageDetailPane.DESCRIPTION;
83
		}
74
		return null;
84
		return null;
75
	}
85
	}
76
86
(-)ui/org/eclipse/debug/internal/ui/views/variables/details/DetailMessages.java (+2 lines)
Lines 31-36 Link Here
31
	public static String DetailPaneProxy_1;
31
	public static String DetailPaneProxy_1;
32
	public static String DetailPaneProxy_2;
32
	public static String DetailPaneProxy_2;
33
	public static String DetailPaneProxy_3;
33
	public static String DetailPaneProxy_3;
34
	public static String MessageDetailPane_0;
35
	public static String MessageDetailPane_1;
34
	static {
36
	static {
35
		// initialize resource bundle
37
		// initialize resource bundle
36
		NLS.initializeMessages(BUNDLE_NAME, DetailMessages.class);
38
		NLS.initializeMessages(BUNDLE_NAME, DetailMessages.class);
(-)ui/org/eclipse/debug/internal/ui/views/variables/details/DetailMessages.properties (+2 lines)
Lines 26-28 Link Here
26
DetailPaneProxy_1=No details to display for the current selection.
26
DetailPaneProxy_1=No details to display for the current selection.
27
DetailPaneProxy_2=The detail pane with ID {0} did not create and return a control.
27
DetailPaneProxy_2=The detail pane with ID {0} did not create and return a control.
28
DetailPaneProxy_3=Could not create the detail pane with ID {0}
28
DetailPaneProxy_3=Could not create the detail pane with ID {0}
29
MessageDetailPane_0=Message Detail Pane
30
MessageDetailPane_1=Displays a message
(-)ui/org/eclipse/debug/internal/ui/views/variables/details/DetailPaneManager.java (+1 lines)
Lines 243-248 Link Here
243
	
243
	
244
	private DetailPaneManager(){
244
	private DetailPaneManager(){
245
		fFactoriesByPaneID = new HashMap();
245
		fFactoriesByPaneID = new HashMap();
246
		fFactoriesByPaneID.put(MessageDetailPane.ID, new DefaultDetailPaneFactory());
246
	}
247
	}
247
	
248
	
248
	public static DetailPaneManager getDefault(){
249
	public static DetailPaneManager getDefault(){
(-)ui/org/eclipse/debug/internal/ui/views/variables/details/DetailPaneProxy.java (-33 / +34 lines)
Lines 24-29 Link Here
24
import org.eclipse.debug.ui.IDetailPane3;
24
import org.eclipse.debug.ui.IDetailPane3;
25
import org.eclipse.jface.viewers.ISelectionProvider;
25
import org.eclipse.jface.viewers.ISelectionProvider;
26
import org.eclipse.jface.viewers.IStructuredSelection;
26
import org.eclipse.jface.viewers.IStructuredSelection;
27
import org.eclipse.jface.viewers.StructuredSelection;
27
import org.eclipse.swt.events.FocusAdapter;
28
import org.eclipse.swt.events.FocusAdapter;
28
import org.eclipse.swt.events.FocusEvent;
29
import org.eclipse.swt.events.FocusEvent;
29
import org.eclipse.swt.layout.GridData;
30
import org.eclipse.swt.layout.GridData;
Lines 106-114 Link Here
106
		}
107
		}
107
		
108
		
108
		String preferredPaneID = DetailPaneManager.getDefault().getPreferredPaneFromSelection(selection);
109
		String preferredPaneID = DetailPaneManager.getDefault().getPreferredPaneFromSelection(selection);
110
		if (preferredPaneID == null) {
111
			preferredPaneID = MessageDetailPane.ID;
112
			selection = new StructuredSelection(DetailMessages.DetailPaneProxy_1);
113
		}
109
		
114
		
110
		// Don't change anything if the preferred pane is the current pane
115
		// Don't change anything if the preferred pane is the current pane
111
		if (fCurrentPane != null && preferredPaneID != null && preferredPaneID.equals(fCurrentPane.getID())){
116
		if (fCurrentPane != null && preferredPaneID.equals(fCurrentPane.getID())){
112
			fCurrentPane.display(selection);
117
			fCurrentPane.display(selection);
113
			if (clean) {
118
			if (clean) {
114
				fireDirty();
119
				fireDirty();
Lines 193-234 Link Here
193
		if (fCurrentPane != null) fCurrentPane.dispose();
198
		if (fCurrentPane != null) fCurrentPane.dispose();
194
		if (fCurrentControl != null && !fCurrentControl.isDisposed()) fCurrentControl.dispose();
199
		if (fCurrentControl != null && !fCurrentControl.isDisposed()) fCurrentControl.dispose();
195
		fCurrentPane = null;
200
		fCurrentPane = null;
196
		if (paneID != null){
201
		fCurrentPane = DetailPaneManager.getDefault().getDetailPaneFromID(paneID);
197
			fCurrentPane = DetailPaneManager.getDefault().getDetailPaneFromID(paneID);
202
		if (fCurrentPane != null){
198
			if (fCurrentPane != null){
203
			final IWorkbenchPartSite workbenchPartSite = fParentContainer.getWorkbenchPartSite();
199
				final IWorkbenchPartSite workbenchPartSite = fParentContainer.getWorkbenchPartSite();
204
			fCurrentPane.init(workbenchPartSite);
200
				fCurrentPane.init(workbenchPartSite);
205
			IDetailPane3 saveable = getSaveable();
201
				IDetailPane3 saveable = getSaveable();
206
			if (saveable != null) {
202
				if (saveable != null) {
207
				Object[] listeners = fListeners.getListeners();
203
					Object[] listeners = fListeners.getListeners();
208
				for (int i = 0; i < listeners.length; i++) {
204
					for (int i = 0; i < listeners.length; i++) {
209
					saveable.addPropertyListener((IPropertyListener) listeners[i]);
205
						saveable.addPropertyListener((IPropertyListener) listeners[i]);
206
					}
207
				}
208
				fCurrentControl = fCurrentPane.createControl(fParentContainer.getParentComposite());
209
				if (fCurrentControl != null){
210
					fParentContainer.getParentComposite().layout(true);
211
					fCurrentPane.display(selection);
212
					if (fParentContainer instanceof IDetailPaneContainer2) {
213
						fCurrentControl.addFocusListener(new FocusAdapter() {
214
							public void focusGained(FocusEvent e) {
215
								updateSelectionProvider(true);
216
							}
217
							public void focusLost(FocusEvent e) {
218
								updateSelectionProvider(false);
219
							}
220
						});
221
					}					
222
				} else{
223
					createErrorLabel(DetailMessages.DetailPaneProxy_0);
224
					DebugUIPlugin.log(new CoreException(new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), MessageFormat.format(DetailMessages.DetailPaneProxy_2, new String[]{fCurrentPane.getID()})))); 
225
				}
210
				}
226
			} else {
211
			}
212
			fCurrentControl = fCurrentPane.createControl(fParentContainer.getParentComposite());
213
			if (fCurrentControl != null){
214
				fParentContainer.getParentComposite().layout(true);
215
				fCurrentPane.display(selection);
216
				if (fParentContainer instanceof IDetailPaneContainer2) {
217
					fCurrentControl.addFocusListener(new FocusAdapter() {
218
						public void focusGained(FocusEvent e) {
219
							updateSelectionProvider(true);
220
						}
221
						public void focusLost(FocusEvent e) {
222
							updateSelectionProvider(false);
223
						}
224
					});
225
				}					
226
			} else{
227
				createErrorLabel(DetailMessages.DetailPaneProxy_0);
227
				createErrorLabel(DetailMessages.DetailPaneProxy_0);
228
				DebugUIPlugin.log(new CoreException(new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), MessageFormat.format(DetailMessages.DetailPaneProxy_3, new String[]{paneID}))));
228
				DebugUIPlugin.log(new CoreException(new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), MessageFormat.format(DetailMessages.DetailPaneProxy_2, new String[]{fCurrentPane.getID()})))); 
229
			}
229
			}
230
		} else {
230
		} else {
231
			createErrorLabel(DetailMessages.DetailPaneProxy_1);
231
			createErrorLabel(DetailMessages.DetailPaneProxy_0);
232
			DebugUIPlugin.log(new CoreException(new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), MessageFormat.format(DetailMessages.DetailPaneProxy_3, new String[]{paneID}))));
232
		}
233
		}
233
	}
234
	}
234
235
(-)ui/org/eclipse/debug/internal/ui/views/variables/details/MessageDetailPane.java (+173 lines)
Added Link Here
1
/*******************************************************************************
2
 *  Copyright (c) 2010 IBM Corporation and others.
3
 *  All rights reserved. This program and the accompanying materials
4
 *  are made available under the terms of the Eclipse Public License v1.0
5
 *  which accompanies this distribution, and is available at
6
 *  http://www.eclipse.org/legal/epl-v10.html
7
 * 
8
 *  Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.debug.internal.ui.views.variables.details;
12
13
import org.eclipse.debug.internal.ui.SWTFactory;
14
import org.eclipse.debug.ui.IDebugUIConstants;
15
import org.eclipse.debug.ui.IDetailPane;
16
import org.eclipse.jface.viewers.IStructuredSelection;
17
import org.eclipse.swt.SWT;
18
import org.eclipse.swt.custom.SashForm;
19
import org.eclipse.swt.layout.GridData;
20
import org.eclipse.swt.layout.GridLayout;
21
import org.eclipse.swt.widgets.Composite;
22
import org.eclipse.swt.widgets.Control;
23
import org.eclipse.swt.widgets.Label;
24
import org.eclipse.ui.IWorkbenchPartSite;
25
26
/**
27
 * A detail pane that displays a message in a wrapped label. Not contributed by an extension
28
 * point - used internally to display messages.
29
 * 
30
 * @since 3.6
31
 */
32
public class MessageDetailPane implements IDetailPane {
33
	
34
	public static final String ID = IDebugUIConstants.PLUGIN_ID + ".detailpanes.message"; //$NON-NLS-1$
35
	public static final String NAME = DetailMessages.MessageDetailPane_0;
36
	public static final String DESCRIPTION = DetailMessages.MessageDetailPane_1;
37
		
38
	private SashForm fSash;
39
	/**
40
	 * Top level composite that remains as orientation changes.
41
	 */
42
	private Composite fDetailsContainer;
43
	/**
44
	 * Inner composite containing separator and editor composite that gets
45
	 * disposed/created as orientation changes with *no* margins (so separator
46
	 * spans entire width/height of the pane).
47
	 */
48
	private Composite fSeparatorContainer; 
49
	/**
50
	 * Cached orientation currently being displayed
51
	 */
52
	private int fOrientation = -1;
53
	/**
54
	 * Composite that contains the editor that has margins.
55
	 */
56
	private Composite fControlParent;
57
	
58
	/**
59
	 * Label control
60
	 */
61
	private Label fLabel;
62
	
63
	/* (non-Javadoc)
64
	 * @see org.eclipse.debug.ui.IDetailPane#init(org.eclipse.ui.IWorkbenchPartSite)
65
	 */
66
	public void init(IWorkbenchPartSite partSite) {
67
	}
68
	
69
	/* (non-Javadoc)
70
	 * @see org.eclipse.debug.ui.IDetailPane#dispose()
71
	 */
72
	public void dispose() {
73
		fSash = null;
74
		fDetailsContainer.dispose();
75
	}	
76
77
	/* (non-Javadoc)
78
	 * @see org.eclipse.debug.ui.IDetailPane#createControl(org.eclipse.swt.widgets.Composite)
79
	 */
80
	public Control createControl(Composite parent) {
81
		fDetailsContainer = SWTFactory.createComposite(parent, parent.getFont(), 1, 1, GridData.FILL_BOTH, 0, 0);
82
		if (parent instanceof SashForm) {
83
			fSash = (SashForm) parent;
84
		}
85
		createDetails();
86
		return fDetailsContainer;
87
	}
88
	
89
	/**
90
	 * Creates the details area with a separator based on orientation.
91
	 */
92
	protected void createDetails() {
93
		int parentOrientation = SWT.HORIZONTAL;
94
		if (fSash != null) {
95
			parentOrientation = fSash.getOrientation();
96
		}
97
		String message = ""; //$NON-NLS-1$
98
		if (fLabel != null) {
99
			message = fLabel.getText();
100
		}
101
		if (parentOrientation == fOrientation) {
102
			return;
103
		}
104
		if (fSeparatorContainer != null) {
105
			fSeparatorContainer.dispose();
106
		}
107
		if (parentOrientation == SWT.VERTICAL) {
108
			fSeparatorContainer = SWTFactory.createComposite(fDetailsContainer, fDetailsContainer.getFont(), 1, 1, GridData.FILL_BOTH, 0, 0);
109
			Label sep = new Label(fSeparatorContainer, SWT.SEPARATOR | SWT.HORIZONTAL);
110
			sep.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
111
			GridLayout layout= (GridLayout)fSeparatorContainer.getLayout();
112
			layout.marginHeight= 0;
113
			layout.marginWidth= 0;
114
			fControlParent = SWTFactory.createComposite(fSeparatorContainer, 1, 1, GridData.FILL_BOTH);
115
		} else {
116
			fSeparatorContainer = SWTFactory.createComposite(fDetailsContainer, fDetailsContainer.getFont(), 2, 1, GridData.FILL_BOTH, 0, 0);
117
			Label sep= new Label(fSeparatorContainer, SWT.SEPARATOR | SWT.VERTICAL);
118
			sep.setLayoutData(new GridData(SWT.TOP, SWT.FILL, false, true));
119
			GridLayout layout= (GridLayout)fSeparatorContainer.getLayout();
120
			layout.marginHeight= 0;
121
			layout.marginWidth= 0;
122
			fControlParent = SWTFactory.createComposite(fSeparatorContainer, 1, 1, GridData.FILL_BOTH);
123
		}
124
		fOrientation = parentOrientation;
125
		fLabel = SWTFactory.createWrapLabel(fControlParent, message, 1);
126
		fDetailsContainer.layout(true);
127
	}
128
	
129
	/* (non-Javadoc)
130
	 * @see org.eclipse.debug.ui.IDetailPane#setFocus()
131
	 */
132
	public boolean setFocus() {
133
		return false;
134
	}
135
		
136
	/* (non-Javadoc)
137
	 * @see org.eclipse.debug.ui.IDetailPane#display(org.eclipse.jface.viewers.IStructuredSelection)
138
	 */
139
	public void display(IStructuredSelection selection) {
140
		// re-create controls if the layout has changed
141
		if (selection != null && selection.size() == 1) {
142
			Object input = selection.getFirstElement();
143
			if (input instanceof String) {
144
				createDetails();
145
				String message = (String) input;
146
				fLabel.setText(message);
147
				fDetailsContainer.layout(true);
148
			}
149
		}
150
	}
151
152
	/* (non-Javadoc)
153
	 * @see org.eclipse.debug.ui.IDetailPane#getID()
154
	 */
155
	public String getID() {
156
		return ID;
157
	}
158
159
	/* (non-Javadoc)
160
	 * @see org.eclipse.debug.ui.IDetailPane#getName()
161
	 */
162
	public String getName() {
163
		return NAME;
164
	}
165
166
	/* (non-Javadoc)
167
	 * @see org.eclipse.debug.ui.IDetailPane#getDescription()
168
	 */
169
	public String getDescription() {
170
		return DESCRIPTION;
171
	}
172
173
}

Return to bug 301123