Adding "open file" button to eclipse toolbar - eclipse

I know you can add new buttons to the eclipse toolbar by writing a custom plugin but just how would i go about adding a simple "open file" button like most editors have?
I guess I can use this as a template to do what i want, but what's the commandId for the "open file dialog":
How to add undo / redo buttons to toolbar in Eclipse?
thank you!

If you want to have a toolbar button which mimics the behaviour of the menu File->Open File..., then you are searching for the command id
org.eclipse.ui.edit.text.openLocalFile
which you would want to use instead of the command ids for the undo/redo in your example.

I don't believe there is a specific commandId for open file dialog that you can use in the toolbar or menu. You would have to create a class that implements the IHandler interface and use something like the JFileChooser to handle the selection of the file.

Related

Eclipse IDE - What are breadcrumbs, and how do I disable them? [duplicate]

How can I disable the Java editor breadcrumb in Eclipse?
If you are referring to the breadcrumbs in the help file of a RCP application, there is only a manual way to do it.
Since Ganymede 3.4M5:
Michael Borgwardt mentions the toolbar icon
Slava Semushin provides a native shortcut based on Ctrl+3+bread, which points directly to the Toggle Java Editor Breadcrumb option.
Shachi reminds us below that you can right-click on any icon on the breadcrumb, and select the entry named "Hide Breadcrumb".
Original answer (manual way, through key mapping)
Find the file org.eclipse.help.webapp\advanced\breadcrumbs.css and replace its contents with.
.help_breadcrumbs {
display: none;
}
For the Java Editor breadcrumb, you need to assign a shortcut to the "Toggle Java Editor Breadcrumb" command (I have tested Alt+B, for instance)
That shortcut will make the breadcrumb bar appear/disappear at will.
With the editor window focussed, look for this icon in your toolbar:
And click on it. That's all. The icon is present by default, but can be deactivated, in which case you have to activated as in MvanGeest's answer.
Another way which works for me at Eclipse Indigo (3.7): press Ctrl+3 and type bread, after that click on item Toggle Java Editor Breadcrumb.
RightClick on any icon on breadcrumb.
There is an option named HIDE BREADCRUMB.
Click it and you are done. :D
Look for this icon in the toolbar:
This button toggles the Breadcrumb view on/off.
(I'm using Eclipse 3.7, and it's there by default)
Here it is :
In the toolbar, toggle bread crumb option.
Something like http://loadcontext.blogspot.com/2008/08/eclipse-34-breadcrumbs-hide-and-show.html?
Customize Perspective, choose the
Commands tab. In the Available command
group, choose Java Editor
Presentation. The Toolbar details
shows the button for Toggle
Breadcrumbs, which looks like a folder
with a C in a circle with a black
triangle on top of it.
Despite my absolute lack of experience with Eclipse, I suppose this setting must appear in other Presentation items too. After the button's enabled, all you have to do is click it. Or not?
Change property breadcrumb.org.eclipse.jdt.ui.JavaPerspective from true to false
in your org.eclipse.jdt.ui.prefs file.
In Juno: type 'Bread' and select 'Toggle Java Editor Breadcrumb'
It very simple just right click in your class editor then select bread crumb or directly right click in top of your class in tool bar then select hide breadcrumb then its done.
When you see the BreadCrumb toolbar, right-click on the green class icon and then from the menu options click on Hide Breadcrumb.

Notepad++ macro in menu bar with icon

I'm looking for a way to add a macro as an icon in the toolbar.
It seems possible to bind keys to the macro, customize the toolbar with Customize Toolbar and use toolbarIcons.xml to customize it. But none of those options provide an option to add a recorded macro as an icon to the toolbar in Notepad++.
Any suggestions?
As you said this can be achieved with CustomizeToolbar plugin. Just follow tyhese steps:
Install CustomizeToolbar plugin (you can find it here on Sourceforge)
Restart notepad++
Enable custom buttons checking Plugin/Customize Toolbar/Custom Buttons:
Notepad++ will ask you to restart:
Open %APPDATA%\Notepad++\plugins\config\CustomizeToolbar.btn and add this line: Macro,YourMacroName,,, replacing YourMacroName with the name of your macro
Restart notepad++
A new button should appear in the toolbar:

