|
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 |
if (viewer != null) { |
| 102 |
viewer.refresh(); |
| 103 |
} |
| 100 |
} |
104 |
} |
| 101 |
|
|
|
| 102 |
} |
105 |
} |
| 103 |
|
106 |
|
| 104 |
/** |
107 |
/** |
|
Lines 125-151
Link Here
|
| 125 |
private IPropertyChangeListener filterChangeListener = new IPropertyChangeListener() { |
128 |
private IPropertyChangeListener filterChangeListener = new IPropertyChangeListener() { |
| 126 |
/* |
129 |
/* |
| 127 |
* (non-Javadoc) |
130 |
* (non-Javadoc) |
| 128 |
* |
131 |
* |
| 129 |
* @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) |
132 |
* @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) |
| 130 |
*/ |
133 |
*/ |
| 131 |
public void propertyChange(PropertyChangeEvent event) { |
134 |
public void propertyChange(PropertyChangeEvent event) { |
| 132 |
IWorkingSet oldWorkingSet = (IWorkingSet) event.getOldValue(); |
|
|
| 133 |
IWorkingSet newWorkingSet = (IWorkingSet) event.getNewValue(); |
135 |
IWorkingSet newWorkingSet = (IWorkingSet) event.getNewValue(); |
| 134 |
|
136 |
|
| 135 |
|
|
|
| 136 |
if (newWorkingSet != null && !contentService.isActive(WorkingSetsContentProvider.EXTENSION_ID)) { |
137 |
if (newWorkingSet != null && !contentService.isActive(WorkingSetsContentProvider.EXTENSION_ID)) { |
| 137 |
contentService.getActivationService().activateExtensions(new String[]{WorkingSetsContentProvider.EXTENSION_ID}, false); |
138 |
contentService.getActivationService().activateExtensions(new String[]{WorkingSetsContentProvider.EXTENSION_ID}, false); |
| 138 |
contentService.getActivationService().persistExtensionActivations(); |
139 |
contentService.getActivationService().persistExtensionActivations(); |
| 139 |
} |
140 |
} |
| 140 |
|
141 |
|
| 141 |
if (viewer != null) { |
142 |
setWorkingSet(newWorkingSet); |
| 142 |
if (newWorkingSet == null) { |
|
|
| 143 |
viewer.setInput(ResourcesPlugin.getWorkspace().getRoot()); |
| 144 |
} else if(oldWorkingSet != newWorkingSet) { |
| 145 |
viewer.setInput(newWorkingSet); |
| 146 |
} |
| 147 |
} |
| 148 |
|
| 149 |
} |
143 |
} |
| 150 |
}; |
144 |
}; |
| 151 |
|
145 |
|
|
Lines 153-159
Link Here
|
| 153 |
|
147 |
|
| 154 |
private IExtensionActivationListener activationListener = new IExtensionActivationListener() { |
148 |
private IExtensionActivationListener activationListener = new IExtensionActivationListener() { |
| 155 |
|
149 |
|
| 156 |
private IWorkingSet workingSet; |
150 |
private IWorkingSet savedWorkingSet; |
| 157 |
|
151 |
|
| 158 |
public void onExtensionActivation(String aViewerId, String[] theNavigatorExtensionIds, boolean isActive) { |
152 |
public void onExtensionActivation(String aViewerId, String[] theNavigatorExtensionIds, boolean isActive) { |
| 159 |
|
153 |
|
|
Lines 162-189
Link Here
|
| 162 |
if (isActive) { |
156 |
if (isActive) { |
| 163 |
extensionStateModel = contentService.findStateModel(WorkingSetsContentProvider.EXTENSION_ID); |
157 |
extensionStateModel = contentService.findStateModel(WorkingSetsContentProvider.EXTENSION_ID); |
| 164 |
workingSetRootModeActionGroup.setStateModel(extensionStateModel); |
158 |
workingSetRootModeActionGroup.setStateModel(extensionStateModel); |
|
|
159 |
extensionStateModel.addPropertyChangeListener(topLevelModeListener); |
| 165 |
|
160 |
|
| 166 |
if (workingSet != null) { |
161 |
if (savedWorkingSet != null) { |
| 167 |
viewer.setInput(workingSet); |
162 |
setWorkingSet(savedWorkingSet); |
| 168 |
workingSetActionGroup.setWorkingSet(workingSet); |
163 |
workingSetActionGroup.setWorkingSet(savedWorkingSet); |
| 169 |
workingSetRootModeActionGroup.setShowTopLevelWorkingSets(true); |
|
|
| 170 |
} |
164 |
} |
| 171 |
managerChangeListener.listen(); |
165 |
managerChangeListener.listen(); |
| 172 |
|
|
|
| 173 |
|
166 |
|
| 174 |
} else { |
167 |
} else { |
| 175 |
Object input = viewer.getInput(); |
168 |
savedWorkingSet= workingSet; |
| 176 |
if (input instanceof IWorkingSet) { |
169 |
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(); |
170 |
managerChangeListener.ignore(); |
| 185 |
workingSetActionGroup.setWorkingSet(null); |
171 |
workingSetActionGroup.setWorkingSet(null); |
| 186 |
workingSetRootModeActionGroup.setShowTopLevelWorkingSets(false); |
172 |
workingSetRootModeActionGroup.setShowTopLevelWorkingSets(false); |
|
|
173 |
extensionStateModel.removePropertyChangeListener(topLevelModeListener); |
| 187 |
|
174 |
|
| 188 |
} |
175 |
} |
| 189 |
} |
176 |
} |
|
Lines 192-202
Link Here
|
| 192 |
|
179 |
|
| 193 |
}; |
180 |
}; |
| 194 |
|
181 |
|
| 195 |
|
|
|
| 196 |
|
182 |
|
| 197 |
/* |
183 |
/* |
| 198 |
* (non-Javadoc) |
184 |
* (non-Javadoc) |
| 199 |
* |
185 |
* |
| 200 |
* @see org.eclipse.ui.navigator.CommonActionProvider#init(org.eclipse.ui.navigator.ICommonActionExtensionSite) |
186 |
* @see org.eclipse.ui.navigator.CommonActionProvider#init(org.eclipse.ui.navigator.ICommonActionExtensionSite) |
| 201 |
*/ |
187 |
*/ |
| 202 |
public void init(ICommonActionExtensionSite aSite) { |
188 |
public void init(ICommonActionExtensionSite aSite) { |
|
Lines 206-279
Link Here
|
| 206 |
extensionStateModel = contentService.findStateModel(WorkingSetsContentProvider.EXTENSION_ID); |
192 |
extensionStateModel = contentService.findStateModel(WorkingSetsContentProvider.EXTENSION_ID); |
| 207 |
|
193 |
|
| 208 |
workingSetActionGroup = new WorkingSetFilterActionGroup(aSite.getViewSite().getShell(), filterChangeListener); |
194 |
workingSetActionGroup = new WorkingSetFilterActionGroup(aSite.getViewSite().getShell(), filterChangeListener); |
|
|
195 |
workingSetRootModeActionGroup = new WorkingSetRootModeActionGroup(viewer, extensionStateModel); |
| 209 |
|
196 |
|
| 210 |
if (extensionStateModel != null) { |
197 |
topLevelModeListener= new IPropertyChangeListener() { |
| 211 |
workingSetRootModeActionGroup = new WorkingSetRootModeActionGroup(viewer, extensionStateModel); |
198 |
public void propertyChange(PropertyChangeEvent event) { |
| 212 |
} |
199 |
setWorkingSet(workingSet); |
| 213 |
|
200 |
}}; |
| 214 |
|
201 |
|
| 215 |
if (contentService.isActive(WorkingSetsContentProvider.EXTENSION_ID)) { |
202 |
if (contentService.isActive(WorkingSetsContentProvider.EXTENSION_ID)) { |
| 216 |
managerChangeListener.listen(); |
203 |
managerChangeListener.listen(); |
|
|
204 |
extensionStateModel.addPropertyChangeListener(topLevelModeListener); |
| 217 |
} |
205 |
} |
| 218 |
|
206 |
|
| 219 |
contentService.getActivationService().addExtensionActivationListener(activationListener); |
207 |
contentService.getActivationService().addExtensionActivationListener(activationListener); |
|
|
208 |
|
| 220 |
} |
209 |
} |
| 221 |
|
210 |
|
|
|
211 |
/** |
| 212 |
* Restores the working set filter from the persistence store. |
| 213 |
*/ |
| 214 |
protected void initWorkingSetFilter(String workingSetName) { |
| 215 |
IWorkingSet workingSet = null; |
| 216 |
|
| 217 |
if (workingSetName != null && workingSetName.length() > 0) { |
| 218 |
IWorkingSetManager workingSetManager = PlatformUI.getWorkbench().getWorkingSetManager(); |
| 219 |
workingSet = workingSetManager.getWorkingSet(workingSetName); |
| 220 |
} else if (PlatformUI.getPreferenceStore().getBoolean( |
| 221 |
IWorkbenchPreferenceConstants.USE_WINDOW_WORKING_SET_BY_DEFAULT)) { |
| 222 |
// use the window set by default if the global preference is set |
| 223 |
workingSet = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getAggregateWorkingSet(); |
| 224 |
} |
| 225 |
|
| 226 |
if (workingSet != null) { |
| 227 |
workingSetFilter.setWorkingSet(workingSet); |
| 228 |
internalSetWorkingSet(workingSet); |
| 229 |
workingSetActionGroup.setWorkingSet(workingSet); |
| 230 |
} |
| 231 |
} |
| 232 |
|
| 233 |
/** |
| 234 |
* Set current active working set. |
| 235 |
* |
| 236 |
* @param workingSet working set to be activated, may be <code>null</code> |
| 237 |
*/ |
| 238 |
protected void setWorkingSet(IWorkingSet workingSet) { |
| 239 |
internalSetWorkingSet(workingSet); |
| 240 |
|
| 241 |
workingSetFilter.setWorkingSet(emptyWorkingSet ? null : workingSet); |
| 242 |
|
| 243 |
if (viewer != null) { |
| 244 |
if (workingSet == null || emptyWorkingSet || !extensionStateModel.getBooleanProperty(WorkingSetsContentProvider.SHOW_TOP_LEVEL_WORKING_SETS)) { |
| 245 |
if (viewer.getInput() != originalViewerInput) { |
| 246 |
viewer.setInput(originalViewerInput); |
| 247 |
} |
| 248 |
if (!filterAdded) { |
| 249 |
viewer.addFilter(workingSetFilter); |
| 250 |
filterAdded = true; |
| 251 |
} else { |
| 252 |
viewer.refresh(); |
| 253 |
} |
| 254 |
} else { |
| 255 |
viewer.removeFilter(workingSetFilter); |
| 256 |
filterAdded = false; |
| 257 |
viewer.setInput(workingSet); |
| 258 |
} |
| 259 |
} |
| 260 |
} |
| 261 |
|
| 262 |
private void internalSetWorkingSet(IWorkingSet workingSet) { |
| 263 |
this.workingSet = workingSet; |
| 264 |
emptyWorkingSet = workingSet != null && workingSet.isAggregateWorkingSet() |
| 265 |
&& workingSet.isEmpty(); |
| 266 |
} |
| 267 |
|
| 222 |
/* (non-Javadoc) |
268 |
/* (non-Javadoc) |
| 223 |
* @see org.eclipse.ui.navigator.CommonActionProvider#restoreState(org.eclipse.ui.IMemento) |
269 |
* @see org.eclipse.ui.navigator.CommonActionProvider#restoreState(org.eclipse.ui.IMemento) |
| 224 |
*/ |
270 |
*/ |
| 225 |
public void restoreState(IMemento aMemento) { |
271 |
public void restoreState(IMemento aMemento) { |
| 226 |
super.restoreState(aMemento); |
272 |
super.restoreState(aMemento); |
| 227 |
|
273 |
|
| 228 |
boolean showWorkingSets = true; |
274 |
boolean showWorkingSets = true; |
| 229 |
if(aMemento != null) { |
275 |
if(aMemento != null) { |
| 230 |
Integer showWorkingSetsInt = aMemento.getInteger(WorkingSetsContentProvider.SHOW_TOP_LEVEL_WORKING_SETS); |
276 |
Integer showWorkingSetsInt = aMemento.getInteger(WorkingSetsContentProvider.SHOW_TOP_LEVEL_WORKING_SETS); |
| 231 |
showWorkingSets = showWorkingSetsInt == null || showWorkingSetsInt.intValue() == 1; |
277 |
showWorkingSets = showWorkingSetsInt == null || showWorkingSetsInt.intValue() == 1; |
| 232 |
extensionStateModel.setBooleanProperty(WorkingSetsContentProvider.SHOW_TOP_LEVEL_WORKING_SETS, showWorkingSets); |
278 |
extensionStateModel.setBooleanProperty(WorkingSetsContentProvider.SHOW_TOP_LEVEL_WORKING_SETS, showWorkingSets); |
| 233 |
workingSetRootModeActionGroup.setShowTopLevelWorkingSets(showWorkingSets); |
279 |
workingSetRootModeActionGroup.setShowTopLevelWorkingSets(showWorkingSets); |
| 234 |
|
280 |
|
| 235 |
if(viewer != null) { |
281 |
String lastWorkingSetName = aMemento.getString(TAG_CURRENT_WORKING_SET_NAME); |
| 236 |
String lastWorkingSetName = aMemento.getString(TAG_CURRENT_WORKING_SET_NAME); |
282 |
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 { |
283 |
} else { |
| 243 |
showWorkingSets = false; |
284 |
showWorkingSets = false; |
| 244 |
|
285 |
|
| 245 |
extensionStateModel.setBooleanProperty(WorkingSetsContentProvider.SHOW_TOP_LEVEL_WORKING_SETS, showWorkingSets); |
286 |
extensionStateModel.setBooleanProperty(WorkingSetsContentProvider.SHOW_TOP_LEVEL_WORKING_SETS, showWorkingSets); |
| 246 |
workingSetRootModeActionGroup.setShowTopLevelWorkingSets(showWorkingSets); |
287 |
workingSetRootModeActionGroup.setShowTopLevelWorkingSets(showWorkingSets); |
| 247 |
} |
288 |
} |
| 248 |
} |
289 |
} |
| 249 |
|
290 |
|
| 250 |
/* (non-Javadoc) |
291 |
/* (non-Javadoc) |
| 251 |
* @see org.eclipse.ui.navigator.CommonActionProvider#saveState(org.eclipse.ui.IMemento) |
292 |
* @see org.eclipse.ui.navigator.CommonActionProvider#saveState(org.eclipse.ui.IMemento) |
| 252 |
*/ |
293 |
*/ |
| 253 |
public void saveState(IMemento aMemento) { |
294 |
public void saveState(IMemento aMemento) { |
| 254 |
super.saveState(aMemento); |
295 |
super.saveState(aMemento); |
| 255 |
|
296 |
|
| 256 |
if(aMemento != null) { |
297 |
if(aMemento != null) { |
| 257 |
int showWorkingSets = extensionStateModel.getBooleanProperty(WorkingSetsContentProvider.SHOW_TOP_LEVEL_WORKING_SETS) ? 1 : 0; |
298 |
int showWorkingSets = extensionStateModel.getBooleanProperty(WorkingSetsContentProvider.SHOW_TOP_LEVEL_WORKING_SETS) ? 1 : 0; |
| 258 |
aMemento.putInteger(WorkingSetsContentProvider.SHOW_TOP_LEVEL_WORKING_SETS, showWorkingSets); |
299 |
aMemento.putInteger(WorkingSetsContentProvider.SHOW_TOP_LEVEL_WORKING_SETS, showWorkingSets); |
| 259 |
|
300 |
|
| 260 |
if(viewer != null) { |
301 |
if (workingSet != null) { |
| 261 |
Object input = viewer.getInput(); |
302 |
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 |
} |
303 |
} |
| 267 |
} |
304 |
} |
| 268 |
|
305 |
|
| 269 |
} |
306 |
} |
| 270 |
|
307 |
|
| 271 |
/* |
308 |
/* |
| 272 |
* (non-Javadoc) |
309 |
* (non-Javadoc) |
| 273 |
* |
310 |
* |
| 274 |
* @see org.eclipse.ui.actions.ActionGroup#fillActionBars(org.eclipse.ui.IActionBars) |
311 |
* @see org.eclipse.ui.actions.ActionGroup#fillActionBars(org.eclipse.ui.IActionBars) |
| 275 |
*/ |
312 |
*/ |
| 276 |
public void fillActionBars(IActionBars actionBars) { |
313 |
public void fillActionBars(IActionBars actionBars) { |
| 277 |
if (!contributedToViewMenu) { |
314 |
if (!contributedToViewMenu) { |
| 278 |
try { |
315 |
try { |
| 279 |
super.fillActionBars(actionBars); |
316 |
super.fillActionBars(actionBars); |
|
Lines 284-295
Link Here
|
| 284 |
} finally { |
321 |
} finally { |
| 285 |
contributedToViewMenu = true; |
322 |
contributedToViewMenu = true; |
| 286 |
} |
323 |
} |
| 287 |
} |
324 |
} |
| 288 |
} |
325 |
} |
| 289 |
|
326 |
|
| 290 |
/* |
327 |
/* |
| 291 |
* (non-Javadoc) |
328 |
* (non-Javadoc) |
| 292 |
* |
329 |
* |
| 293 |
* @see org.eclipse.ui.actions.ActionGroup#dispose() |
330 |
* @see org.eclipse.ui.actions.ActionGroup#dispose() |
| 294 |
*/ |
331 |
*/ |
| 295 |
public void dispose() { |
332 |
public void dispose() { |
|
Lines 300-306
Link Here
|
| 300 |
} |
337 |
} |
| 301 |
|
338 |
|
| 302 |
managerChangeListener.ignore(); |
339 |
managerChangeListener.ignore(); |
|
|
340 |
extensionStateModel.removePropertyChangeListener(topLevelModeListener); |
| 303 |
|
341 |
|
| 304 |
contentService.getActivationService().removeExtensionActivationListener(activationListener); |
342 |
contentService.getActivationService().removeExtensionActivationListener(activationListener); |
| 305 |
} |
343 |
} |
|
|
344 |
|
| 345 |
/** |
| 346 |
* This is used only for the tests. |
| 347 |
* |
| 348 |
* @return a PropertyChangeListener |
| 349 |
*/ |
| 350 |
public IPropertyChangeListener getFilterChangeListener() { |
| 351 |
return filterChangeListener; |
| 352 |
} |
| 353 |
|
| 306 |
} |
354 |
} |