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:
commit
8e7d1fac90
15 changed files with 179 additions and 100 deletions
|
@ -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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -163,6 +163,13 @@ public class BuildBehaviourTab extends AbstractCBuildPropertyTab {
|
||||||
updateButtons();
|
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= new Button(c3, SWT.RADIO);
|
||||||
b_parallelUnlimited.setText(Messages.BuilderSettingsTab_UseUnlimitedJobs);
|
b_parallelUnlimited.setText(Messages.BuilderSettingsTab_UseUnlimitedJobs);
|
||||||
|
|
|
@ -22,6 +22,7 @@ import junit.framework.TestSuite;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.dom.IPDOMManager;
|
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.model.ICProject;
|
||||||
import org.eclipse.cdt.core.resources.ExclusionInstance;
|
import org.eclipse.cdt.core.resources.ExclusionInstance;
|
||||||
import org.eclipse.cdt.core.resources.ExclusionType;
|
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.resources.RefreshScopeManager;
|
||||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
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.CProjectHelper;
|
||||||
import org.eclipse.cdt.core.testplugin.CTestPlugin;
|
import org.eclipse.cdt.core.testplugin.CTestPlugin;
|
||||||
import org.eclipse.cdt.internal.core.resources.ResourceExclusion;
|
import org.eclipse.cdt.internal.core.resources.ResourceExclusion;
|
||||||
|
@ -408,10 +410,8 @@ public class RefreshScopeTests extends TestCase {
|
||||||
|
|
||||||
IResource config1_resource = fProject;
|
IResource config1_resource = fProject;
|
||||||
|
|
||||||
CProjectDescriptionManager descriptionManager = CProjectDescriptionManager.getInstance();
|
|
||||||
ICProjectDescription projectDescription = descriptionManager.getProjectDescription(fProject, false);
|
String conf_name = getCurrentConfigName();
|
||||||
ICConfigurationDescription conf = projectDescription.getActiveConfiguration();
|
|
||||||
String conf_name = conf.getName();
|
|
||||||
|
|
||||||
manager.addResourceToRefresh(fProject, conf_name, config1_resource);
|
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() {
|
public static Test suite() {
|
||||||
return new TestSuite(RefreshScopeTests.class);
|
return new TestSuite(RefreshScopeTests.class);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,9 +16,8 @@ package org.eclipse.cdt.core.dom.ast;
|
||||||
* @noimplement This interface is not intended to be implemented by clients.
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
*/
|
*/
|
||||||
public interface IEnumeration extends IBinding, IType {
|
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
|
* @throws DOMException
|
||||||
*/
|
*/
|
||||||
IEnumerator[] getEnumerators() throws DOMException;
|
IEnumerator[] getEnumerators() throws DOMException;
|
||||||
|
|
|
@ -18,7 +18,7 @@ package org.eclipse.cdt.core.dom.ast;
|
||||||
*/
|
*/
|
||||||
public interface IEnumerator extends IBinding {
|
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.
|
* is the enumeration in which it is declared.
|
||||||
*
|
*
|
||||||
* @return the type of the enumeration
|
* @return the type of the enumeration
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Doug Schaefer (IBM) - Initial API and implementation
|
* Doug Schaefer (IBM) - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.dom.ast;
|
package org.eclipse.cdt.core.dom.ast;
|
||||||
|
|
||||||
|
|
|
@ -6,9 +6,8 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.core.dom.ast;
|
package org.eclipse.cdt.core.dom.ast;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.index.IIndexFile;
|
import org.eclipse.cdt.core.index.IIndexFile;
|
||||||
|
|
|
@ -15,14 +15,13 @@ package org.eclipse.cdt.core.dom.ast;
|
||||||
* @noimplement This interface is not intended to be implemented by clients.
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
*/
|
*/
|
||||||
public interface IFunctionType extends IType {
|
public interface IFunctionType extends IType {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get the return type of this function type
|
* Returns the return type of this function type
|
||||||
*/
|
*/
|
||||||
public IType getReturnType();
|
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
|
* ISO C99 6.7.5.3, ISO C++98 8.3.4-3
|
||||||
*/
|
*/
|
||||||
public IType[] getParameterTypes();
|
public IType[] getParameterTypes();
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM - Initial API and implementation
|
* IBM - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.dom.ast;
|
package org.eclipse.cdt.core.dom.ast;
|
||||||
|
|
||||||
|
@ -18,7 +18,6 @@ package org.eclipse.cdt.core.dom.ast;
|
||||||
* @noimplement This interface is not intended to be implemented by clients.
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
*/
|
*/
|
||||||
public interface IMacroBinding extends IBinding {
|
public interface IMacroBinding extends IBinding {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns <code>true</code> if this is a function-style macro.
|
* Returns <code>true</code> if this is a function-style macro.
|
||||||
* @since 5.0
|
* @since 5.0
|
||||||
|
|
|
@ -17,7 +17,7 @@ package org.eclipse.cdt.core.dom.ast;
|
||||||
*/
|
*/
|
||||||
public interface IPointerType extends IType {
|
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();
|
public IType getType();
|
||||||
|
|
||||||
|
@ -37,5 +37,4 @@ public interface IPointerType extends IType {
|
||||||
* @since 5.3
|
* @since 5.3
|
||||||
*/
|
*/
|
||||||
boolean isRestrict();
|
boolean isRestrict();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2004, 2010 IBM Corporation and others.
|
* Copyright (c) 2004, 2010 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Andrew Niefer (IBM Corporation) - initial API and implementation
|
* Andrew Niefer (IBM Corporation) - initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
@ -18,7 +18,6 @@ package org.eclipse.cdt.core.dom.ast;
|
||||||
* @noextend This interface is not intended to be extended by clients.
|
* @noextend This interface is not intended to be extended by clients.
|
||||||
*/
|
*/
|
||||||
public interface IProblemBinding extends IBinding, IScope, IType, ISemanticProblem {
|
public interface IProblemBinding extends IBinding, IScope, IType, ISemanticProblem {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the AST node that this problem was created for
|
* Returns the AST node that this problem was created for
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -29,7 +29,7 @@ public interface IQualifierType extends IType {
|
||||||
public boolean isVolatile();
|
public boolean isVolatile();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get the type that this is qualifying
|
* Returns the type that this is qualifying
|
||||||
*/
|
*/
|
||||||
public IType getType();
|
public IType getType();
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM - Initial API and implementation
|
* IBM - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
* Bryan Wilkinson (QNX)
|
* Bryan Wilkinson (QNX)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.dom.ast;
|
package org.eclipse.cdt.core.dom.ast;
|
||||||
|
|
||||||
|
@ -24,7 +24,6 @@ import org.eclipse.cdt.core.index.IIndexFileSet;
|
||||||
* @noimplement This interface is not intended to be implemented by clients.
|
* @noimplement This interface is not intended to be implemented by clients.
|
||||||
*/
|
*/
|
||||||
public interface IScope {
|
public interface IScope {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Classifies the scope.
|
* Classifies the scope.
|
||||||
* @since 5.1
|
* @since 5.1
|
||||||
|
@ -32,13 +31,13 @@ public interface IScope {
|
||||||
EScopeKind getKind();
|
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.
|
* @return The name of this scope.
|
||||||
*/
|
*/
|
||||||
public IName getScopeName();
|
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.
|
* is the global scope.
|
||||||
* <p>
|
* <p>
|
||||||
* For scopes obtained from an index, <code>null</code> is returned to indicate that the
|
* 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);
|
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
|
* 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
|
* yet been cached in this scope, or if resolve == false and the appropriate binding
|
||||||
* has not yet been resolved.
|
* has not yet been resolved.
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name
|
||||||
* @param resolve :
|
* @param resolve
|
||||||
* whether or not to resolve the matching binding if it has not
|
* whether or not to resolve the matching binding if it has not
|
||||||
* been so already.
|
* 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);
|
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
|
* 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
|
* 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
|
* 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 name
|
||||||
* @param resolve :
|
* @param resolve
|
||||||
* whether or not to resolve the matching binding if it has not
|
* whether or not to resolve the matching binding if it has not
|
||||||
* been so already.
|
* been so already.
|
||||||
* @param acceptLocalBindings a set of files for which to accept local bindings.
|
* @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);
|
public IBinding getBinding(IASTName name, boolean resolve, IIndexFileSet acceptLocalBindings);
|
||||||
|
|
||||||
|
@ -189,5 +188,4 @@ public interface IScope {
|
||||||
* @since 5.5
|
* @since 5.5
|
||||||
*/
|
*/
|
||||||
public IBinding[] getBindings(ScopeLookupData lookup);
|
public IBinding[] getBindings(ScopeLookupData lookup);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.dom.ast;
|
package org.eclipse.cdt.core.dom.ast;
|
||||||
|
|
||||||
|
|
|
@ -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
|
* Rapperswil, University of applied sciences and others
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* 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.IASTInitializer;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
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.IASTParameterDeclaration;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTPointerOperator;
|
import org.eclipse.cdt.core.dom.ast.IASTPointerOperator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTPreprocessorStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTPreprocessorStatement;
|
||||||
|
@ -771,10 +770,8 @@ public class ChangeGenerator extends ASTVisitor {
|
||||||
IASTNode sibling = siblings[i];
|
IASTNode sibling = siblings[i];
|
||||||
if (sibling == node) {
|
if (sibling == node) {
|
||||||
beforeNode = true;
|
beforeNode = true;
|
||||||
} else if (beforeNode) {
|
} else if (beforeNode && getReplacementNode(sibling) != null) {
|
||||||
sibling = getReplacementNode(sibling);
|
return sibling;
|
||||||
if (sibling != null)
|
|
||||||
return sibling;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -795,18 +792,21 @@ public class ChangeGenerator extends ASTVisitor {
|
||||||
low = mid + 1;
|
low = mid + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
low--;
|
IASTNode statement = --low >= 0 ? preprocessorStatements[low] : null;
|
||||||
if (low >= 0) {
|
|
||||||
IASTNode statement = preprocessorStatements[low];
|
IASTNode originalSibling = getPreviousSiblingNode(node);
|
||||||
if (statement.isPartOfTranslationUnitFile()) {
|
IASTNode sibling = originalSibling == null ? null : getReplacementNode(originalSibling);
|
||||||
int endOffset = endOffset(statement);
|
if (statement == null || !statement.isPartOfTranslationUnitFile()) {
|
||||||
if (!doesRegionContainNode(ast, endOffset, offset - endOffset)) {
|
return sibling;
|
||||||
return statement;
|
}
|
||||||
}
|
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) {
|
private IASTNode getNextSiblingNode(IASTNode node) {
|
||||||
|
@ -823,10 +823,8 @@ public class ChangeGenerator extends ASTVisitor {
|
||||||
for (IASTNode sibling : siblings) {
|
for (IASTNode sibling : siblings) {
|
||||||
if (sibling == node) {
|
if (sibling == node) {
|
||||||
beforeNode = true;
|
beforeNode = true;
|
||||||
} else if (beforeNode) {
|
} else if (beforeNode && getReplacementNode(sibling) != null) {
|
||||||
sibling = getReplacementNode(sibling);
|
return sibling;
|
||||||
if (sibling != null)
|
|
||||||
return sibling;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -847,44 +845,21 @@ public class ChangeGenerator extends ASTVisitor {
|
||||||
low = mid + 1;
|
low = mid + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (high < preprocessorStatements.length) {
|
IASTNode statement = high < preprocessorStatements.length ? preprocessorStatements[high] : null;
|
||||||
IASTNode statement = preprocessorStatements[high];
|
|
||||||
if (statement.isPartOfTranslationUnitFile()) {
|
IASTNode originalSibling = getNextSiblingNode(node);
|
||||||
int offset = offset(statement);
|
IASTNode sibling = originalSibling == null ? null : getReplacementNode(originalSibling);
|
||||||
if (!doesRegionContainNode(ast, endOffset, offset - endOffset)) {
|
if (statement == null || !statement.isPartOfTranslationUnitFile()) {
|
||||||
return statement;
|
return sibling;
|
||||||
}
|
}
|
||||||
}
|
if (sibling == null) {
|
||||||
|
IASTNode parent = node.getParent();
|
||||||
|
if (endOffset(parent) <= offset(statement))
|
||||||
|
return null;
|
||||||
|
return statement;
|
||||||
}
|
}
|
||||||
|
|
||||||
return getNextSiblingNode(node);
|
return offset(originalSibling) <= offset(statement) ? sibling : statement;
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* 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.LabelProvider;
|
||||||
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
||||||
import org.eclipse.swt.SWT;
|
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.SelectionAdapter;
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
import org.eclipse.swt.events.SelectionListener;
|
import org.eclipse.swt.events.SelectionListener;
|
||||||
|
@ -184,6 +186,14 @@ public class CustomFiltersDialog extends SelectionDialog {
|
||||||
if (initialSelection != null && !initialSelection.isEmpty())
|
if (initialSelection != null && !initialSelection.isEmpty())
|
||||||
checkInitialSelections();
|
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
|
// Description
|
||||||
info= new Label(parent, SWT.LEFT);
|
info= new Label(parent, SWT.LEFT);
|
||||||
info.setText(FilterMessages.CustomFiltersDialog_description_label);
|
info.setText(FilterMessages.CustomFiltersDialog_description_label);
|
||||||
|
|
Loading…
Add table
Reference in a new issue