mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-18 22:45:23 +02:00
Cosmetics.
This commit is contained in:
parent
3374ec550e
commit
b84541a5e7
1 changed files with 53 additions and 56 deletions
|
@ -8,7 +8,6 @@
|
|||
* Contributors:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.internal.core.model;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -50,7 +49,6 @@ import org.eclipse.core.runtime.IPath;
|
|||
import org.eclipse.core.runtime.Path;
|
||||
|
||||
public class PathEntryUtil {
|
||||
|
||||
static PathEntryManager manager = PathEntryManager.getDefault();
|
||||
static final IMarker[] NO_MARKERS = new IMarker[0];
|
||||
|
||||
|
@ -60,8 +58,8 @@ public class PathEntryUtil {
|
|||
|
||||
public static IPathEntry getExpandedPathEntry(IPathEntry entry, ICProject cproject) throws CModelException {
|
||||
switch (entry.getEntryKind()) {
|
||||
case IPathEntry.CDT_INCLUDE : {
|
||||
IIncludeEntry includeEntry = (IIncludeEntry)entry;
|
||||
case IPathEntry.CDT_INCLUDE: {
|
||||
IIncludeEntry includeEntry = (IIncludeEntry) entry;
|
||||
IPath refPath = includeEntry.getBaseReference();
|
||||
if (refPath != null && !refPath.isEmpty()) {
|
||||
IPath includePath = includeEntry.getIncludePath();
|
||||
|
@ -73,9 +71,9 @@ public class PathEntryUtil {
|
|||
ICProject refCProject = CoreModel.getDefault().create(project);
|
||||
if (refCProject != null) {
|
||||
IPathEntry[] entries = manager.getResolvedPathEntries(refCProject);
|
||||
for (IPathEntry entrie : entries) {
|
||||
if (entrie.getEntryKind() == IPathEntry.CDT_INCLUDE) {
|
||||
IIncludeEntry refEntry = (IIncludeEntry)entrie;
|
||||
for (IPathEntry pathEntry : entries) {
|
||||
if (pathEntry.getEntryKind() == IPathEntry.CDT_INCLUDE) {
|
||||
IIncludeEntry refEntry = (IIncludeEntry) pathEntry;
|
||||
if (refEntry.getIncludePath().equals(includePath)) {
|
||||
IPath newBasePath = refEntry.getBasePath();
|
||||
// If the includePath is
|
||||
|
@ -109,9 +107,9 @@ public class PathEntryUtil {
|
|||
IPathEntryContainer container = manager.getPathEntryContainer(refPath, cproject);
|
||||
if (container != null) {
|
||||
IPathEntry[] entries = container.getPathEntries();
|
||||
for (IPathEntry entrie : entries) {
|
||||
if (entrie.getEntryKind() == IPathEntry.CDT_INCLUDE) {
|
||||
IIncludeEntry refEntry = (IIncludeEntry)entrie;
|
||||
for (IPathEntry pathEntry : entries) {
|
||||
if (pathEntry.getEntryKind() == IPathEntry.CDT_INCLUDE) {
|
||||
IIncludeEntry refEntry = (IIncludeEntry) pathEntry;
|
||||
if (refEntry.getIncludePath().equals(includePath)) {
|
||||
IPath newBasePath = refEntry.getBasePath();
|
||||
return CoreModel.newIncludeEntry(includeEntry.getPath(), newBasePath, includePath);
|
||||
|
@ -124,8 +122,8 @@ public class PathEntryUtil {
|
|||
break;
|
||||
}
|
||||
|
||||
case IPathEntry.CDT_MACRO : {
|
||||
IMacroEntry macroEntry = (IMacroEntry)entry;
|
||||
case IPathEntry.CDT_MACRO: {
|
||||
IMacroEntry macroEntry = (IMacroEntry) entry;
|
||||
IPath refPath = macroEntry.getBaseReference();
|
||||
if (refPath != null && !refPath.isEmpty()) {
|
||||
String name = macroEntry.getMacroName();
|
||||
|
@ -137,9 +135,9 @@ public class PathEntryUtil {
|
|||
ICProject refCProject = CoreModel.getDefault().create(project);
|
||||
if (refCProject != null) {
|
||||
IPathEntry[] entries = manager.getResolvedPathEntries(refCProject);
|
||||
for (IPathEntry entrie : entries) {
|
||||
if (entrie.getEntryKind() == IPathEntry.CDT_MACRO) {
|
||||
IMacroEntry refEntry = (IMacroEntry)entrie;
|
||||
for (IPathEntry pathEntry : entries) {
|
||||
if (pathEntry.getEntryKind() == IPathEntry.CDT_MACRO) {
|
||||
IMacroEntry refEntry = (IMacroEntry) pathEntry;
|
||||
if (refEntry.getMacroName().equals(name)) {
|
||||
String value = refEntry.getMacroValue();
|
||||
return CoreModel.newMacroEntry(macroEntry.getPath(), name, value);
|
||||
|
@ -153,9 +151,9 @@ public class PathEntryUtil {
|
|||
IPathEntryContainer container = manager.getPathEntryContainer(refPath, cproject);
|
||||
if (container != null) {
|
||||
IPathEntry[] entries = container.getPathEntries();
|
||||
for (IPathEntry entrie : entries) {
|
||||
if (entrie.getEntryKind() == IPathEntry.CDT_MACRO) {
|
||||
IMacroEntry refEntry = (IMacroEntry)entrie;
|
||||
for (IPathEntry pathEntry : entries) {
|
||||
if (pathEntry.getEntryKind() == IPathEntry.CDT_MACRO) {
|
||||
IMacroEntry refEntry = (IMacroEntry) pathEntry;
|
||||
if (refEntry.getMacroName().equals(name)) {
|
||||
String value = refEntry.getMacroValue();
|
||||
return CoreModel.newMacroEntry(macroEntry.getPath(), name, value);
|
||||
|
@ -168,8 +166,8 @@ public class PathEntryUtil {
|
|||
break;
|
||||
}
|
||||
|
||||
case IPathEntry.CDT_LIBRARY : {
|
||||
ILibraryEntry libEntry = (ILibraryEntry)entry;
|
||||
case IPathEntry.CDT_LIBRARY: {
|
||||
ILibraryEntry libEntry = (ILibraryEntry) entry;
|
||||
IPath refPath = libEntry.getBaseReference();
|
||||
if (refPath != null && !refPath.isEmpty()) {
|
||||
IPath libraryPath = libEntry.getLibraryPath();
|
||||
|
@ -181,9 +179,9 @@ public class PathEntryUtil {
|
|||
ICProject refCProject = CoreModel.getDefault().create(project);
|
||||
if (refCProject != null) {
|
||||
IPathEntry[] entries = manager.getResolvedPathEntries(refCProject);
|
||||
for (IPathEntry entrie : entries) {
|
||||
if (entrie.getEntryKind() == IPathEntry.CDT_LIBRARY) {
|
||||
ILibraryEntry refEntry = (ILibraryEntry)entrie;
|
||||
for (IPathEntry pathEntry : entries) {
|
||||
if (pathEntry.getEntryKind() == IPathEntry.CDT_LIBRARY) {
|
||||
ILibraryEntry refEntry = (ILibraryEntry) pathEntry;
|
||||
if (refEntry.getLibraryPath().equals(libraryPath)) {
|
||||
IPath newBasePath = refEntry.getBasePath();
|
||||
// If the libraryPath is
|
||||
|
@ -221,9 +219,9 @@ public class PathEntryUtil {
|
|||
IPathEntryContainer container = manager.getPathEntryContainer(refPath, cproject);
|
||||
if (container != null) {
|
||||
IPathEntry[] entries = container.getPathEntries();
|
||||
for (IPathEntry entrie : entries) {
|
||||
if (entrie.getEntryKind() == IPathEntry.CDT_LIBRARY) {
|
||||
ILibraryEntry refEntry = (ILibraryEntry)entrie;
|
||||
for (IPathEntry pathEntry : entries) {
|
||||
if (pathEntry.getEntryKind() == IPathEntry.CDT_LIBRARY) {
|
||||
ILibraryEntry refEntry = (ILibraryEntry) pathEntry;
|
||||
if (refEntry.getPath().equals(libraryPath)) {
|
||||
return CoreModel.newLibraryEntry(entry.getPath(), refEntry.getBasePath(),
|
||||
refEntry.getLibraryPath(), refEntry.getSourceAttachmentPath(),
|
||||
|
@ -253,8 +251,8 @@ public class PathEntryUtil {
|
|||
|
||||
IPathEntryVariableManager varManager = CCorePlugin.getDefault().getPathEntryVariableManager();
|
||||
switch (entry.getEntryKind()) {
|
||||
case IPathEntry.CDT_INCLUDE : {
|
||||
IIncludeEntry include = (IIncludeEntry)entry;
|
||||
case IPathEntry.CDT_INCLUDE: {
|
||||
IIncludeEntry include = (IIncludeEntry) entry;
|
||||
|
||||
IPath basePath = include.getBasePath();
|
||||
basePath = varManager.resolvePath(basePath);
|
||||
|
@ -265,8 +263,8 @@ public class PathEntryUtil {
|
|||
return CoreModel.newIncludeEntry(resourcePath, basePath, includePath,
|
||||
include.isSystemInclude(), include.getExclusionPatterns(), include.isExported());
|
||||
}
|
||||
case IPathEntry.CDT_INCLUDE_FILE : {
|
||||
IIncludeFileEntry includeFile = (IIncludeFileEntry)entry;
|
||||
case IPathEntry.CDT_INCLUDE_FILE: {
|
||||
IIncludeFileEntry includeFile = (IIncludeFileEntry) entry;
|
||||
|
||||
IPath basePath = includeFile.getBasePath();
|
||||
basePath = varManager.resolvePath(basePath);
|
||||
|
@ -277,8 +275,8 @@ public class PathEntryUtil {
|
|||
return CoreModel.newIncludeFileEntry(resourcePath, basePath, Path.EMPTY, includeFilePath,
|
||||
includeFile.getExclusionPatterns(), includeFile.isExported());
|
||||
}
|
||||
case IPathEntry.CDT_LIBRARY : {
|
||||
ILibraryEntry library = (ILibraryEntry)entry;
|
||||
case IPathEntry.CDT_LIBRARY: {
|
||||
ILibraryEntry library = (ILibraryEntry) entry;
|
||||
|
||||
IPath basePath = library.getBasePath();
|
||||
basePath = varManager.resolvePath(basePath);
|
||||
|
@ -299,13 +297,13 @@ public class PathEntryUtil {
|
|||
sourceAttachmentPath, sourceAttachmentRootPath,
|
||||
sourceAttachmentPrefixMapping, library.isExported());
|
||||
}
|
||||
case IPathEntry.CDT_MACRO : {
|
||||
IMacroEntry macro = (IMacroEntry)entry;
|
||||
case IPathEntry.CDT_MACRO: {
|
||||
IMacroEntry macro = (IMacroEntry) entry;
|
||||
return CoreModel.newMacroEntry(resourcePath, macro.getMacroName(), macro.getMacroValue(),
|
||||
macro.getExclusionPatterns(), macro.isExported());
|
||||
}
|
||||
case IPathEntry.CDT_MACRO_FILE : {
|
||||
IMacroFileEntry macroFile = (IMacroFileEntry)entry;
|
||||
case IPathEntry.CDT_MACRO_FILE: {
|
||||
IMacroFileEntry macroFile = (IMacroFileEntry) entry;
|
||||
|
||||
IPath basePath = macroFile.getBasePath();
|
||||
basePath = varManager.resolvePath(basePath);
|
||||
|
@ -316,19 +314,19 @@ public class PathEntryUtil {
|
|||
return CoreModel.newMacroFileEntry(resourcePath, basePath, Path.EMPTY, macroFilePath,
|
||||
macroFile.getExclusionPatterns(), macroFile.isExported());
|
||||
}
|
||||
case IPathEntry.CDT_OUTPUT : {
|
||||
IOutputEntry out = (IOutputEntry)entry;
|
||||
case IPathEntry.CDT_OUTPUT: {
|
||||
IOutputEntry out = (IOutputEntry) entry;
|
||||
return CoreModel.newOutputEntry(resourcePath, out.getExclusionPatterns());
|
||||
}
|
||||
case IPathEntry.CDT_PROJECT : {
|
||||
IProjectEntry projEntry = (IProjectEntry)entry;
|
||||
case IPathEntry.CDT_PROJECT: {
|
||||
IProjectEntry projEntry = (IProjectEntry) entry;
|
||||
return CoreModel.newProjectEntry(projEntry.getPath(), projEntry.isExported());
|
||||
}
|
||||
case IPathEntry.CDT_SOURCE : {
|
||||
ISourceEntry source = (ISourceEntry)entry;
|
||||
case IPathEntry.CDT_SOURCE: {
|
||||
ISourceEntry source = (ISourceEntry) entry;
|
||||
return CoreModel.newSourceEntry(resourcePath, source.getExclusionPatterns());
|
||||
}
|
||||
case IPathEntry.CDT_CONTAINER : {
|
||||
case IPathEntry.CDT_CONTAINER: {
|
||||
return CoreModel.newContainerEntry(entry.getPath(), entry.isExported());
|
||||
}
|
||||
}
|
||||
|
@ -425,13 +423,13 @@ public class PathEntryUtil {
|
|||
if (!isValidWorkspacePath(project, path)) {
|
||||
return new CModelStatus(
|
||||
ICModelStatusConstants.INVALID_PATHENTRY,
|
||||
CoreModelMessages.getFormattedString("PathEntryManager.0", new Object[]{ path.toOSString(), ((PathEntry)entry).getKindString()})); //$NON-NLS-1$
|
||||
CoreModelMessages.getFormattedString("PathEntryManager.0", new Object[]{ path.toOSString(), ((PathEntry) entry).getKindString()})); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
switch (entry.getEntryKind()) {
|
||||
case IPathEntry.CDT_INCLUDE : {
|
||||
IIncludeEntry include = (IIncludeEntry)entry;
|
||||
case IPathEntry.CDT_INCLUDE: {
|
||||
IIncludeEntry include = (IIncludeEntry) entry;
|
||||
IPath includePath = include.getFullIncludePath();
|
||||
if (!isValidExternalPath(includePath)) {
|
||||
return new CModelStatus(ICModelStatusConstants.INVALID_PATHENTRY,
|
||||
|
@ -443,8 +441,8 @@ public class PathEntryUtil {
|
|||
}
|
||||
break;
|
||||
}
|
||||
case IPathEntry.CDT_LIBRARY : {
|
||||
ILibraryEntry library = (ILibraryEntry)entry;
|
||||
case IPathEntry.CDT_LIBRARY: {
|
||||
ILibraryEntry library = (ILibraryEntry) entry;
|
||||
if (checkSourceAttachment) {
|
||||
IPath sourceAttach = library.getSourceAttachmentPath();
|
||||
if (sourceAttach != null) {
|
||||
|
@ -467,8 +465,8 @@ public class PathEntryUtil {
|
|||
}
|
||||
break;
|
||||
}
|
||||
case IPathEntry.CDT_PROJECT : {
|
||||
IProjectEntry projEntry = (IProjectEntry)entry;
|
||||
case IPathEntry.CDT_PROJECT: {
|
||||
IProjectEntry projEntry = (IProjectEntry) entry;
|
||||
path = projEntry.getPath();
|
||||
IProject reqProject = project.getWorkspace().getRoot().getProject(path.segment(0));
|
||||
if (!reqProject.isAccessible()) {
|
||||
|
@ -481,10 +479,10 @@ public class PathEntryUtil {
|
|||
}
|
||||
break;
|
||||
}
|
||||
case IPathEntry.CDT_CONTAINER :
|
||||
case IPathEntry.CDT_CONTAINER:
|
||||
if (recurseInContainers) {
|
||||
try {
|
||||
IPathEntryContainer cont = manager.getPathEntryContainer((IContainerEntry)entry, cProject);
|
||||
IPathEntryContainer cont = manager.getPathEntryContainer((IContainerEntry) entry, cProject);
|
||||
IPathEntry[] contEntries = cont.getPathEntries();
|
||||
for (IPathEntry contEntrie : contEntries) {
|
||||
ICModelStatus status = validatePathEntry(cProject, contEntrie, checkSourceAttachment, false);
|
||||
|
@ -633,20 +631,19 @@ public class PathEntryUtil {
|
|||
public static int code2Severity(ICModelStatus status) {
|
||||
int severity;
|
||||
switch (status.getCode()) {
|
||||
case ICModelStatusConstants.INVALID_PATHENTRY :
|
||||
case ICModelStatusConstants.INVALID_PATHENTRY:
|
||||
severity = IMarker.SEVERITY_WARNING;
|
||||
break;
|
||||
|
||||
case ICModelStatusConstants.INVALID_PATH :
|
||||
case ICModelStatusConstants.INVALID_PATH:
|
||||
severity = IMarker.SEVERITY_WARNING;
|
||||
break;
|
||||
|
||||
default :
|
||||
default:
|
||||
severity = IMarker.SEVERITY_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
return severity;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue