1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-04 14:55:41 +02:00

update - work in progress

This commit is contained in:
David Inglis 2004-04-08 02:55:51 +00:00
parent 5cc0a37e2b
commit 3980981b94
10 changed files with 211 additions and 230 deletions

View file

@ -1,8 +1,8 @@
/*******************************************************************************
* Copyright (c) 2002, 2003, 2004 QNX Software Systems Ltd. and others. All
* rights reserved. This program and the accompanying materials are made
* available under the terms of the Common Public License v1.0 which
* accompanies this distribution, and is available at
* available under the terms of the Common Public License v1.0 which accompanies
* this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors: QNX Software Systems - Initial API and implementation
@ -12,6 +12,8 @@ package org.eclipse.cdt.internal.ui.dialogs.cpaths;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ICModelStatus;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.model.IPathEntry;
@ -22,17 +24,21 @@ import org.eclipse.cdt.internal.ui.dialogs.StatusUtil;
import org.eclipse.cdt.ui.dialogs.ICOptionContainer;
import org.eclipse.cdt.ui.dialogs.ICOptionPage;
import org.eclipse.cdt.ui.dialogs.TabFolderOptionBlock;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Preferences;
import org.eclipse.core.runtime.SubProgressMonitor;
abstract public class AbstractPathOptionBlock extends TabFolderOptionBlock implements ICOptionContainer {
private List fFilteredOut = new ArrayList();
private StatusInfo fCPathStatus;
private StatusInfo fBuildPathStatus;
@ -68,24 +74,81 @@ abstract public class AbstractPathOptionBlock extends TabFolderOptionBlock imple
public IPathEntry[] getRawCPath() {
List elements = getCPaths();
int nElements = elements.size();
IPathEntry[] entries = new IPathEntry[elements.size()];
List entries = new ArrayList();
for (int i = 0; i < nElements; i++) {
CPListElement currElement = (CPListElement) elements.get(i);
entries[i] = currElement.getPathEntry();
entries.add(currElement.getPathEntry());
}
return entries;
entries.addAll(fFilteredOut);
return (IPathEntry[]) entries.toArray(new IPathEntry[entries.size()]);
}
protected ArrayList getExistingEntries(IPathEntry[] cPathEntries) {
/**
* Initializes the paths for the given project. Multiple calls to init are
* allowed, but all existing settings will be cleared and replace by the
* given or default paths.
*
* @param cproject
* The C/C++ project to configure. Does not have to exist.
* @param outputLocation
* The output location to be set in the page. If <code>null</code>
* is passed, jdt default settings are used, or - if the project is
* an existing Java project- the output location of the existing
* project
* @param cpathEntries
* The path entries to be set in the page. If <code>null</code> is
* passed, jdt default settings are used, or - if the project is an
* existing Java project - the path entries of the existing project
*/
public void init(ICElement element, IPathEntry[] cpathEntries) {
setCProject(element.getCProject());
boolean projectExists = false;
List newCPath = null;
IProject project = getProject();
if (cpathEntries == null) {
try {
cpathEntries = getCProject().getRawPathEntries();
} catch (CModelException e) {
}
}
if (cpathEntries != null) {
newCPath = getFilteredEntries(cpathEntries, getFilteredTypes());
} else {
newCPath = new ArrayList();
}
initialize(element, newCPath);
}
abstract protected int[] getFilteredTypes();
abstract protected void initialize(ICElement element, List cPaths);
protected ArrayList getFilteredEntries(IPathEntry[] cPathEntries, int[] types) {
ArrayList newCPath = new ArrayList();
for (int i = 0; i < cPathEntries.length; i++) {
IPathEntry curr = cPathEntries[i];
newCPath.add(CPListElement.createFromExisting(curr, fCurrCProject));
if (contains(types, curr.getEntryKind())) {
newCPath.add(CPListElement.createFromExisting(curr, fCurrCProject));
} else {
fFilteredOut.add(curr);
}
}
return newCPath;
}
// returns true if set contains elem
private boolean contains(int[] set, int elem) {
if (set == null)
return false;
for (int i = 0; i < set.length; ++i) {
if (set[i] == elem)
return true;
}
return false;
}
abstract protected List getCPaths();
private String getEncodedSettings() {
@ -175,7 +238,8 @@ abstract public class AbstractPathOptionBlock extends TabFolderOptionBlock imple
entries[i] = currElement.getPathEntry();
}
ICModelStatus status = CModelStatus.VERIFIED_OK; // CoreModelUtil.validateCPathEntries(fCurrCProject, entries);
ICModelStatus status = CModelStatus.VERIFIED_OK; // CoreModelUtil.validateCPathEntries(fCurrCProject,
// entries);
if (!status.isOK()) {
fBuildPathStatus.setError(status.getMessage());
return;
@ -202,7 +266,29 @@ abstract public class AbstractPathOptionBlock extends TabFolderOptionBlock imple
return fCurrPage;
}
abstract protected void internalConfigureCProject(List cPathEntries, IProgressMonitor monitor) throws CoreException, InterruptedException;
protected void internalConfigureCProject(List cPathEntries, IProgressMonitor monitor) throws CoreException,
InterruptedException {
// 10 monitor steps to go
monitor.worked(2);
List cpath = new ArrayList(cPathEntries.size() + fFilteredOut.size());
// create and set the paths
for (int i = 0; i < cPathEntries.size(); i++) {
CPListElement entry = ((CPListElement) cPathEntries.get(i));
IResource res = entry.getResource();
if ((res instanceof IFolder) && !res.exists()) {
createFolder((IFolder) res, true, true, null);
}
cpath.add(entry.getPathEntry());
}
cpath.addAll(fFilteredOut);
monitor.worked(1);
getCProject().setRawPathEntries((IPathEntry[]) cpath.toArray(new IPathEntry[cpath.size()]), new SubProgressMonitor(monitor, 7));
}
// -------- creation -------------------------------
@ -221,4 +307,18 @@ abstract public class AbstractPathOptionBlock extends TabFolderOptionBlock imple
}
}
/**
* Creates a folder and all parent folders if not existing. Project must
* exist. <code> org.eclipse.ui.dialogs.ContainerGenerator</code> is too
* heavy (creates a runnable)
*/
private void createFolder(IFolder folder, boolean force, boolean local, IProgressMonitor monitor) throws CoreException {
if (!folder.exists()) {
IContainer parent = folder.getParent();
if (parent instanceof IFolder) {
createFolder((IFolder) parent, force, local, null);
}
folder.create(force, local, monitor);
}
}
}

