mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 375859 - Refresh scope becomes empty after closing/opening project
if left to default
This commit is contained in:
parent
a686aafa3c
commit
6091c93f7b
9 changed files with 120 additions and 94 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2010 QNX Software Systems and others.
|
* Copyright (c) 2000, 2012 QNX Software Systems 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
|
||||||
|
@ -11,6 +11,7 @@
|
||||||
* Dmitry Kozlov (CodeSourcery) - Build error highlighting and navigation
|
* Dmitry Kozlov (CodeSourcery) - Build error highlighting and navigation
|
||||||
* Save build output (bug 294106)
|
* Save build output (bug 294106)
|
||||||
* Andrew Gvozdev (Quoin Inc) - Saving build output implemented in different way (bug 306222)
|
* Andrew Gvozdev (Quoin Inc) - Saving build output implemented in different way (bug 306222)
|
||||||
|
* IBM Corporation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.make.core;
|
package org.eclipse.cdt.make.core;
|
||||||
|
|
||||||
|
@ -279,7 +280,7 @@ public class MakeBuilder extends ACBuilder {
|
||||||
*/
|
*/
|
||||||
protected void refreshProject(IProject project) {
|
protected void refreshProject(IProject project) {
|
||||||
if (buildRunnerHelper != null) {
|
if (buildRunnerHelper != null) {
|
||||||
buildRunnerHelper.refreshProject(null);
|
buildRunnerHelper.refreshProject(null, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
* Wind River Systems - Initial API and implementation
|
* Wind River Systems - Initial API and implementation
|
||||||
* James Blackburn (Broadcom Corp.)
|
* James Blackburn (Broadcom Corp.)
|
||||||
* Andrew Gvozdev
|
* Andrew Gvozdev
|
||||||
|
* IBM Corporation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.managedbuilder.core;
|
package org.eclipse.cdt.managedbuilder.core;
|
||||||
|
|
||||||
|
@ -129,7 +130,7 @@ public class ExternalBuildRunner extends AbstractBuildRunner {
|
||||||
buildRunnerHelper.goodbye();
|
buildRunnerHelper.goodbye();
|
||||||
|
|
||||||
if (state != ICommandLauncher.ILLEGAL_COMMAND) {
|
if (state != ICommandLauncher.ILLEGAL_COMMAND) {
|
||||||
buildRunnerHelper.refreshProject(new SubProgressMonitor(monitor, TICKS_REFRESH_PROJECT, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK));
|
buildRunnerHelper.refreshProject(cfgName, new SubProgressMonitor(monitor, TICKS_REFRESH_PROJECT, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
String msg = ManagedMakeMessages.getFormattedString("ManagedMakeBuilder.message.undefined.build.command", builder.getId()); //$NON-NLS-1$
|
String msg = ManagedMakeMessages.getFormattedString("ManagedMakeBuilder.message.undefined.build.command", builder.getId()); //$NON-NLS-1$
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2010, 2011 Wind River Systems and others.
|
* Copyright (c) 2010, 2012 Wind River Systems 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
|
||||||
|
@ -8,6 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Wind River Systems - Initial API and implementation
|
* Wind River Systems - Initial API and implementation
|
||||||
* James Blackburn (Broadcom Corp.)
|
* James Blackburn (Broadcom Corp.)
|
||||||
|
* IBM Corporation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.managedbuilder.core;
|
package org.eclipse.cdt.managedbuilder.core;
|
||||||
|
|
||||||
|
@ -136,7 +137,7 @@ public class InternalBuildRunner extends AbstractBuildRunner {
|
||||||
buildRunnerHelper.goodbye();
|
buildRunnerHelper.goodbye();
|
||||||
|
|
||||||
if (status != ICommandLauncher.ILLEGAL_COMMAND) {
|
if (status != ICommandLauncher.ILLEGAL_COMMAND) {
|
||||||
buildRunnerHelper.refreshProject(new SubProgressMonitor(monitor, TICKS_REFRESH_PROJECT, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK));
|
buildRunnerHelper.refreshProject(cfgName, new SubProgressMonitor(monitor, TICKS_REFRESH_PROJECT, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK));
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007, 2010 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
|
||||||
|
@ -1211,7 +1211,7 @@ public class CommonBuilder extends ACBuilder {
|
||||||
buildRunnerHelper.goodbye();
|
buildRunnerHelper.goodbye();
|
||||||
|
|
||||||
if (status != ICommandLauncher.ILLEGAL_COMMAND) {
|
if (status != ICommandLauncher.ILLEGAL_COMMAND) {
|
||||||
buildRunnerHelper.refreshProject(new SubProgressMonitor(monitor, TICKS_REFRESH_PROJECT));
|
buildRunnerHelper.refreshProject(cfgName, new SubProgressMonitor(monitor, TICKS_REFRESH_PROJECT));
|
||||||
}
|
}
|
||||||
|
|
||||||
//Throw a core exception indicating that the clean command failed
|
//Throw a core exception indicating that the clean command failed
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2002, 2011 IBM Corporation and others.
|
* Copyright (c) 2002, 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
|
||||||
|
@ -1118,7 +1118,7 @@ public class GeneratedMakefileBuilder extends ACBuilder {
|
||||||
|
|
||||||
// use the refresh scope manager to refresh
|
// use the refresh scope manager to refresh
|
||||||
RefreshScopeManager refreshManager = RefreshScopeManager.getInstance();
|
RefreshScopeManager refreshManager = RefreshScopeManager.getInstance();
|
||||||
IWorkspaceRunnable runnable = refreshManager.getRefreshRunnable(project);
|
IWorkspaceRunnable runnable = refreshManager.getRefreshRunnable(project, cfg.getName());
|
||||||
ResourcesPlugin.getWorkspace().run(runnable, null, IWorkspace.AVOID_UPDATE, null);
|
ResourcesPlugin.getWorkspace().run(runnable, null, IWorkspace.AVOID_UPDATE, null);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
monitor.subTask(ManagedMakeMessages
|
monitor.subTask(ManagedMakeMessages
|
||||||
|
|
|
@ -144,8 +144,7 @@ public class RefreshPolicyTab extends AbstractCBuildPropertyTab {
|
||||||
|
|
||||||
private void loadInfo() {
|
private void loadInfo() {
|
||||||
HashMap<String, HashMap<IResource, List<RefreshExclusion>>> configMap = fManager.getConfigurationToResourcesMap(fProject);
|
HashMap<String, HashMap<IResource, List<RefreshExclusion>>> configMap = fManager.getConfigurationToResourcesMap(fProject);
|
||||||
if (configMap != null)
|
fConfigurationToResourcesToExclusionsMap = copyHashMap(configMap);
|
||||||
fConfigurationToResourcesToExclusionsMap = copyHashMap(configMap);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<RefreshExclusion> getExclusions(String configName, IResource resource) {
|
private List<RefreshExclusion> getExclusions(String configName, IResource resource) {
|
||||||
|
|
|
@ -486,7 +486,7 @@ public class RefreshScopeTests extends TestCase {
|
||||||
createTestFile(path);
|
createTestFile(path);
|
||||||
|
|
||||||
// now refresh
|
// now refresh
|
||||||
IWorkspaceRunnable runnable = manager.getRefreshRunnable(fProject);
|
IWorkspaceRunnable runnable = manager.getRefreshRunnable(fProject, conf_name);
|
||||||
try {
|
try {
|
||||||
ResourcesPlugin.getWorkspace().run(runnable, null, IWorkspace.AVOID_UPDATE, null);
|
ResourcesPlugin.getWorkspace().run(runnable, null, IWorkspace.AVOID_UPDATE, null);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
|
|
|
@ -11,11 +11,11 @@
|
||||||
package org.eclipse.cdt.core.resources;
|
package org.eclipse.cdt.core.resources;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.CProjectNature;
|
import org.eclipse.cdt.core.CProjectNature;
|
||||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
|
@ -97,6 +97,7 @@ public class RefreshScopeManager {
|
||||||
private boolean fIsLoaded = false;
|
private boolean fIsLoaded = false;
|
||||||
|
|
||||||
private boolean fIsLoading = false;
|
private boolean fIsLoading = false;
|
||||||
|
private boolean fIsNewProject = false;
|
||||||
private HashMap<IProject,HashMap<String,HashMap<IResource, List<RefreshExclusion>>>> fProjToConfToResToExcluMap;
|
private HashMap<IProject,HashMap<String,HashMap<IResource, List<RefreshExclusion>>>> fProjToConfToResToExcluMap;
|
||||||
private int fVersion = 2;
|
private int fVersion = 2;
|
||||||
|
|
||||||
|
@ -214,9 +215,7 @@ public class RefreshScopeManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void clearDataForProject(IProject project) {
|
private synchronized void clearDataForProject(IProject project) {
|
||||||
HashMap<String,HashMap<IResource, List<RefreshExclusion>>> configMap = fProjToConfToResToExcluMap.get(project);
|
fProjToConfToResToExcluMap.remove(project);
|
||||||
if (configMap != null)
|
|
||||||
configMap.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -286,7 +285,8 @@ public class RefreshScopeManager {
|
||||||
|
|
||||||
if (resourceMap == null) {
|
if (resourceMap == null) {
|
||||||
resourceMap = new HashMap<IResource, List<RefreshExclusion>>();
|
resourceMap = new HashMap<IResource, List<RefreshExclusion>>();
|
||||||
resourceMap.put(project, new LinkedList<RefreshExclusion>());
|
if (!fIsLoading)
|
||||||
|
resourceMap.put(project, new LinkedList<RefreshExclusion>());
|
||||||
configMap.put(configName, resourceMap);
|
configMap.put(configName, resourceMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -318,8 +318,23 @@ public class RefreshScopeManager {
|
||||||
return fProjToConfToResToExcluMap;
|
return fProjToConfToResToExcluMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Refresh the given project using the refresh setting for the active configuration
|
||||||
|
* @param project
|
||||||
|
* @return the refresh runnable for the given project
|
||||||
|
*/
|
||||||
public IWorkspaceRunnable getRefreshRunnable(final IProject project) {
|
public IWorkspaceRunnable getRefreshRunnable(final IProject project) {
|
||||||
|
return getRefreshRunnable(project, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Refresh the given project using the refresh setting for the configuration with the given name
|
||||||
|
* @param project
|
||||||
|
* @param configName
|
||||||
|
* @return the refresh runnable for the given project
|
||||||
|
* @since 5.4
|
||||||
|
*/
|
||||||
|
public IWorkspaceRunnable getRefreshRunnable(final IProject project, final String configName) {
|
||||||
IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
|
IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -345,13 +360,14 @@ public class RefreshScopeManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(IProgressMonitor monitor) throws CoreException {
|
public void run(IProgressMonitor monitor) throws CoreException {
|
||||||
|
String name = configName;
|
||||||
|
if (name == null) {
|
||||||
CProjectDescriptionManager descriptionManager = CProjectDescriptionManager
|
CProjectDescriptionManager descriptionManager = CProjectDescriptionManager
|
||||||
.getInstance();
|
.getInstance();
|
||||||
ICProjectDescription projectDescription = descriptionManager.getProjectDescription(project, false);
|
ICProjectDescription projectDescription = descriptionManager.getProjectDescription(project, false);
|
||||||
ICConfigurationDescription active_conf = projectDescription.getActiveConfiguration();
|
ICConfigurationDescription active_conf = projectDescription.getActiveConfiguration();
|
||||||
String name = active_conf.getName();
|
name = active_conf.getName();
|
||||||
|
}
|
||||||
List<IResource> resourcesToRefresh = getResourcesToRefresh(project,name);
|
List<IResource> resourcesToRefresh = getResourcesToRefresh(project,name);
|
||||||
for (IResource resource : resourcesToRefresh) {
|
for (IResource resource : resourcesToRefresh) {
|
||||||
List<RefreshExclusion> exclusions = getExclusions(project,name,resource);
|
List<RefreshExclusion> exclusions = getExclusions(project,name,resource);
|
||||||
|
@ -473,7 +489,7 @@ public class RefreshScopeManager {
|
||||||
// walk the tree and load the settings
|
// walk the tree and load the settings
|
||||||
String str = storageElement.getAttribute(VERSION_NUMBER_ATTRIBUTE_NAME);
|
String str = storageElement.getAttribute(VERSION_NUMBER_ATTRIBUTE_NAME);
|
||||||
|
|
||||||
if ((str == null) || (str.equals("1"))) { //$NON-NLS-1$
|
if ( (children.length != 0) && ((str == null) || (str.equals("1")))) { //$NON-NLS-1$
|
||||||
ICConfigurationDescription cfgDescs[] = projectDescription.getConfigurations();
|
ICConfigurationDescription cfgDescs[] = projectDescription.getConfigurations();
|
||||||
for (ICConfigurationDescription cfgDesc : cfgDescs)
|
for (ICConfigurationDescription cfgDesc : cfgDescs)
|
||||||
loadResourceData(workspaceRoot, project, cfgDesc.getName(), children);
|
loadResourceData(workspaceRoot, project, cfgDesc.getName(), children);
|
||||||
|
@ -488,7 +504,9 @@ public class RefreshScopeManager {
|
||||||
// else there are no children, and this is a "new" project.
|
// else there are no children, and this is a "new" project.
|
||||||
// so initialize it.
|
// so initialize it.
|
||||||
if (children.length == 0) {
|
if (children.length == 0) {
|
||||||
|
fIsNewProject = true;
|
||||||
getConfigurationToResourcesMap(project); // this will initialize the config map.
|
getConfigurationToResourcesMap(project); // this will initialize the config map.
|
||||||
|
fIsNewProject = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -506,7 +524,7 @@ public class RefreshScopeManager {
|
||||||
for (ICConfigurationDescription cfgDesc : cfgDescs) {
|
for (ICConfigurationDescription cfgDesc : cfgDescs) {
|
||||||
String configName = cfgDesc.getName();
|
String configName = cfgDesc.getName();
|
||||||
HashMap<IResource, List<RefreshExclusion>> resourceMap = new HashMap<IResource, List<RefreshExclusion>>();
|
HashMap<IResource, List<RefreshExclusion>> resourceMap = new HashMap<IResource, List<RefreshExclusion>>();
|
||||||
if (!fIsLoading)
|
if (!fIsLoading || fIsNewProject) //config settings could be loading and detects a new project and if so, add the default refresh setting
|
||||||
resourceMap.put(project, new LinkedList<RefreshExclusion>());
|
resourceMap.put(project, new LinkedList<RefreshExclusion>());
|
||||||
configMap.put(configName, resourceMap);
|
configMap.put(configName, resourceMap);
|
||||||
}
|
}
|
||||||
|
@ -520,76 +538,80 @@ public class RefreshScopeManager {
|
||||||
*/
|
*/
|
||||||
public synchronized void loadResourceData(IWorkspaceRoot workspaceRoot, IProject project, String configName, ICStorageElement[] children) {
|
public synchronized void loadResourceData(IWorkspaceRoot workspaceRoot, IProject project, String configName, ICStorageElement[] children) {
|
||||||
|
|
||||||
for (ICStorageElement child : children) {
|
if (children.length == 0) {
|
||||||
if (child.getName().equals(RESOURCE_ELEMENT_NAME)) {
|
// we have an empty config to resource map. This call will create an empty resource set for the config name.
|
||||||
|
getResourcesToExclusionsMap(project,configName);
|
||||||
|
} else {
|
||||||
|
for (ICStorageElement child : children) {
|
||||||
|
if (child.getName().equals(RESOURCE_ELEMENT_NAME)) {
|
||||||
|
|
||||||
// get the resource path
|
// get the resource path
|
||||||
String resourcePath = child.getAttribute(WORKSPACE_PATH_ATTRIBUTE_NAME);
|
String resourcePath = child.getAttribute(WORKSPACE_PATH_ATTRIBUTE_NAME);
|
||||||
|
|
||||||
if (resourcePath == null) {
|
if (resourcePath == null) {
|
||||||
// error... skip this resource
|
// error... skip this resource
|
||||||
continue;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
else {
|
|
||||||
String resourceTypeString = child
|
|
||||||
.getAttribute(RESOURCE_TYPE_ATTRIBUTE_NAME);
|
|
||||||
|
|
||||||
if (resourceTypeString == null) {
|
|
||||||
// we'll do our best, but we won't be able to create handles to non-existent
|
|
||||||
// resources
|
|
||||||
resourceTypeString = OTHER_VALUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// find the resource
|
|
||||||
IResource resource = null;
|
|
||||||
|
|
||||||
if (resourceTypeString.equals(PROJECT_VALUE)) {
|
|
||||||
resource = workspaceRoot.getProject(resourcePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (resourceTypeString.equals(FILE_VALUE)) {
|
|
||||||
resource = workspaceRoot.getFile(new Path(resourcePath));
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (resourceTypeString.equals(FOLDER_VALUE)) {
|
|
||||||
resource = workspaceRoot.getFolder(new Path(resourcePath));
|
|
||||||
}
|
|
||||||
|
|
||||||
else {
|
|
||||||
// Find arbitrary resource.
|
|
||||||
// The only way to do this is to ask the workspace root to find
|
|
||||||
// it, if it exists. If it doesn't exist, we have no way of
|
|
||||||
// creating a handle to the right type of object, so we must
|
|
||||||
// give up. In practice, this would likely happen if we had
|
|
||||||
// a virtual group resource that has been deleted somehow since
|
|
||||||
// the settings were created, and since the resource is virtual,
|
|
||||||
// it's impossible to refresh it if it doesn't exist anyway.
|
|
||||||
resource = workspaceRoot.findMember(resourcePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (resource == null) {
|
|
||||||
// error.. skip this resource
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
addResourceToRefresh(project,configName, resource);
|
String resourceTypeString = child
|
||||||
|
.getAttribute(RESOURCE_TYPE_ATTRIBUTE_NAME);
|
||||||
|
|
||||||
// load any exclusions
|
if (resourceTypeString == null) {
|
||||||
List<RefreshExclusion> exclusions;
|
// we'll do our best, but we won't be able to create handles to non-existent
|
||||||
try {
|
// resources
|
||||||
exclusions = RefreshExclusion.loadData(
|
resourceTypeString = OTHER_VALUE;
|
||||||
child, null, resource, this);
|
}
|
||||||
|
|
||||||
// add them
|
// find the resource
|
||||||
for (RefreshExclusion exclusion : exclusions) {
|
IResource resource = null;
|
||||||
addExclusion(project, configName, resource, exclusion);
|
|
||||||
|
if (resourceTypeString.equals(PROJECT_VALUE)) {
|
||||||
|
resource = workspaceRoot.getProject(resourcePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (resourceTypeString.equals(FILE_VALUE)) {
|
||||||
|
resource = workspaceRoot.getFile(new Path(resourcePath));
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (resourceTypeString.equals(FOLDER_VALUE)) {
|
||||||
|
resource = workspaceRoot.getFolder(new Path(resourcePath));
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
// Find arbitrary resource.
|
||||||
|
// The only way to do this is to ask the workspace root to find
|
||||||
|
// it, if it exists. If it doesn't exist, we have no way of
|
||||||
|
// creating a handle to the right type of object, so we must
|
||||||
|
// give up. In practice, this would likely happen if we had
|
||||||
|
// a virtual group resource that has been deleted somehow since
|
||||||
|
// the settings were created, and since the resource is virtual,
|
||||||
|
// it's impossible to refresh it if it doesn't exist anyway.
|
||||||
|
resource = workspaceRoot.findMember(resourcePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (resource == null) {
|
||||||
|
// error.. skip this resource
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
addResourceToRefresh(project,configName, resource);
|
||||||
|
|
||||||
|
// load any exclusions
|
||||||
|
List<RefreshExclusion> exclusions;
|
||||||
|
try {
|
||||||
|
exclusions = RefreshExclusion.loadData(
|
||||||
|
child, null, resource, this);
|
||||||
|
|
||||||
|
// add them
|
||||||
|
for (RefreshExclusion exclusion : exclusions) {
|
||||||
|
addExclusion(project, configName, resource, exclusion);
|
||||||
|
}
|
||||||
|
} catch (CoreException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
} catch (CoreException e) {
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2012, 2012 Andrew Gvozdev and others.
|
* Copyright (c) 2012 Andrew Gvozdev 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
|
||||||
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Andrew Gvozdev - initial API and implementation
|
* Andrew Gvozdev - initial API and implementation
|
||||||
|
* IBM Corporation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.core;
|
package org.eclipse.cdt.internal.core;
|
||||||
|
@ -313,10 +314,11 @@ public class BuildRunnerHelper implements Closeable {
|
||||||
/**
|
/**
|
||||||
* Refresh project in the workspace.
|
* Refresh project in the workspace.
|
||||||
*
|
*
|
||||||
|
* @param configName - the configuration to refresh
|
||||||
* @param monitor - progress monitor in the initial state where {@link IProgressMonitor#beginTask(String, int)}
|
* @param monitor - progress monitor in the initial state where {@link IProgressMonitor#beginTask(String, int)}
|
||||||
* has not been called yet.
|
* has not been called yet.
|
||||||
*/
|
*/
|
||||||
public void refreshProject(IProgressMonitor monitor) {
|
public void refreshProject(String configName, IProgressMonitor monitor) {
|
||||||
if (monitor == null) {
|
if (monitor == null) {
|
||||||
monitor = new NullProgressMonitor();
|
monitor = new NullProgressMonitor();
|
||||||
}
|
}
|
||||||
|
@ -328,7 +330,7 @@ public class BuildRunnerHelper implements Closeable {
|
||||||
// The caveat is for huge projects, it may take sometimes at every build.
|
// The caveat is for huge projects, it may take sometimes at every build.
|
||||||
// Use the refresh scope manager to refresh
|
// Use the refresh scope manager to refresh
|
||||||
RefreshScopeManager refreshManager = RefreshScopeManager.getInstance();
|
RefreshScopeManager refreshManager = RefreshScopeManager.getInstance();
|
||||||
IWorkspaceRunnable runnable = refreshManager.getRefreshRunnable(project);
|
IWorkspaceRunnable runnable = refreshManager.getRefreshRunnable(project, configName);
|
||||||
ResourcesPlugin.getWorkspace().run(runnable, null, IWorkspace.AVOID_UPDATE, null);
|
ResourcesPlugin.getWorkspace().run(runnable, null, IWorkspace.AVOID_UPDATE, null);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
// ignore exceptions
|
// ignore exceptions
|
||||||
|
|
Loading…
Add table
Reference in a new issue