mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-10 17:55:39 +02:00
some changes to try and support resource level include & symbols property page
This commit is contained in:
parent
e4d8025f1e
commit
c3b7353bc6
3 changed files with 44 additions and 40 deletions
|
@ -40,7 +40,7 @@ abstract public class AbstractPathOptionBlock extends TabFolderOptionBlock imple
|
||||||
private StatusInfo fCPathStatus;
|
private StatusInfo fCPathStatus;
|
||||||
private StatusInfo fBuildPathStatus;
|
private StatusInfo fBuildPathStatus;
|
||||||
|
|
||||||
private ICProject fCurrCProject;
|
private ICElement fCurrCElement;
|
||||||
|
|
||||||
private String fUserSettingsTimeStamp;
|
private String fUserSettingsTimeStamp;
|
||||||
private long fFileTimeStamp;
|
private long fFileTimeStamp;
|
||||||
|
@ -71,7 +71,7 @@ abstract public class AbstractPathOptionBlock extends TabFolderOptionBlock imple
|
||||||
public IPathEntry[] getRawCPath() throws CModelException{
|
public IPathEntry[] getRawCPath() throws CModelException{
|
||||||
List elements = getCPaths();
|
List elements = getCPaths();
|
||||||
|
|
||||||
IPathEntry[] entries = fCurrCProject.getRawPathEntries();
|
IPathEntry[] entries = getCProject().getRawPathEntries();
|
||||||
List cpath = new ArrayList(elements.size() + entries.length);
|
List cpath = new ArrayList(elements.size() + entries.length);
|
||||||
|
|
||||||
int[] applyTypes = getAppliedFilteredTypes();
|
int[] applyTypes = getAppliedFilteredTypes();
|
||||||
|
@ -122,7 +122,7 @@ abstract public class AbstractPathOptionBlock extends TabFolderOptionBlock imple
|
||||||
* existing Java project - the path entries of the existing project
|
* existing Java project - the path entries of the existing project
|
||||||
*/
|
*/
|
||||||
public void init(ICElement element, IPathEntry[] cpathEntries) {
|
public void init(ICElement element, IPathEntry[] cpathEntries) {
|
||||||
setCProject(element.getCProject());
|
setCElement(element);
|
||||||
List newCPath = null;
|
List newCPath = null;
|
||||||
|
|
||||||
if (cpathEntries == null) {
|
if (cpathEntries == null) {
|
||||||
|
@ -130,6 +130,7 @@ abstract public class AbstractPathOptionBlock extends TabFolderOptionBlock imple
|
||||||
cpathEntries = getCProject().getRawPathEntries();
|
cpathEntries = getCProject().getRawPathEntries();
|
||||||
} catch (CModelException e) {
|
} catch (CModelException e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (cpathEntries != null) {
|
if (cpathEntries != null) {
|
||||||
newCPath = getFilteredElements(cpathEntries, getFilteredTypes());
|
newCPath = getFilteredElements(cpathEntries, getFilteredTypes());
|
||||||
|
@ -149,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, fCurrCProject));
|
newCPath.add(CPElement.createFromExisting(curr, getCProject()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return newCPath;
|
return newCPath;
|
||||||
|
@ -187,28 +188,32 @@ abstract public class AbstractPathOptionBlock extends TabFolderOptionBlock imple
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasChangesInCPathFile() {
|
public boolean hasChangesInCPathFile() {
|
||||||
IFile file = fCurrCProject.getProject().getFile(".cdtproject"); //$NON-NLS-1$
|
IFile file = getProject().getFile(".cdtproject"); //$NON-NLS-1$
|
||||||
return fFileTimeStamp != file.getModificationStamp();
|
return fFileTimeStamp != file.getModificationStamp();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initializeTimeStamps() {
|
public void initializeTimeStamps() {
|
||||||
IFile file = fCurrCProject.getProject().getFile(".cdtproject"); //$NON-NLS-1$
|
IFile file = getProject().getFile(".cdtproject"); //$NON-NLS-1$
|
||||||
fFileTimeStamp = file.getModificationStamp();
|
fFileTimeStamp = file.getModificationStamp();
|
||||||
fUserSettingsTimeStamp = getEncodedSettings();
|
fUserSettingsTimeStamp = getEncodedSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract protected void addTabs();
|
abstract protected void addTabs();
|
||||||
|
|
||||||
protected void setCProject(ICProject project) {
|
protected void setCElement(ICElement element) {
|
||||||
fCurrCProject = project;
|
fCurrCElement = element;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ICElement getCElement() {
|
||||||
|
return fCurrCElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ICProject getCProject() {
|
protected ICProject getCProject() {
|
||||||
return fCurrCProject;
|
return fCurrCElement.getCProject();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IProject getProject() {
|
public IProject getProject() {
|
||||||
return fCurrCProject.getProject();
|
return getCProject().getProject();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void doStatusLineUpdate() {
|
protected void doStatusLineUpdate() {
|
||||||
|
@ -256,7 +261,7 @@ abstract public class AbstractPathOptionBlock extends TabFolderOptionBlock imple
|
||||||
entries[i] = currElement.getPathEntry();
|
entries[i] = currElement.getPathEntry();
|
||||||
}
|
}
|
||||||
|
|
||||||
ICModelStatus status = CoreModel.validatePathEntries(fCurrCProject, entries);
|
ICModelStatus status = CoreModel.validatePathEntries(getCProject(), entries);
|
||||||
if (!status.isOK()) {
|
if (!status.isOK()) {
|
||||||
fBuildPathStatus.setError(status.getMessage());
|
fBuildPathStatus.setError(status.getMessage());
|
||||||
return;
|
return;
|
||||||
|
@ -289,7 +294,7 @@ abstract public class AbstractPathOptionBlock extends TabFolderOptionBlock imple
|
||||||
|
|
||||||
monitor.worked(2);
|
monitor.worked(2);
|
||||||
|
|
||||||
IPathEntry[] entries = fCurrCProject.getRawPathEntries();
|
IPathEntry[] entries = getCProject().getRawPathEntries();
|
||||||
|
|
||||||
List cpath = new ArrayList(cPathEntries.size() + entries.length);
|
List cpath = new ArrayList(cPathEntries.size() + entries.length);
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,6 @@ import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.DirectoryDialog;
|
import org.eclipse.swt.widgets.DirectoryDialog;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
|
import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
|
||||||
import org.eclipse.ui.help.WorkbenchHelp;
|
|
||||||
import org.eclipse.ui.model.WorkbenchLabelProvider;
|
import org.eclipse.ui.model.WorkbenchLabelProvider;
|
||||||
|
|
||||||
public class CPathIncludeSymbolEntryPage extends CPathBasePage {
|
public class CPathIncludeSymbolEntryPage extends CPathBasePage {
|
||||||
|
@ -102,7 +101,7 @@ public class CPathIncludeSymbolEntryPage extends CPathBasePage {
|
||||||
null,
|
null,
|
||||||
/* 14 */CPathEntryMessages.getString("IncludeSymbolEntryPage.up"), //$NON-NLS-1$
|
/* 14 */CPathEntryMessages.getString("IncludeSymbolEntryPage.up"), //$NON-NLS-1$
|
||||||
/* 15 */CPathEntryMessages.getString("IncludeSymbolEntryPage.down")}; //$NON-NLS-1$
|
/* 15 */CPathEntryMessages.getString("IncludeSymbolEntryPage.down")}; //$NON-NLS-1$
|
||||||
private CPElementGroup fProjectGroup;
|
private CPElementGroup fTopGroup;
|
||||||
|
|
||||||
private class IncludeSymbolAdapter implements IDialogFieldListener, ITreeListAdapter {
|
private class IncludeSymbolAdapter implements IDialogFieldListener, ITreeListAdapter {
|
||||||
|
|
||||||
|
@ -174,10 +173,10 @@ public class CPathIncludeSymbolEntryPage extends CPathBasePage {
|
||||||
fIncludeSymPathsList.setLabelText(CPathEntryMessages.getString("IncludeSymbolEntryPage.label")); //$NON-NLS-1$
|
fIncludeSymPathsList.setLabelText(CPathEntryMessages.getString("IncludeSymbolEntryPage.label")); //$NON-NLS-1$
|
||||||
fIncludeSymPathsList.enableButton(IDX_REMOVE, false);
|
fIncludeSymPathsList.enableButton(IDX_REMOVE, false);
|
||||||
fIncludeSymPathsList.enableButton(IDX_EDIT, false);
|
fIncludeSymPathsList.enableButton(IDX_EDIT, false);
|
||||||
fIncludeSymPathsList.enableButton(IDX_ADD_CONTRIBUTED, false);
|
fIncludeSymPathsList.enableButton(IDX_ADD_CONTRIBUTED, true);
|
||||||
fIncludeSymPathsList.enableButton(IDX_ADD_EXT_INCLUDE, false);
|
fIncludeSymPathsList.enableButton(IDX_ADD_EXT_INCLUDE, true);
|
||||||
fIncludeSymPathsList.enableButton(IDX_ADD_WS_INCLUDE, false);
|
fIncludeSymPathsList.enableButton(IDX_ADD_WS_INCLUDE, true);
|
||||||
fIncludeSymPathsList.enableButton(IDX_ADD_SYMBOL, false);
|
fIncludeSymPathsList.enableButton(IDX_ADD_SYMBOL, true);
|
||||||
fIncludeSymPathsList.enableButton(IDX_EXPORT, false);
|
fIncludeSymPathsList.enableButton(IDX_EXPORT, false);
|
||||||
fIncludeSymPathsList.enableButton(IDX_UP, false);
|
fIncludeSymPathsList.enableButton(IDX_UP, false);
|
||||||
fIncludeSymPathsList.enableButton(IDX_DOWN, false);
|
fIncludeSymPathsList.enableButton(IDX_DOWN, false);
|
||||||
|
@ -204,16 +203,16 @@ public class CPathIncludeSymbolEntryPage extends CPathBasePage {
|
||||||
fIncludeSymPathsList.setButtonsMinWidth(buttonBarWidth);
|
fIncludeSymPathsList.setButtonsMinWidth(buttonBarWidth);
|
||||||
setControl(composite);
|
setControl(composite);
|
||||||
fIncludeSymPathsList.getTreeViewer().addFilter(fFilter);
|
fIncludeSymPathsList.getTreeViewer().addFilter(fFilter);
|
||||||
WorkbenchHelp.setHelp(composite, ICHelpContextIds.PROJECT_INCLUDE_PATHS_SYMBOLS);
|
CUIPlugin.getDefault().getWorkbench().getHelpSystem().setHelp(composite, ICHelpContextIds.PROJECT_INCLUDE_PATHS_SYMBOLS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Image getImage() {
|
public Image getImage() {
|
||||||
return CPluginImages.get(CPluginImages.IMG_OBJS_INCLUDES_CONTAINER);
|
return CPluginImages.get(CPluginImages.IMG_OBJS_INCLUDES_CONTAINER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init(ICProject cproject, List cPaths) {
|
public void init(ICElement cElement, List cPaths) {
|
||||||
fCurrCProject = cproject;
|
fCurrCProject = cElement.getCProject();
|
||||||
List elements = createGroups(cPaths);
|
List elements = createGroups(cElement, cPaths);
|
||||||
fIncludeSymPathsList.setElements(elements);
|
fIncludeSymPathsList.setElements(elements);
|
||||||
updateStatus();
|
updateStatus();
|
||||||
}
|
}
|
||||||
|
@ -264,44 +263,44 @@ public class CPathIncludeSymbolEntryPage extends CPathBasePage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private List createGroups(List cPaths) {
|
private List createGroups(ICElement element, List cPaths) {
|
||||||
// create resource groups
|
// create resource groups
|
||||||
List resourceGroups = new ArrayList(5);
|
List resourceGroups = new ArrayList(5);
|
||||||
fProjectGroup = new CPElementGroup(fCurrCProject.getResource());
|
fTopGroup = new CPElementGroup(element.getResource());
|
||||||
resourceGroups.add(fProjectGroup);
|
resourceGroups.add(fTopGroup);
|
||||||
// add containers first so that they appear at top of list
|
// add containers first so that they appear at top of list
|
||||||
for (int i = 0; i < cPaths.size(); i++) {
|
for (int i = 0; i < cPaths.size(); i++) {
|
||||||
CPElement element = (CPElement)cPaths.get(i);
|
CPElement cpelement = (CPElement)cPaths.get(i);
|
||||||
switch (element.getEntryKind()) {
|
switch (cpelement.getEntryKind()) {
|
||||||
case IPathEntry.CDT_CONTAINER :
|
case IPathEntry.CDT_CONTAINER :
|
||||||
fProjectGroup.addChild(element);
|
fTopGroup.addChild(cpelement);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = 0; i < cPaths.size(); i++) {
|
for (int i = 0; i < cPaths.size(); i++) {
|
||||||
CPElement element = (CPElement)cPaths.get(i);
|
CPElement cpelement = (CPElement)cPaths.get(i);
|
||||||
switch (element.getEntryKind()) {
|
switch (cpelement.getEntryKind()) {
|
||||||
case IPathEntry.CDT_INCLUDE :
|
case IPathEntry.CDT_INCLUDE :
|
||||||
case IPathEntry.CDT_MACRO :
|
case IPathEntry.CDT_MACRO :
|
||||||
CPElementGroup resGroup = new CPElementGroup(element.getResource());
|
CPElementGroup resGroup = new CPElementGroup(cpelement.getResource());
|
||||||
int ndx = resourceGroups.indexOf(resGroup);
|
int ndx = resourceGroups.indexOf(resGroup);
|
||||||
if (ndx == -1) {
|
if (ndx == -1) {
|
||||||
resourceGroups.add(resGroup);
|
resourceGroups.add(resGroup);
|
||||||
} else {
|
} else {
|
||||||
resGroup = (CPElementGroup)resourceGroups.get(ndx);
|
resGroup = (CPElementGroup)resourceGroups.get(ndx);
|
||||||
}
|
}
|
||||||
resGroup.addChild(element);
|
resGroup.addChild(cpelement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// place each path in its appropriate inherited group (or not if
|
// place each path in its appropriate inherited group (or not if
|
||||||
// excluded)
|
// excluded)
|
||||||
for (int i = 0; i < cPaths.size(); i++) {
|
for (int i = 0; i < cPaths.size(); i++) {
|
||||||
CPElement element = (CPElement)cPaths.get(i);
|
CPElement cpelement = (CPElement)cPaths.get(i);
|
||||||
switch (element.getEntryKind()) {
|
switch (cpelement.getEntryKind()) {
|
||||||
case IPathEntry.CDT_INCLUDE :
|
case IPathEntry.CDT_INCLUDE :
|
||||||
case IPathEntry.CDT_MACRO :
|
case IPathEntry.CDT_MACRO :
|
||||||
addPathToResourceGroups(element, null, resourceGroups);
|
addPathToResourceGroups(cpelement, null, resourceGroups);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return resourceGroups;
|
return resourceGroups;
|
||||||
|
@ -512,7 +511,7 @@ public class CPathIncludeSymbolEntryPage extends CPathBasePage {
|
||||||
if (res != null && res.length > 0) {
|
if (res != null && res.length > 0) {
|
||||||
CPElement curr = res[0];
|
CPElement curr = res[0];
|
||||||
curr.setExported(element.isExported());
|
curr.setExported(element.isExported());
|
||||||
fProjectGroup.replaceChild(element, curr);
|
fTopGroup.replaceChild(element, curr);
|
||||||
fIncludeSymPathsList.refresh();
|
fIncludeSymPathsList.refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -673,7 +672,7 @@ public class CPathIncludeSymbolEntryPage extends CPathBasePage {
|
||||||
return (CPElementGroup)item;
|
return (CPElementGroup)item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return fTopGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void listPageDialogFieldChanged(DialogField field) {
|
protected void listPageDialogFieldChanged(DialogField field) {
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class NewIncludesSymbolsTabBlock extends AbstractPathOptionBlock implemen
|
||||||
initializingTabs = false;
|
initializingTabs = false;
|
||||||
|
|
||||||
if (getCProject() != null) {
|
if (getCProject() != null) {
|
||||||
fIncludeSymbols.init(getCProject(), fCPaths);
|
fIncludeSymbols.init(getCElement(), fCPaths);
|
||||||
}
|
}
|
||||||
Dialog.applyDialogFont(fComposite);
|
Dialog.applyDialogFont(fComposite);
|
||||||
return fComposite;
|
return fComposite;
|
||||||
|
@ -77,7 +77,7 @@ public class NewIncludesSymbolsTabBlock extends AbstractPathOptionBlock implemen
|
||||||
fCPaths = cPaths;
|
fCPaths = cPaths;
|
||||||
|
|
||||||
if (fIncludeSymbols != null) {
|
if (fIncludeSymbols != null) {
|
||||||
fIncludeSymbols.init(getCProject(), cPaths);
|
fIncludeSymbols.init(element, cPaths);
|
||||||
}
|
}
|
||||||
doStatusLineUpdate();
|
doStatusLineUpdate();
|
||||||
initializeTimeStamps();
|
initializeTimeStamps();
|
||||||
|
|
Loading…
Add table
Reference in a new issue