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

(-)a/cnd.modelui/nbproject/project.xml (+17 lines)
Lines 193-198 Link Here
193
                    </run-dependency>
193
                    </run-dependency>
194
                </dependency>
194
                </dependency>
195
                <dependency>
195
                <dependency>
196
                    <code-name-base>org.netbeans.modules.sendopts</code-name-base>
197
                    <build-prerequisite/>
198
                    <compile-dependency/>
199
                    <run-dependency>
200
                        <release-version>2</release-version>
201
                        <specification-version>2.36</specification-version>
202
                    </run-dependency>
203
                </dependency>
204
                <dependency>
196
                    <code-name-base>org.openide.awt</code-name-base>
205
                    <code-name-base>org.openide.awt</code-name-base>
197
                    <build-prerequisite/>
206
                    <build-prerequisite/>
198
                    <compile-dependency/>
207
                    <compile-dependency/>
Lines 241-246 Link Here
241
                    </run-dependency>
250
                    </run-dependency>
242
                </dependency>
251
                </dependency>
243
                <dependency>
252
                <dependency>
253
                    <code-name-base>org.openide.modules</code-name-base>
254
                    <build-prerequisite/>
255
                    <compile-dependency/>
256
                    <run-dependency>
257
                        <specification-version>7.49</specification-version>
258
                    </run-dependency>
259
                </dependency>
260
                <dependency>
244
                    <code-name-base>org.openide.nodes</code-name-base>
261
                    <code-name-base>org.openide.nodes</code-name-base>
245
                    <build-prerequisite/>
262
                    <build-prerequisite/>
246
                    <compile-dependency/>
263
                    <compile-dependency/>
(-)a/cnd.modelui/src/org/netbeans/modules/cnd/modelui/actions/Bundle.properties (+1 lines)
Lines 37-39 Link Here
37
CTL_ReparseProject=Reparse Project
37
CTL_ReparseProject=Reparse Project
38
CTL_ReparseProjects=Reparse {0} Projects
38
CTL_ReparseProjects=Reparse {0} Projects
39
CTL_CodeModelDiagnostic=Dump C/C++ Code Model Diagnostics
39
CTL_CodeModelDiagnostic=Dump C/C++ Code Model Diagnostics
40
CTL_ForceReparseProject=Clean C/C++ cache and restart IDE
(-)a/cnd.modelui/src/org/netbeans/modules/cnd/modelui/actions/CeanupCache.java (+116 lines)
Line 0 Link Here
1
package org.netbeans.modules.cnd.modelui.actions;
2
3
import java.io.File;
4
import java.io.IOException;
5
import java.util.Collections;
6
import java.util.Map;
7
import java.util.Set;
8
import org.netbeans.api.sendopts.CommandException;
9
import org.netbeans.spi.sendopts.Env;
10
import org.netbeans.spi.sendopts.Option;
11
import org.netbeans.spi.sendopts.OptionProcessor;
12
import org.openide.filesystems.FileUtil;
13
import org.openide.modules.Places;
14
import org.openide.util.Exceptions;
15
16
/*
17
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
18
 *
19
 * Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
20
 *
21
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
22
 * Other names may be trademarks of their respective owners.
23
 *
24
 * The contents of this file are subject to the terms of either the GNU
25
 * General Public License Version 2 only ("GPL") or the Common
26
 * Development and Distribution License("CDDL") (collectively, the
27
 * "License"). You may not use this file except in compliance with the
28
 * License. You can obtain a copy of the License at
29
 * http://www.netbeans.org/cddl-gplv2.html
30
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
31
 * specific language governing permissions and limitations under the
32
 * License.  When distributing the software, include this License Header
33
 * Notice in each file and include the License file at
34
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
35
 * particular file as subject to the "Classpath" exception as provided
36
 * by Oracle in the GPL Version 2 section of the License file that
37
 * accompanied this code. If applicable, add the following below the
38
 * License Header, with the fields enclosed by brackets [] replaced by
39
 * your own identifying information:
40
 * "Portions Copyrighted [year] [name of copyright owner]"
41
 *
42
 * If you wish your version of this file to be governed by only the CDDL
43
 * or only the GPL Version 2, indicate your decision by adding
44
 * "[Contributor] elects to include this software in this distribution
45
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
46
 * single choice of license, a recipient has the option to distribute
47
 * your version of this file under either the CDDL, the GPL Version 2 or
48
 * to extend the choice of license to its licensees as provided above.
49
 * However, if you add GPL Version 2 code and therefore, elected the GPL
50
 * Version 2 license, then the option applies only if the new code is
51
 * made subject to such option by the copyright holder.
52
 *
53
 * Contributor(s):
54
 */
