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 194683
Collapse All | Expand All

(-)masterfs/apichanges.xml (+13 lines)
Lines 49-54 Link Here
49
        <apidef name="masterfs">MasterFileSystem API</apidef>
49
        <apidef name="masterfs">MasterFileSystem API</apidef>
50
    </apidefs>
50
    </apidefs>
51
    <changes>
51
    <changes>
52
        <change id="canWrite">
53
            <api name="masterfs"/>
54
            <summary>Delegate FileObject.copy() to ProvidedExtensions</summary>
55
            <version major="2" minor="29"/>
56
            <date day="1" month="2" year="2011"/>
57
            <author login="tstupka"/>
58
            <compatibility addition="yes" binary="compatible" source="compatible" semantic="compatible" deprecation="no" deletion="no" modification="no"/>
59
            <description>
60
                Setup if an ProvidedExtensions instance should be used to determine a files canWrite() value
61
            </description>
62
            <class package="org.netbeans.modules.masterfs.providers" name="ProvidedExtensions"/>
63
            <issue number="194683"/>
64
        </change>
52
        <change id="copy-handler">
65
        <change id="copy-handler">
53
            <api name="masterfs"/>
66
            <api name="masterfs"/>
54
            <summary>Delegate FileObject.copy() to ProvidedExtensions</summary>
67
            <summary>Delegate FileObject.copy() to ProvidedExtensions</summary>
(-)masterfs/src/org/netbeans/modules/masterfs/ProvidedExtensionsAccessor.java (+55 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2011 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 2011 Sun Microsystems, Inc.
41
 */
42
43
package org.netbeans.modules.masterfs;
44
45
import org.netbeans.modules.masterfs.providers.ProvidedExtensions;
46
47
/**
48
 *
49
 * @author Tomas Stupka
50
 */
51
public abstract class ProvidedExtensionsAccessor {
52
    public static ProvidedExtensionsAccessor IMPL;
53
    
54
    protected abstract boolean providesCanWrite(ProvidedExtensions pe);
55
}
(-)masterfs/src/org/netbeans/modules/masterfs/ProvidedExtensionsProxy.java (+8 lines)
Lines 218-228 Link Here
218
            if (iListener instanceof ProvidedExtensions) {
218
            if (iListener instanceof ProvidedExtensions) {
219
                runCheckCode(new Runnable() {
219
                runCheckCode(new Runnable() {
220
                    public void run() {
220
                    public void run() {
221
                        ProvidedExtensions extension = (ProvidedExtensions)iListener;
222
                        if(ProvidedExtensionsAccessor.IMPL != null && 
223
                           ProvidedExtensionsAccessor.IMPL.providesCanWrite(extension)) 
224
                        {
221
                        ret[0] = ((ProvidedExtensions)iListener).canWrite(f);
225
                        ret[0] = ((ProvidedExtensions)iListener).canWrite(f);
222
                    }
226
                    }
227
                    }
223
                });                                                                                
228
                });                                                                                
229
                if(ret[0] != null && ret[0]) {
230
                    break;
224
            }
231
            }
225
        }
232
        }
233
        }
226
        return ret[0] != null ? ret[0] : super.canWrite(f);
234
        return ret[0] != null ? ret[0] : super.canWrite(f);
227
    }
235
    }
228
        
236
        
(-)masterfs/src/org/netbeans/modules/masterfs/providers/ProvidedExtensions.java (+33 lines)
Lines 48-53 Link Here
48
import java.io.IOException;
48
import java.io.IOException;
49
import java.util.List;
49
import java.util.List;
50
import java.util.concurrent.Callable;
50
import java.util.concurrent.Callable;
51
import org.netbeans.modules.masterfs.ProvidedExtensionsAccessor;
51
import org.netbeans.modules.masterfs.filebasedfs.utils.FileChangedManager;
52
import org.netbeans.modules.masterfs.filebasedfs.utils.FileChangedManager;
52
import org.openide.filesystems.FileObject;
53
import org.openide.filesystems.FileObject;
53
54
Lines 69-74 Link Here
69
public class ProvidedExtensions implements InterceptionListener {
70
public class ProvidedExtensions implements InterceptionListener {
70
71
71
    /**
72
    /**
73
     * true if this instance should be called to determine a files canWrite value, otherwise false
74
     */
75
    private final boolean providesCanWrite;
76
77
    /**
78
     * Creates a new ProvidedExtensions. 
79
     * 
80
     * @param providesCanWrite true if this instance is meant to 
81
     *        determine a files {@link #canWrite()} value, otherwise false. 
82
     * @since 2.29
83
     *          
84
     */
85
    public ProvidedExtensions(boolean providesCanWrite) {
86
        this.providesCanWrite = providesCanWrite;
87
        if(ProvidedExtensionsAccessor.IMPL == null) {
88
            ProvidedExtensionsAccessor.IMPL = new ProvidedExtensionsAccessor() {
89
                @Override
90
                protected boolean providesCanWrite(ProvidedExtensions pe) {
91
                    return pe.providesCanWrite;
92
                }
93
            };
94
        }     
95
    }
96
97
    /**
98
     * Default constructor
99
     */
100
    public ProvidedExtensions() {
101
        this(false);
102
    }
103
    
104
    /**
72
     * Return instance of {@link ProvidedExtensions.IOHandler}
105
     * Return instance of {@link ProvidedExtensions.IOHandler}
73
     * that is responsible for copying the file or null.
106
     * that is responsible for copying the file or null.
74
     *
107
     *
(-)masterfs/test/unit/src/org/netbeans/modules/masterfs/providers/ProvidedExtensionsTest.java (+1 lines)
Lines 615-620 Link Here
615
        }
615
        }
616
616
617
        public ProvidedExtensionsImpl(AnnotationProviderImpl p) {
617
        public ProvidedExtensionsImpl(AnnotationProviderImpl p) {
618
            super(true);
618
            this.provider = p;
619
            this.provider = p;
619
            cnt++;
620
            cnt++;
620
        }
621
        }

Return to bug 194683