Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 339711
Collapse All | Expand All

(-)src/org/eclipse/wst/sse/core/indexing/AbstractIndexManager.java (-50 / +57 lines)
Lines 221-282 Link Here
221
		synchronized (this.fStartStopLock) {
221
		synchronized (this.fStartStopLock) {
222
			this.fStarting = true;
222
			this.fStarting = true;
223
			
223
			
224
			if(this.fState == STATE_DISABLED) {
224
			try {
225
				//report status
225
				if(this.fState == STATE_DISABLED) {
226
				progress.beginTask(this.fName, 2);
226
					//report status
227
				
227
					progress.beginTask(this.fName, 2);
228
				//start listening for resource change events
228
					
229
				this.fResourceChangeListener.start();
229
					//start listening for resource change events
230
				
230
					this.fResourceChangeListener.start();
231
				//check to see if a full re-index is required
231
					
232
				boolean forcedFullReIndexNeeded = this.isForcedFullReIndexNeeded();
232
					//check to see if a full re-index is required
233
				
233
					boolean forcedFullReIndexNeeded = this.isForcedFullReIndexNeeded();
234
				/* start the indexing job only loading preserved state if not doing full index
234
					
235
				 * if failed loading preserved state then force full re-index
235
					/* start the indexing job only loading preserved state if not doing full index
236
				 */
236
					 * if failed loading preserved state then force full re-index
237
				forcedFullReIndexNeeded = !this.fResourceEventProcessingJob.start(!forcedFullReIndexNeeded,
238
						progress.newChild(1));
239
				progress.setWorkRemaining(1);
240
				
241
				//don't bother processing saved delta if forced full re-index is needed
242
				if(!forcedFullReIndexNeeded) {
243
					/* if there is a delta attempt to process it
244
					 * else need to do a full workspace index
245
					 */
237
					 */
246
					if(savedStateDelta != null) {
238
					forcedFullReIndexNeeded = !this.fResourceEventProcessingJob.start(!forcedFullReIndexNeeded,
247
						forcedFullReIndexNeeded = false;
239
							progress.newChild(1));
248
						try {
240
					progress.setWorkRemaining(1);
249
							//deal with reporting progress
241
					
250
							SubMonitor savedStateProgress = progress.newChild(1, SubMonitor.SUPPRESS_NONE);
242
					//don't bother processing saved delta if forced full re-index is needed
251
							
243
					if(!forcedFullReIndexNeeded) {
252
							//process delta
244
						/* if there is a delta attempt to process it
253
							ResourceDeltaVisitor visitor = new ResourceDeltaVisitor(savedStateProgress,
245
						 * else need to do a full workspace index
254
									AbstractIndexManager.SOURCE_SAVED_STATE);
246
						 */
255
							savedStateDelta.accept(visitor);
247
						if(savedStateDelta != null) {
256
							
248
							forcedFullReIndexNeeded = false;
257
							//process any remaining batched up resources to index
249
							try {
258
							visitor.processBatchedResourceEvents();
250
								//deal with reporting progress
259
						} catch (CoreException e) {
251
								SubMonitor savedStateProgress = progress.newChild(1, SubMonitor.SUPPRESS_NONE);
252
								
253
								//process delta
254
								ResourceDeltaVisitor visitor = new ResourceDeltaVisitor(savedStateProgress,
255
										AbstractIndexManager.SOURCE_SAVED_STATE);
256
								savedStateDelta.accept(visitor);
257
								
258
								//process any remaining batched up resources to index
259
								visitor.processBatchedResourceEvents();
260
							} catch (CoreException e) {
261
								forcedFullReIndexNeeded = true;
262
								Logger.logException(this.fName + ": Could not process saved state. " + //$NON-NLS-1$
263
										"Forced to do a full workspace re-index.", e); //$NON-NLS-1$
264
							}
265
						} else {
260
							forcedFullReIndexNeeded = true;
266
							forcedFullReIndexNeeded = true;
261
							Logger.logException(this.fName + ": Could not process saved state. " + //$NON-NLS-1$
262
									"Forced to do a full workspace re-index.", e); //$NON-NLS-1$
263
						}
267
						}
264
					} else {
265
						forcedFullReIndexNeeded = true;
266
					}
268
					}
269
					progress.worked(1);
270
					
271
					//if need to process the entire workspace do so in another job
272
					if(forcedFullReIndexNeeded){
273
						this.fWorkspaceVisitorJob = new WorkspaceVisitorJob();
274
						this.fWorkspaceVisitorJob.schedule();
275
					}
276
					
277
					//update state
278
					this.fState = STATE_ENABLED;
267
				}
279
				}
268
				progress.worked(1);
280
			} finally {
269
				
281
				progress.done();
270
				//if need to process the entire workspace do so in another job
282
				this.fStarting = false;
271
				if(forcedFullReIndexNeeded){
272
					this.fWorkspaceVisitorJob = new WorkspaceVisitorJob();
273
					this.fWorkspaceVisitorJob.schedule();
274
				}
275
				
276
				//update state
277
				this.fState = STATE_ENABLED;
278
			}
283
			}
279
			this.fStarting = false;
280
		}
284
		}
281
	}
285
	}
282
	
286
	
Lines 447-452 Link Here
447
			Thread.currentThread().interrupt();
451
			Thread.currentThread().interrupt();
448
		}
452
		}
449
		
453
		
454
		progress.done();
450
		return success;
455
		return success;
451
	}
456
	}
452
	
457
	
Lines 585-590 Link Here
585
				status = Status.OK_STATUS;
590
				status = Status.OK_STATUS;
586
			}
591
			}
587
			
592
			
593
			monitor.done();
588
			return status;
594
			return status;
589
		}
595
		}
590
		
596
		
Lines 1608-1613 Link Here
1608
				}
1614
				}
1609
			}
1615
			}
1610
			
1616
			
1617
			progress.done();
1611
			return success;
1618
			return success;
1612
		}
1619
		}
1613
		
1620
		

Return to bug 339711