mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-02 13:13:36 +02:00
update PathEntry ui stuff
This commit is contained in:
parent
d83f3ab70e
commit
0ac56f2cf0
11 changed files with 192 additions and 143 deletions
|
@ -3,6 +3,7 @@ providerName=Eclipse.org
|
||||||
|
|
||||||
elementFiltersName=CElement Filters
|
elementFiltersName=CElement Filters
|
||||||
binaryParserPage=Binary Parser Page
|
binaryParserPage=Binary Parser Page
|
||||||
|
pathContainerPage=Path Container Page
|
||||||
textHoversName=Text Hovers
|
textHoversName=Text Hovers
|
||||||
editorActionsName=Editor Actions
|
editorActionsName=Editor Actions
|
||||||
editorRulerActionsName=Editor Ruler Actions
|
editorRulerActionsName=Editor Ruler Actions
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
<extension-point id="CCompletionContributor" name="%completionContributorName"/>
|
<extension-point id="CCompletionContributor" name="%completionContributorName"/>
|
||||||
<extension-point id="CElementFilters" name="%elementFiltersName"/>
|
<extension-point id="CElementFilters" name="%elementFiltersName"/>
|
||||||
<extension-point id="BinaryParserPage" name="%binaryParserPage"/>
|
<extension-point id="BinaryParserPage" name="%binaryParserPage"/>
|
||||||
<extension-point id="CPathContainerPage" name="%CPathContainerPageExtensionPoint" schema="schema/CPathContainerPage.exsd"/>
|
<extension-point id="PathContainerPage" name="%pathContainerPage" schema="schema/PathContainerPage.exsd"/>
|
||||||
|
|
||||||
<!-- =========================================================================== -->
|
<!-- =========================================================================== -->
|
||||||
<!-- Extension point: org.eclipse.cdt.ui.textHovers -->
|
<!-- Extension point: org.eclipse.cdt.ui.textHovers -->
|
||||||
|
@ -683,4 +683,12 @@
|
||||||
</page>
|
</page>
|
||||||
</extension>
|
</extension>
|
||||||
-->
|
-->
|
||||||
|
<extension
|
||||||
|
point="org.eclipse.cdt.ui.PathContainerPage">
|
||||||
|
<PathContainerPage
|
||||||
|
name="%defaultClasspathContainerPage"
|
||||||
|
class="org.eclipse.cdt.internal.ui.dialogs.cpaths.CPathContainerDefaultPage"
|
||||||
|
id="*">
|
||||||
|
</PathContainerPage>
|
||||||
|
</extension>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<schema targetNamespace="org.eclipse.cdt.ui">
|
<schema targetNamespace="org.eclipse.cdt.ui">
|
||||||
<annotation>
|
<annotation>
|
||||||
<appInfo>
|
<appInfo>
|
||||||
<meta.schema plugin="org.eclipse.cdt.ui" id="CPathContainerPage" name="%CPathContainerPageExtensionPoint"/>
|
<meta.schema plugin="org.eclipse.cdt.ui" id="PathContainerPage" name="%PathContainerPageExtensionPoint"/>
|
||||||
</appInfo>
|
</appInfo>
|
||||||
<documentation>
|
<documentation>
|
||||||
[Enter description of this extension point.]
|
[Enter description of this extension point.]
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
<element name="extension">
|
<element name="extension">
|
||||||
<complexType>
|
<complexType>
|
||||||
<sequence>
|
<sequence>
|
||||||
<element ref="CPathContainerPage"/>
|
<element ref="PathContainerPage"/>
|
||||||
</sequence>
|
</sequence>
|
||||||
<attribute name="point" type="string" use="required">
|
<attribute name="point" type="string" use="required">
|
||||||
<annotation>
|
<annotation>
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
</complexType>
|
</complexType>
|
||||||
</element>
|
</element>
|
||||||
|
|
||||||
<element name="CPathContainerPage">
|
<element name="PathContainerPage">
|
||||||
<complexType>
|
<complexType>
|
||||||
<attribute name="id" type="string" use="required">
|
<attribute name="id" type="string" use="required">
|
||||||
<annotation>
|
<annotation>
|
|
@ -37,63 +37,63 @@ public class CPListElement {
|
||||||
public static final String BASE_REF = "base-ref"; //$NON-NLS-1$
|
public static final String BASE_REF = "base-ref"; //$NON-NLS-1$
|
||||||
public static final String BASE = "base-path"; //$NON-NLS-1$
|
public static final String BASE = "base-path"; //$NON-NLS-1$
|
||||||
|
|
||||||
private ICProject fProject;
|
private final int fEntryKind;
|
||||||
|
private final IPath fPath;
|
||||||
|
private final ICProject fCProject;
|
||||||
|
private final IResource fResource;
|
||||||
|
private final ArrayList fChildren;
|
||||||
|
|
||||||
private int fEntryKind;
|
|
||||||
private IPath fPath;
|
|
||||||
private IResource fResource;
|
|
||||||
private boolean fIsExported;
|
private boolean fIsExported;
|
||||||
private boolean fIsMissing;
|
private boolean fIsMissing;
|
||||||
|
|
||||||
private CPListElement fParentContainer;
|
private CPListElement fParentContainer;
|
||||||
|
|
||||||
private IPathEntry fCachedEntry;
|
private IPathEntry fCachedEntry;
|
||||||
private ArrayList fChildren;
|
|
||||||
|
|
||||||
public CPListElement(ICProject project, int entryKind, IPath path, IResource res) {
|
public CPListElement(ICProject project, int entryKind, IPath path, IResource res) {
|
||||||
fProject = project;
|
fCProject = project;
|
||||||
|
|
||||||
fEntryKind = entryKind;
|
fEntryKind = entryKind;
|
||||||
fPath = path;
|
fPath = path;
|
||||||
fChildren = new ArrayList();
|
fChildren = new ArrayList();
|
||||||
fResource = res;
|
fResource = res;
|
||||||
fIsExported = false;
|
|
||||||
|
|
||||||
|
fIsExported = false;
|
||||||
fIsMissing = false;
|
fIsMissing = false;
|
||||||
fCachedEntry = null;
|
fCachedEntry = null;
|
||||||
fParentContainer = null;
|
fParentContainer = null;
|
||||||
|
|
||||||
switch (entryKind) {
|
switch (entryKind) {
|
||||||
case IPathEntry.CDT_OUTPUT:
|
case IPathEntry.CDT_OUTPUT :
|
||||||
createAttributeElement(EXCLUSION, new Path[0]);
|
createAttributeElement(EXCLUSION, new Path[0]);
|
||||||
break;
|
break;
|
||||||
case IPathEntry.CDT_SOURCE:
|
case IPathEntry.CDT_SOURCE :
|
||||||
createAttributeElement(EXCLUSION, new Path[0]);
|
createAttributeElement(EXCLUSION, new Path[0]);
|
||||||
break;
|
break;
|
||||||
case IPathEntry.CDT_LIBRARY:
|
case IPathEntry.CDT_LIBRARY :
|
||||||
createAttributeElement(SOURCEATTACHMENT, null);
|
createAttributeElement(SOURCEATTACHMENT, null);
|
||||||
|
createAttributeElement(BASE_REF, new Path("")); //$NON-NLS-1$
|
||||||
|
createAttributeElement(BASE, new Path("")); //$NON-NLS-1$
|
||||||
break;
|
break;
|
||||||
case IPathEntry.CDT_INCLUDE:
|
case IPathEntry.CDT_INCLUDE :
|
||||||
createAttributeElement(INCLUDE, new Path("")); //$NON-NLS-1$
|
createAttributeElement(INCLUDE, new Path("")); //$NON-NLS-1$
|
||||||
createAttributeElement(EXCLUSION, new Path[0]);
|
createAttributeElement(EXCLUSION, new Path[0]);
|
||||||
createAttributeElement(SYSTEM_INCLUDE, Boolean.valueOf(false));
|
createAttributeElement(SYSTEM_INCLUDE, Boolean.valueOf(false));
|
||||||
createAttributeElement(BASE_REF, new Path("")); //$NON-NLS-1$
|
createAttributeElement(BASE_REF, new Path("")); //$NON-NLS-1$
|
||||||
createAttributeElement(BASE, new Path("")); //$NON-NLS-1$
|
createAttributeElement(BASE, new Path("")); //$NON-NLS-1$
|
||||||
break;
|
break;
|
||||||
case IPathEntry.CDT_MACRO:
|
case IPathEntry.CDT_MACRO :
|
||||||
createAttributeElement(MACRO_NAME, ""); //$NON-NLS-1$
|
createAttributeElement(MACRO_NAME, ""); //$NON-NLS-1$
|
||||||
createAttributeElement(MACRO_VALUE, ""); //$NON-NLS-1$
|
createAttributeElement(MACRO_VALUE, ""); //$NON-NLS-1$
|
||||||
createAttributeElement(EXCLUSION, new Path[0]);
|
createAttributeElement(EXCLUSION, new Path[0]);
|
||||||
createAttributeElement(BASE_REF, new Path("")); //$NON-NLS-1$
|
createAttributeElement(BASE_REF, new Path("")); //$NON-NLS-1$
|
||||||
createAttributeElement(BASE, new Path("")); //$NON-NLS-1$
|
createAttributeElement(BASE, new Path("")); //$NON-NLS-1$
|
||||||
break;
|
break;
|
||||||
case IPathEntry.CDT_CONTAINER:
|
case IPathEntry.CDT_CONTAINER :
|
||||||
try {
|
try {
|
||||||
IPathEntryContainer container = CoreModel.getDefault().getPathEntryContainer(fPath, fProject);
|
IPathEntryContainer container = CoreModel.getDefault().getPathEntryContainer(fPath, fCProject);
|
||||||
if (container != null) {
|
if (container != null) {
|
||||||
IPathEntry[] entries = container.getPathEntries();
|
IPathEntry[] entries = container.getPathEntries();
|
||||||
for (int i = 0; i < entries.length; i++) {
|
for (int i = 0; i < entries.length; i++) {
|
||||||
CPListElement curr = createFromExisting(entries[i], fProject);
|
CPListElement curr = createFromExisting(entries[i], fCProject);
|
||||||
curr.setParentContainer(this);
|
curr.setParentContainer(this);
|
||||||
fChildren.add(curr);
|
fChildren.add(curr);
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ public class CPListElement {
|
||||||
} catch (CModelException e) {
|
} catch (CModelException e) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default :
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,44 +113,45 @@ public class CPListElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
private IPathEntry newPathEntry() {
|
private IPathEntry newPathEntry() {
|
||||||
IPath[] exclusionPattern;
|
IPath[] exclusionPattern = (IPath[]) getAttribute(EXCLUSION);
|
||||||
//IPath[] exclusionPattern = (IPath[]) getAttribute(EXCLUSION);
|
|
||||||
Object o = getAttribute(EXCLUSION);
|
|
||||||
Class clazz = o.getClass();
|
|
||||||
if (clazz.isArray()) {
|
|
||||||
exclusionPattern = (IPath[]) o;
|
|
||||||
} else {
|
|
||||||
exclusionPattern = new IPath[0];
|
|
||||||
}
|
|
||||||
IPath base = (IPath) getAttribute(BASE);
|
IPath base = (IPath) getAttribute(BASE);
|
||||||
IPath baseRef = (IPath) getAttribute(BASE_REF);
|
IPath baseRef = (IPath) getAttribute(BASE_REF);
|
||||||
switch (fEntryKind) {
|
switch (fEntryKind) {
|
||||||
case IPathEntry.CDT_OUTPUT:
|
case IPathEntry.CDT_OUTPUT :
|
||||||
return CoreModel.newOutputEntry(fPath, exclusionPattern);
|
return CoreModel.newOutputEntry(fPath, exclusionPattern);
|
||||||
case IPathEntry.CDT_SOURCE:
|
case IPathEntry.CDT_SOURCE :
|
||||||
return CoreModel.newSourceEntry(fPath, exclusionPattern);
|
return CoreModel.newSourceEntry(fPath, exclusionPattern);
|
||||||
case IPathEntry.CDT_LIBRARY:
|
case IPathEntry.CDT_LIBRARY :
|
||||||
IPath attach = (IPath) getAttribute(SOURCEATTACHMENT);
|
IPath attach = (IPath) getAttribute(SOURCEATTACHMENT);
|
||||||
return CoreModel.newLibraryEntry(base, fPath, attach, null, null, isExported());
|
if (baseRef != null) {
|
||||||
case IPathEntry.CDT_PROJECT:
|
return CoreModel.newLibraryRefEntry(baseRef, fPath);
|
||||||
return CoreModel.newProjectEntry(fPath, isExported());
|
|
||||||
case IPathEntry.CDT_CONTAINER:
|
|
||||||
return CoreModel.newContainerEntry(fPath, isExported());
|
|
||||||
case IPathEntry.CDT_INCLUDE:
|
|
||||||
if (base != null) {
|
|
||||||
return CoreModel.newIncludeEntry(fPath, base, (IPath) getAttribute(INCLUDE),
|
|
||||||
((Boolean) getAttribute(SYSTEM_INCLUDE)).booleanValue(), exclusionPattern);
|
|
||||||
} else {
|
} else {
|
||||||
|
return CoreModel.newLibraryEntry(base, fPath, attach, null, null, isExported());
|
||||||
}
|
}
|
||||||
case IPathEntry.CDT_MACRO:
|
case IPathEntry.CDT_PROJECT :
|
||||||
return CoreModel.newMacroEntry(fPath, (String) getAttribute(MACRO_NAME),
|
return CoreModel.newProjectEntry(fPath, isExported());
|
||||||
(String) getAttribute(MACRO_VALUE), exclusionPattern);
|
case IPathEntry.CDT_CONTAINER :
|
||||||
default:
|
return CoreModel.newContainerEntry(fPath, isExported());
|
||||||
|
case IPathEntry.CDT_INCLUDE :
|
||||||
|
IPath include = (IPath) getAttribute(INCLUDE);
|
||||||
|
if (baseRef != null) {
|
||||||
|
return CoreModel.newIncludeRefEntry(fPath, baseRef, include);
|
||||||
|
} else {
|
||||||
|
return CoreModel.newIncludeEntry(fPath, base, include, ((Boolean) getAttribute(SYSTEM_INCLUDE)).booleanValue(),
|
||||||
|
exclusionPattern);
|
||||||
|
}
|
||||||
|
case IPathEntry.CDT_MACRO :
|
||||||
|
String macroName = (String) getAttribute(MACRO_NAME);
|
||||||
|
String macroValue = (String) getAttribute(MACRO_VALUE);
|
||||||
|
if (baseRef != null) {
|
||||||
|
return CoreModel.newMacroRefEntry(fPath, baseRef, macroName);
|
||||||
|
} else {
|
||||||
|
return CoreModel.newMacroEntry(fPath, macroName, macroValue, exclusionPattern);
|
||||||
|
}
|
||||||
|
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();
|
||||||
|
@ -169,17 +170,17 @@ public class CPListElement {
|
||||||
appendEncodePath(fPath, buf).append(';');
|
appendEncodePath(fPath, buf).append(';');
|
||||||
buf.append(Boolean.valueOf(fIsExported)).append(';');
|
buf.append(Boolean.valueOf(fIsExported)).append(';');
|
||||||
switch (fEntryKind) {
|
switch (fEntryKind) {
|
||||||
case IPathEntry.CDT_OUTPUT:
|
case IPathEntry.CDT_OUTPUT :
|
||||||
case IPathEntry.CDT_SOURCE:
|
case IPathEntry.CDT_SOURCE :
|
||||||
case IPathEntry.CDT_INCLUDE:
|
case IPathEntry.CDT_INCLUDE :
|
||||||
case IPathEntry.CDT_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);
|
appendEncodePath(exclusion[i], buf);
|
||||||
}
|
}
|
||||||
switch (fEntryKind) {
|
switch (fEntryKind) {
|
||||||
case IPathEntry.CDT_INCLUDE:
|
case IPathEntry.CDT_INCLUDE :
|
||||||
IPath baseRef = (IPath) getAttribute(BASE_REF);
|
IPath baseRef = (IPath) getAttribute(BASE_REF);
|
||||||
appendEncodePath(baseRef, buf);
|
appendEncodePath(baseRef, buf);
|
||||||
IPath base = (IPath) getAttribute(BASE);
|
IPath base = (IPath) getAttribute(BASE);
|
||||||
|
@ -187,25 +188,27 @@ public class CPListElement {
|
||||||
IPath include = (IPath) getAttribute(INCLUDE);
|
IPath include = (IPath) getAttribute(INCLUDE);
|
||||||
appendEncodePath(include, buf);
|
appendEncodePath(include, buf);
|
||||||
break;
|
break;
|
||||||
case IPathEntry.CDT_MACRO:
|
case IPathEntry.CDT_MACRO :
|
||||||
baseRef = (IPath) getAttribute(BASE_REF);
|
baseRef = (IPath) getAttribute(BASE_REF);
|
||||||
appendEncodePath(baseRef, buf);
|
appendEncodePath(baseRef, buf);
|
||||||
base = (IPath) getAttribute(BASE);
|
base = (IPath) getAttribute(BASE);
|
||||||
appendEncodePath(base, buf);
|
appendEncodePath(base, buf);
|
||||||
String symbol = (String) getAttribute(MACRO_NAME);
|
String symbol = (String) getAttribute(MACRO_NAME);
|
||||||
buf.append(symbol).append(';');
|
buf.append(symbol).append(';');
|
||||||
default:
|
default :
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case IPathEntry.CDT_LIBRARY:
|
case IPathEntry.CDT_LIBRARY :
|
||||||
|
IPath baseRef = (IPath) getAttribute(BASE_REF);
|
||||||
|
appendEncodePath(baseRef, buf);
|
||||||
IPath base = (IPath) getAttribute(BASE);
|
IPath base = (IPath) getAttribute(BASE);
|
||||||
appendEncodePath(base, buf);
|
appendEncodePath(base, buf);
|
||||||
IPath sourceAttach = (IPath) getAttribute(SOURCEATTACHMENT);
|
IPath sourceAttach = (IPath) getAttribute(SOURCEATTACHMENT);
|
||||||
appendEncodePath(sourceAttach, buf);
|
appendEncodePath(sourceAttach, buf);
|
||||||
break;
|
break;
|
||||||
default:
|
default :
|
||||||
}
|
}
|
||||||
buf.setLength(buf.length()-1);
|
buf.setLength(buf.length() - 1);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,8 +231,7 @@ public class CPListElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Entries without resource are either non existing or a variable entry
|
* Entries without resource are either non existing or a variable entry External jars do not have a resource
|
||||||
* External jars do not have a resource
|
|
||||||
*/
|
*/
|
||||||
public IResource getResource() {
|
public IResource getResource() {
|
||||||
return fResource;
|
return fResource;
|
||||||
|
@ -263,7 +265,7 @@ public class CPListElement {
|
||||||
if (attrib != null) {
|
if (attrib != null) {
|
||||||
return attrib.getValue();
|
return attrib.getValue();
|
||||||
}
|
}
|
||||||
return new Path("");
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createAttributeElement(String key, Object value) {
|
private void createAttributeElement(String key, Object value) {
|
||||||
|
@ -272,7 +274,7 @@ public class CPListElement {
|
||||||
|
|
||||||
public Object[] getChildren() {
|
public Object[] getChildren() {
|
||||||
if (fEntryKind == IPathEntry.CDT_OUTPUT || fEntryKind == IPathEntry.CDT_SOURCE) {
|
if (fEntryKind == IPathEntry.CDT_OUTPUT || fEntryKind == IPathEntry.CDT_SOURCE) {
|
||||||
return new Object[] { findAttributeElement(EXCLUSION)};
|
return new Object[]{findAttributeElement(EXCLUSION)};
|
||||||
}
|
}
|
||||||
return fChildren.toArray();
|
return fChildren.toArray();
|
||||||
}
|
}
|
||||||
|
@ -299,13 +301,14 @@ public class CPListElement {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
switch (fEntryKind) {
|
switch (fEntryKind) {
|
||||||
case IPathEntry.CDT_LIBRARY:
|
case IPathEntry.CDT_LIBRARY :
|
||||||
return getAttribute(BASE).equals(elem.getAttribute(BASE));
|
return getAttribute(BASE).equals(elem.getAttribute(BASE))
|
||||||
case IPathEntry.CDT_INCLUDE:
|
&& getAttribute(BASE_REF).equals(elem.getAttribute(BASE_REF));
|
||||||
|
case IPathEntry.CDT_INCLUDE :
|
||||||
return (getAttribute(INCLUDE).equals(elem.getAttribute(INCLUDE))
|
return (getAttribute(INCLUDE).equals(elem.getAttribute(INCLUDE))
|
||||||
&& getAttribute(BASE_REF).equals(elem.getAttribute(BASE_REF)) && getAttribute(BASE).equals(
|
&& getAttribute(BASE_REF).equals(elem.getAttribute(BASE_REF)) && getAttribute(BASE).equals(
|
||||||
elem.getAttribute(BASE)));
|
elem.getAttribute(BASE)));
|
||||||
case IPathEntry.CDT_MACRO:
|
case IPathEntry.CDT_MACRO :
|
||||||
return (getAttribute(MACRO_NAME).equals(elem.getAttribute(MACRO_NAME))
|
return (getAttribute(MACRO_NAME).equals(elem.getAttribute(MACRO_NAME))
|
||||||
&& getAttribute(BASE_REF).equals(elem.getAttribute(BASE_REF)) && getAttribute(BASE).equals(
|
&& getAttribute(BASE_REF).equals(elem.getAttribute(BASE_REF)) && getAttribute(BASE).equals(
|
||||||
elem.getAttribute(BASE)));
|
elem.getAttribute(BASE)));
|
||||||
|
@ -319,16 +322,25 @@ public class CPListElement {
|
||||||
* @see Object#hashCode()
|
* @see Object#hashCode()
|
||||||
*/
|
*/
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hashCode = 0;
|
final int HASH_FACTOR = 89;
|
||||||
|
int hashCode = fPath.hashCode() + fEntryKind;
|
||||||
switch (fEntryKind) {
|
switch (fEntryKind) {
|
||||||
case IPathEntry.CDT_LIBRARY:
|
case IPathEntry.CDT_LIBRARY :
|
||||||
hashCode = getAttribute(BASE).hashCode();
|
hashCode = hashCode * HASH_FACTOR + getAttribute(BASE).hashCode();
|
||||||
case IPathEntry.CDT_INCLUDE:
|
hashCode = hashCode * HASH_FACTOR + getAttribute(BASE_REF).hashCode();
|
||||||
hashCode = getAttribute(INCLUDE).hashCode() + getAttribute(BASE_REF).hashCode() + getAttribute(BASE).hashCode();
|
break;
|
||||||
case IPathEntry.CDT_MACRO:
|
case IPathEntry.CDT_INCLUDE :
|
||||||
hashCode = getAttribute(MACRO_NAME).hashCode() + getAttribute(BASE_REF).hashCode() + getAttribute(BASE).hashCode();
|
hashCode = hashCode * HASH_FACTOR + getAttribute(INCLUDE).hashCode();
|
||||||
|
hashCode = hashCode * HASH_FACTOR + getAttribute(BASE_REF).hashCode();
|
||||||
|
hashCode = hashCode * HASH_FACTOR + getAttribute(BASE).hashCode();
|
||||||
|
break;
|
||||||
|
case IPathEntry.CDT_MACRO :
|
||||||
|
hashCode = hashCode * HASH_FACTOR + getAttribute(MACRO_NAME).hashCode();
|
||||||
|
hashCode = hashCode * HASH_FACTOR + getAttribute(BASE_REF).hashCode();
|
||||||
|
hashCode = hashCode * HASH_FACTOR + getAttribute(BASE).hashCode();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return fPath.hashCode() + fEntryKind;
|
return hashCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -382,7 +394,7 @@ public class CPListElement {
|
||||||
* @return Returns a ICProject
|
* @return Returns a ICProject
|
||||||
*/
|
*/
|
||||||
public ICProject getCProject() {
|
public ICProject getCProject() {
|
||||||
return fProject;
|
return fCProject;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CPListElement createFromExisting(IPathEntry curr, ICProject project) {
|
public static CPListElement createFromExisting(IPathEntry curr, ICProject project) {
|
||||||
|
@ -403,14 +415,14 @@ public class CPListElement {
|
||||||
// URL javaDocLocation = null;
|
// URL javaDocLocation = null;
|
||||||
|
|
||||||
switch (curr.getEntryKind()) {
|
switch (curr.getEntryKind()) {
|
||||||
case IPathEntry.CDT_CONTAINER:
|
case IPathEntry.CDT_CONTAINER :
|
||||||
res = null;
|
res = null;
|
||||||
try {
|
try {
|
||||||
isMissing = (CoreModel.getDefault().getPathEntryContainer(path, project) == null);
|
isMissing = (CoreModel.getDefault().getPathEntryContainer(path, project) == null);
|
||||||
} catch (CModelException e) {
|
} catch (CModelException e) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case IPathEntry.CDT_LIBRARY:
|
case IPathEntry.CDT_LIBRARY :
|
||||||
res = root.findMember(path);
|
res = root.findMember(path);
|
||||||
if (res == null) {
|
if (res == null) {
|
||||||
// if (!ArchiveFileFilter.isArchivePath(path)) {
|
// if (!ArchiveFileFilter.isArchivePath(path)) {
|
||||||
|
@ -421,8 +433,10 @@ public class CPListElement {
|
||||||
isMissing = !path.toFile().isFile(); // look for external
|
isMissing = !path.toFile().isFile(); // look for external
|
||||||
}
|
}
|
||||||
sourceAttachment = ((ILibraryEntry) curr).getSourceAttachmentPath();
|
sourceAttachment = ((ILibraryEntry) curr).getSourceAttachmentPath();
|
||||||
|
base = ((ILibraryEntry) curr).getBasePath();
|
||||||
|
baseRef = ((ILibraryEntry) curr).getBaseReference();
|
||||||
break;
|
break;
|
||||||
case IPathEntry.CDT_SOURCE:
|
case IPathEntry.CDT_SOURCE :
|
||||||
path = path.removeTrailingSeparator();
|
path = path.removeTrailingSeparator();
|
||||||
res = root.findMember(path);
|
res = root.findMember(path);
|
||||||
if (res == null) {
|
if (res == null) {
|
||||||
|
@ -433,7 +447,7 @@ public class CPListElement {
|
||||||
}
|
}
|
||||||
exclusion = ((ISourceEntry) curr).getExclusionPatterns();
|
exclusion = ((ISourceEntry) curr).getExclusionPatterns();
|
||||||
break;
|
break;
|
||||||
case IPathEntry.CDT_OUTPUT:
|
case IPathEntry.CDT_OUTPUT :
|
||||||
path = path.removeTrailingSeparator();
|
path = path.removeTrailingSeparator();
|
||||||
res = root.findMember(path);
|
res = root.findMember(path);
|
||||||
if (res == null) {
|
if (res == null) {
|
||||||
|
@ -444,7 +458,7 @@ public class CPListElement {
|
||||||
}
|
}
|
||||||
exclusion = ((IOutputEntry) curr).getExclusionPatterns();
|
exclusion = ((IOutputEntry) curr).getExclusionPatterns();
|
||||||
break;
|
break;
|
||||||
case IPathEntry.CDT_INCLUDE:
|
case IPathEntry.CDT_INCLUDE :
|
||||||
path = path.removeTrailingSeparator();
|
path = path.removeTrailingSeparator();
|
||||||
res = root.findMember(path);
|
res = root.findMember(path);
|
||||||
if (res == null) {
|
if (res == null) {
|
||||||
|
@ -457,12 +471,11 @@ public class CPListElement {
|
||||||
}
|
}
|
||||||
exclusion = ((IIncludeEntry) curr).getExclusionPatterns();
|
exclusion = ((IIncludeEntry) curr).getExclusionPatterns();
|
||||||
sysInclude = ((IIncludeEntry) curr).isSystemInclude();
|
sysInclude = ((IIncludeEntry) curr).isSystemInclude();
|
||||||
baseRef = ((IIncludeEntry) curr).getBasePath();
|
baseRef = ((IIncludeEntry) curr).getBaseReference();
|
||||||
base = new Path("");
|
base = ((IIncludeEntry) curr).getBasePath();
|
||||||
// base = ((IIncludeEntry) curr).getBasePath();
|
|
||||||
include = ((IIncludeEntry) curr).getIncludePath();
|
include = ((IIncludeEntry) curr).getIncludePath();
|
||||||
break;
|
break;
|
||||||
case IPathEntry.CDT_MACRO:
|
case IPathEntry.CDT_MACRO :
|
||||||
path = path.removeTrailingSeparator();
|
path = path.removeTrailingSeparator();
|
||||||
res = root.findMember(path);
|
res = root.findMember(path);
|
||||||
if (res == null) {
|
if (res == null) {
|
||||||
|
@ -476,11 +489,10 @@ public class CPListElement {
|
||||||
exclusion = ((IMacroEntry) curr).getExclusionPatterns();
|
exclusion = ((IMacroEntry) curr).getExclusionPatterns();
|
||||||
macroName = ((IMacroEntry) curr).getMacroName();
|
macroName = ((IMacroEntry) curr).getMacroName();
|
||||||
macroValue = ((IMacroEntry) curr).getMacroValue();
|
macroValue = ((IMacroEntry) curr).getMacroValue();
|
||||||
baseRef = ((IMacroEntry) curr).getBasePath();
|
baseRef = ((IMacroEntry) curr).getBaseReference();
|
||||||
base = new Path("");
|
base = ((IIncludeEntry) curr).getBasePath();
|
||||||
// base = ((IIncludeEntry) curr).getBasePath();
|
|
||||||
break;
|
break;
|
||||||
case IPathEntry.CDT_PROJECT:
|
case IPathEntry.CDT_PROJECT :
|
||||||
res = root.findMember(path);
|
res = root.findMember(path);
|
||||||
isMissing = (res == null);
|
isMissing = (res == null);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -104,7 +104,7 @@ public class CPathContainerDefaultPage extends NewElementWizardPage implements I
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see IClasspathContainerPage#getSelection()
|
* @see IClasspathContainerPage#getSelection()
|
||||||
*/
|
*/
|
||||||
public IPathEntry[] getNewContainers() {
|
public IPathEntry[] getContainerEntries() {
|
||||||
return new IPathEntry[] {CoreModel.newContainerEntry(new Path(fEntryField.getText()))};
|
return new IPathEntry[] {CoreModel.newContainerEntry(new Path(fEntryField.getText()))};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@ public class CPathContainerWizard extends Wizard {
|
||||||
public boolean performFinish() {
|
public boolean performFinish() {
|
||||||
if (fContainerPage != null) {
|
if (fContainerPage != null) {
|
||||||
if (fContainerPage.finish()) {
|
if (fContainerPage.finish()) {
|
||||||
fNewEntries = fContainerPage.getNewContainers();
|
fNewEntries = fContainerPage.getContainerEntries();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ CPathsPropertyPage.closed_project.message=Path information is not available for
|
||||||
CPathsPropertyPage.error.title=Error Setting Propject Paths
|
CPathsPropertyPage.error.title=Error Setting Propject Paths
|
||||||
CPathsPropertyPage.error.message=An error occurred while setting the project path
|
CPathsPropertyPage.error.message=An error occurred while setting the project path
|
||||||
CPathsPropertyPage.unsavedchanges.title=Setting C/C++ Project Path
|
CPathsPropertyPage.unsavedchanges.title=Setting C/C++ Project Path
|
||||||
CPathsPropertyPage.unsavedchanges.message=The C/C++ Project path property page contains unsaved modifications. Do you want to save changes so that other build path related property pages can be updated?
|
CPathsPropertyPage.unsavedchanges.message=The C/C++ Project path property page contains unsaved modifications. Do you want to save changes so that other path related property pages can be updated?
|
||||||
CPathsPropertyPage.unsavedchanges.button.save=Apply
|
CPathsPropertyPage.unsavedchanges.button.save=Apply
|
||||||
CPathsPropertyPage.unsavedchanges.button.discard=Discard
|
CPathsPropertyPage.unsavedchanges.button.discard=Discard
|
||||||
CPathsPropertyPage.unsavedchanges.button.ignore=Apply Later
|
CPathsPropertyPage.unsavedchanges.button.ignore=Apply Later
|
||||||
|
@ -26,6 +26,7 @@ SymbolEntryPage.add=Add User Defined...
|
||||||
SymbolEntryPage.addFromWorkspace=Add from Workspace...
|
SymbolEntryPage.addFromWorkspace=Add from Workspace...
|
||||||
SymbolEntryPage.addContributed=Add Contributed...
|
SymbolEntryPage.addContributed=Add Contributed...
|
||||||
SymbolEntryPage.remove=Remove
|
SymbolEntryPage.remove=Remove
|
||||||
|
SymbolEntryPage.edit=Edit...
|
||||||
SymbolEntryPage.listName=Defines:
|
SymbolEntryPage.listName=Defines:
|
||||||
SymbolEntryPage.editSourcePaths=Edit Source Paths...
|
SymbolEntryPage.editSourcePaths=Edit Source Paths...
|
||||||
SymbolEntryPage.sourcePaths=Source Paths:
|
SymbolEntryPage.sourcePaths=Source Paths:
|
||||||
|
@ -38,12 +39,14 @@ IncludeEntryPage.add=Add External...
|
||||||
IncludeEntryPage.addFromWorkspace=Add From Workspace...
|
IncludeEntryPage.addFromWorkspace=Add From Workspace...
|
||||||
IncludeEntryPage.addContributed=Add Contributed...
|
IncludeEntryPage.addContributed=Add Contributed...
|
||||||
IncludeEntryPage.remove=Remove
|
IncludeEntryPage.remove=Remove
|
||||||
|
IncludeEntryPage.edit=Edit...
|
||||||
IncludeEntryPage.listName=Include Paths:
|
IncludeEntryPage.listName=Include Paths:
|
||||||
IncludeEntryPage.editSourcePaths=Edit Source Paths...
|
IncludeEntryPage.editSourcePaths=Edit Source Paths...
|
||||||
IncludeEntryPage.sourcePaths=Source Paths:
|
IncludeEntryPage.sourcePaths=Source Paths:
|
||||||
IncludeEntryPage.addExternal.button.browse=Browse...
|
IncludeEntryPage.addExternal.button.browse=Browse...
|
||||||
IncludeEntryPage.addExternal.title=Add External Include Path
|
IncludeEntryPage.addExternal.title=Add External Include Path
|
||||||
IncludeEntryPage.addExternal.message=Include path:
|
IncludeEntryPage.addExternal.message=Include path:
|
||||||
|
|
||||||
# ------- BuildPathsBlock -------
|
# ------- BuildPathsBlock -------
|
||||||
CPathsBlock.path.up.button=&Up
|
CPathsBlock.path.up.button=&Up
|
||||||
CPathsBlock.path.down.button=&Down
|
CPathsBlock.path.down.button=&Down
|
||||||
|
@ -51,9 +54,9 @@ CPathsBlock.path.checkall.button=Select &All
|
||||||
CPathsBlock.path.uncheckall.button=D&eselect All
|
CPathsBlock.path.uncheckall.button=D&eselect All
|
||||||
CPathsBlock.path.label=Path order and exported entries:\n(Exported entries are contributed to dependent projects)
|
CPathsBlock.path.label=Path order and exported entries:\n(Exported entries are contributed to dependent projects)
|
||||||
CPathsBlock.warning.EntryMissing=Build path entry is missing: {0}
|
CPathsBlock.warning.EntryMissing=Build path entry is missing: {0}
|
||||||
CPathsBlock.warning.EntriesMissing={0} build path entries are missing.
|
CPathsBlock.warning.EntriesMissing={0} project path entries are missing.
|
||||||
CPathsBlock.operationdesc_project=Creating project...
|
CPathsBlock.operationdesc_project=Creating project...
|
||||||
CPathsBlock.operationdesc_c=Setting build paths...
|
CPathsBlock.operationdesc_c=Setting project paths...
|
||||||
|
|
||||||
# ------- SourcePathEntryPage-------
|
# ------- SourcePathEntryPage-------
|
||||||
SourcePathEntryPage.title=&Source
|
SourcePathEntryPage.title=&Source
|
||||||
|
@ -78,7 +81,6 @@ SourcePathEntryPage.exclusion_added.title=Source Folder Added
|
||||||
SourcePathEntryPage.exclusion_added.message=Exclusion filters have been added to nesting folders.
|
SourcePathEntryPage.exclusion_added.message=Exclusion filters have been added to nesting folders.
|
||||||
|
|
||||||
# ------- OutputPathEntryPage-------
|
# ------- OutputPathEntryPage-------
|
||||||
|
|
||||||
OutputPathEntryPage.title=&Output
|
OutputPathEntryPage.title=&Output
|
||||||
OutputPathEntryPage.description=Build Output locations
|
OutputPathEntryPage.description=Build Output locations
|
||||||
OutputPathEntryPage.folders.label=Output folders on build pat&h:
|
OutputPathEntryPage.folders.label=Output folders on build pat&h:
|
||||||
|
@ -103,18 +105,13 @@ ProjectsEntryPage.projects.checkall.button=Select &All
|
||||||
ProjectsEntryWorkbookPage.projects.uncheckall.button=&Deselect All
|
ProjectsEntryWorkbookPage.projects.uncheckall.button=&Deselect All
|
||||||
|
|
||||||
# ------- LibrariesWorkbookPage-------
|
# ------- LibrariesWorkbookPage-------
|
||||||
|
LibrariesEntryPage.libraries.label=Libraries on the build path:
|
||||||
|
LibrariesEntryPage.libraries.remove.button=&Remove
|
||||||
|
|
||||||
LibrariesWorkbookPage.libraries.label=JARs &and class folders on the build path:
|
LibrariesEntryPage.libraries.addextlib.button=Add E&xternal Library...
|
||||||
LibrariesWorkbookPage.libraries.remove.button=&Remove
|
LibrariesEntryPage.libraries.addcontriblib.button=Add &Contributed...
|
||||||
|
LibrariesEntryPage.libraries.addworkspacelib.button=Add from Workspace...
|
||||||
LibrariesWorkbookPage.libraries.addjar.button=Add &JARs...
|
LibrariesEntryPage.libraries.edit.button=&Edit...
|
||||||
LibrariesWorkbookPage.libraries.addextjar.button=Add E&xternal JARs...
|
|
||||||
LibrariesWorkbookPage.libraries.addvariable.button=Add &Variable...
|
|
||||||
LibrariesWorkbookPage.libraries.addlibrary.button=Add Li&brary...
|
|
||||||
LibrariesWorkbookPage.libraries.addclassfolder.button=Add Class &Folder...
|
|
||||||
|
|
||||||
|
|
||||||
LibrariesWorkbookPage.libraries.edit.button=&Edit...
|
|
||||||
|
|
||||||
LibrariesWorkbookPage.ExistingClassFolderDialog.new.title=Class Folder Selection
|
LibrariesWorkbookPage.ExistingClassFolderDialog.new.title=Class Folder Selection
|
||||||
LibrariesWorkbookPage.ExistingClassFolderDialog.new.description=&Choose class folders to be added to the build path:
|
LibrariesWorkbookPage.ExistingClassFolderDialog.new.description=&Choose class folders to be added to the build path:
|
||||||
|
@ -157,7 +154,6 @@ OrderExportsPage.title=&Order and Export
|
||||||
OrderExportsPage.description=
|
OrderExportsPage.description=
|
||||||
|
|
||||||
# ------- ExclusionPatternDialog -------
|
# ------- ExclusionPatternDialog -------
|
||||||
|
|
||||||
ExclusionPatternDialog.title=Source Folder Exclusion Patterns
|
ExclusionPatternDialog.title=Source Folder Exclusion Patterns
|
||||||
ExclusionPatternDialog.pattern.label=E&xclusion patterns for ''{0}'':
|
ExclusionPatternDialog.pattern.label=E&xclusion patterns for ''{0}'':
|
||||||
ExclusionPatternDialog.pattern.add=A&dd...
|
ExclusionPatternDialog.pattern.add=A&dd...
|
||||||
|
@ -168,7 +164,6 @@ ExclusionPatternDialog.ChooseExclusionPattern.title=Exclusion Pattern Selection
|
||||||
ExclusionPatternDialog.ChooseExclusionPattern.description=&Choose folders or files to exclude:
|
ExclusionPatternDialog.ChooseExclusionPattern.description=&Choose folders or files to exclude:
|
||||||
|
|
||||||
# ------- ExclusionPatternEntryDialog -------
|
# ------- ExclusionPatternEntryDialog -------
|
||||||
|
|
||||||
ExclusionPatternEntryDialog.add.title=Add Exclusion Pattern
|
ExclusionPatternEntryDialog.add.title=Add Exclusion Pattern
|
||||||
ExclusionPatternEntryDialog.edit.title=Edit Exclusion Pattern
|
ExclusionPatternEntryDialog.edit.title=Edit Exclusion Pattern
|
||||||
ExclusionPatternEntryDialog.description=Enter a pattern for excluding files from the source folder. Allowed wildcards are '*', '?' and '**'. Examples: 'java/util/A*.java', 'java/util/', '**/Test*'.
|
ExclusionPatternEntryDialog.description=Enter a pattern for excluding files from the source folder. Allowed wildcards are '*', '?' and '**'. Examples: 'java/util/A*.java', 'java/util/', '**/Test*'.
|
||||||
|
@ -181,7 +176,6 @@ ExclusionPatternEntryDialog.ChooseExclusionPattern.title=Exclusion Pattern Selec
|
||||||
ExclusionPatternEntryDialog.ChooseExclusionPattern.description=&Choose a folder or file to exclude:
|
ExclusionPatternEntryDialog.ChooseExclusionPattern.description=&Choose a folder or file to exclude:
|
||||||
|
|
||||||
# ------- CPListLabelProvider -------
|
# ------- CPListLabelProvider -------
|
||||||
|
|
||||||
CPListLabelProvider.new=(new)
|
CPListLabelProvider.new=(new)
|
||||||
CPListLabelProvider.classcontainer=(class folder)
|
CPListLabelProvider.classcontainer=(class folder)
|
||||||
CPListLabelProvider.twopart={0} - {1}
|
CPListLabelProvider.twopart={0} - {1}
|
||||||
|
@ -194,7 +188,6 @@ CPListLabelProvider.exclusion_filter_separator=;
|
||||||
CPListLabelProvider.unknown_element.label=unknown element
|
CPListLabelProvider.unknown_element.label=unknown element
|
||||||
|
|
||||||
# ------- NewSourceFolderDialog-------
|
# ------- NewSourceFolderDialog-------
|
||||||
|
|
||||||
NewSourceFolderDialog.useproject.button=&Project as source folder
|
NewSourceFolderDialog.useproject.button=&Project as source folder
|
||||||
NewSourceFolderDialog.usefolder.button=&Folder as source folder
|
NewSourceFolderDialog.usefolder.button=&Folder as source folder
|
||||||
NewSourceFolderDialog.sourcefolder.label=&Source folder name:
|
NewSourceFolderDialog.sourcefolder.label=&Source folder name:
|
||||||
|
|
|
@ -14,6 +14,7 @@ import java.util.List;
|
||||||
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.wizards.dialogfields.ITreeListAdapter;
|
import org.eclipse.cdt.internal.ui.wizards.dialogfields.ITreeListAdapter;
|
||||||
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
import org.eclipse.jface.dialogs.IInputValidator;
|
import org.eclipse.jface.dialogs.IInputValidator;
|
||||||
import org.eclipse.jface.dialogs.InputDialog;
|
import org.eclipse.jface.dialogs.InputDialog;
|
||||||
|
@ -47,7 +48,7 @@ public class CPathIncludeEntryPage extends ExtendedCPathBasePage {
|
||||||
if (newItem != null && !newItem.equals("")) { //$NON-NLS-1$
|
if (newItem != null && !newItem.equals("")) { //$NON-NLS-1$
|
||||||
List cplist = fPathList.getElements();
|
List cplist = fPathList.getElements();
|
||||||
|
|
||||||
CPListElement newPath = newCPElement(((ICElement) getSelection().get(0)).getResource());
|
CPListElement newPath = newCPElement(((ICElement) getSelection().get(0)).getResource(), null);
|
||||||
newPath.setAttribute(CPListElement.INCLUDE, new Path(newItem));
|
newPath.setAttribute(CPListElement.INCLUDE, new Path(newItem));
|
||||||
if (!cplist.contains(newPath)) {
|
if (!cplist.contains(newPath)) {
|
||||||
fPathList.addElement(newPath);
|
fPathList.addElement(newPath);
|
||||||
|
@ -87,4 +88,13 @@ public class CPathIncludeEntryPage extends ExtendedCPathBasePage {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected CPListElement newCPElement(IResource resource, CPListElement copyFrom) {
|
||||||
|
CPListElement element = new CPListElement(fCurrCProject, getEntryKind(), resource.getFullPath(), resource);
|
||||||
|
if (copyFrom != null) {
|
||||||
|
element.setAttribute(CPListElement.INCLUDE, copyFrom.getAttribute(CPListElement.INCLUDE));
|
||||||
|
element.setAttribute(CPListElement.SYSTEM_INCLUDE, copyFrom.getAttribute(CPListElement.SYSTEM_INCLUDE));
|
||||||
|
}
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -14,6 +14,7 @@ import java.util.List;
|
||||||
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.wizards.dialogfields.ITreeListAdapter;
|
import org.eclipse.cdt.internal.ui.wizards.dialogfields.ITreeListAdapter;
|
||||||
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.jface.dialogs.InputDialog;
|
import org.eclipse.jface.dialogs.InputDialog;
|
||||||
import org.eclipse.jface.viewers.StructuredSelection;
|
import org.eclipse.jface.viewers.StructuredSelection;
|
||||||
import org.eclipse.jface.window.Window;
|
import org.eclipse.jface.window.Window;
|
||||||
|
@ -39,7 +40,7 @@ public class CPathSymbolEntryPage extends ExtendedCPathBasePage {
|
||||||
if (symbol != null && symbol.length() > 0) {
|
if (symbol != null && symbol.length() > 0) {
|
||||||
List cplist = fPathList.getElements();
|
List cplist = fPathList.getElements();
|
||||||
|
|
||||||
CPListElement newPath = newCPElement(((ICElement) getSelection().get(0)).getResource());
|
CPListElement newPath = newCPElement(((ICElement) getSelection().get(0)).getResource(), null);
|
||||||
String name, value = ""; //$NON-NLS-1$
|
String name, value = ""; //$NON-NLS-1$
|
||||||
int index = symbol.indexOf("="); //$NON-NLS-1$
|
int index = symbol.indexOf("="); //$NON-NLS-1$
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
|
@ -58,4 +59,12 @@ public class CPathSymbolEntryPage extends ExtendedCPathBasePage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected CPListElement newCPElement(IResource resource, CPListElement copyFrom) {
|
||||||
|
CPListElement element = new CPListElement(fCurrCProject, getEntryKind(), resource.getFullPath(), resource);
|
||||||
|
if (copyFrom != null) {
|
||||||
|
element.setAttribute(CPListElement.MACRO_NAME, copyFrom.getAttribute(CPListElement.MACRO_NAME));
|
||||||
|
}
|
||||||
|
return element;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -67,7 +67,8 @@ public abstract class ExtendedCPathBasePage extends CPathBasePage {
|
||||||
private static final int IDX_ADD = 0;
|
private static final int IDX_ADD = 0;
|
||||||
private static final int IDX_ADD_WORKSPACE = 1;
|
private static final int IDX_ADD_WORKSPACE = 1;
|
||||||
private static final int IDX_ADD_CONTRIBUTED = 2;
|
private static final int IDX_ADD_CONTRIBUTED = 2;
|
||||||
private static final int IDX_REMOVE = 4;
|
private static final int IDX_EDIT = 4;
|
||||||
|
private static final int IDX_REMOVE = 5;
|
||||||
private String fPrefix;
|
private String fPrefix;
|
||||||
|
|
||||||
private class IncludeListAdapter implements IListAdapter, IDialogFieldListener {
|
private class IncludeListAdapter implements IListAdapter, IDialogFieldListener {
|
||||||
|
@ -86,6 +87,11 @@ public abstract class ExtendedCPathBasePage extends CPathBasePage {
|
||||||
case IDX_ADD_CONTRIBUTED:
|
case IDX_ADD_CONTRIBUTED:
|
||||||
addContributed();
|
addContributed();
|
||||||
break;
|
break;
|
||||||
|
case IDX_EDIT:
|
||||||
|
if (canEdit(field.getSelectedElements())) {
|
||||||
|
editPath((CPListElement) field.getSelectedElements().get(0));
|
||||||
|
}
|
||||||
|
break;
|
||||||
case IDX_REMOVE:
|
case IDX_REMOVE:
|
||||||
if (canRemove(field.getSelectedElements())) {
|
if (canRemove(field.getSelectedElements())) {
|
||||||
removePath((CPListElement) field.getSelectedElements().get(0));
|
removePath((CPListElement) field.getSelectedElements().get(0));
|
||||||
|
@ -97,6 +103,7 @@ public abstract class ExtendedCPathBasePage extends CPathBasePage {
|
||||||
public void selectionChanged(ListDialogField field) {
|
public void selectionChanged(ListDialogField field) {
|
||||||
List selected = fPathList.getSelectedElements();
|
List selected = fPathList.getSelectedElements();
|
||||||
fPathList.enableButton(IDX_REMOVE, canRemove(selected));
|
fPathList.enableButton(IDX_REMOVE, canRemove(selected));
|
||||||
|
fPathList.enableButton(IDX_EDIT, canEdit(selected));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doubleClicked(ListDialogField field) {
|
public void doubleClicked(ListDialogField field) {
|
||||||
|
@ -145,7 +152,7 @@ public abstract class ExtendedCPathBasePage extends CPathBasePage {
|
||||||
* @see Object#hashCode()
|
* @see Object#hashCode()
|
||||||
*/
|
*/
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return fBaseImage.hashCode() | (showInherited ? 0x1 : 0);
|
return fBaseImage.hashCode() & (showInherited ? ~0x1 : ~0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -179,7 +186,7 @@ public abstract class ExtendedCPathBasePage extends CPathBasePage {
|
||||||
|
|
||||||
public Image getImage(Object element) {
|
public Image getImage(Object element) {
|
||||||
Image image = super.getImage(element);
|
Image image = super.getImage(element);
|
||||||
if (isPathInherited((CPListElement) element)) {
|
if (isPathInheritedFromSelected((CPListElement) element)) {
|
||||||
image = new CPListImageDescriptor(image, true).createImage();
|
image = new CPListImageDescriptor(image, true).createImage();
|
||||||
}
|
}
|
||||||
return image;
|
return image;
|
||||||
|
@ -190,25 +197,11 @@ public abstract class ExtendedCPathBasePage extends CPathBasePage {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Color getForeground(Object element) {
|
public Color getForeground(Object element) {
|
||||||
if (isPathInherited((CPListElement) element)) {
|
if (isPathInheritedFromSelected((CPListElement) element)) {
|
||||||
return inDirect;
|
return inDirect;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isPathInherited(CPListElement element) {
|
|
||||||
IPath resPath = element.getPath();
|
|
||||||
List sel = getSelection();
|
|
||||||
if (!sel.isEmpty()) {
|
|
||||||
if (sel.get(0) instanceof ICElement) {
|
|
||||||
ICElement celem = (ICElement) sel.get(0);
|
|
||||||
if (!celem.getPath().equals(resPath)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ExtendedCPathBasePage(ITreeListAdapter adapter, String prefix) {
|
public ExtendedCPathBasePage(ITreeListAdapter adapter, String prefix) {
|
||||||
|
@ -219,7 +212,8 @@ public abstract class ExtendedCPathBasePage extends CPathBasePage {
|
||||||
String[] buttonLabel = new String[] { /* 0 */CPathEntryMessages.getString(prefix + ".add"), //$NON-NLS-1$
|
String[] buttonLabel = new String[] { /* 0 */CPathEntryMessages.getString(prefix + ".add"), //$NON-NLS-1$
|
||||||
/* 1 */CPathEntryMessages.getString(prefix + ".addFromWorkspace"), //$NON-NLS-1$
|
/* 1 */CPathEntryMessages.getString(prefix + ".addFromWorkspace"), //$NON-NLS-1$
|
||||||
/* 2 */CPathEntryMessages.getString(prefix + ".addContributed"), null, //$NON-NLS-1$
|
/* 2 */CPathEntryMessages.getString(prefix + ".addContributed"), null, //$NON-NLS-1$
|
||||||
/* 4 */CPathEntryMessages.getString(prefix + ".remove")}; //$NON-NLS-1$
|
/* 4 */CPathEntryMessages.getString(prefix + ".edit"), //$NON-NLS-1$
|
||||||
|
/* 5 */CPathEntryMessages.getString(prefix + ".remove")}; //$NON-NLS-1$
|
||||||
fPathList = new ListDialogField(includeListAdaper, buttonLabel, new ModifiedCPListLabelProvider()) {
|
fPathList = new ListDialogField(includeListAdaper, buttonLabel, new ModifiedCPListLabelProvider()) {
|
||||||
|
|
||||||
protected int getListStyle() {
|
protected int getListStyle() {
|
||||||
|
@ -251,7 +245,7 @@ public abstract class ExtendedCPathBasePage extends CPathBasePage {
|
||||||
int buttonBarWidth = converter.convertWidthInCharsToPixels(30);
|
int buttonBarWidth = converter.convertWidthInCharsToPixels(30);
|
||||||
fPathList.setButtonsMinWidth(buttonBarWidth);
|
fPathList.setButtonsMinWidth(buttonBarWidth);
|
||||||
fPathList.enableButton(IDX_REMOVE, false);
|
fPathList.enableButton(IDX_REMOVE, false);
|
||||||
|
fPathList.enableButton(IDX_EDIT, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isEntryKind(int kind) {
|
public boolean isEntryKind(int kind) {
|
||||||
|
@ -262,10 +256,34 @@ public abstract class ExtendedCPathBasePage extends CPathBasePage {
|
||||||
|
|
||||||
abstract int getEntryKind();
|
abstract int getEntryKind();
|
||||||
|
|
||||||
|
protected boolean isPathInheritedFromSelected(CPListElement element) {
|
||||||
|
IPath resPath = element.getPath();
|
||||||
|
List sel = getSelection();
|
||||||
|
if (!sel.isEmpty()) {
|
||||||
|
if (sel.get(0) instanceof ICElement) {
|
||||||
|
ICElement celem = (ICElement) sel.get(0);
|
||||||
|
if (!celem.getPath().equals(resPath)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
protected boolean canRemove(List selected) {
|
protected boolean canRemove(List selected) {
|
||||||
return !selected.isEmpty();
|
return !selected.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean canEdit(List selected) {
|
||||||
|
if( !selected.isEmpty() ) {
|
||||||
|
return !isPathInheritedFromSelected((CPListElement) selected.get(0));
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void editPath(CPListElement element) {
|
||||||
|
}
|
||||||
|
|
||||||
protected void removePath(CPListElement element) {
|
protected void removePath(CPListElement element) {
|
||||||
ICElement celem = (ICElement) getSelection().get(0);
|
ICElement celem = (ICElement) getSelection().get(0);
|
||||||
if (!celem.getPath().equals(element.getPath())) {
|
if (!celem.getPath().equals(element.getPath())) {
|
||||||
|
@ -370,12 +388,12 @@ public abstract class ExtendedCPathBasePage extends CPathBasePage {
|
||||||
CPathContainerWizard wizard = new CPathContainerWizard(elem, fCurrCProject, getRawClasspath());
|
CPathContainerWizard wizard = new CPathContainerWizard(elem, fCurrCProject, getRawClasspath());
|
||||||
wizard.setWindowTitle(title);
|
wizard.setWindowTitle(title);
|
||||||
if (CPathContainerWizard.openWizard(getShell(), wizard) == Window.OK) {
|
if (CPathContainerWizard.openWizard(getShell(), wizard) == Window.OK) {
|
||||||
IPathEntry[] created = wizard.getNewEntries();
|
IPathEntry[] elements = wizard.getNewEntries();
|
||||||
if (created != null) {
|
if (elements != null) {
|
||||||
CPListElement[] res = new CPListElement[created.length];
|
CPListElement[] res = new CPListElement[elements.length];
|
||||||
for (int i = 0; i < res.length; i++) {
|
for (int i = 0; i < res.length; i++) {
|
||||||
res[i] = newCPElement(((ICElement) getSelection().get(0)).getResource());
|
res[i] = newCPElement(((ICElement) getSelection().get(0)).getResource(), (CPListElement) elements[i]);
|
||||||
res[i].setAttribute(CPListElement.BASE_REF, created[i].getPath());
|
res[i].setAttribute(CPListElement.BASE_REF, elements[i].getPath());
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -383,9 +401,7 @@ public abstract class ExtendedCPathBasePage extends CPathBasePage {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected CPListElement newCPElement(IResource resource) {
|
abstract protected CPListElement newCPElement(IResource resource, CPListElement copyFrom);
|
||||||
return new CPListElement(fCurrCProject, getEntryKind(), resource.getFullPath(), resource);
|
|
||||||
}
|
|
||||||
|
|
||||||
private class WorkbenchCPathLabelProvider extends CPListLabelProvider {
|
private class WorkbenchCPathLabelProvider extends CPListLabelProvider {
|
||||||
|
|
||||||
|
@ -482,8 +498,8 @@ public abstract class ExtendedCPathBasePage extends CPathBasePage {
|
||||||
Object[] elements = dialog.getResult();
|
Object[] elements = dialog.getResult();
|
||||||
CPListElement[] res = new CPListElement[elements.length];
|
CPListElement[] res = new CPListElement[elements.length];
|
||||||
for (int i = 0; i < res.length; i++) {
|
for (int i = 0; i < res.length; i++) {
|
||||||
res[i] = newCPElement(((ICElement) getSelection().get(0)).getResource());
|
res[i] = newCPElement(((ICElement) getSelection().get(0)).getResource(), (CPListElement)elements[i]);
|
||||||
|
res[i].setAttribute(CPListElement.BASE_REF, ((CPListElement)elements[i]).getCProject().getPath());
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ public interface ICPathContainerPage extends IWizardPage {
|
||||||
* @return the classpath entries created on the page. All returned entries must be {@link
|
* @return the classpath entries created on the page. All returned entries must be {@link
|
||||||
* IClasspathEntry#CPE_CONTAINER}
|
* IClasspathEntry#CPE_CONTAINER}
|
||||||
*/
|
*/
|
||||||
public IPathEntry[] getNewContainers();
|
public IPathEntry[] getContainerEntries();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the path container entry to be edited or <code>null</code>
|
* Sets the path container entry to be edited or <code>null</code>
|
||||||
|
|
Loading…
Add table
Reference in a new issue