Simplify the EGit UI Activator by using OSGi declarative services

The EGit UI Activator contained a lot of code to deal with external
modifications to git repositories. Refactor this into more manageable
components created dynamically by the framework.

First, the FocusHandler: this maintains a flag whether the application
is active, i.e., whether any of its Shells is the current active shell.
This needs the workbench to have been created, and the FocusHandler has
acquired over time some completely unrelated code that just also
happened to need a workbench. To ensure that it initialized itself only
once the workbench was ready, the FocusHandler scheduled a job that
re-scheduled periodically until the workbench was up.

Split this: move the unrelated code (setting icons for EGit core jobs)
to the newly introduced StartEventListener. Move maintaining the
"application active" state to ApplicationActiveListener, a dedicated
OSGi component triggered on the APP_STARTUP_COMPLETE event. At that
point, we are guaranteed that the workbench is ready, so no job is
needed. The ApplicationActiveListener fires a custom event
APPLICATION_ACTIVE whenever the active state changes; the data of the
event is a boolean indicating the new state (true if active, false
otherwise). Make sure an initial event is fired. The event is posted
asynchronously.

Move all the repository scanning and project refreshing code to a new
component ExternalRepositoryScanner, which in turn listens on that new
APPLICATION_ACTIVE event. The framework will create this component
automatically when the first such event is fired; component creation
will be off the UI thread since the event is posted asynchronously.
Schedule a run whenever the state changes from "inactive" to "active"
to resume scanning.

Unregister the DebugOptionsListener on Activator.stop().

Change-Id: I296d5801d62a6f2c0c8da4166aa36270c1b2ad1b
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
8 files changed
tree: d4859ee0b4356207cb2d28245ab9e4096221db00
  1. .mvn/
  2. icons/
  3. org.eclipse.egit/
  4. org.eclipse.egit-feature/
  5. org.eclipse.egit.core/
  6. org.eclipse.egit.core.junit/
  7. org.eclipse.egit.core.test/
  8. org.eclipse.egit.doc/
  9. org.eclipse.egit.gitflow/
  10. org.eclipse.egit.gitflow-feature/
  11. org.eclipse.egit.gitflow.test/
  12. org.eclipse.egit.gitflow.ui/
  13. org.eclipse.egit.mylyn-feature/
  14. org.eclipse.egit.mylyn.ui/
  15. org.eclipse.egit.mylyn.ui.test/
  16. org.eclipse.egit.repository/
  17. org.eclipse.egit.source-feature/
  18. org.eclipse.egit.target/
  19. org.eclipse.egit.ui/
  20. org.eclipse.egit.ui.test/
  21. tools/
  22. .gitattributes
  23. .gitignore
  24. .project
  25. CONTRIBUTING.md
  26. egit.psf
  27. EGIT_INSTALL
  28. LICENSE
  29. pom.xml
  30. README.md
README.md

Eclipse Git Plugin

EGit is a set of Eclipse plugins for working with Git repositories. It is based on the JGit library, which is a Git implementation in pure Java. This package is licensed under the EPL 2.0. Please refer to the LICENSE file for the complete license.

Components

This package is composed of the following major components.

Implementation

  • org.eclipse.egit: Eclipse branding plugin for EGit.
  • org.eclipse.egit.core: An Eclipse plugin providing an interface to org.eclipse.jgit and support routines to allow processing in an Eclipse workspace. It also supplies the team provider implementation.
  • org.eclipse.egit.gitflow: bundle implementing support for the gitflow branching model.
  • org.eclipse.egit.gitflow.ui: bundle implementing a user interface for the gitflow branching model.
  • org.eclipse.egit.mylyn: bundle integrating EGit with Eclipse Mylyn which provides integration for Eclipse with task tracking systems.
  • org.eclipse.egit.mylyn.ui: bundle integrating EGit user interface with Eclipse Mylyn task based user interface.
  • org.eclipse.egit.target: Eclipse target platform providing EGit 3rd party dependencies for the build and for running EGit in Eclipse workspace.
  • org.eclipse.egit.ui: An Eclipse plugin providing the user interface on top of org.eclipse.egit.core.
  • org.eclipse.egit.ui.importer: An Eclipse plugin integrating the Eclipse smart import wizard to improve importing projects from Git repositories.

Tests

  • org.eclipse.egit.core.junit: Reusable classes used by EGit tests
  • org.eclipse.egit.core.test: Unit tests for org.eclipse.egit.core.
  • org.eclipse.egit.gitflow.test: Unit tests for org.eclipse.egit.gitflow.
  • org.eclipse.egit.mylyn.ui.test: UI tests for org.eclipse.egit.mylyn.ui.
  • org.eclipse.egit.ui.importer.test: UI tests for org.eclipse.egit.ui.smartimport.
  • org.eclipse.egit.ui.test: UI tests for org.eclipse.egit.ui.

Packaging

  • org.eclipse.egit.doc: Documentation bundle packaging EGit documentation. Raw documentation is written in the wiki.
  • org.eclipse.egit-feature: Eclipse feature for installing the core implementation bundles
  • org.eclipse.egit.gitflow-feature: Eclipse feature for installing the optional gitflow bundle.
  • org.eclipse.egit.mylyn-feature: Eclipse feature for installing the EGit task based interface integration.
  • org.eclipse.egit.repository: Definitions for the EGit p2 repository which can be used to install and upgrade EGit, includes all the features and plugins from the JGit p2 repository.
  • org.eclipse.egit.source-feature: Eclipse feature for installing EGit source bundles to help debugging EGit in Eclipse.

Compatibility

  • In general, EGit supports at least the latest two Eclipse releases. For details, please see https://wiki.eclipse.org/EGit/FAQ
  • JGit and EGit releases are versioned according to OSGi semantic versioning
  • Newer version of EGit may implement new functionality, remove existing functions and change others without other notice than what is written in the release notes, commit log and source files themselves.

Features

The following list is not complete, but it gives an overview of the features:

  • org.eclipse.egit.core

    • Supplies an Eclipse team provider.
    • Connect/disconnect the provider to a project.
    • Search for the repositories associated with a project by autodetecting the Git repository directories.
    • Store which repositories are tied to which containers in the Eclipse workspace.
    • Tracks moves/renames/deletes and reflects them in the cache tree.
    • Resolves through linked containers.
  • org.eclipse.egit.ui

    • Connect team provider wizard panels.
    • Connect to Git team provider by making a new repository.
    • Connect to Git team provider by searching local filesystem for existing repository directories.
    • Team actions: track (add), untrack (remove), disconnect, show history, compare version.
    • Resource decorator shows file/directory state in the package explorer and other views.
    • Creating new commits or amending commits.
    • View for staging changes (whole files and partial staging), showing their differences and committing them.
    • Graphical history viewer with the ability to compare versions using eclipse built-in compare editor.
    • Clone, push, pull, fetch
    • Merge, rebase, cherry-pick

Missing Features

  • signing support is incomplete
    • verifying signed objects
    • signing tags
    • signing pushes

Support

Post questions or comments to the egit-dev@eclipse.org mailing list. You need to be subscribed to post.

Contributing

See the EGit Contributor Guide.

About Git

More information about Git, its repository format, and the canonical C based implementation can be obtained from the Git website.