# This patch file was generated by NetBeans IDE
# Following Index: paths are relative to: /data/work/src/netbeans-cdev
# This patch can be applied using context Tools: Patch action on respective folder.
# It uses platform neutral UTF-8 encoding and \n newlines.
# Above lines and this line are ignored by the patching process.
Index: masterfs/apichanges.xml
--- masterfs/apichanges.xml Base (BASE)
+++ masterfs/apichanges.xml Locally Modified (Based On LOCAL)
@@ -49,6 +49,19 @@
MasterFileSystem API
+
+
+ Delegate FileObject.copy() to ProvidedExtensions
+
+
+
+
+
+ Setup if an ProvidedExtensions instance should be used to determine a files canWrite() value
+
+
+
+
Delegate FileObject.copy() to ProvidedExtensions
Index: masterfs/src/org/netbeans/modules/masterfs/ProvidedExtensionsAccessor.java
--- masterfs/src/org/netbeans/modules/masterfs/ProvidedExtensionsAccessor.java Base (BASE)
+++ masterfs/src/org/netbeans/modules/masterfs/ProvidedExtensionsAccessor.java Locally New
@@ -0,0 +1,55 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2011 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):
+ *
+ * Portions Copyrighted 2011 Sun Microsystems, Inc.
+ */
+
+package org.netbeans.modules.masterfs;
+
+import org.netbeans.modules.masterfs.providers.ProvidedExtensions;
+
+/**
+ *
+ * @author Tomas Stupka
+ */
+public abstract class ProvidedExtensionsAccessor {
+ public static ProvidedExtensionsAccessor IMPL;
+
+ protected abstract boolean providesCanWrite(ProvidedExtensions pe);
+}
Index: masterfs/src/org/netbeans/modules/masterfs/ProvidedExtensionsProxy.java
--- masterfs/src/org/netbeans/modules/masterfs/ProvidedExtensionsProxy.java Base (BASE)
+++ masterfs/src/org/netbeans/modules/masterfs/ProvidedExtensionsProxy.java Locally Modified (Based On LOCAL)
@@ -218,11 +218,19 @@
if (iListener instanceof ProvidedExtensions) {
runCheckCode(new Runnable() {
public void run() {
+ ProvidedExtensions extension = (ProvidedExtensions)iListener;
+ if(ProvidedExtensionsAccessor.IMPL != null &&
+ ProvidedExtensionsAccessor.IMPL.providesCanWrite(extension))
+ {
ret[0] = ((ProvidedExtensions)iListener).canWrite(f);
}
+ }
});
+ if(ret[0] != null && ret[0]) {
+ break;
}
}
+ }
return ret[0] != null ? ret[0] : super.canWrite(f);
}
Index: masterfs/src/org/netbeans/modules/masterfs/providers/ProvidedExtensions.java
--- masterfs/src/org/netbeans/modules/masterfs/providers/ProvidedExtensions.java Base (BASE)
+++ masterfs/src/org/netbeans/modules/masterfs/providers/ProvidedExtensions.java Locally Modified (Based On LOCAL)
@@ -48,6 +48,7 @@
import java.io.IOException;
import java.util.List;
import java.util.concurrent.Callable;
+import org.netbeans.modules.masterfs.ProvidedExtensionsAccessor;
import org.netbeans.modules.masterfs.filebasedfs.utils.FileChangedManager;
import org.openide.filesystems.FileObject;
@@ -69,6 +70,38 @@
public class ProvidedExtensions implements InterceptionListener {
/**
+ * true if this instance should be called to determine a files canWrite value, otherwise false
+ */
+ private final boolean providesCanWrite;
+
+ /**
+ * Creates a new ProvidedExtensions.
+ *
+ * @param providesCanWrite true if this instance is meant to
+ * determine a files {@link #canWrite()} value, otherwise false.
+ * @since 2.29
+ *
+ */
+ public ProvidedExtensions(boolean providesCanWrite) {
+ this.providesCanWrite = providesCanWrite;
+ if(ProvidedExtensionsAccessor.IMPL == null) {
+ ProvidedExtensionsAccessor.IMPL = new ProvidedExtensionsAccessor() {
+ @Override
+ protected boolean providesCanWrite(ProvidedExtensions pe) {
+ return pe.providesCanWrite;
+ }
+ };
+ }
+ }
+
+ /**
+ * Default constructor
+ */
+ public ProvidedExtensions() {
+ this(false);
+ }
+
+ /**
* Return instance of {@link ProvidedExtensions.IOHandler}
* that is responsible for copying the file or null.
*
Index: masterfs/test/unit/src/org/netbeans/modules/masterfs/providers/ProvidedExtensionsTest.java
--- masterfs/test/unit/src/org/netbeans/modules/masterfs/providers/ProvidedExtensionsTest.java Base (BASE)
+++ masterfs/test/unit/src/org/netbeans/modules/masterfs/providers/ProvidedExtensionsTest.java Locally Modified (Based On LOCAL)
@@ -615,6 +615,7 @@
}
public ProvidedExtensionsImpl(AnnotationProviderImpl p) {
+ super(true);
this.provider = p;
cnt++;
}