Skip to content

Support customizable label decorations

Tor Arne Vestbø git 2 versions In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest12 patches 7 repliesIn review
  2. v111 patches 17 repliesSuperseded

Changes in v2 from the cover letter

- Fixed layout issues in preference dialog
- Icons replaced to match established conventions
- 'Assume unchanged' icon is back
- Added tooltips in the preference dialog
- 'Added and dirty' is now decorated appropriately
- Refactored container decorations. Now shares code path with files for more accurate results, and to allow inheritance

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/12Add support code to handle plugin property changesorg.spearce.egit.ui/src/org/spearce/egit/ui/Activator.java+52 -00 replies
2/12Use Set instead of array to keep track of change listenersorg.spearce.egit.core/src/org/spearce/egit/core/project/GitProjectData.java+25 -150 replies
3/12Add a specialized team exception for Gitorg.spearce.egit.core/src/org/spearce/egit/core/GitException.java+168 -00 replies
4/12Add new class ExceptionCollector for grouping exceptionsorg.spearce.egit.core/META-INF/MANIFEST.MF org.spearce.egit.core/src/org/spearce/egit/core/internal/util/ExceptionCollector.java+131 -20 replies
5/12Add new class SWTUtils with helper-methods for creating controlsorg.spearce.egit.ui/src/org/spearce/egit/ui/internal/SWTUtils.java+595 -00 replies
6/12Implement basic customizable label decorations with preferencesorg.spearce.egit.ui/plugin.properties org.spearce.egit.ui/plugin.xml org.spearce.egit.ui/src/org/spearce/egit/ui/Activator.java +11 more+1405 -4660 replies
7/12Add binding for name of the current branchorg.spearce.egit.ui/src/org/spearce/egit/ui/UIText.java org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitLightweightDecorator.java org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/IDecoratableResource.java +2 more+50 -110 replies
8/12Add icon decoration for tracked and untracked resourcesorg.spearce.egit.ui/icons/ovr/shared.gif org.spearce.egit.ui/icons/ovr/untracked.gif org.spearce.egit.ui/src/org/spearce/egit/ui/PluginPreferenceInitializer.java +7 more+259 -292 replies
9/12Implement icon and text decorations of various resource statesorg.spearce.egit.ui/icons/ovr/assume_valid.gif org.spearce.egit.ui/icons/ovr/assumevalid.gif org.spearce.egit.ui/icons/ovr/conflict.gif +13 more+477 -760 replies
10/12Don't decorate every single resource on repository changeorg.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitLightweightDecorator.java+4 -240 replies
11/12Expose the underlying resource entries in ContainerTreeIteratororg.spearce.egit.core/src/org/spearce/egit/core/ContainerTreeIterator.java org.spearce.jgit/src/org/spearce/jgit/treewalk/TreeWalk.java+31 -10 replies
12/12Implement label decorations for folders and projectsorg.spearce.egit.ui/src/org/spearce/egit/ui/PluginPreferenceInitializer.java org.spearce.egit.ui/src/org/spearce/egit/ui/UIPreferences.java org.spearce.egit.ui/src/org/spearce/egit/ui/UIText.java +4 more+528 -2831 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [EGIT PATCH v2 00/12] Support customizable label decorations

This series adds support for customizable label decorations, which is usefull for hiding selected decorations, or tweaking the format of the decoration text.

Changes in v2:

- Fixed layout issues in preference dialog
- Icons replaced to match established conventions
- 'Assume unchanged' icon is back
- Added tooltips in the preference dialog
- 'Added and dirty' is now decorated appropriately
- Refactored container decorations. Now shares code path with files for more accurate results, and to allow inheritance

Decorations are edited using the new Team->Git->Label Decorations preference page, which is based off similar functionality from the existing CVS and SVN team providers.

Icons can be enabled and disabled individually, and text can be customized by reordering and editing the set of mapped variables. Boolean variables like 'dirty' and 'staged' can be customized by postfixing the variable name with a colon and a selected string that should be insert if the variable evaluates to true.

The two general options control traversal of child and parent elements during decoration. The first, 'Also re-decorate...', controls whether or not ancestor elements of the current decorated elment will also be scheduled for re-recoration. The second, 'Maximum number of levels...', controls how deep the container decoration algorithm will recurse when trying to determine the state (dirty, staged, etc.) of a container.

Tweaking these options will improve performance for large trees.

The code should work fairly well for most usecases, but I may have missed cases where the decorations will fail misserably. If so, please let me know.

Known issues are:

- If a project has a repository more than one level above the project directory decorations will fail.

- When a Java resource is dirty, each package in the package hierarcy will appear dirty, also when the layout is set to 'flat', which can be confusing.

These are on my list for features to add on top of these series, but I consider them non-blocking. This also goes for online help, which will be added when things stabilize some more.

I've also sprinkled the code with TODOs where I found possible future improvments. One such improvment is performance, where for example refactoring to use one shared status cache should help.

Tor Arne

