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

(-)a/java.source/src/org/netbeans/modules/java/source/indexing/JavaCustomIndexer.java (-1 / +13 lines)
Lines 140-145 Link Here
140
140
141
    @Override
141
    @Override
142
    protected void index(final Iterable<? extends Indexable> files, final Context context) {
142
    protected void index(final Iterable<? extends Indexable> files, final Context context) {
143
        if (context.isTransientIndexing()) {
144
            return;
145
        }
143
        JavaIndex.LOG.log(Level.FINE, context.isSupplementaryFilesIndexing() ? "index suplementary({0})" :"index({0})", context.isAllFilesIndexing() ? context.getRootURI() : files); //NOI18N
146
        JavaIndex.LOG.log(Level.FINE, context.isSupplementaryFilesIndexing() ? "index suplementary({0})" :"index({0})", context.isAllFilesIndexing() ? context.getRootURI() : files); //NOI18N
144
        final TransactionContext txCtx = TransactionContext.get();
147
        final TransactionContext txCtx = TransactionContext.get();
145
        final FileManagerTransaction fmTx = txCtx.get(FileManagerTransaction.class);
148
        final FileManagerTransaction fmTx = txCtx.get(FileManagerTransaction.class);
Lines 929-934 Link Here
929
932
930
        @Override
933
        @Override
931
        public boolean scanStarted(final Context context) {
934
        public boolean scanStarted(final Context context) {
935
            if (context.isTransientIndexing()) {
936
                return true;
937
            }
932
            JavaIndex.LOG.log(Level.FINE, "scan started for root ({0})", context.getRootURI()); //NOI18N
938
            JavaIndex.LOG.log(Level.FINE, "scan started for root ({0})", context.getRootURI()); //NOI18N
933
            TransactionContext.beginStandardTransaction(context.getRootURI(), true, context.isAllFilesIndexing());
939
            TransactionContext.beginStandardTransaction(context.getRootURI(), true, context.isAllFilesIndexing());
934
            boolean vote = true;
940
            boolean vote = true;
Lines 978-984 Link Here
978
        }        
984
        }        
979
985
980
        @Override
986
        @Override
981
        public void scanFinished(final Context context) {            
987
        public void scanFinished(final Context context) {
988
            if (context.isTransientIndexing()) {
989
                return;
990
            }
982
            final TransactionContext txCtx = TransactionContext.get();
991
            final TransactionContext txCtx = TransactionContext.get();
983
            assert txCtx != null;
992
            assert txCtx != null;
984
            try {
993
            try {
Lines 999-1004 Link Here
999
1008
1000
        @Override
1009
        @Override
1001
        public void filesDeleted(Iterable<? extends Indexable> deleted, Context context) {
1010
        public void filesDeleted(Iterable<? extends Indexable> deleted, Context context) {
1011
            if (context.isTransientIndexing()) {
1012
                return;
1013
            }
1002
            JavaIndex.LOG.log(Level.FINE, "filesDeleted({0})", deleted); //NOI18N
1014
            JavaIndex.LOG.log(Level.FINE, "filesDeleted({0})", deleted); //NOI18N
1003
            clearFiles(context, deleted);
1015
            clearFiles(context, deleted);
1004
        }
1016
        }
(-)a/java.source/src/org/netbeans/modules/java/source/usages/BinaryAnalyser.java (+1 lines)
Lines 240-245 Link Here
240
                false,
240
                false,
241
                false,
241
                false,
242
                false,
242
                false,
243
                false,
243
                SuspendSupport.NOP,
244
                SuspendSupport.NOP,
244
                null,
245
                null,
245
                null));
246
                null));
(-)a/java.source/test/unit/src/org/netbeans/modules/java/source/indexing/CompileWorkerTestBase.java (-1 / +1 lines)
Lines 108-114 Link Here
108
    private ParsingOutput runIndexing(List<CompileTuple> files, List<CompileTuple> virtualFiles) throws Exception {
108
    private ParsingOutput runIndexing(List<CompileTuple> files, List<CompileTuple> virtualFiles) throws Exception {
109
        TransactionContext txc = TransactionContext.beginStandardTransaction(src.toURL(), true, false);
109
        TransactionContext txc = TransactionContext.beginStandardTransaction(src.toURL(), true, false);
110
        Factory f = new JavaCustomIndexer.Factory();
110
        Factory f = new JavaCustomIndexer.Factory();
111
        Context ctx = SPIAccessor.getInstance().createContext(CacheFolder.getDataFolder(src.toURL()), src.toURL(), f.getIndexerName(), f.getIndexVersion(), LuceneIndexFactory.getDefault(), false, false, true, SPIAccessor.getInstance().createSuspendStatus(new SuspendStatusImpl() {
111
        Context ctx = SPIAccessor.getInstance().createContext(CacheFolder.getDataFolder(src.toURL()), src.toURL(), f.getIndexerName(), f.getIndexVersion(), LuceneIndexFactory.getDefault(), false, false, true, false, SPIAccessor.getInstance().createSuspendStatus(new SuspendStatusImpl() {
112
            @Override public boolean isSuspended() {
112
            @Override public boolean isSuspended() {
113
                return false;
113
                return false;
114
            }
114
            }
(-)a/parsing.api/apichanges.xml (+16 lines)
Lines 110-115 Link Here
110
<!-- ACTUAL CHANGES BEGIN HERE: -->
110
<!-- ACTUAL CHANGES BEGIN HERE: -->
111
111
112
  <changes>
112
  <changes>
113
  <change id="Context.isTransientIndexing">
114
      <api name="ParsingAPI"/>
115
      <summary>Added <code>Context.isTransientIndexing</code> to notify indexers that indexing is started for modified non saved file.</summary>
116
      <version major="1" minor="66"/>
117
      <date day="3" month="4" year="2013"/>
118
      <author login="tzezula"/>
119
      <compatibility source="compatible" binary="compatible" semantic="compatible" deletion="no" addition="yes" modification="no"/>
120
      <description>
121
          <p>
122
              Added <code>Context.isTransientIndexing</code> to notify indexers that indexing is started for modified non saved file
123
              as a result of <code>QuerySupport</code> query.
124
          </p>
125
      </description>
126
      <class package="org.netbeans.modules.parsing.spi.indexing" name="Context"/>
127
      <issue number="227952"/>
128
  </change>
113
  <change id="QuerySupport.findDependentRoots">
129
  <change id="QuerySupport.findDependentRoots">
114
      <api name="ParsingAPI"/>
130
      <api name="ParsingAPI"/>
115
      <summary>Added <code>QuerySupport.findDependentRoots</code> to find out source roots depending on given source root.</summary>
131
      <summary>Added <code>QuerySupport.findDependentRoots</code> to find out source roots depending on given source root.</summary>
(-)a/parsing.api/nbproject/project.properties (-1 / +1 lines)
Lines 3-9 Link Here
3
javac.source=1.6
3
javac.source=1.6
4
javadoc.apichanges=${basedir}/apichanges.xml
4
javadoc.apichanges=${basedir}/apichanges.xml
5
javadoc.arch=${basedir}/arch.xml
5
javadoc.arch=${basedir}/arch.xml
6
spec.version.base=1.65.0
6
spec.version.base=1.66.0
7
7
8
test.config.stableBTD.includes=**/*Test.class
8
test.config.stableBTD.includes=**/*Test.class
9
test.config.stableBTD.excludes=\
9
test.config.stableBTD.excludes=\
(-)a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/RepositoryUpdater.java (+8 lines)
Lines 1358-1363 Link Here
1358
                                        false,
1358
                                        false,
1359
                                        true,
1359
                                        true,
1360
                                        false,
1360
                                        false,
1361
                                        TransientUpdateSupport.isTransientUpdate(),
1361
                                        SuspendSupport.NOP,
1362
                                        SuspendSupport.NOP,
1362
                                        null,
1363
                                        null,
1363
                                        null);
1364
                                        null);
Lines 1380-1385 Link Here
1380
                                        false,
1381
                                        false,
1381
                                        true,
1382
                                        true,
1382
                                        false,
1383
                                        false,
1384
                                        TransientUpdateSupport.isTransientUpdate(),
1383
                                        SuspendSupport.NOP,
1385
                                        SuspendSupport.NOP,
1384
                                        null,
1386
                                        null,
1385
                                        null);
1387
                                        null);
Lines 2192-2197 Link Here
2192
                            followUpJob,
2194
                            followUpJob,
2193
                            checkEditor,
2195
                            checkEditor,
2194
                            sourceForBinaryRoot,
2196
                            sourceForBinaryRoot,
2197
                            TransientUpdateSupport.isTransientUpdate(),
2195
                            getSuspendStatus(),
2198
                            getSuspendStatus(),
2196
                            getCancelRequest(),
2199
                            getCancelRequest(),
2197
                            logCtx);
2200
                            logCtx);
Lines 2238-2243 Link Here
2238
                                followUpJob,
2241
                                followUpJob,
2239
                                checkEditor,
2242
                                checkEditor,
2240
                                sourceForBinaryRoot,
2243
                                sourceForBinaryRoot,
2244
                                TransientUpdateSupport.isTransientUpdate(),
2241
                                getSuspendStatus(),
2245
                                getSuspendStatus(),
2242
                                getCancelRequest(),
2246
                                getCancelRequest(),
2243
                                logCtx);
2247
                                logCtx);
Lines 2413-2418 Link Here
2413
                                    followUpJob,
2417
                                    followUpJob,
2414
                                    checkEditor,
2418
                                    checkEditor,
2415
                                    sourceForBinaryRoot,
2419
                                    sourceForBinaryRoot,
2420
                                    TransientUpdateSupport.isTransientUpdate(),
2416
                                    getSuspendStatus(),
2421
                                    getSuspendStatus(),
2417
                                    getCancelRequest(),
2422
                                    getCancelRequest(),
2418
                                    logCtx);
2423
                                    logCtx);
