This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 222236
Collapse All | Expand All

(-)a/ant.browsetask/antsrc/org/netbeans/modules/ant/browsetask/NbBrowse.java (-1 / +49 lines)
Lines 51-56 Link Here
51
import org.apache.tools.ant.*;
51
import org.apache.tools.ant.*;
52
52
53
import org.openide.awt.HtmlBrowser;
53
import org.openide.awt.HtmlBrowser;
54
import org.netbeans.modules.web.browser.api.BrowserSupport;
55
import org.netbeans.modules.web.clientproject.spi.URLDisplayerImplementation;
56
import org.netbeans.api.project.FileOwnerQuery;
57
import org.openide.filesystems.FileObject;
58
import org.openide.filesystems.FileUtil;
54
59
55
/**
60
/**
56
 * Opens a web browser.
61
 * Opens a web browser.
Lines 68-73 Link Here
68
        file = f;
73
        file = f;
69
    }
74
    }
70
75
76
    private boolean advanced;
77
    public void setAdvanced(boolean advanced) {
78
        this.advanced = advanced;
79
    }
80
81
    private File context;
82
    public void setContext(File f) {
83
        context = f;
84
    }
85
86
    private String urlPath;
87
    public void setUrlPath(String s) {
88
        urlPath = s;
89
    }
90
71
    public void execute() throws BuildException {
91
    public void execute() throws BuildException {
72
        if (url != null ^ file == null) throw new BuildException("You must define the url or file attributes", getLocation());
92
        if (url != null ^ file == null) throw new BuildException("You must define the url or file attributes", getLocation());
73
        if (url == null) {
93
        if (url == null) {
Lines 75-81 Link Here
75
        }
95
        }
76
        log("Browsing: " + url);
96
        log("Browsing: " + url);
77
        try {
97
        try {
78
            HtmlBrowser.URLDisplayer.getDefault().showURL(new URL(url));
98
            URL u = new URL(url);
99
            URL appRoot = null;
100
            if (advanced) {
101
                FileObject fo = FileUtil.toFileObject(context);
102
                if (context == null) {
103
                    throw new BuildException("You must define the context attribute", getLocation());
104
                }
105
                if (fo == null) {
106
                    throw new BuildException("The context file must exist", getLocation());
107
                }
108
                if (urlPath != null && urlPath.length() > 0) {
109
                    if (!url.endsWith(urlPath)) {
110
                        throw new BuildException("The urlPath("+urlPath+") is not part of the url("+url+")", getLocation());
111
                    }
112
                    appRoot = new URL(url.substring(0, url.length()-urlPath.length()));
113
                }
114
                org.netbeans.api.project.Project p = FileOwnerQuery.getOwner(fo);
115
                if (p != null) {
116
                    URLDisplayerImplementation urlDisplayer = (URLDisplayerImplementation)
117
                            p.getLookup().lookup(URLDisplayerImplementation.class);
118
                    if (urlDisplayer != null) {
119
                        urlDisplayer.showURL(appRoot != null ? appRoot : u, u, fo);
120
                        return;
121
                    }
122
                }
123
                HtmlBrowser.URLDisplayer.getDefault().showURL(u);
124
            } else {
125
                HtmlBrowser.URLDisplayer.getDefault().showURL(u);
126
            }
79
        } catch (MalformedURLException e) {
127
        } catch (MalformedURLException e) {
80
            throw new BuildException(e, getLocation());
128
            throw new BuildException(e, getLocation());
81
        }
129
        }
(-)a/ant.browsetask/nbproject/project.properties (-1 / +5 lines)
Lines 45-48 Link Here
45
antsrc.cp=\
45
antsrc.cp=\
46
    ${ant.core.lib}:\
46
    ${ant.core.lib}:\
47
    ${openide.filesystems.dir}/core/org-openide-filesystems.jar:\
47
    ${openide.filesystems.dir}/core/org-openide-filesystems.jar:\
48
    ${openide.awt.dir}/modules/org-openide-awt.jar
48
    ${openide.awt.dir}/modules/org-openide-awt.jar:\
49
    ${openide.util.lookup.dir}/lib/org-openide-util-lookup.jar:\
50
    ${projectapi.dir}/modules/org-netbeans-modules-projectapi.jar:\
51
    ${web.clientproject.api.dir}/modules/org-netbeans-modules-web-clientproject-api.jar:\
52
    ${web.browser.api.dir}/modules/org-netbeans-modules-web-browser-api.jar
(-)a/ant.browsetask/nbproject/project.xml (+33 lines)
Lines 58-63 Link Here
58
                    </run-dependency>
58
                    </run-dependency>
59
                </dependency>
59
                </dependency>
60
                <dependency>
60
                <dependency>
61
                    <code-name-base>org.netbeans.modules.projectapi</code-name-base>
62
                    <build-prerequisite/>
63
                    <compile-dependency/>
64
                    <run-dependency>
65
                        <release-version>1</release-version>
66
                        <specification-version>1.50</specification-version>
67
                    </run-dependency>
68
                </dependency>
69
                <dependency>
70
                    <code-name-base>org.netbeans.modules.web.browser.api</code-name-base>
71
                    <build-prerequisite/>
72
                    <compile-dependency/>
73
                    <run-dependency>
74
                        <specification-version>1.4</specification-version>
75
                    </run-dependency>
76
                </dependency>
77
                <dependency>
61
                    <code-name-base>org.openide.awt</code-name-base>
78
                    <code-name-base>org.openide.awt</code-name-base>
62
                    <build-prerequisite/>
79
                    <build-prerequisite/>
63
                    <run-dependency>
80
                    <run-dependency>
Lines 69-74 Link Here
69
                    <build-prerequisite/>
86
                    <build-prerequisite/>
70
                    <compile-dependency/>
87
                    <compile-dependency/>
71
                </dependency>
88
                </dependency>
89
                <dependency>
90
                    <code-name-base>org.openide.util.lookup</code-name-base>
91
                    <build-prerequisite/>
92
                    <compile-dependency/>
93
                    <run-dependency>
94
                        <specification-version>8.19</specification-version>
95
                    </run-dependency>
96
                </dependency>
97
                <dependency>
98
                    <code-name-base>org.netbeans.modules.web.clientproject.api</code-name-base>
99
                    <build-prerequisite/>
100
                    <compile-dependency/>
101
                    <run-dependency>
102
                        <specification-version>1.13</specification-version>
103
                    </run-dependency>
104
                </dependency>
72
            </module-dependencies>
105
            </module-dependencies>
73
            <public-packages/>
106
            <public-packages/>
74
            <extra-compilation-unit>
107
            <extra-compilation-unit>
(-)a/j2eeserver/src/org/netbeans/modules/j2ee/deployment/config/ConfigSupportImpl.java (-18 lines)
Lines 1009-1030 Link Here
1009
        return allRelativePaths;
1009
        return allRelativePaths;
1010
    }
1010
    }
1011
1011
1012
    // XXX commented out - there does not seem to be any client for 7.3
1013
    // once this is going to be used move to J2eeModuleProvider
1014
    /**
1015
     * The listener interface to listen for deploy on save operations.
1016
     *
1017
     * @since 1.91
1018
     */
