1 /*******************************************************************************
2 * Copyright (C) 2015, Thomas Wolf <thomas.wolf@paranor.ch>
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *******************************************************************************/
9 package org
.eclipse
.egit
.ui
.internal
.resources
;
11 import org
.eclipse
.jgit
.annotations
.NonNull
;
14 * Base implementation of an {@link IResourceState}.
16 public class ResourceState
implements IResourceState
{
19 * Flag indicating whether or not the resource is tracked
21 private boolean tracked
;
24 * Flag indicating whether or not the resource is ignored
26 private boolean ignored
;
29 * Flag indicating whether or not the resource has changes that are not
32 private boolean dirty
;
35 * Flag indicating whether or not the resource has been deleted locally
36 * (unstaged deletion).
38 private boolean missing
;
41 * Staged state of the resource
44 private StagingState staged
= StagingState
.NOT_STAGED
;
47 * Flag indicating whether or not the resource has merge conflicts
49 private boolean conflicts
;
52 * Flag indicating whether or not the resource is assumed unchanged
54 private boolean assumeUnchanged
;
57 public boolean isTracked() {
62 public boolean isIgnored() {
67 public boolean isDirty() {
72 public boolean isMissing() {
77 public StagingState
getStagingState() {
82 public final boolean isStaged() {
83 return staged
!= StagingState
.NOT_STAGED
;
87 public boolean hasConflicts() {
92 public boolean isAssumeUnchanged() {
93 return assumeUnchanged
;
97 public final boolean hasUnstagedChanges() {
99 && (!isTracked() || isDirty() || isMissing() || hasConflicts());
103 * Sets the staged property.
108 protected void setStagingState(@NonNull StagingState staged
) {
109 this.staged
= staged
;
113 * Sets the conflicts property.
118 protected void setConflicts(boolean conflicts
) {
119 this.conflicts
= conflicts
;
123 * Sets the tracked property.
128 protected void setTracked(boolean tracked
) {
129 this.tracked
= tracked
;
133 * Sets the ignored property.
138 protected void setIgnored(boolean ignored
) {
139 this.ignored
= ignored
;
143 * Sets the dirty property.
148 protected void setDirty(boolean dirty
) {
153 * Sets the missing property.
158 protected void setMissing(boolean missing
) {
159 this.missing
= missing
;
163 * Sets the assumeUnchanged property.
165 * @param assumeUnchanged
168 protected void setAssumeUnchanged(boolean assumeUnchanged
) {
169 this.assumeUnchanged
= assumeUnchanged
;