Lines 2545-2550 Link Here
2545
                                                followUpJob,
2550
                                                followUpJob,
2546
                                                checkEditor,
2551
                                                checkEditor,
2547
                                                sourceForBinaryRoot,
2552
                                                sourceForBinaryRoot,
2553
                                                TransientUpdateSupport.isTransientUpdate(),
2548
                                                getSuspendStatus(),
2554
                                                getSuspendStatus(),
2549
                                                getCancelRequest(),
2555
                                                getCancelRequest(),
2550
                                                logCtx);
2556
                                                logCtx);
Lines 2695-2700 Link Here
2695
                    false,
2701
                    false,
2696
                    false,
2702
                    false,
2697
                    false,
2703
                    false,
2704
                    TransientUpdateSupport.isTransientUpdate(),
2698
                    getSuspendStatus(),
2705
                    getSuspendStatus(),
2699
                    getCancelRequest(),
2706
                    getCancelRequest(),
2700
                    null);
2707
                    null);
Lines 2857-2862 Link Here
2857
                                                        followUpJob,
2864
                                                        followUpJob,
2858
                                                        checkEditor,
2865
                                                        checkEditor,
2859
                                                        sourceForBinaryRoot,
2866
                                                        sourceForBinaryRoot,
2867
                                                        TransientUpdateSupport.isTransientUpdate(),
2860
                                                        getSuspendStatus(),
2868
                                                        getSuspendStatus(),
2861
                                                        getCancelRequest(),
2869
                                                        getCancelRequest(),
2862
                                                        logCtx);
2870
                                                        logCtx);
(-)a/parsing.api/src/org/netbeans/modules/parsing/impl/indexing/SPIAccessor.java (+2 lines)
Lines 91-96 Link Here
91
            boolean followUpJob,
91
            boolean followUpJob,
92
            boolean checkForEditorModifications,
92
            boolean checkForEditorModifications,
93
            boolean sourceForBinaryRoot,
93
            boolean sourceForBinaryRoot,
94
            boolean transientUpdate,
94
            @NonNull final SuspendStatus suspendedStatus,
95
            @NonNull final SuspendStatus suspendedStatus,
95
            @NullAllowed final CancelRequest cancelRequest,
96
            @NullAllowed final CancelRequest cancelRequest,
96
            @NullAllowed final LogContext logContext) throws IOException;
97
            @NullAllowed final LogContext logContext) throws IOException;
Lines 105-110 Link Here
105
            boolean followUpJob,
106
            boolean followUpJob,
106
            boolean checkForEditorModifications,
107
            boolean checkForEditorModifications,
107
            boolean sourceForBinaryRoot,
108
            boolean sourceForBinaryRoot,
109
            boolean transientUpdate,
108
            @NonNull final SuspendStatus suspendedStatus,
110
            @NonNull final SuspendStatus suspendedStatus,
109
            @NullAllowed final CancelRequest cancelRequest,
111
            @NullAllowed final CancelRequest cancelRequest,
110
            @NullAllowed final LogContext logContext) throws IOException;
112
            @NullAllowed final LogContext logContext) throws IOException;
(-)a/parsing.api/src/org/netbeans/modules/parsing/spi/indexing/Context.java (+20 lines)
Lines 79-84 Link Here
79
    private final boolean followUpJob;
79
    private final boolean followUpJob;
80
    private final boolean checkForEditorModifications;
80
    private final boolean checkForEditorModifications;
81
    private final boolean sourceForBinaryRoot;
