Skip to content

Commit

Permalink
[INFRA-15006] Initial donation of NetBeans.
Browse files Browse the repository at this point in the history
Equivalent to the content of netbeans-donation-review.zip donated as part of ApacheNetBeansDonation1.zip with SHA256 being 7f2ca0f61953a190613c9a0fbcc1b034084b04a4d55d23c02cefffc354e7c24a.
  • Loading branch information
pgebauer committed Sep 11, 2017
0 parents commit 6daa72c
Show file tree
Hide file tree
Showing 44,509 changed files with 17,935,083 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
*
* Oracle and Java are registered trademarks of Oracle and/or its affiliates.
* Other names may be trademarks of their respective owners.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common
* Development and Distribution License("CDDL") (collectively, the
* "License"). You may not use this file except in compliance with the
* License. You can obtain a copy of the License at
* http://www.netbeans.org/cddl-gplv2.html
* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
* specific language governing permissions and limitations under the
* License. When distributing the software, include this License Header
* Notice in each file and include the License file at
* nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the
* License Header, with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* Contributor(s):
*
* The Original Software is NetBeans. The Initial Developer of the Original
* Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
* Microsystems, Inc. All Rights Reserved.
*
* If you wish your version of this file to be governed by only the CDDL
* or only the GPL Version 2, indicate your decision by adding
* "[Contributor] elects to include this software in this distribution
* under the [CDDL or GPL Version 2] license." If you do not indicate a
* single choice of license, a recipient has the option to distribute
* your version of this file under either the CDDL, the GPL Version 2 or
* to extend the choice of license to its licensees as provided above.
* However, if you add GPL Version 2 code and therefore, elected the GPL
* Version 2 license, then the option applies only if the new code is
* made subject to such option by the copyright holder.
*/

package org.netbeans.modules.ant.browsetask;

import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;

import org.apache.tools.ant.*;

import org.openide.awt.HtmlBrowser;
import org.netbeans.modules.web.browser.spi.URLDisplayerImplementation;
import org.netbeans.api.project.FileOwnerQuery;
import org.openide.filesystems.FileObject;
import org.openide.filesystems.FileUtil;

/**
* Opens a web browser.
* @author Jesse Glick
*/
public class NbBrowse extends Task {

private String url;
public void setUrl(String s) {
url = s;
}

private File file;
public void setFile(File f) {
file = f;
}

private File context;
public void setContext(File f) {
context = f;
}

private String urlPath;
public void setUrlPath(String s) {
urlPath = s;
}

public void execute() throws BuildException {
if (url != null ^ file == null) throw new BuildException("You must define the url or file attributes", getLocation());
if (url == null) {
url = file.toURI().toString();
}
log("Browsing: " + url);
try {
URL u = new URL(url);
URL appRoot = null;
if (context != null) {
FileObject fo = FileUtil.toFileObject(context);
org.netbeans.api.project.Project p = null;
if (fo != null) {
p = FileOwnerQuery.getOwner(fo);
}
if (urlPath != null && urlPath.length() > 0) {
if (!url.endsWith(urlPath)) {
throw new BuildException("The urlPath("+urlPath+") is not part of the url("+url+")", getLocation());
}
appRoot = new URL(url.substring(0, url.length()-urlPath.length()));
}
if (p != null) {
URLDisplayerImplementation urlDisplayer = (URLDisplayerImplementation)
p.getLookup().lookup(URLDisplayerImplementation.class);
if (urlDisplayer != null) {
urlDisplayer.showURL(appRoot != null ? appRoot : u, u, fo);
return;
}
}
}
HtmlBrowser.URLDisplayer.getDefault().showURL(u);
} catch (MalformedURLException e) {
throw new BuildException(e, getLocation());
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
Copyright (c) 2004, 2016 Oracle and/or its affiliates. All rights reserved.
Oracle and Java are registered trademarks of Oracle and/or its affiliates.
Other names may be trademarks of their respective owners.
The contents of this file are subject to the terms of either the GNU
General Public License Version 2 only ("GPL") or the Common
Development and Distribution License("CDDL") (collectively, the
"License"). You may not use this file except in compliance with the
License. You can obtain a copy of the License at
http://www.netbeans.org/cddl-gplv2.html
or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
specific language governing permissions and limitations under the
License. When distributing the software, include this License Header
Notice in each file and include the License file at
nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
particular file as subject to the "Classpath" exception as provided
by Oracle in the GPL Version 2 section of the License file that
accompanied this code. If applicable, add the following below the
License Header, with the fields enclosed by brackets [] replaced by
your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"
If you wish your version of this file to be governed by only the CDDL
or only the GPL Version 2, indicate your decision by adding
"[Contributor] elects to include this software in this distribution
under the [CDDL or GPL Version 2] license." If you do not indicate a
single choice of license, a recipient has the option to distribute
your version of this file under either the CDDL, the GPL Version 2 or
to extend the choice of license to its licensees as provided above.
However, if you add GPL Version 2 code and therefore, elected the GPL
Version 2 license, then the option applies only if the new code is
made subject to such option by the copyright holder.
Contributor(s):
-->
<antlib>
<taskdef name="nbbrowse" classname="org.netbeans.modules.ant.browsetask.NbBrowse"/>
</antlib>
Loading

0 comments on commit 6daa72c

Please sign in to comment.