Android Studio: How to choose what to import from VCS - java

I'm using Android Studio 2.1, which is based on IntelliJ IDEA 2016.
If you select VCS -> Commit changes there's a nice dialog showing all the modified files and you are able to choose what to commit.
However when selecting VCS -> Update project there's no dialog. You have to update everything give or take.
I really miss eclipse's Team Syncronize perspective. It kicked ass compared to this, both for commiting and updating.
Is there a way of displaying a dialog to select which files to update? Or maybe some plugin? I'm getting tired of importing workspace metadata from other team members, or even broken builds when doing bulk updates. The only workaround seems to be looking at the incoming tab first, and then right click over the files you want, which is not very efficient as you have to expand their packages or parent folder first, and you might also need to manually refresh the incoming tab.

Yes that's a nice question but unforunately we have no ways First thing first to checkout documentation of IntelliJ IDEA 2016.1 Help given here but not in depth. As vcs-> update will update all files from remote branch and it will never provide you options because it is not implemented yet !!
Also see comments discussion on this answer they have talked about whole issue you have here the question asked little matching with yours is this which is the same having this discussion.
This is unlikely to be an issue with the Android tooling and more likely an issue with the underlying intellij idea software.
This is already discuss over here in google code issues :
https://code.google.com/p/android/issues/detail?id=184086
I have already tried to search plugin or help software but coudn't find one. :(

You just can add a .gitignore file for metadata.
Although, when you update your project it's a good practise to commit files before (and choose only those files you want to update).
Regards!

Related

Eclipse commits not showing up on Git Contributions

I am currently going trying to learn java, and my IDE is Eclipse. I connected my Github account and am easily able to push/pull etc. Everything is working great, except for the fact that my commits are not coming up on my Contributions.
I think I have found the issue, but I am not sure what the solution is. If someone can help that would be great, I'm sure it's an easy fix.
Under the "Git Staging" tab on Eclipse, there is a section for 'Author', and 'Committer'.
As I was writing this message I was able to solve this issue.
Under the author & committer section, all you have to do is change it from:
name <name#localhost>
To:
GitHubUsername <GitHubEmail>
For a more permenant solution:
Through this method, it should automatically change the default Author/Committer to what you enter here.
Go through this article for more information.
https://eclipsesource.com/blogs/tutorials/egit-tutorial/

How to update a Github project on IntellijIdea

Everyone
I don't know if the question has already been asked, but I'm looking everywhere but I can't find it.
I am working on a project on Intellij IDEA using GitHub.
I use my desktop computer at work to develop. After finishing I make a commit on Github and it is directly on my account.
But, sometimes I would like to continue at home on my laptop, using the same project as well as modifying and committing it.
Not knowing much about Github in integration with Intellij, I know that I can take an existing project and thus download it locally on my computer. But my question is, how can I update the changed files on each computer.
Example, I work at the office, I modified the A and B file, I commit it to Github, and at home on my computer, I update the Github project on Intellij and suddenly I have the new files modified.
If you have a solution, thank you!
I think you should need to take a "deeper" look into git fundamentals, here's a quick tutorial I think would do for your case:
Learn the Basics of Git in Under 10 Minutes
Also (if u can, and have the time) I would suggest you learn to use the git CLI before the IntelliJIDEA integrated plugin, so that, in case of problems, you know where to look under the hood.
To put it in easy words the most straight-forward thing you can do is (assuming you have already set-up a repo and a branch to work on):
(on the device you just worked on)
git commit -am "comment your wip here"
git push
(on the device where you want to get the work updated)
git pull

perforce workspace root is showing only hard drives

So this is odd for me and occurring multiple times now. I set up an perforce workspace copied from the MASTER and then it works for a few days then one day it just shows the hard drives where it should show the WorkSpace root folder.
All the update workspace and submit options are not allowed and then i have to currently REDO my workspace to get access again.
The settings haven't changed and IDK what could be causing this and how to fix it without a REDO of the workspace.
Is this a problem others have faced ? or just a bug in the software ?
How it does look:
And because I assume this is the first question . I have tried the settings they are still currently setup correctly.
Funny enough, I ran into this issue today.
If someone has this issue make sure that in the top right of the Workspace area, the filter is set to "Workspace Root" and not "Entire Computer". The filter looks like a little funnel for those who don't know.
Picture of Workspace filter image
Looks like your workspace Root has been set to "null" to allow it to map multiple drives. This is not in itself particularly problematic, but it's not something that should happen spontaneously.
The fact that you don't have permission to modify it AND it's changing out from underneath you makes me wonder if you might be using someone else's workspace. Is your username in the "Owner" field? Generally each user should have their own workspace(s).
Assuming that's the problem, the solution is to make your own workspace, and set it to "locked" to prevent anyone else from changing it.

Recover corrupted java file

I tried to reimport my android project on eclipse to solve a problem but I accidently overwrote all my files in the project. All of them had been corrupted which means their size is now 0B...
I tried to use Local History but it's useless since my project is no longer in my workspace, same for .metadata.
I also tried to use Recuva (Software for recovering files) which see my files with their real size but when I try recover them, their size is always 0B...
I lost about 7 days of work and I don't really want to rewrite my code using Java Decompiler...
So my question is, is there any solution to recover that files ?
I wrote 200 lines of code and suddenly system restarted. I lost all code. But I recovered data from eclipse's local history. Right click on the file -->replace with-->previous from Local History
Eclipse has a local history, although by default it's set very low - one of my first tasks when setting up a new development machine is to up the values (in addition to my other version control)
If you do have a history you can right click on your class, and select compare with local history.
You could try decompiling with something like JD-GUI. It might not be as onerous as you think. Obfuscators exist for a reason.
It is not really programming question, but i had similar situation and "Mini Tool Power Data Recovery" tool helped me (it is paid tool, free version exists, but maybe you can search in this direction and find something open source). I tried some another tools then, but with no results.

Can you save groups of tabs in Eclipse so you can open them later?

I have several different processes within a single project that I work on. I am constantly opening and closing tabs(java files) in the code editor for that particular process. Each process almost always uses the same java files.
I was wondering if it is possible to save what files are opened as part of the working set so I can select what working set I want and have all the java files open that I will need to work with. Currently the working set just sets the tree to these files, but I am looking to also have it open the files I need.
I hope this makes sense...
Mylyn should be your answer here.
Mylyn is a task-focused interface for Eclipse that makes working with very large workspaces as easy as working with small ones.
Mylyn extends Eclipse with mechanisms for keeping track of the tasks that you work on.
Mylyn monitors your work activity on those tasks to identify information relevant to the task-at-hand. Mylyn monitors Eclipse and captures your interaction in a task context.
System artifacts such as files, types, methods, and fields get assigned a degree-of-interest based on how recently and frequently you interact with them.
This results in uninteresting elements being filtered from view within Eclipse, allowing you to focus in on what is important.
Following Saheed's answer, don't miss CodeKiller's comment:
You can
Activate the task to reopen all files and
Deactivate the task to close all the files.
Bookmarks (mentioned here by user1039663) is a valable alternative.
Eclipse provides multiple ways of structuring the IDE desktop:
Perspectives: Customization of the positions of open and closed views and editors. You can copy and rename existing perspectives like the Java perspective and suit them to your needs by customizing them. See the Window menu or right-click on the perspective icon in the upper right corner
Task Management Tools like Mylyn: see answer by VonC
Multiple Windows: You can open new windows and move them to your second monitor. Select Window > New Window to open a new window. Each window keeps track of its own open editors.
Multiple Instances of Eclipse: You can always use multiple workspaces and multiple instances of Eclipse. However, this is only recommended when working on different projects, as both instances would overwrite each others files when rebuilding.
Hotkeys: By using shortcuts like Ctrl-T and Alt-Left/Alt-Right and Ctrl-Q you can quickly jump to previous locations where you have edited source files. This is a great help in navigating the open workspace.
Extended VS Presentation provides capabilities to save sessions.
Unluckily, it only works with Eclipse 3.1 to 3.8:
Project page at Eclipse Marketplace
The accepted answer tells us which tool could be used but does not provide a quick and dirty explanation on how to use it.
In my case, I hadn't finished researching a large code base but I needed to save my progress so I could return to it later hence the need to save all open tabs using Mylyn.
If you already have Mylyn installed, navigate to Window -> Show View -> Task List to view the list of tasks. If you've never used it before, the list will be empty.
Right-click inside the Task List view then New -> Category to create a new category. Right-click again New -> Task to create a new task.
Double-click on the task you just created then click on the Context tab at the bottom left of the view.
Now navigate to each tab which you would like Mylyn to save by clicking on the tab name. Notice how an entry for the source file for that tab is added in Context tab of the Task List view.
Once you've cycled through all the tabs you'd like to save, you can confirm they were saved by closing each one and double-clicking the source file in the Task List to restore the tab.
I've edited this answer as per below comment (include essential parts of answer in this post).
Yes, you can save off groups of tabs in Eclipse by installing this Session Manager plug-in.
I've wanted this functionality in Eclipse as well. I recently wrote a feature and have been successfully using it for a few months now. It is a new OSGi type extension and works with Eclipse Neon and above.
Here's how to install it.
In Eclipse, go to Help → Install New Software
Click “Add”, enter a name like “Editor Sessions” and the following URL.
http://spillikinaerospace.com/eclipseInstall/
Unckeck “Group items by category” to see the feature.
Check the box that says “Editor Sessions Manager” and click Next.
Read and agree to the short license agreement.
Click the remaining install buttons.
Allow Eclipse to restart.
Full set of instructions are here: http://chrishull.com/projects/eclipse/
Please give it a try and send comments. I've found it a very useful tool as I work with several Eclipse projects at once and need to recall file groups.
Hope you enjoy it;
-Chris
In addition to all mentioned... Did you try Bookmarks? You can save multiple bookmarks into one set, there are bookmark sets management option and you can add descriptions with prefixes to group bookmarks on the same set. Finally and more important: you can select multiple bookmarks, select goto and multiple editors will be opened at once.
You need a Macro. Searching using this term at Eclipse plugin sites like eclipseplugincentral.com and so on must yield enough suggestions, for example Practically Macro. Good luck.

Categories