|
What this is
Other links
The source code
/*
* Sun Public License Notice
*
* The contents of this file are subject to the Sun Public License
* Version 1.0 (the "License"). You may not use this file except in
* compliance with the License. A copy of the License is available at
* http://www.sun.com/
*
* The Original Code is NetBeans. The Initial Developer of the Original
* Code is Sun Microsystems, Inc. Portions Copyright 1997-2001 Sun
* Microsystems, Inc. All Rights Reserved.
*/
package org.netbeans.modules.extbrowser;
import org.openide.awt.HtmlBrowser;
import org.openide.execution.NbProcessDescriptor;
import org.openide.util.NbBundle;
import org.openide.util.Utilities;
/**
* Browser factory for System default Win browser.
*
* @author Martin Grebac
*/
public class SystemDefaultBrowser extends ExtWebBrowser {
private static final long serialVersionUID = -7317179197254112564L;
/** 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 !org.openide.util.Utilities.isWindows () ? Boolean.TRUE : Boolean.FALSE;
}
/** Creates new ExtWebBrowser */
public SystemDefaultBrowser() {
}
/**
* 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 (org.openide.util.Utilities.isWindows ()) {
impl = new NbDdeBrowserImpl(this);
} else {
throw new UnsupportedOperationException (NbBundle.getMessage (SystemDefaultBrowser.class, "MSG_CannotUseBrowser"));
}
return impl;
}
/** Getter for browser name
* @return name of browser
*/
public String getName () {
if (name == null) {
this.name = NbBundle.getMessage(SystemDefaultBrowser.class, "CTL_SystemDefaultBrowserName");
}
return name;
}
/** Setter for browser name
*/
public void setName(String name) {
// system default browser name shouldn't be changed
}
/** 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 () {
String b;
String params = ""; // NOI18N
try {
// finds HKEY_CLASSES_ROOT\\".html" and respective HKEY_CLASSES_ROOT\\
|
| ... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.