How can I add an AppleScript menu to my menubar? - objective-c

How can I add such a menu to the menu bar in my Cocoa application?
Various applications, for example Coda, have this. Is there an easy way to do this or must I implement this myself?

You must implement this yourself.

The ApplScript Editor has a preverence page where you can activate "show apple script menu in menu bar" (or something similar worded)

Related

Managing IntelliJ Tool Windows, how to

Currently my IntelliJ shows amongst other things
How do i decide
What tool windows are shown
Where they are shown
Those things are called Tool Windows, and you can find them at View > Tool Windows.
To disable some of them, you can install the plugin ToolWindow Manager and disable one by one.
You can enable/disable all tool windows in Settings > Appearance > Show tool window bars
You can find more information about them here.
These are called "Tool Windows". If you right click on them it shows a menu that at the bottom has a "Hide" option. I notice some of them can't be hidden, but you can drag them to other places that are out of your view. For example, you can drag them from the bottom to the side. You can also drag to answer your second question.

How to add a button to the main toolbar in Eclipse programmatically

I've a question. I cannot find the way, how to add buttons to main toolbar programmatically. My problem is, that I've the task to dynamically (based on XML configuration file) build menus and toolbar. I found how to add a menu item programmatically, but not toolbar button.
Tutorials mostly show how to create buttons and menus using plugin descriptor (plugin.xml), but not how to do it programatically. It seems, that it is out of bounds of Eclipse plugin philosophy.
I've just found this:
There might be layout problems with this approach. I also don't
believe the framework will try and re-create your dynamic item except
at random toolbarmanager updates. With Menus they can be updated on an
SWT.Show event, which is why CompoundContributionItem only applies to
Menus.
What shall I do? Can I say Sorry, there is no way to build toolbar dynamically. I can do it just for menus? Collegue says, that it must be possible, but he does neither know how.
The only way to be able to create main toolbar entries programmatically is in an RCP app, where you supply the ActionBarAdvisor for the workbench window. This isn't dynamic, however, just called on window creation.
Another way to do it would be to use org.eclipse.ui.menus and contribute org.eclipse.ui.menus.ExtensionContributionFactory. It also works only on workbench window creation (not really dynamic), but you could read your own XML and provide IContributionItems for the main menu or toolbar.
How dynamic are you trying to be? Most solutions work well on startup/window creation.
PW
Whenever you try to do something programmatically in Eclipse that is normally done through plugin definitions you are walking on thin ice. I've tried it on a few occasions and it rarely ended up being easy or good.
Instead, think of what it is that you only know at runtime and need to be able to change on the fly. Is it the name or icon of the button? That can be changed at runtime.
Take a look at runtime commands, they can be confusing to define properly, but with them you can for example create buttons that are only visible if a condition is active. That condition could be set at runtime.

eclipse menu contribution

I want to add a menu to the eclipse menubar in a RCP application and that menu will be shown active based on some condition(e.g return value of some method) in Java code .Please let me know how can I do it.
Here you find some short examples. Maybe that is enough to give you an idea.
A menu can not be enabled/disabled directly based on an expression - that is only possible for the menu items themselves.
To enable/disable a menu item, have a look at Command Core Expressions in the Eclipse Wiki...

Editor context Menu - Eclipse-RCP

I have an Eclipse RCP application. I have created an Editor. There are few context menu (default), when I right click on the Editor. I have not created these menus.
Please let me know, How to remove the context menu of the Editor?
It needs different approach by which editor you extends.
Let me know What you extends, than I can answer more efficient one.
In general way:
IWorkbenchParSite#registerContextMenu(...) will be used, So find where calls that, override it. It is not recommend. Because by doing this, Menu Extensions which is contributed for your editor will not work anymore.
If you mean the system menu that appears on editor tabs and view tabs, that menu is provided by the presentation (2.1, Classic, Default, etc). There is no tweak to simply modify it.
The 2 ways to remove it would be:
write your own presentation, using
the
org.eclipse.ui.presentations.StackPresentation
API and matching extension point.
Writing a presentation is a involved
undertaking.
Change the internal classes in the
org.eclipse.ui.workbench plugin
and patch that plugin in your RCP
app.
If you use Text or StyleText you will get the system default menu (cut,copy,paste, maybe something about encoding or input). If you are not going to supply your own menu, simply create an empty SWT Menu and set it:
Menu emptyMenu = new Menu(text);
text.setMenu(emptyMenu);
Eclipse also has a text editing framework, if you need more than a basic text box you should check it out. http://wiki.eclipse.org/The_Official_Eclipse_FAQs#Text_Editors

Display a pulldown item in Eclipse programatically

I know that I can declare actions in plugin.xml that specify style="pulldown" in order to make a pulldown style toolbar button, but I want to be able to do it programatically, using the IToolBarManager and IContributionItem interfaces.
I've looked through the interfaces, and the implementations of various things in eclipse, but I can't see how I'd do it. Ideally I want to add such a toolbar item from an IEditorActionBarContributor implementation.
Anyone got any ideas?
In answer to my own question, you need to create an Action object, and then call setMenuCreator on the action. Then when you add the action to the toolbar you'll get a drop down menu.