|
Lines 1-5
Link Here
|
| 1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2006, 2007 IBM Corporation and others. |
2 |
* Copyright (c) 2006, 2008 IBM Corporation and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
|
Lines 7-12
Link Here
|
| 7 |
* |
7 |
* |
| 8 |
* Contributors: |
8 |
* Contributors: |
| 9 |
* IBM Corporation - initial API and implementation |
9 |
* IBM Corporation - initial API and implementation |
|
|
10 |
* anton.leherbauer@windriver.com - bug 212389 [CommonNavigator] working set issues: |
| 11 |
* missing project, window working set inconsistency |
| 10 |
*******************************************************************************/ |
12 |
*******************************************************************************/ |
| 11 |
|
13 |
|
| 12 |
package org.eclipse.ui.internal.navigator.resources.actions; |
14 |
package org.eclipse.ui.internal.navigator.resources.actions; |
|
Lines 17-25
Link Here
|
| 17 |
import org.eclipse.jface.viewers.StructuredViewer; |
19 |
import org.eclipse.jface.viewers.StructuredViewer; |
| 18 |
import org.eclipse.ui.IActionBars; |
20 |
import org.eclipse.ui.IActionBars; |
| 19 |
import org.eclipse.ui.IMemento; |
21 |
import org.eclipse.ui.IMemento; |
|
|
22 |
import org.eclipse.ui.IWorkbenchPreferenceConstants; |
| 20 |
import org.eclipse.ui.IWorkingSet; |
23 |
import org.eclipse.ui.IWorkingSet; |
| 21 |
import org.eclipse.ui.IWorkingSetManager; |
24 |
import org.eclipse.ui.IWorkingSetManager; |
| 22 |
import org.eclipse.ui.PlatformUI; |
25 |
import org.eclipse.ui.PlatformUI; |
|
|
26 |
import org.eclipse.ui.ResourceWorkingSetFilter; |
| 23 |
import org.eclipse.ui.actions.WorkingSetFilterActionGroup; |
27 |
import org.eclipse.ui.actions.WorkingSetFilterActionGroup; |
| 24 |
import org.eclipse.ui.internal.navigator.workingsets.WorkingSetsContentProvider; |
28 |
import org.eclipse.ui.internal.navigator.workingsets.WorkingSetsContentProvider; |
| 25 |
import org.eclipse.ui.navigator.CommonActionProvider; |
29 |
import org.eclipse.ui.navigator.CommonActionProvider; |
|
Lines 30-42
Link Here
|
| 30 |
|
34 |
|
| 31 |
/** |
35 |
/** |
| 32 |
* @since 3.2 |
36 |
* @since 3.2 |
| 33 |
* |
37 |
* |
| 34 |
*/ |
38 |
*/ |
| 35 |
public class WorkingSetActionProvider extends CommonActionProvider { |
39 |
public class WorkingSetActionProvider extends CommonActionProvider { |
| 36 |
|
40 |
|
| 37 |
private static final String TAG_CURRENT_WORKING_SET_NAME = "currentWorkingSetName"; //$NON-NLS-1$ |
41 |
private static final String TAG_CURRENT_WORKING_SET_NAME = "currentWorkingSetName"; //$NON-NLS-1$ |
| 38 |
|
42 |
|
| 39 |
private boolean contributedToViewMenu = false; |
43 |
private boolean contributedToViewMenu = false; |
| 40 |
|
44 |
|
| 41 |
private StructuredViewer viewer; |
45 |
private StructuredViewer viewer; |
| 42 |
|
46 |
|
|
Lines 49-57
Link Here
|
| 49 |
|
53 |
|
| 50 |
private IExtensionStateModel extensionStateModel; |
54 |
private IExtensionStateModel extensionStateModel; |
| 51 |
|
55 |
|
|
|
56 |
private final ResourceWorkingSetFilter workingSetFilter = new ResourceWorkingSetFilter(); |
| 57 |
private boolean filterAdded; |
| 58 |
|
| 59 |
private boolean emptyWorkingSet; |
| 60 |
private IWorkingSet workingSet; |
| 61 |
|
| 62 |
private IPropertyChangeListener topLevelModeListener; |
| 63 |
|
| 64 |
|
| 52 |
/** |
65 |
/** |
| 53 |
* Provides a smart listener to monitor changes to the Working Set Manager. |
66 |
* Provides a smart listener to monitor changes to the Working Set Manager. |
| 54 |
* |
67 |
* |
| 55 |
*/ |
68 |
*/ |
| 56 |
public class WorkingSetManagerListener implements IPropertyChangeListener { |
69 |
public class WorkingSetManagerListener implements IPropertyChangeListener { |
| 57 |
|
70 |
|
|
Lines 59-104
Link Here
|
| 59 |
|
72 |
|
| 60 |
/* |
73 |
/* |
| 61 |
* (non-Javadoc) |
74 |
* (non-Javadoc) |
| 62 |
* |
75 |
* |
| 63 |
* @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) |
76 |
* @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) |
| 64 |
*/ |
77 |
*/ |
| 65 |
public void propertyChange(PropertyChangeEvent event) { |
78 |
public void propertyChange(PropertyChangeEvent event) { |
| 66 |
|
79 |
String property = event.getProperty(); |
| 67 |
Object input = viewer.getInput(); |
80 |
Object newValue = event.getNewValue(); |
| 68 |
if (input instanceof IWorkingSet) { |
81 |
Object oldValue = event.getOldValue(); |
| 69 |
IWorkingSet workingSet = (IWorkingSet) input; |
82 |
|
| 70 |
|
83 |
if (IWorkingSetManager.CHANGE_WORKING_SET_REMOVE.equals(property) && oldValue == workingSet) { |
| 71 |
String property = event.getProperty(); |
84 |
setWorkingSet(null); |
| 72 |
Object newValue = event.getNewValue(); |
85 |
} else if (IWorkingSetManager.CHANGE_WORKING_SET_NAME_CHANGE.equals(property) && newValue == workingSet) { |
| 73 |
Object oldValue = event.getOldValue(); |
86 |
} else if (IWorkingSetManager.CHANGE_WORKING_SET_CONTENT_CHANGE.equals(property) && newValue == workingSet) { |
| 74 |
|
87 |
if (workingSet.isAggregateWorkingSet() && workingSet.isEmpty()) { |
| 75 |
if (IWorkingSetManager.CHANGE_WORKING_SET_REMOVE.equals(property) && oldValue == workingSet) { |
88 |
// act as if the working set has been made null |
| 76 |
// setWorkingSet(null); |
89 |
if (!emptyWorkingSet) { |
| 77 |
if (viewer != null) { |
90 |
emptyWorkingSet = true; |
| 78 |
viewer.setInput(originalViewerInput); |
91 |
workingSetFilter.setWorkingSet(null); |
| 79 |
} |
92 |
} |
| 80 |
} else if (IWorkingSetManager.CHANGE_WORKING_SET_NAME_CHANGE.equals(property) && newValue == workingSet) { |
93 |
} else { |
| 81 |
} else if (IWorkingSetManager.CHANGE_WORKING_SET_CONTENT_CHANGE.equals(property) && newValue == workingSet) { |
94 |
// we've gone from empty to non-empty on our set. |
| 82 |
// if (workingSet.isAggregateWorkingSet() && workingSet.isEmpty()) { |
95 |
// Restore it. |
| 83 |
// // act as if the working set has been made null |
96 |
if (emptyWorkingSet) { |
| 84 |
// if (!emptyWorkingSet) { |
97 |
emptyWorkingSet = false; |
| 85 |
// emptyWorkingSet = true; |
98 |
workingSetFilter.setWorkingSet(workingSet); |
| 86 |
// workingSetFilter.setWorkingSet(null); |
|
|
| 87 |
// } |
| 88 |
// } else { |
| 89 |
// // we've gone from empty to non-empty on our set. |
| 90 |
// // Restore it. |
| 91 |
// if (emptyWorkingSet) { |
| 92 |
// emptyWorkingSet = false; |
| 93 |
// workingSetFilter.setWorkingSet(workingSet); |
| 94 |
// } |
| 95 |
// } |
| 96 |
if (viewer != null) { |
| 97 |
viewer.refresh(); |
| 98 |
} |
99 |
} |
| 99 |
} |
100 |
} |
|
|
101 |
System.out.println("change working set: " + newValue); //$NON-NLS-1$ |
| 102 |
if (viewer != null) { |
| 103 |
viewer.refresh(); |
| 104 |
} |
| 100 |
} |
105 |
} |
| 101 |
|
|
|
| 102 |
} |
106 |
} |
| 103 |
|
107 |
|
| 104 |
/** |
108 |
/** |
|
Lines 125-151
Link Here
|
| 125 |
private IPropertyChangeListener filterChangeListener = new IPropertyChangeListener() { |
129 |
private IPropertyChangeListener filterChangeListener = new IPropertyChangeListener() { |
| 126 |
/* |
130 |
/* |
| 127 |
* (non-Javadoc) |
131 |
* (non-Javadoc) |
| 128 |
* |
132 |
* |
| 129 |
* @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) |
133 |
* @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) |
| 130 |
*/ |
134 |
*/ |
| 131 |
public void propertyChange(PropertyChangeEvent event) { |
135 |
public void propertyChange(PropertyChangeEvent event) { |
| 132 |
IWorkingSet oldWorkingSet = (IWorkingSet) event.getOldValue(); |
|
|
| 133 |
IWorkingSet newWorkingSet = (IWorkingSet) event.getNewValue(); |
136 |
IWorkingSet newWorkingSet = (IWorkingSet) event.getNewValue(); |
| 134 |
|
137 |
|
| 135 |
|
|
|
| 136 |
if (newWorkingSet != null && !contentService.isActive(WorkingSetsContentProvider.EXTENSION_ID)) { |
138 |
if (newWorkingSet != null && !contentService.isActive(WorkingSetsContentProvider.EXTENSION_ID)) { |
| 137 |
contentService.getActivationService().activateExtensions(new String[]{WorkingSetsContentProvider.EXTENSION_ID}, false); |
139 |
contentService.getActivationService().activateExtensions(new String[]{WorkingSetsContentProvider.EXTENSION_ID}, false); |
| 138 |
contentService.getActivationService().persistExtensionActivations(); |
140 |
contentService.getActivationService().persistExtensionActivations(); |
| 139 |
} |
141 |
} |
| 140 |
|
142 |
|
| 141 |
if (viewer != null) { |
143 |
System.out.println("filter change listener: " + newWorkingSet); //$NON-NLS-1$ |
| 142 |
if (newWorkingSet == null) { |
144 |
setWorkingSet(newWorkingSet); |
| 143 |
viewer.setInput(ResourcesPlugin.getWorkspace().getRoot()); |
|
|
| 144 |
} else if(oldWorkingSet != newWorkingSet) { |
| 145 |
viewer.setInput(newWorkingSet); |
| 146 |
} |
| 147 |
} |
| 148 |
|
| 149 |
} |
145 |
} |
| 150 |
}; |
146 |
}; |
| 151 |
|
147 |
|
|
Lines 153-159
Link Here
|
| 153 |
|
149 |
|
| 154 |
private IExtensionActivationListener activationListener = new IExtensionActivationListener() { |
150 |
private IExtensionActivationListener activationListener = new IExtensionActivationListener() { |
| 155 |
|
151 |
|
| 156 |
private IWorkingSet workingSet; |
152 |
private IWorkingSet savedWorkingSet; |
| 157 |
|
153 |
|
| 158 |
public void onExtensionActivation(String aViewerId, String[] theNavigatorExtensionIds, boolean isActive) { |
154 |
public void onExtensionActivation(String aViewerId, String[] theNavigatorExtensionIds, boolean isActive) { |
| 159 |
|
155 |
|
|
Lines 162-189
Link Here
|
| 162 |
if (isActive) { |
158 |
if (isActive) { |
| 163 |
extensionStateModel = contentService.findStateModel(WorkingSetsContentProvider.EXTENSION_ID); |
159 |
extensionStateModel = contentService.findStateModel(WorkingSetsContentProvider.EXTENSION_ID); |
| 164 |
workingSetRootModeActionGroup.setStateModel(extensionStateModel); |
160 |
workingSetRootModeActionGroup.setStateModel(extensionStateModel); |
|
|
161 |
extensionStateModel.addPropertyChangeListener(topLevelModeListener); |
| 165 |
|
162 |
|
| 166 |
if (workingSet != null) { |
163 |
if (savedWorkingSet != null) { |
| 167 |
viewer.setInput(workingSet); |
164 |
setWorkingSet(savedWorkingSet); |
| 168 |
workingSetActionGroup.setWorkingSet(workingSet); |
165 |
workingSetActionGroup.setWorkingSet(savedWorkingSet); |
| 169 |
workingSetRootModeActionGroup.setShowTopLevelWorkingSets(true); |
|
|
| 170 |
} |
166 |
} |
| 171 |
managerChangeListener.listen(); |
167 |
managerChangeListener.listen(); |
| 172 |
|
|
|
| 173 |
|
168 |
|
| 174 |
} else { |
169 |
} else { |
| 175 |
Object input = viewer.getInput(); |
170 |
savedWorkingSet= workingSet; |
| 176 |
if (input instanceof IWorkingSet) { |
171 |
setWorkingSet(null); |
| 177 |
workingSet = (IWorkingSet) input; |
|
|
| 178 |
if (viewer != null && input != originalViewerInput) { |
| 179 |
viewer.setInput(originalViewerInput); |
| 180 |
} |
| 181 |
} else { |
| 182 |
workingSet = null; |
| 183 |
} |
| 184 |
managerChangeListener.ignore(); |
172 |
managerChangeListener.ignore(); |
| 185 |
workingSetActionGroup.setWorkingSet(null); |
173 |
workingSetActionGroup.setWorkingSet(null); |
| 186 |
workingSetRootModeActionGroup.setShowTopLevelWorkingSets(false); |
174 |
workingSetRootModeActionGroup.setShowTopLevelWorkingSets(false); |
|
|
175 |
extensionStateModel.removePropertyChangeListener(topLevelModeListener); |
| 187 |
|
176 |
|
| 188 |
} |
177 |
} |
| 189 |
} |
178 |
} |
|
Lines 192-202
Link Here
|
| 192 |
|
181 |
|
| 193 |
}; |
182 |
}; |
| 194 |
|
183 |
|
| 195 |
|
|
|
| 196 |
|
184 |
|
| 197 |
/* |
185 |
/* |
| 198 |
* (non-Javadoc) |
186 |
* (non-Javadoc) |
| 199 |
* |
187 |
* |
| 200 |
* @see org.eclipse.ui.navigator.CommonActionProvider#init(org.eclipse.ui.navigator.ICommonActionExtensionSite) |
188 |
* @see org.eclipse.ui.navigator.CommonActionProvider#init(org.eclipse.ui.navigator.ICommonActionExtensionSite) |
| 201 |
*/ |
189 |
*/ |
| 202 |
public void init(ICommonActionExtensionSite aSite) { |
190 |
public void init(ICommonActionExtensionSite aSite) { |
|
Lines 206-279
Link Here
|
| 206 |
extensionStateModel = contentService.findStateModel(WorkingSetsContentProvider.EXTENSION_ID); |
194 |
extensionStateModel = contentService.findStateModel(WorkingSetsContentProvider.EXTENSION_ID); |
| 207 |
|
195 |
|
| 208 |
workingSetActionGroup = new WorkingSetFilterActionGroup(aSite.getViewSite().getShell(), filterChangeListener); |
196 |
workingSetActionGroup = new WorkingSetFilterActionGroup(aSite.getViewSite().getShell(), filterChangeListener); |
|
|
197 |
workingSetRootModeActionGroup = new WorkingSetRootModeActionGroup(viewer, extensionStateModel); |
| 209 |
|
198 |
|
| 210 |
if (extensionStateModel != null) { |
199 |
topLevelModeListener= new IPropertyChangeListener() { |
| 211 |
workingSetRootModeActionGroup = new WorkingSetRootModeActionGroup(viewer, extensionStateModel); |
200 |
public void propertyChange(PropertyChangeEvent event) { |
| 212 |
} |
201 |
System.out.println("topLevelModeListener: " + workingSet); //$NON-NLS-1$ |
| 213 |
|
202 |
setWorkingSet(workingSet); |
|
|
203 |
}}; |
| 214 |
|
204 |
|
| 215 |
if (contentService.isActive(WorkingSetsContentProvider.EXTENSION_ID)) { |
205 |
if (contentService.isActive(WorkingSetsContentProvider.EXTENSION_ID)) { |
| 216 |
managerChangeListener.listen(); |
206 |
managerChangeListener.listen(); |
|
|
207 |
extensionStateModel.addPropertyChangeListener(topLevelModeListener); |
| 217 |
} |
208 |
} |
| 218 |
|
209 |
|
| 219 |
contentService.getActivationService().addExtensionActivationListener(activationListener); |
210 |
contentService.getActivationService().addExtensionActivationListener(activationListener); |
|
|
211 |
|
| 212 |
} |
| 213 |
|
| 214 |
/** |
| 215 |
* Restores the working set filter from the persistence store. |
| 216 |
*/ |
| 217 |
protected void initWorkingSetFilter(String workingSetName) { |
| 218 |
IWorkingSet workingSet = null; |
| 219 |
|
| 220 |
if (workingSetName != null && workingSetName.length() > 0) { |
| 221 |
IWorkingSetManager workingSetManager = PlatformUI.getWorkbench().getWorkingSetManager(); |
| 222 |
workingSet = workingSetManager.getWorkingSet(workingSetName); |
| 223 |
} else if (PlatformUI.getPreferenceStore().getBoolean( |
| 224 |
IWorkbenchPreferenceConstants.USE_WINDOW_WORKING_SET_BY_DEFAULT)) { |
| 225 |
// use the window set by default if the global preference is set |
| 226 |
workingSet = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getAggregateWorkingSet(); |
| 227 |
} |
| 228 |
|
| 229 |
if (workingSet != null) { |
| 230 |
workingSetFilter.setWorkingSet(workingSet); |
| 231 |
internalSetWorkingSet(workingSet); |
| 232 |
workingSetActionGroup.setWorkingSet(workingSet); |
| 233 |
} |
| 234 |
} |
| 235 |
|
| 236 |
/** |
| 237 |
* Set current active working set. |
| 238 |
* |
| 239 |
* @param workingSet working set to be activated, may be <code>null</code> |
| 240 |
*/ |
| 241 |
protected void setWorkingSet(IWorkingSet workingSet) { |
| 242 |
internalSetWorkingSet(workingSet); |
| 243 |
|
| 244 |
workingSetFilter.setWorkingSet(emptyWorkingSet ? null : workingSet); |
| 245 |
|
| 246 |
if (viewer != null) { |
| 247 |
if (workingSet == null || emptyWorkingSet || !extensionStateModel.getBooleanProperty(WorkingSetsContentProvider.SHOW_TOP_LEVEL_WORKING_SETS)) { |
| 248 |
if (viewer.getInput() != originalViewerInput) { |
| 249 |
viewer.setInput(originalViewerInput); |
| 250 |
} |
| 251 |
if (!filterAdded) { |
| 252 |
viewer.addFilter(workingSetFilter); |
| 253 |
filterAdded = true; |
| 254 |
} else { |
| 255 |
viewer.refresh(); |
| 256 |
} |
| 257 |
} else { |
| 258 |
viewer.removeFilter(workingSetFilter); |
| 259 |
filterAdded = false; |
| 260 |
if (!workingSet.isAggregateWorkingSet()) { |
| 261 |
IWorkingSetManager workingSetManager = PlatformUI.getWorkbench().getWorkingSetManager(); |
| 262 |
viewer.setInput(workingSetManager.createAggregateWorkingSet("", "", new IWorkingSet[] { workingSet })); //$NON-NLS-1$ //$NON-NLS-2$ |
| 263 |
} else { |
| 264 |
viewer.setInput(workingSet); |
| 265 |
} |
| 266 |
} |
| 267 |
} |
| 220 |
} |
268 |
} |
| 221 |
|
269 |
|
|
|
270 |
private void internalSetWorkingSet(IWorkingSet workingSet) { |
| 271 |
this.workingSet = workingSet; |
| 272 |
emptyWorkingSet = workingSet != null && workingSet.isAggregateWorkingSet() |
| 273 |
&& workingSet.isEmpty(); |
| 274 |
} |
| 275 |
|
| 222 |
/* (non-Javadoc) |
276 |
/* (non-Javadoc) |
| 223 |
* @see org.eclipse.ui.navigator.CommonActionProvider#restoreState(org.eclipse.ui.IMemento) |
277 |
* @see org.eclipse.ui.navigator.CommonActionProvider#restoreState(org.eclipse.ui.IMemento) |
| 224 |
*/ |
278 |
*/ |
| 225 |
public void restoreState(IMemento aMemento) { |
279 |
public void restoreState(IMemento aMemento) { |
| 226 |
super.restoreState(aMemento); |
280 |
super.restoreState(aMemento); |
| 227 |
|
281 |
|
| 228 |
boolean showWorkingSets = true; |
282 |
boolean showWorkingSets = true; |
| 229 |
if(aMemento != null) { |
283 |
if(aMemento != null) { |
| 230 |
Integer showWorkingSetsInt = aMemento.getInteger(WorkingSetsContentProvider.SHOW_TOP_LEVEL_WORKING_SETS); |
284 |
Integer showWorkingSetsInt = aMemento.getInteger(WorkingSetsContentProvider.SHOW_TOP_LEVEL_WORKING_SETS); |
| 231 |
showWorkingSets = showWorkingSetsInt == null || showWorkingSetsInt.intValue() == 1; |
285 |
showWorkingSets = showWorkingSetsInt == null || showWorkingSetsInt.intValue() == 1; |
| 232 |
extensionStateModel.setBooleanProperty(WorkingSetsContentProvider.SHOW_TOP_LEVEL_WORKING_SETS, showWorkingSets); |
286 |
extensionStateModel.setBooleanProperty(WorkingSetsContentProvider.SHOW_TOP_LEVEL_WORKING_SETS, showWorkingSets); |
| 233 |
workingSetRootModeActionGroup.setShowTopLevelWorkingSets(showWorkingSets); |
287 |
workingSetRootModeActionGroup.setShowTopLevelWorkingSets(showWorkingSets); |
| 234 |
|
288 |
|
| 235 |
if(viewer != null) { |
289 |
String lastWorkingSetName = aMemento.getString(TAG_CURRENT_WORKING_SET_NAME); |
| 236 |
String lastWorkingSetName = aMemento.getString(TAG_CURRENT_WORKING_SET_NAME); |
290 |
initWorkingSetFilter(lastWorkingSetName); |
| 237 |
IWorkingSetManager workingSetManager = PlatformUI.getWorkbench().getWorkingSetManager(); |
|
|
| 238 |
IWorkingSet lastWorkingSet = workingSetManager.getWorkingSet(lastWorkingSetName); |
| 239 |
viewer.setInput(lastWorkingSet); |
| 240 |
workingSetActionGroup.setWorkingSet(lastWorkingSet); |
| 241 |
} |
| 242 |
} else { |
291 |
} else { |
| 243 |
showWorkingSets = false; |
292 |
showWorkingSets = false; |
| 244 |
|
293 |
|
| 245 |
extensionStateModel.setBooleanProperty(WorkingSetsContentProvider.SHOW_TOP_LEVEL_WORKING_SETS, showWorkingSets); |
294 |
extensionStateModel.setBooleanProperty(WorkingSetsContentProvider.SHOW_TOP_LEVEL_WORKING_SETS, showWorkingSets); |
| 246 |
workingSetRootModeActionGroup.setShowTopLevelWorkingSets(showWorkingSets); |
295 |
workingSetRootModeActionGroup.setShowTopLevelWorkingSets(showWorkingSets); |
| 247 |
} |
296 |
} |
| 248 |
} |
297 |
} |
| 249 |
|
298 |
|
| 250 |
/* (non-Javadoc) |
299 |
/* (non-Javadoc) |
| 251 |
* @see org.eclipse.ui.navigator.CommonActionProvider#saveState(org.eclipse.ui.IMemento) |
300 |
* @see org.eclipse.ui.navigator.CommonActionProvider#saveState(org.eclipse.ui.IMemento) |
| 252 |
*/ |
301 |
*/ |
| 253 |
public void saveState(IMemento aMemento) { |
302 |
public void saveState(IMemento aMemento) { |
| 254 |
super.saveState(aMemento); |
303 |
super.saveState(aMemento); |
| 255 |
|
304 |
|
| 256 |
if(aMemento != null) { |
305 |
if(aMemento != null) { |
| 257 |
int showWorkingSets = extensionStateModel.getBooleanProperty(WorkingSetsContentProvider.SHOW_TOP_LEVEL_WORKING_SETS) ? 1 : 0; |
306 |
int showWorkingSets = extensionStateModel.getBooleanProperty(WorkingSetsContentProvider.SHOW_TOP_LEVEL_WORKING_SETS) ? 1 : 0; |
| 258 |
aMemento.putInteger(WorkingSetsContentProvider.SHOW_TOP_LEVEL_WORKING_SETS, showWorkingSets); |
307 |
aMemento.putInteger(WorkingSetsContentProvider.SHOW_TOP_LEVEL_WORKING_SETS, showWorkingSets); |
| 259 |
|
308 |
|
| 260 |
if(viewer != null) { |
309 |
if (workingSet != null) { |
| 261 |
Object input = viewer.getInput(); |
310 |
aMemento.putString(TAG_CURRENT_WORKING_SET_NAME, workingSet.getName()); |
| 262 |
if(input instanceof IWorkingSet) { |
|
|
| 263 |
IWorkingSet workingSet = (IWorkingSet) input; |
| 264 |
aMemento.putString(TAG_CURRENT_WORKING_SET_NAME, workingSet.getName()); |
| 265 |
} |
| 266 |
} |
311 |
} |
| 267 |
} |
312 |
} |
| 268 |
|
313 |
|
| 269 |
} |
314 |
} |
| 270 |
|
315 |
|
| 271 |
/* |
316 |
/* |
| 272 |
* (non-Javadoc) |
317 |
* (non-Javadoc) |
| 273 |
* |
318 |
* |
| 274 |
* @see org.eclipse.ui.actions.ActionGroup#fillActionBars(org.eclipse.ui.IActionBars) |
319 |
* @see org.eclipse.ui.actions.ActionGroup#fillActionBars(org.eclipse.ui.IActionBars) |
| 275 |
*/ |
320 |
*/ |
| 276 |
public void fillActionBars(IActionBars actionBars) { |
321 |
public void fillActionBars(IActionBars actionBars) { |
| 277 |
if (!contributedToViewMenu) { |
322 |
if (!contributedToViewMenu) { |
| 278 |
try { |
323 |
try { |
| 279 |
super.fillActionBars(actionBars); |
324 |
super.fillActionBars(actionBars); |
|
Lines 284-295
Link Here
|
| 284 |
} finally { |
329 |
} finally { |
| 285 |
contributedToViewMenu = true; |
330 |
contributedToViewMenu = true; |
| 286 |
} |
331 |
} |
| 287 |
} |
332 |
} |
| 288 |
} |
333 |
} |
| 289 |
|
334 |
|
| 290 |
/* |
335 |
/* |
| 291 |
* (non-Javadoc) |
336 |
* (non-Javadoc) |
| 292 |
* |
337 |
* |
| 293 |
* @see org.eclipse.ui.actions.ActionGroup#dispose() |
338 |
* @see org.eclipse.ui.actions.ActionGroup#dispose() |
| 294 |
*/ |
339 |
*/ |
| 295 |
public void dispose() { |
340 |
public void dispose() { |
|
Lines 300-306
Link Here
|
| 300 |
} |
345 |
} |
| 301 |
|
346 |
|
| 302 |
managerChangeListener.ignore(); |
347 |
managerChangeListener.ignore(); |
|
|
348 |
extensionStateModel.removePropertyChangeListener(topLevelModeListener); |
| 303 |
|
349 |
|
| 304 |
contentService.getActivationService().removeExtensionActivationListener(activationListener); |
350 |
contentService.getActivationService().removeExtensionActivationListener(activationListener); |
| 305 |
} |
351 |
} |
|
|
352 |
|
| 353 |
/** |
| 354 |
* This is used only for the tests. |
| 355 |
* |
| 356 |
* @return a PropertyChangeListener |
| 357 |
*/ |
| 358 |
public IPropertyChangeListener getFilterChangeListener() { |
| 359 |
return filterChangeListener; |
| 360 |
} |
| 361 |
|
| 306 |
} |
362 |
} |