IndexChangedEvent.java

  1. /*
  2.  * Copyright (C) 2010, Google Inc. and others
  3.  *
  4.  * This program and the accompanying materials are made available under the
  5.  * terms of the Eclipse Distribution License v. 1.0 which is available at
  6.  * https://www.eclipse.org/org/documents/edl-v10.php.
  7.  *
  8.  * SPDX-License-Identifier: BSD-3-Clause
  9.  */

  10. package org.eclipse.jgit.events;

  11. /**
  12.  * Describes a change to one or more paths in the index file.
  13.  */
  14. public class IndexChangedEvent extends RepositoryEvent<IndexChangedListener> {
  15.     private boolean internal;

  16.     /**
  17.      * Notify that the index changed
  18.      *
  19.      * @param internal
  20.      *                     {@code true} if the index was changed by the same
  21.      *                     JGit process
  22.      * @since 5.0
  23.      */
  24.     public IndexChangedEvent(boolean internal) {
  25.         this.internal = internal;
  26.     }

  27.     /**
  28.      * @return {@code true} if the index was changed by the same JGit process
  29.      * @since 5.0
  30.      */
  31.     public boolean isInternal() {
  32.         return internal;
  33.     }

  34.     /** {@inheritDoc} */
  35.     @Override
  36.     public Class<IndexChangedListener> getListenerType() {
  37.         return IndexChangedListener.class;
  38.     }

  39.     /** {@inheritDoc} */
  40.     @Override
  41.     public void dispatch(IndexChangedListener listener) {
  42.         listener.onIndexChanged(this);
  43.     }
  44. }