1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

@Override annotations + organize imports + unnecessary

casts/$NON-NLS + trailing white spaces
This commit is contained in:
Andrew Gvozdev 2011-11-18 17:21:02 -05:00
parent 10dd44163a
commit ba7591a95b
11 changed files with 480 additions and 464 deletions

View file

@ -41,7 +41,7 @@ public final class GCCBuildCommandParserOptionPage extends AbstractLanguageSetti
private boolean fEditable;
private Text inputCommand;
private StatusMessageLine fStatusLine;
private Button runOnceRadioButton;
private Button runEveryBuildRadioButton;
@ -69,7 +69,7 @@ public final class GCCBuildCommandParserOptionPage extends AbstractLanguageSetti
composite.setLayout(layout);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
Dialog.applyDialogFont(composite);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 2;
composite.setLayoutData(gd);
@ -90,15 +90,16 @@ public final class GCCBuildCommandParserOptionPage extends AbstractLanguageSetti
inputCommand = ControlFactory.createTextField(composite, SWT.SINGLE | SWT.BORDER);
String customParameter = provider.getCustomParameter();
inputCommand.setText(customParameter!=null ? customParameter : "");
GridData gd = new GridData();
gd.horizontalSpan = 1;
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.FILL;
inputCommand.setLayoutData(gd);
inputCommand.setEnabled(fEditable);
inputCommand.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
String text = inputCommand.getText();
AbstractBuildCommandParser provider = getRawProvider();
@ -155,7 +156,7 @@ public final class GCCBuildCommandParserOptionPage extends AbstractLanguageSetti
});
}
{
applyToProjectCheckBox = new Button(composite, SWT.CHECK);
applyToProjectCheckBox.setText("Apply discovered settings on project level");
@ -178,23 +179,23 @@ public final class GCCBuildCommandParserOptionPage extends AbstractLanguageSetti
providerTab.refreshItem(selectedProvider);
}
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
});
}
// // Status line
// if (fEditable) {
// fStatusLine = new StatusMessageLine(composite, SWT.LEFT, 2);
// IStatus status = new Status(IStatus.WARNING, CUIPlugin.PLUGIN_ID, "Note that currently not all options are persisted (FIXME)");
// fStatusLine.setErrorStatus(status);
// }
setControl(composite);
}

View file

@ -30,7 +30,6 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
@ -42,7 +41,7 @@ public final class BuiltinSpecsDetectorOptionPage extends AbstractLanguageSettin
private boolean fEditable;
private Text inputCommand;
private StatusMessageLine fStatusLine;
private Button allocateConsoleCheckBox;
@ -66,7 +65,7 @@ public final class BuiltinSpecsDetectorOptionPage extends AbstractLanguageSettin
composite.setLayout(layout);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
Dialog.applyDialogFont(composite);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 2;
composite.setLayoutData(gd);
@ -89,6 +88,7 @@ public final class BuiltinSpecsDetectorOptionPage extends AbstractLanguageSettin
inputCommand.setText(customParameter!=null ? customParameter : "");
inputCommand.setEnabled(fEditable);
inputCommand.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
String text = inputCommand.getText();
AbstractBuiltinSpecsDetector provider = getRawProvider();
@ -225,14 +225,14 @@ public final class BuiltinSpecsDetectorOptionPage extends AbstractLanguageSettin
});
}
// // Status line
// if (fEditable) {
// fStatusLine = new StatusMessageLine(composite, SWT.LEFT, 2);
// IStatus status = new Status(IStatus.WARNING, CUIPlugin.PLUGIN_ID, "Note that currently not all options are persisted (FIXME)");
// fStatusLine.setErrorStatus(status);
// }
setControl(composite);
}

View file

