blob: 3f971f498fb978841c8a5eabbe6fd128c0e33bad [file] [log] [blame]
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.netbeans.modules.extbrowser;
import org.netbeans.modules.extbrowser.PrivateBrowserFamilyId;
import org.openide.awt.HtmlBrowser;
import org.openide.execution.NbProcessDescriptor;
import org.openide.util.NbBundle;
import org.openide.util.Utilities;
/**
* @author Petr Jiricka
*/
public class SafariBrowser extends ExtWebBrowser {
private static final long serialVersionUID = -1L;
/** Creates new ExtWebBrowser */
public SafariBrowser() {
super(PrivateBrowserFamilyId.SAFARI);
}
/** Determines whether the browser should be visible or not
* @return true when OS is Windows.
* false in all other cases.
*/
public static Boolean isHidden () {
return (Utilities.isMac()) ? Boolean.FALSE : Boolean.TRUE;
}
/** Getter for browser name
* @return name of browser
*/
public String getName () {
if (name == null) {
this.name = NbBundle.getMessage(SafariBrowser.class, "CTL_SafariBrowserName");
}
return name;
}
/**
* Returns a new instance of BrowserImpl implementation.
* @throws UnsupportedOperationException when method is called and OS is not Windows.
* @return browserImpl implementation of browser.
*/
public HtmlBrowser.Impl createHtmlBrowserImpl() {
ExtBrowserImpl impl = null;
if (Utilities.isMac()) {
impl = new MacBrowserImpl(this);
} else {
throw new UnsupportedOperationException (NbBundle.getMessage(SafariBrowser.class, "MSG_CannotUseBrowser"));
}
return impl;
}
/** Default command for browser execution.
* Can be overriden to return browser that suits to platform and settings.
*
* @return process descriptor that allows to start browser.
*/
protected NbProcessDescriptor defaultBrowserExecutable () {
return new NbProcessDescriptor ("/usr/bin/open", // NOI18N
"-a safari {" + ExtWebBrowser.UnixBrowserFormat.TAG_URL + "}",
ExtWebBrowser.UnixBrowserFormat.getHint()); // NOI18N
}
}