55
56
/**
57
 *
58
 * @author Alexander Simon
59
 */
60
@org.openide.util.lookup.ServiceProvider(service=org.netbeans.spi.sendopts.OptionProcessor.class)
61
public class CeanupCache extends OptionProcessor {
62
63
    @Override
64
    protected Set<Option> getOptions() {
65
        cleanupCache("cnd"); // NOI18N
66
        cleanupCache("remote-files"); // NOI18N
67
        cleanupCache("index"); // NOI18N
68
        cleanupCache("svnremotecache"); // NOI18N
69
        return Collections.emptySet();
70
    }
71
72
    static void markToCleanup() {
73
        markToCleanup("cnd"); // NOI18N
74
        markToCleanup("remote-files"); // NOI18N
75
        markToCleanup("index"); // NOI18N
76
        markToCleanup("svnremotecache"); // NOI18N
77
        
78
    }
79
80
    private static void markToCleanup(String cacheName) {
81
        File cache = Places.getCacheSubdirectory(cacheName); // NOI18N
82
        if (cache.exists()) {
83
            File cleanupFile = new File(cache,"cleanup"); // NOI18N
84
            if (!cleanupFile.exists()) {
85
                try {
86
                    cleanupFile.createNewFile();
87
                } catch (IOException x) {
88
                }
89
            }
90
        }
91
    }
92
    
93
    private static void cleanupCache(String cacheName) {
94
        File cache = Places.getCacheSubdirectory(cacheName); // NOI18N
95
        if (cache.exists()) {
96
            File cleanupFile = new File(cache, "cleanup"); // NOI18N
97
            if (cleanupFile.exists()) {
98
                deleteRecursively(cache);
99
            }
100
        }
101
    }
102
103
    public static void deleteRecursively(File file) {
104
        File [] files = file.listFiles();
105
        if (files != null) {
106
            for (int i = 0; i < files.length; i++) {
107
                deleteRecursively(files[i]);
108
            }
109
        }
110
        file.delete();
111
    }
112
    
113
    @Override
114
    protected void process(Env env, Map<Option, String[]> optionValues) throws CommandException {
115
    }
116
}
(-)a/cnd.modelui/src/org/netbeans/modules/cnd/modelui/actions/ReparseProjectAction.java (-10 / +9 lines)
Lines 43-72 Link Here
43
package org.netbeans.modules.cnd.modelui.actions;
43
package org.netbeans.modules.cnd.modelui.actions;
44
44
45
import java.util.Collection;
45
import java.util.Collection;
46
import org.netbeans.modules.cnd.api.model.CsmModelAccessor;
47
import org.netbeans.modules.cnd.api.model.CsmProject;
46
import org.netbeans.modules.cnd.api.model.CsmProject;
47
import org.openide.LifecycleManager;
48
import org.openide.util.NbBundle;
48
import org.openide.util.NbBundle;
49
49
50
/**
50
/**
51
 * @author Vladimir Voskresensky
51
 * @author Alexander Simon
52
 */
52
 */