View file

@ -31,7 +31,8 @@ public class CPListElement {
public static final String SOURCEATTACHMENTROOT = "rootpath"; //$NON-NLS-1$
public static final String EXCLUSION = "exclusion"; //$NON-NLS-1$
public static final String INCLUDE = "includepath"; //$NON-NLS-1$
public static final String DEFINE = "define"; //$NON-NLS-1$
public static final String MACRO_NAME = "macroname"; //$NON-NLS-1$
public static final String MACRO_VALUE = "macrovalue"; //$NON-NLS-1$
private ICProject fProject;
@ -69,12 +70,14 @@ public class CPListElement {
case IPathEntry.CDT_LIBRARY:
createAttributeElement(SOURCEATTACHMENT, null);
break;
case IPathEntry.CDT_PROJECT:
case IPathEntry.CDT_INCLUDE:
createAttributeElement(INCLUDE, null);
createAttributeElement(INCLUDE, new Path("")); //$NON-NLS-1$
createAttributeElement(EXCLUSION, new Path[0]);
break;
case IPathEntry.CDT_MACRO:
createAttributeElement(DEFINE, null);
createAttributeElement(MACRO_NAME, ""); //$NON-NLS-1$
createAttributeElement(MACRO_VALUE, ""); //$NON-NLS-1$
createAttributeElement(EXCLUSION, new Path[0]);
break;
case IPathEntry.CDT_CONTAINER:
try {
@ -122,7 +125,7 @@ public class CPListElement {
return CoreModel.newIncludeEntry(fPath, (IPath) getAttribute(INCLUDE));
case IPathEntry.CDT_MACRO:
exclusionPattern = (IPath[]) getAttribute(EXCLUSION);
return CoreModel.newMacroEntry(fPath, (String) getAttribute(DEFINE), null);
return CoreModel.newMacroEntry(fPath, (String) getAttribute(MACRO_NAME), (String) getAttribute(MACRO_NAME));
default:
return null;
}
@ -130,7 +133,7 @@ public class CPListElement {
public static StringBuffer appendEncodePath(IPath path, StringBuffer buf) {
if (path != null) {
String str= path.toString();
String str = path.toString();
buf.append('[').append(str.length()).append(']').append(str);
} else {
buf.append('[').append(']');
@ -150,14 +153,14 @@ public class CPListElement {
case IPathEntry.CDT_SOURCE:
case IPathEntry.CDT_INCLUDE:
case IPathEntry.CDT_MACRO:
IPath[] exclusion= (IPath[]) getAttribute(EXCLUSION);
IPath[] exclusion = (IPath[]) getAttribute(EXCLUSION);
buf.append('[').append(exclusion.length).append(']');
for (int i= 0; i < exclusion.length; i++) {
for (int i = 0; i < exclusion.length; i++) {
appendEncodePath(exclusion[i], buf).append(';');
}
break;
case IPathEntry.CDT_LIBRARY:
IPath sourceAttach= (IPath) getAttribute(SOURCEATTACHMENT);
IPath sourceAttach = (IPath) getAttribute(SOURCEATTACHMENT);
appendEncodePath(sourceAttach, buf).append(';');
break;
default:
@ -228,7 +231,8 @@ public class CPListElement {
}
public Object[] getChildren() {
if (fEntryKind == IPathEntry.CDT_OUTPUT || fEntryKind == IPathEntry.CDT_SOURCE || fEntryKind == IPathEntry.CDT_INCLUDE || fEntryKind == IPathEntry.CDT_MACRO) {
if (fEntryKind == IPathEntry.CDT_OUTPUT || fEntryKind == IPathEntry.CDT_SOURCE || fEntryKind == IPathEntry.CDT_INCLUDE
|| fEntryKind == IPathEntry.CDT_MACRO) {
return new Object[] { findAttributeElement(EXCLUSION)};
@ -325,6 +329,10 @@ public class CPListElement {
IWorkspaceRoot root = project.getProject().getWorkspace().getRoot();
IPath sourceAttachment = null;
IPath[] exclusion = null;
IPath include = null;
String macroName = null;
String macroValue = null;
// get the resource
IResource res = null;
boolean isMissing = false;
@ -383,6 +391,7 @@ public class CPListElement {
isMissing = !path.toFile().isFile(); // look for external
}
exclusion = ((IIncludeEntry) curr).getExclusionPatterns();
include = ((IIncludeEntry) curr).getIncludePath();
break;
case IPathEntry.CDT_MACRO:
path = path.removeTrailingSeparator();
@ -394,6 +403,8 @@ public class CPListElement {
isMissing = !path.toFile().isFile(); // look for external
}
exclusion = ((IMacroEntry) curr).getExclusionPatterns();
macroName = ((IMacroEntry) curr).getMacroName();
macroValue = ((IMacroEntry) curr).getMacroValue();
break;
case IPathEntry.CDT_PROJECT:
res = root.findMember(path);
@ -403,6 +414,9 @@ public class CPListElement {
CPListElement elem = new CPListElement(project, curr.getEntryKind(), path, res);
elem.setAttribute(SOURCEATTACHMENT, sourceAttachment);
elem.setAttribute(EXCLUSION, exclusion);
elem.setAttribute(INCLUDE, include);
elem.setAttribute(MACRO_NAME, macroName);
elem.setAttribute(MACRO_VALUE, macroValue);
elem.setExported(curr.isExported());
if (project.exists()) {

View file

@ -128,6 +128,11 @@ class CPListLabelProvider extends LabelProvider {
}
case IPathEntry.CDT_PROJECT:
return path.lastSegment();
case IPathEntry.CDT_INCLUDE:
return ((IPath) cpentry.getAttribute(CPListElement.INCLUDE)).toString();
case IPathEntry.CDT_MACRO:
return (String) cpentry.getAttribute(CPListElement.MACRO_NAME) + "=" //$NON-NLS-1$
+ (String) cpentry.getAttribute(CPListElement.MACRO_VALUE);
case IPathEntry.CDT_CONTAINER:
try {
IPathEntryContainer container = CoreModel.getDefault().getPathEntryContainer(cpentry.getPath(),
@ -163,7 +168,8 @@ class CPListLabelProvider extends LabelProvider {
if (ArchiveFileFilter.isArchivePath(path)) {
IPath appendedPath = path.removeLastSegments(1);
String appended = isExternal ? appendedPath.toOSString() : appendedPath.makeRelative().toString();
return CPathEntryMessages.getFormattedString("CPListLabelProvider.twopart", new String[] { path.lastSegment(), appended}); //$NON-NLS-1$
return CPathEntryMessages.getFormattedString("CPListLabelProvider.twopart", //$NON-NLS-1$
new String[] { path.lastSegment(), appended});
} else {
return isExternal ? path.toOSString() : path.makeRelative().toString();
}
@ -229,16 +235,12 @@ class CPListLabelProvider extends LabelProvider {
} else if (element instanceof CPListElementAttribute) {
String key = ((CPListElementAttribute) element).getKey();
if (key.equals(CPListElement.SOURCEATTACHMENT)) {
// return fRegistry.get(CPluginImages.DESC_OBJS_SOURCE_ATTACH_ATTRIB);
// return
// fRegistry.get(CPluginImages.DESC_OBJS_SOURCE_ATTACH_ATTRIB);
} else if (key.equals(CPListElement.EXCLUSION)) {
return CPluginImages.get(CPluginImages.IMG_OBJS_EXCLUDSION_FILTER_ATTRIB);
} else if (key.equals(CPListElement.INCLUDE)) {
// return fRegistry.get(CPluginImages.DESC_OBJS_INCLUDE_ATTRIB);
} else if (key.equals(CPListElement.DEFINE)) {
// return fRegistry.get(CPluginImages.DESC_OBJS_MACRO_ATTRIB);
}
}
return null;
}
}

View file

@ -8,6 +8,7 @@
******************************************************************************/
package org.eclipse.cdt.internal.ui.dialogs.cpaths;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
@ -22,6 +23,7 @@ public abstract class CPathBasePage extends AbstractCOptionPage {
public CPathBasePage(String title) {
super(title);
}
public CPathBasePage(String title, ImageDescriptor image) {
super(title, image);
}
@ -53,10 +55,24 @@ public abstract class CPathBasePage extends AbstractCOptionPage {
}
}
}
public abstract List getSelection();
public abstract void setSelection(List selection);
public abstract boolean isEntryKind(int kind);
protected List filterList(List input) {
ArrayList filtered = new ArrayList();
List cpelements = input;
for (int i = 0; i < cpelements.size(); i++) {
CPListElement cpe = (CPListElement) cpelements.get(i);
if (isEntryKind(cpe.getEntryKind())) {
filtered.add(cpe);
}
}
return filtered;
}
}

View file

@ -33,6 +33,7 @@ public class CPathIncludeEntryPage extends CPathBasePage {
private ListDialogField fIncludeList;
private TreeListDialogField fSrcList;
private List fCPathList;
private class IncludeListAdapter implements IListAdapter, IDialogFieldListener {
@ -75,8 +76,9 @@ public class CPathIncludeEntryPage extends CPathBasePage {
fIncludeList.setButtonsMinWidth(buttonBarWidth);
}
public void init(ICProject project) {
public void init(ICProject project, List cPaths) {
fSrcList.setElements(project.getChildrenOfType(ICElement.C_CCONTAINER));
fIncludeList.setElements(filterList(cPaths));
}
public List getSelection() {

View file

@ -104,15 +104,8 @@ public class CPathOutputEntryPage extends CPathBasePage {
}
private void updateFoldersList() {
ArrayList folders = new ArrayList();
List cpelements = fCPathList.getElements();
for (int i = 0; i < cpelements.size(); i++) {
CPListElement cpe = (CPListElement) cpelements.get(i);
if (cpe.getEntryKind() == IPathEntry.CDT_OUTPUT) {
folders.add(cpe);
}
}
List folders = filterList(fCPathList.getElements());
fOutputList.setElements(folders);
for (int i = 0; i < folders.size(); i++) {

View file

@ -104,15 +104,7 @@ public class CPathSourceEntryPage extends CPathBasePage {
}
private void updateFoldersList() {
ArrayList folders = new ArrayList();
List cpelements = fCPathList.getElements();
for (int i = 0; i < cpelements.size(); i++) {
CPListElement cpe = (CPListElement) cpelements.get(i);
if (cpe.getEntryKind() == IPathEntry.CDT_SOURCE) {
folders.add(cpe);
}
}
List folders = filterList(fCPathList.getElements());
fFoldersList.setElements(folders);
for (int i = 0; i < folders.size(); i++) {

View file

@ -72,7 +72,6 @@ public class CPathSymbolEntryPage extends CPathBasePage {
int buttonBarWidth = converter.convertWidthInCharsToPixels(30);
fSymbolsList.setButtonsMinWidth(buttonBarWidth);
}
public List getSelection() {
@ -93,7 +92,8 @@ public class CPathSymbolEntryPage extends CPathBasePage {
public void performDefaults() {
}
public void init(ICProject project) {
public void init(ICProject project, List list) {
fSrcList.setElements(project.getChildrenOfType(ICElement.C_CCONTAINER));
fSymbolsList.setElements(filterList(list));
}
}

View file

@ -11,26 +11,20 @@ package org.eclipse.cdt.internal.ui.dialogs.cpaths;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.IPathEntry;
import org.eclipse.cdt.internal.ui.dialogs.IStatusChangeListener;
import org.eclipse.cdt.internal.ui.wizards.dialogfields.CheckedListDialogField;
import org.eclipse.cdt.internal.ui.wizards.dialogfields.DialogField;
import org.eclipse.cdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
public class CPathTabBlock extends AbstractPathOptionBlock {
private int[] pathTypes = { IPathEntry.CDT_SOURCE, IPathEntry.CDT_PROJECT, IPathEntry.CDT_OUTPUT, IPathEntry.CDT_LIBRARY,
IPathEntry.CDT_CONTAINER};
private CheckedListDialogField fCPathList;
private CPathSourceEntryPage fSourcePage;
@ -108,52 +102,18 @@ public class CPathTabBlock extends AbstractPathOptionBlock {
return control;
}
/**
* Initializes the classpath for the given project. Multiple calls to init
* are allowed, but all existing settings will be cleared and replace by the
* given or default paths.
*
* @param jproject
* The java project to configure. Does not have to exist.
* @param outputLocation
* The output location to be set in the page. If <code>null</code>
* is passed, jdt default settings are used, or - if the project is
* an existing Java project- the output location of the existing
* project
* @param classpathEntries
* The classpath entries to be set in the page. If <code>null</code>
* is passed, jdt default settings are used, or - if the project is
* an existing Java project - the classpath entries of the existing
* project
*/
public void init(ICProject cproject, IPathEntry[] cpathEntries) {
setCProject(cproject);
boolean projectExists = false;
List newClassPath = null;
IProject project = getProject();
if (cpathEntries == null) {
try {
cpathEntries = getCProject().getRawPathEntries();
} catch (CModelException e) {
}
}
if (cpathEntries != null) {
newClassPath = getExistingEntries(cpathEntries);
}
if (newClassPath == null) {
newClassPath = getDefaultCPath(cproject);
}
protected void initialize(ICElement element, List cPaths) {
List exportedEntries = new ArrayList();
for (int i = 0; i < newClassPath.size(); i++) {
CPListElement curr = (CPListElement) newClassPath.get(i);
for (int i = 0; i < cPaths.size(); i++) {
CPListElement curr = (CPListElement) cPaths.get(i);
if (curr.isExported() && curr.getEntryKind() != IPathEntry.CDT_SOURCE) {
exportedEntries.add(curr);
}
}
fCPathList.setElements(newClassPath);
fCPathList.setElements(cPaths);
fCPathList.setCheckedElements(exportedEntries);
if (fProjectsPage != null) {
@ -167,52 +127,11 @@ public class CPathTabBlock extends AbstractPathOptionBlock {
initializeTimeStamps();
}
private List getDefaultCPath(ICProject cproj) {
List list = new ArrayList();
// IResource srcFolder;
// IPreferenceStore store= PreferenceConstants.getPreferenceStore();
// String sourceFolderName=
// store.getString(PreferenceConstants.SRCBIN_SRCNAME);
// if (store.getBoolean(PreferenceConstants.SRCBIN_FOLDERS_IN_NEWPROJ)
// && sourceFolderName.length() > 0) {
// srcFolder= jproj.getProject().getFolder(sourceFolderName);
// } else {
// srcFolder= jproj.getProject();
// }
//
// list.add(new CPListElement(jproj, IClasspathEntry.CPE_SOURCE,
// srcFolder.getFullPath(), srcFolder));
//
// IClasspathEntry[] jreEntries=
// PreferenceConstants.getDefaultJRELibrary();
// list.addAll(getExistingEntries(jreEntries));
return list;
protected int[] getFilteredTypes() {
return pathTypes;
}
// -------- evaluate default settings --------
// private List getDefaultClassPath(IJavaProject jproj) {
// List list= new ArrayList();
// IResource srcFolder;
// IPreferenceStore store= PreferenceConstants.getPreferenceStore();
// String sourceFolderName=
// store.getString(PreferenceConstants.SRCBIN_SRCNAME);
// if (store.getBoolean(PreferenceConstants.SRCBIN_FOLDERS_IN_NEWPROJ) &&
// sourceFolderName.length() > 0) {
// srcFolder= jproj.getProject().getFolder(sourceFolderName);
// } else {
// srcFolder= jproj.getProject();
// }
//
// list.add(new CPListElement(jproj, IClasspathEntry.CPE_SOURCE,
// srcFolder.getFullPath(), srcFolder));
//
// IPathEntry[] jreEntries= PreferenceConstants.getDefaultJRELibrary();
// list.addAll(getExistingEntries(jreEntries));
// return list;
// }
//
/**
* Validates the build path.
*/
@ -262,47 +181,4 @@ public class CPathTabBlock extends AbstractPathOptionBlock {
*/
updateBuildPathStatus();
}
/*
* Creates the Java project and sets the configured build path and output
* location. If the project already exists only build paths are updated.
*/
protected void internalConfigureCProject(List cPathEntries, IProgressMonitor monitor) throws CoreException, InterruptedException {
// 10 monitor steps to go
monitor.worked(2);
int nEntries = cPathEntries.size();
IPathEntry[] classpath = new IPathEntry[nEntries];
// create and set the class path
for (int i = 0; i < nEntries; i++) {
CPListElement entry = ((CPListElement) cPathEntries.get(i));
IResource res = entry.getResource();
if ((res instanceof IFolder) && !res.exists()) {
createFolder((IFolder) res, true, true, null);
}
classpath[i] = entry.getPathEntry();
}
monitor.worked(1);
getCProject().setRawPathEntries(classpath, new SubProgressMonitor(monitor, 7));
}
/**
* Creates a folder and all parent folders if not existing. Project must
* exist. <code> org.eclipse.ui.dialogs.ContainerGenerator</code> is too
* heavy (creates a runnable)
*/
private void createFolder(IFolder folder, boolean force, boolean local, IProgressMonitor monitor) throws CoreException {
if (!folder.exists()) {
IContainer parent = folder.getParent();
if (parent instanceof IFolder) {
createFolder((IFolder) parent, force, local, null);
}
folder.create(force, local, monitor);
}
}
}

View file

@ -12,16 +12,12 @@ package org.eclipse.cdt.internal.ui.dialogs.cpaths;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.ICContainer;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.IPathEntry;
import org.eclipse.cdt.internal.ui.dialogs.IStatusChangeListener;
import org.eclipse.cdt.internal.ui.wizards.dialogfields.ITreeListAdapter;
import org.eclipse.cdt.internal.ui.wizards.dialogfields.TreeListDialogField;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.widgets.Composite;
@ -29,10 +25,14 @@ import org.eclipse.swt.widgets.Control;
public class IncludesSymbolsTabBlock extends AbstractPathOptionBlock {
private int[] pathTypes = { IPathEntry.CDT_INCLUDE, IPathEntry.CDT_MACRO};
private CPathIncludeEntryPage fIncludePage;
private CPathSymbolEntryPage fSymbolsPage;
private SourceTreeAdapter fSourceTreeAdapter;
private List fCPaths;
private class SourceTreeAdapter implements ITreeListAdapter {
public void customButtonPressed(TreeListDialogField field, int index) {
@ -83,42 +83,28 @@ public class IncludesSymbolsTabBlock extends AbstractPathOptionBlock {
public Control createContents(Composite parent) {
Control control = super.createContents(parent);
if (getCProject() != null) {
fIncludePage.init(getCProject());
fSymbolsPage.init(getCProject());
fIncludePage.init(getCProject(), getCPaths());
fSymbolsPage.init(getCProject(), getCPaths());
}
Dialog.applyDialogFont(control);
return control;
}
protected List getCPaths() {
return new ArrayList();
return fCPaths;
}
public void init(ICElement cElement, IPathEntry[] cpathEntries) {
setCProject(cElement.getCProject());
boolean projectExists = false;
List newClassPath = null;
protected int[] getFilteredTypes() {
return pathTypes;
}
IProject project = getProject();
if (cpathEntries == null) {
try {
cpathEntries = getCProject().getRawPathEntries();
} catch (CModelException e) {
}
}
if (cpathEntries != null) {
newClassPath = getExistingEntries(cpathEntries);
}
protected void initialize(ICElement element, List cPaths) {
fCPaths = cPaths;
if (fIncludePage != null) {
fIncludePage.init(getCProject());
fSymbolsPage.init(getCProject());
fIncludePage.init(getCProject(), getCPaths());
fSymbolsPage.init(getCProject(), getCPaths());
}
doStatusLineUpdate();
initializeTimeStamps();
}
protected void internalConfigureCProject(List cPathEntries, IProgressMonitor monitor) throws CoreException,
InterruptedException {
}
}