1019
    public static interface DeployOnSaveListener {
1020
1021
        /**
1022
         * Invoked when a deploy on save operation has been successfully
1023
         * performed by the infrastructure.
1024
         *
1025
         * @param artifacts artifacts affected by the deploy
1026
         */
1027
        public void deployed(Iterable<ArtifactListener.Artifact> artifacts);
1028
1029
    }
1030
}
1012
}
(-)a/j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/spi/J2eeModuleProvider.java (-4 / +21 lines)
Lines 533-540 Link Here
533
         * @param listener listener to add
533
         * @param listener listener to add
534
         * @since 1.91
534
         * @since 1.91
535
         */
535
         */
536
        // XXX commented out - there does not seem to be any client for 7.3
536
        public void addDeployOnSaveListener( DeployOnSaveListener listener );
537
        //public void addDeployOnSaveListener( DeployOnSaveListener listener );
538
537
539
        /**
538
        /**
540
         * Removes the listener listening for deploy on save.
539
         * Removes the listener listening for deploy on save.
Lines 543-550 Link Here
543
         * @see #addDeployOnSaveListener(org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeModuleProvider.DeployOnSaveListener)
542
         * @see #addDeployOnSaveListener(org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeModuleProvider.DeployOnSaveListener)
544
         * @since 1.91
543
         * @since 1.91
545
         */
