Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 229278 Details for
Bug 403872
[Performance] Move the savePluginPreferences() call to background job to improve performance when saveEnabledStates() is invoked by activityManagerChanged() event.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
patch for updated fix based on Eclipse 3.4.2, generated by diff command.
patch.txt (text/plain), 5.67 KB, created by
Li Juan Gao
on 2013-04-03 06:24:13 EDT
(
hide
)
Description:
patch for updated fix based on Eclipse 3.4.2, generated by diff command.
Filename:
MIME Type:
Creator:
Li Juan Gao
Created:
2013-04-03 06:24:13 EDT
Size:
5.67 KB
patch
obsolete
>--- /Users/zhangchy/Desktop/changes/original/ActivityPersistanceHelper.java 2013-02-22 13:40:26.000000000 +0800 >+++ /Users/zhangchy/Desktop/changes/modified/ActivityPersistanceHelper.java 2013-04-02 11:15:04.000000000 +0800 >@@ -15,6 +15,10 @@ > import java.util.Iterator; > import java.util.Set; > >+import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.Status; >+import org.eclipse.core.runtime.jobs.Job; > import org.eclipse.jface.preference.IPreferenceStore; > import org.eclipse.jface.util.IPropertyChangeListener; > import org.eclipse.jface.util.PropertyChangeEvent; >@@ -68,7 +72,7 @@ > .getActivityManager().getEnabledActivityIds(), delta); > } > if (activityManagerEvent.haveEnabledActivityIdsChanged()) { >- saveEnabledStates(); >+ saveEnabledStates(true); > } > } > }; >@@ -86,23 +90,25 @@ > public void propertyChange(PropertyChangeEvent event) { > // dont process property events if we're in the process of > // serializing state. >- if (!saving && event.getProperty().startsWith(PREFIX)) { >- String activityId = event.getProperty().substring(PREFIX.length()); >- IWorkbenchActivitySupport support = PlatformUI.getWorkbench().getActivitySupport(); >- IActivityManager activityManager = support.getActivityManager(); >- >- boolean enabled = Boolean.valueOf(event.getNewValue().toString()).booleanValue(); >- // if we're turning an activity off we'll need to create its dependency tree to ensuure that all dependencies are also disabled. >- Set set = new HashSet(activityManager.getEnabledActivityIds()); >- if (enabled == false) { >- Set dependencies = buildDependencies(activityManager, activityId); >- set.removeAll(dependencies); >- } >- else { >- set.add(activityId); >- } >- support.setEnabledActivityIds(set); >- } >+ synchronized(savingLock){ >+ if (event.getProperty().startsWith(PREFIX)) { >+ String activityId = event.getProperty().substring(PREFIX.length()); >+ IWorkbenchActivitySupport support = PlatformUI.getWorkbench().getActivitySupport(); >+ IActivityManager activityManager = support.getActivityManager(); >+ >+ boolean enabled = Boolean.valueOf(event.getNewValue().toString()).booleanValue(); >+ // if we're turning an activity off we'll need to create its dependency tree to ensuure that all dependencies are also disabled. >+ Set set = new HashSet(activityManager.getEnabledActivityIds()); >+ if (enabled == false) { >+ Set dependencies = buildDependencies(activityManager, activityId); >+ set.removeAll(dependencies); >+ } >+ else { >+ set.add(activityId); >+ } >+ support.setEnabledActivityIds(set); >+ } >+ } > } > }; > >@@ -110,7 +116,7 @@ > * Whether we are currently saving the state of activities to the preference > * store. > */ >- protected boolean saving = false; >+ protected Object savingLock = new Object(); > > /** > * Get the singleton instance of this class. >@@ -262,31 +268,43 @@ > * Save the enabled states in the preference store. > */ > protected void saveEnabledStates() { >- try { >- saving = true; >- >+ saveEnabledStates(false); >+ } >+ >+ private void saveEnabledStates(boolean saveInBackground) { >+ synchronized(savingLock){ > IPreferenceStore store = WorkbenchPlugin.getDefault() > .getPreferenceStore(); >- >- IWorkbenchActivitySupport support = PlatformUI.getWorkbench() >- .getActivitySupport(); >- IActivityManager activityManager = support.getActivityManager(); >- Iterator values = activityManager.getDefinedActivityIds().iterator(); >- while (values.hasNext()) { >- IActivity activity = activityManager.getActivity((String) values >- .next()); >- if (activity.getExpression() != null) { >- continue; >- } >- >- store.setValue(createPreferenceKey(activity.getId()), activity >- .isEnabled()); >- } >- WorkbenchPlugin.getDefault().savePluginPreferences(); >- } >- finally { >- saving = false; >- } >+ >+ IWorkbenchActivitySupport support = PlatformUI.getWorkbench() >+ .getActivitySupport(); >+ IActivityManager activityManager = support.getActivityManager(); >+ Iterator values = activityManager.getDefinedActivityIds().iterator(); >+ while (values.hasNext()) { >+ IActivity activity = activityManager.getActivity((String) values >+ .next()); >+ if (activity.getExpression() != null) { >+ continue; >+ } >+ >+ store.setValue(createPreferenceKey(activity.getId()), activity >+ .isEnabled()); >+ } >+ >+ if (saveInBackground) { >+ Job job = new Job("Save Activity to Plugin Preference Job") { //$NON-NLS-1$ >+ protected IStatus run(IProgressMonitor arg0) { >+ synchronized(savingLock){ >+ WorkbenchPlugin.getDefault().savePluginPreferences(); >+ } >+ return Status.OK_STATUS; >+ } >+ }; >+ job.schedule(); >+ } else { >+ WorkbenchPlugin.getDefault().savePluginPreferences(); >+ } >+ } > } > > /** >@@ -294,6 +312,6 @@ > */ > public void shutdown() { > unhookListeners(); >- saveEnabledStates(); >+ saveEnabledStates(false); > } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 403872
:
228828
|
229275
|
229276
|
229277
|
229278
|
229515
|
229569