mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-07 18:43:32 +02:00
bug 105978: Replaced deprecated calls and other cosmetics.
This commit is contained in:
parent
e87c41012e
commit
44514db3fb
1 changed files with 39 additions and 32 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2011 QNX Software Systems and others.
|
* Copyright (c) 2000, 2013 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
|
||||||
|
@ -32,17 +32,17 @@ import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.resources.IncrementalProjectBuilder;
|
import org.eclipse.core.resources.IncrementalProjectBuilder;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.Preferences;
|
|
||||||
import org.eclipse.core.runtime.jobs.ISchedulingRule;
|
import org.eclipse.core.runtime.jobs.ISchedulingRule;
|
||||||
|
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
|
||||||
|
import org.eclipse.core.runtime.preferences.InstanceScope;
|
||||||
import org.eclipse.osgi.util.NLS;
|
import org.eclipse.osgi.util.NLS;
|
||||||
|
|
||||||
public abstract class ACBuilder extends IncrementalProjectBuilder implements IMarkerGenerator {
|
public abstract class ACBuilder extends IncrementalProjectBuilder implements IMarkerGenerator {
|
||||||
|
|
||||||
private static final Preferences prefs = CCorePlugin.getDefault().getPluginPreferences();
|
|
||||||
|
|
||||||
private static final String CONTENTS_CONFIGURATION_IDS = "org.eclipse.cdt.make.core.configurationIds"; //$NON-NLS-1$
|
private static final String CONTENTS_CONFIGURATION_IDS = "org.eclipse.cdt.make.core.configurationIds"; //$NON-NLS-1$
|
||||||
|
private static final IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID);
|
||||||
/** @since 5.2 */ // set to true to print build events on the console in debug mode
|
/** @since 5.2 */ // set to true to print build events on the console in debug mode
|
||||||
protected static final boolean DEBUG_EVENTS = false;
|
protected static final boolean DEBUG_EVENTS = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for ACBuilder
|
* Constructor for ACBuilder
|
||||||
*/
|
*/
|
||||||
|
@ -93,8 +93,9 @@ public abstract class ACBuilder extends IncrementalProjectBuilder implements IMa
|
||||||
}
|
}
|
||||||
|
|
||||||
String type = problemMarkerInfo.getType();
|
String type = problemMarkerInfo.getType();
|
||||||
if (type == null)
|
if (type == null) {
|
||||||
type = ICModelMarker.C_MODEL_PROBLEM_MARKER;
|
type = ICModelMarker.C_MODEL_PROBLEM_MARKER;
|
||||||
|
}
|
||||||
|
|
||||||
IMarker marker = markerResource.createMarker(type);
|
IMarker marker = markerResource.createMarker(type);
|
||||||
marker.setAttribute(IMarker.MESSAGE, problemMarkerInfo.description);
|
marker.setAttribute(IMarker.MESSAGE, problemMarkerInfo.description);
|
||||||
|
@ -149,11 +150,11 @@ public abstract class ACBuilder extends IncrementalProjectBuilder implements IMa
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean needAllConfigBuild() {
|
public static boolean needAllConfigBuild() {
|
||||||
return prefs.getBoolean(CCorePreferenceConstants.PREF_BUILD_ALL_CONFIGS);
|
return prefs.getBoolean(CCorePreferenceConstants.PREF_BUILD_ALL_CONFIGS, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setAllConfigBuild(boolean enable) {
|
public static void setAllConfigBuild(boolean enable) {
|
||||||
prefs.setValue(CCorePreferenceConstants.PREF_BUILD_ALL_CONFIGS, enable);
|
prefs.putBoolean(CCorePreferenceConstants.PREF_BUILD_ALL_CONFIGS, enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -165,7 +166,7 @@ public abstract class ACBuilder extends IncrementalProjectBuilder implements IMa
|
||||||
*/
|
*/
|
||||||
public static boolean buildConfigResourceChanges() {
|
public static boolean buildConfigResourceChanges() {
|
||||||
//bug 219337
|
//bug 219337
|
||||||
return prefs.getBoolean(CCorePreferenceConstants.PREF_BUILD_CONFIGS_RESOURCE_CHANGES);
|
return prefs.getBoolean(CCorePreferenceConstants.PREF_BUILD_CONFIGS_RESOURCE_CHANGES, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -175,7 +176,7 @@ public abstract class ACBuilder extends IncrementalProjectBuilder implements IMa
|
||||||
* @since 5.1
|
* @since 5.1
|
||||||
*/
|
*/
|
||||||
public static void setBuildConfigResourceChanges(boolean enable) {
|
public static void setBuildConfigResourceChanges(boolean enable) {
|
||||||
prefs.setValue(CCorePreferenceConstants.PREF_BUILD_CONFIGS_RESOURCE_CHANGES, enable);
|
prefs.putBoolean(CCorePreferenceConstants.PREF_BUILD_CONFIGS_RESOURCE_CHANGES, enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("nls")
|
@SuppressWarnings("nls")
|
||||||
|
@ -191,28 +192,33 @@ public abstract class ACBuilder extends IncrementalProjectBuilder implements IMa
|
||||||
private String cfgIdToNames(String strIds) {
|
private String cfgIdToNames(String strIds) {
|
||||||
IProject project = getProject();
|
IProject project = getProject();
|
||||||
ICProjectDescription prjDesc = CoreModel.getDefault().getProjectDescription(project, false);
|
ICProjectDescription prjDesc = CoreModel.getDefault().getProjectDescription(project, false);
|
||||||
if (prjDesc==null)
|
if (prjDesc == null) {
|
||||||
return strIds;
|
return strIds;
|
||||||
|
}
|
||||||
|
|
||||||
if (strIds==null)
|
if (strIds == null) {
|
||||||
return "Active=" + prjDesc.getActiveConfiguration().getName();
|
return "Active=" + prjDesc.getActiveConfiguration().getName();
|
||||||
|
}
|
||||||
|
|
||||||
String[] ids = strIds.split("\\|");
|
String[] ids = strIds.split("\\|");
|
||||||
String names="";
|
String names="";
|
||||||
for (String id : ids) {
|
for (String id : ids) {
|
||||||
ICConfigurationDescription cfgDesc = prjDesc.getConfigurationById(id);
|
ICConfigurationDescription cfgDesc = prjDesc.getConfigurationById(id);
|
||||||
String name;
|
String name;
|
||||||
if (cfgDesc!=null)
|
if (cfgDesc != null) {
|
||||||
name = cfgDesc.getName();
|
name = cfgDesc.getName();
|
||||||
else
|
} else {
|
||||||
name = id;
|
name = id;
|
||||||
|
}
|
||||||
|
|
||||||
if (names.length()>0)
|
if (names.length() >0 ) {
|
||||||
names=names+",";
|
names=names+",";
|
||||||
|
}
|
||||||
names = names + name;
|
names = names + name;
|
||||||
}
|
}
|
||||||
if (names.equals(""))
|
if (names.equals("")) {
|
||||||
return strIds;
|
return strIds;
|
||||||
|
}
|
||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,9 +244,10 @@ public abstract class ACBuilder extends IncrementalProjectBuilder implements IMa
|
||||||
// This method is overridden with no purpose but to track events in debug mode
|
// This method is overridden with no purpose but to track events in debug mode
|
||||||
protected void clean(IProgressMonitor monitor) throws CoreException {
|
protected void clean(IProgressMonitor monitor) throws CoreException {
|
||||||
super.clean(monitor);
|
super.clean(monitor);
|
||||||
if (DEBUG_EVENTS)
|
if (DEBUG_EVENTS) {
|
||||||
printEvent(IncrementalProjectBuilder.CLEAN_BUILD, null);
|
printEvent(IncrementalProjectBuilder.CLEAN_BUILD, null);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default ACBuilder shouldn't require locking the workspace during a CDT Project build.
|
* Default ACBuilder shouldn't require locking the workspace during a CDT Project build.
|
||||||
|
|
Loading…
Add table
Reference in a new issue