544
         */
546
        // XXX commented out - there does not seem to be any client for 7.3
545
        public void removeDeployOnSaveListener( DeployOnSaveListener listener );
547
        //public void removeDeployOnSaveListener( DeployOnSaveListener listener );
548
546
549
        /**
547
        /**
550
         * Retrieves message destinations stored in the module.
548
         * Retrieves message destinations stored in the module.
Lines 723-728 Link Here
723
         */
721
         */
724
        public void bindEjbReferenceForEjb(String ejbName, String ejbType,
722
        public void bindEjbReferenceForEjb(String ejbName, String ejbType,
725
                String referenceName, String jndiName) throws ConfigurationException;
723
                String referenceName, String jndiName) throws ConfigurationException;
724
725
        /**
726
         * The listener interface to listen for deploy on save operations.
727
         *
728
         * @since 1.91
729
         */
730
        public static interface DeployOnSaveListener {
731
732
            /**
733
             * Invoked when a deploy on save operation has been successfully
734
             * performed by the infrastructure.
735
             *
736
             * @param artifacts artifacts affected by the deploy
737
             */
738
            public void deployed(Iterable<ArtifactListener.Artifact> artifacts);
739
740
        }
741
742
726
    }
743
    }
727
744
728
    /**
745
    /**
(-)a/web.browser.api/nbproject/project.xml (+1 lines)
Lines 124-129 Link Here
124
            </module-dependencies>
124
            </module-dependencies>
125
            <friend-packages>
125
            <friend-packages>
126
                <friend>org.netbeans.core.browser.webview</friend>
126
                <friend>org.netbeans.core.browser.webview</friend>
127
                <friend>org.netbeans.modules.ant.browsetask</friend>
127
                <friend>org.netbeans.modules.cordova</friend>
128
                <friend>org.netbeans.modules.cordova</friend>
128
                <friend>org.netbeans.modules.extbrowser</friend>
129
                <friend>org.netbeans.modules.extbrowser</friend>
129
                <friend>org.netbeans.modules.html</friend>
130
                <friend>org.netbeans.modules.html</friend>
(-)a/web.clientproject.api/nbproject/project.xml (+2 lines)
Lines 118-123 Link Here
118
                </dependency>
118
                </dependency>
119
            </module-dependencies>
119
            </module-dependencies>
120
            <friend-packages>
120
            <friend-packages>
121
                <friend>org.netbeans.modules.ant.browsetask</friend>
121
                <friend>org.netbeans.modules.cordova</friend>
122
                <friend>org.netbeans.modules.cordova</friend>
122
                <friend>org.netbeans.modules.cordova.platforms</friend>
123
                <friend>org.netbeans.modules.cordova.platforms</friend>
123
                <friend>org.netbeans.modules.cordova.platforms.android</friend>
124
                <friend>org.netbeans.modules.cordova.platforms.android</friend>
Lines 130-135 Link Here
130
                <friend>org.netbeans.modules.web.inspect</friend>
131
                <friend>org.netbeans.modules.web.inspect</friend>
131
                <friend>org.netbeans.modules.web.javascript.debugger</friend>
132
                <friend>org.netbeans.modules.web.javascript.debugger</friend>
132
                <friend>org.netbeans.modules.web.livehtml</friend>
133
                <friend>org.netbeans.modules.web.livehtml</friend>
134
                <friend>org.netbeans.modules.web.project</friend>
133
                <package>org.netbeans.modules.web.clientproject.api</package>
135
                <package>org.netbeans.modules.web.clientproject.api</package>
134
                <package>org.netbeans.modules.web.clientproject.api.network</package>
136
                <package>org.netbeans.modules.web.clientproject.api.network</package>
135
                <package>org.netbeans.modules.web.clientproject.spi</package>
137
                <package>org.netbeans.modules.web.clientproject.spi</package>
(-)a/web.clientproject.api/src/org/netbeans/modules/web/clientproject/spi/URLDisplayerImplementation.java (+61 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2012 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2012 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.modules.web.clientproject.spi;
43
44
import java.net.URL;
45
import org.openide.filesystems.FileObject;
46
47
/**
48
 * Contract allowing different project types to implement opening of project files
49
 * in a browser. At the moment used only by Java Web project type.
50
 */
