mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 01:36:01 +02:00
Code streamlining.
This commit is contained in:
parent
2e121463ed
commit
fb3a4c8d26
8 changed files with 10 additions and 26 deletions
|
@ -243,7 +243,7 @@ public class ExcludeFromBuildHandler extends AbstractHandler {
|
||||||
try {
|
try {
|
||||||
CoreModel.getDefault().setProjectDescription(p, prjd);
|
CoreModel.getDefault().setProjectDescription(p, prjd);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
CUIPlugin.getDefault().logErrorMessage(Messages.AbstractPage_11 + e.getLocalizedMessage());
|
CUIPlugin.logError(Messages.AbstractPage_11 + e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
AbstractPage.updateViews(res);
|
AbstractPage.updateViews(res);
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,6 @@ import org.eclipse.cdt.internal.ui.dialogs.IStatusChangeListener;
|
||||||
public abstract class OptionsConfigurationBlock {
|
public abstract class OptionsConfigurationBlock {
|
||||||
|
|
||||||
public static final class Key {
|
public static final class Key {
|
||||||
|
|
||||||
private String fQualifier;
|
private String fQualifier;
|
||||||
private String fKey;
|
private String fKey;
|
||||||
|
|
||||||
|
@ -118,9 +117,7 @@ public abstract class OptionsConfigurationBlock {
|
||||||
public String getQualifier() {
|
public String getQualifier() {
|
||||||
return fQualifier;
|
return fQualifier;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected static class ControlData {
|
protected static class ControlData {
|
||||||
private Key fKey;
|
private Key fKey;
|
||||||
|
@ -208,7 +205,7 @@ public abstract class OptionsConfigurationBlock {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
testIfOptionsComplete(allKeys);
|
checkIfOptionsComplete(allKeys);
|
||||||
if (fProject == null || hasProjectSpecificOptions(fProject)) {
|
if (fProject == null || hasProjectSpecificOptions(fProject)) {
|
||||||
fDisabledProjectSettings= null;
|
fDisabledProjectSettings= null;
|
||||||
} else {
|
} else {
|
||||||
|
@ -245,12 +242,11 @@ public abstract class OptionsConfigurationBlock {
|
||||||
protected final static Key getCDTUIKey(String key) {
|
protected final static Key getCDTUIKey(String key) {
|
||||||
return getKey(CUIPlugin.PLUGIN_ID, key);
|
return getKey(CUIPlugin.PLUGIN_ID, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void testIfOptionsComplete(Key[] allKeys) {
|
private void checkIfOptionsComplete(Key[] allKeys) {
|
||||||
for (int i= 0; i < allKeys.length; i++) {
|
for (int i= 0; i < allKeys.length; i++) {
|
||||||
if (allKeys[i].getStoredValue(fLookupOrder, false, fManager) == null) {
|
if (allKeys[i].getStoredValue(fLookupOrder, false, fManager) == null) {
|
||||||
CUIPlugin.getDefault().logErrorMessage("preference option missing: " + allKeys[i] + " (" + this.getClass().getName() +')'); //$NON-NLS-1$//$NON-NLS-2$
|
CUIPlugin.logError("Preference option missing: " + allKeys[i] + " (" + this.getClass().getName() +')'); //$NON-NLS-1$//$NON-NLS-2$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -264,11 +260,9 @@ public abstract class OptionsConfigurationBlock {
|
||||||
fManager.getWorkingCopy(DefaultScope.INSTANCE.getNode(CUIPlugin.PLUGIN_ID)).putInt(REBUILD_COUNT_KEY, fRebuildCount);
|
fManager.getWorkingCopy(DefaultScope.INSTANCE.getNode(CUIPlugin.PLUGIN_ID)).putInt(REBUILD_COUNT_KEY, fRebuildCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void settingsUpdated() {
|
protected void settingsUpdated() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void selectOption(String key, String qualifier) {
|
public void selectOption(String key, String qualifier) {
|
||||||
for (int i= 0; i < fAllKeys.length; i++) {
|
for (int i= 0; i < fAllKeys.length; i++) {
|
||||||
Key curr= fAllKeys[i];
|
Key curr= fAllKeys[i];
|
||||||
|
@ -295,7 +289,6 @@ public abstract class OptionsConfigurationBlock {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean hasProjectSpecificOptions(IProject project) {
|
public boolean hasProjectSpecificOptions(IProject project) {
|
||||||
if (project != null) {
|
if (project != null) {
|
||||||
IScopeContext projectContext= new ProjectScope(project);
|
IScopeContext projectContext= new ProjectScope(project);
|
||||||
|
@ -696,7 +689,6 @@ public abstract class OptionsConfigurationBlock {
|
||||||
return fDisabledProjectSettings == null || fProject == null;
|
return fDisabledProjectSettings == null || fProject == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean performOk() {
|
public boolean performOk() {
|
||||||
return processChanges(fContainer);
|
return processChanges(fContainer);
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,9 +59,7 @@ import org.eclipse.cdt.internal.ui.preferences.formatter.ProfileManager.CustomPr
|
||||||
import org.eclipse.cdt.internal.ui.preferences.formatter.ProfileManager.Profile;
|
import org.eclipse.cdt.internal.ui.preferences.formatter.ProfileManager.Profile;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class ProfileStore {
|
public class ProfileStore {
|
||||||
|
|
||||||
/** The default encoding to use */
|
/** The default encoding to use */
|
||||||
public static final String ENCODING= "UTF-8"; //$NON-NLS-1$
|
public static final String ENCODING= "UTF-8"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
@ -71,7 +69,6 @@ public class ProfileStore {
|
||||||
* A SAX event handler to parse the xml format for profiles.
|
* A SAX event handler to parse the xml format for profiles.
|
||||||
*/
|
*/
|
||||||
private final static class ProfileDefaultHandler extends DefaultHandler {
|
private final static class ProfileDefaultHandler extends DefaultHandler {
|
||||||
|
|
||||||
private List<Profile> fProfiles;
|
private List<Profile> fProfiles;
|
||||||
private int fVersion;
|
private int fVersion;
|
||||||
|
|
||||||
|
@ -123,7 +120,6 @@ public class ProfileStore {
|
||||||
public List<Profile> getProfiles() {
|
public List<Profile> getProfiles() {
|
||||||
return fProfiles;
|
return fProfiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -229,7 +225,6 @@ public class ProfileStore {
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
protected static List<Profile> readProfilesFromStream(InputSource inputSource) throws CoreException {
|
protected static List<Profile> readProfilesFromStream(InputSource inputSource) throws CoreException {
|
||||||
|
|
||||||
final ProfileDefaultHandler handler= new ProfileDefaultHandler();
|
final ProfileDefaultHandler handler= new ProfileDefaultHandler();
|
||||||
try {
|
try {
|
||||||
final SAXParserFactory factory= SAXParserFactory.newInstance();
|
final SAXParserFactory factory= SAXParserFactory.newInstance();
|
||||||
|
@ -274,8 +269,6 @@ public class ProfileStore {
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
private static void writeProfilesToStream(Collection<Profile> profiles, OutputStream stream, String encoding, IProfileVersioner profileVersioner) throws CoreException {
|
private static void writeProfilesToStream(Collection<Profile> profiles, OutputStream stream, String encoding, IProfileVersioner profileVersioner) throws CoreException {
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final DocumentBuilderFactory factory= DocumentBuilderFactory.newInstance();
|
final DocumentBuilderFactory factory= DocumentBuilderFactory.newInstance();
|
||||||
final DocumentBuilder builder= factory.newDocumentBuilder();
|
final DocumentBuilder builder= factory.newDocumentBuilder();
|
||||||
|
@ -305,7 +298,6 @@ public class ProfileStore {
|
||||||
throw createException(e, FormatterMessages.CodingStyleConfigurationBlock_error_serializing_xml_message);
|
throw createException(e, FormatterMessages.CodingStyleConfigurationBlock_error_serializing_xml_message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create a new profile element in the specified document. The profile is not added
|
* Create a new profile element in the specified document. The profile is not added
|
||||||
|
@ -328,7 +320,7 @@ public class ProfileStore {
|
||||||
setting.setAttribute(XML_ATTRIBUTE_VALUE, value);
|
setting.setAttribute(XML_ATTRIBUTE_VALUE, value);
|
||||||
element.appendChild(setting);
|
element.appendChild(setting);
|
||||||
} else {
|
} else {
|
||||||
CUIPlugin.getDefault().logErrorMessage("ProfileStore: Profile does not contain value for key " + key); //$NON-NLS-1$
|
CUIPlugin.logError("ProfileStore: Profile does not contain value for key " + key); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return element;
|
return element;
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class CorrectionCommandInstaller {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fCorrectionHandlerActivations != null) {
|
if (fCorrectionHandlerActivations != null) {
|
||||||
CUIPlugin.getDefault().logErrorMessage("correction handler activations not released"); //$NON-NLS-1$
|
CUIPlugin.logError("Correction handler activations not released"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
fCorrectionHandlerActivations= new ArrayList<IHandlerActivation>();
|
fCorrectionHandlerActivations= new ArrayList<IHandlerActivation>();
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class OpenNewWizardAction extends AbstractOpenWizardAction {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
} catch (MalformedURLException exception) {
|
} catch (MalformedURLException exception) {
|
||||||
CUIPlugin.getDefault().logErrorMessage("Unable to load wizard icon"); //$NON-NLS-1$
|
CUIPlugin.logError("Unable to load wizard icon"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
return ImageDescriptor.getMissingImageDescriptor();
|
return ImageDescriptor.getMissingImageDescriptor();
|
||||||
|
|
||||||
|
|
|
@ -203,7 +203,7 @@ implements IWorkbenchWindowPulldownDelegate2, IObjectActionDelegate {
|
||||||
try {
|
try {
|
||||||
CoreModel.getDefault().setProjectDescription(p, prjd);
|
CoreModel.getDefault().setProjectDescription(p, prjd);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
CUIPlugin.getDefault().logErrorMessage(Messages.AbstractPage_11 + e.getLocalizedMessage());
|
CUIPlugin.logError(Messages.AbstractPage_11 + e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
AbstractPage.updateViews(res);
|
AbstractPage.updateViews(res);
|
||||||
}
|
}
|
||||||
|
|
|
@ -656,7 +656,7 @@ implements
|
||||||
else
|
else
|
||||||
CDTPropertyManager.performOk(AbstractPage.this);
|
CDTPropertyManager.performOk(AbstractPage.this);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
CUIPlugin.getDefault().logErrorMessage(Messages.AbstractPage_11 + e.getLocalizedMessage());
|
CUIPlugin.logError(Messages.AbstractPage_11 + e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
updateViews(internalElement);
|
updateViews(internalElement);
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,7 +142,7 @@ public class CDTPropertyManager {
|
||||||
try {
|
try {
|
||||||
CoreModel.getDefault().setProjectDescription(project, prjd);
|
CoreModel.getDefault().setProjectDescription(project, prjd);
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
CUIPlugin.getDefault().logErrorMessage(Messages.AbstractPage_11 + e.getLocalizedMessage());
|
CUIPlugin.logError(Messages.AbstractPage_11 + e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pages.size() == 0) {
|
if (pages.size() == 0) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue