mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-31 21:05:37 +02:00
Discovered path container wizard page now properly displays per file scanner info.
Fixed couple of NPEs.
This commit is contained in:
parent
8c3f6a184a
commit
04cd3adec5
9 changed files with 341 additions and 224 deletions
|
@ -707,9 +707,14 @@ public class PerFileSICollector implements IScannerInfoCollector2, IScannerInfoC
|
|||
* @return
|
||||
*/
|
||||
private CCommandDSC getCommand(IPath path) {
|
||||
try {
|
||||
IFile file = project.getWorkspace().getRoot().getFile(path);
|
||||
return getCommand(file);
|
||||
}
|
||||
catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private CCommandDSC getCommand(IFile file) {
|
||||
CCommandDSC cmd = null;
|
||||
|
|
BIN
build/org.eclipse.cdt.make.ui/icons/obj16/lib_obj.gif
Normal file
BIN
build/org.eclipse.cdt.make.ui/icons/obj16/lib_obj.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 338 B |
|
@ -427,8 +427,9 @@
|
|||
point="org.eclipse.cdt.ui.PathContainerPage">
|
||||
<PathContainerPage
|
||||
class="org.eclipse.cdt.make.ui.dialogs.DiscoveredPathContainerPage"
|
||||
name="%DiscoveredScannerInfoContainer.name"
|
||||
id="org.eclipse.cdt.make.core.DISCOVERED_SCANNER_INFO"/>
|
||||
icon="icons/obj16/lib_obj.gif"
|
||||
id="org.eclipse.cdt.make.core.DISCOVERED_SCANNER_INFO"
|
||||
name="%DiscoveredScannerInfoContainer.name"/>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.core.runtime.preferences">
|
||||
|
|
|
@ -26,8 +26,12 @@ public class DiscoveredElement {
|
|||
public static final int CONTAINER = 1;
|
||||
public static final int INCLUDE_PATH = 2;
|
||||
public static final int SYMBOL_DEFINITION = 3;
|
||||
public static final int PATHS_GROUP = 4;
|
||||
public static final int SYMBOLS_GROUP = 5;
|
||||
public static final int INCLUDE_FILE = 4;
|
||||
public static final int MACROS_FILE = 5;
|
||||
public static final int PATHS_GROUP = 10;
|
||||
public static final int SYMBOLS_GROUP = 11;
|
||||
public static final int INCLUDE_FILE_GROUP = 12;
|
||||
public static final int MACROS_FILE_GROUP = 13;
|
||||
|
||||
private IProject fProject;
|
||||
private String fEntry;
|
||||
|
@ -53,72 +57,59 @@ public class DiscoveredElement {
|
|||
boolean removed,
|
||||
boolean system) {
|
||||
DiscoveredElement rv = null;
|
||||
int parentKind = 0;
|
||||
switch (kind) {
|
||||
case CONTAINER: {
|
||||
rv = new DiscoveredElement(project, entry, kind, removed, system);
|
||||
DiscoveredElement group = new DiscoveredElement(project, null, PATHS_GROUP, false, false);
|
||||
rv.fChildren.add(group);
|
||||
group.fParent = rv;
|
||||
group.setParent(rv);
|
||||
group = new DiscoveredElement(project, null, SYMBOLS_GROUP, false, false);
|
||||
rv.fChildren.add(group);
|
||||
group.fParent = rv;
|
||||
group.setParent(rv);
|
||||
group = new DiscoveredElement(project, null, INCLUDE_FILE_GROUP, false, false);
|
||||
rv.fChildren.add(group);
|
||||
group.setParent(rv);
|
||||
group = new DiscoveredElement(project, null, MACROS_FILE_GROUP, false, false);
|
||||
rv.fChildren.add(group);
|
||||
group.setParent(rv);
|
||||
}
|
||||
return rv;
|
||||
case INCLUDE_PATH:
|
||||
parentKind = PATHS_GROUP;
|
||||
break;
|
||||
case INCLUDE_PATH: {
|
||||
case SYMBOL_DEFINITION:
|
||||
parentKind = SYMBOLS_GROUP;
|
||||
break;
|
||||
case INCLUDE_FILE:
|
||||
parentKind = INCLUDE_FILE_GROUP;
|
||||
break;
|
||||
case MACROS_FILE:
|
||||
parentKind = MACROS_FILE_GROUP;
|
||||
break;
|
||||
}
|
||||
if (parentKind != 0) {
|
||||
if (parent != null) {
|
||||
DiscoveredElement group = null;
|
||||
if (parent.getEntryKind() == PATHS_GROUP) {
|
||||
parent = parent.getParent();
|
||||
if (parent.getEntryKind() == parentKind) {
|
||||
group = parent;
|
||||
}
|
||||
else if (parent.getEntryKind() == CONTAINER) {
|
||||
for (Iterator i = parent.fChildren.iterator(); i.hasNext(); ) {
|
||||
DiscoveredElement child = (DiscoveredElement) i.next();
|
||||
if (child.getEntryKind() == PATHS_GROUP) {
|
||||
if (child.getEntryKind() == parentKind) {
|
||||
group = child;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (group == null) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
if (parent.getEntryKind() == CONTAINER) {
|
||||
if (group != null) {
|
||||
rv = new DiscoveredElement(project, entry, kind, removed, system);
|
||||
group.fChildren.add(rv);
|
||||
rv.setParent(group);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SYMBOL_DEFINITION: {
|
||||
if (parent != null) {
|
||||
DiscoveredElement group = null;
|
||||
if (parent.getEntryKind() == SYMBOLS_GROUP) {
|
||||
parent = parent.getParent();
|
||||
group = parent;
|
||||
}
|
||||
else if (parent.getEntryKind() == CONTAINER) {
|
||||
for (Iterator i = parent.fChildren.iterator(); i.hasNext(); ) {
|
||||
DiscoveredElement child = (DiscoveredElement) i.next();
|
||||
if (child.getEntryKind() == SYMBOLS_GROUP) {
|
||||
group = child;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (group == null) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
if (parent.getEntryKind() == CONTAINER) {
|
||||
rv = new DiscoveredElement(project, entry, kind, removed, system);
|
||||
group.fChildren.add(rv);
|
||||
rv.setParent(group);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
/**
|
||||
|
@ -184,6 +175,8 @@ public class DiscoveredElement {
|
|||
switch(fEntryKind) {
|
||||
case INCLUDE_PATH:
|
||||
case SYMBOL_DEFINITION:
|
||||
case INCLUDE_FILE:
|
||||
case MACROS_FILE:
|
||||
return new Object[0];
|
||||
}
|
||||
return fChildren.toArray();
|
||||
|
@ -193,6 +186,8 @@ public class DiscoveredElement {
|
|||
switch(fEntryKind) {
|
||||
case INCLUDE_PATH:
|
||||
case SYMBOL_DEFINITION:
|
||||
case INCLUDE_FILE:
|
||||
case MACROS_FILE:
|
||||
return false;
|
||||
}
|
||||
return (fChildren.size() > 0);
|
||||
|
|
|
@ -35,7 +35,9 @@ public class DiscoveredElementLabelProvider extends LabelProvider implements ICo
|
|||
private final Color inDirect = new Color(Display.getDefault(), new RGB(170, 170, 170));
|
||||
|
||||
private ImageDescriptor fIncludeIcon, fMacroIcon, fContainerImage;
|
||||
private ImageDescriptor fRemovedIncludeIcon, fRemovedMacroIcon;
|
||||
private ImageDescriptor fIncludeGroupIcon, fMacroGroupIcon;
|
||||
private ImageDescriptor fIncludeAndMacrosFileIcon;
|
||||
private ImageDescriptor fIncludeAndMacrosFileGroupIcon;
|
||||
private ImageDescriptorRegistry fRegistry;
|
||||
|
||||
private final String DISABLED_LABEL = MakeUIPlugin.
|
||||
|
@ -43,9 +45,14 @@ public class DiscoveredElementLabelProvider extends LabelProvider implements ICo
|
|||
|
||||
public DiscoveredElementLabelProvider() {
|
||||
fRegistry = CUIPlugin.getImageDescriptorRegistry();
|
||||
fIncludeIcon = CPluginImages.DESC_OBJS_INCLUDES_FOLDER;
|
||||
fMacroIcon = CPluginImages.DESC_OBJS_MACRO;
|
||||
fContainerImage = CPluginImages.DESC_OBJS_LIBRARY;
|
||||
fIncludeGroupIcon = CPluginImages.DESC_OBJS_INCLUDES_CONTAINER;
|
||||
fMacroGroupIcon = CPluginImages.DESC_OBJS_MACRO;
|
||||
fIncludeAndMacrosFileGroupIcon = CPluginImages.DESC_OBJS_INCLUDE;
|
||||
fIncludeIcon = CPluginImages.DESC_OBJS_INCLUDES_FOLDER;
|
||||
// fQuoteIncludeIcon = CPluginImages.DESC_OBJS_QUOTE_INCLUDES_FOLDER;
|
||||
fIncludeAndMacrosFileIcon = CPluginImages.DESC_OBJS_TUNIT_HEADER;
|
||||
fMacroIcon = fMacroGroupIcon;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -69,7 +76,7 @@ public class DiscoveredElementLabelProvider extends LabelProvider implements ICo
|
|||
Image image = null;
|
||||
switch (elem.getEntryKind()) {
|
||||
case DiscoveredElement.PATHS_GROUP:
|
||||
image = CPluginImages.get(CPluginImages.IMG_OBJS_INCLUDES_CONTAINER);
|
||||
image = fRegistry.get(fIncludeGroupIcon);
|
||||
break;
|
||||
case DiscoveredElement.CONTAINER:
|
||||
image = fRegistry.get(fContainerImage);
|
||||
|
@ -81,6 +88,14 @@ public class DiscoveredElementLabelProvider extends LabelProvider implements ICo
|
|||
case DiscoveredElement.SYMBOL_DEFINITION:
|
||||
image = fRegistry.get(fMacroIcon);
|
||||
break;
|
||||
case DiscoveredElement.INCLUDE_FILE:
|
||||
case DiscoveredElement.MACROS_FILE:
|
||||
image = fRegistry.get(fIncludeAndMacrosFileIcon);
|
||||
break;
|
||||
case DiscoveredElement.INCLUDE_FILE_GROUP:
|
||||
case DiscoveredElement.MACROS_FILE_GROUP:
|
||||
image = fRegistry.get(fIncludeAndMacrosFileGroupIcon);
|
||||
break;
|
||||
}
|
||||
if (image != null && elem.isRemoved()) {
|
||||
image = new DiscoveredElementImageDescriptor(image, true).createImage();
|
||||
|
@ -99,9 +114,15 @@ public class DiscoveredElementLabelProvider extends LabelProvider implements ICo
|
|||
return CPathEntryMessages.getString("CPElementLabelProvider.Includes"); //$NON-NLS-1$
|
||||
case DiscoveredElement.SYMBOLS_GROUP:
|
||||
return CPathEntryMessages.getString("CPElementLabelProvider.PreprocessorSymbols"); //$NON-NLS-1$
|
||||
case DiscoveredElement.INCLUDE_FILE_GROUP:
|
||||
return CPathEntryMessages.getString("CPElementLabelProvider.IncludeFiles"); //$NON-NLS-1$
|
||||
case DiscoveredElement.MACROS_FILE_GROUP:
|
||||
return CPathEntryMessages.getString("CPElementLabelProvider.MacrosFiles"); //$NON-NLS-1$
|
||||
case DiscoveredElement.CONTAINER:
|
||||
case DiscoveredElement.INCLUDE_PATH:
|
||||
case DiscoveredElement.SYMBOL_DEFINITION:
|
||||
case DiscoveredElement.INCLUDE_FILE:
|
||||
case DiscoveredElement.MACROS_FILE:
|
||||
return elem.getEntry() + (elem.isRemoved() ? addAnnotation(DISABLED_LABEL) : ""); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
@ -125,6 +146,8 @@ public class DiscoveredElementLabelProvider extends LabelProvider implements ICo
|
|||
switch (elem.getEntryKind()) {
|
||||
case DiscoveredElement.INCLUDE_PATH:
|
||||
case DiscoveredElement.SYMBOL_DEFINITION:
|
||||
case DiscoveredElement.INCLUDE_FILE:
|
||||
case DiscoveredElement.MACROS_FILE:
|
||||
if (elem.isRemoved()) {
|
||||
return inDirect;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,9 @@ public class DiscoveredElementSorter extends ViewerSorter {
|
|||
private static final int CONTAINER = 0;
|
||||
private static final int PATHS_GROUP = 1;
|
||||
private static final int SYMBOLS_GROUP = 2;
|
||||
private static final int OTHER = 5;
|
||||
private static final int INCLUDE_FILE_GROUP = 3;
|
||||
private static final int MACROS_FILE_GROUP = 4;
|
||||
private static final int OTHER = 10;
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.ViewerSorter#category(java.lang.Object)
|
||||
|
@ -37,6 +39,10 @@ public class DiscoveredElementSorter extends ViewerSorter {
|
|||
return PATHS_GROUP;
|
||||
case DiscoveredElement.SYMBOLS_GROUP:
|
||||
return SYMBOLS_GROUP;
|
||||
case DiscoveredElement.INCLUDE_FILE_GROUP:
|
||||
return INCLUDE_FILE_GROUP;
|
||||
case DiscoveredElement.MACROS_FILE_GROUP:
|
||||
return MACROS_FILE_GROUP;
|
||||
}
|
||||
}
|
||||
return OTHER;
|
||||
|
@ -50,6 +56,8 @@ public class DiscoveredElementSorter extends ViewerSorter {
|
|||
switch (firstElem.getEntryKind()) {
|
||||
case DiscoveredElement.INCLUDE_PATH:
|
||||
case DiscoveredElement.SYMBOL_DEFINITION:
|
||||
case DiscoveredElement.INCLUDE_FILE:
|
||||
case DiscoveredElement.MACROS_FILE:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import java.util.Collections;
|
|||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.core.model.CModelException;
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
|
@ -33,6 +34,7 @@ import org.eclipse.cdt.make.core.MakeCorePlugin;
|
|||
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorCleaner;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredPathInfo;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerFileDiscoveredPathInfo;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IPerProjectDiscoveredPathInfo;
|
||||
import org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredPathContainer;
|
||||
import org.eclipse.cdt.make.internal.core.scannerconfig.ScannerConfigUtil;
|
||||
|
@ -46,6 +48,7 @@ import org.eclipse.cdt.make.internal.ui.scannerconfig.DiscoveredElementSorter;
|
|||
import org.eclipse.cdt.ui.wizards.IPathEntryContainerPage;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.jface.action.Action;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.action.IMenuListener;
|
||||
|
@ -107,7 +110,10 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr
|
|||
private IContainerEntry fPathEntry;
|
||||
|
||||
private TreeListDialogField fDiscoveredContainerList;
|
||||
private IDiscoveredPathInfo info = null;
|
||||
private boolean dirty;
|
||||
private List deletedEntries;
|
||||
|
||||
private CopyTextAction copyTextAction;
|
||||
private HandlerSubmission submission;
|
||||
|
||||
|
@ -136,6 +142,7 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr
|
|||
fDiscoveredContainerList.setTreeExpansionLevel(2);
|
||||
fDiscoveredContainerList.setViewerSorter(new DiscoveredElementSorter());
|
||||
dirty = false;
|
||||
deletedEntries = new ArrayList();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -151,6 +158,11 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr
|
|||
*/
|
||||
public void initialize(ICProject project, IPathEntry[] currentEntries) {
|
||||
fCProject = project;
|
||||
try {
|
||||
info = MakeCorePlugin.getDefault().getDiscoveryManager().getDiscoveredInfo(fCProject.getProject());
|
||||
} catch (CoreException e) {
|
||||
setErrorMessage("Error initializing Discovered paths container");
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -160,11 +172,41 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr
|
|||
if (!dirty) {
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
IDiscoveredPathInfo info = MakeCorePlugin.getDefault().
|
||||
getDiscoveryManager().getDiscoveredInfo(fCProject.getProject());
|
||||
// first process deletes
|
||||
if (deletedEntries.size() > 0) {
|
||||
IProject project = fCProject.getProject();
|
||||
SCProfileInstance profileInstance = ScannerConfigProfileManager.getInstance().
|
||||
getSCProfileInstance(project, ScannerConfigProfileManager.NULL_PROFILE_ID); // use selected profile for the project
|
||||
IScannerInfoCollector collector = profileInstance.getScannerInfoCollector();
|
||||
if (collector instanceof IScannerInfoCollectorCleaner) {
|
||||
IScannerInfoCollectorCleaner collectorUtil = (IScannerInfoCollectorCleaner) collector;
|
||||
boolean exitLoop = false;
|
||||
for (Iterator i = deletedEntries.iterator(); i.hasNext() && !exitLoop; ) {
|
||||
DiscoveredElement elem = (DiscoveredElement) i.next();
|
||||
switch (elem.getEntryKind()) {
|
||||
case DiscoveredElement.CONTAINER:
|
||||
collectorUtil.deleteAll(project);
|
||||
exitLoop = true;
|
||||
break;
|
||||
case DiscoveredElement.PATHS_GROUP:
|
||||
collectorUtil.deleteAllPaths(project);
|
||||
break;
|
||||
case DiscoveredElement.SYMBOLS_GROUP:
|
||||
collectorUtil.deleteAllSymbols(project);
|
||||
break;
|
||||
case DiscoveredElement.INCLUDE_PATH:
|
||||
collectorUtil.deletePath(project, elem.getEntry());
|
||||
break;
|
||||
case DiscoveredElement.SYMBOL_DEFINITION:
|
||||
collectorUtil.deleteSymbol(project, elem.getEntry());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (info instanceof IPerProjectDiscoveredPathInfo) {
|
||||
IPerProjectDiscoveredPathInfo projetcPathInfo = (IPerProjectDiscoveredPathInfo) info;
|
||||
IPerProjectDiscoveredPathInfo projectPathInfo = (IPerProjectDiscoveredPathInfo) info;
|
||||
|
||||
LinkedHashMap includes = new LinkedHashMap();
|
||||
LinkedHashMap symbols = new LinkedHashMap();
|
||||
|
@ -202,8 +244,8 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr
|
|||
}
|
||||
}
|
||||
}
|
||||
projetcPathInfo.setIncludeMap(includes);
|
||||
projetcPathInfo.setSymbolMap(symbols);
|
||||
projectPathInfo.setIncludeMap(includes);
|
||||
projectPathInfo.setSymbolMap(symbols);
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -215,9 +257,6 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr
|
|||
} catch (CoreException e) {
|
||||
MakeCorePlugin.log(e);
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
MakeCorePlugin.log(e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -251,22 +290,19 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr
|
|||
* @return
|
||||
*/
|
||||
private DiscoveredElement populateDiscoveredElements(IContainerEntry pathEntry) {
|
||||
IDiscoveredPathInfo info;
|
||||
DiscoveredElement container = null;
|
||||
try {
|
||||
container = DiscoveredElement.createNew(null, fCProject.getProject(), null,
|
||||
DiscoveredElement.CONTAINER, false, false);
|
||||
info = MakeCorePlugin.getDefault().
|
||||
getDiscoveryManager().getDiscoveredInfo(fCProject.getProject());
|
||||
try {
|
||||
IPathEntryContainer peContainer = CoreModel.getPathEntryContainer(pathEntry.getPath(), fCProject);
|
||||
if (peContainer != null) {
|
||||
container.setEntry(peContainer.getDescription());
|
||||
}
|
||||
if (info != null) {
|
||||
if (info instanceof IPerProjectDiscoveredPathInfo) {
|
||||
IPerProjectDiscoveredPathInfo projetcPathInfo = (IPerProjectDiscoveredPathInfo) info;
|
||||
IPerProjectDiscoveredPathInfo projectPathInfo = (IPerProjectDiscoveredPathInfo) info;
|
||||
// get include paths
|
||||
LinkedHashMap paths = projetcPathInfo.getIncludeMap();
|
||||
LinkedHashMap paths = projectPathInfo.getIncludeMap();
|
||||
for (Iterator i = paths.keySet().iterator(); i.hasNext(); ) {
|
||||
String include = (String) i.next();
|
||||
Boolean removed = (Boolean) paths.get(include);
|
||||
|
@ -275,7 +311,7 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr
|
|||
DiscoveredElement.INCLUDE_PATH, removed.booleanValue(), false);
|
||||
}
|
||||
// get defined symbols
|
||||
LinkedHashMap symbols = projetcPathInfo.getSymbolMap();
|
||||
LinkedHashMap symbols = projectPathInfo.getSymbolMap();
|
||||
for (Iterator i = symbols.keySet().iterator(); i.hasNext(); ) {
|
||||
String symbol = (String) i.next();
|
||||
SymbolEntry se = (SymbolEntry) symbols.get(symbol);
|
||||
|
@ -290,13 +326,44 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr
|
|||
DiscoveredElement.SYMBOL_DEFINITION, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (info instanceof IPerFileDiscoveredPathInfo) {
|
||||
IPerFileDiscoveredPathInfo filePathInfo = (IPerFileDiscoveredPathInfo) info;
|
||||
// get include paths
|
||||
IPath[] includes = filePathInfo.getIncludePaths();
|
||||
for (int i = 0; i < includes.length; i++) {
|
||||
String include = includes[i].toPortableString();
|
||||
DiscoveredElement.createNew(container, fCProject.getProject(), include,
|
||||
DiscoveredElement.INCLUDE_PATH, false, false);
|
||||
}
|
||||
// get defined symbols
|
||||
Map symbols = filePathInfo.getSymbols();
|
||||
for (Iterator iter = symbols.keySet().iterator(); iter.hasNext();) {
|
||||
String key = (String) iter.next();
|
||||
String value = (String) symbols.get(key);
|
||||
String symbol = (value != null && value.length() > 0) ? key + "=" + value : key; //$NON-NLS-1$
|
||||
DiscoveredElement.createNew(container, fCProject.getProject(), symbol,
|
||||
DiscoveredElement.SYMBOL_DEFINITION, false, false);
|
||||
}
|
||||
// get include files
|
||||
IPath[] includeFiles = filePathInfo.getIncludeFiles(fCProject.getPath());
|
||||
for (int i = 0; i < includeFiles.length; i++) {
|
||||
String includeFile = includeFiles[i].toPortableString();
|
||||
DiscoveredElement.createNew(container, fCProject.getProject(), includeFile,
|
||||
DiscoveredElement.INCLUDE_FILE, false, false);
|
||||
}
|
||||
// get macros files
|
||||
IPath[] macrosFiles = filePathInfo.getMacroFiles(fCProject.getPath());
|
||||
for (int i = 0; i < macrosFiles.length; i++) {
|
||||
String macrosFile = macrosFiles[i].toPortableString();
|
||||
DiscoveredElement.createNew(container, fCProject.getProject(), macrosFile,
|
||||
DiscoveredElement.MACROS_FILE, false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (CModelException e) {
|
||||
MakeUIPlugin.log(e.getStatus());
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
MakeUIPlugin.log(e);
|
||||
}
|
||||
return container;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
|
@ -320,6 +387,8 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr
|
|||
switch (elem.getEntryKind()) {
|
||||
case DiscoveredElement.PATHS_GROUP:
|
||||
case DiscoveredElement.SYMBOLS_GROUP:
|
||||
case DiscoveredElement.INCLUDE_FILE_GROUP:
|
||||
case DiscoveredElement.MACROS_FILE_GROUP:
|
||||
return elem.getChildren().length != 0;
|
||||
}
|
||||
}
|
||||
|
@ -567,18 +636,14 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr
|
|||
|
||||
private boolean deleteEntry() {
|
||||
boolean rc = false;
|
||||
IProject project = fCProject.getProject();
|
||||
SCProfileInstance profileInstance = ScannerConfigProfileManager.getInstance().
|
||||
getSCProfileInstance(project, ScannerConfigProfileManager.NULL_PROFILE_ID); // use selected profile for the project
|
||||
IScannerInfoCollector collector = profileInstance.getScannerInfoCollector();
|
||||
if (collector instanceof IScannerInfoCollectorCleaner) {
|
||||
IScannerInfoCollectorCleaner collectorUtil = (IScannerInfoCollectorCleaner) collector;
|
||||
List newSelection = new ArrayList();
|
||||
List selElements = fDiscoveredContainerList.getSelectedElements();
|
||||
boolean skipIncludes = false, skipSymbols = false;
|
||||
for (int i = 0; i < selElements.size(); ++i) {
|
||||
DiscoveredElement elem = (DiscoveredElement) selElements.get(i);
|
||||
if (elem.getEntryKind() == DiscoveredElement.CONTAINER) {
|
||||
collectorUtil.deleteAll(project);
|
||||
deletedEntries.add(elem);
|
||||
|
||||
Object[] children = elem.getChildren();
|
||||
for (int j = 0; j < children.length; j++) {
|
||||
if (children[j] instanceof DiscoveredElement) {
|
||||
|
@ -590,25 +655,31 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr
|
|||
rc = true;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
DiscoveredElement parent = elem.getParent();
|
||||
if (parent != null) {
|
||||
Object[] children = parent.getChildren();
|
||||
if (elem.delete()) {
|
||||
switch (elem.getEntryKind()) {
|
||||
case DiscoveredElement.PATHS_GROUP:
|
||||
collectorUtil.deleteAllPaths(project);
|
||||
deletedEntries.add(elem);
|
||||
skipIncludes = true;
|
||||
break;
|
||||
case DiscoveredElement.SYMBOLS_GROUP:
|
||||
collectorUtil.deleteAllSymbols(project);
|
||||
deletedEntries.add(elem);
|
||||
skipSymbols = true;
|
||||
break;
|
||||
case DiscoveredElement.INCLUDE_PATH:
|
||||
collectorUtil.deletePath(project, elem.getEntry());
|
||||
if (!skipIncludes) {
|
||||
deletedEntries.add(elem);
|
||||
}
|
||||
break;
|
||||
case DiscoveredElement.SYMBOL_DEFINITION:
|
||||
collectorUtil.deleteSymbol(project, elem.getEntry());
|
||||
if (!skipSymbols) {
|
||||
deletedEntries.add(elem);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
rc = true;
|
||||
// set new selection
|
||||
for (int j = 0; j < children.length; ++j) {
|
||||
|
@ -630,9 +701,7 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fDiscoveredContainerList.postSetSelection(new StructuredSelection(newSelection));
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -654,6 +723,9 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr
|
|||
* @return
|
||||
*/
|
||||
private boolean canMoveUpDown(List selElements, int direction) {
|
||||
if (info instanceof IPerFileDiscoveredPathInfo) {
|
||||
return false;
|
||||
}
|
||||
if (selElements.size() == 0) {
|
||||
return false;
|
||||
}
|
||||
|
@ -686,6 +758,9 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr
|
|||
* @return
|
||||
*/
|
||||
private boolean canRemoveRestore(List selElements) {
|
||||
if (info instanceof IPerFileDiscoveredPathInfo) {
|
||||
return false;
|
||||
}
|
||||
if (selElements.size() == 0) {
|
||||
return false;
|
||||
}
|
||||
|
@ -706,6 +781,13 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr
|
|||
* @return
|
||||
*/
|
||||
private boolean canDelete(List selElements) {
|
||||
if (info instanceof IPerFileDiscoveredPathInfo) {
|
||||
if (selElements.size() > 0 &&
|
||||
((DiscoveredElement) selElements.get(0)).getEntryKind() == DiscoveredElement.CONTAINER) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (selElements.size() == 0) {
|
||||
return false;
|
||||
}
|
||||
|
@ -719,7 +801,6 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr
|
|||
*/
|
||||
public class CopyTextAction extends Action {
|
||||
static final String ACTION_ID = "org.eclipse.ui.edit.copy"; //$NON-NLS-1$
|
||||
private Shell shell;
|
||||
private Clipboard clipboard;
|
||||
private String discoveredEntry = null;
|
||||
|
||||
|
@ -729,7 +810,6 @@ public class DiscoveredPathContainerPage extends WizardPage implements IPathEntr
|
|||
setToolTipText(MakeUIPlugin.getResourceString("CopyDiscoveredPathAction.tooltip")); //$NON-NLS-1$
|
||||
setActionDefinitionId(ACTION_ID);
|
||||
clipboard = new Clipboard(shell.getDisplay());
|
||||
this.shell = shell;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2005-06-08 Vladimir Hirsl
|
||||
Fix for NPE in CPElement.java
|
||||
|
||||
* src/org/eclipse/cdt/internal/ui/dialogs/cpaths/CPElement.java
|
||||
|
||||
2005-06-07 Alain Magloire
|
||||
Patch form Chris Recoskie to provide an ID to the wizard.
|
||||
* src/org/eclipse/cdt/ui/wizards/NewCProjectWizardPage.java
|
||||
|
|
|
@ -764,7 +764,7 @@ public class CPElement {
|
|||
res = root.findMember(path);
|
||||
break;
|
||||
}
|
||||
CPElement elem = new CPElement(element.getCProject(), curr.getEntryKind(), path, res);
|
||||
CPElement elem = new CPElement((element == null) ? null : element.getCProject(), curr.getEntryKind(), path, res);
|
||||
elem.setAttribute(SOURCEATTACHMENT, sourceAttachment);
|
||||
elem.setAttribute(EXCLUSION, exclusion);
|
||||
elem.setAttribute(INCLUDE, include);
|
||||
|
|
Loading…
Add table
Reference in a new issue