diff --git a/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml b/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml index b74ed934d5a..b3261dbb275 100644 --- a/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml +++ b/build/org.eclipse.cdt.managedbuilder.ui/plugin.xml @@ -67,6 +67,18 @@ + + + + + 0) + return true; + } else { + String ext = file.getFileExtension(); + ITool[] tools = cfg.getFilteredTools(); + for (int index = 0; index < tools.length; index++) { + ITool tool = tools[index]; + if (tool.buildsFileType(ext)) + return true; + } + } + return false; + } + + /* + * Returns true if the given resource can be built by at list one configuration + * defined for the resource project + */ + public boolean isBuildResource(IFile file){ + IProject project = file.getProject(); + IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project); + if(info != null){ + IManagedProject managedProject = info.getManagedProject(); + if(managedProject != null){ + IConfiguration cfgs[] = managedProject.getConfigurations(); + if(cfgs != null && cfgs.length > 0){ + for(int i = 0; i < cfgs.length; i++){ + if(isBuildResource(file,cfgs[i])) + return true; + } + } + } + } + return false; + } + /* * (non-Javadoc) * @@ -348,30 +450,30 @@ public class ResourceBuildPropertyPage extends PropertyPage implements // If the user did not visit this page, then there is nothing to do. if (!displayedConfig) return true; - IRunnableWithProgress runnable = new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) { - fOptionBlock.performApply(monitor); + IRunnableWithProgress runnable = new IRunnableWithProgress() { + public void run(IProgressMonitor monitor) { + fOptionBlock.performApply(monitor); + } + }; + IRunnableWithProgress op = new WorkspaceModifyDelegatingOperation(runnable); + try { + new ProgressMonitorDialog(getShell()).run(false, true, op); + } catch (InvocationTargetException e) { + Throwable e1 = e.getTargetException(); + ManagedBuilderUIPlugin.errorDialog(getShell(), ManagedBuilderUIMessages.getResourceString("ManagedProjectPropertyPage.internalError"),e1.toString(), e1); //$NON-NLS-1$ + return false; + } catch (InterruptedException e) { + // cancelled + return false; } - }; - IRunnableWithProgress op = new WorkspaceModifyDelegatingOperation(runnable); - try { - new ProgressMonitorDialog(getShell()).run(false, true, op); - } catch (InvocationTargetException e) { - Throwable e1 = e.getTargetException(); - ManagedBuilderUIPlugin.errorDialog(getShell(), ManagedBuilderUIMessages.getResourceString("ManagedProjectPropertyPage.internalError"),e1.toString(), e1); //$NON-NLS-1$ - return false; - } catch (InterruptedException e) { - // cancelled - return false; - } - - // Write out the build model info + + // Write out the build model info ManagedBuildManager.setDefaultConfiguration(getProject(), getSelectedConfiguration()); - if ( getCurrentResourceConfig().isExcluded() != isExcluded() ) { - getCurrentResourceConfig().setExclude(isExcluded()); - selectedConfiguration.setRebuildState(true); - } - + if ( getCurrentResourceConfig().isExcluded() != isExcluded() ) { + getCurrentResourceConfig().setExclude(isExcluded()); + selectedConfiguration.setRebuildState(true); + } + ManagedBuildManager.saveBuildInfo(getProject(), false); return true; } @@ -520,4 +622,4 @@ public class ResourceBuildPropertyPage extends PropertyPage implements public void setExcluded(boolean isExcluded) { this.isExcluded = isExcluded; } -} \ No newline at end of file +}