81
    private final boolean sourceForBinaryRoot;
82
    private final boolean transientUpdate;
82
    private final CancelRequest cancelRequest;
83
    private final CancelRequest cancelRequest;
83
    private final SuspendStatus suspendedStatus;
84
    private final SuspendStatus suspendedStatus;
84
    private final LogContext logContext;
85
    private final LogContext logContext;
Lines 100-105 Link Here
100
             final boolean followUpJob,
101
             final boolean followUpJob,
101
             final boolean checkForEditorModifications,
102
             final boolean checkForEditorModifications,
102
             final boolean sourceForBinaryRoot,
103
             final boolean sourceForBinaryRoot,
104
             final boolean transientUpdate,
103
             @NonNull final SuspendStatus suspendedStatus,
105
             @NonNull final SuspendStatus suspendedStatus,
104
             @NullAllowed final CancelRequest cancelRequest,
106
             @NullAllowed final CancelRequest cancelRequest,
105
             @NullAllowed final LogContext logContext
107
             @NullAllowed final LogContext logContext
Lines 116-121 Link Here
116
        this.followUpJob = followUpJob;
118
        this.followUpJob = followUpJob;
117
        this.checkForEditorModifications = checkForEditorModifications;
119
        this.checkForEditorModifications = checkForEditorModifications;
118
        this.sourceForBinaryRoot = sourceForBinaryRoot;
120
        this.sourceForBinaryRoot = sourceForBinaryRoot;
121
        this.transientUpdate  = transientUpdate;
119
        this.cancelRequest = cancelRequest;
122
        this.cancelRequest = cancelRequest;
120
        this.suspendedStatus = suspendedStatus;
123
        this.suspendedStatus = suspendedStatus;
121
        this.logContext = logContext;
124
        this.logContext = logContext;
Lines 130-135 Link Here
130
             final boolean followUpJob,
133
             final boolean followUpJob,
131
             final boolean checkForEditorModifications,
134
             final boolean checkForEditorModifications,
132
             final boolean sourceForBinaryRoot,
135
             final boolean sourceForBinaryRoot,
136
             final boolean transientUpdate,
133
             @NonNull final SuspendStatus suspendedStatus,
137
             @NonNull final SuspendStatus suspendedStatus,
134
             @NullAllowed final CancelRequest cancelRequest,
138
             @NullAllowed final CancelRequest cancelRequest,
135
             @NullAllowed final LogContext logContext
139
             @NullAllowed final LogContext logContext
Lines 145-150 Link Here
145
        this.followUpJob = followUpJob;
149
        this.followUpJob = followUpJob;
146
        this.checkForEditorModifications = checkForEditorModifications;
150
        this.checkForEditorModifications = checkForEditorModifications;
147
        this.sourceForBinaryRoot = sourceForBinaryRoot;
151
        this.sourceForBinaryRoot = sourceForBinaryRoot;
152
        this.transientUpdate = transientUpdate;
148
        this.cancelRequest = cancelRequest;
153
        this.cancelRequest = cancelRequest;
149
        this.suspendedStatus = suspendedStatus;
154
        this.suspendedStatus = suspendedStatus;
150
        this.logContext = logContext;
155
        this.logContext = logContext;
Lines 284-289 Link Here
284
    }
289
    }
285
290
286
    /**
291
    /**
292
     * Returns true if the indexing is started for modified non saved file
293
     * as a part of an index query.
294
     * The indexers which are using {@link IndexingSupport} for persistence
295
     * do not need this information as the {@link IndexingSupport} handles
296
     * transient changes itself. Indexers which are using custom storage
297
     * should check the transient indexing flag and don't do any persistent
298
     * changes in case of transient indexing.
299
     * @return true in case of transient indexing.
300
     * @since 1.66
301
     */
302
    public boolean isTransientIndexing() {
303
        return transientUpdate;
304
    }
305
306
    /**
287
     * Notifies indexers whether they should use editor documents rather than just
307
     * Notifies indexers whether they should use editor documents rather than just
288
     * files. This is mostly useful for <code>CustomIndexer</code>s that may optimize
308
     * files. This is mostly useful for <code>CustomIndexer</code>s that may optimize
289
     * their work and not try to find editor documents for their <code>Indexable</code>s.
309
     * their work and not try to find editor documents for their <code>Indexable</code>s.
(-)a/parsing.api/src/org/netbeans/modules/parsing/spi/indexing/Indexable.java (-12 / +16 lines)
Lines 165-178 Link Here
165
165
166
        @Override
166
        @Override
167
        public Context createContext(
167
        public Context createContext(
168
                FileObject indexFolder,
168
                @NonNull final FileObject indexFolder,
169
                URL rootURL,
169
                @NonNull final URL rootURL,
170
                String indexerName,
170
                @NonNull final String indexerName,
171
                int indexerVersion,
171
                final int indexerVersion,
172
                IndexFactoryImpl factory,
172
                @NullAllowed IndexFactoryImpl factory,
173
                boolean followUpJob,
173
                final boolean followUpJob,
174
                boolean checkForEditorModifications,
174
                final boolean checkForEditorModifications,
175
                boolean sourceForBinaryRoot,
175
                final boolean sourceForBinaryRoot,
176
                final boolean transientUpdate,
176
                @NonNull SuspendStatus suspendedStatus,
177
                @NonNull SuspendStatus suspendedStatus,
177
                @NullAllowed CancelRequest cancelRequest,
178
                @NullAllowed CancelRequest cancelRequest,
178
                @NullAllowed final LogContext logContext) throws IOException {
179
                @NullAllowed final LogContext logContext) throws IOException {
Lines 185-190 Link Here
185
                    followUpJob,
186
                    followUpJob,
186
                    checkForEditorModifications,
187
                    checkForEditorModifications,
187
                    sourceForBinaryRoot,
188
                    sourceForBinaryRoot,
189
                    transientUpdate,
188
                    suspendedStatus,
190
                    suspendedStatus,
189
                    cancelRequest,
191
                    cancelRequest,
190
                    logContext);
192
                    logContext);
Lines 196-206 Link Here
196
                @NonNull final Callable<FileObject> indexFolderFactory,
198
                @NonNull final Callable<FileObject> indexFolderFactory,
197
                @NonNull final URL rootURL,
199
                @NonNull final URL rootURL,
198
                @NonNull final String indexerName,
200
                @NonNull final String indexerName,
199
                int indexerVersion,
201
                final int indexerVersion,
200
                @NullAllowed final IndexFactoryImpl factory,
202
                @NullAllowed final IndexFactoryImpl factory,
201
                boolean followUpJob,
203
                final boolean followUpJob,
202
                boolean checkForEditorModifications,
204
                final boolean checkForEditorModifications,
203
                boolean sourceForBinaryRoot,
205
                final boolean sourceForBinaryRoot,
206
                final boolean transientUpdate,
204
                @NonNull final SuspendStatus suspendedStatus,
207
                @NonNull final SuspendStatus suspendedStatus,
205
                @NullAllowed final CancelRequest cancelRequest,
208
                @NullAllowed final CancelRequest cancelRequest,
206
                @NullAllowed final LogContext logContext) throws IOException {
209
                @NullAllowed final LogContext logContext) throws IOException {
Lines 213-218 Link Here
213
                followUpJob,
216
                followUpJob,
214
                checkForEditorModifications,
217
                checkForEditorModifications,
215
                sourceForBinaryRoot,
218
                sourceForBinaryRoot,
219
                transientUpdate,
216
                suspendedStatus,
220
                suspendedStatus,
217
                cancelRequest,
221
                cancelRequest,
218
                logContext);
222
                logContext);
(-)a/parsing.api/test/unit/src/org/netbeans/modules/parsing/spi/indexing/support/IndexingSupportTest.java (+4 lines)
Lines 114-119 Link Here
114
                false,
114
                false,
115
                false,
115
                false,
116
                false,
116
                false,
117
                false,
117
                SuspendSupport.NOP,
118
                SuspendSupport.NOP,
118
                null,
119
                null,
119
                null);
120
                null);
Lines 127-132 Link Here
127
                false,
128
                false,
128
                false,
129
                false,
129
                false,
130
                false,
131
                false,
130
                SuspendSupport.NOP,
132
                SuspendSupport.NOP,
131
                null,
133
                null,
132
                null);
134
                null);
Lines 152-157 Link Here
152
                false,
154
                false,
153
                false,
155
                false,
154
                false,
156
                false,
157
                false,
155
                SuspendSupport.NOP,
158
                SuspendSupport.NOP,
156
                null,
159
                null,
157
                null);
160
                null);
Lines 235-240 Link Here
235
                false,
238
                false,
236
                false,
239
                false,
237
                false,
240
                false,
241
                false,
238
                SuspendSupport.NOP,
242
                SuspendSupport.NOP,
239
                null,
243
                null,
240
                null);
244
                null);

Return to bug 228041