-
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-3271: Add more Git actions to context menu #3618
Conversation
Resource[] resources = appContext.getResources(); | ||
Path[] paths = new Path[resources.length]; | ||
for (int i = 0; i < resources.length; i++) { | ||
Path path = resources[i].getLocation().removeFirstSegments(appContext.getRootProject().getLocation().segmentCount()); |
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.
appContext.getRootProject().getLocation().segmentCount()
will be always equals to 1
, so you can safely remove the first segment without this checking.
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
**/ | ||
@Singleton | ||
public class AddToIndexAction extends GitAction { | ||
private final AddToIndexPresenter presenter; | ||
private static final String ADD_TO_INDEX_COMMAND_NAME = "Git add to index"; |
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.
You have two equals constants in action and presenter, consider to extract it to the shared place of interface.
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.
moved to constants
consolesPanelPresenter.addCommandOutput(appContext.getDevMachine().getId(), console); | ||
notificationManager.notify(constant.statusFailed(), FAIL, FLOAT_MODE); | ||
public void showDialog() { | ||
if (appContext.getResources().length == 1) { |
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.
appContext.getResources()
may be null
add additional checking for that.
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
* @param all | ||
* automatically stage files that have been modified and deleted | ||
* @param files | ||
* the list of iles that are commited, ignoring the index |
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.
iles
-> files
and commited
-> committed
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
HTML message; | ||
@UiField | ||
TextArea items; | ||
Label message; |
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.
Reformat this code.
this.items.setText(sb.toString()); | ||
} | ||
public void setMessage(String message) { | ||
this.message.getElement().setInnerHTML(message); |
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.
this.message.setText(message);
.
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.
The message
parameter is given in html format, and setText()
would display the raw massage with html tags. How about just to rename this parameter to htmlMessage
?
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.
Yes, it would be better to rename the parameter.
* @param includeSelection is selection included | ||
*/ | ||
void setIncludeSelection(boolean includeSelection); | ||
/** Returns true if the project explorer selection must be added to index before commit, and <code>false</code> otherwise. */ |
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.
Simple selection, it might not be from project explorer. Paraphrase this sentence.
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
String selectedItemPath = selectedItem.getLocation() | ||
.removeFirstSegments(appContext.getRootProject().getLocation().segmentCount()) | ||
.toString(); | ||
for (IndexFile file : indexedFiles) |
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.
Wrap this block of code in curly brackets according to our coding style.
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
//Mark selected items to reset from index | ||
for (Resource selectedItem : appContext.getResources()) { | ||
String selectedItemPath = selectedItem.getLocation() | ||
.removeFirstSegments(appContext.getRootProject().getLocation().segmentCount()) |
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.
The same as above, you can simply remove the first segment from the path.
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
Build # 1525 - FAILED Please check console output at https://ci.codenvycorp.com/job/che-pullrequests-build/1525/ to view the results. |
Build # 1532 - FAILED Please check console output at https://ci.codenvycorp.com/job/che-pullrequests-build/1532/ to view the results. |
Build # 1534 - FAILED Please check console output at https://ci.codenvycorp.com/job/che-pullrequests-build/1534/ to view the results. |
* @param amend | ||
* indicates that previous commit must be overwritten | ||
*/ | ||
Promise<Revision> commit(DevMachine devMachine, Path project, String message, boolean all, Path[] files, boolean amend); |
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.
why we need Path[] files
if you added all options ? If all will be true
what need to set to the files
?
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.
all
parameter means add to index all changes and files
parameter defines what files to commit. all
can be true
and files
parameter can contain items, this will happen when user would call commit operation on selected items and would select Add all changes except of new files
check box.
We have separate issue: #3614 to improve this window where add to index action will be performed automaticaly because user will have an ability to chose all changed files directly in the window.
Build success. https://ci.codenvycorp.com/job/che-pullrequests-build/1565/ |
What does this PR do?
Added file related git actions to project explorer and editor context menu.
Updated those git actions to have an ability to use them with resource selection.
What issues does this PR fix or reference?
#3271
Tests written?
Yes