-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Trash refactor #3342
base: master
Are you sure you want to change the base?
Trash refactor #3342
Conversation
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.
A few minor things.
// Ode.getInstance().getFolderManager().addFolderManagerEventListener(this); | ||
|
||
// It is important to listen to project manager events as soon as possible. | ||
Ode.getInstance().getProjectManager().addProjectManagerEventListener(this); | ||
// Ode.getInstance().getProjectManager().addProjectManagerEventListener(this); |
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.
Are we sure commenting these out is the correct thing to be doing?
folder.removeProject(project); | ||
Ode.getInstance().getFolderManager().saveAllFolders(); | ||
refresh(); | ||
|
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.
Could remove this blank line entirely.
project.restoreFromTrash(); | ||
} | ||
List<ProjectFolder> selectedFolders = ProjectListBox.getProjectListBox().getProjectList() | ||
.getSelectedFolders(); |
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.
Indentation should just be +4 here.
List<ProjectFolder> selectedFolders = ProjectListBox.getProjectListBox().getProjectList() | ||
.getSelectedFolders(); | ||
if (!selectedProjects.isEmpty() || !selectedFolders.isEmpty()) { | ||
Ode.getInstance().getFolderManager().moveItemsToFolder(selectedProjects, selectedFolders, |
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 could cache the call to Ode.getInstance() and reuse it.
for (ProjectFolder child : folder.getChildFolders()) { | ||
if (!"*trash*".equals(child.getName()) && !selectedFolders.contains(child)) { | ||
FolderTreeItem childItem = renderFolder(child); | ||
childItem.setState(true); | ||
treeItem.addItem(childItem); | ||
} |
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 was the indentation changed here?
Project currentProject = Ode.getInstance().getProjectManager().getProject(Ode.getInstance().getCurrentYoungAndroidProjectId()); | ||
selectedProjects.add(currentProject); | ||
if (deleteConfirmation(selectedProjects)) { | ||
if (deleteConfirmation(true, selectedProjects, new ArrayList<>())) { |
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.
It might be better to use Collections.emptyList()
if GWT supports it in order to not have to result a new list every time this gets called.
General items:
ant tests
passes on my machineFor all other changes:
master
master
as the baseWhat does this PR accomplish?
Previously, the trash can only accepted projects, and it was impossible to delete folders. This change refactors the trash/restore/delete system to behave more like the trash system from an OS. Project can be moved to trash individually, and folders can be trashed with their nested contents of projects and folders. All of these things can be restored or deleted permanently
Fixes #3222