53
public final class ReparseProjectAction extends ProjectActionBase {
53
public final class ForceReparseProjectAction extends ProjectActionBase {
54
54
55
    public ReparseProjectAction() {
55
    public ForceReparseProjectAction() {
56
        super(true);
56
        super(true);
57
    }
57
    }
58
58
59
    @Override
59
    @Override
60
    public String getName() {
60
    public String getName() {
61
        final Collection<CsmProject> projects = getCsmProjects(getActivatedNodes());
61
        return NbBundle.getMessage(ForceReparseProjectAction.class, "CTL_ForceReparseProject"); //NOI18N
62
        if (projects.size() > 1) {
63
            return NbBundle.getMessage(ReparseProjectAction.class, "CTL_ReparseProjects", projects.size()); //NOI18N
64
        }
65
        return NbBundle.getMessage(ReparseProjectAction.class, "CTL_ReparseProject"); //NOI18N
66
    }
62
    }
67
63
68
    @Override
64
    @Override
69
    protected void performAction(Collection<CsmProject> csmProjects) {
65
    protected void performAction(Collection<CsmProject> csmProjects) {
70
        CsmModelAccessor.getModel().scheduleReparse(csmProjects);
66
        CeanupCache.markToCleanup();
67
        LifecycleManager.getDefault().saveAll();
68
        LifecycleManager.getDefault().markForRestart();
69
        LifecycleManager.getDefault().exit();
71
    }
70
    }
72
}
71
}
(-)a/cnd.modelui/src/org/netbeans/modules/cnd/modelui/layer.xml (+7 lines)
Lines 52-57 Link Here
52
            <file name="ReparseProjectAction.instance">
52
            <file name="ReparseProjectAction.instance">
53
                <attr name="instanceClass" stringvalue="org.netbeans.modules.cnd.modelui.actions.ReparseProjectAction"/>
53
                <attr name="instanceClass" stringvalue="org.netbeans.modules.cnd.modelui.actions.ReparseProjectAction"/>
54
            </file>
54
            </file>
55
            <file name="ForceReparseProjectAction.instance">
56
                <attr name="instanceClass" stringvalue="org.netbeans.modules.cnd.modelui.actions.ForceReparseProjectAction"/>
57
            </file>
55
            <file name="CodeModelDiagnosticAction.instance">
58
            <file name="CodeModelDiagnosticAction.instance">
56
                <attr name="instanceClass" stringvalue="org.netbeans.modules.cnd.modelui.actions.CodeModelDiagnosticAction"/>
59
                <attr name="instanceClass" stringvalue="org.netbeans.modules.cnd.modelui.actions.CodeModelDiagnosticAction"/>
57
            </file>
60
            </file>
Lines 130-135 Link Here
130
                <attr name="originalFile" stringvalue="Actions/NativeProjectCodeAssistance/ReparseProjectAction.instance"/>
133
                <attr name="originalFile" stringvalue="Actions/NativeProjectCodeAssistance/ReparseProjectAction.instance"/>
131
                <attr name="position" intvalue="150"/>
134
                <attr name="position" intvalue="150"/>
132
            </file>
135
            </file>
136
            <file name="org.netbeans.modules.cnd.modelui.actions.ForceReparseProjectAction.shadow">
137
                <attr name="originalFile" stringvalue="Actions/NativeProjectCodeAssistance/ForceReparseProjectAction.instance"/>
138
                <attr name="position" intvalue="151"/>
139
            </file>
133
            <file name="TestProjectAllReferencesPerformanceAction.shadow">
140
            <file name="TestProjectAllReferencesPerformanceAction.shadow">
134
                <attr name="originalFile" stringvalue="Actions/NativeProjectCodeAssistance/TestProjectAllReferencesPerformanceAction.instance"/>
141
                <attr name="originalFile" stringvalue="Actions/NativeProjectCodeAssistance/TestProjectAllReferencesPerformanceAction.instance"/>
135
                <attr name="position" intvalue="1200"/>
142
                <attr name="position" intvalue="1200"/>

Return to bug 267606