-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CHE-5339: Mark with color Git changed files in project explorer #5722
Changes from 10 commits
146e559
19a68b9
176eeba
a38f0c7
c5e0a01
752ff4e
b942c65
51774dd
0cc1574
c192c6d
fe0820f
b1a6682
9c0069f
54726b1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2012-2017 Codenvy, S.A. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Codenvy, S.A. - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.che.ide.api.vcs; | ||
|
||
/** | ||
* Indicates that specified resource has VCS status attribute. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you please elaborate on what it means to have VCS status attribute? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It means that the resource can store and return VCS status |
||
* | ||
* @author Igor Vinokur | ||
*/ | ||
public interface HasVcsStatus { | ||
|
||
/** | ||
* Returns VCS status attribute of the resource. | ||
*/ | ||
VcsStatus getVcsStatus(); | ||
|
||
/** | ||
* Set VCS status attribute to the resource. | ||
* | ||
* @param vcsStatus | ||
* VCS status to set | ||
*/ | ||
void setVcsStatus(VcsStatus vcsStatus); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2012-2017 Codenvy, S.A. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Codenvy, S.A. - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.che.ide.api.vcs; | ||
|
||
import org.eclipse.che.ide.api.theme.Style; | ||
|
||
import static java.util.Arrays.stream; | ||
|
||
public enum VcsStatus { | ||
|
||
UNTRACKED("untracked"), | ||
ADDED("added"), | ||
MODIFIED("modified"), | ||
NOT_MODIFIED("not_modified"); | ||
|
||
private String value; | ||
|
||
VcsStatus(String value) { | ||
this.value = value; | ||
} | ||
|
||
public String getValue() { | ||
return value; | ||
} | ||
|
||
public String getColor() { | ||
switch (this) { | ||
case UNTRACKED: | ||
return Style.getVcsStatusUntrackedColor(); | ||
case MODIFIED: | ||
return Style.getVcsStatusModifiedColor(); | ||
case ADDED: | ||
return Style.getVcsStatusAddedColor(); | ||
case NOT_MODIFIED: | ||
return Style.getMainFontColor(); | ||
default: | ||
return null; | ||
} | ||
} | ||
|
||
public static VcsStatus from(String value) { | ||
return stream(VcsStatus.values()).filter(vcsStatus -> vcsStatus.getValue().equals(value.toLowerCase())) | ||
.findAny() | ||
.orElse(null); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think it makes sense to specify the format of the color in the javadoc, like hash #000000 or color name like blue ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. Any css valid color.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done