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

(-)a/lib.cvsclient/nbproject/project.properties (+1 lines)
Lines 38-42 Link Here
38
# made subject to such option by the copyright holder.
38
# made subject to such option by the copyright holder.
39
39
40
is.autoload=true
40
is.autoload=true
41
javac.compilerargs=-Xlint -Xlint:-serial
41
test-unit-sys-prop.test.junit.jar=${junit.dir}/modules/ext/junit-3.8.1.jar
42
test-unit-sys-prop.test.junit.jar=${junit.dir}/modules/ext/junit-3.8.1.jar
42
disable.qa-functional.tests=true
43
disable.qa-functional.tests=true
(-)a/lib.cvsclient/src/org/netbeans/lib/cvsclient/Client.java (-4 / +4 lines)
Lines 377-389 Link Here
377
    /**
377
    /**
378
     * Process all the requests. The connection must have been opened and
378
     * Process all the requests. The connection must have been opened and
379
     * set first.
379
     * set first.
380
     * @param requests the requets to process
380
     * @param requests the request to process
381
     */
381
     */
382
    public void processRequests(List requests)
382
    public void processRequests(List requests)
383
            throws IOException, UnconfiguredRequestException, ResponseException,
383
            throws IOException, UnconfiguredRequestException, ResponseException,
384
            CommandAbortedException {
384
            CommandAbortedException {
385
385
386
        if (requests == null || requests.size() == 0) {
386
        if (requests == null || requests.isEmpty()) {
387
            throw new IllegalArgumentException("[processRequests] requests " + // NOI18N
387
            throw new IllegalArgumentException("[processRequests] requests " + // NOI18N
388
                                               "was either null or empty."); // NOI18N
388
                                               "was either null or empty."); // NOI18N
389
        }
389
        }
Lines 595-601 Link Here
595
595
596
                String responseString = responseNameBuffer.toString();
596
                String responseString = responseNameBuffer.toString();
597
                Response response = getResponseFactory().createResponse(responseString);
597
                Response response = getResponseFactory().createResponse(responseString);
598
                //Logger.logInput(new String("<" + responseString + " processing start>\n").getBytes()); // NOI18N
598
                Logger.logInput(("<" + responseString + " processing start>\n").getBytes()); // NOI18N
599
                response.process(dis, this);
599
                response.process(dis, this);
600
                boolean terminal = response.isTerminalResponse();
600
                boolean terminal = response.isTerminalResponse();
601
601
Lines 605-611 Link Here
605
                    String errMsg = errorResponce.getMessage();
605
                    String errMsg = errorResponce.getMessage();
606
                    throw new CommandAbortedException(errMsg, errMsg);
606
                    throw new CommandAbortedException(errMsg, errMsg);
607
                }
607
                }
608
                //Logger.logInput(new String("<" + responseString + " processed " + terminal + ">\n").getBytes()); // NOI18N
608
                Logger.logInput(("<" + responseString + " processed " + terminal + ">\n").getBytes()); // NOI18N
609
                if (terminal || abort) {
609
                if (terminal || abort) {
610
                    break;
610
                    break;
611
                }
611
                }
(-)a/lib.cvsclient/src/org/netbeans/lib/cvsclient/command/edit/EditCommand.java (-5 / +3 lines)
Lines 41-48 Link Here
41
package org.netbeans.lib.cvsclient.command.edit;
41
package org.netbeans.lib.cvsclient.command.edit;
42
42
43
import java.io.*;
43
import java.io.*;
44
import java.util.*;
45
46
import org.netbeans.lib.cvsclient.*;
44
import org.netbeans.lib.cvsclient.*;
47
import org.netbeans.lib.cvsclient.admin.*;
45
import org.netbeans.lib.cvsclient.admin.*;
48
import org.netbeans.lib.cvsclient.command.*;
46
import org.netbeans.lib.cvsclient.command.*;
Lines 122-135 Link Here
122
    }
120
    }
123
121
124
    protected void addRequestForFile(File file, Entry entry) {
122
    protected void addRequestForFile(File file, Entry entry) {
125
        String temporaryWatch = Watch.getWatchString(getTemporaryWatch());
123
        String temporaryWatchText = Watch.getWatchString(getTemporaryWatch());
126
        requests.add(new NotifyRequest(file, "E", temporaryWatch)); // NOI18N
124
        requests.add(new NotifyRequest(file, "E", temporaryWatchText)); // NOI18N
127
125
128
        try {
126
        try {
129
            editFile(clientServices, file);
127
            editFile(clientServices, file);
130
        }
128
        }
131
        catch (IOException ex) {
129
        catch (IOException ex) {
132
            // ignore
130
            ex.printStackTrace();
133
        }
131
        }
134
    }
132
    }
135
133
(-)a/versioning.system.cvss/src/org/netbeans/modules/versioning/system/cvss/Annotator.java (-5 / +12 lines)
Lines 80-85 Link Here
80
import org.netbeans.modules.versioning.util.SystemActionBridge;
80
import org.netbeans.modules.versioning.util.SystemActionBridge;
81
import org.netbeans.modules.diff.PatchAction;
81
import org.netbeans.modules.diff.PatchAction;
82
import org.netbeans.modules.versioning.system.cvss.options.AnnotationColorProvider;
82
import org.netbeans.modules.versioning.system.cvss.options.AnnotationColorProvider;
83
import org.netbeans.modules.versioning.system.cvss.ui.actions.edit.EditAction;
84
import org.netbeans.modules.versioning.system.cvss.ui.actions.edit.UneditAction;
83
import org.openide.util.ImageUtilities;
85
import org.openide.util.ImageUtilities;
84
86
85
/**
87
/**
Lines 90-101 Link Here
90
 */
92
 */
