List of usage examples for org.eclipse.jdt.core.search SearchEngine createTypeNameMatch
public static TypeNameMatch createTypeNameMatch(IType type, int modifiers)
From source file:org.eclipse.ajdt.internal.corext.util.OpenTypeHistory.java
License:Open Source License
private synchronized void internalCheckConsistency(IProgressMonitor monitor) throws OperationCanceledException { // Setting fNeedsConsistencyCheck is necessary here since // markAsInconsistent isn't synchronized. fNeedsConsistencyCheck = true;//from w ww .ja va2 s . com List typesToCheck = new ArrayList(getKeys()); monitor.beginTask(CorextMessages.TypeInfoHistory_consistency_check, typesToCheck.size()); monitor.setTaskName(CorextMessages.TypeInfoHistory_consistency_check); for (Iterator iter = typesToCheck.iterator(); iter.hasNext();) { TypeNameMatch type = (TypeNameMatch) iter.next(); long currentTimestamp = getContainerTimestamp(type); Long lastTested = (Long) fTimestampMapping.get(type); if (lastTested != null && currentTimestamp != IResource.NULL_STAMP && currentTimestamp == lastTested.longValue() && !isContainerDirty(type)) continue; try { IType jType = type.getType(); if (jType == null || !jType.exists()) { remove(type); } else { // copy over the modifiers since they may have changed int modifiers = jType.getFlags(); if (modifiers != type.getModifiers()) { replace(type, SearchEngine.createTypeNameMatch(jType, modifiers)); } else { fTimestampMapping.put(type, new Long(currentTimestamp)); } } } catch (JavaModelException e) { remove(type); } if (monitor.isCanceled()) throw new OperationCanceledException(); monitor.worked(1); } monitor.done(); fNeedsConsistencyCheck = false; }
From source file:org.eclipse.ajdt.internal.corext.util.OpenTypeHistory.java
License:Open Source License
protected Object createFromElement(Element type) { String handle = type.getAttribute(NODE_HANDLE); if (handle == null) return null; IJavaElement element = JavaCore.create(handle); if (!(element instanceof IType)) return null; int modifiers = 0; try {/*from ww w. j a v a 2s . com*/ modifiers = Integer.parseInt(type.getAttribute(NODE_MODIFIERS)); } catch (NumberFormatException e) { // take zero } TypeNameMatch info = SearchEngine.createTypeNameMatch((IType) element, modifiers); long timestamp = IResource.NULL_STAMP; String timestampValue = type.getAttribute(NODE_TIMESTAMP); if (timestampValue != null && timestampValue.length() > 0) { try { timestamp = Long.parseLong(timestampValue); } catch (NumberFormatException e) { // take null stamp } } if (timestamp != IResource.NULL_STAMP) { fTimestampMapping.put(info, new Long(timestamp)); } return info; }