# This patch file was generated by NetBeans IDE # Following Index: paths are relative to: /home.local/rmatous/nball/openide/masterfs # 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: src/org/netbeans/modules/masterfs/providers/InterceptionListener2.java *** /home.local/rmatous/nball/openide/masterfs/src/org/netbeans/modules/masterfs/providers/InterceptionListener2.java No Base Revision --- /home.local/rmatous/nball/openide/masterfs/src/org/netbeans/modules/masterfs/providers/InterceptionListener2.java Locally New *************** *** 1,0 **** --- 1,45 ---- + /* + * 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-2006 Sun + * Microsystems, Inc. All Rights Reserved. + */ + + package org.netbeans.modules.masterfs.providers; + + import java.io.IOException; + import org.openide.filesystems.FileObject; + + /** + * + * @author Radek Matous + */ + public interface InterceptionListener2 extends InterceptionListener { + /** + * Tests whether is "mv src destFolder/fileName" handled + * by the moveImpl(). + */ + boolean implsMove(FileObject src, FileObject destFolder, String name, String ext); + + /** + * Actually moves the file (e.g. svn move src destFolder/fileName). + */ + void moveImpl(FileObject src, FileObject destFolder, String name, String ext) throws IOException; + + /** + * Tests whether is "mv src fileName" handled + * by the renameImpl(). + */ + boolean implsRename(FileObject src, String name, String ext); + + /** + * Actually renames the file (e.g. svn move src fileName). + */ + void renameImpl(FileObject src, String name, String ext) throws IOException; + } Index: test/unit/src/org/netbeans/modules/masterfs/providers/InterceptionListener2Test.java *** /home.local/rmatous/nball/openide/masterfs/test/unit/src/org/netbeans/modules/masterfs/providers/InterceptionListener2Test.java No Base Revision --- /home.local/rmatous/nball/openide/masterfs/test/unit/src/org/netbeans/modules/masterfs/providers/InterceptionListener2Test.java Locally New *************** *** 1,0 **** --- 1,233 ---- + /* + * 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-2006 Sun + * Microsystems, Inc. All Rights Reserved. + */ + + package org.netbeans.modules.masterfs.providers; + + import java.io.File; + import java.io.IOException; + import java.util.ArrayList; + import java.util.List; + import org.netbeans.junit.NbTestCase; + import org.openide.filesystems.FileChangeAdapter; + import org.openide.filesystems.FileChangeListener; + import org.openide.filesystems.FileLock; + import org.openide.filesystems.FileObject; + import org.openide.filesystems.FileRenameEvent; + import org.openide.filesystems.FileUtil; + import org.openide.util.lookup.Lookups; + + /** + * + * @author Radek Matous + */ + public class InterceptionListener2Test extends NbTestCase { + private InterceptionListenerImpl iListener; + protected void setUp() throws Exception { + super.setUp(); + iListener = (InterceptionListenerImpl)Lookups.metaInfServices( + Thread.currentThread().getContextClassLoader()).lookup(AnnotationProvider.class); + assertNotNull(iListener); + clearWorkDir(); + } + + public InterceptionListener2Test(String testName) { + super(testName); + } + + + public void testImplsMove() throws IOException { + FileObject fo = FileUtil.toFileObject(getWorkDir()); + assertNotNull(fo); + assertNotNull(iListener); + FileObject toMove = fo.createData("aa"); + assertNotNull(toMove); + FileObject whereToMove = fo.createFolder("aafolder"); + assertNotNull(whereToMove); + + iListener.clear(); + FileLock lock = toMove.lock(); + iListener.setLock(lock); + try { + assertEquals(0,iListener.implsMoveCalls); + assertEquals(0,iListener.moveImplCalls); + iListener.setImplsMoveRetVal(true); + assertNotNull(toMove.move(lock, whereToMove, toMove.getName(), toMove.getExt())); + assertEquals(1,iListener.implsMoveCalls); + assertEquals(1,iListener.moveImplCalls); + } finally { + if (lock != null) { + iListener.setLock(null); + lock.releaseLock(); + } + } + } + + public void testImplsMove2() throws IOException { + FileObject fo = FileUtil.toFileObject(getWorkDir()); + assertNotNull(fo); + assertNotNull(iListener); + FileObject toMove = fo.createData("aa"); + assertNotNull(toMove); + FileObject whereToMove = fo.createFolder("aafolder"); + assertNotNull(whereToMove); + + iListener.clear(); + FileLock lock = toMove.lock(); + iListener.setLock(lock); + try { + assertEquals(0,iListener.implsMoveCalls); + assertEquals(0,iListener.moveImplCalls); + iListener.setImplsMoveRetVal(false); + assertNotNull(toMove.move(lock, whereToMove, toMove.getName(), toMove.getExt())); + assertEquals(1,iListener.implsMoveCalls); + assertEquals(0,iListener.moveImplCalls); + } finally { + if (lock != null) { + iListener.setLock(null); + lock.releaseLock(); + } + } + } + + public void testImplsRename() throws IOException { + FileObject fo = FileUtil.toFileObject(getWorkDir()); + assertNotNull(fo); + assertNotNull(iListener); + FileObject toRename = fo.createData("aa"); + assertNotNull(toRename); + + iListener.clear(); + FileLock lock = toRename.lock(); + iListener.setLock(lock); + try { + assertEquals(0,iListener.implsRenameCalls); + assertEquals(0,iListener.renameImplCalls); + iListener.setImplsRenameRetVal(true); + toRename.rename(lock,toRename.getName(), toRename.getExt()); + assertEquals(1,iListener.implsRenameCalls); + assertEquals(1,iListener.renameImplCalls); + } finally { + if (lock != null) { + iListener.setLock(null); + lock.releaseLock(); + } + } + } + + public void testImplsRename2() throws IOException { + final List events = new ArrayList(); + FileObject fo = FileUtil.toFileObject(getWorkDir()); + assertNotNull(fo); + FileObject toRename = fo.createData("aa"); + assertNotNull(toRename); + + iListener.clear(); + FileLock lock = toRename.lock(); + iListener.setLock(lock); + try { + iListener.setImplsRenameRetVal(true); + FileChangeListener fcl = new FileChangeAdapter() { + public void fileRenamed(FileRenameEvent fe) { + events.add(fe); + } + }; + toRename.getParent().addFileChangeListener(fcl); + toRename.addFileChangeListener(fcl); + toRename.getFileSystem().addFileChangeListener(fcl); + toRename.rename(lock,"bb", "ext"); + } finally { + if (lock != null) { + iListener.setLock(null); + lock.releaseLock(); + } + } + assertEquals(3,events.size()); + } + + public static class InterceptionListenerImpl extends InterceptionListenerTest.InterceptionListenerImpl { + private int implsMoveCalls; + private int moveImplCalls; + private int implsRenameCalls; + private int renameImplCalls; + + private static boolean implsMoveRetVal = true; + private static boolean implsRenameRetVal = true; + + public static FileLock lock; + + + + public void clear() { + super.clear(); + implsMoveCalls = 0; + moveImplCalls = 0; + implsRenameCalls = 0; + renameImplCalls = 0; + } + + public boolean implsMove(FileObject src, FileObject destFolder, String name, String ext) { + implsMoveCalls++; + return isImplsMoveRetVal(); + } + + public void moveImpl(FileObject src, FileObject destFolder, String name, String ext) throws IOException { + moveImplCalls++; + assertNotNull(FileUtil.copyFile(src, destFolder, name, ext)); + File fSrc = FileUtil.toFile(src); + assertNotNull(fSrc); + assertTrue(fSrc.delete()); + } + + public boolean implsRename(FileObject src, String name, String ext) { + implsRenameCalls++; + return isImplsRenameRetVal(); + } + + public void renameImpl(FileObject src, String name, String ext) throws IOException { + renameImplCalls++; + File fSrc = FileUtil.toFile(src); + assertNotNull(fSrc); + if (ext != null && ext.length() > 0) { + File f = new File(fSrc.getParentFile(),name+"."+ext); + assertTrue(fSrc.renameTo(f)); + } else { + File f = new File(fSrc.getParentFile(),name); + assertTrue(fSrc.renameTo(f)); + } + } + + public static FileLock getLock() { + return lock; + } + + public static void setLock(FileLock lock) { + InterceptionListenerImpl.lock = lock; + } + + public static boolean isImplsMoveRetVal() { + return implsMoveRetVal; + } + + public static void setImplsMoveRetVal(boolean implsMoveRetVal) { + InterceptionListenerImpl.implsMoveRetVal = implsMoveRetVal; + } + + public static boolean isImplsRenameRetVal() { + return implsRenameRetVal; + } + + public static void setImplsRenameRetVal(boolean implsRenameRetVal) { + InterceptionListenerImpl.implsRenameRetVal = implsRenameRetVal; + } + } + } Index: test/unit/src/org/netbeans/modules/masterfs/MasterFileSystemTest2.java *** /home.local/rmatous/nball/openide/masterfs/test/unit/src/org/netbeans/modules/masterfs/MasterFileSystemTest2.java No Base Revision --- /home.local/rmatous/nball/openide/masterfs/test/unit/src/org/netbeans/modules/masterfs/MasterFileSystemTest2.java Locally New *************** *** 1,0 **** --- 1,38 ---- + /* + * 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-2005 Sun + * Microsystems, Inc. All Rights Reserved. + */ + + package org.netbeans.modules.masterfs; + + import junit.framework.Test; + import org.netbeans.junit.NbTestSuite; + import org.netbeans.modules.masterfs.providers.InterceptionListener2Test; + import org.openide.filesystems.FileObjectTestHid; + import org.openide.filesystems.FileSystemTestHid; + import org.openide.filesystems.FileUtilTestHidden; + import org.openide.filesystems.URLMapperTestHidden; + + /** + * @author rm111737 + */ + public class MasterFileSystemTest2 extends MasterFileSystemTest { + /** Creates new MasterFileSystemTest */ + public MasterFileSystemTest2(Test test) { + super(test); + InterceptionListener2Test.InterceptionListenerImpl.setImplsMoveRetVal(true); + InterceptionListener2Test.InterceptionListenerImpl.setImplsRenameRetVal(true); + } + + public static Test suite() { + return new MasterFileSystemTest2(MasterFileSystemTest.suite()); + } + } Index: masterfs.tar.gz *** /home.local/rmatous/nball/openide/masterfs/masterfs.tar.gz No Base Revision --- /home.local/rmatous/nball/openide/masterfs/masterfs.tar.gz Locally New *************** *** 1,0 **** --- 1,1 ---- + [Binary File Locally New] Index: src/org/netbeans/modules/masterfs/filebasedfs/fileobjects/BaseFileObj.java *** /home.local/rmatous/nball/openide/masterfs/src/org/netbeans/modules/masterfs/filebasedfs/fileobjects/BaseFileObj.java Base (1.19) --- /home.local/rmatous/nball/openide/masterfs/src/org/netbeans/modules/masterfs/filebasedfs/fileobjects/BaseFileObj.java Locally Modified (Based On 1.19) *************** *** 399,404 **** --- 399,407 ---- } abstract protected void setValid(boolean valid); + + abstract public void refresh(final boolean expected, boolean fire); + //TODO: attributes written by VCS must be readable by FileBaseFS and vice versa /** * FileBaseFS Index: src/org/netbeans/modules/masterfs/Delegate.java *** /home.local/rmatous/nball/openide/masterfs/src/org/netbeans/modules/masterfs/Delegate.java Base (1.20) --- /home.local/rmatous/nball/openide/masterfs/src/org/netbeans/modules/masterfs/Delegate.java Locally Modified (Based On 1.20) *************** *** 39,45 **** private FileObject delegate; private FileObject secondDelegate; private FileChangeListener weakListener; ! final private FileChangeListener fListener; private Reference lock = null; private int attribs = 0; --- 39,45 ---- private FileObject delegate; private FileObject secondDelegate; private FileChangeListener weakListener; ! final FileChangeListener fListener; private Reference lock = null; private int attribs = 0; Index: src/org/netbeans/modules/masterfs/filebasedfs/fileobjects/FileObj.java *** /home.local/rmatous/nball/openide/masterfs/src/org/netbeans/modules/masterfs/filebasedfs/fileobjects/FileObj.java Base (1.17) --- /home.local/rmatous/nball/openide/masterfs/src/org/netbeans/modules/masterfs/filebasedfs/fileobjects/FileObj.java Locally Modified (Based On 1.17) *************** *** 167,173 **** return false; } ! public final void refresh(final boolean expected) { Statistics.StopWatch stopWatch = Statistics.getStopWatch(Statistics.REFRESH_FILE); stopWatch.start(); if (isValid()) { --- 167,173 ---- return false; } ! public void refresh(final boolean expected, boolean fire) { Statistics.StopWatch stopWatch = Statistics.getStopWatch(Statistics.REFRESH_FILE); stopWatch.start(); if (isValid()) { *************** *** 174,180 **** final long oldLastModified = lastModified; setLastModified(getFileName().getFile().lastModified()); ! if (oldLastModified != -1 && lastModified != -1 && lastModified != 0 && oldLastModified < lastModified) { fireFileChangedEvent(expected); } --- 174,180 ---- final long oldLastModified = lastModified; setLastModified(getFileName().getFile().lastModified()); ! if (fire && oldLastModified != -1 && lastModified != -1 && lastModified != 0 && oldLastModified < lastModified) { fireFileChangedEvent(expected); } *************** *** 182,196 **** --- 182,203 ---- if (!validityFlag) { //fileobject is invalidated setValid(false); + if (fire) { fireFileDeletedEvent(expected); } } + } stopWatch.stop(); } + public final void refresh(final boolean expected) { + refresh(expected, true); + } + + public final Enumeration getChildren(final boolean rec) { return Enumerations.empty(); } Index: src/org/netbeans/modules/masterfs/filebasedfs/fileobjects/FolderObj.java *** /home.local/rmatous/nball/openide/masterfs/src/org/netbeans/modules/masterfs/filebasedfs/fileobjects/FolderObj.java Base (1.18) --- /home.local/rmatous/nball/openide/masterfs/src/org/netbeans/modules/masterfs/filebasedfs/fileobjects/FolderObj.java Locally Modified (Based On 1.18) *************** *** 238,250 **** } } ! ! public final void refresh(final boolean expected) { Statistics.StopWatch stopWatch = Statistics.getStopWatch(Statistics.REFRESH_FOLDER); stopWatch.start(); if (isValid()) { - boolean isFileCreatedFired = false; final ChildrenCache cache = getChildrenCache(); final Mutex.Privileged mutexPrivileged = cache.getMutexPrivileged(); --- 238,251 ---- } } ! public void refresh(final boolean expected, boolean fire) { Statistics.StopWatch stopWatch = Statistics.getStopWatch(Statistics.REFRESH_FOLDER); stopWatch.start(); if (isValid()) { final ChildrenCache cache = getChildrenCache(); final Mutex.Privileged mutexPrivileged = cache.getMutexPrivileged(); *************** *** 282,303 **** if (operationId == ChildrenCache.ADDED_CHILD && newChild != null) { if (newChild.isFolder()) { ! isFileCreatedFired = true; newChild.fireFileFolderCreatedEvent(expected); } else { ! isFileCreatedFired = true; newChild.fireFileDataCreatedEvent(expected); } } else if (operationId == ChildrenCache.REMOVED_CHILD) { if (newChild != null) { if (newChild.isValid()) { newChild.setValid(false); newChild.fireFileDeletedEvent(expected); } } else { //TODO: should be rechecked --- 280,302 ---- if (operationId == ChildrenCache.ADDED_CHILD && newChild != null) { if (newChild.isFolder()) { ! if (fire) { newChild.fireFileFolderCreatedEvent(expected); + } } else { ! if (fire) { newChild.fireFileDataCreatedEvent(expected); } + } } else if (operationId == ChildrenCache.REMOVED_CHILD) { if (newChild != null) { if (newChild.isValid()) { newChild.setValid(false); + if (fire) { newChild.fireFileDeletedEvent(expected); } + } } else { //TODO: should be rechecked //assert false; *************** *** 308,316 **** --- 310,320 ---- } fakeInvalid.setValid(false); + if (fire) { fakeInvalid.fireFileDeletedEvent(expected); } } + } } else { assert !(new FileInfo(child.getFile()).isConvertibleToFileObject()); *************** *** 321,332 **** --- 325,342 ---- if (!validityFlag) { //fileobject is invalidated setValid(false); + if (fire) { fireFileDeletedEvent(expected); } } + } stopWatch.stop(); } + public final void refresh(final boolean expected) { + refresh(expected, true); + } + //TODO: rewrite partly and check FileLocks for existing FileObjects private boolean deleteFile(final File file, final LinkedList all, final FileObjectFactory factory) throws IOException { final boolean ret = file.delete(); Index: test/unit/src/org/netbeans/modules/masterfs/providers/InterceptionListenerTest.java *** /home.local/rmatous/nball/openide/masterfs/test/unit/src/org/netbeans/modules/masterfs/providers/InterceptionListenerTest.java Base (1.1) --- /home.local/rmatous/nball/openide/masterfs/test/unit/src/org/netbeans/modules/masterfs/providers/InterceptionListenerTest.java Locally Modified (Based On 1.1) *************** *** 15,20 **** --- 15,21 ---- import java.awt.Image; import java.io.IOException; + import java.util.Iterator; import java.util.Set; import javax.swing.Action; import org.netbeans.junit.NbTestCase; *************** *** 30,36 **** private InterceptionListenerImpl iListener; protected void setUp() throws Exception { super.setUp(); ! iListener = (InterceptionListenerImpl)Lookups.metaInfServices(Thread.currentThread().getContextClassLoader()).lookup(InterceptionListener.class); assertNotNull(iListener); iListener.clear(); clearWorkDir(); --- 31,37 ---- private InterceptionListenerImpl iListener; protected void setUp() throws Exception { super.setUp(); ! iListener = (InterceptionListenerImpl)Lookups.metaInfServices(Thread.currentThread().getContextClassLoader()).lookup(AnnotationProvider.class); assertNotNull(iListener); iListener.clear(); clearWorkDir(); *************** *** 91,97 **** } } ! public static class InterceptionListenerImpl extends AnnotationProvider implements InterceptionListener { private int beforeCreateCalls = 0; private int createFailureCalls = 0; private int createSuccessCalls = 0; --- 92,98 ---- } } ! public static abstract class InterceptionListenerImpl extends AnnotationProvider implements InterceptionListener2 { private int beforeCreateCalls = 0; private int createFailureCalls = 0; private int createSuccessCalls = 0; *************** *** 132,148 **** deleteFailureCalls++; } ! public String annotateNameHtml(String name, Set files) { ! return name; } ! public String annotateName(String name, Set files) { ! return name; } public Image annotateIcon(Image icon, int iconType, Set files) { return icon; --- 133,157 ---- deleteFailureCalls++; } ! public String annotateName(String name, java.util.Set files) { ! java.lang.StringBuffer sb = new StringBuffer(name); ! Iterator it = files.iterator(); ! while (it.hasNext()) { ! FileObject fo = (FileObject)it.next(); ! try { ! sb.append("," +fo.getNameExt());//NOI18N ! } catch (Exception ex) { ! fail(); } + } ! return sb.toString() ; } + public String annotateNameHtml(String name, Set files) { + return annotateName(name, files); + } + public Image annotateIcon(Image icon, int iconType, Set files) { return icon; } Index: src/org/netbeans/modules/masterfs/MasterFileObject.java *** /home.local/rmatous/nball/openide/masterfs/src/org/netbeans/modules/masterfs/MasterFileObject.java Base (1.47) --- /home.local/rmatous/nball/openide/masterfs/src/org/netbeans/modules/masterfs/MasterFileObject.java Locally Modified (Based On 1.47) *************** *** 17,22 **** --- 17,23 ---- import java.io.File; import org.netbeans.modules.masterfs.filebasedfs.FileBasedFileSystem; import org.netbeans.modules.masterfs.filebasedfs.fileobjects.BaseFileObj; + import org.netbeans.modules.masterfs.providers.InterceptionListener2; import org.openide.ErrorManager; import org.openide.filesystems.*; *************** *** 499,504 **** --- 500,506 ---- // overwritten only because of included in sync. section enterExclusiveCriticalSection(); try { + Delegate.getLockForDelegate(lock, getDelegate().get()); return new AtomicAction(this).move(lock, target, name, ext); } finally { finishExclusiveCriticalSection(); *************** *** 548,556 **** */ public void rename(FileLock lock, String name, String ext) throws IOException { //TODO: rename is wrong implemeted enterCriticalSection(); try { ! FileObject deleg = getValidOrInvalid(getDelegate().get()); if (isReadOnly()) { Utils.throwIOException("EXC_CannotRename", new Object[]{getPath(), getHFs().getDisplayName()}); --- 550,570 ---- */ public void rename(FileLock lock, String name, String ext) throws IOException { //TODO: rename is wrong implemeted + FileObject deleg = null; + boolean externalImpl = false; + MasterFileSystem.StatusImpl status = (MasterFileSystem.StatusImpl)MasterFileSystem.getDefault().getStatus(); + InterceptionListener iListener = status.getInterceptionListener(); + if (iListener != null && iListener instanceof InterceptionListener2) { + InterceptionListener2 iListener2 = (InterceptionListener2)iListener; + if (iListener2.implsRename(this, name, ext)) { + iListener2.renameImpl(this, name, ext); + externalImpl = true; + } + } + enterCriticalSection(); try { ! deleg = getValidOrInvalid(getDelegate().get()); if (isReadOnly()) { Utils.throwIOException("EXC_CannotRename", new Object[]{getPath(), getHFs().getDisplayName()}); *************** *** 565,571 **** --- 579,587 ---- try { //TODO: here is fired exception sometimes FileLock lck = Delegate.getLockForDelegate(lock, deleg); + if (!externalImpl) { deleg.rename(lck, name, ext); + } MountTable.getDefault().renameCachedFileObjects(oldResName.getNormalizedPath(), getResource().getNormalizedPath()); return; } catch (IOException iex) { *************** *** 582,589 **** --- 598,618 ---- throw new IOException("Not implemented yet"); } finally { finishCriticalSection(); + if (externalImpl) { + FileObject parent = this.getParent(); + if (parent != null) { + FileObject parDelegate = ((MasterFileObject)parent).getDelegate().get(); + if (parDelegate instanceof BaseFileObj) { + ((BaseFileObj)(parDelegate)).refresh(true, false); + } else { + parent.refresh(true); } } + ((MasterFileObject)getParent()).fireFileRenamedEvent(((MasterFileObject)getParent()).getEnumOfListeners(),new FileRenameEvent(getParent(),this,name, ext)); + this.fireFileRenamedEvent(getEnumOfListeners(), new FileRenameEvent(this,this,name, ext)); + } + } + } public final Object writeReplace() { return new Replace(getPath()); *************** *** 1114,1119 **** --- 1143,1161 ---- } private void move() throws IOException { + MasterFileSystem.StatusImpl status = (MasterFileSystem.StatusImpl)MasterFileSystem.getDefault().getStatus(); + InterceptionListener iListener = status.getInterceptionListener(); + if (iListener != null && iListener instanceof InterceptionListener2) { + InterceptionListener2 iListener2 = (InterceptionListener2)iListener; + if (iListener2.implsMove(hfoI, targetI, nameI, extI)) { + iListener2.moveImpl(hfoI, targetI, nameI, extI); + hfoI.refresh(true); + targetI.refresh(true); + retVal = targetI.getFileObject(nameI, extI); + return; + } + } + retVal = hfoI.superMove(fLockI, targetI, nameI, extI); } Index: src/org/netbeans/modules/masterfs/MasterFileSystem.java *** /home.local/rmatous/nball/openide/masterfs/src/org/netbeans/modules/masterfs/MasterFileSystem.java Base (1.22) --- /home.local/rmatous/nball/openide/masterfs/src/org/netbeans/modules/masterfs/MasterFileSystem.java Locally Modified (Based On 1.22) *************** *** 16,33 **** import org.netbeans.modules.masterfs.providers.AnnotationProvider; import org.netbeans.modules.masterfs.providers.InterceptionListener; import org.openide.filesystems.*; import org.openide.util.NbBundle; import org.openide.util.actions.SystemAction; import org.openide.util.Utilities; - - import javax.swing.*; import java.awt.*; import java.beans.PropertyVetoException; import java.io.File; import java.io.Serializable; import java.util.*; --- 16,30 ---- import org.netbeans.modules.masterfs.providers.AnnotationProvider; import org.netbeans.modules.masterfs.providers.InterceptionListener; + import org.netbeans.modules.masterfs.providers.InterceptionListener2; import org.openide.filesystems.*; import org.openide.util.NbBundle; import org.openide.util.actions.SystemAction; import org.openide.util.Utilities; import java.awt.*; import java.beans.PropertyVetoException; import java.io.File; + import java.io.IOException; import java.io.Serializable; import java.util.*; *************** *** 315,321 **** static final class StatusImpl implements FileSystem.HtmlStatus, ! org.openide.util.LookupListener, org.openide.filesystems.FileStatusListener { /** result with providers */ private org.openide.util.Lookup.Result annotationProviders; private Collection previousProviders; --- 315,321 ---- static final class StatusImpl implements FileSystem.HtmlStatus, ! org.openide.util.LookupListener, org.openide.filesystems.FileStatusListener, InterceptionListener2 { /** result with providers */ private org.openide.util.Lookup.Result annotationProviders; private Collection previousProviders; *************** *** 328,342 **** } public InterceptionListener getInterceptionListener() { ! InterceptionListener retVal = null; ! assert previousProviders != null; ! java.util.Iterator it = previousProviders.iterator (); ! while (retVal == null && it.hasNext ()) { ! AnnotationProvider ap = (AnnotationProvider)it.next (); ! retVal = ap.getInterceptionListener (); } - return retVal; - } public void resultChanged (org.openide.util.LookupEvent ev) { java.util.Collection now = annotationProviders.allInstances (); --- 328,338 ---- } public InterceptionListener getInterceptionListener() { ! return this; } public void resultChanged (org.openide.util.LookupEvent ev) { *************** *** 464,471 **** --- 457,596 ---- } return retVal; } + + public void beforeCreate(FileObject parent, String name, boolean isFolder) { + InterceptionListener retVal = null; + assert previousProviders != null; + java.util.Iterator it = previousProviders.iterator(); + while (it.hasNext()) { + AnnotationProvider ap = (AnnotationProvider)it.next(); + retVal = ap.getInterceptionListener(); + if (retVal != null) { + retVal.beforeCreate(parent, name, isFolder); } + } + } + public void createSuccess(FileObject fo) { + InterceptionListener retVal = null; + assert previousProviders != null; + java.util.Iterator it = previousProviders.iterator(); + while (it.hasNext()) { + AnnotationProvider ap = (AnnotationProvider)it.next(); + retVal = ap.getInterceptionListener(); + if (retVal != null) { + retVal.createSuccess(fo); + } + } + } + + public void createFailure(FileObject parent, String name, boolean isFolder) { + InterceptionListener retVal = null; + assert previousProviders != null; + java.util.Iterator it = previousProviders.iterator(); + while (it.hasNext()) { + AnnotationProvider ap = (AnnotationProvider)it.next(); + retVal = ap.getInterceptionListener(); + if (retVal != null) { + retVal.createFailure(parent, name, isFolder); + } + } + } + + public void beforeDelete(FileObject fo) { + InterceptionListener retVal = null; + assert previousProviders != null; + java.util.Iterator it = previousProviders.iterator(); + while (it.hasNext()) { + AnnotationProvider ap = (AnnotationProvider)it.next(); + retVal = ap.getInterceptionListener(); + if (retVal != null) { + retVal.beforeDelete(fo); + } + } + } + + public void deleteSuccess(FileObject fo) { + InterceptionListener retVal = null; + assert previousProviders != null; + java.util.Iterator it = previousProviders.iterator(); + while (it.hasNext()) { + AnnotationProvider ap = (AnnotationProvider)it.next(); + retVal = ap.getInterceptionListener(); + if (retVal != null) { + retVal.deleteSuccess(fo); + } + } + } + + public void deleteFailure(FileObject fo) { + InterceptionListener retVal = null; + assert previousProviders != null; + java.util.Iterator it = previousProviders.iterator(); + while (it.hasNext()) { + AnnotationProvider ap = (AnnotationProvider)it.next(); + retVal = ap.getInterceptionListener(); + if (retVal != null) { + retVal.deleteFailure(fo); + } + } + } + + public boolean implsMove(FileObject src, FileObject destFolder, String name, String ext) { + InterceptionListener retVal = null; + assert previousProviders != null; + java.util.Iterator it = previousProviders.iterator(); + while (it.hasNext()) { + AnnotationProvider ap = (AnnotationProvider)it.next(); + retVal = ap.getInterceptionListener(); + if (retVal != null && retVal instanceof InterceptionListener2) { + return ((InterceptionListener2)retVal).implsMove(src, destFolder, name, ext); + } + } + return false; + } + + public void moveImpl(FileObject src, FileObject destFolder, String name, String ext) throws IOException { + InterceptionListener retVal = null; + assert previousProviders != null; + java.util.Iterator it = previousProviders.iterator(); + while (it.hasNext()) { + AnnotationProvider ap = (AnnotationProvider)it.next(); + retVal = ap.getInterceptionListener(); + if (retVal != null && retVal instanceof InterceptionListener2) { + ((InterceptionListener2)retVal).moveImpl(src, destFolder, name, ext); + } + } + } + + public boolean implsRename(FileObject src, String name, String ext) { + InterceptionListener retVal = null; + assert previousProviders != null; + java.util.Iterator it = previousProviders.iterator(); + while (it.hasNext()) { + AnnotationProvider ap = (AnnotationProvider)it.next(); + retVal = ap.getInterceptionListener(); + if (retVal != null && retVal instanceof InterceptionListener2) { + return ((InterceptionListener2)retVal).implsRename(src, name, ext); + } + } + return false; + } + + public void renameImpl(FileObject src, String name, String ext) throws IOException { + InterceptionListener retVal = null; + assert previousProviders != null; + java.util.Iterator it = previousProviders.iterator(); + while (it.hasNext()) { + AnnotationProvider ap = (AnnotationProvider)it.next(); + retVal = ap.getInterceptionListener(); + if (retVal != null && retVal instanceof InterceptionListener2) { + ((InterceptionListener2)retVal).renameImpl(src, name, ext); + } + } + } + } + private static final class Replace implements Serializable { static final long serialVersionUID = 50485340814380L; Index: test/unit/src/org/netbeans/modules/masterfs/MasterFileSystemTest.java *** /home.local/rmatous/nball/openide/masterfs/test/unit/src/org/netbeans/modules/masterfs/MasterFileSystemTest.java Base (1.7) --- /home.local/rmatous/nball/openide/masterfs/test/unit/src/org/netbeans/modules/masterfs/MasterFileSystemTest.java Locally Modified (Based On 1.7) *************** *** 20,25 **** --- 20,26 ---- import org.netbeans.junit.NbTestSuite; import org.netbeans.modules.masterfs.providers.AutoMountProvider; import org.netbeans.modules.masterfs.providers.FileSystemProvider; + import org.netbeans.modules.masterfs.providers.InterceptionListener2Test; import org.netbeans.modules.masterfs.providers.MountSupport; import org.openide.filesystems.FileObject; import org.openide.filesystems.FileObjectTestHid; *************** *** 49,54 **** --- 50,58 ---- /** Creates new MasterFileSystemTest */ public MasterFileSystemTest(Test test) { super(test); + InterceptionListener2Test.InterceptionListenerImpl.setImplsMoveRetVal(false); + InterceptionListener2Test.InterceptionListenerImpl.setImplsRenameRetVal(false); + } Index: test/unit/src/META-INF/services/org.netbeans.modules.masterfs.providers.AnnotationProvider *** /home.local/rmatous/nball/openide/masterfs/test/unit/src/META-INF/services/org.netbeans.modules.masterfs.providers.AnnotationProvider Base (1.1) --- /home.local/rmatous/nball/openide/masterfs/test/unit/src/META-INF/services/org.netbeans.modules.masterfs.providers.AnnotationProvider Locally Modified (Based On 1.1) *************** *** 1,1 **** ! org.netbeans.modules.masterfs.providers.InterceptionListenerTest$InterceptionListenerImpl --- 1,1 ---- ! org.netbeans.modules.masterfs.providers.InterceptionListener2Test$InterceptionListenerImpl Index: nbproject/project.xml *** /home.local/rmatous/nball/openide/masterfs/nbproject/project.xml Base (1.15) --- /home.local/rmatous/nball/openide/masterfs/nbproject/project.xml Locally Modified (Based On 1.15) *************** *** 53,58 **** --- 53,59 ---- org.netbeans.modules.vcscore org.netbeans.modules.versioning.system.cvss + org.netbeans.modules.subversion org.netbeans.modules.masterfs.providers Index: src/org/netbeans/modules/masterfs/filebasedfs/fileobjects/ReplaceForSerialization.java *** /home.local/rmatous/nball/openide/masterfs/src/org/netbeans/modules/masterfs/filebasedfs/fileobjects/ReplaceForSerialization.java Base (1.5) --- /home.local/rmatous/nball/openide/masterfs/src/org/netbeans/modules/masterfs/filebasedfs/fileobjects/ReplaceForSerialization.java Locally Modified (Based On 1.5) *************** *** 105,112 **** --- 105,116 ---- public FileObject createData(String name, String ext) throws IOException { throw new IOException (getPath()); } + + public void refresh(final boolean expected, boolean fire) { } } + }