91
public class Annotator {
93
public class Annotator {
92
94
93
    private static String badgeModified = "org/netbeans/modules/versioning/system/cvss/resources/icons/modified-badge.png";
95
    private static final String badgeModified = "org/netbeans/modules/versioning/system/cvss/resources/icons/modified-badge.png";
94
    private static String badgeConflicts = "org/netbeans/modules/versioning/system/cvss/resources/icons/conflicts-badge.png";
96
    private static final String badgeConflicts = "org/netbeans/modules/versioning/system/cvss/resources/icons/conflicts-badge.png";
95
    
97
    
96
    private static String toolTipModified = "<img src=\"" + Annotator.class.getClassLoader().getResource(badgeModified) + "\">&nbsp;"
98
    private static final String toolTipModified = "<img src=\"" + Annotator.class.getClassLoader().getResource(badgeModified) + "\">&nbsp;"
97
            + NbBundle.getMessage(Annotator.class, "MSG_Contains_Modified_Locally");
99
            + NbBundle.getMessage(Annotator.class, "MSG_Contains_Modified_Locally");
98
    private static String toolTipConflict = "<img src=\"" + Annotator.class.getClassLoader().getResource(badgeConflicts) + "\">&nbsp;"
100
    private static final String toolTipConflict = "<img src=\"" + Annotator.class.getClassLoader().getResource(badgeConflicts) + "\">&nbsp;"
99
            + NbBundle.getMessage(Annotator.class, "MSG_Contains_Conflicts");
101
            + NbBundle.getMessage(Annotator.class, "MSG_Contains_Conflicts");
100
  
102
  
101
    private static final int STATUS_TEXT_ANNOTABLE = FileInformation.STATUS_NOTVERSIONED_EXCLUDED | 
103
    private static final int STATUS_TEXT_ANNOTABLE = FileInformation.STATUS_NOTVERSIONED_EXCLUDED | 
Lines 336-341 Link Here
336
            actions.add(new ViewRevisionAction(ctx));
338
            actions.add(new ViewRevisionAction(ctx));
337
            actions.add(SystemAction.get(SearchHistoryAction.class));
339
            actions.add(SystemAction.get(SearchHistoryAction.class));
338
            actions.add(null);
340
            actions.add(null);
341
            actions.add(SystemAction.get(EditAction.class));
342
            actions.add(SystemAction.get(UneditAction.class));
343
            actions.add(null);
339
            actions.add(SystemAction.get(GetCleanAction.class));
344
            actions.add(SystemAction.get(GetCleanAction.class));
340
            actions.add(SystemAction.get(ResolveConflictsAction.class));
345
            actions.add(SystemAction.get(ResolveConflictsAction.class));
341
            actions.add(SystemAction.get(IgnoreAction.class));
346
            actions.add(SystemAction.get(IgnoreAction.class));
Lines 373-378 Link Here
373
                actions.add(new ViewRevisionAction(loc.getString("CTL_PopupMenuItem_ViewRevision"), ctx)); // NOI18N
378
                actions.add(new ViewRevisionAction(loc.getString("CTL_PopupMenuItem_ViewRevision"), ctx)); // NOI18N
374
                actions.add(SystemActionBridge.createAction(SystemAction.get(SearchHistoryAction.class), loc.getString("CTL_PopupMenuItem_SearchHistory"), context));
379
                actions.add(SystemActionBridge.createAction(SystemAction.get(SearchHistoryAction.class), loc.getString("CTL_PopupMenuItem_SearchHistory"), context));
375
                actions.add(null);
380
                actions.add(null);
381
                actions.add(SystemActionBridge.createAction(SystemAction.get(EditAction.class), loc.getString("CTL_PopupMenuItem_Edit"), context));
382
                actions.add(SystemActionBridge.createAction(SystemAction.get(UneditAction.class), loc.getString("CTL_PopupMenuItem_Unedit"), context));
383
                actions.add(null);
376
                actions.add(SystemActionBridge.createAction(SystemAction.get(GetCleanAction.class), loc.getString("CTL_PopupMenuItem_GetClean"), context));
384
                actions.add(SystemActionBridge.createAction(SystemAction.get(GetCleanAction.class), loc.getString("CTL_PopupMenuItem_GetClean"), context));
377
                actions.add(SystemActionBridge.createAction(SystemAction.get(ResolveConflictsAction.class), loc.getString("CTL_PopupMenuItem_ResolveConflicts"), context));
385
                actions.add(SystemActionBridge.createAction(SystemAction.get(ResolveConflictsAction.class), loc.getString("CTL_PopupMenuItem_ResolveConflicts"), context));
378
                if (!onlyProjects) {
386
                if (!onlyProjects) {
Lines 504-510 Link Here
504
    }
512
    }
505
513
506
    private Image annotateFolderIcon(VCSContext context, Image icon) {
514
    private Image annotateFolderIcon(VCSContext context, Image icon) {
507
        FileStatusCache cache = CvsVersioningSystem.getInstance().getStatusCache();
508
        boolean isVersioned = false;
515
        boolean isVersioned = false;
509
        for (Iterator<File> i = context.getRootFiles().iterator(); i.hasNext();) {
516
        for (Iterator<File> i = context.getRootFiles().iterator(); i.hasNext();) {
510
            File file = i.next();
517
            File file = i.next();
(-)a/versioning.system.cvss/src/org/netbeans/modules/versioning/system/cvss/Bundle.properties (+2 lines)
Lines 61-66 Link Here
61
61
62
CTL_PopupMenuItem_ViewRevision = View Rev&ision...
62
CTL_PopupMenuItem_ViewRevision = View Rev&ision...
63
CTL_PopupMenuItem_SearchHistory = Search &History...
63
CTL_PopupMenuItem_SearchHistory = Search &History...
64
CTL_PopupMenuItem_Edit = &Edit
65
CTL_PopupMenuItem_Unedit = U&nedit
64
CTL_PopupMenuItem_ShowAnnotations = Show &Annotations
66
CTL_PopupMenuItem_ShowAnnotations = Show &Annotations
65
CTL_PopupMenuItem_HideAnnotations = Hide &Annotations
67
CTL_PopupMenuItem_HideAnnotations = Hide &Annotations
66
CTL_PopupMenuItem_GetClean = Re&vert Modifications
68
CTL_PopupMenuItem_GetClean = Re&vert Modifications
(-)a/versioning.system.cvss/src/org/netbeans/modules/versioning/system/cvss/CvsLiteFileHandler.java (-3 / +12 lines)
Lines 54-73 Link Here
54
import java.io.FileOutputStream;
54
import java.io.FileOutputStream;
55
55
56
/**
56
/**
57
 * Cvs client library FileHandler that performs
57
 * CVS client library FileHandler that performs
58
 * operations using openide filesystems.
58
 * operations using openide filesystems.
59
 *
59
 *
60
 * <p>It writes user's data files. Folders, temporary
60
 * <p>It writes user's data files. Folders, temporary
61
 * files and metadata files are written directly by
61
 * files and metadata files are written directly by
62
 * the cvsclient library.
62
 * the cvsclient library.
63
 *
63
 *
64
 * <p>It supresses FilesystemHandler event propagating
64
 * <p>It surpresses FilesystemHandler event propagating
65
 * to cache to avoid
65
 * to cache to avoid
66
 *
66
 *
67
 * @author Petr Kuzel
67
 * @author Petr Kuzel
68
 */
68
 */
69
class CvsLiteFileHandler extends DefaultFileHandler implements FileReadOnlyHandler {
69
class CvsLiteFileHandler extends DefaultFileHandler implements FileReadOnlyHandler {
70
70
71
    @Override
71
    protected boolean createNewFile(File file) throws IOException {
72
    protected boolean createNewFile(File file) throws IOException {
72
        boolean exists = file.isFile();
73
        boolean exists = file.isFile();
73
        if (exists) {
74
        if (exists) {
Lines 90-95 Link Here
90
        }
91
        }
91
    }
92
    }
92
93
94
    @Override
93
    protected OutputStream createOutputStream(File file) throws IOException {
95
    protected OutputStream createOutputStream(File file) throws IOException {
94
        file = FileUtil.normalizeFile(file);
96
        file = FileUtil.normalizeFile(file);
95
        FileObject fo = FileUtil.toFileObject(file);
97
        FileObject fo = FileUtil.toFileObject(file);
Lines 108-113 Link Here
108
        return new LockedOutputStream(lock, stream);
110
        return new LockedOutputStream(lock, stream);
109
    }
111
    }
110
112
113
    @Override
111
    public void removeLocalFile(String pathname) throws IOException {
114
    public void removeLocalFile(String pathname) throws IOException {
112
        File fileToDelete = new File(pathname);
115
        File fileToDelete = new File(pathname);
113
        fileToDelete = FileUtil.normalizeFile(fileToDelete);
116
        fileToDelete = FileUtil.normalizeFile(fileToDelete);
Lines 125-132 Link Here
125
        }
128
        }
126
    }
129
    }
127
130
131
    @Override
128
    public void setFileReadOnly(File file, boolean readOnly) throws IOException {
132
    public void setFileReadOnly(File file, boolean readOnly) throws IOException {
129
        file.setWritable(readOnly);
133
        file.setWritable(!readOnly);
130
    }
134
    }
131
        
135
        
132
    private static class LockedOutputStream extends OutputStream {
136
    private static class LockedOutputStream extends OutputStream {
Lines 139-144 Link Here
139
            this.peer = peer;
143
            this.peer = peer;
140
        }
144
        }
141
145
146
        @Override
142
        public void close() throws IOException {
147
        public void close() throws IOException {
143
            lock.releaseLock();
148
            lock.releaseLock();
144
            try {
149
            try {
Lines 149-166 Link Here
149
            }
154
            }
150
        }
155
        }
151
156
157
        @Override
152
        public void flush() throws IOException {
158
        public void flush() throws IOException {
153
            peer.flush();
159
            peer.flush();
154
        }
160
        }
155
161
162
        @Override
156
        public void write(byte b[]) throws IOException {
163
        public void write(byte b[]) throws IOException {
157
            peer.write(b);
164
            peer.write(b);
158
        }
165
        }
159
166
167
        @Override
160
        public void write(byte b[], int off, int len) throws IOException {
168
        public void write(byte b[], int off, int len) throws IOException {
161
            peer.write(b, off, len);
169
            peer.write(b, off, len);
162
        }
170
        }
163
171
172
        @Override
164
        public void write(int b) throws IOException {
173
        public void write(int b) throws IOException {
165
            peer.write(b);
174
            peer.write(b);
166
        }
175
        }
(-)a/versioning.system.cvss/src/org/netbeans/modules/versioning/system/cvss/ExecutorSupport.java (-6 / +11 lines)
Lines 151-156 Link Here
151
        this.nonInteractive = nonInteractive;
151
        this.nonInteractive = nonInteractive;
152
    }
152
    }
153
153
154
    private void ensureGroupExists() {
155
        if (group == null) {
156
            group = new ExecutorGroup(getDisplayName());
157
            group.setNonInteractive(nonInteractive);
158
        }
159
    }
160
154
161
155
    /**
162
    /**
156
     * Async execution.
163
     * Async execution.
Lines 160-169 Link Here
160
    public void execute() {
167
    public void execute() {
161
        assert executed == false;
168
        assert executed == false;
162
        executed = true;
169
        executed = true;
163
        if (group == null) {
170
        ensureGroupExists();
164
            group = new ExecutorGroup(getDisplayName());
165
            group.setNonInteractive(nonInteractive);
166
        }
167
171
168
        setup();
172
        setup();
169
        executeImpl();
173
        executeImpl();
Lines 359-371 Link Here
359
    }
363
    }
360
364
361
    /**
365
    /**
362
     * Associates this executor with actualy enqueued runnable
366
     * Associates this executor with actually enqueued runnable
363
     * (ClientRunnable created by ClientRuntime) performing the command.
367
     * (ClientRunnable created by ClientRuntime) performing the command.
364
     *
368
     *
365
     * <p>Adds the runnable into group cancelable chain.
369
     * <p>Adds the runnable into group cancellable chain.
366
     */
370
     */
367
    public void commandEnqueued(CommandRunnable commandRunnable) {
371
    public void commandEnqueued(CommandRunnable commandRunnable) {
368
        this.commandRunnable = commandRunnable;
372
        this.commandRunnable = commandRunnable;
373
        ensureGroupExists();
369
        group.enqueued(cvs.getClientRuntime(cmd, options), this);
374
        group.enqueued(cvs.getClientRuntime(cmd, options), this);
370
        group.addCancellable(commandRunnable);
375
        group.addCancellable(commandRunnable);
371
    }
376
    }
(-)a/versioning.system.cvss/src/org/netbeans/modules/versioning/system/cvss/FilesystemHandler.java (-28 / +71 lines)
Lines 1-7 Link Here
1
/*
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
3
 *
4
 * Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved.
4
 * Copyright 1997-2010 Sun Microsystems, Inc. All rights reserved.
5
 *
5
 *
6
 * The contents of this file are subject to the terms of either the GNU
6
 * The contents of this file are subject to the terms of either the GNU
7
 * General Public License Version 2 only ("GPL") or the Common
7
 * General Public License Version 2 only ("GPL") or the Common
Lines 41-46 Link Here
41
41
42
package org.netbeans.modules.versioning.system.cvss;
42
package org.netbeans.modules.versioning.system.cvss;
43
43
44
import org.netbeans.lib.cvsclient.command.CommandException;
45
import org.netbeans.lib.cvsclient.connection.AuthenticationException;
44
import org.netbeans.modules.versioning.spi.VCSInterceptor;
46
import org.netbeans.modules.versioning.spi.VCSInterceptor;
45
import org.netbeans.modules.versioning.util.Utils;
47
import org.netbeans.modules.versioning.util.Utils;
46
import org.netbeans.lib.cvsclient.admin.StandardAdminHandler;
48
import org.netbeans.lib.cvsclient.admin.StandardAdminHandler;
Lines 51-69 Link Here
51
import java.io.File;
53
import java.io.File;
52
import java.io.IOException;
54
import java.io.IOException;
53
import java.util.*;
55
import java.util.*;
54
import javax.swing.SwingUtilities;
55
import org.netbeans.lib.cvsclient.command.GlobalOptions;
56
import org.netbeans.lib.cvsclient.command.GlobalOptions;
57
import org.netbeans.lib.cvsclient.command.Watch;
58
import org.netbeans.lib.cvsclient.command.edit.EditCommand;
56
import org.netbeans.lib.cvsclient.command.update.UpdateCommand;
59
import org.netbeans.lib.cvsclient.command.update.UpdateCommand;
60
import org.netbeans.modules.versioning.system.cvss.ui.actions.edit.EditExecutor;
57
import org.netbeans.modules.versioning.system.cvss.ui.actions.update.UpdateExecutor;
61
import org.netbeans.modules.versioning.system.cvss.ui.actions.update.UpdateExecutor;
58
import org.openide.util.RequestProcessor;
62
import org.openide.util.Exceptions;
59
63
60
/**
64
/**
61
 * Handles events fired from the filesystem such as file/folder create/delete/move.
65
 * Handles events fired from the filesystem such as file/folder create/delete/move.
62
 * 
66
 *
63
 * @author Maros Sandor
67
 * @author Maros Sandor
64
 */
68
 */
65
class FilesystemHandler extends VCSInterceptor {
69
class FilesystemHandler extends VCSInterceptor {
66
        
70
67
    private final FileStatusCache   cache;
71
    private final FileStatusCache   cache;
68
    private static Thread ignoredThread;
72
    private static Thread ignoredThread;
69
73
Lines 73-91 Link Here
73
77
74
    /**
78
    /**
75
     * We save all CVS metadata to be able to commit files that were in that directory.
79
     * We save all CVS metadata to be able to commit files that were in that directory.
76
     * 
80
     *
77
     * @param file File, we are only interested in files inside CVS directory
81
     * @param file File, we are only interested in files inside CVS directory
78
     */ 
82
     */
83
    @Override
79
    public boolean beforeDelete(File file) {
84
    public boolean beforeDelete(File file) {
80
        return !ignoringEvents();
85
        return !ignoringEvents();
81
    }
86
    }
82
87
88
    @Override
83
    public void doDelete(File file) throws IOException {
89
    public void doDelete(File file) throws IOException {
84
        if (file.isDirectory() && hasMetadata(file)) {
90
        if (file.isDirectory() && hasMetadata(file)) {
85
            CvsVisibilityQuery.hideFolder(file);
91
            CvsVisibilityQuery.hideFolder(file);
86
            cache.refresh(file, FileStatusCache.REPOSITORY_STATUS_UNKNOWN, true);
92
            cache.refresh(file, FileStatusCache.REPOSITORY_STATUS_UNKNOWN, true);
87
        } else if (org.netbeans.modules.versioning.system.cvss.util.Utils.isPartOfCVSMetadata(file)) {
93
        } else if (org.netbeans.modules.versioning.system.cvss.util.Utils.isPartOfCVSMetadata(file)) {
88
            // medatada are never deleted
94
            // metadata are never deleted
89
        } else {
95
        } else {
90
            if (!file.delete()) {
96
            if (!file.delete()) {
91
                throw new IOException("Failed to delete file: " + file.getAbsolutePath());
97
                throw new IOException("Failed to delete file: " + file.getAbsolutePath());
Lines 94-103 Link Here
94
        }
100
        }
95
    }
101
    }
96
102
103
    @Override
97
    public void afterDelete(File file) {
104
    public void afterDelete(File file) {
98
        refreshDeleted(file, false);
105
        refreshDeleted(file, false);
99
    }
106
    }
100
    
107
101
    private void refreshDeleted(File file, boolean refreshNow) {
108
    private void refreshDeleted(File file, boolean refreshNow) {
102
        if (refreshNow) {
109
        if (refreshNow) {
103
            cache.refreshNow(file, FileStatusCache.REPOSITORY_STATUS_UNKNOWN, false);
110
            cache.refreshNow(file, FileStatusCache.REPOSITORY_STATUS_UNKNOWN, false);
Lines 110-126 Link Here
110
    /**
117
    /**
111
     * We handle directory renames that are managed by CVS.
118
     * We handle directory renames that are managed by CVS.
112
     */
119
     */
120
    @Override
113
    public boolean beforeMove(File from, File to) {
121
    public boolean beforeMove(File from, File to) {
114
        File destDir = to.getParentFile();
122
        File destDir = to.getParentFile();
115
        return from != null && destDir != null && org.netbeans.modules.versioning.system.cvss.util.Utils.containsMetadata(from);
123
        return from != null && destDir != null && org.netbeans.modules.versioning.system.cvss.util.Utils.containsMetadata(from);
116
    }
124
    }
117
    
125
118
    /**
126
    /**
119
     * We only handle directories, file renames are examined ex post. Both directories share the same parent.
127
     * We only handle directories, file renames are examined ex post. Both directories share the same parent.
120
     * 
128
     *
121
     * @param from source directory to be renamed
129
     * @param from source directory to be renamed
122
     * @param to new directory to be created 
130
     * @param to new directory to be created
123
     */
131
     */
132
    @Override
124
    public void doMove(File from, File to) throws IOException {
133
    public void doMove(File from, File to) throws IOException {
125
        List<File> affectedFiles = new ArrayList<File>();
134
        List<File> affectedFiles = new ArrayList<File>();
126
        moveRecursively(affectedFiles, from, to);
135
        moveRecursively(affectedFiles, from, to);
Lines 161-167 Link Here
161
        } catch (IOException e) {
170
        } catch (IOException e) {
162
            // the Entry is not available, continue with no Entry
171
            // the Entry is not available, continue with no Entry
163
        }
172
        }
164
        
173
165
        if (entries != null) {
174
        if (entries != null) {
166
            for (Entry entry : entries) {
175
            for (Entry entry : entries) {
167
                if (entry != null && !entry.isDirectory() && !entry.isUserFileToBeRemoved()) {
176
                if (entry != null && !entry.isDirectory() && !entry.isUserFileToBeRemoved()) {
Lines 170-197 Link Here
170
                }
179
                }
171
            }
180
            }
172
        }
181
        }
173
        
182
174
        File [] files = dir.listFiles();
183
        File [] files = dir.listFiles();
175
        for (File file : files) {
184
        for (File file : files) {
176
            if (file.isDirectory()) cvsRemoveRecursively(file);
185
            if (file.isDirectory()) cvsRemoveRecursively(file);
177
        }
186
        }
178
    }
187
    }
179
188
189
    @Override
180
    public void afterMove(final File from, final File to) {
190
    public void afterMove(final File from, final File to) {
181
        if (ignoringEvents()) return;
191
        if (ignoringEvents()) return;
182
        Utils.post(new Runnable() {
192
        Utils.post(new Runnable() {
193
            @Override
183
            public void run() {
194
            public void run() {
184
                fileDeletedImpl(from, true);
195
                fileDeletedImpl(from, true);
185
                fileCreatedImpl(to);
196
                fileCreatedImpl(to);
186
            }
197
            }
187
        });
198
        });
188
    }
199
    }
189
    
200
201
    @Override
190
    public boolean beforeCreate(File file, boolean isDirectory) {
202
    public boolean beforeCreate(File file, boolean isDirectory) {
191
        if (ignoringEvents()) return false;
203
        if (ignoringEvents()) return false;
192
        return isDirectory && file.getName().equals(CvsVersioningSystem.FILENAME_CVS);
204
        return isDirectory && file.getName().equals(CvsVersioningSystem.FILENAME_CVS);
193
    }
205
    }
194
206
207
    @Override
195
    public void doCreate(File file, boolean isDirectory) throws IOException {
208
    public void doCreate(File file, boolean isDirectory) throws IOException {
196
        file.mkdir();
209
        file.mkdir();
197
        File f = new File(file, CvsLiteAdminHandler.INVALID_METADATA_MARKER);
210
        File f = new File(file, CvsLiteAdminHandler.INVALID_METADATA_MARKER);
Lines 202-219 Link Here
202
        }
215
        }
203
    }
216
    }
204
217
218
    @Override
205
    public void afterCreate(final File file) {
219
    public void afterCreate(final File file) {
206
        if (ignoringEvents()) return;
220
        if (ignoringEvents()) return;
207
        Utils.post(new Runnable() {
221
        Utils.post(new Runnable() {
222
            @Override
208
            public void run() {
223
            public void run() {
209
                fileCreatedImpl(file);
224
                fileCreatedImpl(file);
210
            }
225
            }
211
        });
226
        });
212
    }
227
    }
213
228
229
    @Override
214
    public void afterChange(final File file) {
230
    public void afterChange(final File file) {
215
        if (ignoringEvents()) return;
231
        if (ignoringEvents()) return;
216
        Utils.post(new Runnable() {
232
        Utils.post(new Runnable() {
233
            @Override
217
            public void run() {
234
            public void run() {
218
                cache.refreshCached(file, FileStatusCache.REPOSITORY_STATUS_UNKNOWN);
235
                cache.refreshCached(file, FileStatusCache.REPOSITORY_STATUS_UNKNOWN);
219
                if (file.getName().equals(CvsVersioningSystem.FILENAME_CVSIGNORE)) cache.directoryContentChanged(file.getParentFile());
236
                if (file.getName().equals(CvsVersioningSystem.FILENAME_CVSIGNORE)) cache.directoryContentChanged(file.getParentFile());
Lines 225-230 Link Here
225
    public Object getAttribute(final File file, String attrName) {
242
    public Object getAttribute(final File file, String attrName) {
226
        if("ProvidedExtensions.Refresh".equals(attrName)) {
243
        if("ProvidedExtensions.Refresh".equals(attrName)) {
227
            return new Runnable() {
244
            return new Runnable() {
245
                @Override
228
                public void run() {
246
                public void run() {
229
                    UpdateCommand cmd = new UpdateCommand();
247
                    UpdateCommand cmd = new UpdateCommand();
230
                    GlobalOptions options = CvsVersioningSystem.createGlobalOptions();
248
                    GlobalOptions options = CvsVersioningSystem.createGlobalOptions();
Lines 238-248 Link Here
238
                    final ExecutorGroup refreshCommandGroup = new ExecutorGroup(null);
256
                    final ExecutorGroup refreshCommandGroup = new ExecutorGroup(null);
239
                    refreshCommandGroup.addExecutors(UpdateExecutor.splitCommand(cmd, CvsVersioningSystem.getInstance(), options, null));
257
                    refreshCommandGroup.addExecutors(UpdateExecutor.splitCommand(cmd, CvsVersioningSystem.getInstance(), options, null));
240
                    CvsVersioningSystem.getInstance().getParallelRequestProcessor().post(new Runnable() {
258
                    CvsVersioningSystem.getInstance().getParallelRequestProcessor().post(new Runnable() {
259
                        @Override
241
                        public void run() {
260
                        public void run() {
242
                            refreshCommandGroup.execute();
261
                            refreshCommandGroup.execute();
243
                        }
262
                        }
244
                    });
263
                    });
245
        
264
246
                }
265
                }
247
            };
266
            };
248
        } else {
267
        } else {
Lines 250-255 Link Here
250
        }
269
        }
251
    }
270
    }
252
271
272
    @Override
273
    public void beforeEdit(File file) {
274
        EditCommand cmd = new EditCommand();
275
        cmd.setDisplayName("CVS edit");
276
        cmd.setFiles(new File[]{file});
277
        cmd.setTemporaryWatch(Watch.EDIT);
278
279
        CvsVersioningSystem cvs = CvsVersioningSystem.getInstance();
280
        EditExecutor[] executors = EditExecutor.splitCommand(cmd, cvs, null);
281
        try {
282
            cvs.post(cmd, executors[0]);
283
        } catch (CommandException ex) {
284
            Exceptions.printStackTrace(ex);
285
        } catch (AuthenticationException ex) {
286
            Exceptions.printStackTrace(ex);
287
        } catch (NotVersionedException ex) {
288
            Exceptions.printStackTrace(ex);
289
        } catch (IllegalCommandException ex) {
290
            Exceptions.printStackTrace(ex);
291
        } catch (IOException ex) {
292
            Exceptions.printStackTrace(ex);
293
        }
294
    }
295
253
    // private methods ---------------------------
296
    // private methods ---------------------------
254
297
255
    private void fileCreatedImpl(File file) {
298
    private void fileCreatedImpl(File file) {
Lines 267-273 Link Here
267
                // the Entry is not available, continue with no Entry
310
                // the Entry is not available, continue with no Entry
268
            }
311
            }
269
            if (entry != null && !entry.isDirectory() && entry.isUserFileToBeRemoved()) {
312
            if (entry != null && !entry.isDirectory() && entry.isUserFileToBeRemoved()) {
270
                cvsUndoRemoveLocally(sah, file, entry);    
313
                cvsUndoRemoveLocally(sah, file, entry);
271
            }
314
            }
272
            cache.refresh(file, FileStatusCache.REPOSITORY_STATUS_UNKNOWN);
315
            cache.refresh(file, FileStatusCache.REPOSITORY_STATUS_UNKNOWN);
273
        }
316
        }
Lines 277-288 Link Here
277
320
278
    /**
321
    /**
279
     * If a regular file is deleted then update its Entries as if it has been removed.
322
     * If a regular file is deleted then update its Entries as if it has been removed.
280
     * 
323
     *
281
     * @param file deleted file
324
     * @param file deleted file
282
     */ 
325
     */
283
    private void fileDeletedImpl(File file, boolean refreshNow) {
326
    private void fileDeletedImpl(File file, boolean refreshNow) {
284
        if (file == null) return;
327
        if (file == null) return;
285
        
328
286
        StandardAdminHandler sah = new StandardAdminHandler();
329
        StandardAdminHandler sah = new StandardAdminHandler();
287
        Entry entry = null;
330
        Entry entry = null;
288
        try {
331
        try {
Lines 291-310 Link Here
291
            // the Entry is not available, continue with no Entry
334
            // the Entry is not available, continue with no Entry
292
        }
335
        }
293
        if (entry != null && !entry.isDirectory() && !entry.isUserFileToBeRemoved()) {
336
        if (entry != null && !entry.isDirectory() && !entry.isUserFileToBeRemoved()) {
294
            cvsRemoveLocally(sah, file, entry);    
337
            cvsRemoveLocally(sah, file, entry);
295
        }
338
        }
296
339
297
        refreshDeleted(file, refreshNow);
340
        refreshDeleted(file, refreshNow);
298
    }
341
    }
299
    
342
300
    /**
343
    /**
301
     * Emulates the 'cvs remove' command by modifying Entries. We do this to avoid contacting the
344
     * Emulates the 'cvs remove' command by modifying Entries. We do this to avoid contacting the
302
     * server.
345
     * server.
303
     * 
346
     *
304
     * @param ah
347
     * @param ah
305
     * @param file
348
     * @param file
306
     * @param entry
349
     * @param entry
307
     */ 
350
     */
308
    private void cvsRemoveLocally(AdminHandler ah, File file, Entry entry) {
351
    private void cvsRemoveLocally(AdminHandler ah, File file, Entry entry) {
309
        try {
352
        try {
310
            if (entry.isNewUserFile()) {
353
            if (entry.isNewUserFile()) {
Lines 328-344 Link Here
328
            // failed to set entry, the file will be probably resurrected during update
371
            // failed to set entry, the file will be probably resurrected during update
329
        }
372
        }
330
    }
373
    }
331
    
374
332
    private void refresh(List<File> files) {
375
    private void refresh(List<File> files) {
333
        for (File file : files) {
376
        for (File file : files) {
334
            cache.refresh(file, FileStatusCache.REPOSITORY_STATUS_UNKNOWN, true);          
377
            cache.refresh(file, FileStatusCache.REPOSITORY_STATUS_UNKNOWN, true);
335
        }
378
        }
336
    }
379
    }
337
380
338
    private boolean hasMetadata(File file) {
381
    private boolean hasMetadata(File file) {
339
        return new File(file, "CVS/Repository").canRead();
382
        return new File(file, "CVS/Repository").canRead();
340
    }
383
    }
341
    
384
342
    /**
385
    /**
343
     * Ignores (internal) events from current thread. E.g.:
386
     * Ignores (internal) events from current thread. E.g.:
344
     * <pre>
387
     * <pre>
Lines 364-370 Link Here
364
407
365
    /**
408
    /**
366
     * @return true if filesystem events are ignored in current thread, false otherwise
409
     * @return true if filesystem events are ignored in current thread, false otherwise
367
     */ 
410
     */
368
    private static boolean ignoringEvents() {
411
    private static boolean ignoringEvents() {
369
        return ignoredThread == Thread.currentThread();
412
        return ignoredThread == Thread.currentThread();
370
    }
413
    }
(-)a/versioning.system.cvss/src/org/netbeans/modules/versioning/system/cvss/util/Utils.java (-7 / +7 lines)
Lines 106-112 Link Here
106
106
107
    /**
107
    /**
108
     * Validates annotation format text
108
     * Validates annotation format text
109
     * @param format format to be validatet
109
     * @param format format to be validated
110
     * @return <code>true</code> if the format is correct, <code>false</code> otherwise.
110
     * @return <code>true</code> if the format is correct, <code>false</code> otherwise.
111
     */
111
     */
112
    public static boolean isAnnotationFormatValid(final String format) {
112
    public static boolean isAnnotationFormatValid(final String format) {
Lines 124-130 Link Here
124
    
124
    
125
    /**
125
    /**
126
     * Semantics is similar to {@link org.openide.windows.TopComponent#getActivatedNodes()} except that this
126
     * Semantics is similar to {@link org.openide.windows.TopComponent#getActivatedNodes()} except that this
127
     * method returns File objects instead od Nodes. Every node is examined for Files it represents. File and Folder
127
     * method returns File objects instead of Nodes. Every node is examined for Files it represents. File and Folder
128
     * nodes represent their underlying files or folders. Project nodes are represented by their source groups. Other
128
     * nodes represent their underlying files or folders. Project nodes are represented by their source groups. Other
129
     * logical nodes must provide FileObjects in their Lookup.
129
     * logical nodes must provide FileObjects in their Lookup.
130
     *   
130
     *   
Lines 142-148 Link Here
142
    
142
    
143
    /**
143
    /**
144
     * Semantics is similar to {@link org.openide.windows.TopComponent#getActivatedNodes()} except that this
144
     * Semantics is similar to {@link org.openide.windows.TopComponent#getActivatedNodes()} except that this
145
     * method returns File objects instead od Nodes. Every node is examined for Files it represents. File and Folder
145
     * method returns File objects instead of Nodes. Every node is examined for Files it represents. File and Folder
146
     * nodes represent their underlying files or folders. Project nodes are represented by their source groups. Other
146
     * nodes represent their underlying files or folders. Project nodes are represented by their source groups. Other
147
     * logical nodes must provide FileObjects in their Lookup.
147
     * logical nodes must provide FileObjects in their Lookup.
148
     *
148
     *
Lines 165-171 Link Here
165
            }
165
            }
166
        }
166
        }
167
        // if there are no exclusions, we may safely return this context because filtered files == root files
167
        // if there are no exclusions, we may safely return this context because filtered files == root files
168
        if (context.getExclusions().size() == 0) return context;
168
        if (context.getExclusions().isEmpty()) return context;
169
169
170
        // in this code we remove files from filteredFiles to NOT include any files that do not have required status
170
        // in this code we remove files from filteredFiles to NOT include any files that do not have required status
171
        // consider a freeform project that has 'build' in filteredFiles, the Branch action would try to branch it
171
        // consider a freeform project that has 'build' in filteredFiles, the Branch action would try to branch it
Lines 294-300 Link Here
294
    }
294
    }
295
295
296
    /**
296
    /**
297
     * Returns the widest possible versioned context for the given file, the outter boundary is the file's Project.
297
     * Returns the widest possible versioned context for the given file, the outer boundary is the file's Project.
298
     * 
298
     * 
299
     * @param file a file
299
     * @param file a file
300
     * @return Context a context 
300
     * @return Context a context 
Lines 380-386 Link Here
380
     * Computes path of this file to repository root.
380
     * Computes path of this file to repository root.
381
     *
381
     *
382
     * @param file a file
382
     * @param file a file
383
     * @return String path of this file in repsitory. If this path does not describe a
383
     * @return String path of this file in repository. If this path does not describe a
384
     * versioned file, this method returns an empty string 
384
     * versioned file, this method returns an empty string 
385
     */
385
     */
386
    public static String getRelativePath(File file) {
386
    public static String getRelativePath(File file) {
Lines 453-459 Link Here
453
        } else {
453
        } else {
454
            int rev = Integer.parseInt(nums[lastIndex]);
454
            int rev = Integer.parseInt(nums[lastIndex]);
455
            if (!cutoff) rev--;
455
            if (!cutoff) rev--;
456
            StringBuffer sb = new StringBuffer(nums[0]);
456
            StringBuilder sb = new StringBuilder(nums[0]);
457
            for (int i = 1; i<lastIndex; i++) {
457
            for (int i = 1; i<lastIndex; i++) {
458
                sb.append('.').append(nums[i]); // NOI18N
458
                sb.append('.').append(nums[i]); // NOI18N
459
            }
459
            }
(-)a/xml.schema.completion/src/org/netbeans/modules/xml/schema/completion/util/CompletionUtil.java (-4 / +4 lines)
Lines 313-326 Link Here
313
           ((Datatype)type).getEnumerations() == null)
313
           ((Datatype)type).getEnumerations() == null)
314
            return null;                
314
            return null;                
315
        for(Object value: ((Datatype)type).getEnumerations()) {
315
        for(Object value: ((Datatype)type).getEnumerations()) {
316
            String str = (value!=null)?value.toString():null;
316
            if(context.getTypedChars() == null || context.getTypedChars().equals("")) {
317
            if(context.getTypedChars() == null || context.getTypedChars().equals("")) {
317
                ValueResultItem item = new ValueResultItem(attr, (String)value, context);
318
                ValueResultItem item = new ValueResultItem(attr, str, context);
318
                result.add(item);
319
                result.add(item);
319
                continue;
320
                continue;
320
            }
321
            }
321
            String str = (String)value;
322
            if(str.startsWith(context.getTypedChars())) {
322
            if(str.startsWith(context.getTypedChars())) {
323
                ValueResultItem item = new ValueResultItem(attr, (String)value, context);
323
                ValueResultItem item = new ValueResultItem(attr, str, context);
324
                result.add(item);
324
                result.add(item);
325
            }
325
            }
326
        }
326
        }
Lines 344-350 Link Here
344
        }
344
        }
345
        // namespace aware items
345
        // namespace aware items
346
        List<String> prefixes = getPrefixes(context, axi, cm);
346
        List<String> prefixes = getPrefixes(context, axi, cm);
347
        if (prefixes.size() == 0) {
347
        if (prefixes.isEmpty()) {
348
           prefixes.add(null);
348
           prefixes.add(null);
349
        }
349
        }
350
        for (String prefix: prefixes) {
350
        for (String prefix: prefixes) {
(-)a/xml.schema.model/src/org/netbeans/modules/xml/schema/model/LocalElement.java (-2 / +2 lines)
Lines 1-7 Link Here
1
/*
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
3
 *
4
 * Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved.
4
 * Copyright 1997-2010 Sun Microsystems, Inc. All rights reserved.
5
 *
5
 *
6
 * The contents of this file are subject to the terms of either the GNU
6
 * The contents of this file are subject to the terms of either the GNU
7
 * General Public License Version 2 only ("GPL") or the Common
7
 * General Public License Version 2 only ("GPL") or the Common
Lines 79-83 Link Here
79
    void setMinOccurs(Integer min);
79
    void setMinOccurs(Integer min);
80
    int getMinOccursDefault();
80
    int getMinOccursDefault();
81
    int getMinOccursEffective();
81
    int getMinOccursEffective();
82
    
82
    String getMinOccursText();
83
}
83
}
(-)a/xml.schema.model/src/org/netbeans/modules/xml/schema/model/impl/LocalElementBaseImpl.java (-3 / +7 lines)
Lines 1-7 Link Here
1
/*
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
3
 *
4
 * Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved.
4
 * Copyright 1997-2010 Sun Microsystems, Inc. All rights reserved.
5
 *
5
 *
6
 * The contents of this file are subject to the terms of either the GNU
6
 * The contents of this file are subject to the terms of either the GNU
7
 * General Public License Version 2 only ("GPL") or the Common
7
 * General Public License Version 2 only ("GPL") or the Common
Lines 100-111 Link Here
100
    public NamedComponentReference<GlobalElement> getRef() {
100
    public NamedComponentReference<GlobalElement> getRef() {
101
        return resolveGlobalReference(GlobalElement.class, SchemaAttributes.REF);
101
        return resolveGlobalReference(GlobalElement.class, SchemaAttributes.REF);
102
    }
102
    }
103
    
103
104
    public String getMinOccursText() {
105
        return getAttribute(SchemaAttributes.MIN_OCCURS);
106
    }
107
104
    /**
108
    /**
105
     *
109
     *
106
     */
110
     */
107
    public Integer getMinOccurs() {
111
    public Integer getMinOccurs() {
108
        String s = getAttribute(SchemaAttributes.MIN_OCCURS);
112
        String s = getMinOccursText();
109
        return s == null ? null : Integer.valueOf(s);
113
        return s == null ? null : Integer.valueOf(s);
110
    }
114
    }
111
    
115
    
(-)a/xml.schema.ui.basic/src/org/netbeans/modules/xml/schema/ui/nodes/categorized/AdvancedLocalElementNode.java (-2 / +9 lines)
Lines 1-7 Link Here
1
/*
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
3
 *
4
 * Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved.
4
 * Copyright 1997-2010 Sun Microsystems, Inc. All rights reserved.
5
 *
5
 *
6
 * The contents of this file are subject to the terms of either the GNU
6
 * The contents of this file are subject to the terms of either the GNU
7
 * General Public License Version 2 only ("GPL") or the Common
7
 * General Public License Version 2 only ("GPL") or the Common
Lines 81-88 Link Here
81
        String max=element.getMaxOccursEffective();
81
        String max=element.getMaxOccursEffective();
82
        if (max.equals("unbounded"))
82
        if (max.equals("unbounded"))
83
            max="*";
83
            max="*";
84
85
        String minimum;
86
        try {
87
            minimum = Integer.toString(element.getMinOccursEffective());
88
        } catch (NumberFormatException ex) {
89
            minimum = "<font color='#ff0000'>"+element.getMinOccursText()+"</font>";
90
        }
84
        
91
        
85
        String decoration="["+element.getMinOccursEffective()+".."+max+"]";
92
        String decoration="["+minimum+".."+max+"]";
86
        if(element.getType()!=null && element.getType().get()!=null) {
93
        if(element.getType()!=null && element.getType().get()!=null) {
87
            String supertypeLabel = NbBundle.getMessage(
94
            String supertypeLabel = NbBundle.getMessage(
88
                    AdvancedLocalElementNode.class, "LBL_InstanceOf",
95
                    AdvancedLocalElementNode.class, "LBL_InstanceOf",

Return to bug 70639