RCP application menus in Mac OS - macos

I am struggling to figure out how RCP applications on Mac OS work with "About" and "Preferences" actions. I create them with ActionFactory and place them to relevant file menus. Works fine everywhere. However, on Mac OS those actions get placed into application menu by something which knows better where to put other peoples good actions. But of course they don't work.. Any idea why?
(eclipse target platform 3.7, OSX - the latest El Capitan)

For the 3.x style action bar advisor add the menu item in the normal place but use an ActionContributionItem and set the menu item in be invisible on the Mac:
So for Quit something like:
IWorkbenchAction quitAction = ActionFactory.QUIT.create(window);
register(quitAction);
ActionContributionItem quitItem = new ActionContributionItem(quitAction);
quitItem.setVisible(!Util.isMac());
menu.add(quitItem);
'About' and 'Preferences' can also be specified like this.
Util is org.eclipse.jface.util.Util.
Eclipse will find these items and move them to the correct place.

Related

Create custom right-click menu for OS X app, developed on Linux

I am creating an app for Mac OS, but it is being built on Linux. Because of this, I am not able to use tools such as Xcode, and I am not developing in swift. Rather, the .app directory is being put together according to Apple's documentation, and the entrypoint/executable of my app is a shell script.
I need to customize the menu which appears when you right click on the app (either on the dock icon or in Finder). Is there a way to do this, without using cocoa, etc.?
The menu I believe you are referring to is called "Services".
In order to add a menu item there for your application you would create a script to enable including it there. Xcode isn't needed or required, however, you'll need to know at the very least some basic AppleScript or Javascript to accomplish what you want. (see examples from the link)
↳ Mac Automation Scripting Guide

How to hide Mac OSX menu bar while running an Adobe AIR app?

I need to run an Adobe AIR app across 2 monitors, which cannot be done with fullscreen mode. I am wondering if there is a way to hide the the OSX (Mountain Lion) menu bar. I can span a chromeless AIR window across 2 monitors, but the OSX menu bar is always on top.
Someone posted that they were able to hide the OSX menu bar by using another app (in this post), but so far I have not found a solution.
Sounds like they were using a Native application to remove the UI elements.
I'd suggest you look into doing this through an ANE. If you find the native code for this I'd be happy to wrap it into an ANE for you.
I found an app that can hide the OSX menu bar on Mountain Lion, for AIR apps and pretty much any other apps.
The app is MenuAndDockless
Instructions:
Download the app, install SIMBL loader first (comes with the app download), then install MenuAndDockless app.
Start up the AIR app, or any other kind of app (you will need to restart it if it's already running). Go to the MenuAndDockless Settings (Menu > Window > Settings > Settings…)
Set the desired settings and restart your app.
Here's a detailed manual for the MenuAndDockless app: http://myownapp.com/manuals/mad_manual/

How to change the application menu name in PyQt4 on OS X

I'm porting a PyQt4 (PySide) application that I wrote for Linux and Windows to OS X, menus seem to be otherwise OK out of the box (i.e. Help menu that only has About in it is magically moved to the "main menu" and a File menu is created just fine, but the "main" menu is titled Python instead of Application name.
I call self.setWindowTitle("Appname") in MainWindow.__init__() and self.setApplicationName("Appname") in Application.__init__() but the result is this:
How can I fix this? - Preferably in a way that my app still looks the same as it did before on Windows & Linux.
So it looks like Mac does something different than the other OS systems. I don't have a Mac so I can't really test it out but I think on a Mac the QMainWindow.menuBar() function does not return the application wide menu bar. You might try creating menubar like.
menubar = QtGui.MenuBar()
that has no parent.
I'm getting this information from the following links.
From the documents
Deploying an Application on Mac OS X
Also, it looks like the file Info.plist in "The Bundle" section of the second link is where the application name would live.
I'm sorry I can't be of more help but I hope this information will help you. Good luck!

Menu bar in wrong place (in window) on Mac OS. Netbeans Platform Application

I'm building app in Netbeans Platform 7.1, and the problem is that the menu bar is in the window and not on the top of the desktop, when I run it on Mac OS (Lion).
Where can be the problem?
You will either have to switch back to Java 6 so you can use Apple's implementation or you will have to be patient for OpenJDK to be complete their port.
Edit:
Installed the latest macportpreview of OpenJDK 1.7. But my netbeans platform based application still wasn't using the apple menubar. Then made a small Swing application and it did use the apple menu bar. So it is possible. Tried several things with the netbeans.conf in several locations but didn't help. However the following did work. In one of the core modules in my netbeans platform application I allready had a ModuleInstaller. So I changed the restored function to contain the following lines:
#Override
public void restored() {
if (System.getProperty("os.name").equals("Mac OS X")) {
System.setProperty("apple.laf.useScreenMenuBar", "true");
}
}
Make sure that:
a) -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true are included in the "etc/netbeans.conf" settings file. That makes the platform to place the menu correctly.
b) You're including the "Apple Application Menu" module inside the "platform" cluster, along with the "Window System API" and their dependencies.
Cheers,
Antonio

how to add item in right click context menu of file and folder in objective c

I am developing an cocoa application for Mac and what i need is to add an item in the context menu that appears when user right-clicks on specific file and folder (i.e. when user click on file or folder by pressing ctrl key of keyboard).
I am new to Cocoa application development. I have searched in google for it and found that it can be implemented by using CFPlugIn. Does anyone know how to use CFPlugIn to implement this or any other method to add item in context menu of specific file or folder??
Thanks in advance
You can use system services for contextual menu. you should refer Services Implementation Guide. take a look at Services step out in Snow Leopard article.
If you wish to sell your product on apple app store than you should not follow dropbox.
This is no longer supported in Mac OS X 10.6 and Mac OS X 10.7. Earlier versions of Mac OS X had support for contextual menu plugins, but this feature has since been removed.
What is it you're trying to accomplish in the broader sense? If you give us an idea of what your goal is, we may be able to suggest an alternate way to accomplish it.
Using System Extensions and a FinderSync extension you can accomplish this.
https://developer.apple.com/library/content/documentation/General/Conceptual/ExtensibilityPG/Finder.html

Resources