51
public interface URLDisplayerImplementation {
52
53
    /**
54
     * 
55
     * @param applicationRootURL root of application to which urlToOpenInBrowser belongs
56
     * @param urlToOpenInBrowser URL of a file to open in browser
57
     * @param context either file corresponding to urlToOpenInBrowser or project's folder
58
     */
59
    void showURL(URL applicationRootURL, URL urlToOpenInBrowser, FileObject context);
60
61
}
(-)a/web.project/nbproject/project.xml (+16 lines)
Lines 336-341 Link Here
336
                    </run-dependency>
336
                    </run-dependency>
337
                </dependency>
337
                </dependency>
338
                <dependency>
338
                <dependency>
339
                    <code-name-base>org.netbeans.modules.web.browser.api</code-name-base>
340
                    <build-prerequisite/>
341
                    <compile-dependency/>
342
                    <run-dependency>
343
                        <specification-version>1.4</specification-version>
344
                    </run-dependency>
345
                </dependency>
346
                <dependency>
339
                    <code-name-base>org.netbeans.modules.web.common</code-name-base>
347
                    <code-name-base>org.netbeans.modules.web.common</code-name-base>
340
                    <build-prerequisite/>
348
                    <build-prerequisite/>
341
                    <compile-dependency/>
349
                    <compile-dependency/>
Lines 514-519 Link Here
514
                        <specification-version>6.2</specification-version>
522
                        <specification-version>6.2</specification-version>
515
                    </run-dependency>
523
                    </run-dependency>
516
                </dependency>
524
                </dependency>
525
                <dependency>
526
                    <code-name-base>org.netbeans.modules.web.clientproject.api</code-name-base>
527
                    <build-prerequisite/>
528
                    <compile-dependency/>
529
                    <run-dependency>
530
                        <specification-version>1.13</specification-version>
531
                    </run-dependency>
532
                </dependency>
517
            </module-dependencies>
533
            </module-dependencies>
518
            <test-dependencies>
534
            <test-dependencies>
519
                <test-type>
535
                <test-type>
(-)a/web.project/src/org/netbeans/modules/web/project/WebActionProvider.java (+11 lines)
Lines 303-308 Link Here
303
303
304
    @Override
304
    @Override
