1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Added per file C/C++ Includes & Symbols property page to display per file scanner info (discovered and user specified).

This commit is contained in:
Vladimir Hirsl 2005-04-22 16:04:06 +00:00
parent 7d7fa374bf
commit 7c8ce5b42e
12 changed files with 1433 additions and 14 deletions

View file

@ -258,6 +258,16 @@
value="org.eclipse.cdt.make.core.makeNature"> value="org.eclipse.cdt.make.core.makeNature">
</filter> </filter>
</page> </page>
<page
adaptable="true"
class="org.eclipse.cdt.internal.ui.dialogs.cpaths.IncludesSymbolsPropertyPage"
id="org.eclipse.cdt.make.ui.scannerconfig.PerFileIncludesSymbolsPropertyPage"
name="%IncludeSymbolProperties.name"
objectClass="org.eclipse.cdt.core.model.ITranslationUnit">
<filter
name="projectNature"
value="org.eclipse.cdt.make.core.makeNature"/>
</page>
</extension> </extension>
<extension <extension

View file

@ -1,3 +1,18 @@
2005-04-22 Vladimir Hirsl
Added per file C/C++ Includes & Symbols property page to display
per file scanner info (discovered and user specified).
+ icons/obj16/hfolder_quote_obj.gif
* src/org/eclipse/cdt/internal/ui/CPluginImages.java
* src/org/eclipse/cdt/internal/ui/dialogs/cpaths/AbstractPathOptionBlock.java
* src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathEntryMessages.properties
+ src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathIncludeSymbolEntryBasePage.java
* src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathIncludeSymbolEntryPage.java
+ src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPathIncludeSymbolEntryPerFilePage.java
* src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPElement.java
* src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CElementLabelProvider.java
* src/org/eclipse/cdt/internal/ui/dialogs/cpaths/NewIncludesSymbolsTabBlock.java
2005-04-13 Alain Magloire 2005-04-13 Alain Magloire
Fix PR 91239 Fix PR 91239
* src/org/eclipse/cdt/internal/ui/CPerspectiveFactory.java * src/org/eclipse/cdt/internal/ui/CPerspectiveFactory.java

Binary file not shown.

After

Width:  |  Height:  |  Size: 969 B

View file

