1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Merge remote-tracking branch 'cdt/master' into sd90

This commit is contained in:
Andrew Gvozdev 2012-07-14 04:58:40 -04:00
commit 8e7d1fac90
15 changed files with 179 additions and 100 deletions

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2007, 2011 Intel Corporation and others.
* Copyright (c) 2007, 2012 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -163,6 +163,13 @@ public class BuildBehaviourTab extends AbstractCBuildPropertyTab {
updateButtons();
}
});
s_parallelNumber.getAccessible().addAccessibleListener(new AccessibleAdapter() {
@Override
public void getName(AccessibleEvent e) {
e.result = Messages.BuilderSettingsTab_UseParallelJobs;
}
});
s_parallelNumber.setToolTipText(Messages.BuilderSettingsTab_UseParallelJobs);
b_parallelUnlimited= new Button(c3, SWT.RADIO);
b_parallelUnlimited.setText(Messages.BuilderSettingsTab_UseUnlimitedJobs);

View file

@ -22,6 +22,7 @@ import junit.framework.TestSuite;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.IPDOMManager;
import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.resources.ExclusionInstance;
import org.eclipse.cdt.core.resources.ExclusionType;
@ -29,6 +30,7 @@ import org.eclipse.cdt.core.resources.RefreshExclusion;
import org.eclipse.cdt.core.resources.RefreshScopeManager;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
import org.eclipse.cdt.core.settings.model.WriteAccessException;
import org.eclipse.cdt.core.testplugin.CProjectHelper;
import org.eclipse.cdt.core.testplugin.CTestPlugin;
import org.eclipse.cdt.internal.core.resources.ResourceExclusion;
@ -408,10 +410,8 @@ public class RefreshScopeTests extends TestCase {
IResource config1_resource = fProject;
CProjectDescriptionManager descriptionManager = CProjectDescriptionManager.getInstance();
ICProjectDescription projectDescription = descriptionManager.getProjectDescription(fProject, false);
ICConfigurationDescription conf = projectDescription.getActiveConfiguration();
String conf_name = conf.getName();
String conf_name = getCurrentConfigName();
manager.addResourceToRefresh(fProject, conf_name, config1_resource);
@ -567,6 +567,101 @@ public class RefreshScopeTests extends TestCase {
}
public void closeProject(ICProjectDescription projDesc) {
try {
// save the project description
CCorePlugin.getDefault().setProjectDescription(fProject, projDesc);
fProject.close(null);
} catch (CoreException e1) {
fail();
}
}
public void openProject() {
try {
fProject.open(null);
} catch (CoreException e) {
fail();
}
}
public String getCurrentConfigName() {
CProjectDescriptionManager descriptionManager = CProjectDescriptionManager.getInstance();
ICProjectDescription projectDescription = descriptionManager.getProjectDescription(fProject, false);
ICConfigurationDescription conf = projectDescription.getActiveConfiguration();
return conf.getName();
}
public void testEmptyRefreshScopeCloseAndReopen() {
RefreshScopeManager manager = RefreshScopeManager.getInstance();
manager.clearAllData();
String config_name = getCurrentConfigName();
// get the resources. since we are not loading ... the project should auto-magically be added by default.
List<IResource> config_resources = manager.getResourcesToRefresh(fProject, config_name);
assertEquals(1,config_resources.size());
assertEquals(true, config_resources.contains(fProject));
// now delete it.
manager.deleteResourceToRefresh(fProject, config_name, fProject);
// and make sure it is empty.
config_resources = manager.getResourcesToRefresh(fProject, config_name);
assertEquals(0,config_resources.size());
// write the persistent data.
ICProjectDescription projectDescription = CCorePlugin.getDefault().getProjectDescription(fProject);
try {
manager.persistSettings(projectDescription);
} catch (CoreException e) {
fail();
}
// close and reopen
closeProject(projectDescription);
openProject();
// now verify that there are no resources.
HashMap<String, HashMap<IResource, List<RefreshExclusion>>> config_map = manager.getConfigurationToResourcesMap(fProject);
assertEquals(1,config_map.size());
config_resources = manager.getResourcesToRefresh(fProject, config_name);
assertEquals(0,config_resources.size());
}
public void testAddEmptyConfiguration() {
final String CFG_NAME="empty_config";
CoreModel model = CoreModel.getDefault();
RefreshScopeManager manager = RefreshScopeManager.getInstance();
manager.clearAllData();
CProjectDescriptionManager descriptionManager = CProjectDescriptionManager.getInstance();
ICProjectDescription projectDescription = descriptionManager.getProjectDescription(fProject, false);
ICConfigurationDescription base = projectDescription.getActiveConfiguration();
ICProjectDescription propertyProjectDescription = CoreModel.getDefault().getProjectDescription(fProject);
ICConfigurationDescription propertyDefaultConfigurationDescription = propertyProjectDescription.getConfigurations()[0];
try {
projectDescription.setReadOnly(false, true);
ICConfigurationDescription newCfg = projectDescription.createConfiguration(CFG_NAME + ".id", CFG_NAME, propertyDefaultConfigurationDescription);
} catch (WriteAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (CoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
List<IResource> empty_config_resources = manager.getResourcesToRefresh(fProject, CFG_NAME);
assertEquals(1,empty_config_resources.size());
assertEquals(true,empty_config_resources.contains(fProject));
}
public static Test suite() {
return new TestSuite(RefreshScopeTests.class);
}

View file

@ -16,9 +16,8 @@ package org.eclipse.cdt.core.dom.ast;
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IEnumeration extends IBinding, IType {
/**
* returns an array of the IEnumerators declared in this enumeration
* Returns an array of the IEnumerators declared in this enumeration
* @throws DOMException
*/
IEnumerator[] getEnumerators() throws DOMException;

View file

@ -18,7 +18,7 @@ package org.eclipse.cdt.core.dom.ast;
*/
public interface IEnumerator extends IBinding {
/**
* returns the type of this enumeration. The type of an enumerator
* Returns the type of this enumeration. The type of an enumerator
* is the enumeration in which it is declared.
*
* @return the type of the enumeration

View file

@ -8,7 +8,6 @@
* Contributors:
* Markus Schorn - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.core.dom.ast;
import org.eclipse.cdt.core.index.IIndexFile;

View file

@ -15,14 +15,13 @@ package org.eclipse.cdt.core.dom.ast;
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IFunctionType extends IType {
/**
* get the return type of this function type
* Returns the return type of this function type
*/
public IType getReturnType();
/**
* get the adjusted parameter types
* Returns the adjusted parameter types
* ISO C99 6.7.5.3, ISO C++98 8.3.4-3
*/
public IType[] getParameterTypes();

View file

@ -18,7 +18,6 @@ package org.eclipse.cdt.core.dom.ast;
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IMacroBinding extends IBinding {
/**
* Returns <code>true</code> if this is a function-style macro.
* @since 5.0

View file

@ -17,7 +17,7 @@ package org.eclipse.cdt.core.dom.ast;
*/
public interface IPointerType extends IType {
/**
* get the type that this is a pointer to
* Returns the type that this is a pointer to
*/
public IType getType();
@ -37,5 +37,4 @@ public interface IPointerType extends IType {
* @since 5.3
*/
boolean isRestrict();
}

View file

@ -18,7 +18,6 @@ package org.eclipse.cdt.core.dom.ast;
* @noextend This interface is not intended to be extended by clients.
*/
public interface IProblemBinding extends IBinding, IScope, IType, ISemanticProblem {
/**
* Returns the AST node that this problem was created for
*/

View file

@ -29,7 +29,7 @@ public interface IQualifierType extends IType {
public boolean isVolatile();
/**
* get the type that this is qualifying
* Returns the type that this is qualifying
*/
public IType getType();
}

View file

@ -24,7 +24,6 @@ import org.eclipse.cdt.core.index.IIndexFileSet;
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IScope {
/**
* Classifies the scope.
* @since 5.1
@ -32,13 +31,13 @@ public interface IScope {
EScopeKind getKind();
/**
* Get the IName for this scope, may be null
* Returns the IName for this scope, may be null
* @return The name of this scope.
*/
public IName getScopeName();
/**
* The method returns the first enclosing non-template scope, or <code>null</code> if this
* Returns the first enclosing non-template scope, or <code>null</code> if this
* is the global scope.
* <p>
* For scopes obtained from an index, <code>null</code> is returned to indicate that the
@ -58,32 +57,32 @@ public interface IScope {
public IBinding[] find(String name);
/**
* Get the binding in this scope that the given name would resolve to. Could
* Returns the binding in this scope that the given name would resolve to. Could
* return null if there is no matching binding in this scope, if the binding has not
* yet been cached in this scope, or if resolve == false and the appropriate binding
* has not yet been resolved.
*
* @param name
* @param resolve :
* @param resolve
* whether or not to resolve the matching binding if it has not
* been so already.
* @return : the binding in this scope that matches the name, or null
* @return the binding in this scope that matches the name, or null
*/
public IBinding getBinding(IASTName name, boolean resolve);
/**
* Get the binding in this scope that the given name would resolve to. Could
* Returns the binding in this scope that the given name would resolve to. Could
* return null if there is no matching binding in this scope, if the binding has not
* yet been cached in this scope, or if resolve == false and the appropriate binding
* has not yet been resolved. Accepts file local bindings from the index for the files
* int the given set, only.
* in the given set, only.
*
* @param name
* @param resolve :
* @param resolve
* whether or not to resolve the matching binding if it has not
* been so already.
* @param acceptLocalBindings a set of files for which to accept local bindings.
* @return : the binding in this scope that matches the name, or null
* @return the binding in this scope that matches the name, or null
*/
public IBinding getBinding(IASTName name, boolean resolve, IIndexFileSet acceptLocalBindings);
@ -189,5 +188,4 @@ public interface IScope {
* @since 5.5
*/
public IBinding[] getBindings(ScopeLookupData lookup);
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2011 Institute for Software, HSR Hochschule fuer Technik
* Copyright (c) 2008, 2012 Institute for Software, HSR Hochschule fuer Technik
* Rapperswil, University of applied sciences and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@ -37,7 +37,6 @@ import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
import org.eclipse.cdt.core.dom.ast.IASTInitializer;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTNodeSelector;
import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTPointerOperator;
import org.eclipse.cdt.core.dom.ast.IASTPreprocessorStatement;
@ -771,9 +770,7 @@ public class ChangeGenerator extends ASTVisitor {
IASTNode sibling = siblings[i];
if (sibling == node) {
beforeNode = true;
} else if (beforeNode) {
sibling = getReplacementNode(sibling);
if (sibling != null)
} else if (beforeNode && getReplacementNode(sibling) != null) {
return sibling;
}
}
@ -795,18 +792,21 @@ public class ChangeGenerator extends ASTVisitor {
low = mid + 1;
}
}
low--;
if (low >= 0) {
IASTNode statement = preprocessorStatements[low];
if (statement.isPartOfTranslationUnitFile()) {
int endOffset = endOffset(statement);
if (!doesRegionContainNode(ast, endOffset, offset - endOffset)) {
IASTNode statement = --low >= 0 ? preprocessorStatements[low] : null;
IASTNode originalSibling = getPreviousSiblingNode(node);
IASTNode sibling = originalSibling == null ? null : getReplacementNode(originalSibling);
if (statement == null || !statement.isPartOfTranslationUnitFile()) {
return sibling;
}
if (sibling == null) {
IASTNode parent = node.getParent();
if (offset(parent) >= endOffset(statement))
return null;
return statement;
}
}
}
return getPreviousSiblingNode(node);
return endOffset(originalSibling) >= endOffset(statement) ? sibling : statement;
}
private IASTNode getNextSiblingNode(IASTNode node) {
@ -823,9 +823,7 @@ public class ChangeGenerator extends ASTVisitor {
for (IASTNode sibling : siblings) {
if (sibling == node) {
beforeNode = true;
} else if (beforeNode) {
sibling = getReplacementNode(sibling);
if (sibling != null)
} else if (beforeNode && getReplacementNode(sibling) != null) {
return sibling;
}
}
@ -847,44 +845,21 @@ public class ChangeGenerator extends ASTVisitor {
low = mid + 1;
}
}
if (high < preprocessorStatements.length) {
IASTNode statement = preprocessorStatements[high];
if (statement.isPartOfTranslationUnitFile()) {
int offset = offset(statement);
if (!doesRegionContainNode(ast, endOffset, offset - endOffset)) {
IASTNode statement = high < preprocessorStatements.length ? preprocessorStatements[high] : null;
IASTNode originalSibling = getNextSiblingNode(node);
IASTNode sibling = originalSibling == null ? null : getReplacementNode(originalSibling);
if (statement == null || !statement.isPartOfTranslationUnitFile()) {
return sibling;
}
if (sibling == null) {
IASTNode parent = node.getParent();
if (endOffset(parent) <= offset(statement))
return null;
return statement;
}
}
}
return getNextSiblingNode(node);
}
/**
* Checks if a given region contains at least a piece of a node after rewrite.
*/
private boolean doesRegionContainNode(IASTTranslationUnit ast, int offset, int length) {
IASTNodeSelector nodeSelector = ast.getNodeSelector(ast.getFilePath());
while (length > 0) {
IASTNode node = nodeSelector.findFirstContainedNode(offset, length - 1);
if (node == null)
return false;
if (!isNodeRemoved(node))
return true;
int oldOffset = offset;
offset = endOffset(node);
length -= offset - oldOffset;
}
return false;
}
private boolean isNodeRemoved(IASTNode node) {
do {
if (getReplacementNode(node) == null)
return true;
} while ((node = node.getParent()) != null);
return false;
return offset(originalSibling) <= offset(statement) ? sibling : statement;
}
/**

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2009 IBM Corporation and others.
* Copyright (c) 2000, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -32,6 +32,8 @@ import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.swt.SWT;
import org.eclipse.swt.accessibility.AccessibleAdapter;
import org.eclipse.swt.accessibility.AccessibleEvent;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
@ -184,6 +186,14 @@ public class CustomFiltersDialog extends SelectionDialog {
if (initialSelection != null && !initialSelection.isEmpty())
checkInitialSelections();
fCheckBoxList.getTable().getAccessible().addAccessibleListener(new AccessibleAdapter() {
@Override
public void getName(AccessibleEvent e) {
e.result = FilterMessages.CustomFiltersDialog_filterList_label;
}
});
fCheckBoxList.getTable().setToolTipText(FilterMessages.CustomFiltersDialog_filterList_label);
// Description
info= new Label(parent, SWT.LEFT);
info.setText(FilterMessages.CustomFiltersDialog_description_label);