use of com.intellij.ui.CustomProtocolHandler in project intellij-community by JetBrains.
the class MacMainFrameDecorator method createProtocolHandler.
private static void createProtocolHandler() {
if (ourProtocolHandler == null) {
// install uri handler
final ID mainBundle = invoke("NSBundle", "mainBundle");
final ID urlTypes = invoke(mainBundle, "objectForInfoDictionaryKey:", Foundation.nsString("CFBundleURLTypes"));
final ApplicationInfoEx info = ApplicationInfoImpl.getShadowInstance();
final BuildNumber build = info != null ? info.getBuild() : null;
if (urlTypes.equals(ID.NIL) && build != null && !build.isSnapshot()) {
LOG.warn("no url bundle present. \n" + "To use platform protocol handler to open external links specify required protocols in the mac app layout section of the build file\n" + "Example: args.urlSchemes = [\"your-protocol\"] will handle following links: your-protocol://open?file=file&line=line");
return;
}
ourProtocolHandler = new CustomProtocolHandler();
Application.getApplication().setOpenURIHandler(new OpenURIHandler() {
@Override
public void openURI(AppEvent.OpenURIEvent event) {
ourProtocolHandler.openLink(event.getURI());
}
});
}
}
Aggregations