1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-09 10:46:02 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2013-11-18 17:49:54 -08:00
parent dfd0794ed6
commit 6aa836780c
8 changed files with 58 additions and 161 deletions

View file

@ -87,8 +87,8 @@ public class CModel extends Openable implements ICModel {
} }
/** /**
* Finds the given project in the list of the java model's children. * Finds the given project in the list of the C model's children.
* Returns null if not found. * Returns {@code null} if not found.
*/ */
public ICProject findCProject(IProject project) { public ICProject findCProject(IProject project) {
try { try {
@ -112,7 +112,7 @@ public class CModel extends Openable implements ICModel {
@Override @Override
public void copy(ICElement[] elements, ICElement[] containers, ICElement[] siblings, public void copy(ICElement[] elements, ICElement[] containers, ICElement[] siblings,
String[] renamings, boolean replace, IProgressMonitor monitor) throws CModelException { String[] renamings, boolean replace, IProgressMonitor monitor) throws CModelException {
if (elements != null && elements[0] != null && elements[0].getElementType() <= ICElement.C_UNIT ) { if (elements != null && elements[0] != null && elements[0].getElementType() <= ICElement.C_UNIT) {
runOperation(new CopyResourceElementsOperation(elements, containers, replace), elements, runOperation(new CopyResourceElementsOperation(elements, containers, replace), elements,
siblings, renamings, monitor); siblings, renamings, monitor);
} else { } else {
@ -184,8 +184,7 @@ public class CModel extends Openable implements ICModel {
/** /**
* Workaround for bug 15168 circular errors not reported * Workaround for bug 15168 circular errors not reported
* Returns the list of java projects before resource delta processing * Returns the list of C projects before resource delta processing has started.
* has started.
*/ */
public ICProject[] getOldCProjectsList() throws CModelException { public ICProject[] getOldCProjectsList() throws CModelException {
CModelManager manager = CModelManager.getDefault(); CModelManager manager = CModelManager.getDefault();
@ -194,9 +193,6 @@ public class CModel extends Openable implements ICModel {
manager.cProjectsCache; manager.cProjectsCache;
} }
/* (non-Javadoc)
* @see Openable#buildStructure(OpenableInfo, IProgressMonitor, Map, IResource)
*/
@Override @Override
protected boolean buildStructure(OpenableInfo info, IProgressMonitor pm, Map<ICElement, protected boolean buildStructure(OpenableInfo info, IProgressMonitor pm, Map<ICElement,
CElementInfo> newElements, IResource underlyingResource) throws CModelException { CElementInfo> newElements, IResource underlyingResource) throws CModelException {
@ -214,9 +210,6 @@ public class CModel extends Openable implements ICModel {
return validInfo; return validInfo;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.core.model.ICModel#getNonCResources()
*/
@Override @Override
public Object[] getNonCResources() throws CModelException { public Object[] getNonCResources() throws CModelException {
return ((CModelInfo) getElementInfo()).getNonCResources(); return ((CModelInfo) getElementInfo()).getNonCResources();

View file

@ -166,10 +166,11 @@ public class CModelManager implements IResourceChangeListener, IContentTypeChang
/** /**
* Map of the binary parser for each project. * Map of the binary parser for each project.
*/ */
private final Map<IProject, BinaryParserConfig[]> binaryParsersMap = Collections.synchronizedMap(new HashMap<IProject, BinaryParserConfig[]>()); private final Map<IProject, BinaryParserConfig[]> binaryParsersMap =
Collections.synchronizedMap(new HashMap<IProject, BinaryParserConfig[]>());
/** /**
* The lis of the SourceMappers on projects. * The list of the SourceMappers on projects.
*/ */
private HashMap<ICProject, SourceMapper> sourceMappers = new HashMap<ICProject, SourceMapper>(); private HashMap<ICProject, SourceMapper> sourceMappers = new HashMap<ICProject, SourceMapper>();
@ -626,8 +627,8 @@ public class CModelManager implements IResourceChangeListener, IContentTypeChang
if (parsers == null) { if (parsers == null) {
try { try {
BinaryParserConfig config = new BinaryParserConfig(CCorePlugin.getDefault().getDefaultBinaryParser(), CCorePlugin.DEFAULT_BINARY_PARSER_UNIQ_ID); BinaryParserConfig config = new BinaryParserConfig(CCorePlugin.getDefault().getDefaultBinaryParser(), CCorePlugin.DEFAULT_BINARY_PARSER_UNIQ_ID);
parsers = new BinaryParserConfig[]{config}; parsers = new BinaryParserConfig[] { config };
} catch (CoreException e1) { } catch (CoreException e) {
} }
} }
} }
@ -785,15 +786,16 @@ public class CModelManager implements IResourceChangeListener, IContentTypeChang
runner = binaryRunners.get(project); runner = binaryRunners.get(project);
} }
if (runner == null) { if (runner == null) {
// Creation of BinaryRunner must occur outside the synchronized block // Creation of BinaryRunner must occur outside the synchronized block.
runner = new BinaryRunner(project); runner = new BinaryRunner(project);
synchronized (binaryRunners) { synchronized (binaryRunners) {
if (binaryRunners.get(project) == null) { BinaryRunner existing = binaryRunners.get(project);
if (existing == null) {
binaryRunners.put(project, runner); binaryRunners.put(project, runner);
runner.start(); runner.start();
} else { } else {
// Another thread was faster // Another thread was faster.
runner = binaryRunners.get(project); runner = existing;
} }
} }
} }
@ -1001,14 +1003,16 @@ public class CModelManager implements IResourceChangeListener, IContentTypeChang
// If inside CProjectDescriptionManager.setProjectDescription() just send notifications // If inside CProjectDescriptionManager.setProjectDescription() just send notifications
fire(delta, ElementChangedEvent.POST_CHANGE); fire(delta, ElementChangedEvent.POST_CHANGE);
} else { } else {
// If not inside CProjectDescriptionManager.setProjectDescription() recalculate cached settings // If not inside CProjectDescriptionManager.setProjectDescription() recalculate cached
// settings
try { try {
CoreModel.getDefault().updateProjectDescriptions(new IProject[] {project}, null); CoreModel.getDefault().updateProjectDescriptions(new IProject[] {project}, null);
} catch (CoreException e) { } catch (CoreException e) {
CCorePlugin.log(e); CCorePlugin.log(e);
} }
// Fire notifications in a job with workspace rule to ensure running after the updateProjectDescriptions(...) // Fire notifications in a job with workspace rule to ensure running after
// which is run in separate thread with workspace rule // the updateProjectDescriptions(...), which is run in separate thread with workspace
// rule.
ISchedulingRule rule = ResourcesPlugin.getWorkspace().getRoot(); ISchedulingRule rule = ResourcesPlugin.getWorkspace().getRoot();
Job job = new Job(CoreModelMessages.getFormattedString("CModelManager.LanguageSettingsChangeEventNotifications")) { //$NON-NLS-1$ Job job = new Job(CoreModelMessages.getFormattedString("CModelManager.LanguageSettingsChangeEventNotifications")) { //$NON-NLS-1$
@Override @Override
@ -1148,7 +1152,8 @@ public class CModelManager implements IResourceChangeListener, IContentTypeChang
System.out.print("Listener #" + (i + 1) + "=" + listener.toString());//$NON-NLS-1$//$NON-NLS-2$ System.out.print("Listener #" + (i + 1) + "=" + listener.toString());//$NON-NLS-1$//$NON-NLS-2$
start = System.currentTimeMillis(); start = System.currentTimeMillis();
} }
// Wrap callbacks with Safe runnable for subsequent listeners to be called when some are causing grief // Wrap callbacks with Safe runnable for subsequent listeners to be called when some
// are causing grief.
SafeRunner.run(new ISafeRunnable() { SafeRunner.run(new ISafeRunnable() {
@Override @Override
public void handleException(Throwable exception) { public void handleException(Throwable exception) {
@ -1284,9 +1289,9 @@ public class CModelManager implements IResourceChangeListener, IContentTypeChang
// remove children // remove children
Object existingInfo = this.cache.peekAtInfo(openedElement); Object existingInfo = this.cache.peekAtInfo(openedElement);
if (openedElement instanceof IParent && existingInfo instanceof CElementInfo) { if (openedElement instanceof IParent && existingInfo instanceof CElementInfo) {
ICElement[] children = ((CElementInfo)existingInfo).getChildren(); ICElement[] children = ((CElementInfo) existingInfo).getChildren();
for (int i = 0, size = children.length; i < size; ++i) { for (int i = 0, size = children.length; i < size; ++i) {
CElement child = (CElement)children[i]; CElement child = (CElement) children[i];
try { try {
child.close(); child.close();
} catch (CModelException e) { } catch (CModelException e) {
@ -1303,7 +1308,7 @@ public class CModelManager implements IResourceChangeListener, IContentTypeChang
this.cache.removeInfo(element); this.cache.removeInfo(element);
} }
/* /**
* Returns the temporary cache for newly opened elements for the current thread. * Returns the temporary cache for newly opened elements for the current thread.
* Creates it if not already created. * Creates it if not already created.
*/ */
@ -1316,14 +1321,14 @@ public class CModelManager implements IResourceChangeListener, IContentTypeChang
return result; return result;
} }
/* /**
* Returns whether there is a temporary cache for the current thread. * Returns whether there is a temporary cache for the current thread.
*/ */
public boolean hasTemporaryCache() { public boolean hasTemporaryCache() {
return this.temporaryCache.get() != null; return this.temporaryCache.get() != null;
} }
/* /**
* Resets the temporary cache for newly created elements to null. * Resets the temporary cache for newly created elements to null.
*/ */
public void resetTemporaryCache() { public void resetTemporaryCache() {

View file

@ -11,7 +11,6 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.model; package org.eclipse.cdt.internal.core.model;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
@ -138,7 +137,6 @@ public class CProject extends Openable implements ICProject {
*/ */
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)
return true; return true;
@ -255,7 +253,6 @@ public class CProject extends Openable implements ICProject {
return PathEntryManager.getDefault().projectPrerequisites(entries); return PathEntryManager.getDefault().projectPrerequisites(entries);
} }
/** /**
* @see org.eclipse.cdt.core.model.ICProject#getOption(String, boolean) * @see org.eclipse.cdt.core.model.ICProject#getOption(String, boolean)
*/ */
@ -302,9 +299,6 @@ public class CProject extends Openable implements ICProject {
return options; return options;
} }
/**
* @see org.eclipse.cdt.core.model.ICProject#setOption(java.lang.String, java.lang.String)
*/
@Override @Override
public void setOption(String optionName, String optionValue) { public void setOption(String optionName, String optionValue) {
if (!CModelManager.OptionNames.contains(optionName)) if (!CModelManager.OptionNames.contains(optionName))
@ -326,9 +320,6 @@ public class CProject extends Openable implements ICProject {
} }
} }
/**
* @see org.eclipse.cdt.core.model.ICProject#setOptions(Map)
*/
@Override @Override
public void setOptions(Map<String, String> newOptions) { public void setOptions(Map<String, String> newOptions) {
Preferences preferences = new Preferences(); Preferences preferences = new Preferences();
@ -395,8 +386,8 @@ public class CProject extends Openable implements ICProject {
} }
} }
/* /**
* Set cached preferences, no preferences are saved, only info is updated * Sets cached preferences, no preferences are saved, only info is updated
*/ */
private void setPreferences(Preferences preferences) { private void setPreferences(Preferences preferences) {
if (!isCProject()) { if (!isCProject()) {
@ -405,33 +396,21 @@ public class CProject extends Openable implements ICProject {
// Do nothing // Do nothing
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.core.model.ICProject#getResolvedCPathEntries()
*/
@Override @Override
public IPathEntry[] getResolvedPathEntries() throws CModelException { public IPathEntry[] getResolvedPathEntries() throws CModelException {
return CoreModel.getResolvedPathEntries(this); return CoreModel.getResolvedPathEntries(this);
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.core.model.ICProject#getRawCPathEntries()
*/
@Override @Override
public IPathEntry[] getRawPathEntries() throws CModelException { public IPathEntry[] getRawPathEntries() throws CModelException {
return CoreModel.getRawPathEntries(this); return CoreModel.getRawPathEntries(this);
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.core.model.ICProject#setRawCPathEntries(org.eclipse.cdt.core.model.IPathEntry[], org.eclipse.core.runtime.IProgressMonitor)
*/
@Override @Override
public void setRawPathEntries(IPathEntry[] newEntries, IProgressMonitor monitor) throws CModelException { public void setRawPathEntries(IPathEntry[] newEntries, IProgressMonitor monitor) throws CModelException {
CoreModel.setRawPathEntries(this, newEntries, monitor); CoreModel.setRawPathEntries(this, newEntries, monitor);
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.core.model.ICProject#getSourceRoot(org.eclipse.cdt.core.model.ISourceEntry)
*/
@Override @Override
public ISourceRoot getSourceRoot(ISourceEntry entry) throws CModelException { public ISourceRoot getSourceRoot(ISourceEntry entry) throws CModelException {
return getSourceRoot(new CSourceEntry(entry.getPath(), entry.getExclusionPatterns(), 0)); return getSourceRoot(new CSourceEntry(entry.getPath(), entry.getExclusionPatterns(), 0));
@ -456,9 +435,6 @@ public class CProject extends Openable implements ICProject {
return null; return null;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.core.model.ICProject#findSourceRoot()
*/
@Override @Override
public ISourceRoot findSourceRoot(IResource res) { public ISourceRoot findSourceRoot(IResource res) {
try { try {
@ -473,9 +449,6 @@ public class CProject extends Openable implements ICProject {
return null; return null;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.core.model.ICProject#findSourceRoot()
*/
@Override @Override
public ISourceRoot findSourceRoot(IPath path) { public ISourceRoot findSourceRoot(IPath path) {
try { try {
@ -490,9 +463,6 @@ public class CProject extends Openable implements ICProject {
return null; return null;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.core.model.ICProject#getSourceRoots()
*/
@Override @Override
public ISourceRoot[] getSourceRoots() throws CModelException { public ISourceRoot[] getSourceRoots() throws CModelException {
Object[] children = getChildren(); Object[] children = getChildren();
@ -506,7 +476,7 @@ public class CProject extends Openable implements ICProject {
} }
/** /**
* Get all source roots. * Returns all source roots.
* *
* @return all source roots * @return all source roots
* @throws CModelException * @throws CModelException
@ -547,9 +517,6 @@ public class CProject extends Openable implements ICProject {
return outs; return outs;
} }
/**
*
*/
public IOutputEntry[] getOutputEntries(IPathEntry[] entries) throws CModelException { public IOutputEntry[] getOutputEntries(IPathEntry[] entries) throws CModelException {
ArrayList<IPathEntry> list = new ArrayList<IPathEntry>(entries.length); ArrayList<IPathEntry> list = new ArrayList<IPathEntry>(entries.length);
for (IPathEntry entrie : entries) { for (IPathEntry entrie : entries) {
@ -562,9 +529,6 @@ public class CProject extends Openable implements ICProject {
return outputs; return outputs;
} }
/**
*
*/
@Override @Override
public boolean isOnOutputEntry(IResource resource) { public boolean isOnOutputEntry(IResource resource) {
IPath path = resource.getFullPath(); IPath path = resource.getFullPath();
@ -595,9 +559,6 @@ public class CProject extends Openable implements ICProject {
return false; return false;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.model.Openable#buildStructure(org.eclipse.cdt.internal.core.model.OpenableInfo, org.eclipse.core.runtime.IProgressMonitor, java.util.Map, org.eclipse.core.resources.IResource)
*/
@Override @Override
protected boolean buildStructure(OpenableInfo info, IProgressMonitor pm, protected boolean buildStructure(OpenableInfo info, IProgressMonitor pm,
Map<ICElement, CElementInfo> newElements, IResource underlyingResource) Map<ICElement, CElementInfo> newElements, IResource underlyingResource)
@ -647,11 +608,12 @@ public class CProject extends Openable implements ICProject {
children.addAll(sourceRoots); children.addAll(sourceRoots);
boolean projectIsSourceRoot = false; boolean projectIsSourceRoot = false;
for (ISourceRoot sourceRoot : sourceRoots) for (ISourceRoot sourceRoot : sourceRoots) {
if (sourceRoot.getResource().equals(getProject())) { if (sourceRoot.getResource().equals(getProject())) {
projectIsSourceRoot = true; projectIsSourceRoot = true;
break; break;
} }
}
// Now look for output folders // Now look for output folders
try { try {
@ -686,9 +648,6 @@ public class CProject extends Openable implements ICProject {
return true; return true;
} }
/*
* @see ICProject
*/
@Override @Override
public boolean isOnSourceRoot(ICElement element) { public boolean isOnSourceRoot(ICElement element) {
try { try {
@ -704,9 +663,6 @@ public class CProject extends Openable implements ICProject {
return false; return false;
} }
/*
* @see ICProject
*/
@Override @Override
public boolean isOnSourceRoot(IResource resource) { public boolean isOnSourceRoot(IResource resource) {
try { try {
@ -722,9 +678,6 @@ public class CProject extends Openable implements ICProject {
return false; return false;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.core.model.ICElement#exists()
*/
@Override @Override
public boolean exists() { public boolean exists() {
if (!isCProject()) { if (!isCProject()) {
@ -733,17 +686,11 @@ public class CProject extends Openable implements ICProject {
return true; return true;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.core.model.ICProject#getNonCResources()
*/
@Override @Override
public Object[] getNonCResources() throws CModelException { public Object[] getNonCResources() throws CModelException {
return ((CProjectInfo) getElementInfo()).getNonCResources(getResource()); return ((CProjectInfo) getElementInfo()).getNonCResources(getResource());
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.model.CElement#closing(java.lang.Object)
*/
@Override @Override
protected void closing(Object info) throws CModelException { protected void closing(Object info) throws CModelException {
if (info instanceof CProjectInfo) { if (info instanceof CProjectInfo) {
@ -760,7 +707,7 @@ public class CProject extends Openable implements ICProject {
super.closing(info); super.closing(info);
} }
/* /**
* Resets this project's caches * Resets this project's caches
*/ */
public void resetCaches() { public void resetCaches() {
@ -808,7 +755,7 @@ public class CProject extends Openable implements ICProject {
if (project != null) { if (project != null) {
IResource resource= project.findMember(path); IResource resource= project.findMember(path);
if (resource != null && resource.getType() == IResource.FILE) { if (resource != null && resource.getType() == IResource.FILE) {
final IFile file= (IFile)resource; final IFile file= (IFile) resource;
tu= (CElement) CModelManager.getDefault().create(file, this); tu= (CElement) CModelManager.getDefault().create(file, this);
if (tu == null) { if (tu == null) {
String contentTypeId= CoreModel.getRegistedContentTypeId(project, file.getName()); String contentTypeId= CoreModel.getRegistedContentTypeId(project, file.getName());
@ -833,5 +780,4 @@ public class CProject extends Openable implements ICProject {
protected char getHandleMementoDelimiter() { protected char getHandleMementoDelimiter() {
return CEM_CPROJECT; return CEM_CPROJECT;
} }
} }

View file

@ -9,7 +9,6 @@
* QNX Software Systems - Initial API and implementation * QNX Software Systems - Initial API and implementation
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.model; package org.eclipse.cdt.internal.core.model;
import java.util.ArrayList; import java.util.ArrayList;
@ -36,11 +35,11 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.content.IContentType; import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.core.runtime.content.IContentTypeManager.ContentTypeChangeEvent; import org.eclipse.core.runtime.content.IContentTypeManager.ContentTypeChangeEvent;
import org.eclipse.core.runtime.preferences.IScopeContext; import org.eclipse.core.runtime.preferences.IScopeContext;
/** /**
* ContentType processor * ContentType processor
*/ */
public class ContentTypeProcessor extends CModelOperation { public class ContentTypeProcessor extends CModelOperation {
CModelManager fManager; CModelManager fManager;
CElementDelta fCurrentDelta; CElementDelta fCurrentDelta;
ContentTypeChangeEvent[] fEvents; ContentTypeChangeEvent[] fEvents;
@ -53,9 +52,6 @@ public class ContentTypeProcessor extends CModelOperation {
fCurrentDelta = new CElementDelta(root); fCurrentDelta = new CElementDelta(root);
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.model.CModelOperation#isReadOnly()
*/
@Override @Override
public boolean isReadOnly() { public boolean isReadOnly() {
return true; return true;
@ -77,8 +73,6 @@ public class ContentTypeProcessor extends CModelOperation {
} }
} }
static public void processContentTypeChanges(ContentTypeChangeEvent[] events) { static public void processContentTypeChanges(ContentTypeChangeEvent[] events) {
try { try {
CModelOperation op = new ContentTypeProcessor(events); CModelOperation op = new ContentTypeProcessor(events);
@ -214,7 +208,6 @@ public class ContentTypeProcessor extends CModelOperation {
} }
} }
/** /**
* Add the resource delta to the right CElementDelta tree. * Add the resource delta to the right CElementDelta tree.
* @param parent * @param parent
@ -252,7 +245,6 @@ public class ContentTypeProcessor extends CModelOperation {
} }
private void elementAdded(ICElement celement, ICElement parent) throws CModelException { private void elementAdded(ICElement celement, ICElement parent) throws CModelException {
if (celement instanceof Openable) { if (celement instanceof Openable) {
addToParentInfo((Openable)celement); addToParentInfo((Openable)celement);
} }
@ -296,13 +288,13 @@ public class ContentTypeProcessor extends CModelOperation {
} }
fCurrentDelta.changed(element, ICElementDelta.F_CONTENT |ICElementDelta.F_CONTENT_TYPE); fCurrentDelta.changed(element, ICElementDelta.F_CONTENT |ICElementDelta.F_CONTENT_TYPE);
} }
/** /**
* Removes the given element from its parents cache of children. If the * Removes the given element from its parents cache of children. If the
* element does not have a parent, or the parent is not currently open, * element does not have a parent, or the parent is not currently open,
* this has no effect. * this has no effect.
*/ */
private void removeFromParentInfo(ICElement child) throws CModelException { private void removeFromParentInfo(ICElement child) throws CModelException {
// Remove the child from the parent list. // Remove the child from the parent list.
ICElement parent = child.getParent(); ICElement parent = child.getParent();
if (parent != null && parent instanceof Parent && fManager.peekAtInfo(parent) != null) { if (parent != null && parent instanceof Parent && fManager.peekAtInfo(parent) != null) {
@ -338,5 +330,4 @@ public class ContentTypeProcessor extends CModelOperation {
} }
return new ICProject[0]; return new ICProject[0];
} }
} }

View file

@ -37,17 +37,18 @@ public final class FileExistsCache {
private static class Content { private static class Content {
public Content(String[] names) { public Content(String[] names) {
fNames= names; fNames= names;
fIsFile= new BitSet(names.length*2); fIsFile= new BitSet(names.length * 2);
} }
public String[] fNames; public String[] fNames;
public BitSet fIsFile; public BitSet fIsFile;
} }
private Reference<Map<String,Content>> fCache= null;
private Reference<Map<String, Content>> fCache;
private final boolean fCaseInSensitive; private final boolean fCaseInSensitive;
public FileExistsCache(boolean caseInsensitive) { public FileExistsCache(boolean caseInsensitive) {
fCaseInSensitive= caseInsensitive; fCaseInSensitive= caseInsensitive;
fCache= new SoftReference<Map<String,Content>>(new HashMap<String, Content>()); // before running out of memory the entire map will be thrown away. fCache= new SoftReference<Map<String, Content>>(new HashMap<String, Content>()); // before running out of memory the entire map will be thrown away.
} }
public boolean isFile(String path) { public boolean isFile(String path) {
@ -92,14 +93,13 @@ public final class FileExistsCache {
if (avail == null) { if (avail == null) {
String[] files = null; String[] files = null;
try { try {
files = (parentStore == null) ? new File(parent).list() : parentStore.childNames(EFS.NONE, null); files = parentStore == null ? new File(parent).list() : parentStore.childNames(EFS.NONE, null);
} catch (CoreException e) { } catch (CoreException e) {
// Ignore // Ignore
} }
if (files == null || files.length == 0) { if (files == null || files.length == 0) {
avail= EMPTY_STRING_ARRAY; avail= EMPTY_STRING_ARRAY;
} } else {
else {
if (fCaseInSensitive) { if (fCaseInSensitive) {
for (int i = 0; i < files.length; i++) { for (int i = 0; i < files.length; i++) {
files[i]= files[i].toUpperCase(); files[i]= files[i].toUpperCase();
@ -118,14 +118,14 @@ public final class FileExistsCache {
final BitSet isFileBitset = avail.fIsFile; final BitSet isFileBitset = avail.fIsFile;
if (isFileBitset.get(idx)) if (isFileBitset.get(idx))
return true; return true;
if (isFileBitset.get(idx+1)) if (isFileBitset.get(idx + 1))
return false; return false;
if ((file != null && file.isFile()) || (fileStore != null && !fileStore.fetchInfo().isDirectory())) { if ((file != null && file.isFile()) || (fileStore != null && !fileStore.fetchInfo().isDirectory())) {
isFileBitset.set(idx); isFileBitset.set(idx);
return true; return true;
} }
isFileBitset.set(idx+1); isFileBitset.set(idx + 1);
return false; return false;
} }

View file

@ -1147,7 +1147,6 @@ public class CCorePlugin extends Plugin {
private static final String PARSER_EXCEPTIONS = CCorePlugin.PLUGIN_ID + "/debug/parser/exceptions" ; //$NON-NLS-1$ private static final String PARSER_EXCEPTIONS = CCorePlugin.PLUGIN_ID + "/debug/parser/exceptions" ; //$NON-NLS-1$
private static final String SCANNER = CCorePlugin.PLUGIN_ID + "/debug/scanner"; //$NON-NLS-1$ private static final String SCANNER = CCorePlugin.PLUGIN_ID + "/debug/scanner"; //$NON-NLS-1$
private static final String DELTA = CCorePlugin.PLUGIN_ID + "/debug/deltaprocessor" ; //$NON-NLS-1$ private static final String DELTA = CCorePlugin.PLUGIN_ID + "/debug/deltaprocessor" ; //$NON-NLS-1$
//private static final String CONTENTASSIST = CCorePlugin.PLUGIN_ID + "/debug/contentassist" ; //$NON-NLS-1$
/** /**
* Configure the plug-in with respect to option settings defined in ".options" file * Configure the plug-in with respect to option settings defined in ".options" file

View file

@ -86,18 +86,16 @@ public class ContentAssistProcessor implements IContentAssistProcessor {
private static final boolean DEBUG= "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.cdt.ui/debug/ResultCollector")); //$NON-NLS-1$//$NON-NLS-2$ private static final boolean DEBUG= "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.cdt.ui/debug/ResultCollector")); //$NON-NLS-1$//$NON-NLS-2$
/** /**
* Dialog settings key for the "all categories are disabled" warning dialog. See * Dialog settings key for the "all categories are disabled" warning dialog.
* {@link OptionalMessageDialog}. * See {@link OptionalMessageDialog}.
*/ */
private static final String PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY= "EmptyDefaultAssistCategory"; //$NON-NLS-1$ private static final String PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY= "EmptyDefaultAssistCategory"; //$NON-NLS-1$
private static final Comparator<CompletionProposalCategory> ORDER_COMPARATOR= new Comparator<CompletionProposalCategory>() { private static final Comparator<CompletionProposalCategory> ORDER_COMPARATOR= new Comparator<CompletionProposalCategory>() {
@Override @Override
public int compare(CompletionProposalCategory d1, CompletionProposalCategory d2) { public int compare(CompletionProposalCategory d1, CompletionProposalCategory d2) {
return d1.getSortOrder() - d2.getSortOrder(); return d1.getSortOrder() - d2.getSortOrder();
} }
}; };
private static final ICompletionProposal[] NO_PROPOSALS= {}; private static final ICompletionProposal[] NO_PROPOSALS= {};
@ -110,9 +108,9 @@ public class ContentAssistProcessor implements IContentAssistProcessor {
/* cycling stuff */ /* cycling stuff */
private int fRepetition= -1; private int fRepetition= -1;
private List<List<CompletionProposalCategory>> fCategoryIteration= null; private List<List<CompletionProposalCategory>> fCategoryIteration;
private String fIterationGesture= null; private String fIterationGesture;
private int fNumberOfComputedResults= 0; private int fNumberOfComputedResults;
private String fErrorMessage; private String fErrorMessage;
private boolean fIsAutoActivated; private boolean fIsAutoActivated;
@ -123,10 +121,6 @@ public class ContentAssistProcessor implements IContentAssistProcessor {
fCategories= CompletionProposalComputerRegistry.getDefault().getProposalCategories(); fCategories= CompletionProposalComputerRegistry.getDefault().getProposalCategories();
fAssistant= assistant; fAssistant= assistant;
fAssistant.addCompletionListener(new ICompletionListener() { fAssistant.addCompletionListener(new ICompletionListener() {
/*
* @see org.eclipse.jface.text.contentassist.ICompletionListener#assistSessionStarted(org.eclipse.jface.text.contentassist.ContentAssistEvent)
*/
@Override @Override
public void assistSessionStarted(ContentAssistEvent event) { public void assistSessionStarted(ContentAssistEvent event) {
if (event.processor != ContentAssistProcessor.this) if (event.processor != ContentAssistProcessor.this)
@ -164,9 +158,6 @@ public class ContentAssistProcessor implements IContentAssistProcessor {
} }
} }
/*
* @see org.eclipse.jface.text.contentassist.ICompletionListener#assistSessionEnded(org.eclipse.jface.text.contentassist.ContentAssistEvent)
*/
@Override @Override
public void assistSessionEnded(ContentAssistEvent event) { public void assistSessionEnded(ContentAssistEvent event) {
if (event.processor != ContentAssistProcessor.this) if (event.processor != ContentAssistProcessor.this)
@ -192,18 +183,12 @@ public class ContentAssistProcessor implements IContentAssistProcessor {
} }
} }
/*
* @see org.eclipse.jface.text.contentassist.ICompletionListener#selectionChanged(org.eclipse.jface.text.contentassist.ICompletionProposal, boolean)
*/
@Override @Override
public void selectionChanged(ICompletionProposal proposal, boolean smartToggle) {} public void selectionChanged(ICompletionProposal proposal, boolean smartToggle) {}
}); });
} }
/*
* @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#computeCompletionProposals(org.eclipse.jface.text.ITextViewer, int)
*/
@Override @Override
public final ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) { public final ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) {
long start= DEBUG ? System.currentTimeMillis() : 0; long start= DEBUG ? System.currentTimeMillis() : 0;
@ -250,7 +235,7 @@ public class ContentAssistProcessor implements IContentAssistProcessor {
} }
/** /**
* Verify that auto activation is allowed. * Verifies that auto activation is allowed.
* <p> * <p>
* The default implementation always returns <code>true</code>. * The default implementation always returns <code>true</code>.
* </p> * </p>
@ -296,9 +281,6 @@ public class ContentAssistProcessor implements IContentAssistProcessor {
return proposals; return proposals;
} }
/*
* @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#computeContextInformation(org.eclipse.jface.text.ITextViewer, int)
*/
@Override @Override
public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset) { public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset) {
clearState(); clearState();
@ -362,26 +344,16 @@ public class ContentAssistProcessor implements IContentAssistProcessor {
fCompletionAutoActivationCharacters= activationSet; fCompletionAutoActivationCharacters= activationSet;
} }
/*
* @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getCompletionProposalAutoActivationCharacters()
*/
@Override @Override
public char[] getCompletionProposalAutoActivationCharacters() { public char[] getCompletionProposalAutoActivationCharacters() {
return fCompletionAutoActivationCharacters; return fCompletionAutoActivationCharacters;
} }
/*
* @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getContextInformationAutoActivationCharacters()
*/
@Override @Override
public char[] getContextInformationAutoActivationCharacters() { public char[] getContextInformationAutoActivationCharacters() {
return null; return null;
} }
/*
* @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getErrorMessage()
*/
@Override @Override
public String getErrorMessage() { public String getErrorMessage() {
if (fNumberOfComputedResults > 0) if (fNumberOfComputedResults > 0)
@ -391,9 +363,6 @@ public class ContentAssistProcessor implements IContentAssistProcessor {
return ContentAssistMessages.ContentAssistProcessor_no_completions; return ContentAssistMessages.ContentAssistProcessor_no_completions;
} }
/*
* @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getContextInformationValidator()
*/
@Override @Override
public IContextInformationValidator getContextInformationValidator() { public IContextInformationValidator getContextInformationValidator() {
return null; return null;
@ -494,9 +463,6 @@ public class ContentAssistProcessor implements IContentAssistProcessor {
final int restoreId= IDialogConstants.CLIENT_ID + 10; final int restoreId= IDialogConstants.CLIENT_ID + 10;
final int settingsId= IDialogConstants.CLIENT_ID + 11; final int settingsId= IDialogConstants.CLIENT_ID + 11;
final OptionalMessageDialog dialog= new OptionalMessageDialog(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY, shell, title, null /* default image */, message, MessageDialog.WARNING, new String[] { restoreButtonLabel, IDialogConstants.CLOSE_LABEL }, 1) { final OptionalMessageDialog dialog= new OptionalMessageDialog(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY, shell, title, null /* default image */, message, MessageDialog.WARNING, new String[] { restoreButtonLabel, IDialogConstants.CLOSE_LABEL }, 1) {
/*
* @see org.eclipse.cdt.internal.ui.dialogs.OptionalMessageDialog#createCustomArea(org.eclipse.swt.widgets.Composite)
*/
@Override @Override
protected Control createCustomArea(Composite composite) { protected Control createCustomArea(Composite composite) {
// wrap link and checkbox in one composite without space // wrap link and checkbox in one composite without space
@ -533,9 +499,6 @@ public class ContentAssistProcessor implements IContentAssistProcessor {
return parent; return parent;
} }
/*
* @see org.eclipse.jface.dialogs.MessageDialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
*/
@Override @Override
protected void createButtonsForButtonBar(Composite parent) { protected void createButtonsForButtonBar(Composite parent) {
Button[] buttons= new Button[2]; Button[] buttons= new Button[2];

View file

@ -14,12 +14,13 @@ import org.eclipse.cdt.ui.CUIPlugin;
public class Util implements IDebugLogConstants{ public class Util implements IDebugLogConstants{
public static boolean VERBOSE_CONTENTASSIST = false; public static boolean VERBOSE_CONTENTASSIST = false;
private Util() { private Util() {
} }
/*
* Add a log entry
*/
/**
* Adds a log entry
*/
public static void debugLog(String message, DebugLogConstant client) { public static void debugLog(String message, DebugLogConstant client) {
if( CUIPlugin.getDefault() == null ) return; if( CUIPlugin.getDefault() == null ) return;
if ( CUIPlugin.getDefault().isDebugging() && isActive(client)) { if ( CUIPlugin.getDefault().isDebugging() && isActive(client)) {
@ -42,5 +43,4 @@ public class Util implements IDebugLogConstants{
} }
return false; return false;
} }
} }