@ -30,7 +30,7 @@ import org.eclipse.ui.console.MessageConsoleStream;
public class ScannerDiscoveryGlobalConsole implements ICConsole {
private MessageConsole console;
private ConsoleOutputStreamAdapter stream;
private class ConsoleOutputStreamAdapter extends ConsoleOutputStream {
private MessageConsoleStream fConsoleStream;
public ConsoleOutputStreamAdapter(MessageConsoleStream stream) {
@ -44,37 +44,42 @@ public class ScannerDiscoveryGlobalConsole implements ICConsole {
public synchronized void write(byte[] b, int off, int len) throws IOException {
fConsoleStream.write(b, off, len);
}
@Override
public void flush() throws IOException {
fConsoleStream.flush();
}
@Override
public void close() throws IOException {
fConsoleStream.close();
}
}
@Override
public void start(IProject project) {
Assert.isTrue(project == null);
}
@Override
public ConsoleOutputStream getOutputStream() throws CoreException {
return stream;
}
@Override
public ConsoleOutputStream getInfoStream() throws CoreException {
return stream;
}
@Override
public ConsoleOutputStream getErrorStream() throws CoreException {
return stream;
}
@Override
public void init(String consoleId, String name, URL defaultIconUrl) {
console = null;
IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager();
IConsole[] allConsoles = consoleManager.getConsoles();
for (IConsole con : allConsoles) {
@ -90,12 +95,12 @@ public class ScannerDiscoveryGlobalConsole implements ICConsole {
if (iconUrl==null) {
iconUrl = defaultIconUrl;
}
console = new MessageConsole(name, CDTSharedImages.getImageDescriptor(iconUrl.toString()));
console.activate();
consoleManager.addConsoles(new IConsole[]{ console });
}
stream = new ConsoleOutputStreamAdapter(console.newMessageStream());
}

View file

@ -50,16 +50,16 @@ import org.eclipse.core.runtime.IPath;
import org.osgi.framework.Version;
/**
* This class represents a set of configurations
* This class represents a set of configurations
* to be edited simultaneously on property pages.
*/
public class MultiConfiguration extends MultiItemsHolder implements
IMultiConfiguration {
private static final String[] EMPTY_STR_ARRAY = new String[0];
protected IConfiguration[] fCfgs = null;
private int curr = 0;
public MultiConfiguration(IConfiguration[] cfs) {
fCfgs = cfs;
for (int i=0; i<fCfgs.length; i++)
@ -68,19 +68,19 @@ public class MultiConfiguration extends MultiItemsHolder implements
break;
}
}
public MultiConfiguration(ICConfigurationDescription[] cfds) {
this(cfds2cfs(cfds));
}
public static IConfiguration[] cfds2cfs(ICConfigurationDescription[] cfgds) {
IConfiguration[] cfs = new IConfiguration[cfgds.length];
for (int i=0; i<cfgds.length; i++)
cfs[i] = ManagedBuildManager.getConfigurationForDescription(cfgds[i]);
return cfs;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.settings.model.MultiItemsHolder#getItems()
*/
@ -211,24 +211,24 @@ public class MultiConfiguration extends MultiItemsHolder implements
*/
@Override
public IManagedCommandLineInfo generateToolCommandLineInfo(
String sourceExtension,
String[] flags,
String sourceExtension,
String[] flags,
String outputFlag,
String outputPrefix,
String outputName,
String outputPrefix,
String outputName,
String[] inputResources,
IPath inputLocation,
IPath inputLocation,
IPath outputLocation) {
if (DEBUG)
System.out.println("Strange multi access: MultiConfiguration.generateToolCommandLineInfo()"); //$NON-NLS-1$
return curr().generateToolCommandLineInfo(
sourceExtension,
flags,
outputFlag,
outputPrefix,
outputName,
inputResources,
inputLocation,
sourceExtension,
flags,
outputFlag,
outputPrefix,
outputName,
inputResources,
inputLocation,
outputLocation);
}
@ -243,7 +243,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
return EMPTY_STR;
return s;
}
public String[] getArtifactExtensions() {
String[] s = new String[fCfgs.length];
for (int i=0; i<fCfgs.length; i++)
@ -278,7 +278,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
String args0 = fCfgs[0].getBuildArguments();
if (args0 == null)
args0 = EMPTY_STR;
for (IConfiguration cfg : fCfgs) {
String args = cfg.getBuildArguments();
if (args == null)
@ -294,7 +294,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
*/
@Override
public IBuildPropertyValue getBuildArtefactType() {
IBuildPropertyValue b = fCfgs[0].getBuildArtefactType();
IBuildPropertyValue b = fCfgs[0].getBuildArtefactType();
if (b == null)
return null;
for (int i=1; i<fCfgs.length; i++)
@ -414,7 +414,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getErrorParserIds()
*/
@Override
public String getErrorParserIds() {
String s = fCfgs[0].getErrorParserIds();
@ -440,6 +440,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
return s;
}
@Override
public String getDefaultLanguageSettingsProvidersIds() {
ManagedBuilderCorePlugin.error("Default Language Settings Providers are not supported in multiconfiguration mode");
return null;
@ -847,9 +848,9 @@ public class MultiConfiguration extends MultiItemsHolder implements
return false;
return true;
}
public boolean[] isManagedBuildOnMulti() {
boolean[] b = new boolean[fCfgs.length];
boolean[] b = new boolean[fCfgs.length];
for (int i=0; i<fCfgs.length; i++)
b[i] = fCfgs[i].isManagedBuildOn();
return b;
@ -1031,7 +1032,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setName(java.lang.String)
*/
@Override
public void setName(String name) {} // do nothing
public void setName(String name) {} // do nothing
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setOption(org.eclipse.cdt.managedbuilder.core.IHoldsOptions, org.eclipse.cdt.managedbuilder.core.IOption, boolean)
@ -1214,7 +1215,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
}
return true; // all cfgs report true
}
@Override
public void setParallelDef(boolean parallel) {
for (IConfiguration cfg : fCfgs) {
@ -1222,7 +1223,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
((Configuration)cfg).setParallelDef(parallel);
}
}
@Override
public int getParallelNumber() {
int res = 0;
@ -1231,7 +1232,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
int num = ((Configuration)cfg).getParallelNumber();
Assert.isTrue(num != 0); // can't be 0, see IMakeCommonBuildInfo.getParallelizationNum()
if (res == 0)
if (res == 0)
res = num;
else if (res != num)
return 0; // values are different !
@ -1240,7 +1241,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
}
return res; // all cfgs report same value
}
@Override
public void setParallelNumber(int num) {
for (IConfiguration cfg : fCfgs) {
@ -1248,12 +1249,12 @@ public class MultiConfiguration extends MultiItemsHolder implements
((Configuration)cfg).setParallelNumber(num);
}
}
@Override
public boolean getInternalBuilderParallel() {
return getParallelDef();
}
@Override
public boolean isInternalBuilderEnabled() {
for (int i=0; i<fCfgs.length; i++)
@ -1275,14 +1276,14 @@ public class MultiConfiguration extends MultiItemsHolder implements
return false;
return true; // all cfgs report true
}
@Override
public void enableInternalBuilder(boolean v) {
for (int i=0; i<fCfgs.length; i++)
if (fCfgs[i] instanceof Configuration)
((Configuration)fCfgs[i]).enableInternalBuilder(v);
}
/**
* Returns "default" configuration.
*/
@ -1367,7 +1368,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
ManagedBuilderCorePlugin.log(e);
}
}
public String getBuildAttribute(String name, String defValue) {
String res = defValue;
IBuilder b = fCfgs[0].getBuilder();

View file

@ -15,7 +15,6 @@ import java.util.ArrayList;
import java.util.List;
import org.eclipse.cdt.core.AbstractExecutableExtensionBase;
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsEditableProvider;
import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvider;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.core.settings.model.ICFileDescription;
@ -31,11 +30,12 @@ import org.eclipse.core.runtime.IPath;
//public class MBSLanguageSettingsProvider extends AbstractExecutableExtensionBase implements ILanguageSettingsEditableProvider {
public class MBSLanguageSettingsProvider extends AbstractExecutableExtensionBase implements ILanguageSettingsProvider {
@Override
public List<ICLanguageSettingEntry> getSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId) {
IPath projectPath = rc.getProjectRelativePath();
ICLanguageSetting[] languageSettings = null;
if (rc instanceof IFile) {
ICLanguageSetting ls = cfgDescription.getLanguageSettingForFile(projectPath, true);
if (ls != null) {
@ -45,9 +45,9 @@ public class MBSLanguageSettingsProvider extends AbstractExecutableExtensionBase
ICResourceDescription rcDescription = cfgDescription.getResourceDescription(projectPath, false);
languageSettings = getLanguageSettings(rcDescription);
}
List<ICLanguageSettingEntry> list = new ArrayList<ICLanguageSettingEntry>();
if (languageSettings != null) {
for (ICLanguageSetting langSetting : languageSettings) {
if (langSetting!=null) {
@ -69,7 +69,7 @@ public class MBSLanguageSettingsProvider extends AbstractExecutableExtensionBase
}
return list;
}
private ICLanguageSetting[] getLanguageSettings(ICResourceDescription rcDescription) {
ICLanguageSetting[] array = null;
switch (rcDescription.getType()) {
@ -98,7 +98,7 @@ public class MBSLanguageSettingsProvider extends AbstractExecutableExtensionBase
// lang.setSettingEntries(kind, entries);
IPath projectPath = rc.getProjectRelativePath();
ICResourceDescription rcDescription = cfgDescription.getResourceDescription(projectPath, false);
for (ICLanguageSetting languageSetting : getLanguageSettings(rcDescription)) {
if (languageSetting!=null) {
String id = languageSetting.getLanguageId();

View file

@ -43,7 +43,7 @@ public class LanguageSettingsExtensionManager {
/** Name of the extension point for contributing language settings */
static final String PROVIDER_EXTENSION_FULL_ID = "org.eclipse.cdt.core.LanguageSettingsProvider"; //$NON-NLS-1$
static final String PROVIDER_EXTENSION_SIMPLE_ID = "LanguageSettingsProvider"; //$NON-NLS-1$
static final String ELEM_PROVIDER = "provider"; //$NON-NLS-1$
static final String ATTR_CLASS = "class"; //$NON-NLS-1$
static final String ATTR_ID = "id"; //$NON-NLS-1$
@ -57,7 +57,7 @@ public class LanguageSettingsExtensionManager {
static final String ATTR_KIND = "kind"; //$NON-NLS-1$
static final String ATTR_VALUE = "value"; //$NON-NLS-1$
/**
/**
* Extension providers loaded once. If the provider is editable (read cloneable)
* external callers get copy rather than real instance.
*/
@ -82,6 +82,7 @@ public class LanguageSettingsExtensionManager {
// sort by name - for the providers taken from platform extensions
Set<ILanguageSettingsProvider> sortedProviders = new TreeSet<ILanguageSettingsProvider>(
new Comparator<ILanguageSettingsProvider>() {
@Override
public int compare(ILanguageSettingsProvider pr1, ILanguageSettingsProvider pr2) {
return pr1.getName().compareTo(pr2.getName());
}
@ -155,7 +156,7 @@ public class LanguageSettingsExtensionManager {
/**
* Configure language settings provider with parameters defined in XML metadata.
*
*
* @param provider - empty non-configured provider.
* @param ce - configuration element from registry representing XML.
*/
@ -222,7 +223,7 @@ public class LanguageSettingsExtensionManager {
if (className==null || className.length()==0) {
return new LanguageSettingsBaseProvider();
}
try {
IExtensionPoint extension = registry.getExtensionPoint(CCorePlugin.PLUGIN_ID, PROVIDER_EXTENSION_SIMPLE_ID);
if (extension != null) {
@ -249,8 +250,8 @@ public class LanguageSettingsExtensionManager {
}
/**
* Create an instance of language settings provider of given class name.
*
* Create an instance of language settings provider of given class name.
*
* @param className - class name to instantiate.
* @return new instance of language settings provider.
*/
@ -258,7 +259,7 @@ public class LanguageSettingsExtensionManager {
if (className==null || className.equals(LanguageSettingsSerializableProvider.class.getName())) {
return new LanguageSettingsSerializableProvider();
}
ILanguageSettingsProvider provider = createProviderCarcass(className, Platform.getExtensionRegistry());
if (provider==null) {
IStatus status = new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, "Not able to load provider class=" + className);
@ -280,7 +281,7 @@ public class LanguageSettingsExtensionManager {
if (provider!=null) {
if (!(provider instanceof ILanguageSettingsEditableProvider))
throw new CloneNotSupportedException("Not able to clone provider " + provider.getClass());
provider = ((ILanguageSettingsEditableProvider) provider).clone();
}
return provider;
@ -288,7 +289,7 @@ public class LanguageSettingsExtensionManager {
/**
* TODO
*
*
* @param id
* @return
*/
@ -305,7 +306,7 @@ public class LanguageSettingsExtensionManager {
}
return provider;
}
/**
* @return list of providers contributed by all extensions. Preferable copy but if not possible
* will return raw provider.
@ -321,7 +322,7 @@ public class LanguageSettingsExtensionManager {
}
if (extensionProvider==null)
extensionProvider = fExtensionProviders.get(id);
if (extensionProvider!=null)
list.add(extensionProvider);
}

View file

@ -658,7 +658,8 @@ projects:
}
}
private static void loadProviderEntries(LanguageSettingsSerializableProvider provider, String cfgId, Element projectElementWsp) {
private static void loadProviderEntries(LanguageSettingsSerializableProvider provider,
String cfgId, Element projectElementWsp) {
/*
<project>
<configuration id="cfg.id">

View file

@ -819,6 +819,7 @@ public class CConfigurationDescription extends CDataProxyContainer implements IC
return status != null ? status : CConfigurationStatus.CFG_STATUS_OK;
}
@Override
public void setLanguageSettingProviders(List<ILanguageSettingsProvider> providers) {
try {
CConfigurationSpecSettings specSettings = getSpecSettings();
@ -828,6 +829,7 @@ public class CConfigurationDescription extends CDataProxyContainer implements IC
}
}
@Override
public List<ILanguageSettingsProvider> getLanguageSettingProviders() {
try {
return getSpecSettings().getLanguageSettingProviders();

View file

@ -56,7 +56,7 @@ import org.eclipse.core.runtime.QualifiedName;
/**
* CConfigurationDescriptionCache is a proxy class for serialization of configuration description data.
*
*
* An inspection of the scenario where user changes project properties and saves it yields
* following sequence of events:
* - Initialization:
@ -603,12 +603,14 @@ public class CConfigurationDescriptionCache extends CDefaultConfigurationData
return status != null ? status : CConfigurationStatus.CFG_STATUS_OK;
}
@Override
public void setLanguageSettingProviders(List<ILanguageSettingsProvider> providers) {
if(!fInitializing)
throw ExceptionFactory.createIsReadOnlyException();
fSpecSettings.setLanguageSettingProviders(providers);
}
@Override
public List<ILanguageSettingsProvider> getLanguageSettingProviders() {
return fSpecSettings.getLanguageSettingProviders();
}

View file

@ -639,11 +639,13 @@ public class MultiConfigDescription extends MultiItemsHolder implements
fCfgs[i].removeStorage(id);
}
@Override
public void setLanguageSettingProviders(List<ILanguageSettingsProvider> providers) {
if (DEBUG)
System.out.println("Bad multi access: MultiConfigDescription.setLanguageSettingProviders()"); //$NON-NLS-1$
}
@Override
public List<ILanguageSettingsProvider> getLanguageSettingProviders() {
if (DEBUG)
System.out.println("Bad multi access: MultiConfigDescription.getLanguageSettingProviders()"); //$NON-NLS-1$