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:
parent
5cc0a37e2b
commit
3980981b94
10 changed files with 211 additions and 230 deletions
|
@ -1,8 +1,8 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2002, 2003, 2004 QNX Software Systems Ltd. and others. All
|
* Copyright (c) 2002, 2003, 2004 QNX Software Systems Ltd. and others. All
|
||||||
* rights reserved. This program and the accompanying materials are made
|
* rights reserved. This program and the accompanying materials are made
|
||||||
* available under the terms of the Common Public License v1.0 which
|
* available under the terms of the Common Public License v1.0 which accompanies
|
||||||
* accompanies this distribution, and is available at
|
* this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/cpl-v10.html
|
* http://www.eclipse.org/legal/cpl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors: QNX Software Systems - Initial API and implementation
|
* 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.ArrayList;
|
||||||
import java.util.List;
|
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.ICModelStatus;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
import org.eclipse.cdt.core.model.IPathEntry;
|
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.ICOptionContainer;
|
||||||
import org.eclipse.cdt.ui.dialogs.ICOptionPage;
|
import org.eclipse.cdt.ui.dialogs.ICOptionPage;
|
||||||
import org.eclipse.cdt.ui.dialogs.TabFolderOptionBlock;
|
import org.eclipse.cdt.ui.dialogs.TabFolderOptionBlock;
|
||||||
|
import org.eclipse.core.resources.IContainer;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
|
import org.eclipse.core.resources.IFolder;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
import org.eclipse.core.runtime.Preferences;
|
import org.eclipse.core.runtime.Preferences;
|
||||||
|
import org.eclipse.core.runtime.SubProgressMonitor;
|
||||||
|
|
||||||
abstract public class AbstractPathOptionBlock extends TabFolderOptionBlock implements ICOptionContainer {
|
abstract public class AbstractPathOptionBlock extends TabFolderOptionBlock implements ICOptionContainer {
|
||||||
|
|
||||||
|
private List fFilteredOut = new ArrayList();
|
||||||
private StatusInfo fCPathStatus;
|
private StatusInfo fCPathStatus;
|
||||||
private StatusInfo fBuildPathStatus;
|
private StatusInfo fBuildPathStatus;
|
||||||
|
|
||||||
|
@ -48,10 +54,10 @@ abstract public class AbstractPathOptionBlock extends TabFolderOptionBlock imple
|
||||||
|
|
||||||
public AbstractPathOptionBlock(IStatusChangeListener context, int pageToShow) {
|
public AbstractPathOptionBlock(IStatusChangeListener context, int pageToShow) {
|
||||||
super(false);
|
super(false);
|
||||||
|
|
||||||
fContext = context;
|
fContext = context;
|
||||||
fPageIndex = pageToShow;
|
fPageIndex = pageToShow;
|
||||||
|
|
||||||
fCPathStatus = new StatusInfo();
|
fCPathStatus = new StatusInfo();
|
||||||
fBuildPathStatus = new StatusInfo();
|
fBuildPathStatus = new StatusInfo();
|
||||||
|
|
||||||
|
@ -68,24 +74,81 @@ abstract public class AbstractPathOptionBlock extends TabFolderOptionBlock imple
|
||||||
public IPathEntry[] getRawCPath() {
|
public IPathEntry[] getRawCPath() {
|
||||||
List elements = getCPaths();
|
List elements = getCPaths();
|
||||||
int nElements = elements.size();
|
int nElements = elements.size();
|
||||||
IPathEntry[] entries = new IPathEntry[elements.size()];
|
List entries = new ArrayList();
|
||||||
|
|
||||||
for (int i = 0; i < nElements; i++) {
|
for (int i = 0; i < nElements; i++) {
|
||||||
CPListElement currElement = (CPListElement) elements.get(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();
|
ArrayList newCPath = new ArrayList();
|
||||||
for (int i = 0; i < cPathEntries.length; i++) {
|
for (int i = 0; i < cPathEntries.length; i++) {
|
||||||
IPathEntry curr = cPathEntries[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;
|
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();
|
abstract protected List getCPaths();
|
||||||
|
|
||||||
private String getEncodedSettings() {
|
private String getEncodedSettings() {
|
||||||
|
@ -121,11 +184,11 @@ abstract public class AbstractPathOptionBlock extends TabFolderOptionBlock imple
|
||||||
protected void setCProject(ICProject project) {
|
protected void setCProject(ICProject project) {
|
||||||
fCurrCProject = project;
|
fCurrCProject = project;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ICProject getCProject() {
|
protected ICProject getCProject() {
|
||||||
return fCurrCProject;
|
return fCurrCProject;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IProject getProject() {
|
public IProject getProject() {
|
||||||
return fCurrCProject.getProject();
|
return fCurrCProject.getProject();
|
||||||
}
|
}
|
||||||
|
@ -142,7 +205,7 @@ abstract public class AbstractPathOptionBlock extends TabFolderOptionBlock imple
|
||||||
protected StatusInfo getPathStatus() {
|
protected StatusInfo getPathStatus() {
|
||||||
return fCPathStatus;
|
return fCPathStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------- tab switching ----------
|
// -------- tab switching ----------
|
||||||
|
|
||||||
public void setCurrentPage(ICOptionPage page) {
|
public void setCurrentPage(ICOptionPage page) {
|
||||||
|
@ -175,7 +238,8 @@ abstract public class AbstractPathOptionBlock extends TabFolderOptionBlock imple
|
||||||
entries[i] = currElement.getPathEntry();
|
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()) {
|
if (!status.isOK()) {
|
||||||
fBuildPathStatus.setError(status.getMessage());
|
fBuildPathStatus.setError(status.getMessage());
|
||||||
return;
|
return;
|
||||||
|
@ -201,9 +265,31 @@ abstract public class AbstractPathOptionBlock extends TabFolderOptionBlock imple
|
||||||
}
|
}
|
||||||
return fCurrPage;
|
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 -------------------------------
|
// -------- creation -------------------------------
|
||||||
|
|
||||||
public void configureCProject(IProgressMonitor monitor) throws CoreException, InterruptedException {
|
public void configureCProject(IProgressMonitor monitor) throws CoreException, InterruptedException {
|
||||||
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -31,7 +31,8 @@ public class CPListElement {
|
||||||
public static final String SOURCEATTACHMENTROOT = "rootpath"; //$NON-NLS-1$
|
public static final String SOURCEATTACHMENTROOT = "rootpath"; //$NON-NLS-1$
|
||||||
public static final String EXCLUSION = "exclusion"; //$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 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;
|
private ICProject fProject;
|
||||||
|
|
||||||
|
@ -69,12 +70,14 @@ public class CPListElement {
|
||||||
case IPathEntry.CDT_LIBRARY:
|
case IPathEntry.CDT_LIBRARY:
|
||||||
createAttributeElement(SOURCEATTACHMENT, null);
|
createAttributeElement(SOURCEATTACHMENT, null);
|
||||||
break;
|
break;
|
||||||
case IPathEntry.CDT_PROJECT:
|
|
||||||
case IPathEntry.CDT_INCLUDE:
|
case IPathEntry.CDT_INCLUDE:
|
||||||
createAttributeElement(INCLUDE, null);
|
createAttributeElement(INCLUDE, new Path("")); //$NON-NLS-1$
|
||||||
|
createAttributeElement(EXCLUSION, new Path[0]);
|
||||||
break;
|
break;
|
||||||
case IPathEntry.CDT_MACRO:
|
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;
|
break;
|
||||||
case IPathEntry.CDT_CONTAINER:
|
case IPathEntry.CDT_CONTAINER:
|
||||||
try {
|
try {
|
||||||
|
@ -122,22 +125,22 @@ public class CPListElement {
|
||||||
return CoreModel.newIncludeEntry(fPath, (IPath) getAttribute(INCLUDE));
|
return CoreModel.newIncludeEntry(fPath, (IPath) getAttribute(INCLUDE));
|
||||||
case IPathEntry.CDT_MACRO:
|
case IPathEntry.CDT_MACRO:
|
||||||
exclusionPattern = (IPath[]) getAttribute(EXCLUSION);
|
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:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static StringBuffer appendEncodePath(IPath path, StringBuffer buf) {
|
public static StringBuffer appendEncodePath(IPath path, StringBuffer buf) {
|
||||||
if (path != null) {
|
if (path != null) {
|
||||||
String str= path.toString();
|
String str = path.toString();
|
||||||
buf.append('[').append(str.length()).append(']').append(str);
|
buf.append('[').append(str.length()).append(']').append(str);
|
||||||
} else {
|
} else {
|
||||||
buf.append('[').append(']');
|
buf.append('[').append(']');
|
||||||
}
|
}
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -150,18 +153,18 @@ public class CPListElement {
|
||||||
case IPathEntry.CDT_SOURCE:
|
case IPathEntry.CDT_SOURCE:
|
||||||
case IPathEntry.CDT_INCLUDE:
|
case IPathEntry.CDT_INCLUDE:
|
||||||
case IPathEntry.CDT_MACRO:
|
case IPathEntry.CDT_MACRO:
|
||||||
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++) {
|
||||||
appendEncodePath(exclusion[i], buf).append(';');
|
appendEncodePath(exclusion[i], buf).append(';');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case IPathEntry.CDT_LIBRARY:
|
case IPathEntry.CDT_LIBRARY:
|
||||||
IPath sourceAttach= (IPath) getAttribute(SOURCEATTACHMENT);
|
IPath sourceAttach = (IPath) getAttribute(SOURCEATTACHMENT);
|
||||||
appendEncodePath(sourceAttach, buf).append(';');
|
appendEncodePath(sourceAttach, buf).append(';');
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
||||||
}
|
}
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
@ -228,7 +231,8 @@ public class CPListElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object[] getChildren() {
|
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)};
|
return new Object[] { findAttributeElement(EXCLUSION)};
|
||||||
|
|
||||||
|
@ -325,6 +329,10 @@ public class CPListElement {
|
||||||
IWorkspaceRoot root = project.getProject().getWorkspace().getRoot();
|
IWorkspaceRoot root = project.getProject().getWorkspace().getRoot();
|
||||||
IPath sourceAttachment = null;
|
IPath sourceAttachment = null;
|
||||||
IPath[] exclusion = null;
|
IPath[] exclusion = null;
|
||||||
|
IPath include = null;
|
||||||
|
String macroName = null;
|
||||||
|
String macroValue = null;
|
||||||
|
|
||||||
// get the resource
|
// get the resource
|
||||||
IResource res = null;
|
IResource res = null;
|
||||||
boolean isMissing = false;
|
boolean isMissing = false;
|
||||||
|
@ -383,6 +391,7 @@ public class CPListElement {
|
||||||
isMissing = !path.toFile().isFile(); // look for external
|
isMissing = !path.toFile().isFile(); // look for external
|
||||||
}
|
}
|
||||||
exclusion = ((IIncludeEntry) curr).getExclusionPatterns();
|
exclusion = ((IIncludeEntry) curr).getExclusionPatterns();
|
||||||
|
include = ((IIncludeEntry) curr).getIncludePath();
|
||||||
break;
|
break;
|
||||||
case IPathEntry.CDT_MACRO:
|
case IPathEntry.CDT_MACRO:
|
||||||
path = path.removeTrailingSeparator();
|
path = path.removeTrailingSeparator();
|
||||||
|
@ -394,6 +403,8 @@ public class CPListElement {
|
||||||
isMissing = !path.toFile().isFile(); // look for external
|
isMissing = !path.toFile().isFile(); // look for external
|
||||||
}
|
}
|
||||||
exclusion = ((IMacroEntry) curr).getExclusionPatterns();
|
exclusion = ((IMacroEntry) curr).getExclusionPatterns();
|
||||||
|
macroName = ((IMacroEntry) curr).getMacroName();
|
||||||
|
macroValue = ((IMacroEntry) curr).getMacroValue();
|
||||||
break;
|
break;
|
||||||
case IPathEntry.CDT_PROJECT:
|
case IPathEntry.CDT_PROJECT:
|
||||||
res = root.findMember(path);
|
res = root.findMember(path);
|
||||||
|
@ -403,6 +414,9 @@ public class CPListElement {
|
||||||
CPListElement elem = new CPListElement(project, curr.getEntryKind(), path, res);
|
CPListElement elem = new CPListElement(project, 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(MACRO_NAME, macroName);
|
||||||
|
elem.setAttribute(MACRO_VALUE, macroValue);
|
||||||
elem.setExported(curr.isExported());
|
elem.setExported(curr.isExported());
|
||||||
|
|
||||||
if (project.exists()) {
|
if (project.exists()) {
|
||||||
|
@ -410,4 +424,4 @@ public class CPListElement {
|
||||||
}
|
}
|
||||||
return elem;
|
return elem;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -83,7 +83,7 @@ class CPListLabelProvider extends LabelProvider {
|
||||||
} else {
|
} else {
|
||||||
buf.append(notAvailable);
|
buf.append(notAvailable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (key.equals(CPListElement.EXCLUSION)) {
|
if (key.equals(CPListElement.EXCLUSION)) {
|
||||||
buf.append(CPathEntryMessages.getString("CPListLabelProvider.exclusion_filter.label")); //$NON-NLS-1$
|
buf.append(CPathEntryMessages.getString("CPListLabelProvider.exclusion_filter.label")); //$NON-NLS-1$
|
||||||
IPath[] patterns = (IPath[]) attrib.getValue();
|
IPath[] patterns = (IPath[]) attrib.getValue();
|
||||||
|
@ -128,6 +128,11 @@ class CPListLabelProvider extends LabelProvider {
|
||||||
}
|
}
|
||||||
case IPathEntry.CDT_PROJECT:
|
case IPathEntry.CDT_PROJECT:
|
||||||
return path.lastSegment();
|
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:
|
case IPathEntry.CDT_CONTAINER:
|
||||||
try {
|
try {
|
||||||
IPathEntryContainer container = CoreModel.getDefault().getPathEntryContainer(cpentry.getPath(),
|
IPathEntryContainer container = CoreModel.getDefault().getPathEntryContainer(cpentry.getPath(),
|
||||||
|
@ -163,7 +168,8 @@ class CPListLabelProvider extends LabelProvider {
|
||||||
if (ArchiveFileFilter.isArchivePath(path)) {
|
if (ArchiveFileFilter.isArchivePath(path)) {
|
||||||
IPath appendedPath = path.removeLastSegments(1);
|
IPath appendedPath = path.removeLastSegments(1);
|
||||||
String appended = isExternal ? appendedPath.toOSString() : appendedPath.makeRelative().toString();
|
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 {
|
} else {
|
||||||
return isExternal ? path.toOSString() : path.makeRelative().toString();
|
return isExternal ? path.toOSString() : path.makeRelative().toString();
|
||||||
}
|
}
|
||||||
|
@ -229,16 +235,12 @@ class CPListLabelProvider extends LabelProvider {
|
||||||
} else if (element instanceof CPListElementAttribute) {
|
} else if (element instanceof CPListElementAttribute) {
|
||||||
String key = ((CPListElementAttribute) element).getKey();
|
String key = ((CPListElementAttribute) element).getKey();
|
||||||
if (key.equals(CPListElement.SOURCEATTACHMENT)) {
|
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)) {
|
} else if (key.equals(CPListElement.EXCLUSION)) {
|
||||||
return CPluginImages.get(CPluginImages.IMG_OBJS_EXCLUDSION_FILTER_ATTRIB);
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
|
@ -8,6 +8,7 @@
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.dialogs.cpaths;
|
package org.eclipse.cdt.internal.ui.dialogs.cpaths;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ -22,6 +23,7 @@ public abstract class CPathBasePage extends AbstractCOptionPage {
|
||||||
public CPathBasePage(String title) {
|
public CPathBasePage(String title) {
|
||||||
super(title);
|
super(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CPathBasePage(String title, ImageDescriptor image) {
|
public CPathBasePage(String title, ImageDescriptor image) {
|
||||||
super(title, image);
|
super(title, image);
|
||||||
}
|
}
|
||||||
|
@ -53,10 +55,24 @@ public abstract class CPathBasePage extends AbstractCOptionPage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract List getSelection();
|
public abstract List getSelection();
|
||||||
|
|
||||||
public abstract void setSelection(List selection);
|
public abstract void setSelection(List selection);
|
||||||
|
|
||||||
public abstract boolean isEntryKind(int kind);
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -33,6 +33,7 @@ public class CPathIncludeEntryPage extends CPathBasePage {
|
||||||
|
|
||||||
private ListDialogField fIncludeList;
|
private ListDialogField fIncludeList;
|
||||||
private TreeListDialogField fSrcList;
|
private TreeListDialogField fSrcList;
|
||||||
|
private List fCPathList;
|
||||||
|
|
||||||
private class IncludeListAdapter implements IListAdapter, IDialogFieldListener {
|
private class IncludeListAdapter implements IListAdapter, IDialogFieldListener {
|
||||||
|
|
||||||
|
@ -75,8 +76,9 @@ public class CPathIncludeEntryPage extends CPathBasePage {
|
||||||
fIncludeList.setButtonsMinWidth(buttonBarWidth);
|
fIncludeList.setButtonsMinWidth(buttonBarWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init(ICProject project) {
|
public void init(ICProject project, List cPaths) {
|
||||||
fSrcList.setElements(project.getChildrenOfType(ICElement.C_CCONTAINER));
|
fSrcList.setElements(project.getChildrenOfType(ICElement.C_CCONTAINER));
|
||||||
|
fIncludeList.setElements(filterList(cPaths));
|
||||||
}
|
}
|
||||||
|
|
||||||
public List getSelection() {
|
public List getSelection() {
|
||||||
|
|
|
@ -104,15 +104,8 @@ public class CPathOutputEntryPage extends CPathBasePage {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateFoldersList() {
|
private void updateFoldersList() {
|
||||||
ArrayList folders = new ArrayList();
|
|
||||||
|
List folders = filterList(fCPathList.getElements());
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fOutputList.setElements(folders);
|
fOutputList.setElements(folders);
|
||||||
|
|
||||||
for (int i = 0; i < folders.size(); i++) {
|
for (int i = 0; i < folders.size(); i++) {
|
||||||
|
|
|
@ -104,15 +104,7 @@ public class CPathSourceEntryPage extends CPathBasePage {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateFoldersList() {
|
private void updateFoldersList() {
|
||||||
ArrayList folders = new ArrayList();
|
List folders = filterList(fCPathList.getElements());
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fFoldersList.setElements(folders);
|
fFoldersList.setElements(folders);
|
||||||
|
|
||||||
for (int i = 0; i < folders.size(); i++) {
|
for (int i = 0; i < folders.size(); i++) {
|
||||||
|
|
|
@ -72,7 +72,6 @@ public class CPathSymbolEntryPage extends CPathBasePage {
|
||||||
|
|
||||||
int buttonBarWidth = converter.convertWidthInCharsToPixels(30);
|
int buttonBarWidth = converter.convertWidthInCharsToPixels(30);
|
||||||
fSymbolsList.setButtonsMinWidth(buttonBarWidth);
|
fSymbolsList.setButtonsMinWidth(buttonBarWidth);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List getSelection() {
|
public List getSelection() {
|
||||||
|
@ -93,7 +92,8 @@ public class CPathSymbolEntryPage extends CPathBasePage {
|
||||||
public void performDefaults() {
|
public void performDefaults() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init(ICProject project) {
|
public void init(ICProject project, List list) {
|
||||||
fSrcList.setElements(project.getChildrenOfType(ICElement.C_CCONTAINER));
|
fSrcList.setElements(project.getChildrenOfType(ICElement.C_CCONTAINER));
|
||||||
|
fSymbolsList.setElements(filterList(list));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,26 +11,20 @@ package org.eclipse.cdt.internal.ui.dialogs.cpaths;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.model.CModelException;
|
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.internal.ui.wizards.dialogfields.CheckedListDialogField;
|
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.DialogField;
|
||||||
import org.eclipse.cdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
|
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.jface.dialogs.Dialog;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Control;
|
import org.eclipse.swt.widgets.Control;
|
||||||
|
|
||||||
public class CPathTabBlock extends AbstractPathOptionBlock {
|
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 CheckedListDialogField fCPathList;
|
||||||
|
|
||||||
private CPathSourceEntryPage fSourcePage;
|
private CPathSourceEntryPage fSourcePage;
|
||||||
|
@ -108,52 +102,18 @@ public class CPathTabBlock extends AbstractPathOptionBlock {
|
||||||
return control;
|
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();
|
protected void initialize(ICElement element, List cPaths) {
|
||||||
if (cpathEntries == null) {
|
|
||||||
try {
|
|
||||||
cpathEntries = getCProject().getRawPathEntries();
|
|
||||||
} catch (CModelException e) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (cpathEntries != null) {
|
|
||||||
newClassPath = getExistingEntries(cpathEntries);
|
|
||||||
}
|
|
||||||
if (newClassPath == null) {
|
|
||||||
newClassPath = getDefaultCPath(cproject);
|
|
||||||
}
|
|
||||||
|
|
||||||
List exportedEntries = new ArrayList();
|
List exportedEntries = new ArrayList();
|
||||||
for (int i = 0; i < newClassPath.size(); i++) {
|
for (int i = 0; i < cPaths.size(); i++) {
|
||||||
CPListElement curr = (CPListElement) newClassPath.get(i);
|
CPListElement curr = (CPListElement) cPaths.get(i);
|
||||||
if (curr.isExported() && curr.getEntryKind() != IPathEntry.CDT_SOURCE) {
|
if (curr.isExported() && curr.getEntryKind() != IPathEntry.CDT_SOURCE) {
|
||||||
exportedEntries.add(curr);
|
exportedEntries.add(curr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fCPathList.setElements(newClassPath);
|
fCPathList.setElements(cPaths);
|
||||||
fCPathList.setCheckedElements(exportedEntries);
|
fCPathList.setCheckedElements(exportedEntries);
|
||||||
|
|
||||||
if (fProjectsPage != null) {
|
if (fProjectsPage != null) {
|
||||||
|
@ -167,52 +127,11 @@ public class CPathTabBlock extends AbstractPathOptionBlock {
|
||||||
initializeTimeStamps();
|
initializeTimeStamps();
|
||||||
}
|
}
|
||||||
|
|
||||||
private List getDefaultCPath(ICProject cproj) {
|
|
||||||
List list = new ArrayList();
|
protected int[] getFilteredTypes() {
|
||||||
// IResource srcFolder;
|
return pathTypes;
|
||||||
// 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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------- 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.
|
* Validates the build path.
|
||||||
*/
|
*/
|
||||||
|
@ -262,47 +181,4 @@ public class CPathTabBlock extends AbstractPathOptionBlock {
|
||||||
*/
|
*/
|
||||||
updateBuildPathStatus();
|
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -12,16 +12,12 @@ package org.eclipse.cdt.internal.ui.dialogs.cpaths;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.model.CModelException;
|
|
||||||
import org.eclipse.cdt.core.model.ICContainer;
|
import org.eclipse.cdt.core.model.ICContainer;
|
||||||
import org.eclipse.cdt.core.model.ICElement;
|
import org.eclipse.cdt.core.model.ICElement;
|
||||||
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.internal.ui.wizards.dialogfields.ITreeListAdapter;
|
import org.eclipse.cdt.internal.ui.wizards.dialogfields.ITreeListAdapter;
|
||||||
import org.eclipse.cdt.internal.ui.wizards.dialogfields.TreeListDialogField;
|
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.jface.dialogs.Dialog;
|
||||||
import org.eclipse.swt.events.KeyEvent;
|
import org.eclipse.swt.events.KeyEvent;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
@ -29,10 +25,14 @@ import org.eclipse.swt.widgets.Control;
|
||||||
|
|
||||||
public class IncludesSymbolsTabBlock extends AbstractPathOptionBlock {
|
public class IncludesSymbolsTabBlock extends AbstractPathOptionBlock {
|
||||||
|
|
||||||
|
private int[] pathTypes = { IPathEntry.CDT_INCLUDE, IPathEntry.CDT_MACRO};
|
||||||
|
|
||||||
private CPathIncludeEntryPage fIncludePage;
|
private CPathIncludeEntryPage fIncludePage;
|
||||||
private CPathSymbolEntryPage fSymbolsPage;
|
private CPathSymbolEntryPage fSymbolsPage;
|
||||||
private SourceTreeAdapter fSourceTreeAdapter;
|
private SourceTreeAdapter fSourceTreeAdapter;
|
||||||
|
|
||||||
|
private List fCPaths;
|
||||||
|
|
||||||
private class SourceTreeAdapter implements ITreeListAdapter {
|
private class SourceTreeAdapter implements ITreeListAdapter {
|
||||||
|
|
||||||
public void customButtonPressed(TreeListDialogField field, int index) {
|
public void customButtonPressed(TreeListDialogField field, int index) {
|
||||||
|
@ -79,46 +79,32 @@ public class IncludesSymbolsTabBlock extends AbstractPathOptionBlock {
|
||||||
fSymbolsPage = new CPathSymbolEntryPage(fSourceTreeAdapter);
|
fSymbolsPage = new CPathSymbolEntryPage(fSourceTreeAdapter);
|
||||||
addPage(fSymbolsPage);
|
addPage(fSymbolsPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Control createContents(Composite parent) {
|
public Control createContents(Composite parent) {
|
||||||
Control control = super.createContents(parent);
|
Control control = super.createContents(parent);
|
||||||
if (getCProject() != null) {
|
if (getCProject() != null) {
|
||||||
fIncludePage.init(getCProject());
|
fIncludePage.init(getCProject(), getCPaths());
|
||||||
fSymbolsPage.init(getCProject());
|
fSymbolsPage.init(getCProject(), getCPaths());
|
||||||
}
|
}
|
||||||
Dialog.applyDialogFont(control);
|
Dialog.applyDialogFont(control);
|
||||||
return control;
|
return control;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List getCPaths() {
|
protected List getCPaths() {
|
||||||
return new ArrayList();
|
return fCPaths;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init(ICElement cElement, IPathEntry[] cpathEntries) {
|
protected int[] getFilteredTypes() {
|
||||||
setCProject(cElement.getCProject());
|
return pathTypes;
|
||||||
boolean projectExists = false;
|
}
|
||||||
List newClassPath = null;
|
|
||||||
|
|
||||||
IProject project = getProject();
|
protected void initialize(ICElement element, List cPaths) {
|
||||||
if (cpathEntries == null) {
|
fCPaths = cPaths;
|
||||||
try {
|
|
||||||
cpathEntries = getCProject().getRawPathEntries();
|
|
||||||
} catch (CModelException e) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (cpathEntries != null) {
|
|
||||||
newClassPath = getExistingEntries(cpathEntries);
|
|
||||||
}
|
|
||||||
if (fIncludePage != null) {
|
if (fIncludePage != null) {
|
||||||
fIncludePage.init(getCProject());
|
fIncludePage.init(getCProject(), getCPaths());
|
||||||
fSymbolsPage.init(getCProject());
|
fSymbolsPage.init(getCProject(), getCPaths());
|
||||||
}
|
}
|
||||||
doStatusLineUpdate();
|
doStatusLineUpdate();
|
||||||
initializeTimeStamps();
|
initializeTimeStamps();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
protected void internalConfigureCProject(List cPathEntries, IProgressMonitor monitor) throws CoreException,
|
|
||||||
InterruptedException {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Add table
Reference in a new issue