1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-15 04:55:22 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2015-01-06 16:40:11 -08:00
parent ce73d736bd
commit 693185186e
5 changed files with 78 additions and 154 deletions

View file

@ -48,11 +48,6 @@ public class CContainer extends Openable implements ICContainer {
super(parent, res, type);
}
/**
* Returns a the collection of binary files in this ccontainer
*
* @see ICContainer#getBinaries()
*/
@Override
public IBinary[] getBinaries() throws CModelException {
List<?> list = getChildrenOfType(C_BINARY);
@ -61,9 +56,6 @@ public class CContainer extends Openable implements ICContainer {
return array;
}
/**
* @see ICContainer#getBinary(String)
*/
@Override
public IBinary getBinary(String name) {
IFile file = getContainer().getFile(new Path(name));
@ -78,11 +70,6 @@ public class CContainer extends Openable implements ICContainer {
return new Binary(this, file, null);
}
/**
* Returns a the collection of archive files in this ccontainer
*
* @see ICContainer#getArchives()
*/
@Override
public IArchive[] getArchives() throws CModelException {
List<?> list = getChildrenOfType(C_ARCHIVE);
@ -91,9 +78,6 @@ public class CContainer extends Openable implements ICContainer {
return array;
}
/**
* @see ICContainer#getArchive(String)
*/
@Override
public IArchive getArchive(String name) {
IFile file = getContainer().getFile(new Path(name));
@ -108,9 +92,6 @@ public class CContainer extends Openable implements ICContainer {
return new Archive(this, file, null);
}
/**
* @see ICContainer#getTranslationUnits()
*/
@Override
public ITranslationUnit[] getTranslationUnits() throws CModelException {
List<?> list = getChildrenOfType(C_UNIT);
@ -119,11 +100,6 @@ public class CContainer extends Openable implements ICContainer {
return array;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.model.ICContainer#getTranslationUnit(java.lang.String)
*/
@Override
public ITranslationUnit getTranslationUnit(String name) {
IFile file = getContainer().getFile(new Path(name));
@ -135,11 +111,6 @@ public class CContainer extends Openable implements ICContainer {
return new TranslationUnit(this, file, id);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.model.ICContainer#getCContainers()
*/
@Override
public ICContainer[] getCContainers() throws CModelException {
List<?> list = getChildrenOfType(C_CCONTAINER);
@ -148,11 +119,6 @@ public class CContainer extends Openable implements ICContainer {
return array;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.core.model.ICContainer#getCContainer(java.lang.String)
*/
@Override
public ICContainer getCContainer(String name) {
IFolder folder = getContainer().getFolder(new Path(name));
@ -164,7 +130,7 @@ public class CContainer extends Openable implements ICContainer {
}
public IContainer getContainer() {
return (IContainer) getResource();
return getResource();
}
@Override
@ -178,9 +144,6 @@ public class CContainer extends Openable implements ICContainer {
return getPath().hashCode();
}
/**
* @see Openable
*/
@Override
protected boolean buildStructure(OpenableInfo info, IProgressMonitor pm, Map<ICElement, CElementInfo> newElements, IResource underlyingResource)
throws CModelException {
@ -200,19 +163,13 @@ public class CContainer extends Openable implements ICContainer {
return validInfo;
}
/*
* (non-Javadoc) Returns an array of non-c resources contained in the
* receiver.
*
* @see org.eclipse.cdt.core.model.ICContainer#getNonCResources()
*/
@Override
public Object[] getNonCResources() throws CModelException {
return ((CContainerInfo) getElementInfo()).getNonCResources(getResource());
}
protected boolean computeChildren(OpenableInfo info, IResource res) throws CModelException {
ArrayList<ICElement> vChildren = new ArrayList<ICElement>();
ArrayList<ICElement> vChildren = new ArrayList<>();
try {
IResource[] resources = null;
if (res instanceof IContainer) {
@ -221,8 +178,8 @@ public class CContainer extends Openable implements ICContainer {
}
if (resources != null) {
ICProject cproject = getCProject();
for (IResource resource2 : resources) {
ICElement celement = computeChild(resource2, cproject);
for (IResource resource : resources) {
ICElement celement = computeChild(resource, cproject);
if (celement != null) {
vChildren.add(celement);
}
@ -325,5 +282,4 @@ public class CContainer extends Openable implements ICContainer {
protected char getHandleMementoDelimiter() {
return CElement.CEM_SOURCEFOLDER;
}
}

View file

@ -25,10 +25,6 @@ import org.eclipse.core.runtime.Path;
public class SourceRoot extends CContainer implements ISourceRoot {
ICSourceEntry sourceEntry;
/**
* @param parent
* @param res
*/
public SourceRoot(ICElement parent, IResource res, ICSourceEntry entry) {
super(parent, res);
sourceEntry = entry;
@ -90,5 +86,4 @@ public class SourceRoot extends CContainer implements ISourceRoot {
protected char getHandleMementoDelimiter() {
return CElement.CEM_SOURCEROOT;
}
}

View file

@ -1165,12 +1165,12 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
}
public static String getAbsoluteInclusionPath(String includeDirective, String currentFile) {
// Filename is an absolute path
// Filename is an absolute path.
if (new File(includeDirective).isAbsolute()) {
return includeDirective;
}
// Filename is a Linux absolute path on a Windows machine
if (File.separatorChar == '\\' && includeDirective.length() > 0) {
// Filename is a Linux absolute path on a Windows machine.
if (File.separatorChar == '\\' && !includeDirective.isEmpty()) {
final char firstChar = includeDirective.charAt(0);
if (firstChar == '\\' || firstChar == '/') {
if (currentFile != null && currentFile.length() > 1 && currentFile.charAt(1) == ':') {

View file

@ -10,22 +10,16 @@
*******************************************************************************/
package org.eclipse.cdt.internal.ui.filters;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.core.resources.IResource;
/**
* Filters closed projects
*/
public class ClosedProjectFilter extends ViewerFilter {
/*
* @see ViewerFilter
*/
@Override
public boolean select(Viewer viewer, Object parent, Object element) {
if (element instanceof ICElement)

View file

@ -61,8 +61,8 @@ public class LlvmEnvironmentVariableSupplier implements IConfigurationEnvironmen
if (System.getProperty("os.name").toLowerCase().indexOf("win") >= 0) { //$NON-NLS-1$ //$NON-NLS-2$
try {
// try to find mingw or cygwin path from PATH environment variable
IBuildEnvironmentVariable envPath = llvmEnvironmentVariables
.get(ENV_VAR_NAME_PATH);
IBuildEnvironmentVariable envPath =
llvmEnvironmentVariables.get(ENV_VAR_NAME_PATH);
IBuildEnvironmentVariable mingwPath=null, cygwinPath=null;
// if path is empty
if (envPath == null) {
@ -104,7 +104,7 @@ public class LlvmEnvironmentVariableSupplier implements IConfigurationEnvironmen
}
/**
* Get LLVM bin path
* Returns LLVM bin path
*
* @return LLVM bin path
*/
@ -113,7 +113,7 @@ public class LlvmEnvironmentVariableSupplier implements IConfigurationEnvironmen
}
/**
* Get LLVM include paths
* Returns LLVM include paths
*
* @return LLVM include paths
*/
@ -122,7 +122,7 @@ public class LlvmEnvironmentVariableSupplier implements IConfigurationEnvironmen
}
/**
* Get LLVM library paths
* Returns LLVM library paths
*
* @return LLVM library paths
*/
@ -131,17 +131,16 @@ public class LlvmEnvironmentVariableSupplier implements IConfigurationEnvironmen
}
/**
* Get LLVM libraries
* Returns LLVM libraries
*
* @return LLVM libraries
*/
public static String getLibraries() {
return getLlvmEnvironmentVariable(ENV_VAR_NAME_LIBRARIES).getValue();
}
/**
* Set path to LLVM bin.
* Sets path to LLVM bin.
*
* @param path Path to LLVM bin location.
*/
@ -150,7 +149,7 @@ public class LlvmEnvironmentVariableSupplier implements IConfigurationEnvironmen
}
/**
* Append a new include path.
* Appends a new include path.
*
* @param path Include path
*/
@ -163,7 +162,7 @@ public class LlvmEnvironmentVariableSupplier implements IConfigurationEnvironmen
}
/**
* Append a new library path.
* Appends a new library path.
*
* @param path Library path
*/
@ -176,7 +175,7 @@ public class LlvmEnvironmentVariableSupplier implements IConfigurationEnvironmen
}
/**
* Append a new library.
* Appends a new library.
*
* @param lib Library file
*/
@ -196,7 +195,7 @@ public class LlvmEnvironmentVariableSupplier implements IConfigurationEnvironmen
}
/**
* Get a specific path for given parameters.
* Returns a specific path for given parameters.
*
* @param pathKey Path for specific location
* @param subDirName Additional sub-path
@ -204,12 +203,11 @@ public class LlvmEnvironmentVariableSupplier implements IConfigurationEnvironmen
*/
private static String findBinDir(String pathKey, String subDirName) {
String resultPath = null;
//if preferences haven't been changed
//try to find the bin path from the LLVM environment variable HashMap
// If preferences haven't been changed, try to find the bin path from the LLVM environment
// variable map.
if (!preferencesChanged) { //TODO: Change
//get current path
LlvmBuildEnvironmentVariable earlierValue = llvmEnvironmentVariables
.get(pathKey);
LlvmBuildEnvironmentVariable earlierValue = llvmEnvironmentVariables.get(pathKey);
//if earlier LlvmBuildEnvironmentVariable exists
if (null != earlierValue) {
//return current path
@ -279,7 +277,7 @@ public class LlvmEnvironmentVariableSupplier implements IConfigurationEnvironmen
}
/**
* Get the full path for llvm executable if the bin path given
* Returns the full path for llvm executable if the bin path given
* as a parameter is found and executable exists in that path.
*
* @param binPathTemp User provided bin directory path
@ -298,7 +296,7 @@ public class LlvmEnvironmentVariableSupplier implements IConfigurationEnvironmen
arFileFullPath = new File(binPathTemp, llvm_executable);
// Check if file exists -> proper LLVM installation exists.
if (arFileFullPath.isFile()) {
// Return path where llvm-ar exists
// Return path where llvm-ar exists.
return binPathTemp;
}
}
@ -338,7 +336,7 @@ public class LlvmEnvironmentVariableSupplier implements IConfigurationEnvironmen
/**
*
* Get LLVM environment variable.
* Returns LLVM environment variable.
*
* @param envName Name of the environment variable
*/
@ -347,32 +345,32 @@ public class LlvmEnvironmentVariableSupplier implements IConfigurationEnvironmen
}
/**
* Set LLVM environment variable.
* Sets LLVM environment variable.
*
* @param name Name for the environment variable
* @param path Path for the environment variable
*/
private static void setLlvmEnvironmentVariable(String name, String path) {
//appends a new path in front of the the old path in HashMap that contains
// append a new path in front of the the old path in HashMap that contains
// the specific LLVM environment variable
llvmEnvironmentVariables.put(name, new LlvmBuildEnvironmentVariable(
name, path, IBuildEnvironmentVariable.ENVVAR_APPEND));
}
/**
* Set LLVM environment variable by replacing the existing paths.
* Sets LLVM environment variable by replacing the existing paths.
*
* @param name Name for the environment variable
* @param path Path for the environment variable
*/
public static void setLlvmEnvironmentVariableReplace(String name, String path) {
//replaces the old path in HashMap that contains the specific LLVM environment variable
// replace the old path in HashMap that contains the specific LLVM environment variable
llvmEnvironmentVariables.put(name, new LlvmBuildEnvironmentVariable(
name, path, IBuildEnvironmentVariable.ENVVAR_REPLACE));
}
/**
* Append a new LLVM environment variable to existing list.
* Appends a new LLVM environment variable to existing list.
*
* @param name Name of the preference
* @param oldPath Old paths/preference values
@ -384,7 +382,7 @@ public class LlvmEnvironmentVariableSupplier implements IConfigurationEnvironmen
// if oldPath exists
if (oldPath!=null) {
//if the oldPath isn't empty
if((oldPath.trim()).length()!=0) {
if (!oldPath.trim().isEmpty()) {
StringBuffer sB = new StringBuffer();
// append old path
sB.append(oldPath);
@ -400,15 +398,14 @@ public class LlvmEnvironmentVariableSupplier implements IConfigurationEnvironmen
if (!ok) {
newPath=path;
}
//set new path to the HashMap that contains
//the specific LLVM environment variable
//if newPath exists
// Set new path to the HashMap that contains the specific LLVM environment variable
// if newPath exists.
if (newPath != null) {
// if the newPath isn't empty
if((newPath.trim()).length()!=0) {
if (!newPath.trim().isEmpty()) {
// add new values to the LLVM environment variable
llvmEnvironmentVariables.put(name, new LlvmBuildEnvironmentVariable(
name, newPath, IBuildEnvironmentVariable.ENVVAR_APPEND));
llvmEnvironmentVariables.put(name, new LlvmBuildEnvironmentVariable(name, newPath,
IBuildEnvironmentVariable.ENVVAR_APPEND));
}
}
}
@ -427,31 +424,13 @@ public class LlvmEnvironmentVariableSupplier implements IConfigurationEnvironmen
return ""; //$NON-NLS-1$
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.managedbuilder.envvar.
* IConfigurationEnvironmentVariableSupplier#getVariable(java.lang.String,
* org.eclipse.cdt.managedbuilder.core.IConfiguration,
* org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider)
*/
public IBuildEnvironmentVariable getVariable(String variableName,
IConfiguration configuration, IEnvironmentVariableProvider provider) {
public IBuildEnvironmentVariable getVariable(String variableName, IConfiguration configuration,
IEnvironmentVariableProvider provider) {
return llvmEnvironmentVariables.get(variableName);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.managedbuilder.envvar.
* IConfigurationEnvironmentVariableSupplier
* #getVariables(org.eclipse.cdt.managedbuilder.core.IConfiguration,
* org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider)
*/
public IBuildEnvironmentVariable[] getVariables(
IConfiguration configuration, IEnvironmentVariableProvider provider) {
return llvmEnvironmentVariables.values().toArray(
new IBuildEnvironmentVariable[0]);
public IBuildEnvironmentVariable[] getVariables(IConfiguration configuration,
IEnvironmentVariableProvider provider) {
return llvmEnvironmentVariables.values().toArray(new IBuildEnvironmentVariable[0]);
}
}