Implement icon and text decorations of various resource states
[egit/torarne.git] / org.spearce.egit.ui / src / org / spearce / egit / ui / internal / decorators / IDecoratableResource.java
blobb864a106b1a172425e3c6287e57f844d60e15f99
1 /*******************************************************************************
2 * Copyright (C) 2008, Tor Arne Vestbø <torarnv@gmail.com>
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 * See LICENSE for the full license text, also available.
7 *******************************************************************************/
9 package org.spearce.egit.ui.internal.decorators;
11 import org.eclipse.core.resources.IResource;
13 /**
14 * Represents the state of a resource that can be used as a basis for decoration
16 public interface IDecoratableResource {
18 /**
19 * Set of possible staging states for a resource
21 public enum Staged {
22 /** Represents a resource that is not staged */
23 NOT_STAGED,
24 /** Represents a resource that has been modified */
25 MODIFIED,
26 /** Represents a resource that is added to Git */
27 ADDED,
28 /** Represents a resource that is removed from Git */
29 REMOVED,
30 /** Represents a resource that has been renamed */
31 RENAMED
34 /**
35 * Gets the type of the resource as defined by {@link IResource}
37 * @return the type of the resource
39 int getType();
41 /**
42 * Gets the name of the resource
44 * @return the name of the resource
46 String getName();
48 /**
49 * Gets the current branch of the resource if applicable
51 * @return the name of the current branch, or <code>null</code> if not
52 * applicable
54 String getBranch();
56 /**
57 * Returns whether or not the resource is tracked by Git
59 * @return whether or not the resource is tracked by Git
61 boolean isTracked();
63 /**
64 * Returns whether or not the resource is ignored, either by a global team
65 * ignore in Eclipse, or by .git/info/exclude et al.
67 * @return whether or not the resource is ignored
69 boolean isIgnored();
71 /**
72 * Returns whether or not the resource has changes that are not staged
74 * @return whether or not the resource is dirty
76 boolean isDirty();
78 /**
79 * Returns the staged state of the resource
81 * The set of allowed values are defined by the <code>Staged</code> enum
83 * @return the staged state of the resource
85 Staged staged();
87 /**
88 * Returns whether or not the resource has merge conflicts
90 * @return whether or not the resource has merge conflicts
92 boolean hasConflicts();
94 /**
95 * Returns whether or not the resource is assumed valid
97 * @return whether or not the resource is assumed valid
99 boolean isAssumeValid();