mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-08 16:55:38 +02:00
Cosmetics.
Change-Id: I3bdff42323e40f5440b20bfde2efa7658f0d680b
This commit is contained in:
parent
992e4b61eb
commit
871e7abcd0
2 changed files with 12 additions and 33 deletions
|
@ -12,7 +12,7 @@ package org.eclipse.cdt.debug.internal.core.sourcelookup;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
||||||
|
@ -23,6 +23,7 @@ import org.eclipse.core.runtime.Path;
|
||||||
import org.eclipse.debug.core.sourcelookup.ISourceContainer;
|
import org.eclipse.debug.core.sourcelookup.ISourceContainer;
|
||||||
import org.eclipse.debug.core.sourcelookup.ISourceContainerType;
|
import org.eclipse.debug.core.sourcelookup.ISourceContainerType;
|
||||||
import org.eclipse.debug.core.sourcelookup.containers.CompositeSourceContainer;
|
import org.eclipse.debug.core.sourcelookup.containers.CompositeSourceContainer;
|
||||||
|
import org.eclipse.debug.core.sourcelookup.containers.LocalFileStorage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A directory in the local file system that is used for running the C/C++ compiler. This container
|
* A directory in the local file system that is used for running the C/C++ compiler. This container
|
||||||
|
@ -78,9 +79,6 @@ public class CompilationDirectorySourceContainer extends CompositeSourceContaine
|
||||||
fSubfolders = subfolders;
|
fSubfolders = subfolders;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.debug.core.sourcelookup.ISourceContainer#getName()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return fDirectory.getAbsolutePath();
|
return fDirectory.getAbsolutePath();
|
||||||
|
@ -97,16 +95,13 @@ public class CompilationDirectorySourceContainer extends CompositeSourceContaine
|
||||||
return fDirectory;
|
return fDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.debug.core.sourcelookup.ISourceContainer#getType()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public ISourceContainerType getType() {
|
public ISourceContainerType getType() {
|
||||||
return getSourceContainerType(TYPE_ID);
|
return getSourceContainerType(TYPE_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Source elements returned from this method are instances of <code>IFile</code> or <code>LocalFileStorage</code>.
|
* Source elements returned from this method are instances of {@link IFile} or {@link LocalFileStorage}.
|
||||||
* @see org.eclipse.debug.core.sourcelookup.ISourceContainer#findSourceElements(String)
|
* @see org.eclipse.debug.core.sourcelookup.ISourceContainer#findSourceElements(String)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -115,11 +110,9 @@ public class CompilationDirectorySourceContainer extends CompositeSourceContaine
|
||||||
if (!file.isAbsolute()) {
|
if (!file.isAbsolute()) {
|
||||||
file = new File(fDirectory, name);
|
file = new File(fDirectory, name);
|
||||||
}
|
}
|
||||||
List<Object> sources = new ArrayList<Object>();
|
List<Object> sources = new ArrayList<>();
|
||||||
if (file.exists() && file.isFile()) {
|
if (file.exists() && file.isFile()) {
|
||||||
sources.addAll(Arrays.asList(SourceUtils.findSourceElements(file, getDirector())));
|
Collections.addAll(sources, SourceUtils.findSourceElements(file, getDirector()));
|
||||||
} else {
|
|
||||||
sources = new ArrayList<Object>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check sub-folders
|
// Check sub-folders
|
||||||
|
@ -130,8 +123,9 @@ public class CompilationDirectorySourceContainer extends CompositeSourceContaine
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (isFindDuplicates()) {
|
if (isFindDuplicates()) {
|
||||||
for (Object element : elements)
|
for (Object element : elements) {
|
||||||
sources.add(element);
|
sources.add(element);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
sources.add(elements[0]);
|
sources.add(elements[0]);
|
||||||
break;
|
break;
|
||||||
|
@ -144,17 +138,11 @@ public class CompilationDirectorySourceContainer extends CompositeSourceContaine
|
||||||
return sources.toArray();
|
return sources.toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.debug.core.sourcelookup.ISourceContainer#isComposite()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isComposite() {
|
public boolean isComposite() {
|
||||||
return fSubfolders;
|
return fSubfolders;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see java.lang.Object#equals(java.lang.Object)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (obj instanceof CompilationDirectorySourceContainer) {
|
if (obj instanceof CompilationDirectorySourceContainer) {
|
||||||
|
@ -164,23 +152,17 @@ public class CompilationDirectorySourceContainer extends CompositeSourceContaine
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see java.lang.Object#hashCode()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return getDirectory().hashCode();
|
return getDirectory().hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.debug.core.sourcelookup.containers.CompositeSourceContainer#createSourceContainers()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected ISourceContainer[] createSourceContainers() throws CoreException {
|
protected ISourceContainer[] createSourceContainers() throws CoreException {
|
||||||
if (fSubfolders) {
|
if (fSubfolders) {
|
||||||
String[] files = fDirectory.list();
|
String[] files = fDirectory.list();
|
||||||
if (files != null) {
|
if (files != null) {
|
||||||
List<ISourceContainer> dirs = new ArrayList<ISourceContainer>();
|
List<ISourceContainer> dirs = new ArrayList<>();
|
||||||
for (String name : files) {
|
for (String name : files) {
|
||||||
File file = new File(getDirectory(), name);
|
File file = new File(getDirectory(), name);
|
||||||
if (file.exists() && file.isDirectory()) {
|
if (file.exists() && file.isDirectory()) {
|
||||||
|
@ -197,9 +179,6 @@ public class CompilationDirectorySourceContainer extends CompositeSourceContaine
|
||||||
return new ISourceContainer[0];
|
return new ISourceContainer[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.cdt.debug.core.sourcelookup.IMappingSourceContainer#getCompilationPath(java.lang.String)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public IPath getCompilationPath(String sourceName) {
|
public IPath getCompilationPath(String sourceName) {
|
||||||
IPath path = new Path(sourceName);
|
IPath path = new Path(sourceName);
|
||||||
|
|
|
@ -19,7 +19,7 @@ import org.w3c.dom.Element;
|
||||||
import org.w3c.dom.Node;
|
import org.w3c.dom.Node;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See <code>CompilationDirectorySourceContainer</code>.
|
* See {@link CompilationDirectorySourceContainer}.
|
||||||
*/
|
*/
|
||||||
public class CompilationDirectorySourceContainerType extends AbstractSourceContainerTypeDelegate {
|
public class CompilationDirectorySourceContainerType extends AbstractSourceContainerTypeDelegate {
|
||||||
@Override
|
@Override
|
||||||
|
@ -43,13 +43,13 @@ public class CompilationDirectorySourceContainerType extends AbstractSourceConta
|
||||||
if (node.getNodeType() == Node.ELEMENT_NODE) {
|
if (node.getNodeType() == Node.ELEMENT_NODE) {
|
||||||
Element element = (Element) node;
|
Element element = (Element) node;
|
||||||
if ("directory".equals(element.getNodeName())) { //$NON-NLS-1$
|
if ("directory".equals(element.getNodeName())) { //$NON-NLS-1$
|
||||||
String string = element.getAttribute("path"); //$NON-NLS-1$
|
String path = element.getAttribute("path"); //$NON-NLS-1$
|
||||||
if (string == null || string.length() == 0) {
|
if (path == null || path.isEmpty()) {
|
||||||
abort(InternalSourceLookupMessages.CompilationDirectorySourceContainerType_0, null);
|
abort(InternalSourceLookupMessages.CompilationDirectorySourceContainerType_0, null);
|
||||||
}
|
}
|
||||||
String nest = element.getAttribute("nest"); //$NON-NLS-1$
|
String nest = element.getAttribute("nest"); //$NON-NLS-1$
|
||||||
boolean nested = "true".equals(nest); //$NON-NLS-1$
|
boolean nested = "true".equals(nest); //$NON-NLS-1$
|
||||||
return new CompilationDirectorySourceContainer(new Path(string), nested);
|
return new CompilationDirectorySourceContainer(new Path(path), nested);
|
||||||
}
|
}
|
||||||
abort(InternalSourceLookupMessages.CompilationDirectorySourceContainerType_1, null);
|
abort(InternalSourceLookupMessages.CompilationDirectorySourceContainerType_1, null);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue