Eclipse Shortcut for Team - Synchronize with Repository - eclipse

What are the shortcuts for the context menu actions "Team -> Synchronize with Repository" and "Team -> Update" on the whole project?
I have already found shortcuts, but these are executed only on the file i have currently opened. But I want to execute it on the whole project without having to scroll the project explorer to the top and right-clicking on the project.
If there are no such shortcuts, how can I create them?

As john.k.doe indicates, that's the right solution, but you also need to do something else in order to make the shortcut actually work, which is go to Window > Customize Perspective > Command Groups Availability and there just check the SVN box ;)

you can almost always get the key shortcuts you want by
go to preferences type "keys" or go to General -> Keys
in the field presented when you click on "Keys"
in the left pane, type the command you are interested in setting up a shortcut for:
the image below is from my mac, but it works the same way on windows/linux, you just might choose something besides Cmd-Y as your shortcut modifier. the U under User indicates that i was the one to add that modification.

I have written a small Eclipse plug-in which selects the active project in the Package Explorer so you can execute other actions (like 'Sync with repo' and 'Update') on it. I think this approach is more flexible compared to writing a plug-in that selects the project and executes a predefined action.
You can get the plug-in at http://code.google.com/a/eclipselabs.org/p/eclipse-tweaks/downloads/list, it is named "com.xakcop.select". Download it and put it in the dropins/ folder of your Eclipse installation. Then when you restart Eclipse, you will find a new command Select project in Windows->Preferences->Keys. The default key binding is Ctrl+Shift+Backspace but you can change it to whatever you want.
When you are in the Java editor just press Ctrl+Shift+Backspace, this will select the project that the current file belongs to in Package Explorer. Then press the shortcut for "Synchronize with repository" and you are done.
The source code of the plug-in is also available as part of my eclipse-tweaks project: http://code.google.com/a/eclipselabs.org/p/eclipse-tweaks/source/browse/com.xakcop.select

I think the answer to this question adresses the issue.
The quickest way I've found to update/synchronize, after having set the shortcut keys, is to click on the minimize button in the Project/Package Explorer and then press the keys. After the update, simply clicking on the last used file in the editor returns to the previous workspace state (provided the "Link with Editor" button in Project Explorer is selected).
I should clarify: I use a working set for each project. The working sets are displayed as default Top Level Elements in the Package Explorer so, by clicking on the minimize button the desired Project' working set, they collapse and are easy to select. Then, I apply the shortcut on the selected working set.

From my point of view, the problem is the focus of the commands you execute.
The Team commands Snychronize and Update are executed on the current object (In my case). As you noticed, when you execute the command on the project, the project is synchonized - when you do it on a file, only the file is synchronized.
What I did as workaround is the following:
I created Key-Bindings for the commands Show in (Navigator) (Alt-N), Go to (Alt-G), and Show View (Naviator) (CTRL+SHIFT+Q, N).
With Alt-N I show the current File in the Navigator. I can then use the keys to navigate to the root that I want to synchronize (it's not always the whole project for me). If the root is to far away I use Alt-G and type the Project or Folder where I want to go to and execute afterwards the Synchronize commands.
(Go to works only in the current view)
If you have selected the Project once you just have to switch to the navigator (Show View command) and execute your synchronize commands.
You could also use rgerganov's plugin then you would not have to execute as many commands.
The procedure works also with other views (package explorer, project explorer)
What about this approach? It should also work for other SCM's or commands you want to execute on any object in the explorer views.

Related

How to add a keyboard shortcut to the Team->Add command in eclipse

I would like to have keyboard shortcuts to Team->Add and Team->Commit in eclipse. I am using eGit.
I added them in Preferences->General->Keys and that works in that the keys show up on the menus next to Team->add and Team->commit.
However, when I press the keys nothing seems to happen. The little Key Assist window pops up after the first key and shows me the matching commands, with 'Add to Git index' included, but the file is not added to the git index.
More generally, I would like to be able to commit the current project to git without having to use the mouse.
Make sure that the Git command groups are available. Right-click a blank area of menu bar -> Customize perspective -> Command groups availability; make sure the 'Git' entry in the available command groups is selected.
When you add a keyboard shortcut in eclipse, you also have a scope attached to it (the "When" field, in Eclipse terms). Make sure that it's set to a scope that'll be in use when you fire the shortcut, like "Java editors" or the more broad "In Windows". (NB: I've not had a chance to test this myself, so I could be barking up the wrong tree).

How do I compare two files using Eclipse? Is there any option provided by Eclipse?

How do I compare two files using Eclipse?
(Currently I am using WinMerge.)
To compare two files in Eclipse, first select them in the Project Explorer / Package Explorer / Navigator with control-click. Now right-click on one of the files, and the following context menu will appear. Select Compare With / Each Other.
Just select all of the files you want to compare, then open the context menu (Right-Click on the file) and choose Compare With, Then select each other..
If one or both of the files you wish to compare isn't in an Eclipse project:
Open the Quick Access search box
Linux/Windows: Ctrl+3
Mac: ⌘+3
Type compare and select Compare With Other Resource
Select the files to compare → OK
You can also create a keyboard shortcut for Compare With Other Resource by going to Window → Preferences → General → Keys
Other than using the Navigator/Proj Explorer and choosing files and doing 'Compare With'->'Each other'... I prefer opening both files in Eclipse and using 'Compare With'->'Opened Editor'->(pick the opened tab)...
You can get this feature via the AnyEdit eclipse plugin located here (you can use Install Software via Eclipse->Help->Install New Software screen):
http://andrei.gmxhome.de/eclipse/
If your compairing javascript you might find it not displaying.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=509820
Here is a workround...
Window > Preferences > Compare/Patch > General Tab
Deselect checkbox next to "Open structure compare automatically"
Compare with Other Resource – The Easy Way using Eclipse (no additional plugin required)
To assign a keyboard shortcut to the feature, go to Window > Preferences > General > Keys, look for the command Compare with Other Resource and assign it to a keyboard shortcut of your liking. See How to manage keyboard shortcuts in Eclipse for more details on configuring shortcuts.
Tip: Alternatively, you could press Ctrl+3 (for Quick Access) and search for Compare with Other Resource. This way you don’t have to configure a shortcut but you’ll have to search for the command every time in Quick Access.
Once the shortcut is assigned, you need to select the source file from the Package Explorer, Project Explorer or Navigator. The easiest way to do this from an open editor is to assign a shortcut to instantly show the file in the Package Explorer or, if it’s not open, to open it quickly using the keyboard.
Now press the keyboard shortcut you assigned to Compare with Other Resource and the following (non-modal) dialog should appear:
Troubleshooting: If the dialog doesn’t appear, it’s probably because you haven’t selected a file in either the Package Explorer or another view that allows file selection. Make sure a file is selected and make sure you haven’t selected the class in the Package Explorer rather than the actual Java file.
Now you can select the second file in the Package Explorer and drag and drop it onto the dialog. Click OK and the comparison editor should display, comparing the two selected files.
Tip: See the post on using shortcuts for common SVN commands for tips on how to navigate the comparison editor with the keyboard.
Comparing External Files
Using the Compare with Other Resource dialog, you can compare a workspace file with an external file or even compare two external files with each other.
Comparing a workspace file with an external file is easy: Once you’ve opened the dialog from a selected file, instead of dragging and dropping another workspace file, tick External File in the Right pane and then Browse to a file on your filesystem.
To compare two external files, you have to start the dialog again from a selected workspace file (choose an arbitrary file). Once open, select External File in the Left pane and Browse to your file then do the same for the Right pane.
Please refer this page for more details: http://www.eclipseonetips.com/2013/09/19/compare-two-workspace-or-external-files-in-eclipse/
If you have Beyond Compare installed, the ContextQuickie eclipse plugin has an option to enable it to be selected from the context menu displayed when you right-click a file.
Install from:
https://github.com/ContextQuickie/ContextQuickie/wiki/Installation
After install, activate Beyond Compare menu items via Window->Preferences->Context Quickie->check 'Enable Beyond Compare'.

Eclipse: How do I refresh an entire workspace? F5 doesn't do it

I have a workspace with a bunch of java projects. If I go to File->Refresh, it doesn't really refresh anything (perhaps the currently selected project). How do I get eclipse to refresh all of the projects?
It will indeed only refresh the current project (or, more specifically, the current selection in the project explorer). I just click somewhere in the project explorer, do Ctrl+A to select all projects and then press F5 to achieve a complete refresh.
If you want to refresh all Projects, ignoring closed projects, then the easiest way is to:
ctrl-click and item in the Project Explorer (to ensure the P. Explorer has focus)
ctrl-click the item again so that it's no longer highlighted (but the P. Explorer still has focus)
F5 will now Refresh the entire workspace
Effectively F5 refreshes the Workspace when a navigation view has focus and nothing is selected.
Ctrl-A, then F5.
You can set up the workspace to automatically refresh when it detects changes in the preferences. (Window > Preferences > General > Workspace > Refresh Automatically)
Easy.
Create an external tool: Run > External Tools > External Tools
Configuration...
Create a new Program configuration Point the location to an exe that is very fast (I use Cygwin's 'ls')
On the Refresh tab, choose Refresh Resources upon completion, The Entire Workspace
On the Build tab, deselect Build before launch
Run the tool to refresh all projects.
Control click all your projects together, then right click and hit refresh.
Usually I refresh all like that, then i make sure to clean all projects and rebuild in eclipse.
For anyone curious how to select all of those projects on OS X where Ctrl+A doesn't work:
Click the first project
Hold down Shift
Hold the ↓ key until they are all selected
Now press F5
This answer led me to an even simpler solution, no configuration necessary.
Cmd-3 build all (control-3 on windows)
Edit: Correction -- I need to both refresh and build. Build does not automatically refresh. I'm currently using two actions, "echo" from my comment in the linked answer I just referred to (an External Tool configuration with a hook to refresh all), followed by cmd-3 "build all"

Running Eclipse projects on the Command Prompt

I have a console-based C project in Eclipse. Is there a button I can press to launch my application in a Command Prompt window?
You can run your application as an External Tool, and there's a toolbar item for that. Looks like a green circle with a white arrow, beside a red toolbox. I'm a Java developer so I don't really know the CDT, but at least in the JDT you can run any command line tool in this way. (If it's not in your toolbar, right-click the toolbar and choose Customize Perspective… then find the External Tools item under Launch, and add it.)
First, click the down-arrow beside the button and then choose External Tools Configurations…. In the dialog, select Program from the left side and then click the New button in the toolbar. You are basically creating a shortcut that will live in the toolbar. At this point you can fill out the command line details to run your application. There's a lot of goodies like setting up environment variables, requiring a build of your projects before launching, etc. When you're done, save it, and you can run it as often as you like by clicking the arrow-and-toolbox button. You can come back and edit it later too, make duplicates, etc.
If you're working with a team, or you just want to do a really nice job:
In the Common tab, under Save as, choose Shared File. This will create a file in your project to represent the tool shortcut that you're building. That means you can check it into your source tree, and others can use it too. These files are XML so you want to check them in as text, not binary.
Start your working directory with ${workspace_loc} so that anyone who checks out your project can run it without having to adjust the shortcut for their file system.
Not directly, but you could configure an Ant task to run it (if it doesn't require console input), or you can configure firing up a JVM under Run|External Tools.

Can't select Primary Output as target of shortcut in Visual Studio 2005 setup project

I've Added a setup project to my solution (didn't use the wizard) I then added the primary output of the Windows Application I have coded to the Applcation Folder node (Right click the setup project in Solution-Explorer and select View -> File System). I Right clicked the User's Desktop node and selected 'Create Shortcut to user's Desktop' in the context menu. Typed a name for the shortcut and then in the properties window clicked the ellipsis button for the Target property. A dialog is displayed but it won't expand the Application folder node and let me select the Primary Output as the target !!! WTF ???
I have done this on another project but I can't for the life of me figure out why I can't do it on this one. Hell! the projects are almost identical in every other way. Gah! going bald. Hoping someone out there is having a better day than me and has time to give me the probably screamingly obvious solution and make me feel lame.
You actually have to right-click on 'Primary Output From ' in your setup project, and create a shortcut to that. Then, you can move the shortcut over to the 'Users Desktop' location within your setup project.
I think you've created a shortcut to the desktop, on the desktop.
Try clicking on User's Desktop, then right-clicking in the right hand pane, and selecting "Create new shortcut" from there.