mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-22 00:15:25 +02:00
Enhanced loops.
This commit is contained in:
parent
11f33b6627
commit
e0da7a58dd
1 changed files with 21 additions and 23 deletions
|
@ -78,35 +78,33 @@ public class CSourceLookup extends AbstractDsfService implements ISourceLookup {
|
||||||
private List<String> getSourceLookupPath(ISourceContainer[] containers) {
|
private List<String> getSourceLookupPath(ISourceContainer[] containers) {
|
||||||
ArrayList<String> list = new ArrayList<String>(containers.length);
|
ArrayList<String> list = new ArrayList<String>(containers.length);
|
||||||
|
|
||||||
for (int i = 0; i < containers.length; ++i) {
|
for (ISourceContainer container : containers) {
|
||||||
if (containers[i] instanceof ProjectSourceContainer) {
|
if (container instanceof ProjectSourceContainer) {
|
||||||
IProject project = ((ProjectSourceContainer)containers[i]).getProject();
|
IProject project = ((ProjectSourceContainer) container).getProject();
|
||||||
if (project != null && project.exists()) {
|
if (project != null && project.exists()) {
|
||||||
IPath location = project.getLocation();
|
IPath location = project.getLocation();
|
||||||
if (location != null) {
|
if (location != null) {
|
||||||
list.add(location.toPortableString());
|
list.add(location.toPortableString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if (container instanceof FolderSourceContainer) {
|
||||||
if (containers[i] instanceof FolderSourceContainer) {
|
IContainer folder = ((FolderSourceContainer) container).getContainer();
|
||||||
IContainer container = ((FolderSourceContainer)containers[i]).getContainer();
|
if (folder != null && folder.exists()) {
|
||||||
if (container != null && container.exists()) {
|
IPath location = folder.getLocation();
|
||||||
IPath location = container.getLocation();
|
|
||||||
if (location != null) {
|
if (location != null) {
|
||||||
list.add(location.toPortableString());
|
list.add(location.toPortableString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if (container instanceof DirectorySourceContainer) {
|
||||||
if (containers[i] instanceof DirectorySourceContainer) {
|
File dir = ((DirectorySourceContainer) container).getDirectory();
|
||||||
File dir = ((DirectorySourceContainer)containers[i]).getDirectory();
|
|
||||||
if (dir != null && dir.exists()) {
|
if (dir != null && dir.exists()) {
|
||||||
IPath path = new Path(dir.getAbsolutePath());
|
IPath path = new Path(dir.getAbsolutePath());
|
||||||
list.add(path.toPortableString());
|
list.add(path.toPortableString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (containers[i].isComposite()) {
|
if (container.isComposite()) {
|
||||||
try {
|
try {
|
||||||
list.addAll(getSourceLookupPath(containers[i].getSourceContainers()));
|
list.addAll(getSourceLookupPath(container.getSourceContainers()));
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -122,7 +120,8 @@ public class CSourceLookup extends AbstractDsfService implements ISourceLookup {
|
||||||
@Override
|
@Override
|
||||||
protected void handleSuccess() {
|
protected void handleSuccess() {
|
||||||
doInitialize(requestMonitor);
|
doInitialize(requestMonitor);
|
||||||
}});
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doInitialize(final RequestMonitor requestMonitor) {
|
private void doInitialize(final RequestMonitor requestMonitor) {
|
||||||
|
@ -165,7 +164,6 @@ public class CSourceLookup extends AbstractDsfService implements ISourceLookup {
|
||||||
rm.setData(sourceString);
|
rm.setData(sourceString);
|
||||||
}
|
}
|
||||||
rm.done();
|
rm.done();
|
||||||
|
|
||||||
return Status.OK_STATUS;
|
return Status.OK_STATUS;
|
||||||
}
|
}
|
||||||
}.schedule();
|
}.schedule();
|
||||||
|
|
Loading…
Add table
Reference in a new issue