1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 17:05:26 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2015-01-08 11:07:01 -08:00
parent 07997cb72a
commit 2dbdd831ec
11 changed files with 24 additions and 62 deletions

View file

@ -361,8 +361,8 @@ public class CModelTests extends TestCase {
// bug 179474
public void testSourceExclusionFilters_179474() throws Exception {
ICProject testProject;
testProject=CProjectHelper.createCProject("bug179474", "none", IPDOMManager.ID_NO_INDEXER);
if (testProject==null)
testProject= CProjectHelper.createCProject("bug179474", "none", IPDOMManager.ID_NO_INDEXER);
if (testProject == null)
fail("Unable to create project");
IFolder subFolder = testProject.getProject().getFolder("sub");

View file

@ -30,7 +30,6 @@ import org.eclipse.core.runtime.IProgressMonitor;
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface ICProject extends IParent, IOpenable, ICElement {
/**
* Returns the <code>ICElement</code> corresponding to the given
* path, or <code>null</code> if no such
@ -67,8 +66,7 @@ public interface ICProject extends IParent, IOpenable, ICElement {
* Returns all of the existing source roots that exist
* on the project, in the order they are defined by the ".cdtproject".
*
* @return all of the existing package fragment roots that exist
* on the classpath
* @return all of the existing source roots
* @exception CModelException if this element does not exist or if an
* exception occurs while accessing its corresponding resource
*/
@ -243,5 +241,4 @@ public interface ICProject extends IParent, IOpenable, ICElement {
* exception occurs while accessing its corresponding resource
*/
Object[] getNonCResources() throws CModelException;
}

View file

@ -23,7 +23,7 @@ public class SourceEntry extends APathEntry implements ISourceEntry {
@Override
public boolean equals (Object obj) {
if (obj instanceof ISourceEntry) {
ISourceEntry otherEntry = (ISourceEntry)obj;
ISourceEntry otherEntry = (ISourceEntry) obj;
if (!super.equals(otherEntry)) {
return false;
}
@ -40,5 +40,4 @@ public class SourceEntry extends APathEntry implements ISourceEntry {
}
return super.equals(obj);
}
}

View file

@ -16,7 +16,6 @@ import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
@ -104,7 +103,7 @@ public class BracketInserterTest extends TestCase {
private void setUpProject() throws CoreException {
fProject= CProjectHelper.createCProject(getName(), "bin", IPDOMManager.ID_NO_INDEXER);
ICContainer cContainer= CProjectHelper.addCContainer(fProject, SRC);
IFile file= EditorTestHelper.createFile((IContainer)cContainer.getResource(), TU_NAME, TU_CONTENTS, new NullProgressMonitor());
IFile file= EditorTestHelper.createFile(cContainer.getResource(), TU_NAME, TU_CONTENTS, new NullProgressMonitor());
assertNotNull(file);
assertTrue(file.exists());
}

View file

@ -14,7 +14,6 @@ package org.eclipse.cdt.ui.tests.text;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
@ -102,7 +101,7 @@ public class HyperlinkTest extends TestCase {
super.setUp();
project= CProjectHelper.createCCProject(super.getName(), "unused", IPDOMManager.ID_NO_INDEXER);
ICContainer cContainer= CProjectHelper.addCContainer(project, "src");
IFile file= EditorTestHelper.createFile((IContainer) cContainer.getResource(), fileName, code, new NullProgressMonitor());
IFile file= EditorTestHelper.createFile(cContainer.getResource(), fileName, code, new NullProgressMonitor());
assertNotNull(file);
assertTrue(file.exists());

View file

@ -604,7 +604,7 @@ public class BaseCElementContentProvider implements ITreeContentProvider {
List<ICElement> missingElements = new ArrayList<ICElement>();
try {
List<IResource> missingContainers = new ArrayList<IResource>();
IResource[] allChildren = ((IContainer) container.getResource()).members();
IResource[] allChildren = container.getResource().members();
for (IResource child : allChildren) {
if (!(child instanceof IContainer))
continue;

View file

@ -24,7 +24,6 @@ import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.internal.ui.wizards.CWizardRegistry;
public class CPerspectiveFactory implements IPerspectiveFactory {
/**
* Constructs a new Default layout engine.
*/
@ -96,6 +95,5 @@ public class CPerspectiveFactory implements IPerspectiveFactory {
for (int i = 0; i < wizIDs.length; ++i) {
layout.addNewWizardShortcut(wizIDs[i]);
}
}
}

View file

@ -147,12 +147,12 @@ public class NewSourceFolderWizardPage extends NewElementWizardPage {
String projPath= null;
if (selectedElement instanceof IResource) {
IProject proj= ((IResource)selectedElement).getProject();
IProject proj= ((IResource) selectedElement).getProject();
if (proj != null) {
projPath= proj.getFullPath().makeRelative().toString();
}
} else if (selectedElement instanceof ICElement) {
ICProject jproject= ((ICElement)selectedElement).getCProject();
ICProject jproject= ((ICElement) selectedElement).getCProject();
if (jproject != null) {
projPath= jproject.getProject().getFullPath().makeRelative().toString();
}
@ -336,7 +336,7 @@ public class NewSourceFolderWizardPage extends NewElementWizardPage {
return;
}
}
ArrayList<IPathEntry> newEntries= new ArrayList<IPathEntry>(fEntries.length + 1);
ArrayList<IPathEntry> newEntries= new ArrayList<>(fEntries.length + 1);
int projectEntryIndex= -1;
for (int i= 0; i < fEntries.length; i++) {
@ -355,7 +355,7 @@ public class NewSourceFolderWizardPage extends NewElementWizardPage {
IPathEntry newEntry= CoreModel.newSourceEntry(path);
Set<IPathEntry> modified= new HashSet<IPathEntry>();
Set<IPathEntry> modified= new HashSet<>();
if (fExcludeInOthersFields.isSelected()) {
addExclusionPatterns(newEntry, newEntries, modified);
newEntries.add(CoreModel.newSourceEntry(path));
@ -390,13 +390,13 @@ public class NewSourceFolderWizardPage extends NewElementWizardPage {
}
}
private void addExclusionPatterns(IPathEntry newEntry, List<IPathEntry> existing, Set<IPathEntry> modifiedEntries) {
private static void addExclusionPatterns(IPathEntry newEntry, List<IPathEntry> existing, Set<IPathEntry> modifiedEntries) {
IPath entryPath= newEntry.getPath();
for (int i= 0; i < existing.size(); i++) {
IPathEntry curr= existing.get(i);
IPath currPath= curr.getPath();
if (curr.getEntryKind() == IPathEntry.CDT_SOURCE && currPath.isPrefixOf(entryPath)) {
IPath[] exclusionFilters= ((ISourceEntry)curr).getExclusionPatterns();
IPath[] exclusionFilters= ((ISourceEntry) curr).getExclusionPatterns();
if (!CoreModelUtil.isExcludedPath(entryPath, exclusionFilters)) {
IPath pathToExclude= entryPath.removeFirstSegments(currPath.segmentCount()).addTrailingSeparator();
IPath[] newExclusionFilters= new IPath[exclusionFilters.length + 1];
@ -427,7 +427,6 @@ public class NewSourceFolderWizardPage extends NewElementWizardPage {
}
monitor.beginTask(NewFolderWizardMessages.NewSourceFolderWizardPage_operation, 3);
try {
// IPath projPath= fCurrCProject.getProject().getFullPath();
String relPath= fRootDialogField.getText();
IFolder folder= fCurrCProject.getProject().getFolder(relPath);
@ -438,7 +437,7 @@ public class NewSourceFolderWizardPage extends NewElementWizardPage {
throw new InterruptedException();
}
if(CCorePlugin.getDefault().isNewStyleProject(fCurrCProject.getProject())){
if (CCorePlugin.getDefault().isNewStyleProject(fCurrCProject.getProject())) {
ICSourceEntry newEntry = new CSourceEntry(folder, null, 0);
ICProjectDescription des = CCorePlugin.getDefault().getProjectDescription(fCurrCProject.getProject(), true);
addEntryToAllCfgs(des, newEntry, fIsProjectAsSourceFolder);
@ -453,23 +452,24 @@ public class NewSourceFolderWizardPage extends NewElementWizardPage {
}
}
private void addEntryToAllCfgs(ICProjectDescription des, ICSourceEntry entry, boolean removeProj) throws WriteAccessException, CoreException{
private void addEntryToAllCfgs(ICProjectDescription des, ICSourceEntry entry, boolean removeProj)
throws WriteAccessException, CoreException{
ICConfigurationDescription cfgs[] = des.getConfigurations();
for(ICConfigurationDescription cfg : cfgs){
for (ICConfigurationDescription cfg : cfgs) {
ICSourceEntry[] entries = cfg.getSourceEntries();
entries = addEntry(entries, entry, removeProj);
cfg.setSourceEntries(entries);
}
}
private ICSourceEntry[] addEntry(ICSourceEntry[] entries, ICSourceEntry entry, boolean removeProj){
Set<ICSourceEntry> set = new HashSet<ICSourceEntry>();
for(ICSourceEntry se : entries){
if(removeProj && new Path(se.getValue()).segmentCount() == 1)
private ICSourceEntry[] addEntry(ICSourceEntry[] entries, ICSourceEntry sourceEntry, boolean removeProj) {
Set<ICSourceEntry> set = new HashSet<>();
for (ICSourceEntry entry : entries) {
if (removeProj && new Path(entry.getValue()).segmentCount() == 1)
continue;
set.add(se);
set.add(entry);
}
set.add(entry);
set.add(sourceEntry);
return set.toArray(new ICSourceEntry[set.size()]);
}

View file

@ -20,10 +20,6 @@ import org.eclipse.debug.core.sourcelookup.ISourceContainer;
* Director of the common source containers.
*/
public class CommonSourceLookupDirector extends CSourceLookupDirector {
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector#setSourceContainers(org.eclipse.debug.core.sourcelookup.ISourceContainer[])
*/
@Override
public void setSourceContainers(ISourceContainer[] containers) {
try {

View file

@ -84,10 +84,6 @@ public class SourceFoldersRelativePathSourceContainer extends CompositeSourceCon
super.dispose();
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceContainer#isComposite()
*/
@Override
public boolean isComposite() {
return true;
@ -95,16 +91,11 @@ public class SourceFoldersRelativePathSourceContainer extends CompositeSourceCon
/**
* Returns whether referenced projects are considered.
*
* @return whether referenced projects are considered
*/
public boolean isSearchReferencedProjects() {
return fSearchReferencedProjects;
}
/* (non-Javadoc)
* @see org.eclipse.debug.internal.core.sourcelookup.ISourceContainer#getName()
*/
@Override
public String getName() {
return fProject == null ?
@ -112,17 +103,11 @@ public class SourceFoldersRelativePathSourceContainer extends CompositeSourceCon
NLS.bind(InternalSourceLookupMessages.SourceFoldersRelativePathSourceContainer_1, fProject.getName());
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.sourcelookup.ISourceContainer#getType()
*/
@Override
public ISourceContainerType getType() {
return getSourceContainerType(TYPE_ID);
}
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (obj != null && obj instanceof SourceFoldersRelativePathSourceContainer) {
@ -132,17 +117,11 @@ public class SourceFoldersRelativePathSourceContainer extends CompositeSourceCon
return false;
}
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
return TYPE_ID.hashCode() * 31 + (fProject == null ? 0 : fProject.hashCode());
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.sourcelookup.IMappingSourceContainer#getCompilationPath(java.lang.String)
*/
@Override
public IPath getCompilationPath(String sourceName) {
if (fProject == null)
@ -192,7 +171,7 @@ public class SourceFoldersRelativePathSourceContainer extends CompositeSourceCon
ISourceRoot[] roots = cProject.getAllSourceRoots();
List<ISourceContainer> list = new ArrayList<ISourceContainer>(roots.length);
for (ISourceRoot root : roots) {
IContainer folder = (IContainer) root.getResource();
IContainer folder = root.getResource();
ISourceContainer container = new CompilationDirectorySourceContainer(folder.getLocation(), false);
container.init(getDirector());
list.add(container);

View file

@ -33,11 +33,6 @@ import org.eclipse.core.resources.IResource;
* @since 7.1
*/
public class ToggleCBreakpointTester extends PropertyTester {
/*
* (non-Javadoc)
* @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
*/
@Override
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
// test for CEditor