git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [EGIT PATCH 01/11] Add support code to handle plugin property changes

From
Shawn O. Pearce <spearce@spearce.org>
Date
Feb 5, 2009, 16:40 UTC
Message-ID
<20090205164022.GK26880@spearce.org>
In-Reply-To
<498B1563.4070905@gmail.com>
Tor Arne Vestbø <torarnv@gmail.com> wrote:
Show 20 quoted lines
> Shawn O. Pearce wrote:
> > Tor Arne Vestbø <torarnv@gmail.com> wrote:
> >> diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/Activator.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/Activator.java
> >> index fced643..d4a9e8e 100644
> >> --- a/org.spearce.egit.ui/src/org/spearce/egit/ui/Activator.java
> >> +++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/Activator.java
> >> @@ -44,9 +48,24 @@
> >>   * This is a plugin singleton mostly controlling logging.
> >>   */
> >>  public class Activator extends AbstractUIPlugin {
> >> +
> >> +	/**
> >> +	 *  The one and only instance
> >> +	 */
> >>  	private static Activator plugin;
> > 
> > What does this field do?  I don't see it referenced anywhere...
> 
> It's the singleton instance, referenced from Activator.getDefault(). I
> just documented it :)
*sigh*.  I haven't had enough caffiene yet this morning.  Yes,
I see what you mean, its only the Javadoc that was added.  OK,
forget I said anything here.  :-)
 
Show 20 quoted lines
> >>  	/**
> >> +	 * Property listeners for plugin specific events
> >> +	 */
> >> +	private static List<IPropertyChangeListener> propertyChangeListeners =
> >> +		new ArrayList<IPropertyChangeListener>(5);
> > 
> > None of these list accesses are thread-safe.  Are we certain they
> > call will come from a single thread, e.g. the SWT event thread?
> > Or do we need to put synchronized protection in here?
> 
> The addPropertyChangeListener method is called at startup from the
> GitLightweightDecorator constructor, in one of the worker threads, and
> same thing with removePropertyChangeListener from dispose(). The
> broadcastPropertyChange method is called in the main thread every time
> the Git decorator preference page is closes.
> 
> This is the sync model used by other Eclipse plugins for keeping track
> of propertyChangeListeners, for example in the TeamUIPlugin, that's why
> I assumed it was OK. I'm perfectly fine with syncrhronizing it though,
> similar to repositoryChangeListeners in GitProjectData?

OK, I see. I'd perhaps prefer to make this thread-safe just in case. If its always coming off the SWT event thread, then just tossing a synchronized keyword on all 3 methods should be Good Enough(tm).

-- 
Shawn.
Previous: Tor Arne VestbøNext: Tor Arne Vestbø
Message 24 of 31 in “Support customizable label decorations”
  1. 00/11 Support customizable label decorationsTor Arne Vestbø, Feb 5, 2009
  2. 01/11 Add support code to handle plugin property changesTor Arne Vestbø, Feb 5, 2009
  3. 02/11 Use Set instead of array to keep track of change listenersTor Arne Vestbø, Feb 5, 2009
  4. 03/11 Add a specialized team exception for GitTor Arne Vestbø, Feb 5, 2009
  5. 04/11 Add new class ExceptionCollector for grouping exceptionsTor Arne Vestbø, Feb 5, 2009
  6. 05/11 Add new class SWTUtils with helper-methods for creating controlsTor Arne Vestbø, Feb 5, 2009
  7. 06/11 Implement basic customizable label decorations with preferencesTor Arne Vestbø, Feb 5, 2009
  8. 07/11 Add binding for name of the current branchTor Arne Vestbø, Feb 5, 2009
  9. 08/11 Add icon decoration for tracked and untracked resourcesTor Arne Vestbø, Feb 5, 2009
  10. 09/11 Implement decorations of dirty, staged, and conflicting resourcesTor Arne Vestbø, Feb 5, 2009
  11. 10/11 Don't decorate every single resource on repository changeTor Arne Vestbø, Feb 5, 2009
  12. 11/11 Implement label decorations for folders and projectsTor Arne Vestbø, Feb 5, 2009
  13. Robin RosenbergFeb 5, 2009
  14. Tor Arne VestbøFeb 5, 2009
  15. Tor Arne VestbøFeb 5, 2009
  16. Robin RosenbergFeb 5, 2009
  17. Tor Arne VestbøFeb 5, 2009
  18. Robin RosenbergFeb 5, 2009
  19. Shawn O. PearceFeb 5, 2009
  20. Tor Arne VestbøFeb 5, 2009
  21. 02/11 Use Set instead of array to keep track of change listenersTor Arne Vestbø, Feb 5, 2009
  22. Shawn O. PearceFeb 5, 2009
  23. Tor Arne VestbøFeb 5, 2009
  24. Shawn O. PearceFeb 5, 2009
  25. Add support code to handle plugin property changesTor Arne Vestbø, Feb 5, 2009
  26. Tor Arne VestbøFeb 5, 2009
  27. Shawn O. PearceFeb 5, 2009
  28. Tor Arne VestbøFeb 5, 2009
  29. Robin RosenbergFeb 5, 2009
  30. Tor Arne VestbøFeb 5, 2009
  31. Robin RosenbergFeb 5, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.