eclipse plugin development-adding button to toolbar and its behaviour

Using eclipse plugin, I am trying to add some buttons in toolbar and want to perform some action onclick to that button.
so what i did in extension tab i added org.eclipse.ui.menus and so added a menucontribution to it with URI location- toolbar:org.eclipse.ui.main.toolbar.And then a toolbar in it with a command lets say Design
so by doing this a got a button on toolbar with name Design.
now i want it should be clickable (as for now it is inactive) and on click i can add some behavior/action to it.
please help.
You can use "Hello,World Command" plug-in template which adds a "Sample Menu" in the toolbar and start from that point.

Search text field on menu bar

In a Eclipse RCP application, is there any way I can have text field (for search) on menu bar?
For example I have menu:
File Edit ... Search: |___text field___|
The text field is located at the right end of the menu bar.
I don't think that is easily possible. But you could use the CoolBar to create this functionality.
You can place an SWT control on the toolbar, but it doesn't work for menus. Here is the toolbar way:
Open the extensions tab in plugin.xml file
Add a menuContribution extension to org.eclipse.ui.menus and set it as a toolbar (toolbar:ID)
Add a toolbar to this menuContribution
Add a control to this toolbar
Double click and create the class which extends WorkbenchWindowControlContribution and fill the createControl(...) function using the desired SWT controls.
After setting the menuContribution as a menu, it is still possible to add a control, but unfortunately, it does not show any controls.

How to Display Current Function in Eclipse

I miss a certain functionality in Eclipse. I would like to know the name of the current function the cursor is currently inside. This is useful when browsing unknown code using the search function, for example.
Any idea how to show it? Maybe a plugin?
I'm using the "Toggle Breadcrumb" option from toolbar:
It shows a nice breadcrumb, ending with current function name.
It's quite handy for me, as Outline becomes cumbersome to use if you have zilions of functions.
It produces the following structure above your Java Editor (truncated at the picture below):
The "Outline" view shows the current function.
It may be necessary to enable the 'Link to Editor' option in the Outline View dropdown menu. This might be off by default for CDT.
I was looking for something similar (Xcode-like bar at the top showing the current function, where you can also go to another function by clicking on it to open a popup list of functions). Here is what I settled on with Eclipse 3.5.1 CDT:
I moved the Outline view to the top, resized it to make it a 1-line horizontal strip (don't make it too narrow), and selected "Link With Editor" in its menu, so that it always shows the current function. However, this doesn't open a popup list like Xcode. For that functionality, I assigned a shortcut to the "Show Outline" command which does open a popup list of all functions.
The Eclipse function 'show outline' will pop up a list of outline objects, and it will highlight the object your cursor is inside in grey. It's typically bound to 'ctrl-o' (the letter 'o', not zero), but you can re-bind it as you see fit. I'm running Eclipse with the CDT plugin and it works pretty well for me.
To enable the breadcrumb invoke Toggle Java Editor Breadcrumb in the toolbar or press Alt+Shift+B in the Java editor.
You can also display the Quick Outline (ctrl+o). This way you see the context quickly without having to have a permanent Outline Window linked to the Editor.
Use the "Link With Editor" option on the outline menu
Press Ctrl+o (cursor is currently inside a function at a particular line).
It highlights the current method, or name of the class if the cursor is outside the method body.
You can click on highlighted method.
It has got inline search feature ...start typing name of the method to navigate to the specified method or method with matching search pattern.
If you press again Ctrl+o to shows the inherited members/methods.
Using outline with "link with editor" option worked also for me, thanks!
Just an addition, you can move outline pane in to the same window group as search, progress etc. saves the space in your perspective instead of keeping it at another group.