305
    public String[] getTargetNames(String command, Lookup context, Properties p, boolean doJavaChecks) throws IllegalArgumentException {
305
    public String[] getTargetNames(String command, Lookup context, Properties p, boolean doJavaChecks) throws IllegalArgumentException {
306
307
        if (WebProject.isEaselEnable()) {
308
            p.setProperty("browser.advanced", "true");
309
            FileObject fo = context.lookup(FileObject.class);
310
            if (fo == null) {
311
                fo = getProject().getProjectDirectory();
312
            }
313
            String ctx = FileUtil.toFile(fo).getAbsolutePath();
314
            p.setProperty("browser.context", ctx);
315
        }
316
306
        if (command.equals(COMMAND_RUN_SINGLE) ||command.equals(COMMAND_RUN) ||
317
        if (command.equals(COMMAND_RUN_SINGLE) ||command.equals(COMMAND_RUN) ||
307
            command.equals(WebProjectConstants.COMMAND_REDEPLOY) ||command.equals(COMMAND_DEBUG) ||
318
            command.equals(WebProjectConstants.COMMAND_REDEPLOY) ||command.equals(COMMAND_DEBUG) ||
308
            command.equals(COMMAND_DEBUG_SINGLE) || command.equals(JavaProjectConstants.COMMAND_DEBUG_FIX) ||
319
            command.equals(COMMAND_DEBUG_SINGLE) || command.equals(JavaProjectConstants.COMMAND_DEBUG_FIX) ||
(-)a/web.project/src/org/netbeans/modules/web/project/WebProject.java (-17 / +149 lines)
Lines 49-54 Link Here
49
import java.io.*;
49
import java.io.*;
50
import java.lang.ref.Reference;
50
import java.lang.ref.Reference;
51
import java.lang.ref.WeakReference;
51
import java.lang.ref.WeakReference;
52
import java.net.MalformedURLException;
53
import java.net.URL;
52
import java.util.*;
54
import java.util.*;
53
import java.util.ArrayList;
55
import java.util.ArrayList;
54
import java.util.concurrent.CopyOnWriteArrayList;
56
import java.util.concurrent.CopyOnWriteArrayList;
Lines 149-160 Link Here
149
import org.netbeans.modules.j2ee.deployment.devmodules.api.InstanceRemovedException;
151
import org.netbeans.modules.j2ee.deployment.devmodules.api.InstanceRemovedException;
150
import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule.Type;
152
import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule.Type;
151
import org.netbeans.modules.j2ee.deployment.devmodules.spi.ArtifactListener;
153
import org.netbeans.modules.j2ee.deployment.devmodules.spi.ArtifactListener;
154
import org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeModuleProvider.ConfigSupport.DeployOnSaveListener;
152
import org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeModuleProvider.DeployOnSaveSupport;
155
import org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeModuleProvider.DeployOnSaveSupport;
153
import org.netbeans.modules.j2ee.metadata.model.api.MetadataModel;
156
import org.netbeans.modules.j2ee.metadata.model.api.MetadataModel;
154
import org.netbeans.modules.j2ee.spi.ejbjar.EjbJarFactory;
157
import org.netbeans.modules.j2ee.spi.ejbjar.EjbJarFactory;
155
import org.netbeans.modules.j2ee.spi.ejbjar.support.EjbJarSupport;
158
import org.netbeans.modules.j2ee.spi.ejbjar.support.EjbJarSupport;
156
import org.netbeans.modules.java.api.common.project.ProjectProperties;
159
import org.netbeans.modules.java.api.common.project.ProjectProperties;
157
import org.netbeans.modules.web.api.webmodule.WebProjectConstants;
160
import org.netbeans.modules.web.api.webmodule.WebProjectConstants;
161
import org.netbeans.modules.web.browser.api.BrowserSupport;
162
import org.netbeans.modules.web.browser.spi.PageInspectorCustomizer;
163
import org.netbeans.modules.web.clientproject.spi.URLDisplayerImplementation;
164
import org.netbeans.modules.web.common.api.WebUtils;
165
import org.netbeans.modules.web.common.spi.ServerURLMappingImplementation;
158
import org.netbeans.modules.web.project.api.WebProjectUtilities;
166
import org.netbeans.modules.web.project.api.WebProjectUtilities;
159
import org.netbeans.modules.web.project.classpath.ClassPathSupportCallbackImpl;
167
import org.netbeans.modules.web.project.classpath.ClassPathSupportCallbackImpl;
160
import org.netbeans.modules.web.project.classpath.DelagatingProjectClassPathModifierImpl;
168
import org.netbeans.modules.web.project.classpath.DelagatingProjectClassPathModifierImpl;
Lines 177-183 Link Here
177
import org.netbeans.spi.project.support.ant.PropertyUtils;
185
import org.netbeans.spi.project.support.ant.PropertyUtils;
178
import org.netbeans.spi.queries.FileEncodingQueryImplementation;
186
import org.netbeans.spi.queries.FileEncodingQueryImplementation;
179
import org.openide.filesystems.FileLock;
187
import org.openide.filesystems.FileLock;
180
import org.openide.filesystems.FileSystem;
181
import org.openide.filesystems.FileSystem.AtomicAction;
188
import org.openide.filesystems.FileSystem.AtomicAction;
182
import org.openide.loaders.DataObject;
189
import org.openide.loaders.DataObject;
183
import org.openide.util.Exceptions;
190
import org.openide.util.Exceptions;
Lines 600-606 Link Here
600
            ExtraSourceJavadocSupport.createExtraJavadocQueryImplementation(this, helper, eval),
607
            ExtraSourceJavadocSupport.createExtraJavadocQueryImplementation(this, helper, eval),
601
            LookupMergerSupport.createJFBLookupMerger(),
608
            LookupMergerSupport.createJFBLookupMerger(),
602
            QuerySupport.createBinaryForSourceQueryImplementation(sourceRoots, testRoots, helper, eval),
609
            QuerySupport.createBinaryForSourceQueryImplementation(sourceRoots, testRoots, helper, eval),
603
            new ProjectWebRootProviderImpl()
610
            new ProjectWebRootProviderImpl(),
611
            new ClientSideDevelopmentSupport(),
604
        });
612
        });
605
613
606
        Lookup ee6 = Lookups.fixed(new Object[]{
614
        Lookup ee6 = Lookups.fixed(new Object[]{
Lines 1506-1512 Link Here
1506
     * Class should not request project lock from FS listener methods
1514
     * Class should not request project lock from FS listener methods
1507
     * (deadlock prone).
1515
     * (deadlock prone).
1508
     */
1516
     */
1509
    private class CopyOnSaveSupport extends FileChangeAdapter implements PropertyChangeListener {
1517
    private class CopyOnSaveSupport extends FileChangeAdapter implements PropertyChangeListener, DeployOnSaveListener {
1510
1518
1511
        private FileObject docBase = null;
1519
        private FileObject docBase = null;
1512
1520
Lines 1556-1591 Link Here
1556
            resources = getWebModule().getResourceDirectory();
1564
            resources = getWebModule().getResourceDirectory();
1557
            buildWeb = evaluator().getProperty(WebProjectProperties.BUILD_WEB_DIR);
1565
            buildWeb = evaluator().getProperty(WebProjectProperties.BUILD_WEB_DIR);
1558
1566
1559
            FileSystem docBaseFileSystem = null;
1560
            if (docBase != null) {
1567
            if (docBase != null) {
1561
                docBaseFileSystem = docBase.getFileSystem();
1568
                docBase.addRecursiveListener(this);
1562
                docBaseFileSystem.addFileChangeListener(this);
1563
            }
1569
            }
1564
1570
1565
            if (webInf != null) {
1571
            if (webInf != null && !FileUtil.isParentOf(docBase, webInf)) {
1566
                if (!webInf.getFileSystem().equals(docBaseFileSystem)) {
1572
                webInf.addRecursiveListener(this);
1567
                    webInf.getFileSystem().addFileChangeListener(this);
1568
                }
1569
            }
1573
            }
1570
1574
1571
            if (resources != null) {
1575
            if (resources != null) {
1572
                FileUtil.addFileChangeListener(this, resources);
1576
                FileUtil.addFileChangeListener(this, resources);
1573
            }
1577
            }
1574
1578
1579
            // Add deployed resources notification listener
1580
            if (isEaselEnable()) {
1581
                webModule.getConfigSupport().addDeployOnSaveListener(this);
1582
            }
1583
1575
            LOGGER.log(Level.FINE, "Web directory is {0}", docBaseValue);
1584
            LOGGER.log(Level.FINE, "Web directory is {0}", docBaseValue);
1576
            LOGGER.log(Level.FINE, "WEB-INF directory is {0}", webInfValue);
1585
            LOGGER.log(Level.FINE, "WEB-INF directory is {0}", webInfValue);
1577
        }
1586
        }
1578
1587
1579
        public void cleanup() throws FileStateInvalidException {
1588
        public void cleanup() throws FileStateInvalidException {
1580
            FileSystem docBaseFileSystem = null;
1581
            if (docBase != null) {
1589
            if (docBase != null) {
1582
                docBaseFileSystem = docBase.getFileSystem();
1590
                docBase.removeRecursiveListener(this);
1583
                docBaseFileSystem.removeFileChangeListener(this);
1584
            }
1591
            }
1585
            if (webInf != null) {
1592
            if (webInf != null && !FileUtil.isParentOf(docBase, webInf)) {
1586
                if (!webInf.getFileSystem().equals(docBaseFileSystem)) {
1593
                webInf.removeRecursiveListener(this);
1587
                    webInf.getFileSystem().removeFileChangeListener(this);
1588
                }
1589
            }
1594
            }
1590
            if (resources != null) {
1595
            if (resources != null) {
1591
                FileUtil.removeFileChangeListener(this, resources);
1596
                FileUtil.removeFileChangeListener(this, resources);
Lines 1593-1598 Link Here
1593
            }
1598
            }
1594
1599
1595
            WebProject.this.evaluator().removePropertyChangeListener(this);
1600
            WebProject.this.evaluator().removePropertyChangeListener(this);
1601
1602
            if (isEaselEnable()) {
1603
                webModule.getConfigSupport().removeDeployOnSaveListener(this);
1604
            }
1596
        }
1605
        }
1597
1606
1598
        public void propertyChange(PropertyChangeEvent evt) {
1607
        public void propertyChange(PropertyChangeEvent evt) {
Lines 1902-1907 Link Here
1902
            assert current != null : "webBuildBase: " + webBuildBase + ", path: " + path + ", isFolder: " + isFolder;
1911
            assert current != null : "webBuildBase: " + webBuildBase + ", path: " + path + ", isFolder: " + isFolder;
1903
            return current;
1912
            return current;
1904
        }
1913
        }
1914
1915
        public void deployed(Iterable<Artifact> artifacts) {
1916
            for (Artifact artifact : artifacts) {
1917
                FileObject fileObject = getReloadFileObject(artifact);
1918
                if (fileObject != null) {
1919
                    reload(fileObject);
1920
                }
1921
            }
1922
        }
1923
1924
        private void reload(FileObject fo) {
1925
            URL u = getBrowserSupport().getBrowserURL(fo, true);
1926
            if (u != null) {
1927
                assert getBrowserSupport().canReload(u) : u;
1928
                getBrowserSupport().reload(u);
1929
            }
1930
        }
1931
1932
        private FileObject getReloadFileObject(Artifact artifact) {
1933
            File file = artifact.getFile();
1934
            FileObject fileObject = FileUtil.toFileObject(FileUtil.normalizeFile(file));
1935
            if (fileObject == null) {
1936
                return null;
1937
            }
1938
            return getWebDocFileObject(fileObject);
1939
        }
1940
1941
        private FileObject getWebDocFileObject(FileObject artifact) {
1942
            FileObject webBuildBase = buildWeb == null ? null : helper.resolveFileObject(buildWeb);
1943
            if (docBase != null && webBuildBase != null) {
1944
                if (!FileUtil.isParentOf(webBuildBase, artifact)) {
1945
                    return null;
1946
                } else {
1947
                    String path = FileUtil.getRelativePath(webBuildBase, artifact);
1948
                    return docBase.getFileObject(path);
1949
                }
1950
            } else {
1951
                return null;
1952
            }
1953
        }
1954
    }
1955
1956
    private BrowserSupport getBrowserSupport() {
1957
        return BrowserSupport.getDefault();
1958
    }
1959
1960
    public static boolean isEaselEnable() {
1961
        return Boolean.getBoolean("easel.everywhere");
1905
    }
1962
    }
1906
1963
1907
    private class ArtifactCopySupport extends ArtifactCopyOnSaveSupport {
1964
    private class ArtifactCopySupport extends ArtifactCopyOnSaveSupport {
Lines 2290-2293 Link Here
2290
2347
2291
    }
2348
    }
2292
2349
2350
    private class ClientSideDevelopmentSupport implements ServerURLMappingImplementation, 
2351
            URLDisplayerImplementation, PageInspectorCustomizer {
2352
2353
        private String projectRootURL = null;
2354
        private FileObject webDocumentRoot;
2355
        private boolean initialized = false;
2356
2357
        public ClientSideDevelopmentSupport() {
2358
        }
2359
2360
        @Override
2361
        public void showURL(URL applicationRootURL, URL urlToOpenInBrowser, FileObject context) {
2362
            projectRootURL = WebUtils.urlToString(applicationRootURL);
2363
            if (projectRootURL != null && !projectRootURL.endsWith("/")) {
2364
                projectRootURL += "/";
2365
            }
2366
            getBrowserSupport().load(urlToOpenInBrowser, context);
2367
        }
2368
2369
        @Override
2370
        public URL toServer(int projectContext, FileObject projectFile) {
2371
            init();
2372
            if (projectRootURL == null || webDocumentRoot == null) {
2373
                return null;
2374
            }
2375
            String relPath = FileUtil.getRelativePath(webDocumentRoot, projectFile);
2376
            try {
2377
                return new URL(projectRootURL + relPath);
2378
            } catch (MalformedURLException ex) {
2379
                Exceptions.printStackTrace(ex);
2380
                return null;
2381
            }
2382
        }
2383
2384
        @Override
2385
        public FileObject fromServer(int projectContext, URL serverURL) {
2386
            init();
2387
            if (projectRootURL == null || webDocumentRoot == null) {
2388
                return null;
2389
            }
2390
            String u = WebUtils.urlToString(serverURL);
2391
            if (u.startsWith(projectRootURL)) {
2392
                return webDocumentRoot.getFileObject(u.substring(projectRootURL.length()));
2393
            }
2394
            return null;
2395
        }
2396
2397
        private FileObject getWebRoot() {
2398
            WebModule webModule = WebModule.getWebModule(getProjectDirectory());
2399
            return webModule != null ? webModule.getDocumentBase() : null;
2400
        }
2401
2402
        private void init() {
2403
            if (initialized) {
2404
                return;
2405
            }
2406
            webDocumentRoot = getWebRoot();
2407
            initialized = true;
2408
        }
2409
2410
        @Override
2411
        public boolean isHighlightSelectionEnabled() {
2412
            return true;
2413
        }
2414
2415
        @Override
2416
        public void addPropertyChangeListener(PropertyChangeListener l) {
2417
        }
2418
2419
        @Override
2420
        public void removePropertyChangeListener(PropertyChangeListener l) {
2421
        }
2422
2423
    }
2424
2293
}
2425
}
(-)a/web.project/src/org/netbeans/modules/web/project/resources/build-impl.xsl (-1 / +2 lines)
Lines 2139-2145 Link Here
2139
            </target>
2139
            </target>
2140
            
2140
            
2141
            <target name="-display-browser-nb" if="do.display.browser.nb">
2141
            <target name="-display-browser-nb" if="do.display.browser.nb">
2142
                <nbbrowse url="${{client.url}}"/>
2142
                <property name="browser.advanced" value="false"/>
2143
                <nbbrowse url="${{client.url}}" advanced="${{browser.advanced}}" context="${{browser.context}}" urlPath="${{client.urlPart}}"/>
2143
            </target>
2144
            </target>
2144
            
2145
            
2145
            <target name="-get-browser" if="do.display.browser.cl" unless="browser">
2146
            <target name="-get-browser" if="do.display.browser.cl" unless="browser">

Return to bug 222236