Tor Arne Vestbø (12):
Add support code to handle plugin property changes Use Set instead of array to keep track of change listeners Add a specialized team exception for Git
Add new class ExceptionCollector for grouping exceptions Add new class SWTUtils with helper-methods for creating controls Implement basic customizable label decorations with preferences Add binding for name of the current branch
Add icon decoration for tracked and untracked resources Implement icon and text decorations of various resource states Don't decorate every single resource on repository change Expose the underlying resource entries in ContainerTreeIterator Implement label decorations for folders and projects

 org.spearce.egit.core/META-INF/MANIFEST.MF         |    5 +-
 .../spearce/egit/core/ContainerTreeIterator.java   |   23 +-
 .../src/org/spearce/egit/core/GitException.java    |  168 ++++
 .../core/internal/util/ExceptionCollector.java     |  128 +++
 .../spearce/egit/core/project/GitProjectData.java  |   40 +-
 org.spearce.egit.ui/icons/ovr/assume_valid.gif     |  Bin 0 -> 85 bytes
 org.spearce.egit.ui/icons/ovr/assumevalid.gif      |  Bin 64 -> 0 bytes
 org.spearce.egit.ui/icons/ovr/conflict.gif         |  Bin 64 -> 194 bytes
 org.spearce.egit.ui/icons/ovr/pending_add.gif      |  Bin 64 -> 0 bytes
 org.spearce.egit.ui/icons/ovr/pending_remove.gif   |  Bin 111 -> 0 bytes
 org.spearce.egit.ui/icons/ovr/shared.gif           |  Bin 106 -> 0 bytes
 org.spearce.egit.ui/icons/ovr/staged.gif           |  Bin 0 -> 114 bytes
 org.spearce.egit.ui/icons/ovr/staged_added.gif     |  Bin 0 -> 169 bytes
 org.spearce.egit.ui/icons/ovr/staged_removed.gif   |  Bin 0 -> 176 bytes
 org.spearce.egit.ui/icons/ovr/untracked.gif        |  Bin 0 -> 79 bytes
 org.spearce.egit.ui/plugin.properties              |    1 +
 org.spearce.egit.ui/plugin.xml                     |   12 +-
 .../src/org/spearce/egit/ui/Activator.java         |   68 ++
 .../egit/ui/PluginPreferenceInitializer.java       |   15 +
 .../src/org/spearce/egit/ui/UIIcons.java           |   21 +-
 .../src/org/spearce/egit/ui/UIPreferences.java     |   21 +
 .../src/org/spearce/egit/ui/UIText.java            |   99 ++-
 .../src/org/spearce/egit/ui/internal/SWTUtils.java |  595 ++++++++++++
 .../egit/ui/internal/actions/BranchAction.java     |    4 +-
 .../egit/ui/internal/actions/Disconnect.java       |    4 +-
 .../egit/ui/internal/actions/ResetAction.java      |    4 +-
 .../decorators/DecoratableResourceAdapter.java     |  391 ++++++++
 .../decorators/GitLightweightDecorator.java        |  653 ++++++++++++++
 .../internal/decorators/GitResourceDecorator.java  |  454 ----------
 .../internal/decorators/IDecoratableResource.java  |  100 ++
 .../preferences/GitDecoratorPreferencePage.java    |  949 ++++++++++++++++++++
 .../src/org/spearce/egit/ui/uitext.properties      |   38 +-
 .../src/org/spearce/jgit/treewalk/TreeWalk.java    |    9 +
 33 files changed, 3310 insertions(+), 492 deletions(-)
 create mode 100644 org.spearce.egit.core/src/org/spearce/egit/core/GitException.java
 create mode 100644 org.spearce.egit.core/src/org/spearce/egit/core/internal/util/ExceptionCollector.java
 create mode 100644 org.spearce.egit.ui/icons/ovr/assume_valid.gif
 delete mode 100644 org.spearce.egit.ui/icons/ovr/assumevalid.gif
 delete mode 100644 org.spearce.egit.ui/icons/ovr/pending_add.gif
 delete mode 100644 org.spearce.egit.ui/icons/ovr/pending_remove.gif
 delete mode 100644 org.spearce.egit.ui/icons/ovr/shared.gif
 create mode 100644 org.spearce.egit.ui/icons/ovr/staged.gif
 create mode 100644 org.spearce.egit.ui/icons/ovr/staged_added.gif
 create mode 100644 org.spearce.egit.ui/icons/ovr/staged_removed.gif
 create mode 100644 org.spearce.egit.ui/icons/ovr/untracked.gif
 create mode 100644 org.spearce.egit.ui/src/org/spearce/egit/ui/internal/SWTUtils.java
 create mode 100644 org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/DecoratableResourceAdapter.java
 create mode 100644 org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitLightweightDecorator.java
 delete mode 100644 org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/GitResourceDecorator.java
 create mode 100644 org.spearce.egit.ui/src/org/spearce/egit/ui/internal/decorators/IDecoratableResource.java
 create mode 100644 org.spearce.egit.ui/src/org/spearce/egit/ui/internal/preferences/GitDecoratorPreferencePage.java