@ -85,6 +85,7 @@ public class CPluginImages {
public static final String IMG_OBJS_LIBRARY= NAME_PREFIX + "lib_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_LIBRARY= NAME_PREFIX + "lib_obj.gif"; //$NON-NLS-1$
public static final String IMG_OBJS_INCLUDES_CONTAINER = NAME_PREFIX + "includes_container.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_INCLUDES_CONTAINER = NAME_PREFIX + "includes_container.gif"; //$NON-NLS-1$
public static final String IMG_OBJS_INCLUDES_FOLDER = NAME_PREFIX + "hfolder_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_INCLUDES_FOLDER = NAME_PREFIX + "hfolder_obj.gif"; //$NON-NLS-1$
public static final String IMG_OBJS_QUOTE_INCLUDES_FOLDER = NAME_PREFIX + "hfolder_quote_obj.gif"; //$NON-NLS-1$
public static final String IMG_OBJS_ORDER= NAME_PREFIX + "cp_order_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_ORDER= NAME_PREFIX + "cp_order_obj.gif"; //$NON-NLS-1$
public static final String IMG_OBJS_EXCLUDSION_FILTER_ATTRIB= NAME_PREFIX + "exclusion_filter_attrib.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_EXCLUDSION_FILTER_ATTRIB= NAME_PREFIX + "exclusion_filter_attrib.gif"; //$NON-NLS-1$
public static final String IMG_OBJS_SOURCE_ATTACH_ATTRIB = NAME_PREFIX + "source_attach_attrib.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_SOURCE_ATTACH_ATTRIB = NAME_PREFIX + "source_attach_attrib.gif"; //$NON-NLS-1$
@ -154,6 +155,7 @@ public class CPluginImages {
public static final ImageDescriptor DESC_OBJS_LIBRARY= createManaged(T_OBJ, IMG_OBJS_LIBRARY); public static final ImageDescriptor DESC_OBJS_LIBRARY= createManaged(T_OBJ, IMG_OBJS_LIBRARY);
public static final ImageDescriptor DESC_OBJS_INCLUDES_CONTAINER= createManaged(T_OBJ, IMG_OBJS_INCLUDES_CONTAINER); public static final ImageDescriptor DESC_OBJS_INCLUDES_CONTAINER= createManaged(T_OBJ, IMG_OBJS_INCLUDES_CONTAINER);
public static final ImageDescriptor DESC_OBJS_INCLUDES_FOLDER= createManaged(T_OBJ, IMG_OBJS_INCLUDES_FOLDER); public static final ImageDescriptor DESC_OBJS_INCLUDES_FOLDER= createManaged(T_OBJ, IMG_OBJS_INCLUDES_FOLDER);
public static final ImageDescriptor DESC_OBJS_QUOTE_INCLUDES_FOLDER= createManaged(T_OBJ, IMG_OBJS_QUOTE_INCLUDES_FOLDER);
public static final ImageDescriptor DESC_OBJS_ORDER= createManaged(T_OBJ, IMG_OBJS_ORDER); public static final ImageDescriptor DESC_OBJS_ORDER= createManaged(T_OBJ, IMG_OBJS_ORDER);
public static final ImageDescriptor DESC_OBJS_EXCLUSION_FILTER_ATTRIB = createManaged(T_OBJ, IMG_OBJS_EXCLUDSION_FILTER_ATTRIB); public static final ImageDescriptor DESC_OBJS_EXCLUSION_FILTER_ATTRIB = createManaged(T_OBJ, IMG_OBJS_EXCLUDSION_FILTER_ATTRIB);
public static final ImageDescriptor DESC_OBJS_SOURCE_ATTACH_ATTRIB= createManaged(T_OBJ, IMG_OBJS_SOURCE_ATTACH_ATTRIB); public static final ImageDescriptor DESC_OBJS_SOURCE_ATTACH_ATTRIB= createManaged(T_OBJ, IMG_OBJS_SOURCE_ATTACH_ATTRIB);

View file

@ -150,7 +150,7 @@ abstract public class AbstractPathOptionBlock extends TabFolderOptionBlock imple
for (int i = 0; i < cPathEntries.length; i++) { for (int i = 0; i < cPathEntries.length; i++) {
IPathEntry curr = cPathEntries[i]; IPathEntry curr = cPathEntries[i];
if (contains(types, curr.getEntryKind())) { if (contains(types, curr.getEntryKind())) {
newCPath.add(CPElement.createFromExisting(curr, getCProject())); newCPath.add(CPElement.createFromExisting(curr, getCElement()));
} }
} }
return newCPath; return newCPath;

View file

@ -13,15 +13,20 @@ import java.util.List;
import org.eclipse.cdt.core.model.CModelException; import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.CoreModel; import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ICProject; import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.model.IIncludeEntry; import org.eclipse.cdt.core.model.IIncludeEntry;
import org.eclipse.cdt.core.model.IIncludeFileEntry;
import org.eclipse.cdt.core.model.ILibraryEntry; import org.eclipse.cdt.core.model.ILibraryEntry;
import org.eclipse.cdt.core.model.IMacroEntry; import org.eclipse.cdt.core.model.IMacroEntry;
import org.eclipse.cdt.core.model.IMacroFileEntry;
import org.eclipse.cdt.core.model.IOutputEntry; import org.eclipse.cdt.core.model.IOutputEntry;
import org.eclipse.cdt.core.model.IPathEntry; import org.eclipse.cdt.core.model.IPathEntry;
import org.eclipse.cdt.core.model.IPathEntryContainer; import org.eclipse.cdt.core.model.IPathEntryContainer;
import org.eclipse.cdt.core.model.IPathEntryContainerExtension;
import org.eclipse.cdt.core.model.ISourceEntry; import org.eclipse.cdt.core.model.ISourceEntry;
import org.eclipse.cdt.ui.CUIPlugin; import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot; import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
@ -43,6 +48,8 @@ public class CPElement {
public static final String BASE = "base-path"; //$NON-NLS-1$ public static final String BASE = "base-path"; //$NON-NLS-1$
public static final String PARENT = "parent"; //$NON-NLS-1$ public static final String PARENT = "parent"; //$NON-NLS-1$
public static final String PARENT_CONTAINER = "parent-container"; //$NON-NLS-1$ public static final String PARENT_CONTAINER = "parent-container"; //$NON-NLS-1$
public static final String INCLUDE_FILE = "includefile"; //$NON-NLS-1$
public static final String MACROS_FILE = "macrosfile"; //$NON-NLS-1$
private final int fEntryKind; private final int fEntryKind;
private final IPath fPath; private final IPath fPath;
@ -100,6 +107,12 @@ public class CPElement {
createAttributeElement(BASE_REF, new Path("")); //$NON-NLS-1$ createAttributeElement(BASE_REF, new Path("")); //$NON-NLS-1$
createAttributeElement(BASE, new Path("")); //$NON-NLS-1$ createAttributeElement(BASE, new Path("")); //$NON-NLS-1$
break; break;
case IPathEntry.CDT_INCLUDE_FILE :
createAttributeElement(INCLUDE_FILE, new Path("")); //$NON-NLS-1$
createAttributeElement(EXCLUSION, new Path[0]);
createAttributeElement(BASE_REF, new Path("")); //$NON-NLS-1$
createAttributeElement(BASE, new Path("")); //$NON-NLS-1$
break;
case IPathEntry.CDT_MACRO : case IPathEntry.CDT_MACRO :
createAttributeElement(MACRO_NAME, ""); //$NON-NLS-1$ createAttributeElement(MACRO_NAME, ""); //$NON-NLS-1$
createAttributeElement(MACRO_VALUE, ""); //$NON-NLS-1$ createAttributeElement(MACRO_VALUE, ""); //$NON-NLS-1$
@ -107,11 +120,27 @@ public class CPElement {
createAttributeElement(BASE_REF, new Path("")); //$NON-NLS-1$ createAttributeElement(BASE_REF, new Path("")); //$NON-NLS-1$
createAttributeElement(BASE, new Path("")); //$NON-NLS-1$ createAttributeElement(BASE, new Path("")); //$NON-NLS-1$
break; break;
case IPathEntry.CDT_MACRO_FILE :
createAttributeElement(MACROS_FILE, new Path("")); //$NON-NLS-1$
createAttributeElement(EXCLUSION, new Path[0]);
createAttributeElement(BASE_REF, new Path("")); //$NON-NLS-1$
createAttributeElement(BASE, new Path("")); //$NON-NLS-1$
break;
case IPathEntry.CDT_CONTAINER : case IPathEntry.CDT_CONTAINER :
try { try {
IPathEntryContainer container = CoreModel.getPathEntryContainer(fPath, fCProject); IPathEntryContainer container = CoreModel.getPathEntryContainer(fPath, fCProject);
if (container != null) { if (container != null) {
IPathEntry[] entries = container.getPathEntries(); IPathEntry[] entries = null;
if (container instanceof IPathEntryContainerExtension &&
res instanceof IFile) {
IPathEntryContainerExtension extContainer = (IPathEntryContainerExtension) container;
entries = extContainer.getPathEntries(res.getFullPath(),
IPathEntry.CDT_INCLUDE | IPathEntry.CDT_MACRO |
IPathEntry.CDT_INCLUDE_FILE | IPathEntry.CDT_MACRO_FILE);
}
else {
entries = container.getPathEntries();
}
for (int i = 0; i < entries.length; i++) { for (int i = 0; i < entries.length; i++) {
CPElement curr = createFromExisting(entries[i], fCProject); CPElement curr = createFromExisting(entries[i], fCProject);
curr.createAttributeElement(PARENT_CONTAINER, this); curr.createAttributeElement(PARENT_CONTAINER, this);
@ -169,6 +198,10 @@ public class CPElement {
} }
return CoreModel.newIncludeEntry(fPath, base, include, ((Boolean)getAttribute(SYSTEM_INCLUDE)).booleanValue(), return CoreModel.newIncludeEntry(fPath, base, include, ((Boolean)getAttribute(SYSTEM_INCLUDE)).booleanValue(),
exclusionPattern, isExported()); exclusionPattern, isExported());
case IPathEntry.CDT_INCLUDE_FILE:
IPath includeFile = (IPath)getAttribute(INCLUDE_FILE);
return CoreModel.newIncludeFileEntry(fPath, baseRef, base, includeFile,
exclusionPattern, isExported());
case IPathEntry.CDT_MACRO : case IPathEntry.CDT_MACRO :
String macroName = (String)getAttribute(MACRO_NAME); String macroName = (String)getAttribute(MACRO_NAME);
String macroValue = (String)getAttribute(MACRO_VALUE); String macroValue = (String)getAttribute(MACRO_VALUE);
@ -176,6 +209,10 @@ public class CPElement {
return CoreModel.newMacroRefEntry(fPath, baseRef, macroName); return CoreModel.newMacroRefEntry(fPath, baseRef, macroName);
} }
return CoreModel.newMacroEntry(fPath, macroName, macroValue, exclusionPattern, isExported()); return CoreModel.newMacroEntry(fPath, macroName, macroValue, exclusionPattern, isExported());
case IPathEntry.CDT_MACRO_FILE :
IPath macrosFile = (IPath)getAttribute(MACROS_FILE);
return CoreModel.newMacroFileEntry(fPath, baseRef, base, macrosFile,
exclusionPattern, isExported());
default : default :
return null; return null;
} }
@ -202,7 +239,9 @@ public class CPElement {
case IPathEntry.CDT_OUTPUT : case IPathEntry.CDT_OUTPUT :
case IPathEntry.CDT_SOURCE : case IPathEntry.CDT_SOURCE :
case IPathEntry.CDT_INCLUDE : case IPathEntry.CDT_INCLUDE :
case IPathEntry.CDT_INCLUDE_FILE :
case IPathEntry.CDT_MACRO : case IPathEntry.CDT_MACRO :
case IPathEntry.CDT_MACRO_FILE :
IPath[] exclusion = (IPath[])getAttribute(EXCLUSION); IPath[] exclusion = (IPath[])getAttribute(EXCLUSION);
buf.append('[').append(exclusion.length).append(']'); buf.append('[').append(exclusion.length).append(']');
for (int i = 0; i < exclusion.length; i++) { for (int i = 0; i < exclusion.length; i++) {
@ -217,6 +256,14 @@ public class CPElement {
IPath include = (IPath)getAttribute(INCLUDE); IPath include = (IPath)getAttribute(INCLUDE);
appendEncodePath(include, buf); appendEncodePath(include, buf);
break; break;
case IPathEntry.CDT_INCLUDE_FILE :
baseRef = (IPath)getAttribute(BASE_REF);
appendEncodePath(baseRef, buf);
base = (IPath)getAttribute(BASE);
appendEncodePath(base, buf);
IPath includeFile = (IPath)getAttribute(INCLUDE_FILE);
appendEncodePath(includeFile, buf);
break;
case IPathEntry.CDT_MACRO : case IPathEntry.CDT_MACRO :
baseRef = (IPath)getAttribute(BASE_REF); baseRef = (IPath)getAttribute(BASE_REF);
appendEncodePath(baseRef, buf); appendEncodePath(baseRef, buf);
@ -224,6 +271,14 @@ public class CPElement {
appendEncodePath(base, buf); appendEncodePath(base, buf);
String symbol = (String)getAttribute(MACRO_NAME); String symbol = (String)getAttribute(MACRO_NAME);
buf.append(symbol).append(';'); buf.append(symbol).append(';');
case IPathEntry.CDT_MACRO_FILE :
baseRef = (IPath)getAttribute(BASE_REF);
appendEncodePath(baseRef, buf);
base = (IPath)getAttribute(BASE);
appendEncodePath(base, buf);
IPath macrosFile = (IPath)getAttribute(MACROS_FILE);
appendEncodePath(macrosFile, buf);
break;
default : default :
} }
break; break;
@ -334,7 +389,9 @@ public class CPElement {
case IPathEntry.CDT_OUTPUT : case IPathEntry.CDT_OUTPUT :
case IPathEntry.CDT_SOURCE : case IPathEntry.CDT_SOURCE :
case IPathEntry.CDT_INCLUDE : case IPathEntry.CDT_INCLUDE :
case IPathEntry.CDT_INCLUDE_FILE :
case IPathEntry.CDT_MACRO : case IPathEntry.CDT_MACRO :
case IPathEntry.CDT_MACRO_FILE :
if (getInherited() == null && getParentContainer() == null) { if (getInherited() == null && getParentContainer() == null) {
return new Object[]{findAttributeElement(EXCLUSION)}; return new Object[]{findAttributeElement(EXCLUSION)};
} }
@ -379,10 +436,18 @@ public class CPElement {
return (getAttribute(INCLUDE).equals(elem.getAttribute(INCLUDE)) return (getAttribute(INCLUDE).equals(elem.getAttribute(INCLUDE))
&& getAttribute(BASE_REF).equals(elem.getAttribute(BASE_REF)) && getAttribute(BASE).equals( && getAttribute(BASE_REF).equals(elem.getAttribute(BASE_REF)) && getAttribute(BASE).equals(
elem.getAttribute(BASE))); elem.getAttribute(BASE)));
case IPathEntry.CDT_INCLUDE_FILE :
return (getAttribute(INCLUDE_FILE).equals(elem.getAttribute(INCLUDE_FILE))
&& getAttribute(BASE_REF).equals(elem.getAttribute(BASE_REF)) && getAttribute(BASE).equals(
elem.getAttribute(BASE)));
case IPathEntry.CDT_MACRO : case IPathEntry.CDT_MACRO :
return (getAttribute(MACRO_NAME).equals(elem.getAttribute(MACRO_NAME)) return (getAttribute(MACRO_NAME).equals(elem.getAttribute(MACRO_NAME))
&& getAttribute(BASE_REF).equals(elem.getAttribute(BASE_REF)) && getAttribute(BASE).equals( && getAttribute(BASE_REF).equals(elem.getAttribute(BASE_REF)) && getAttribute(BASE).equals(
elem.getAttribute(BASE))); elem.getAttribute(BASE)));
case IPathEntry.CDT_MACRO_FILE :
return (getAttribute(MACROS_FILE).equals(elem.getAttribute(MACROS_FILE))
&& getAttribute(BASE_REF).equals(elem.getAttribute(BASE_REF)) && getAttribute(BASE).equals(
elem.getAttribute(BASE)));
} }
return true; return true;
} }
@ -406,11 +471,21 @@ public class CPElement {
hashCode = hashCode * HASH_FACTOR + getAttribute(BASE_REF).hashCode(); hashCode = hashCode * HASH_FACTOR + getAttribute(BASE_REF).hashCode();
hashCode = hashCode * HASH_FACTOR + getAttribute(BASE).hashCode(); hashCode = hashCode * HASH_FACTOR + getAttribute(BASE).hashCode();
break; break;
case IPathEntry.CDT_INCLUDE_FILE :
hashCode = hashCode * HASH_FACTOR + getAttribute(INCLUDE_FILE).hashCode();
hashCode = hashCode * HASH_FACTOR + getAttribute(BASE_REF).hashCode();
hashCode = hashCode * HASH_FACTOR + getAttribute(BASE).hashCode();
break;
case IPathEntry.CDT_MACRO : case IPathEntry.CDT_MACRO :
hashCode = hashCode * HASH_FACTOR + getAttribute(MACRO_NAME).hashCode(); hashCode = hashCode * HASH_FACTOR + getAttribute(MACRO_NAME).hashCode();
hashCode = hashCode * HASH_FACTOR + getAttribute(BASE_REF).hashCode(); hashCode = hashCode * HASH_FACTOR + getAttribute(BASE_REF).hashCode();
hashCode = hashCode * HASH_FACTOR + getAttribute(BASE).hashCode(); hashCode = hashCode * HASH_FACTOR + getAttribute(BASE).hashCode();
break; break;
case IPathEntry.CDT_MACRO_FILE :
hashCode = hashCode * HASH_FACTOR + getAttribute(MACROS_FILE).hashCode();
hashCode = hashCode * HASH_FACTOR + getAttribute(BASE_REF).hashCode();
hashCode = hashCode * HASH_FACTOR + getAttribute(BASE).hashCode();
break;
} }
return hashCode; return hashCode;
} }
@ -491,6 +566,23 @@ public class CPElement {
fStatus = new Status(IStatus.WARNING, CUIPlugin.PLUGIN_ID, -1, CPathEntryMessages.getString("CPElement.status.includePathNotFound"), null); //$NON-NLS-1$ fStatus = new Status(IStatus.WARNING, CUIPlugin.PLUGIN_ID, -1, CPathEntryMessages.getString("CPElement.status.includePathNotFound"), null); //$NON-NLS-1$
} }
break; break;
case IPathEntry.CDT_INCLUDE_FILE :
path = fPath.removeTrailingSeparator();
res = root.findMember(path);
if (res == null) {
if (root.getWorkspace().validatePath(path.toString(), IResource.FOLDER).isOK()) {
res = root.getFolder(path);
}
}
if (res.getType() != IResource.ROOT && res.getType() != IResource.PROJECT && fCProject != null) {
if (!fCProject.isOnSourceRoot(res)) {
fStatus = new Status(IStatus.WARNING, CUIPlugin.PLUGIN_ID, -1, CPathEntryMessages.getString("CPElement.status.notOnSourcePath"), null); //$NON-NLS-1$
}
}
if (!((IIncludeFileEntry)entry).getFullIncludeFilePath().toFile().exists()) {
fStatus = new Status(IStatus.WARNING, CUIPlugin.PLUGIN_ID, -1, CPathEntryMessages.getString("CPElement.status.includeFilePathNotFound"), null); //$NON-NLS-1$
}
break;
case IPathEntry.CDT_MACRO : case IPathEntry.CDT_MACRO :
path = fPath.removeTrailingSeparator(); path = fPath.removeTrailingSeparator();
res = root.findMember(path); res = root.findMember(path);
@ -505,6 +597,23 @@ public class CPElement {
} }
} }
break; break;
case IPathEntry.CDT_MACRO_FILE :
path = fPath.removeTrailingSeparator();
res = root.findMember(path);
if (res == null) {
if (root.getWorkspace().validatePath(path.toString(), IResource.FOLDER).isOK()) {
res = root.getFolder(path);
}
}
if (res.getType() != IResource.ROOT && res.getType() != IResource.PROJECT && fCProject != null) {
if (!fCProject.isOnSourceRoot(res)) {
fStatus = new Status(IStatus.WARNING, CUIPlugin.PLUGIN_ID, -1, CPathEntryMessages.getString("CPElement.status.notOnSourcePath"), null); //$NON-NLS-1$
}
}
if (!((IMacroFileEntry)entry).getFullMacroFilePath().toFile().exists()) {
fStatus = new Status(IStatus.WARNING, CUIPlugin.PLUGIN_ID, -1, CPathEntryMessages.getString("CPElement.status.macrosFilePathNotFound"), null); //$NON-NLS-1$
}
break;
case IPathEntry.CDT_PROJECT : case IPathEntry.CDT_PROJECT :
res = root.findMember(fPath); res = root.findMember(fPath);
if (res == null) { if (res == null) {
@ -549,15 +658,17 @@ public class CPElement {
return fCProject; return fCProject;
} }
public static CPElement createFromExisting(IPathEntry curr, ICProject project) { public static CPElement createFromExisting(IPathEntry curr, ICElement element) {
IPath path = curr.getPath(); IPath path = curr.getPath();
IWorkspaceRoot root = CUIPlugin.getWorkspace().getRoot(); IWorkspaceRoot root = CUIPlugin.getWorkspace().getRoot();
IPath sourceAttachment = null; IPath sourceAttachment = null;
IPath[] exclusion = null; IPath[] exclusion = null;
IPath include = null; IPath include = null;
IPath includeFile = null;
IPath library = null; IPath library = null;
String macroName = null; String macroName = null;
String macroValue = null; String macroValue = null;
IPath macrosFile = null;
boolean sysInclude = false; boolean sysInclude = false;
IPath baseRef = null; IPath baseRef = null;
IPath base = null; IPath base = null;
@ -567,7 +678,7 @@ public class CPElement {
switch (curr.getEntryKind()) { switch (curr.getEntryKind()) {
case IPathEntry.CDT_CONTAINER : case IPathEntry.CDT_CONTAINER :
res = null; res = (element instanceof ICProject) ? null : element.getResource();
break; break;
case IPathEntry.CDT_LIBRARY : case IPathEntry.CDT_LIBRARY :
library = ((ILibraryEntry)curr).getLibraryPath(); library = ((ILibraryEntry)curr).getLibraryPath();
@ -609,6 +720,19 @@ public class CPElement {
base = ((IIncludeEntry)curr).getBasePath(); base = ((IIncludeEntry)curr).getBasePath();
include = ((IIncludeEntry)curr).getIncludePath(); include = ((IIncludeEntry)curr).getIncludePath();
break; break;
case IPathEntry.CDT_INCLUDE_FILE :
path = path.removeTrailingSeparator();
res = root.findMember(path);
if (res == null) {
if (root.getWorkspace().validatePath(path.toString(), IResource.FOLDER).isOK()) {
res = root.getFolder(path);
}
}
exclusion = ((IIncludeFileEntry)curr).getExclusionPatterns();
includeFile = ((IIncludeFileEntry)curr).getIncludeFilePath();
baseRef = ((IIncludeFileEntry)curr).getBaseReference();
base = ((IIncludeFileEntry)curr).getBasePath();
break;
case IPathEntry.CDT_MACRO : case IPathEntry.CDT_MACRO :
path = path.removeTrailingSeparator(); path = path.removeTrailingSeparator();
res = root.findMember(path); res = root.findMember(path);
@ -623,17 +747,32 @@ public class CPElement {
baseRef = ((IMacroEntry)curr).getBaseReference(); baseRef = ((IMacroEntry)curr).getBaseReference();
base = ((IMacroEntry)curr).getBasePath(); base = ((IMacroEntry)curr).getBasePath();
break; break;
case IPathEntry.CDT_MACRO_FILE :
path = path.removeTrailingSeparator();
res = root.findMember(path);
if (res == null) {
if (root.getWorkspace().validatePath(path.toString(), IResource.FOLDER).isOK()) {
res = root.getFolder(path);
}
}
exclusion = ((IMacroFileEntry)curr).getExclusionPatterns();
macrosFile = ((IMacroFileEntry)curr).getMacroFilePath();
baseRef = ((IMacroFileEntry)curr).getBaseReference();
base = ((IMacroFileEntry)curr).getBasePath();
break;
case IPathEntry.CDT_PROJECT : case IPathEntry.CDT_PROJECT :
res = root.findMember(path); res = root.findMember(path);
break; break;
} }
CPElement elem = new CPElement(project, curr.getEntryKind(), path, res); CPElement elem = new CPElement(element.getCProject(), curr.getEntryKind(), path, res);
elem.setAttribute(SOURCEATTACHMENT, sourceAttachment); elem.setAttribute(SOURCEATTACHMENT, sourceAttachment);
elem.setAttribute(EXCLUSION, exclusion); elem.setAttribute(EXCLUSION, exclusion);
elem.setAttribute(INCLUDE, include); elem.setAttribute(INCLUDE, include);
elem.setAttribute(INCLUDE_FILE, includeFile);
elem.setAttribute(LIBRARY, library); elem.setAttribute(LIBRARY, library);
elem.setAttribute(MACRO_NAME, macroName); elem.setAttribute(MACRO_NAME, macroName);
elem.setAttribute(MACRO_VALUE, macroValue); elem.setAttribute(MACRO_VALUE, macroValue);
elem.setAttribute(MACROS_FILE, macrosFile);
elem.setAttribute(SYSTEM_INCLUDE, Boolean.valueOf(sysInclude)); elem.setAttribute(SYSTEM_INCLUDE, Boolean.valueOf(sysInclude));
elem.setAttribute(BASE_REF, baseRef); elem.setAttribute(BASE_REF, baseRef);
elem.setAttribute(BASE, base); elem.setAttribute(BASE, base);

View file

@ -14,7 +14,6 @@ import org.eclipse.cdt.core.model.IPathEntry;
import org.eclipse.cdt.core.model.IPathEntryContainer; import org.eclipse.cdt.core.model.IPathEntryContainer;
import org.eclipse.cdt.internal.ui.CPluginImages; import org.eclipse.cdt.internal.ui.CPluginImages;
import org.eclipse.cdt.internal.ui.util.ImageDescriptorRegistry; import org.eclipse.cdt.internal.ui.util.ImageDescriptorRegistry;
import org.eclipse.cdt.internal.ui.viewsupport.CElementImageProvider;
import org.eclipse.cdt.ui.CUIPlugin; import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
@ -37,11 +36,11 @@ class CPElementLabelProvider extends LabelProvider implements IColorProvider {
private String fNewLabel, fCreateLabel; private String fNewLabel, fCreateLabel;
private ImageDescriptor fIncludeIcon, fMacroIcon, fLibWSrcIcon, fLibIcon; private ImageDescriptor fIncludeIcon, fMacroIcon, fLibWSrcIcon, fLibIcon;
private ImageDescriptor fQuoteIncludeIcon, fIncludeFileIcon, fMacrosFileIcon;
private ImageDescriptor fFolderImage, fOutputImage, fProjectImage, fContainerImage; private ImageDescriptor fFolderImage, fOutputImage, fProjectImage, fContainerImage;
private boolean bShowExported; private boolean bShowExported;
private boolean bShowParentInfo; private boolean bShowParentInfo;
private ImageDescriptorRegistry fRegistry; private ImageDescriptorRegistry fRegistry;
private CElementImageProvider fCImages;
public CPElementLabelProvider() { public CPElementLabelProvider() {
this(true, false); this(true, false);
@ -51,12 +50,14 @@ class CPElementLabelProvider extends LabelProvider implements IColorProvider {
fNewLabel = CPathEntryMessages.getString("CPElementLabelProvider.new"); //$NON-NLS-1$ fNewLabel = CPathEntryMessages.getString("CPElementLabelProvider.new"); //$NON-NLS-1$
fCreateLabel = CPathEntryMessages.getString("CPElementLabelProvider.willbecreated"); //$NON-NLS-1$ fCreateLabel = CPathEntryMessages.getString("CPElementLabelProvider.willbecreated"); //$NON-NLS-1$
fRegistry = CUIPlugin.getImageDescriptorRegistry(); fRegistry = CUIPlugin.getImageDescriptorRegistry();
fCImages = new CElementImageProvider();
fLibIcon = CPluginImages.DESC_OBJS_ARCHIVE; fLibIcon = CPluginImages.DESC_OBJS_ARCHIVE;
fLibWSrcIcon = CPluginImages.DESC_OBJS_ARCHIVE_WSRC; fLibWSrcIcon = CPluginImages.DESC_OBJS_ARCHIVE_WSRC;
fIncludeIcon = CPluginImages.DESC_OBJS_INCLUDES_FOLDER; fIncludeIcon = CPluginImages.DESC_OBJS_INCLUDES_FOLDER;
fQuoteIncludeIcon = CPluginImages.DESC_OBJS_QUOTE_INCLUDES_FOLDER;
fIncludeFileIcon = CPluginImages.DESC_OBJS_TUNIT_HEADER;
fMacroIcon = CPluginImages.DESC_OBJS_MACRO; fMacroIcon = CPluginImages.DESC_OBJS_MACRO;
fMacrosFileIcon = CPluginImages.DESC_OBJS_TUNIT_HEADER;
fFolderImage = CPluginImages.DESC_OBJS_SOURCE_ROOT; fFolderImage = CPluginImages.DESC_OBJS_SOURCE_ROOT;
fOutputImage = CPluginImages.DESC_OBJS_CONTAINER; fOutputImage = CPluginImages.DESC_OBJS_CONTAINER;
fContainerImage = CPluginImages.DESC_OBJS_LIBRARY; fContainerImage = CPluginImages.DESC_OBJS_LIBRARY;
@ -85,8 +86,12 @@ class CPElementLabelProvider extends LabelProvider implements IColorProvider {
switch (group.getEntryKind()) { switch (group.getEntryKind()) {
case IPathEntry.CDT_INCLUDE : case IPathEntry.CDT_INCLUDE :
return CPathEntryMessages.getString("CPElementLabelProvider.Includes"); //$NON-NLS-1$ return CPathEntryMessages.getString("CPElementLabelProvider.Includes"); //$NON-NLS-1$
case IPathEntry.CDT_INCLUDE_FILE :
return CPathEntryMessages.getString("CPElementLabelProvider.IncludeFiles"); //$NON-NLS-1$
case IPathEntry.CDT_MACRO : case IPathEntry.CDT_MACRO :
return CPathEntryMessages.getString("CPElementLabelProvider.PreprocessorSymbols"); //$NON-NLS-1$ return CPathEntryMessages.getString("CPElementLabelProvider.PreprocessorSymbols"); //$NON-NLS-1$
case IPathEntry.CDT_MACRO_FILE :
return CPathEntryMessages.getString("CPElementLabelProvider.MacrosFiles"); //$NON-NLS-1$
case IPathEntry.CDT_LIBRARY : case IPathEntry.CDT_LIBRARY :
return CPathEntryMessages.getString("CPElementLabelProvider.Libraries"); //$NON-NLS-1$ return CPathEntryMessages.getString("CPElementLabelProvider.Libraries"); //$NON-NLS-1$
case -1 : case -1 :
@ -161,6 +166,14 @@ class CPElementLabelProvider extends LabelProvider implements IColorProvider {
addParentInfo(cpentry, str); addParentInfo(cpentry, str);
return str.toString(); return str.toString();
} }
case IPathEntry.CDT_INCLUDE_FILE : {
IPath incFilePath = ((IPath)cpentry.getAttribute(CPElement.INCLUDE_FILE));
StringBuffer str = new StringBuffer();
addBaseString(incFilePath, cpentry, str);
addExport(cpentry, str);
addParentInfo(cpentry, str);
return str.toString();
}
case IPathEntry.CDT_MACRO : { case IPathEntry.CDT_MACRO : {
StringBuffer str = new StringBuffer((String)cpentry.getAttribute(CPElement.MACRO_NAME) + "=" //$NON-NLS-1$ StringBuffer str = new StringBuffer((String)cpentry.getAttribute(CPElement.MACRO_NAME) + "=" //$NON-NLS-1$
+ (String)cpentry.getAttribute(CPElement.MACRO_VALUE)); + (String)cpentry.getAttribute(CPElement.MACRO_VALUE));
@ -169,6 +182,14 @@ class CPElementLabelProvider extends LabelProvider implements IColorProvider {
addParentInfo(cpentry, str); addParentInfo(cpentry, str);
return str.toString(); return str.toString();
} }
case IPathEntry.CDT_MACRO_FILE : {
IPath macroFilePath = ((IPath)cpentry.getAttribute(CPElement.MACROS_FILE));
StringBuffer str = new StringBuffer();
addBaseString(macroFilePath, cpentry, str);
addExport(cpentry, str);
addParentInfo(cpentry, str);
return str.toString();
}
case IPathEntry.CDT_CONTAINER : { case IPathEntry.CDT_CONTAINER : {
StringBuffer str = new StringBuffer(path.toString()); StringBuffer str = new StringBuffer(path.toString());
try { try {
@ -307,9 +328,15 @@ class CPElementLabelProvider extends LabelProvider implements IColorProvider {
case IPathEntry.CDT_CONTAINER : case IPathEntry.CDT_CONTAINER :
return fContainerImage; return fContainerImage;
case IPathEntry.CDT_INCLUDE : case IPathEntry.CDT_INCLUDE :
return fIncludeIcon; if (((Boolean)cpentry.getAttribute(CPElement.SYSTEM_INCLUDE)).booleanValue())
return fIncludeIcon;
return fQuoteIncludeIcon;
case IPathEntry.CDT_INCLUDE_FILE :
return fIncludeFileIcon;
case IPathEntry.CDT_MACRO : case IPathEntry.CDT_MACRO :
return fMacroIcon; return fMacroIcon;
case IPathEntry.CDT_MACRO_FILE :
return fMacrosFileIcon;
default : default :
return null; return null;
} }
@ -350,6 +377,9 @@ class CPElementLabelProvider extends LabelProvider implements IColorProvider {
return CPluginImages.get(CPluginImages.IMG_OBJS_INCLUDES_CONTAINER); return CPluginImages.get(CPluginImages.IMG_OBJS_INCLUDES_CONTAINER);
case IPathEntry.CDT_MACRO : case IPathEntry.CDT_MACRO :
return fRegistry.get(fMacroIcon); return fRegistry.get(fMacroIcon);
case IPathEntry.CDT_INCLUDE_FILE :
case IPathEntry.CDT_MACRO_FILE :
return CPluginImages.get(CPluginImages.IMG_OBJS_INCLUDE);
case IPathEntry.CDT_LIBRARY : case IPathEntry.CDT_LIBRARY :
return CPluginImages.get(CPluginImages.IMG_OBJS_LIBRARY); return CPluginImages.get(CPluginImages.IMG_OBJS_LIBRARY);
case -1 : case -1 :

View file

@ -65,6 +65,7 @@ IncludeSymbolEntryPage.export=Export
IncludeSymbolEntryPage.up=Up IncludeSymbolEntryPage.up=Up
IncludeSymbolEntryPage.down=Down IncludeSymbolEntryPage.down=Down
IncludeSymbolsEntryPage.show_inherited.check=Show Inherited Paths IncludeSymbolsEntryPage.show_inherited.check=Show Inherited Paths
IncludeSymbolsEntryPage.show_unrelated.check=Show Unrelated Resources
IncludeSymbolEntryPage.addSymbol.title=Add Preprocessor Symbol IncludeSymbolEntryPage.addSymbol.title=Add Preprocessor Symbol
IncludeSymbolEntryPage.addSymbol.message=Symbol definition: IncludeSymbolEntryPage.addSymbol.message=Symbol definition:
IncludeSymbolEntryPage.editSymbol.title=Edit Preprocessor Symbol IncludeSymbolEntryPage.editSymbol.title=Edit Preprocessor Symbol
@ -108,6 +109,8 @@ CPElement.status.sourcePathMissing=Source path does not exist.
CPElement.status.outputPathMissing=Output path does not exist. CPElement.status.outputPathMissing=Output path does not exist.
CPElement.status.notOnSourcePath=Project path must exist on source path. CPElement.status.notOnSourcePath=Project path must exist on source path.
CPElement.status.includePathNotFound=Include path not found. CPElement.status.includePathNotFound=Include path not found.
CPElement.status.includeFilePathNotFound=Include file path not found.
CPElement.status.macrosFilePathNotFound=Macros file path not found.
CPElement.status.missingProjectPath=Missing project path. CPElement.status.missingProjectPath=Missing project path.
# ------- SourcePathEntryPage------- # ------- SourcePathEntryPage-------
@ -212,8 +215,10 @@ CPElementLabelProvider.source_attachment_root.label=Source attachment root:
CPElementLabelProvider.exclusion_filter.label=Exclusion filter: CPElementLabelProvider.exclusion_filter.label=Exclusion filter:
CPElementLabelProvider.exclusion_filter_separator=; CPElementLabelProvider.exclusion_filter_separator=;
CPElementLabelProvider.unknown_element.label=unknown element CPElementLabelProvider.unknown_element.label=unknown element
CPElementLabelProvider.Includes=Includes CPElementLabelProvider.Includes=Include Paths
CPElementLabelProvider.IncludeFiles=Include Files
CPElementLabelProvider.PreprocessorSymbols=Preprocessor Symbols CPElementLabelProvider.PreprocessorSymbols=Preprocessor Symbols
CPElementLabelProvider.MacrosFiles=Symbol Definitions Files
CPElementLabelProvider.Libraries=Libraries CPElementLabelProvider.Libraries=Libraries
CPElementLabelProvider.export.label= (Exported) CPElementLabelProvider.export.label= (Exported)

View file

@ -0,0 +1,30 @@
/***********************************************************************
* Copyright (c) 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.internal.ui.dialogs.cpaths;
import java.util.List;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.jface.resource.ImageDescriptor;
public abstract class CPathIncludeSymbolEntryBasePage extends CPathBasePage {
public CPathIncludeSymbolEntryBasePage(String title) {
super(title);
}
public CPathIncludeSymbolEntryBasePage(String title, ImageDescriptor image) {
super(title, image);
}
public abstract void init(ICElement cElement, List cPaths);
public abstract List getCPaths();
}

View file

@ -64,7 +64,7 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
import org.eclipse.ui.model.WorkbenchLabelProvider; import org.eclipse.ui.model.WorkbenchLabelProvider;
public class CPathIncludeSymbolEntryPage extends CPathBasePage { public class CPathIncludeSymbolEntryPage extends CPathIncludeSymbolEntryBasePage {
private TreeListDialogField fIncludeSymPathsList; private TreeListDialogField fIncludeSymPathsList;
private SelectionButtonDialogField fShowInheritedPaths; private SelectionButtonDialogField fShowInheritedPaths;

View file

@ -11,6 +11,7 @@ package org.eclipse.cdt.internal.ui.dialogs.cpaths;
import java.util.List; import java.util.List;
import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.model.IPathEntry; import org.eclipse.cdt.core.model.IPathEntry;
import org.eclipse.cdt.internal.ui.dialogs.IStatusChangeListener; import org.eclipse.cdt.internal.ui.dialogs.IStatusChangeListener;
import org.eclipse.cdt.ui.dialogs.ICOptionPage; import org.eclipse.cdt.ui.dialogs.ICOptionPage;
@ -23,7 +24,7 @@ import org.eclipse.swt.widgets.Control;
public class NewIncludesSymbolsTabBlock extends AbstractPathOptionBlock implements IStatusChangeListener { public class NewIncludesSymbolsTabBlock extends AbstractPathOptionBlock implements IStatusChangeListener {
private CPathIncludeSymbolEntryPage fIncludeSymbols; private CPathIncludeSymbolEntryBasePage fIncludeSymbols;
private List fCPaths; private List fCPaths;
@ -31,7 +32,6 @@ public class NewIncludesSymbolsTabBlock extends AbstractPathOptionBlock implemen
public NewIncludesSymbolsTabBlock(IStatusChangeListener context, int pageToShow) { public NewIncludesSymbolsTabBlock(IStatusChangeListener context, int pageToShow) {
super(context, pageToShow); super(context, pageToShow);
fIncludeSymbols = new CPathIncludeSymbolEntryPage(this);
} }
protected void addTab(ICOptionPage tab) { protected void addTab(ICOptionPage tab) {
@ -76,7 +76,13 @@ public class NewIncludesSymbolsTabBlock extends AbstractPathOptionBlock implemen
protected void initialize(ICElement element, List cPaths) { protected void initialize(ICElement element, List cPaths) {
fCPaths = cPaths; fCPaths = cPaths;
if (fIncludeSymbols != null) { if (element instanceof ICProject) {
fIncludeSymbols = new CPathIncludeSymbolEntryPage(this);
}
else {
fIncludeSymbols = new CPathIncludeSymbolEntryPerFilePage(this);
}
if (fIncludeSymbols != null) {
fIncludeSymbols.init(element, cPaths); fIncludeSymbols.init(element, cPaths);
} }
doStatusLineUpdate(); doStatusLineUpdate();
@ -105,4 +111,5 @@ public class NewIncludesSymbolsTabBlock extends AbstractPathOptionBlock implemen
updateBuildPathStatus(); updateBuildPathStatus();
doStatusLineUpdate(); doStatusLineUpdate();
} }
} }