mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-09 17:25:38 +02:00
1. Fix to not build the non-initialized project
2. small UI fixes
This commit is contained in:
parent
e7795ac42c
commit
e8fa5343a0
6 changed files with 85 additions and 2 deletions
|
@ -30,10 +30,12 @@ import org.eclipse.cdt.core.ConsoleOutputStream;
|
|||
import org.eclipse.cdt.core.ErrorParserManager;
|
||||
import org.eclipse.cdt.core.envvar.IEnvironmentVariable;
|
||||
import org.eclipse.cdt.core.envvar.IEnvironmentVariableManager;
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.model.ICModelMarker;
|
||||
import org.eclipse.cdt.core.resources.ACBuilder;
|
||||
import org.eclipse.cdt.core.resources.IConsole;
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||
import org.eclipse.cdt.core.settings.model.util.ListComparator;
|
||||
import org.eclipse.cdt.internal.core.ConsoleOutputSniffer;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2;
|
||||
|
@ -466,6 +468,11 @@ public class CommonBuilder extends ACBuilder {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isCdtProjectCreated(IProject project){
|
||||
ICProjectDescription des = CoreModel.getDefault().getProjectDescription(project, false);
|
||||
return des != null && !des.isCdtProjectCreating();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see IncrementalProjectBuilder#build
|
||||
|
@ -474,6 +481,9 @@ public class CommonBuilder extends ACBuilder {
|
|||
fBuildSet.start(this);
|
||||
|
||||
IProject project = getProject();
|
||||
|
||||
if(!isCdtProjectCreated(project))
|
||||
return project.getReferencedProjects();
|
||||
|
||||
if(VERBOSE)
|
||||
outputTrace(project.getName(), ">>build requested, type = " + kind); //$NON-NLS-1$
|
||||
|
@ -488,6 +498,9 @@ public class CommonBuilder extends ACBuilder {
|
|||
}
|
||||
|
||||
protected IProject[] build(int kind, IProject project, IBuilder[] builders, boolean isForeground, IProgressMonitor monitor) throws CoreException{
|
||||
if(!isCdtProjectCreated(project))
|
||||
return project.getReferencedProjects();
|
||||
|
||||
int num = builders.length;
|
||||
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
|
||||
IConfiguration activeCfg = info.getDefaultConfiguration();
|
||||
|
@ -1456,6 +1469,10 @@ public class CommonBuilder extends ACBuilder {
|
|||
|
||||
protected void clean(IProgressMonitor monitor) throws CoreException {
|
||||
IProject curProject = getProject();
|
||||
|
||||
if(!isCdtProjectCreated(curProject))
|
||||
return;
|
||||
|
||||
IBuilder[] builders = ManagedBuilderCorePlugin.createBuilders(curProject, null);
|
||||
for(int i = 0; i < builders.length; i++){
|
||||
IBuilder builder = builders[i];
|
||||
|
|
|
@ -50,6 +50,7 @@ public class ChangeConfigAction extends Action {
|
|||
while (iter.hasNext()) {
|
||||
IProject prj = (IProject)iter.next();
|
||||
ICProjectDescription prjd = CDTPropertyManager.getProjectDescription(prj);
|
||||
boolean changed = false;
|
||||
ICConfigurationDescription[] configs = prjd.getConfigurations();
|
||||
if (configs != null && configs.length > 0) {
|
||||
for (int i = 0; i < configs.length; i++) {
|
||||
|
@ -57,10 +58,14 @@ public class ChangeConfigAction extends Action {
|
|||
configs[i].setActive();
|
||||
CDTPropertyManager.performOk(null);
|
||||
AbstractPage.updateViews(prj);
|
||||
changed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!changed)
|
||||
CDTPropertyManager.performCancel(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -389,6 +389,9 @@ implements
|
|||
|
||||
public boolean performCancel() {
|
||||
if (! noContentOnPage && displayedConfig) forEach(ICPropertyTab.CANCEL);
|
||||
|
||||
CDTPropertyManager.performCancel(this);
|
||||
|
||||
return true;
|
||||
}
|
||||
public void performDefaults() {
|
||||
|
|
|
@ -98,8 +98,25 @@ public class CDTPropertyManager {
|
|||
*/
|
||||
public static void performOk(Object p) {
|
||||
if (saveDone) return;
|
||||
|
||||
performOkForced(p);
|
||||
}
|
||||
|
||||
if (pages.size() == 0) {
|
||||
project = null;
|
||||
prjd = null;
|
||||
saveDone = false;
|
||||
}
|
||||
}
|
||||
|
||||
public static void performCancel(Object p) {
|
||||
saveDone = true;
|
||||
|
||||
if (pages.size() == 0) {
|
||||
project = null;
|
||||
prjd = null;
|
||||
saveDone = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs mandatory saving
|
||||
|
@ -112,6 +129,12 @@ public class CDTPropertyManager {
|
|||
} catch (CoreException e) {
|
||||
CUIPlugin.getDefault().logErrorMessage(UIMessages.getString("AbstractPage.11") + e.getLocalizedMessage()); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
if (pages.size() == 0) {
|
||||
project = null;
|
||||
prjd = null;
|
||||
saveDone = false;
|
||||
}
|
||||
}
|
||||
|
||||
// pages utilities
|
||||
|
@ -137,6 +160,23 @@ public class CDTPropertyManager {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (pages.size() == 0) {
|
||||
// if(!saveDone){
|
||||
// if(prjd != null){
|
||||
// saveDone = !prjd.isModified();
|
||||
// }
|
||||
// }
|
||||
|
||||
saveDone = true;
|
||||
|
||||
// if(saveDone){
|
||||
project = null;
|
||||
prjd = null;
|
||||
saveDone = false;
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -273,4 +273,8 @@ public class ManageConfigDialog extends Dialog {
|
|||
table.setFocus();
|
||||
updateButtons();
|
||||
}
|
||||
|
||||
ICProjectDescription getProjectDescription(){
|
||||
return des;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,8 +12,11 @@
|
|||
package org.eclipse.cdt.ui.newui;
|
||||
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.jface.window.Window;
|
||||
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
|
||||
public class ManageConfigRunner implements IConfigManager {
|
||||
|
@ -41,10 +44,21 @@ public class ManageConfigRunner implements IConfigManager {
|
|||
boolean result = false;
|
||||
if (d.open() == Window.OK) {
|
||||
if (doOk) {
|
||||
CDTPropertyManager.performOk(d.getShell());
|
||||
// CDTPropertyManager.performOk(d.getShell());
|
||||
ICProjectDescription des = d.getProjectDescription();
|
||||
if(des != null){
|
||||
try {
|
||||
CoreModel.getDefault().setProjectDescription(obs[0], des);
|
||||
} catch (CoreException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
AbstractPage.updateViews(obs[0]);
|
||||
result = true;
|
||||
} else if (doOk) {
|
||||
CDTPropertyManager.performCancel(d.getShell());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue