1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-30 21:55:31 +02:00

autotools: Modernize o.e.cdt.autotools.ui.

* Enable warnings and save actions.
* Replace useless @see comments with proper Override annotations.
* Remove redundant type declarations.
* Add missing Deprecated annotations.
* Remove useless throws declarations.
* Remove useless casts.
* Remove useless method parameters.

Change-Id: Ic93548f0d0b20706b36efb921a7a86adbe1b2608
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
This commit is contained in:
Alexander Kurtakov 2015-10-15 11:23:56 +03:00 committed by Gerrit Code Review @ Eclipse.org
parent c6a1fab921
commit 6839fa9c6b
205 changed files with 1282 additions and 1605 deletions

View file

@ -1,8 +1,101 @@
#Tue Oct 06 15:50:25 EDT 2009
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
org.eclipse.jdt.core.compiler.problem.deadCode=warning
org.eclipse.jdt.core.compiler.problem.deprecation=warning
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=disabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=disabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameter=warning
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=warning
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.7

View file

@ -0,0 +1,60 @@
eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
sp_cleanup.add_default_serial_version_id=true
sp_cleanup.add_generated_serial_version_id=false
sp_cleanup.add_missing_annotations=true
sp_cleanup.add_missing_deprecated_annotations=true
sp_cleanup.add_missing_methods=false
sp_cleanup.add_missing_nls_tags=false
sp_cleanup.add_missing_override_annotations=true
sp_cleanup.add_missing_override_annotations_interface_methods=true
sp_cleanup.add_serial_version_id=false
sp_cleanup.always_use_blocks=true
sp_cleanup.always_use_parentheses_in_expressions=false
sp_cleanup.always_use_this_for_non_static_field_access=false
sp_cleanup.always_use_this_for_non_static_method_access=false
sp_cleanup.convert_functional_interfaces=false
sp_cleanup.convert_to_enhanced_for_loop=false
sp_cleanup.correct_indentation=false
sp_cleanup.format_source_code=true
sp_cleanup.format_source_code_changes_only=true
sp_cleanup.insert_inferred_type_arguments=false
sp_cleanup.make_local_variable_final=true
sp_cleanup.make_parameters_final=false
sp_cleanup.make_private_fields_final=true
sp_cleanup.make_type_abstract_if_missing_method=false
sp_cleanup.make_variable_declarations_final=false
sp_cleanup.never_use_blocks=false
sp_cleanup.never_use_parentheses_in_expressions=true
sp_cleanup.on_save_use_additional_actions=true
sp_cleanup.organize_imports=true
sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
sp_cleanup.remove_private_constructors=true
sp_cleanup.remove_redundant_type_arguments=true
sp_cleanup.remove_trailing_whitespaces=false
sp_cleanup.remove_trailing_whitespaces_all=true
sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
sp_cleanup.remove_unnecessary_casts=true
sp_cleanup.remove_unnecessary_nls_tags=false
sp_cleanup.remove_unused_imports=false
sp_cleanup.remove_unused_local_variables=false
sp_cleanup.remove_unused_private_fields=true
sp_cleanup.remove_unused_private_members=false
sp_cleanup.remove_unused_private_methods=true
sp_cleanup.remove_unused_private_types=true
sp_cleanup.sort_members=false
sp_cleanup.sort_members_all=false
sp_cleanup.use_anonymous_class_creation=false
sp_cleanup.use_blocks=false
sp_cleanup.use_blocks_only_for_return_and_throw=false
sp_cleanup.use_lambda=true
sp_cleanup.use_parentheses_in_expressions=false
sp_cleanup.use_this_for_non_static_field_access=false
sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
sp_cleanup.use_this_for_non_static_method_access=false
sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
sp_cleanup.use_type_arguments=false

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name.0
Bundle-SymbolicName: org.eclipse.cdt.autotools.ui;singleton:=true
Bundle-Version: 1.0.1.qualifier
Bundle-Version: 2.0.0.qualifier
Bundle-Activator: org.eclipse.cdt.autotools.ui.AutotoolsUIPlugin
Bundle-Localization: plugin
Bundle-Vendor: %provider

View file

@ -11,7 +11,7 @@
<relativePath>../../pom.xml</relativePath>
</parent>
<version>1.0.1-SNAPSHOT</version>
<version>2.0.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.autotools.ui</artifactId>
<packaging>eclipse-plugin</packaging>
</project>

View file

@ -74,6 +74,7 @@ public class AutotoolsUIPlugin extends AbstractUIPlugin {
/**
* This method is called upon plug-in activation
*/
@Override
public void start(BundleContext context) throws Exception {
super.start(context);
}
@ -81,6 +82,7 @@ public class AutotoolsUIPlugin extends AbstractUIPlugin {
/**
* This method is called when the plug-in is stopped
*/
@Override
public void stop(BundleContext context) throws Exception {
super.stop(context);
plugin = null;
@ -179,6 +181,7 @@ public class AutotoolsUIPlugin extends AbstractUIPlugin {
display = Display.getDefault();
final IStatus fstatus = status;
display.asyncExec(new Runnable() {
@Override
public void run() {
ErrorDialog.openError(null, title, null, fstatus);
}

View file

@ -72,8 +72,8 @@ public class AutoconfAnnotationHover implements IAnnotationHover, IAnnotationHov
if (model == null)
return null;
List<Annotation> exact= new ArrayList<Annotation>();
List<Annotation> including= new ArrayList<Annotation>();
List<Annotation> exact= new ArrayList<>();
List<Annotation> including= new ArrayList<>();
@SuppressWarnings("rawtypes")
Iterator e= model.getAnnotationIterator();
@ -95,9 +95,7 @@ public class AutoconfAnnotationHover implements IAnnotationHover, IAnnotationHov
return select(exact, including);
}
/*
* @see IVerticalRulerHover#getHoverInfo(ISourceViewer, int)
*/
@Override
public String getHoverInfo(ISourceViewer sourceViewer, int lineNumber) {
List<Annotation> annotations = getAnnotationsForLine(sourceViewer, lineNumber);
if (annotations != null && annotations.size() > 0) {
@ -105,25 +103,25 @@ public class AutoconfAnnotationHover implements IAnnotationHover, IAnnotationHov
if (annotations.size() == 1) {
// optimization
Annotation annotation = (Annotation) annotations.get(0);
Annotation annotation = annotations.get(0);
String message= annotation.getText();
if (message != null && message.trim().length() > 0)
return formatSingleMessage(message);
} else {
List<String> messages= new ArrayList<String>();
List<String> messages= new ArrayList<>();
Iterator<Annotation> e= annotations.iterator();
while (e.hasNext()) {
Annotation annotation = (Annotation) e.next();
Annotation annotation = e.next();
String message= annotation.getText();
if (message != null && message.trim().length() > 0)
messages.add(message.trim());
}
if (messages.size() == 1)
return formatSingleMessage((String) messages.get(0));
return formatSingleMessage(messages.get(0));
if (messages.size() > 1)
return formatMultipleMessages(messages);
@ -134,16 +132,6 @@ public class AutoconfAnnotationHover implements IAnnotationHover, IAnnotationHov
}
// private int getHoverWidth(Display display) {
// Rectangle displayBounds= display.getBounds();
// int hoverWidth= displayBounds.width - (display.getCursorLocation().x - displayBounds.x);
// hoverWidth-= 12; // XXX: Add some space to the border, Revisit
// if (hoverWidth < 200) {
// hoverWidth= 200;
// }
// return hoverWidth;
// }
/*
* Formats a message as HTML text.
*/
@ -166,7 +154,7 @@ public class AutoconfAnnotationHover implements IAnnotationHover, IAnnotationHov
HTMLPrinter.startBulletList(buffer);
Iterator<String> e= messages.iterator();
while (e.hasNext())
HTMLPrinter.addBullet(buffer, HTMLPrinter.convertToHTMLContent((String) e.next()));
HTMLPrinter.addBullet(buffer, HTMLPrinter.convertToHTMLContent(e.next()));
HTMLPrinter.endBulletList(buffer);
HTMLPrinter.addPageEpilog(buffer);
@ -178,22 +166,27 @@ public class AutoconfAnnotationHover implements IAnnotationHover, IAnnotationHov
// handles html.
@Override
public IInformationControlCreator getHoverControlCreator() {
return new IInformationControlCreator() {
@Override
public IInformationControl createInformationControl(Shell parent) {
return new DefaultInformationControl(parent, false);
}
};
}
@Override
public boolean canHandleMouseCursor() {
return false;
}
@Override
public ILineRange getHoverLineRange(ISourceViewer viewer, int lineNumber) {
return new LineRange(lineNumber, 1);
}
@Override
public Object getHoverInfo(ISourceViewer sourceViewer, ILineRange lineRange, int visibleNumberOfLines) {
return getHoverInfo(sourceViewer, lineRange.getStartLine());
}

View file

@ -38,7 +38,7 @@ import org.eclipse.swt.graphics.RGB;
public class AutoconfCodeScanner extends RuleBasedScanner {
private Map<String, IToken> fTokenMap= new HashMap<String, IToken>();
private Map<String, IToken> fTokenMap= new HashMap<>();
private String[] fPropertyNamesColor;
/**
@ -82,7 +82,7 @@ public class AutoconfCodeScanner extends RuleBasedScanner {
IToken ammacro = getToken(ColorManager.AUTOCONF_AMMACRO_COLOR);
IToken code = getToken(ColorManager.AUTOCONF_CODESEQ_COLOR);
List<IRule> rules= new ArrayList<IRule>();
List<IRule> rules= new ArrayList<>();
// Add rule for single line comments.
rules.add(new EndOfLineRule("dnl", comment)); //$NON-NLS-1$
@ -159,9 +159,7 @@ public class AutoconfCodeScanner extends RuleBasedScanner {
return -1;
}
/*
* @see ITokenScanner#nextToken()
*/
@Override
public IToken nextToken() {
return super.nextToken();
}
@ -246,9 +244,7 @@ public class AutoconfCodeScanner extends RuleBasedScanner {
}
}
/*
* @see ICharacterScanner#unread()
*/
@Override
public void unread() {
--fOffset;
fColumn = UNDEFINED;

View file

@ -25,6 +25,7 @@ public class AutoconfDocumentProvider extends TextFileDocumentProvider {
disconnect(e.next());
}
@Override
public void connect(Object element) throws CoreException {
super.connect(element);
// Remove all error markers for file as we will parse
@ -33,8 +34,9 @@ public class AutoconfDocumentProvider extends TextFileDocumentProvider {
// h.removeAllExistingMarkers();
}
@Override
public IDocument getDocument(Object element) {
FileInfo info= (FileInfo) getFileInfo(element);
FileInfo info= getFileInfo(element);
if (info != null)
return info.fTextFileBuffer.getDocument();
return getParentProvider().getDocument(element);

View file

@ -19,6 +19,7 @@ import org.eclipse.jface.text.IDocumentListener;
public class AutoconfDocumentSetupParticipant implements
IDocumentSetupParticipant, IDocumentListener {
@Override
public void setup(IDocument document) {
AutoconfPartitioner partitioner =
new AutoconfPartitioner(
@ -34,17 +35,12 @@ public class AutoconfDocumentSetupParticipant implements
// document.addDocumentListener(this);
}
/*
* @see IDocumentListener#documentAboutToBeChanged(DocumentEvent)
*/
@Override
public void documentAboutToBeChanged(DocumentEvent e) {
// do nothing
}
/*
* @see IDocumentListener#documentChanged(DocumentEvent)
*/
@Override
public void documentChanged(DocumentEvent e) {
// do nothing
}

View file

@ -118,7 +118,8 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro
super();
}
protected void initializeEditor() {
@Override
protected void initializeEditor() {
super.initializeEditor();
setDocumentProvider(getAutoconfDocumentProvider());
IPreferenceStore[] stores = new IPreferenceStore[2];
@ -155,7 +156,8 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro
return document;
}
protected void doSetInput(IEditorInput newInput) throws CoreException
@Override
protected void doSetInput(IEditorInput newInput) throws CoreException
{
// If this editor is for a project file, remove this editor as a property
// change listener.
@ -177,7 +179,7 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro
{
IDocument document = getInputDocument();
setRootElement(reparseDocument(document, newInput));
setRootElement(reparseDocument(document));
}
catch (Exception e)
{
@ -185,7 +187,8 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro
}
}
@SuppressWarnings({ "rawtypes" })
@Override
@SuppressWarnings({ "rawtypes" })
public Object getAdapter(Class required) {
if (ProjectionAnnotationModel.class.equals(required)) {
if (fProjectionSupport != null) {
@ -264,6 +267,7 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro
return ColorManager.getDefault().getColor(PreferenceConverter.getColor(AutotoolsPlugin.getDefault().getPreferenceStore(), key));
}
@Override
public void handleProjectPropertyChanged(IProject project, String property) {
if (property.equals(AutotoolsPropertyConstants.AUTOCONF_MACRO_VERSIONING)) {
ISourceViewer sourceViewer= getSourceViewer();
@ -285,24 +289,21 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro
try {
IDocument document = getInputDocument();
setRootElement(reparseDocument(document, getEditorInput()));
setRootElement(reparseDocument(document));
}
catch (Exception e) {
e.printStackTrace();
}
}
private AutoconfElement reparseDocument(IDocument document,
IEditorInput editorInput) {
private AutoconfElement reparseDocument(IDocument document) {
AutoconfParser parser = getAutoconfParser();
((AutoconfErrorHandler)parser.getErrorHandler()).removeAllExistingMarkers();
return parser.parse(document);
}
/* (non-Javadoc)
* @see org.eclipse.ui.texteditor.AbstractTextEditor#handlePreferenceStoreChanged(org.eclipse.jface.util.PropertyChangeEvent)
*/
@Override
protected void handlePreferenceStoreChanged(PropertyChangeEvent event) {
ISourceViewer sourceViewer= getSourceViewer();
if (sourceViewer == null)
@ -354,16 +355,12 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro
fHoverInfo= hoverInfo;
fControlCreator= controlCreator;
}
/*
* @see org.eclipse.jface.text.information.IInformationProvider#getSubject(org.eclipse.jface.text.ITextViewer, int)
*/
public IRegion getSubject(ITextViewer textViewer, int invocationOffset) {
@Override
public IRegion getSubject(ITextViewer textViewer, int invocationOffset) {
return fHoverRegion;
}
/*
* @see org.eclipse.jface.text.information.IInformationProvider#getInformation(org.eclipse.jface.text.ITextViewer, org.eclipse.jface.text.IRegion)
*/
public String getInformation(ITextViewer textViewer, IRegion subject) {
@Override
public String getInformation(ITextViewer textViewer, IRegion subject) {
return fHoverInfo.toString();
}
@ -371,13 +368,12 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro
* @see org.eclipse.jface.text.information.IInformationProviderExtension#getInformation2(org.eclipse.jface.text.ITextViewer, org.eclipse.jface.text.IRegion)
* @since 3.2
*/
public Object getInformation2(ITextViewer textViewer, IRegion subject) {
@Override
public Object getInformation2(ITextViewer textViewer, IRegion subject) {
return fHoverInfo;
}
/*
* @see org.eclipse.jface.text.information.IInformationProviderExtension2#getInformationPresenterControlCreator()
*/
public IInformationControlCreator getInformationPresenterControlCreator() {
@Override
public IInformationControlCreator getInformationPresenterControlCreator() {
return fControlCreator;
}
}
@ -408,10 +404,8 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro
fTextOperationAction= textOperationAction;
}
/*
* @see org.eclipse.jface.action.IAction#run()
*/
public void run() {
@Override
public void run() {
ISourceViewer sourceViewer= getSourceViewer();
if (sourceViewer == null) {
@ -589,6 +583,7 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro
*
* @param listener The reconcile listener to be added
*/
@Override
public final void addReconcilingParticipant(IReconcilingParticipant listener) {
synchronized (fReconcilingListeners) {
fReconcilingListeners.add(listener);
@ -625,18 +620,14 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro
return AutotoolsPlugin.getDefault().getPreferenceStore().getBoolean(MakefileEditorPreferenceConstants.EDITOR_FOLDING_ENABLED);
}
/* (non-Javadoc)
* @see org.eclipse.ui.editors.text.TextEditor#initializeKeyBindingScopes()
*/
@Override
protected void initializeKeyBindingScopes() {
setKeyBindingScopes(new String [] { AutotoolsUIPlugin.getUniqueIdentifier() + ".editor.scope" } ); //$NON-NLS-1$
}
/**
* @see org.eclipse.ui.texteditor.AbstractTextEditor#createActions()
*/
protected void createActions() {
@Override
protected void createActions() {
super.createActions();
// TODO: Figure out how to do this later.
// fFoldingGroup= new FoldingActionGroup(this, getSourceViewer());
@ -667,12 +658,14 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro
* @param parent Parent composite of the control.
*/
public void createPartControl(Composite parent) {
@Override
public void createPartControl(Composite parent) {
super.createPartControl(parent);
// Sticky hover support
IInformationControlCreator informationControlCreator= new IInformationControlCreator() {
public IInformationControl createInformationControl(Shell shell) {
@Override
public IInformationControl createInformationControl(Shell shell) {
return new DefaultInformationControl(shell, true);
}
};
@ -705,7 +698,8 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro
// fEditorSelectionChangedListener.install(getSelectionProvider());
}
protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) {
@Override
protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) {
ISourceViewer viewer = new ProjectionViewer(parent, ruler, getOverviewRuler(), isOverviewRulerVisible(), styles);
// ensure decoration support has been created and configured.
@ -715,9 +709,7 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro
}
/* (non-Javadoc)
* @see org.eclipse.ui.IWorkbenchPart#dispose()
*/
@Override
public void dispose() {
if (fProjectionFileUpdater != null) {
fProjectionFileUpdater.uninstall();
@ -729,9 +721,7 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro
super.dispose();
}
/*
* @see org.eclipse.ui.texteditor.AbstractTextEditor#performRevert()
*/
@Override
protected void performRevert() {
ProjectionViewer projectionViewer= (ProjectionViewer) getSourceViewer();
projectionViewer.setRedraw(false);

View file

@ -40,9 +40,7 @@ public class AutoconfEditorMacroValidator implements IAutoconfMacroValidator {
fEditor = autoconfEditor;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.autotools.ui.editors.parser.IAutoconfMacroValidator#validateMacroCall(org.eclipse.cdt.autotools.core.ui.editors.parser.AutoconfMacroElement)
*/
@Override
public void validateMacroCall(AutoconfMacroElement macro)
throws ParseException, InvalidMacroException {
AutoconfPrototype p = AutoconfTextHover.getPrototype(macro.getName(), fEditor);

View file

@ -33,7 +33,7 @@ public class AutoconfErrorHandler implements IAutoconfErrorHandler {
private int CDT_WARNING = 1;
private int CDT_ERROR = 2;
private Map<Position, Annotation> annotations = new HashMap<Position, Annotation>();
private Map<Position, Annotation> annotations = new HashMap<>();
private AnnotationModel fAnnotationModel;
public AutoconfErrorHandler(IEditorInput input) {
@ -46,23 +46,24 @@ public class AutoconfErrorHandler implements IAutoconfErrorHandler {
super(annotationType, persist, message);
}
@Override
public void setQuickFixable(boolean state) {
// do nothing
}
@Override
public boolean isQuickFixableStateSet() {
return true;
}
@Override
public boolean isQuickFixable() throws AssertionFailedException {
return false;
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.autotools.ui.editors.IAutoconfErrorHandler#handleError(org.eclipse.cdt.autotools.core.ui.editors.parser.ParseException)
*/
@Override
public void handleError(ParseException e) {
Integer charStart = Integer.valueOf(e.getStartOffset());
Integer charEnd = Integer.valueOf(e.getEndOffset());

View file

@ -26,20 +26,17 @@ public class AutoconfIdentifierRule implements IPredicateRule {
fToken = token;
}
@Override
public IToken getSuccessToken() {
return fToken;
}
/*
* @see IRule#evaluate(ICharacterScanner)
*/
@Override
public IToken evaluate(ICharacterScanner scanner) {
return evaluate(scanner, false);
}
/*
* @see IPredicateRule#evaluate(ICharacterScanner, resume)
*/
@Override
public IToken evaluate(ICharacterScanner scanner, boolean resume) {
int c = scanner.read();
if (Character.isLetterOrDigit((char)c) || fExtraChars.indexOf((char)c) >= 0) {

View file

@ -14,16 +14,12 @@ import org.eclipse.jface.text.rules.IWordDetector;
public class AutoconfKeywordDetector implements IWordDetector {
/**
* @see IWordDetector#isWordPart(character)
*/
@Override
public boolean isWordPart(char character) {
return (Character.isLetter(character) && Character.isLowerCase(character));
}
/**
* @see IWordDetector#isWordStart(char)
*/
@Override
public boolean isWordStart(char character) {
return (Character.isLetter(character) && Character.isLowerCase(character));
}

View file

@ -14,14 +14,13 @@ import org.eclipse.jface.text.rules.IWordDetector;
public class AutoconfM4WordDetector implements IWordDetector {
@Override
public boolean isWordPart(char c) {
// TODO Auto-generated method stub
return (Character.isLetter(c) ||
Character.isDigit(c) || c == '_');
return (Character.isLetter(c) || Character.isDigit(c) || c == '_');
}
@Override
public boolean isWordStart(char c) {
// TODO Auto-generated method stub
return (c == 'm');
}

View file

@ -36,11 +36,13 @@ public class AutoconfMacro implements Comparable<Object> {
return (parms.length() > 0);
}
@Override
public int compareTo(Object x) {
AutoconfMacro y = (AutoconfMacro) x;
return getName().compareTo(y.getName());
}
@Override
public boolean equals(Object x) {
if (x == null)
return false;
@ -48,6 +50,7 @@ public class AutoconfMacro implements Comparable<Object> {
return getName().equals(y.getName());
}
@Override
public int hashCode() {
return getName().hashCode();
}

View file

@ -36,7 +36,7 @@ import org.eclipse.swt.graphics.RGB;
public class AutoconfMacroCodeScanner extends RuleBasedScanner {
private Map<String, IToken> fTokenMap= new HashMap<String, IToken>();
private Map<String, IToken> fTokenMap= new HashMap<>();
private String[] fPropertyNamesColor;
private int quoteLevel;
@ -82,7 +82,7 @@ public class AutoconfMacroCodeScanner extends RuleBasedScanner {
IToken ammacro = getToken(ColorManager.AUTOCONF_AMMACRO_COLOR);
IToken code = getToken(ColorManager.AUTOCONF_CODESEQ_COLOR);
List<IRule> rules= new ArrayList<IRule>();
List<IRule> rules= new ArrayList<>();
// Add rule for single line comments.
rules.add(new RestrictedEndOfLineRule("dnl", "[]", comment)); //$NON-NLS-1$
@ -131,9 +131,7 @@ public class AutoconfMacroCodeScanner extends RuleBasedScanner {
setRules(result);
}
/*
* @see ITokenScanner#nextToken()
*/
@Override
public IToken nextToken() {
int ch = read();
if (ch == '[') {
@ -267,9 +265,7 @@ public class AutoconfMacroCodeScanner extends RuleBasedScanner {
}
}
/*
* @see ICharacterScanner#unread()
*/
@Override
public void unread() {
--fOffset;
fColumn = UNDEFINED;

View file

@ -46,6 +46,7 @@ public class AutoconfMacroContentAssistProcessor implements
return offset;
}
@Override
public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer,
int offset) {
@ -62,7 +63,7 @@ public class AutoconfMacroContentAssistProcessor implements
}
ICompletionProposal[] result = null;
if (macros != null) {
ArrayList<ICompletionProposal> validList = new ArrayList<ICompletionProposal>();
ArrayList<ICompletionProposal> validList = new ArrayList<>();
for (int i = 0; i < macros.length; ++i) {
String name = macros[i].getName();
if (name.length() >= prefix.length()) {
@ -86,32 +87,37 @@ public class AutoconfMacroContentAssistProcessor implements
}
}
result = new ICompletionProposal[validList.size()];
result = (ICompletionProposal[])validList.toArray(result);
result = validList.toArray(result);
}
return result;
}
@Override
public IContextInformation[] computeContextInformation(ITextViewer viewer,
int offset) {
// TODO Auto-generated method stub
return null;
}
@Override
public char[] getCompletionProposalAutoActivationCharacters() {
// TODO Auto-generated method stub
return null;
}
@Override
public char[] getContextInformationAutoActivationCharacters() {
// TODO Auto-generated method stub
return null;
}
@Override
public IContextInformationValidator getContextInformationValidator() {
// TODO Auto-generated method stub
return new AutoconfMacroParameterListValidator();
}
@Override
public String getErrorMessage() {
// TODO Auto-generated method stub
return null;

View file

@ -34,9 +34,7 @@ public class AutoconfMacroDamagerRepairer extends DefaultDamagerRepairer {
super(scanner);
}
/*
* @see IPresentationDamager#getDamageRegion(ITypedRegion, DocumentEvent, boolean)
*/
@Override
public IRegion getDamageRegion(ITypedRegion partition, DocumentEvent e, boolean documentPartitioningChanged) {
// In the case of a partition with multiline rules, we will punt to
// reparse the entire partition because we don't know if the line being
@ -46,9 +44,7 @@ public class AutoconfMacroDamagerRepairer extends DefaultDamagerRepairer {
return partition;
}
/*
* @see IPresentationRepairer#createPresentation(TextPresentation, ITypedRegion)
*/
@Override
public void createPresentation(TextPresentation presentation, ITypedRegion region) {
// int offset = region.getOffset();

View file

@ -39,10 +39,7 @@ public class AutoconfMacroParameterListValidator implements IContextInformationV
public AutoconfMacroParameterListValidator() {
}
/**
* @see IContextInformationValidator#install(IContextInformation, ITextViewer, int)
* @see IContextInformationPresenter#install(IContextInformation, ITextViewer, int)
*/
@Override
public void install(IContextInformation info, ITextViewer viewer, int documentPosition) {
fPosition= documentPosition;
@ -130,9 +127,7 @@ public class AutoconfMacroParameterListValidator implements IContextInformationV
return charCount;
}
/**
* @see IContextInformationValidator#isContextInformationValid(int)
*/
@Override
public boolean isContextInformationValid(int position) {
try {
@ -152,9 +147,7 @@ public class AutoconfMacroParameterListValidator implements IContextInformationV
}
}
/**
* @see IContextInformationPresenter#updatePresentation(int, TextPresentation)
*/
@Override
public boolean updatePresentation(int position, TextPresentation presentation) {
int currentParameter= -1;

View file

@ -45,6 +45,7 @@ public class AutoconfMacroPartitionRule implements IPredicateRule {
m4MacroWordDetector = new AutoconfM4WordDetector();
}
@Override
public IToken getSuccessToken() {
return token;
}
@ -77,12 +78,14 @@ public class AutoconfMacroPartitionRule implements IPredicateRule {
}
}
@Override
public IToken evaluate(ICharacterScanner scanner, boolean resume) {
// if (resume)
// return Token.UNDEFINED;
return evaluate(scanner);
}
@Override
public IToken evaluate(ICharacterScanner scanner) {
int c = scanner.read();
fBuffer.setLength(0);

View file

@ -55,9 +55,7 @@ public class AutoconfMacroProposalContextInformation implements IContextInformat
fInformationDisplayString= informationDisplayString;
}
/*
* @see IContextInformation#equals(Object)
*/
@Override
public boolean equals(Object object) {
if (object instanceof IContextInformation) {
IContextInformation contextInformation= (IContextInformation) object;
@ -69,36 +67,30 @@ public class AutoconfMacroProposalContextInformation implements IContextInformat
return false;
}
@Override
public int hashCode() {
String combined = fInformationDisplayString.toLowerCase().concat(fContextDisplayString.toLowerCase());
return combined.hashCode();
}
/*
* @see IContextInformation#getInformationDisplayString()
*/
@Override
public String getInformationDisplayString() {
return fInformationDisplayString;
}
/*
* @see IContextInformation#getImage()
*/
@Override
public Image getImage() {
return fImage;
}
/*
* @see IContextInformation#getContextDisplayString()
*/
@Override
public String getContextDisplayString() {
if (fContextDisplayString != null)
return fContextDisplayString;
return fInformationDisplayString;
}
/* (non-Javadoc)
* @see org.eclipse.jface.text.contentassist.IContextInformationExtension#getContextInformationPosition()
*/
@Override
public int getContextInformationPosition() {
return fInformationPosition;
}

View file

@ -45,6 +45,7 @@ public class AutoconfMacroRule implements IRule {
fStartingSequence = startingSequence;
}
@Override
public IToken evaluate(ICharacterScanner scanner) {
int c = scanner.read();
fBuffer.setLength(0);

View file

@ -14,11 +14,13 @@ import org.eclipse.jface.text.rules.IWordDetector;
public class AutoconfMacroWordDetector implements IWordDetector {
@Override
public boolean isWordPart(char c) {
return ((Character.isLetter(c) && Character.isUpperCase(c)) ||
Character.isDigit(c) || c == '_');
}
@Override
public boolean isWordStart(char c) {
return (c == 'A');
}

View file

@ -14,11 +14,13 @@ import org.eclipse.jface.text.rules.IWordDetector;
public class AutoconfPKGWordDetector implements IWordDetector {
@Override
public boolean isWordPart(char c) {
return ((Character.isLetter(c) && Character.isUpperCase(c)) ||
Character.isDigit(c) || c == '_');
}
@Override
public boolean isWordStart(char c) {
return (c == 'P');
}

View file

@ -33,7 +33,7 @@ public class AutoconfPartitionScanner extends RuleBasedPartitionScanner {
public AutoconfPartitionScanner() {
super();
List<IRule> rules= new ArrayList<IRule>();
List<IRule> rules= new ArrayList<>();
Token macro = new Token(AUTOCONF_MACRO);
Token comment = new Token(AUTOCONF_COMMENT);

View file

@ -30,6 +30,7 @@ public class AutoconfPartitioner extends FastPartitioner {
// To optionally show partitions, we must do so by overriding the computePartitioning
// method. We cannot do it at connect time because the document may be zero length
// at the time and we will end up getting default partitioning from then on.
@Override
public ITypedRegion[] computePartitioning(int offset, int length,
boolean includeZeroLength) {
ITypedRegion[] regions = super.computePartitioning(offset, length, includeZeroLength);

View file

@ -33,6 +33,7 @@ public class AutoconfReconcilingStrategy implements IReconcilingStrategy {
documentProvider = editor.getDocumentProvider();
}
@Override
public void reconcile(IRegion partition) {
try {
AutoconfParser parser = editor.getAutoconfParser();
@ -45,11 +46,13 @@ public class AutoconfReconcilingStrategy implements IReconcilingStrategy {
}
}
@Override
public void reconcile(DirtyRegion dirtyRegion, IRegion subRegion) {
// TODO Auto-generated method stub
}
@Override
public void setDocument(IDocument document) {
// TODO Auto-generated method stub

View file

@ -40,16 +40,12 @@ public class AutoconfSourceViewerConfiguration extends
fEditor = editor;
}
/*
* @see org.eclipse.jface.text.source.SourceViewerConfiguration#getConfiguredDocumentPartitioning(org.eclipse.jface.text.source.ISourceViewer)
*/
@Override
public String getConfiguredDocumentPartitioning(ISourceViewer sourceViewer) {
return AutoconfEditor.AUTOCONF_PARTITIONING;
}
/*
* @see org.eclipse.jface.text.source.SourceViewerConfiguration#getContentAssistant(org.eclipse.jface.text.source.ISourceViewer)
*/
@Override
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
ContentAssistant assistant = new ContentAssistant();
@ -66,39 +62,35 @@ public class AutoconfSourceViewerConfiguration extends
return assistant;
}
/* (non-Javadoc)
* Method declared on SourceViewerConfiguration
*/
@Override
public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
return new String[] { IDocument.DEFAULT_CONTENT_TYPE,
AutoconfPartitionScanner.AUTOCONF_MACRO,
AutoconfPartitionScanner.AUTOCONF_COMMENT};
}
@Override
public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) {
if (acHover == null)
acHover = new AutoconfTextHover(fEditor);
return acHover;
}
@Override
public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) {
if (aaHover == null)
aaHover = new AutoconfAnnotationHover();
return aaHover;
}
/* (non-Javadoc)
* @see org.eclipse.jface.text.source.SourceViewerConfiguration#getReconciler(org.eclipse.jface.text.source.ISourceViewer)
*/
@Override
public IReconciler getReconciler(ISourceViewer sourceViewer) {
MonoReconciler reconciler= new MonoReconciler(new AutoconfReconcilingStrategy(fEditor), false);
reconciler.setDelay(1000);
reconciler.setProgressMonitor(new NullProgressMonitor());
return reconciler;
}
/* (non-Javadoc)
* Method declared on SourceViewerConfiguration
*/
@Override
public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
PresentationReconciler reconciler = new PresentationReconciler();

View file

@ -14,6 +14,7 @@ import org.eclipse.jface.text.rules.IWhitespaceDetector;
public class AutoconfWhitespaceDetector implements IWhitespaceDetector {
@Override
public boolean isWhitespace(char c) {
return (c == ' ' || c == '\t' || c == '\n' || c == '\r');
}

View file

@ -17,16 +17,12 @@ public class AutoconfWordDetector implements IWordDetector {
private static final String correctStartSpecChars = "%*().><"; //$NON-NLS-1$
private static final String correctSpecChars = "@$/\\><"; //$NON-NLS-1$
/**
* @see IWordDetector#isWordPart(character)
*/
@Override
public boolean isWordPart(char character) {
return Character.isLetterOrDigit(character) || (correctSpecChars.indexOf(character) >= 0);
}
/**
* @see IWordDetector#isWordStart(char)
*/
@Override
public boolean isWordStart(char character) {
return Character.isLetterOrDigit(character) || (correctStartSpecChars.indexOf(character) >= 0);
}

View file

@ -60,6 +60,7 @@ public class InlineDataRule implements IRule {
scanner.unread();
return true;
}
@Override
public IToken evaluate(ICharacterScanner scanner) {
int c = scanner.read();
fBuffer.setLength(0);

View file

@ -29,9 +29,7 @@ public class MultilineRuleDamagerRepairer extends DefaultDamagerRepairer {
super(scanner);
}
/*
* @see IPresentationDamager#getDamageRegion(ITypedRegion, DocumentEvent, boolean)
*/
@Override
public IRegion getDamageRegion(ITypedRegion partition, DocumentEvent e, boolean documentPartitioningChanged) {
// In the case of a partition with multiline rules, we will punt to
// reparse the entire partition because we don't know if the line being

View file

@ -30,6 +30,7 @@ public class ParseException extends Exception {
public void setLineNumber(int lineNumber) {
this.lineNumber = lineNumber;
}
@Override
public String getMessage() {
return message;
}

View file

@ -72,7 +72,7 @@ public class RecursiveSingleLineRule extends SingleLineRule {
super(startSequence, endSequence, token, escapeCharacter, breaksOnEOF);
this.startSequence = startSequence;
this.endSequence = endSequence;
rules = new ArrayList<IRule>();
rules = new ArrayList<>();
startIndex = 0;
endIndex = 0;
}
@ -99,7 +99,7 @@ public class RecursiveSingleLineRule extends SingleLineRule {
super(startSequence, endSequence, token, escapeCharacter, breaksOnEOF, escapeContinuesLine);
this.startSequence = startSequence;
this.endSequence = endSequence;
rules = new ArrayList<IRule>();
rules = new ArrayList<>();
startIndex = 0;
endIndex = 0;
}
@ -108,6 +108,7 @@ public class RecursiveSingleLineRule extends SingleLineRule {
rules.add(rule);
}
@Override
public IToken getSuccessToken() {
// We need to be aware of what success token we are referring to.
// The current internal rule index will help us determine which
@ -125,6 +126,7 @@ public class RecursiveSingleLineRule extends SingleLineRule {
scanner.unread();
}
@Override
public IToken evaluate(ICharacterScanner scanner, boolean resume) {
int column = scanner.getColumn();
// Check if we are at EOF, in which case rules don't hold

View file

@ -71,7 +71,7 @@ public class RestrictedEndOfLineRule extends EndOfLineRule {
super(startSequence, token, escapeCharacter, breaksOnEOF);
this.startSequence = startSequence;
this.restrictedChars = restrictedChars;
rules = new ArrayList<IRule>();
rules = new ArrayList<>();
startIndex = 0;
endIndex = 0;
}
@ -88,6 +88,7 @@ public class RestrictedEndOfLineRule extends EndOfLineRule {
scanner.unread();
}
@Override
public IToken evaluate(ICharacterScanner scanner, boolean resume) {
int column = scanner.getColumn();
// Check if we are at EOF, in which case rules don't hold

View file

@ -43,7 +43,7 @@ public class AutoconfContentOutlinePage extends ContentOutlinePage {
}
protected ISelection updateSelection(ISelection sel) {
ArrayList<AutoconfElement> newSelection= new ArrayList<AutoconfElement>();
ArrayList<AutoconfElement> newSelection= new ArrayList<>();
if (sel instanceof IStructuredSelection) {
@SuppressWarnings("rawtypes")
Iterator iter= ((IStructuredSelection)sel).iterator();
@ -69,6 +69,7 @@ public class AutoconfContentOutlinePage extends ContentOutlinePage {
if (control != null && !control.isDisposed())
{
control.getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
if (!control.isDisposed()) {
// control.setRedraw(false);
@ -86,6 +87,7 @@ public class AutoconfContentOutlinePage extends ContentOutlinePage {
}
}
@Override
public void createControl(Composite parent) {
super.createControl(parent);
@ -102,6 +104,7 @@ public class AutoconfContentOutlinePage extends ContentOutlinePage {
/*
* Change in selection
*/
@Override
public void selectionChanged(SelectionChangedEvent event)
{
super.selectionChanged(event);

View file

@ -36,11 +36,13 @@ public class AutoconfContentProvider implements ITreeContentProvider {
this.documentProvider = editor.getDocumentProvider();
}
@Override
public void dispose() {
// TODO Auto-generated method stub
}
@Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
if (oldInput != null)
{
@ -69,6 +71,7 @@ public class AutoconfContentProvider implements ITreeContentProvider {
}
}
@Override
public Object[] getChildren(Object parentElement) {
if (parentElement instanceof AutoconfElement) {
AutoconfElement element = (AutoconfElement)parentElement;
@ -77,10 +80,12 @@ public class AutoconfContentProvider implements ITreeContentProvider {
return new Object[0];
}
@Override
public Object getParent(Object element) {
return null;
}
@Override
public boolean hasChildren(Object element) {
if (element instanceof AutoconfElement) {
return ((AutoconfElement)element).hasChildren();
@ -88,6 +93,7 @@ public class AutoconfContentProvider implements ITreeContentProvider {
return false;
}
@Override
public Object[] getElements(Object inputElement) {
return this.getChildren(editor.getRootElement());
}

View file

@ -35,19 +35,24 @@ public class AutoconfLabelProvider implements ILabelProvider {
super();
}
@Override
public void addListener(ILabelProviderListener listener) {
}
@Override
public void dispose() {
}
@Override
public boolean isLabelProperty(Object element, String property) {
return false;
}
@Override
public void removeListener(ILabelProviderListener listener) {
}
@Override
public Image getImage(Object element) {
if (element instanceof AutoconfIfElement)
return AutotoolsUIPluginImages.get(AutotoolsUIPluginImages.IMG_OBJS_IF);
@ -74,6 +79,7 @@ public class AutoconfLabelProvider implements ILabelProvider {
return null;
}
@Override
public String getText(Object element) {
if (element instanceof AutoconfElement) {
AutoconfElement e = (AutoconfElement)element;

View file

@ -34,16 +34,17 @@ public class AutoconfElement {
this.name = name;
this.var = var;
this.startOffset = 0;
this.children = new ArrayList<AutoconfElement>();
this.children = new ArrayList<>();
}
@Override
public String toString() {
String source = getSource();
if (source == null) {
StringBuffer kids = new StringBuffer();
for (Iterator<AutoconfElement> iterator = children.iterator(); iterator.hasNext();) {
AutoconfElement kid = (AutoconfElement) iterator.next();
AutoconfElement kid = iterator.next();
kids.append(kid.toString());
kids.append(","); //$NON-NLS-1$
}
@ -64,7 +65,7 @@ public class AutoconfElement {
public AutoconfElement getLastChild() {
if (hasChildren())
return (AutoconfElement)children.get(children.size() - 1);
return children.get(children.size() - 1);
return null;
}
@ -77,7 +78,7 @@ public class AutoconfElement {
}
public AutoconfElement[] getChildren() {
return (AutoconfElement[]) children.toArray(new AutoconfElement[children.size()]);
return children.toArray(new AutoconfElement[children.size()]);
}
public boolean hasChildren() {

View file

@ -26,6 +26,7 @@ public class AutoconfMacroArgumentElement extends AutoconfElement {
public AutoconfMacroArgumentElement(String name) {
super(name);
}
@Override
public String getVar() {
return super.getVar();
}

View file

@ -14,16 +14,11 @@ package org.eclipse.cdt.autotools.ui.editors.parser;
import java.util.regex.Pattern;
/**
*
*/
public class AutoconfMacroDetector implements IAutoconfMacroDetector {
private static final Pattern AUTOCONF_MACRO_PATTERN = Pattern.compile("PKG_.*|AC_.*|AM_.*|m4.*"); //$NON-NLS-1$
/* (non-Javadoc)
* @see org.eclipse.cdt.autotools.core.ui.editors.parser.IAutoconfMacroDetector#isMacroIdentifier(java.lang.String)
*/
@Override
public boolean isMacroIdentifier(String name) {
return AUTOCONF_MACRO_PATTERN.matcher(name).matches();
}

View file

@ -22,6 +22,7 @@ public class AutoconfMacroElement extends AutoconfElement {
super(name);
}
@Override
public String getVar() {
if (children.size() > 0)
return getParameter(0);
@ -33,7 +34,7 @@ public class AutoconfMacroElement extends AutoconfElement {
}
public String getParameter(int num) {
return ((AutoconfElement) children.get(num)).getName();
return children.get(num).getName();
}
/**

View file

@ -68,7 +68,7 @@ public class AutoconfOutlineErrorHandler {
int lineNumber = e.getLineNumber();
Map<String, Object> map = new HashMap<String, Object>();
Map<String, Object> map = new HashMap<>();
MarkerUtilities.setLineNumber(map, lineNumber);
MarkerUtilities.setMessage(map, e.getMessage());
map.put(IMarker.MESSAGE, e.getMessage());

View file

@ -62,7 +62,7 @@ public class AutoconfParser {
"format incr decr eval syscmd esyscmd sysval mkstemp maketemp errprint m4exit " + //$NON-NLS-1$
"__file__ __line__ __program__ "; //$NON-NLS-1$
private static List<String> m4builtins = new ArrayList<String>();
private static List<String> m4builtins = new ArrayList<>();
static {
m4builtins.addAll(Arrays.asList(M4_BUILTINS.split(" "))); //$NON-NLS-1$
}
@ -252,7 +252,7 @@ public class AutoconfParser {
else
exp = "do";
handleError(block, token, AutoconfEditorMessages.getFormattedString(MISSING_SPECIFIER, exp));
handleError(token, AutoconfEditorMessages.getFormattedString(MISSING_SPECIFIER, exp));
// assume we're still in the block...
tokenizer.unreadToken(token);
@ -332,7 +332,7 @@ public class AutoconfParser {
setSourceEnd(block, token);
if (token.getType() != ITokenConstants.SH_ESAC) {
handleError(parent, token, AutoconfEditorMessages.getFormattedString(UNTERMINATED_CONSTRUCT, block.getName()));
handleError(token, AutoconfEditorMessages.getFormattedString(UNTERMINATED_CONSTRUCT, block.getName()));
}
}
@ -410,7 +410,7 @@ public class AutoconfParser {
case ITokenConstants.EOF:
AutoconfElement element = parent;
while (element != null && !(element instanceof AutoconfRootElement)) {
handleError(element, token, AutoconfEditorMessages.getFormattedString(UNTERMINATED_CONSTRUCT, element.getName()));
handleError(token, AutoconfEditorMessages.getFormattedString(UNTERMINATED_CONSTRUCT, element.getName()));
element = element.getParent();
}
throw new BlockEndCondition(token);
@ -443,12 +443,12 @@ public class AutoconfParser {
// being tolerant of nesting problems by allowing
// stranded else/elif nodes but reporting errors.
case ITokenConstants.SH_IF:
checkLineStart(parent, token, atStart);
checkLineStart(token, atStart);
parseBlock(parent, token, new AutoconfIfElement());
break;
case ITokenConstants.SH_ELIF:
checkLineStart(parent, token, atStart);
checkLineStart(token, atStart);
checkBlockValidity(
parent, token,
new Class[] { AutoconfIfElement.class, AutoconfElifElement.class },
@ -458,7 +458,7 @@ public class AutoconfParser {
throw new BlockEndCondition(token);
case ITokenConstants.SH_ELSE:
checkLineStart(parent, token, atStart);
checkLineStart(token, atStart);
checkBlockValidity(
parent, token,
new Class[] { AutoconfIfElement.class, AutoconfElifElement.class },
@ -468,7 +468,7 @@ public class AutoconfParser {
throw new BlockEndCondition(token);
case ITokenConstants.SH_FI:
checkLineStart(parent, token, atStart);
checkLineStart(token, atStart);
checkBlockValidity(
parent, token,
new Class[] { AutoconfIfElement.class, AutoconfElifElement.class, AutoconfElseElement.class },
@ -478,27 +478,27 @@ public class AutoconfParser {
// 4. Look for for/while loops
case ITokenConstants.SH_FOR:
checkLineStart(parent, token, atStart);
checkLineStart(token, atStart);
parseBlock(parent, token, new AutoconfForElement());
break;
case ITokenConstants.SH_WHILE:
checkLineStart(parent, token, atStart);
checkLineStart(token, atStart);
parseBlock(parent, token, new AutoconfWhileElement());
break;
case ITokenConstants.SH_UNTIL:
checkLineStart(parent, token, atStart);
checkLineStart(token, atStart);
parseBlock(parent, token, new AutoconfUntilElement());
break;
case ITokenConstants.SH_SELECT:
checkLineStart(parent, token, atStart);
checkLineStart(token, atStart);
parseBlock(parent, token, new AutoconfSelectElement());
break;
case ITokenConstants.SH_DONE:
checkLineStart(parent, token, atStart);
checkLineStart(token, atStart);
checkBlockValidity(
parent, token,
new Class[] { AutoconfForElement.class, AutoconfWhileElement.class,
@ -508,7 +508,7 @@ public class AutoconfParser {
// 5. Look for case statements
case ITokenConstants.SH_CASE:
checkLineStart(parent, token, atStart);
checkLineStart(token, atStart);
parseCaseBlock(parent, token, new AutoconfCaseElement());
break;
@ -520,7 +520,7 @@ public class AutoconfParser {
throw new BlockEndCondition(token);
case ITokenConstants.SH_ESAC:
checkLineStart(parent, token, atStart);
checkLineStart(token, atStart);
checkBlockValidity(
parent, token,
// note: we don't strictly recurse here, so accept either parent
@ -539,9 +539,9 @@ public class AutoconfParser {
}
}
private void checkLineStart(AutoconfElement parent, Token token, boolean atStart) {
private void checkLineStart(Token token, boolean atStart) {
if (!atStart) {
handleError(parent, token, AutoconfEditorMessages.getFormattedString(INVALID_TERMINATION, token.getText()));
handleError(token, AutoconfEditorMessages.getFormattedString(INVALID_TERMINATION, token.getText()));
}
}
@ -554,8 +554,7 @@ public class AutoconfParser {
private void parseHERE(AutoconfElement parent, Token controlToken) {
Token token = tokenizer.readToken();
if (token.getType() == ITokenConstants.EOL || token.getType() == ITokenConstants.EOF) {
handleError(parent, token,
AutoconfEditorMessages.getString(INCOMPLETE_INLINE_MARKER));
handleError(token, AutoconfEditorMessages.getString(INCOMPLETE_INLINE_MARKER));
} else {
String hereTag = token.getText();
@ -564,7 +563,7 @@ public class AutoconfParser {
while (true) {
token = tokenizer.readToken();
if (token.getType() == ITokenConstants.EOF) {
handleError(parent, token, AutoconfEditorMessages.getFormattedString(UNTERMINATED_CONSTRUCT, parent.getName()));
handleError(token, AutoconfEditorMessages.getFormattedString(UNTERMINATED_CONSTRUCT, parent.getName()));
break;
} else if (token.getType() == ITokenConstants.EOL) {
atEOL = true;
@ -630,7 +629,7 @@ public class AutoconfParser {
// 5. Abort on unexpected tokens
case ITokenConstants.SH_DO:
case ITokenConstants.SH_THEN:
handleError(parent, token, AutoconfEditorMessages.getFormattedString(INVALID_SPECIFIER, token.getText()));
handleError(token, AutoconfEditorMessages.getFormattedString(INVALID_SPECIFIER, token.getText()));
tokenizer.unreadToken(token);
// close enough...
return token;
@ -644,7 +643,7 @@ public class AutoconfParser {
case ITokenConstants.SH_ELSE:
case ITokenConstants.SH_FI:
case ITokenConstants.SH_DONE:
handleError(parent, token, AutoconfEditorMessages.getFormattedString(UNTERMINATED_CONSTRUCT, parent.getName()));
handleError(token, AutoconfEditorMessages.getFormattedString(UNTERMINATED_CONSTRUCT, parent.getName()));
tokenizer.unreadToken(token);
throw new BlockEndCondition(token);
}
@ -684,7 +683,7 @@ public class AutoconfParser {
// 4. Abort on unexpected tokens
else switch (token.getType()) {
case ITokenConstants.SH_THEN:
handleError(parent, token, AutoconfEditorMessages.getFormattedString(INVALID_SPECIFIER, token.getText()));
handleError(token, AutoconfEditorMessages.getFormattedString(INVALID_SPECIFIER, token.getText()));
tokenizer.unreadToken(token);
// close enough...
//throw new ExprEndCondition(token);
@ -699,7 +698,7 @@ public class AutoconfParser {
case ITokenConstants.SH_ELSE:
case ITokenConstants.SH_FI:
case ITokenConstants.SH_DONE:
handleError(parent, token, AutoconfEditorMessages.getFormattedString(UNTERMINATED_CONSTRUCT, parent.getName()));
handleError(token, AutoconfEditorMessages.getFormattedString(UNTERMINATED_CONSTRUCT, parent.getName()));
tokenizer.unreadToken(token);
throw new BlockEndCondition(token);
}
@ -746,9 +745,9 @@ public class AutoconfParser {
case ITokenConstants.SH_DO:
case ITokenConstants.SH_THEN:
if (parent instanceof AutoconfCaseElement)
handleError(parent, token, AutoconfEditorMessages.getString(INVALID_IN));
handleError(token, AutoconfEditorMessages.getString(INVALID_IN));
else
handleError(parent, token, AutoconfEditorMessages.getString(IMPROPER_CASE_CONDITION));
handleError(token, AutoconfEditorMessages.getString(IMPROPER_CASE_CONDITION));
// close enough...
return token;
@ -761,7 +760,7 @@ public class AutoconfParser {
case ITokenConstants.SH_ELSE:
case ITokenConstants.SH_FI:
case ITokenConstants.SH_DONE:
handleError(parent, token, AutoconfEditorMessages.getFormattedString(UNTERMINATED_CONSTRUCT, parent.getName()));
handleError(token, AutoconfEditorMessages.getFormattedString(UNTERMINATED_CONSTRUCT, parent.getName()));
tokenizer.unreadToken(token);
throw new BlockEndCondition(token);
}
@ -789,8 +788,7 @@ public class AutoconfParser {
}
// not a match
handleError(parent, token,
AutoconfEditorMessages.getFormattedString(errorMessage, parent.getName(), token.getText()));
handleError(token, AutoconfEditorMessages.getFormattedString(errorMessage, parent.getName(), token.getText()));
}
/**
@ -879,7 +877,7 @@ public class AutoconfParser {
&& !(parent instanceof AutoconfForElement)) {
Token peek = tokenizer.peekToken();
if (peek.getType() == ITokenConstants.RPAREN) {
handleError(macro, peek, AutoconfEditorMessages.getString(UNMATCHED_RIGHT_PARENTHESIS));
handleError(peek, AutoconfEditorMessages.getString(UNMATCHED_RIGHT_PARENTHESIS));
}
}
@ -888,10 +886,10 @@ public class AutoconfParser {
private void validateMacroParameterCount(AutoconfMacroElement macro, Token token, int count) {
if (macro.getParameterCount() < count) {
handleError(macro, token, AutoconfEditorMessages.getFormattedString("M4MacroArgsTooFew",
handleError(token, AutoconfEditorMessages.getFormattedString("M4MacroArgsTooFew",
macro.getName(), Integer.valueOf(2))); //$NON-NLS-1$
} else if (macro.getParameterCount() > count) {
handleError(macro, token, AutoconfEditorMessages.getFormattedString("M4MacroArgsTooMany",
handleError(token, AutoconfEditorMessages.getFormattedString("M4MacroArgsTooMany",
macro.getName(), Integer.valueOf(2))); //$NON-NLS-1$
}
}
@ -911,7 +909,7 @@ public class AutoconfParser {
Token token = tokenizer.readToken();
if (token.getType() == ITokenConstants.LPAREN) {
token = parseMacroArguments(macro, token);
token = parseMacroArguments(macro);
setSourceEnd(macro, token);
} else {
tokenizer.unreadToken(token);
@ -940,7 +938,7 @@ public class AutoconfParser {
* @param macro
* @return final token (')')
*/
protected Token parseMacroArguments(AutoconfMacroElement macro, Token lparen) {
protected Token parseMacroArguments(AutoconfMacroElement macro) {
Token argStart = null;
Token argEnd = null;
Token token;
@ -1009,7 +1007,7 @@ public class AutoconfParser {
}
if (token.getType() != ITokenConstants.RPAREN) {
handleError(macro, token, AutoconfEditorMessages.getString(UNMATCHED_LEFT_PARENTHESIS));
handleError(token, AutoconfEditorMessages.getString(UNMATCHED_LEFT_PARENTHESIS));
}
// note: moved 15-char truncation to AutoconfLabelProvider
@ -1022,13 +1020,13 @@ public class AutoconfParser {
protected void handleError(AutoconfElement element, Token token, String message) {
handleMessage(element, token, message, IMarker.SEVERITY_ERROR);
protected void handleError(Token token, String message) {
handleMessage(token, message, IMarker.SEVERITY_ERROR);
}
protected void handleWarning(AutoconfElement element, Token token, String message) {
handleMessage(element, token, message, IMarker.SEVERITY_WARNING);
protected void handleWarning(Token token, String message) {
handleMessage(token, message, IMarker.SEVERITY_WARNING);
}
protected void handleMessage(AutoconfElement element, Token token, String message, int severity) {
protected void handleMessage(Token token, String message, int severity) {
if (errorHandler != null) {
int lineNumber = 0;
int startColumn = 0;

View file

@ -32,6 +32,7 @@ public class ParseException extends Exception {
public void setLineNumber(int lineNumber) {
this.lineNumber = lineNumber;
}
@Override
public String getMessage() {
return message;
}

View file

@ -50,6 +50,7 @@ public class Token implements ITokenConstants {
this.length = length;
}
@Override
public String toString() {
return text;
}

View file

@ -15,6 +15,7 @@ import org.eclipse.cdt.managedbuilder.ui.properties.AbstractCBuildPropertyTab;
public abstract class AbstractAutotoolsCPropertyTab extends
AbstractCBuildPropertyTab {
@Override
public boolean isIndexerAffected() {
return false;
}

View file

@ -34,6 +34,7 @@ public class Console implements IConsole {
// }
//
@Override
public void start(IProject project ) {
this.project = project;
fConsoleManager.getConsole(project).start(project);
@ -43,14 +44,17 @@ public class Console implements IConsole {
* @throws CoreException
* @see org.eclipse.cdt.core.resources.IConsole#getOutputStream()
*/
@Override
public ConsoleOutputStream getOutputStream() throws CoreException {
return fConsoleManager.getConsole(project).getOutputStream();
}
@Override
public ConsoleOutputStream getInfoStream() throws CoreException {
return fConsoleManager.getConsole(project).getInfoStream();
}
@Override
public ConsoleOutputStream getErrorStream() throws CoreException {
return fConsoleManager.getConsole(project).getErrorStream();
}

View file

@ -34,11 +34,7 @@ public class ErrorParserBlock extends AbstractErrorParserBlock {
fPrefs = preferences;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
*/
@Override
public void createControl(Composite parent) {
if (useBuildInfo == true && fBuildInfo == null) {
@ -51,11 +47,7 @@ public class ErrorParserBlock extends AbstractErrorParserBlock {
super.createControl(parent);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.ui.dialogs.ErrorParserBlock#getErrorParserIDs(org.eclipse.core.resources.IProject)
*/
@Override
protected String[] getErrorParserIDs(IProject project) {
if (getContainer().getProject() != null && fBuildInfo == null) {
try {
@ -69,12 +61,7 @@ public class ErrorParserBlock extends AbstractErrorParserBlock {
return new String[0];
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.ui.dialogs.ErrorParserBlock#saveErrorParsers(org.eclipse.core.resources.IProject,
* java.lang.String[])
*/
@Override
public void saveErrorParsers(IProject project, String[] parserIDs) throws CoreException {
if (getContainer().getProject() != null) {
try {
@ -88,22 +75,19 @@ public class ErrorParserBlock extends AbstractErrorParserBlock {
}
/* (non-Javadoc)
* @see org.eclipse.cdt.ui.dialogs.AbstractErrorParserBlock#saveErrorParsers(java.lang.String[])
*/
@Override
protected void saveErrorParsers(String[] parserIDs) throws CoreException {
fBuildInfo = MakeCorePlugin.createBuildInfo(fPrefs, MakeBuilder.BUILDER_ID, false);
fBuildInfo.setErrorParsers(parserIDs);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.ui.dialogs.AbstractErrorParserBlock#getErrorParserIDs(boolean)
*/
@Override
protected String[] getErrorParserIDs(boolean defaults) {
fBuildInfo = MakeCorePlugin.createBuildInfo(fPrefs, MakeBuilder.BUILDER_ID, defaults);
return fBuildInfo.getErrorParsers();
}
@Override
public void setContainer(ICOptionContainer container) {
super.setContainer(container);
if (getContainer().getProject() != null) {

View file

@ -38,7 +38,7 @@ public class HTML2TextReader extends SubstitutionTextReader {
static {
fgTags= new HashSet<String>();
fgTags= new HashSet<>();
fgTags.add("b"); //$NON-NLS-1$
fgTags.add("br"); //$NON-NLS-1$
fgTags.add("h5"); //$NON-NLS-1$
@ -49,7 +49,7 @@ public class HTML2TextReader extends SubstitutionTextReader {
fgTags.add("li"); //$NON-NLS-1$
fgTags.add("ul"); //$NON-NLS-1$
fgEntityLookup= new HashMap<String, String>(7);
fgEntityLookup= new HashMap<>(7);
fgEntityLookup.put("lt", "<"); //$NON-NLS-1$ //$NON-NLS-2$
fgEntityLookup.put("gt", ">"); //$NON-NLS-1$ //$NON-NLS-2$
fgEntityLookup.put("nbsp", " "); //$NON-NLS-1$ //$NON-NLS-2$
@ -75,6 +75,7 @@ public class HTML2TextReader extends SubstitutionTextReader {
fTextPresentation= presentation;
}
@Override
public int read() throws IOException {
int c= super.read();
if (c != -1)
@ -98,9 +99,7 @@ public class HTML2TextReader extends SubstitutionTextReader {
}
}
/**
* @see SubstitutionTextReader#computeSubstitution(char)
*/
@Override
protected String computeSubstitution(int c) throws IOException {
if (c == '<')
return processHTMLTag();
@ -230,7 +229,7 @@ public class HTML2TextReader extends SubstitutionTextReader {
} catch (NumberFormatException e) {
}
} else {
String str= (String) fgEntityLookup.get(symbol);
String str= fgEntityLookup.get(symbol);
if (str != null) {
return str;
}

View file

@ -89,9 +89,7 @@ public class HTMLTextPresenter implements DefaultInformationControl.IInformation
return (i == length ? line : line.substring(0, i)) + " "; //$NON-NLS-1$
}
/*
* @see IHoverInformationPresenter#updatePresentation(Display display, String, TextPresentation, int, int)
*/
@Override
public String updatePresentation(Display display, String hoverInfo, TextPresentation presentation, int maxWidth, int maxHeight) {
if (hoverInfo == null)

View file

@ -124,6 +124,7 @@ public class ResourceLookup {
*/
public static void sortFilesByRelevance(IFile[] filesToSort, final IProject preferredProject) {
Collections.sort(Arrays.asList(filesToSort), new Comparator<IFile>() {
@Override
public int compare(IFile f1, IFile f2) {
int r1= FileRelevance.getRelevance(f1, preferredProject);
int r2= FileRelevance.getRelevance(f2, preferredProject);

View file

@ -124,7 +124,7 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
public ResourceLookupTree() {
fRootNode= new Node(null, CharArrayUtils.EMPTY, false, false) {};
fFileExtensions= new HashMap<String, Extensions>();
fFileExtensions= new HashMap<>();
fUnrefJob= new Job("Timer") { //$NON-NLS-1$
@Override
protected IStatus run(IProgressMonitor monitor) {
@ -152,6 +152,7 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
/**
* Handle resource change notifications.
*/
@Override
public void resourceChanged(IResourceChangeEvent event) {
IResourceDelta delta= event.getDelta();
synchronized (fLock) {
@ -182,7 +183,8 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
/**
* Handles resource change notifications by visiting the delta.
*/
public boolean visit(IResourceDelta delta) throws CoreException {
@Override
public boolean visit(IResourceDelta delta) {
assert Thread.holdsLock(fLock);
final IResource res= delta.getResource();
@ -274,7 +276,8 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
/**
* Add a resource tree by using a resource proxy visitor.
*/
public boolean visit(IResourceProxy proxy) throws CoreException {
@Override
public boolean visit(IResourceProxy proxy) {
if (proxy.getType() == IResource.FILE) {
if (fCurrentExtensions.isRelevant(proxy.getName())) {
if (proxy.isLinked()) {
@ -300,7 +303,7 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
public void simulateNodeMapCollection() {
synchronized (fLock) {
fNodeMap= null;
fNodeMapRef= new SoftReference<Map<Integer, Object>>(null);
fNodeMapRef= new SoftReference<>(null);
}
}
@ -317,8 +320,8 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
if (fNodeMap == null) {
fFileExtensions.clear();
fNodeMap= new HashMap<Integer, Object>();
fNodeMapRef= new SoftReference<Map<Integer, Object>>(fNodeMap);
fNodeMap= new HashMap<>();
fNodeMapRef= new SoftReference<>(fNodeMap);
}
}
fUnrefJob.cancel();
@ -349,13 +352,13 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
private void initFileExtensions() {
if (fDefaultExtensions == null) {
HashSet<String> cdtContentTypes= new HashSet<String>();
HashSet<String> cdtContentTypes= new HashSet<>();
String[] registeredContentTypes= CoreModel.getRegistedContentTypeIds();
cdtContentTypes.addAll(Arrays.asList(registeredContentTypes));
final IContentTypeManager ctm= Platform.getContentTypeManager();
final IContentType[] ctts= ctm.getAllContentTypes();
Set<String> result= new HashSet<String>();
Set<String> result= new HashSet<>();
outer: for (IContentType ctt : ctts) {
IContentType basedOn= ctt;
while (basedOn != null) {
@ -368,7 +371,7 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
}
fCDTProjectExtensions= new Extensions(result, true);
result= new HashSet<String>();
result= new HashSet<>();
for (IContentType ctt : ctts) {
IContentType basedOn= ctt;
while (basedOn != null) {
@ -700,7 +703,7 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
while(suffix.startsWith("../")) { //$NON-NLS-1$
suffix= suffix.substring(3);
}
Set<String> prjset= new HashSet<String>();
Set<String> prjset= new HashSet<>();
for (IProject prj : projects) {
prjset.add(prj.getName());
}
@ -829,7 +832,7 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
@SuppressWarnings("nls")
public void dump() {
List<String> lines= new ArrayList<String>();
List<String> lines= new ArrayList<>();
synchronized (fLock) {
for (Iterator<Object> iterator = fNodeMap.values().iterator(); iterator.hasNext();) {
Node[] nodes= convert(iterator.next());

View file

@ -20,12 +20,14 @@ public abstract class SingleCharReader extends Reader {
/**
* @see Reader#read(char)
*/
@Override
public abstract int read() throws IOException;
/**
* @see Reader#read(char[],int,int)
*/
@Override
public int read(char cbuf[], int off, int len) throws IOException {
int end= off + len;
for (int i= off; i < end; i++) {
@ -44,7 +46,8 @@ public abstract class SingleCharReader extends Reader {
/**
* @see Reader#ready()
*/
public boolean ready() throws IOException {
@Override
public boolean ready() throws IOException {
return true;
}

View file

@ -88,9 +88,7 @@ public abstract class SubstitutionTextReader extends SingleCharReader {
return ch;
}
/**
* @see Reader#read()
*/
@Override
public int read() throws IOException {
int c;
do {
@ -111,23 +109,17 @@ public abstract class SubstitutionTextReader extends SingleCharReader {
return c;
}
/**
* @see Reader#ready()
*/
public boolean ready() throws IOException {
@Override
public boolean ready() throws IOException {
return fReader.ready();
}
/**
* @see Reader#close()
*/
@Override
public void close() throws IOException {
fReader.close();
}
/**
* @see Reader#reset()
*/
@Override
public void reset() throws IOException {
fReader.reset();
fWasWhiteSpace= true;

View file

@ -17,7 +17,6 @@ import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.viewers.ISelection;
@ -26,7 +25,7 @@ import org.eclipse.ui.handlers.HandlerUtil;
public abstract class AbstractAutotoolsHandler extends AbstractHandler {
protected Object execute(ExecutionEvent event, InvokeAction a) throws ExecutionException {
protected Object execute(ExecutionEvent event, InvokeAction a) {
ISelection k = HandlerUtil.getCurrentSelection(event);
if (!k.isEmpty() && k instanceof IStructuredSelection) {
Object obj = ((IStructuredSelection)k).getFirstElement();

View file

@ -51,14 +51,17 @@ public abstract class AbstractTargetAction
fContainer = container;
}
@Override
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
fPart = targetPart;
}
@Override
public void init(IWorkbenchWindow window) {
fWindow = window;
}
@Override
public void selectionChanged(IAction action, ISelection selection) {
boolean enabled = false;
if (selection instanceof IStructuredSelection) {

View file

@ -11,7 +11,6 @@
package org.eclipse.cdt.internal.autotools.ui.actions;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
/**
* @author Jeff Johnston
@ -19,7 +18,8 @@ import org.eclipse.core.commands.ExecutionException;
*/
public class AclocalHandler extends AbstractAutotoolsHandler {
public Object execute(ExecutionEvent event) throws ExecutionException {
@Override
public Object execute(ExecutionEvent event) {
return execute(event, new InvokeAclocalAction());
}

View file

@ -11,11 +11,11 @@
package org.eclipse.cdt.internal.autotools.ui.actions;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
public class AutoconfHandler extends AbstractAutotoolsHandler {
public Object execute(ExecutionEvent event) throws ExecutionException {
@Override
public Object execute(ExecutionEvent event) {
return execute(event, new InvokeAutoconfAction());
}

View file

@ -11,7 +11,6 @@
package org.eclipse.cdt.internal.autotools.ui.actions;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
/**
* @author Jeff Johnston
@ -19,7 +18,8 @@ import org.eclipse.core.commands.ExecutionException;
*/
public class AutoheaderHandler extends AbstractAutotoolsHandler {
public Object execute(ExecutionEvent event) throws ExecutionException {
@Override
public Object execute(ExecutionEvent event) {
return execute(event, new InvokeAutoheaderAction());
}

View file

@ -11,11 +11,11 @@
package org.eclipse.cdt.internal.autotools.ui.actions;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
public class AutomakeHandler extends AbstractAutotoolsHandler {
public Object execute(ExecutionEvent event) throws ExecutionException {
@Override
public Object execute(ExecutionEvent event) {
return execute(event, new InvokeAutomakeAction());
}

View file

@ -11,7 +11,6 @@
package org.eclipse.cdt.internal.autotools.ui.actions;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
/**
* @author Jeff Johnston
@ -19,7 +18,8 @@ import org.eclipse.core.commands.ExecutionException;
*/
public class AutoreconfHandler extends AbstractAutotoolsHandler {
public Object execute(ExecutionEvent event) throws ExecutionException {
@Override
public Object execute(ExecutionEvent event) {
return execute(event, new InvokeAutoreconfAction());
}

View file

@ -24,6 +24,7 @@ public class InvokeAclocalAction extends InvokeAction {
private static final String DEFAULT_OPTION = ""; //$NON-NLS-1$
private static final String DEFAULT_COMMAND = "aclocal"; //$NON-NLS-1$
@Override
public void run(IAction action) {
IContainer container = getSelectedContainer();
@ -97,6 +98,7 @@ public class InvokeAclocalAction extends InvokeAction {
}
}
@Override
public void dispose() {
}

View file

@ -90,7 +90,7 @@ public abstract class InvokeAction extends AbstractTargetAction {
protected String[] separateTargets(String rawArgList) {
StringTokenizer st = new StringTokenizer(rawArgList, " "); //$NON-NLS-1$
ArrayList<String> targetList = new ArrayList<String>();
ArrayList<String> targetList = new ArrayList<>();
while (st.hasMoreTokens()) {
String currentWord = st.nextToken().trim();
@ -136,7 +136,7 @@ public abstract class InvokeAction extends AbstractTargetAction {
}
protected String[] separateOptions(String rawArgList) {
ArrayList<String> argList = new ArrayList<String>();
ArrayList<String> argList = new ArrayList<>();
// May be multiple user-specified options in which case we
// need to split them up into individual options
rawArgList = rawArgList.trim();
@ -162,7 +162,7 @@ public abstract class InvokeAction extends AbstractTargetAction {
}
protected String[] simpleParseOptions(String rawArgList) {
ArrayList<String> argList = new ArrayList<String>();
ArrayList<String> argList = new ArrayList<>();
int lastArgIndex = -1;
int i = 0;
while (i < rawArgList.length()) {
@ -208,7 +208,7 @@ public abstract class InvokeAction extends AbstractTargetAction {
protected IPath getExecDir(IContainer container) {
int type = container.getType();
IPath execDir = null;
if (type == IContainer.FILE) {
if (type == IResource.FILE) {
execDir = container.getLocation().removeLastSegments(1);
} else {
execDir = container.getLocation();
@ -219,7 +219,7 @@ public abstract class InvokeAction extends AbstractTargetAction {
protected IPath getCWD(IContainer container) {
int type = container.getType();
IPath cwd = null;
if (type == IContainer.FILE) {
if (type == IResource.FILE) {
cwd = container.getFullPath().removeLastSegments(1);
} else {
cwd = container.getFullPath();
@ -244,21 +244,18 @@ public abstract class InvokeAction extends AbstractTargetAction {
}
@Override
public void run(IProgressMonitor monitor)
throws InvocationTargetException, InterruptedException {
ByteArrayOutputStream stdout = new ByteArrayOutputStream();
ByteArrayOutputStream stderr = new ByteArrayOutputStream();
public void run(IProgressMonitor monitor) throws InvocationTargetException {
RemoteCommandLauncher cmdL = new RemoteCommandLauncher();
outputs = null;
outputs = new HashMap<>();
// invoke command
try {
monitor.beginTask(
InvokeMessages.getFormattedString("InvokeAction.progress.message", // $NON-NLS-1$
new String[]{command.toOSString()}), IProgressMonitor.UNKNOWN);
try (ByteArrayOutputStream stdout = new ByteArrayOutputStream();
ByteArrayOutputStream stderr = new ByteArrayOutputStream()) {
monitor.beginTask(InvokeMessages.getFormattedString("InvokeAction.progress.message", // $NON-NLS-1$
new String[] { command.toOSString() }), IProgressMonitor.UNKNOWN);
monitor.worked(1);
Process process = cmdL.execute(command, argumentList, envList,
execDir, new NullProgressMonitor());
Process process = cmdL.execute(command, argumentList, envList, execDir, new NullProgressMonitor());
if (cmdL.waitAndRead(stdout, stderr, new NullProgressMonitor()) == ICommandLauncher.OK) {
try {
@ -274,24 +271,15 @@ public abstract class InvokeAction extends AbstractTargetAction {
monitor.done();
return;
}
} catch (CoreException e) {
outputs.put("stdout", stdout.toString()); //$NON-NLS-1$
outputs.put("stderr", stderr.toString()); //$NON-NLS-1$
} catch (CoreException | IOException e) {
monitor.done();
throw new InvocationTargetException(e);
}
outputs = new HashMap<String, String>();
outputs.put("stdout", stdout.toString()); //$NON-NLS-1$
outputs.put("stderr", stderr.toString()); //$NON-NLS-1$
try {
stdout.close();
stderr.close();
} catch (IOException e) {
// ignore
}
}
public HashMap<String, String> getOutputs() {
return outputs;
}
@ -333,9 +321,6 @@ public abstract class InvokeAction extends AbstractTargetAction {
final ISchedulingRule rule = ResourcesPlugin.getWorkspace().getRoot();
Job backgroundJob = new Job(actionName) {
/* (non-Javadoc)
* @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
@ -371,7 +356,7 @@ public abstract class InvokeAction extends AbstractTargetAction {
consoleOutStream.write(buf.toString().getBytes());
consoleOutStream.flush();
ArrayList<String> additionalEnvs = new ArrayList<String>();
ArrayList<String> additionalEnvs = new ArrayList<>();
String strippedCommand = AutotoolsNewMakeGenerator.stripEnvVars(command, additionalEnvs);
// Get a launcher for the config command
RemoteCommandLauncher launcher = new RemoteCommandLauncher();
@ -380,7 +365,7 @@ public abstract class InvokeAction extends AbstractTargetAction {
IEnvironmentVariable variables[] = ManagedBuildManager
.getEnvironmentVariableProvider().getVariables(cfg, true);
String[] env = null;
ArrayList<String> envList = new ArrayList<String>();
ArrayList<String> envList = new ArrayList<>();
if (variables != null) {
for (int i = 0; i < variables.length; i++) {
envList.add(variables[i].getName()
@ -454,8 +439,7 @@ public abstract class InvokeAction extends AbstractTargetAction {
} catch (CoreException e) {
return e.getStatus();
}
IStatus returnStatus = Status.OK_STATUS;
return returnStatus;
return Status.OK_STATUS;
}
};

View file

@ -27,6 +27,7 @@ import org.eclipse.jface.action.IAction;
public class InvokeAutoconfAction extends InvokeAction {
private final static String DEFAULT_COMMAND = "autoconf"; //$NON-NLS-1$
@Override
public void run(IAction action) {
IContainer container = getSelectedContainer();
if (container == null)
@ -52,6 +53,7 @@ public class InvokeAutoconfAction extends InvokeAction {
}
@Override
public void dispose() {
}
}

View file

@ -25,6 +25,7 @@ public class InvokeAutoheaderAction extends InvokeAction {
private static final String DEFAULT_OPTION = ""; //$NON-NLS-1$
private static final String DEFAULT_COMMAND = "autoheader"; //$NON-NLS-1$
@Override
public void run(IAction action) {
IContainer container = getSelectedContainer();
@ -72,6 +73,7 @@ public class InvokeAutoheaderAction extends InvokeAction {
}
@Override
public void dispose() {
}

View file

@ -30,6 +30,7 @@ public class InvokeAutomakeAction extends InvokeAction {
private static final String DEFAULT_OPTION = ""; //$NON-NLS-1$
private static final String DEFAULT_COMMAND = "automake"; //$NON-NLS-1$
@Override
public void run(IAction action) {
IContainer container = getSelectedContainer();
@ -91,6 +92,7 @@ InvokeMessages
}
}
@Override
public void dispose() {
}

View file

@ -25,6 +25,7 @@ public class InvokeAutoreconfAction extends InvokeAction {
private static final String DEFAULT_OPTION = ""; //$NON-NLS-1$
private static final String DEFAULT_COMMAND = "autoreconf"; //$NON-NLS-1$
@Override
public void run(IAction action) {
IContainer container = getSelectedContainer();
@ -71,6 +72,7 @@ public class InvokeAutoreconfAction extends InvokeAction {
}
}
@Override
public void dispose() {
}

View file

@ -25,6 +25,7 @@ public class InvokeLibtoolizeAction extends InvokeAction {
private static final String DEFAULT_OPTION = ""; //$NON-NLS-1$
private static final String DEFAULT_COMMAND = "libtoolize"; //$NON-NLS-1$
@Override
public void run(IAction action) {
IContainer container = getSelectedContainer();
@ -71,6 +72,7 @@ public class InvokeLibtoolizeAction extends InvokeAction {
}
}
@Override
public void dispose() {
}

View file

@ -11,7 +11,6 @@
package org.eclipse.cdt.internal.autotools.ui.actions;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
/**
* @author Jeff Johnston
@ -19,7 +18,8 @@ import org.eclipse.core.commands.ExecutionException;
*/
public class LibtoolizeHandler extends AbstractAutotoolsHandler {
public Object execute(ExecutionEvent event) throws ExecutionException {
@Override
public Object execute(ExecutionEvent event) {
return execute(event, new InvokeLibtoolizeAction());
}

View file

@ -30,6 +30,7 @@ import org.eclipse.jface.action.IAction;
public class ReconfigureAction extends InvokeAction {
@Override
public void run(IAction action) {
IContainer container = getSelectedContainer();
if (container == null)
@ -40,14 +41,13 @@ public class ReconfigureAction extends InvokeAction {
final ISchedulingRule rule = ResourcesPlugin.getWorkspace().getRoot();
Job backgroundJob = new Job("Reconfigure Action"){ //$NON-NLS-1$
/* (non-Javadoc)
* @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
public void run(IProgressMonitor monitor) throws CoreException {
@Override
public void run(IProgressMonitor monitor) {
IProject project = getSelectedContainer().getProject();
AutotoolsNewMakeGenerator m = new AutotoolsNewMakeGenerator();
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
@ -72,6 +72,7 @@ public class ReconfigureAction extends InvokeAction {
backgroundJob.schedule();
}
@Override
public void dispose() {
}

View file

@ -11,7 +11,6 @@
package org.eclipse.cdt.internal.autotools.ui.actions;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
/**
* @author Jeff Johnston
@ -19,7 +18,8 @@ import org.eclipse.core.commands.ExecutionException;
*/
public class ReconfigureHandler extends AbstractAutotoolsHandler {
public Object execute(ExecutionEvent event) throws ExecutionException {
@Override
public Object execute(ExecutionEvent event) {
return execute(event, new ReconfigureAction());
}

View file

@ -32,13 +32,12 @@ public class SingleInputDialog extends InputDialog {
this.firstMessage = firstMessage;
}
/*
* (non-Javadoc) Method declared on Dialog.
*/
@Override
protected void buttonPressed(int buttonId) {
super.buttonPressed(buttonId);
}
@Override
protected Control createDialogArea(Composite parent) {
// create composite

View file

@ -43,9 +43,7 @@ public class TwoInputDialog extends InputDialog {
this.secondMessage = secondMessage;
}
/*
* (non-Javadoc) Method declared on Dialog.
*/
@Override
protected void buttonPressed(int buttonId) {
if (buttonId == IDialogConstants.OK_ID) {
secondValue = secondText.getText();
@ -55,6 +53,7 @@ public class TwoInputDialog extends InputDialog {
super.buttonPressed(buttonId);
}
@Override
protected Control createDialogArea(Composite parent) {
// create composite
@ -78,6 +77,7 @@ public class TwoInputDialog extends InputDialog {
secondText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
| GridData.HORIZONTAL_ALIGN_FILL));
secondText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
validateInput();
}

View file

@ -100,9 +100,7 @@ public class ProjectionFileUpdater implements IProjectionListener {
private class ReconcilerParticipant implements IReconcilingParticipant {
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.autotools.ui.editors.automake.IReconcilingParticipant#reconciled()
*/
@Override
public void reconciled() {
processReconcile();
}
@ -119,9 +117,7 @@ public class ProjectionFileUpdater implements IProjectionListener {
private boolean fCollapseConditional = false;
private boolean fCollapseLoop = false;
/*
* @see org.eclipse.jface.text.source.projection.IProjectionListener#projectionEnabled()
*/
@Override
public void projectionEnabled() {
// http://home.ott.oti.com/teams/wswb/anon/out/vms/index.html
// projectionEnabled messages are not always paired with projectionDisabled
@ -135,9 +131,7 @@ public class ProjectionFileUpdater implements IProjectionListener {
fEditor.addReconcilingParticipant(fParticipant);
}
/*
* @see org.eclipse.jface.text.source.projection.IProjectionListener#projectionDisabled()
*/
@Override
public void projectionDisabled() {
fCachedDocument= null;
if (fParticipant != null) {
@ -187,7 +181,7 @@ public class ProjectionFileUpdater implements IProjectionListener {
}
private Map<AutoconfProjectionAnnotation, Position> computeAdditions(AutoconfElement root) {
Map<AutoconfProjectionAnnotation, Position> map= new HashMap<AutoconfProjectionAnnotation, Position>();
Map<AutoconfProjectionAnnotation, Position> map= new HashMap<>();
if (root instanceof AutoconfRootElement)
computeAdditions(root.getChildren(), map);
return map;
@ -277,9 +271,9 @@ public class ProjectionFileUpdater implements IProjectionListener {
fCachedDocument= provider.getDocument(fEditor.getEditorInput());
fAllowCollapsing= false;
Map<AutoconfProjectionAnnotation, Position> additions= new HashMap<AutoconfProjectionAnnotation, Position>();
List<AutoconfProjectionAnnotation> deletions= new ArrayList<AutoconfProjectionAnnotation>();
List<AutoconfProjectionAnnotation> updates = new ArrayList<AutoconfProjectionAnnotation>();
Map<AutoconfProjectionAnnotation, Position> additions= new HashMap<>();
List<AutoconfProjectionAnnotation> deletions= new ArrayList<>();
List<AutoconfProjectionAnnotation> updates = new ArrayList<>();
Map<AutoconfProjectionAnnotation, Position> updated= computeAdditions(fEditor.getRootElement());
@ -288,9 +282,9 @@ public class ProjectionFileUpdater implements IProjectionListener {
Iterator<AutoconfProjectionAnnotation> e= updated.keySet().iterator();
while (e.hasNext()) {
AutoconfProjectionAnnotation annotation= (AutoconfProjectionAnnotation) e.next();
AutoconfProjectionAnnotation annotation= e.next();
AutoconfElement element= annotation.getElement();
Position position= (Position) updated.get(annotation);
Position position= updated.get(annotation);
List<AutoconfProjectionAnnotation> annotations= previous.get(element);
if (annotations == null) {
@ -298,7 +292,7 @@ public class ProjectionFileUpdater implements IProjectionListener {
} else {
Iterator<AutoconfProjectionAnnotation> x= annotations.iterator();
while (x.hasNext()) {
AutoconfProjectionAnnotation a= (AutoconfProjectionAnnotation) x.next();
AutoconfProjectionAnnotation a= x.next();
if (annotation.isComment() == a.isComment()) {
Position p= model.getPosition(a);
if (p != null && !position.equals(p)) {
@ -342,19 +336,19 @@ public class ProjectionFileUpdater implements IProjectionListener {
if (deletions.isEmpty() || (additions.isEmpty() && changes.isEmpty()))
return;
List<AutoconfProjectionAnnotation> newDeletions= new ArrayList<AutoconfProjectionAnnotation>();
List<AutoconfProjectionAnnotation> newChanges= new ArrayList<AutoconfProjectionAnnotation>();
List<AutoconfProjectionAnnotation> newDeletions= new ArrayList<>();
List<AutoconfProjectionAnnotation> newChanges= new ArrayList<>();
Iterator<AutoconfProjectionAnnotation> deletionIterator= deletions.iterator();
outer: while (deletionIterator.hasNext()) {
AutoconfProjectionAnnotation deleted= (AutoconfProjectionAnnotation) deletionIterator.next();
AutoconfProjectionAnnotation deleted= deletionIterator.next();
Position deletedPosition= model.getPosition(deleted);
if (deletedPosition == null)
continue;
Iterator<AutoconfProjectionAnnotation> changesIterator= changes.iterator();
while (changesIterator.hasNext()) {
AutoconfProjectionAnnotation changed= (AutoconfProjectionAnnotation) changesIterator.next();
AutoconfProjectionAnnotation changed= changesIterator.next();
if (deleted.isComment() == changed.isComment()) {
Position changedPosition= model.getPosition(changed);
if (changedPosition == null)
@ -378,9 +372,9 @@ public class ProjectionFileUpdater implements IProjectionListener {
Iterator<AutoconfProjectionAnnotation> additionsIterator= additions.keySet().iterator();
while (additionsIterator.hasNext()) {
AutoconfProjectionAnnotation added= (AutoconfProjectionAnnotation) additionsIterator.next();
AutoconfProjectionAnnotation added= additionsIterator.next();
if (deleted.isComment() == added.isComment()) {
Position addedPosition= (Position) additions.get(added);
Position addedPosition= additions.get(added);
if (deletedPosition.getOffset() == addedPosition.getOffset()) {
@ -403,7 +397,7 @@ public class ProjectionFileUpdater implements IProjectionListener {
}
private Map<AutoconfElement, List<AutoconfProjectionAnnotation>> createAnnotationMap(IAnnotationModel model) {
Map<AutoconfElement, List<AutoconfProjectionAnnotation>> map= new HashMap<AutoconfElement, List<AutoconfProjectionAnnotation>>();
Map<AutoconfElement, List<AutoconfProjectionAnnotation>> map= new HashMap<>();
@SuppressWarnings("rawtypes")
Iterator e= model.getAnnotationIterator();
while (e.hasNext()) {
@ -412,7 +406,7 @@ public class ProjectionFileUpdater implements IProjectionListener {
AutoconfProjectionAnnotation directive= (AutoconfProjectionAnnotation) annotation;
List<AutoconfProjectionAnnotation> list= map.get(directive.getElement());
if (list == null) {
list= new ArrayList<AutoconfProjectionAnnotation>(2);
list= new ArrayList<>(2);
map.put(directive.getElement(), list);
}
list.add(directive);

View file

@ -14,6 +14,7 @@ package org.eclipse.cdt.internal.autotools.ui.editors.automake;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.events.SelectionEvent;
@ -26,8 +27,6 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.jface.viewers.ILabelProvider;
/**
* A class to select one or more elements out of an indexed property
*/
@ -53,10 +52,7 @@ public abstract class AbstractElementListSelectionDialog extends SelectionStatus
protected void access$superOpen() {
super.open();
}
/*
* @private
* @see Dialog#cancelPressed
*/
@Override
protected void cancelPressed() {
setResult(null);
super.cancelPressed();
@ -64,10 +60,7 @@ public abstract class AbstractElementListSelectionDialog extends SelectionStatus
protected Point computeInitialSize() {
return new Point(convertWidthInCharsToPixels(60), convertHeightInCharsToPixels(18));
}
/*
* @private
* @see Window#createDialogArea(Composite)
*/
@Override
protected Control createDialogArea(Composite parent) {
Composite contents= (Composite)super.createDialogArea(parent);
@ -78,9 +71,11 @@ public abstract class AbstractElementListSelectionDialog extends SelectionStatus
fRenderer, fIgnoreCase);
fSelectionList.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
handleDoubleClick();
}
@Override
public void widgetSelected(SelectionEvent e) {
verifyCurrentSelection();
}
@ -116,6 +111,7 @@ public abstract class AbstractElementListSelectionDialog extends SelectionStatus
* @private
* @see Window#create(Shell)
*/
@Override
public void create() {
super.create();
if (isEmptyList()) {
@ -145,7 +141,7 @@ public abstract class AbstractElementListSelectionDialog extends SelectionStatus
*/
protected List<Object> getWidgetSelection() {
if (fSelectionList == null || fSelectionList.isDisposed())
return new ArrayList<Object>(0);
return new ArrayList<>(0);
return fSelectionList.getSelection();
}
/**
@ -195,8 +191,10 @@ public abstract class AbstractElementListSelectionDialog extends SelectionStatus
/*
* @private
*/
@Override
public int open() {
BusyIndicator.showWhile(null, new Runnable() {
@Override
public void run() {
access$superOpen();
}
@ -227,6 +225,7 @@ public abstract class AbstractElementListSelectionDialog extends SelectionStatus
* Sets the message to be shown above the match text field.
* Must be set before widget creation
*/
@Override
public void setMessage(String message) {
fMessageText= message;
}

View file

@ -39,144 +39,157 @@ public abstract class AbstractMakefile extends Parent implements IMakefile {
super(parent);
}
@Override
public abstract IDirective[] getBuiltins();
@Override
public IRule[] getRules() {
IDirective[] stmts = getDirectives(true);
List<IRule> array = new ArrayList<IRule>(stmts.length);
List<IRule> array = new ArrayList<>(stmts.length);
for (int i = 0; i < stmts.length; i++) {
if (stmts[i] instanceof IRule) {
array.add((IRule)stmts[i]);
}
}
return (IRule[]) array.toArray(new IRule[0]);
return array.toArray(new IRule[0]);
}
@Override
public IRule[] getRules(String target) {
IRule[] rules = getRules();
List<IRule> array = new ArrayList<IRule>(rules.length);
List<IRule> array = new ArrayList<>(rules.length);
for (int i = 0; i < rules.length; i++) {
if (rules[i].getTarget().toString().equals(target)) {
array.add(rules[i]);
}
}
return (IRule[]) array.toArray(new IRule[0]);
return array.toArray(new IRule[0]);
}
@Override
public IInferenceRule[] getInferenceRules() {
IRule[] rules = getRules();
List<IInferenceRule> array = new ArrayList<IInferenceRule>(rules.length);
List<IInferenceRule> array = new ArrayList<>(rules.length);
for (int i = 0; i < rules.length; i++) {
if (rules[i] instanceof IInferenceRule) {
array.add((IInferenceRule)rules[i]);
}
}
return (IInferenceRule[]) array.toArray(new IInferenceRule[0]);
return array.toArray(new IInferenceRule[0]);
}
@Override
public IInferenceRule[] getInferenceRules(String target) {
IInferenceRule[] irules = getInferenceRules();
List<IInferenceRule> array = new ArrayList<IInferenceRule>(irules.length);
List<IInferenceRule> array = new ArrayList<>(irules.length);
for (int i = 0; i < irules.length; i++) {
if (irules[i].getTarget().toString().equals(target)) {
array.add(irules[i]);
}
}
return (IInferenceRule[]) array.toArray(new IInferenceRule[0]);
return array.toArray(new IInferenceRule[0]);
}
@Override
public ITargetRule[] getTargetRules() {
IRule[] trules = getRules();
List<ITargetRule> array = new ArrayList<ITargetRule>(trules.length);
List<ITargetRule> array = new ArrayList<>(trules.length);
for (int i = 0; i < trules.length; i++) {
if (trules[i] instanceof ITargetRule) {
array.add((ITargetRule)trules[i]);
}
}
return (ITargetRule[]) array.toArray(new ITargetRule[0]);
return array.toArray(new ITargetRule[0]);
}
@Override
public ITargetRule[] getTargetRules(String target) {
ITargetRule[] trules = getTargetRules();
List<ITargetRule> array = new ArrayList<ITargetRule>(trules.length);
List<ITargetRule> array = new ArrayList<>(trules.length);
for (int i = 0; i < trules.length; i++) {
if (trules[i].getTarget().toString().equals(target)) {
array.add(trules[i]);
}
}
return (ITargetRule[]) array.toArray(new ITargetRule[0]);
return array.toArray(new ITargetRule[0]);
}
@Override
public IMacroDefinition[] getMacroDefinitions() {
IDirective[] stmts = getDirectives(true);
List<IMacroDefinition> array = new ArrayList<IMacroDefinition>(stmts.length);
List<IMacroDefinition> array = new ArrayList<>(stmts.length);
for (int i = 0; i < stmts.length; i++) {
if (stmts[i] instanceof IMacroDefinition) {
array.add((IMacroDefinition)stmts[i]);
}
}
return (IMacroDefinition[]) array.toArray(new IMacroDefinition[0]);
return array.toArray(new IMacroDefinition[0]);
}
@Override
public IMacroDefinition[] getMacroDefinitions(String name) {
IMacroDefinition[] variables = getMacroDefinitions();
List<IMacroDefinition> array = new ArrayList<IMacroDefinition>(variables.length);
List<IMacroDefinition> array = new ArrayList<>(variables.length);
for (int i = 0; i < variables.length; i++) {
if (variables[i].getName().equals(name)) {
array.add(variables[i]);
}
}
return (IMacroDefinition[]) array.toArray(new IMacroDefinition[0]);
return array.toArray(new IMacroDefinition[0]);
}
@Override
public IMacroDefinition[] getBuiltinMacroDefinitions() {
IDirective[] stmts = getBuiltins();
List<IMacroDefinition> array = new ArrayList<IMacroDefinition>(stmts.length);
List<IMacroDefinition> array = new ArrayList<>(stmts.length);
for (int i = 0; i < stmts.length; i++) {
if (stmts[i] instanceof IMacroDefinition) {
array.add((IMacroDefinition)stmts[i]);
}
}
return (IMacroDefinition[]) array.toArray(new IMacroDefinition[0]);
return array.toArray(new IMacroDefinition[0]);
}
@Override
public IMacroDefinition[] getBuiltinMacroDefinitions(String name) {
IMacroDefinition[] variables = getBuiltinMacroDefinitions();
List<IMacroDefinition> array = new ArrayList<IMacroDefinition>(variables.length);
List<IMacroDefinition> array = new ArrayList<>(variables.length);
for (int i = 0; i < variables.length; i++) {
if (variables[i].getName().equals(name)) {
array.add(variables[i]);
}
}
return (IMacroDefinition[]) array.toArray(new IMacroDefinition[0]);
return array.toArray(new IMacroDefinition[0]);
}
public IInferenceRule[] getBuiltinInferenceRules() {
IDirective[] stmts = getBuiltins();
List<IInferenceRule> array = new ArrayList<IInferenceRule>(stmts.length);
List<IInferenceRule> array = new ArrayList<>(stmts.length);
for (int i = 0; i < stmts.length; i++) {
if (stmts[i] instanceof IInferenceRule) {
array.add((IInferenceRule)stmts[i]);
}
}
return (IInferenceRule[]) array.toArray(new IInferenceRule[0]);
return array.toArray(new IInferenceRule[0]);
}
public IInferenceRule[] getBuiltinInferenceRules(String target) {
IInferenceRule[] irules = getBuiltinInferenceRules();
List<IInferenceRule> array = new ArrayList<IInferenceRule>(irules.length);
List<IInferenceRule> array = new ArrayList<>(irules.length);
for (int i = 0; i < irules.length; i++) {
if (irules[i].getTarget().toString().equals(target)) {
array.add(irules[i]);
}
}
return (IInferenceRule[]) array.toArray(new IInferenceRule[0]);
return array.toArray(new IInferenceRule[0]);
}
@Override
public String expandString(String line) {
return expandString(line, false);
}
@Override
public String expandString(String line, boolean recursive) {
int len = line.length();
boolean foundDollar = false;
@ -258,6 +271,7 @@ public abstract class AbstractMakefile extends Parent implements IMakefile {
return buffer.toString();
}
@Override
public URI getFileURI() {
return filename;
}
@ -267,17 +281,17 @@ public abstract class AbstractMakefile extends Parent implements IMakefile {
}
@Override
public IMakefile getMakefile() {
return this;
}
@Override
public IMakefileReaderProvider getMakefileReaderProvider() {
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.make.core.makefile.IMakefile#parse(java.net.URI, org.eclipse.cdt.make.core.makefile.IMakefileReaderProvider)
*/
@Override
public void parse(URI fileURI,
IMakefileReaderProvider makefileReaderProvider) throws IOException {
// not used

View file

@ -35,7 +35,7 @@ import org.eclipse.swt.graphics.RGB;
*/
public abstract class AbstractMakefileCodeScanner extends RuleBasedScanner {
private Map<String, Token> fTokenMap= new HashMap<String, Token>();
private Map<String, Token> fTokenMap= new HashMap<>();
private String[] fPropertyNamesColor;
/**
* Preference keys for boolean preferences which are <code>true</code>,
@ -89,7 +89,7 @@ public abstract class AbstractMakefileCodeScanner extends RuleBasedScanner {
}
protected Token getToken(String key) {
return (Token) fTokenMap.get(key);
return fTokenMap.get(key);
}
private void addToken(String colorKey, String boldKey, String italicKey) {

View file

@ -15,6 +15,7 @@ public class AutoconfSubstRule implements IPredicateRule {
private char[][] fSortedLineDelimiters;
private static class DecreasingCharArrayLengthComparator implements Comparator<Object> {
@Override
public int compare(Object o1, Object o2) {
return ((char[]) o2).length - ((char[]) o1).length;
}
@ -26,6 +27,7 @@ public class AutoconfSubstRule implements IPredicateRule {
this.token = token;
}
@Override
public IToken evaluate(ICharacterScanner scanner, boolean resume) {
char[][] originalDelimiters= scanner.getLegalLineDelimiters();
int count= originalDelimiters.length;
@ -81,10 +83,12 @@ public class AutoconfSubstRule implements IPredicateRule {
return Token.UNDEFINED;
}
@Override
public IToken getSuccessToken() {
return token;
}
@Override
public IToken evaluate(ICharacterScanner scanner) {
return evaluate(scanner, false);
}

View file

@ -41,23 +41,17 @@ public class AutomakeCompletionProcessor implements IContentAssistProcessor {
protected int fInstallOffset;
/*
* @see IContextInformationValidator#isContextInformationValid(int)
*/
@Override
public boolean isContextInformationValid(int offset) {
return Math.abs(fInstallOffset - offset) < 5;
}
/*
* @see IContextInformationValidator#install(IContextInformation, ITextViewer, int)
*/
@Override
public void install(IContextInformation info, ITextViewer viewer, int offset) {
fInstallOffset = offset;
}
/*
* @see org.eclipse.jface.text.contentassist.IContextInformationPresenter#updatePresentation(int, TextPresentation)
*/
@Override
public boolean updatePresentation(int documentPosition, TextPresentation presentation) {
return false;
}
@ -65,9 +59,7 @@ public class AutomakeCompletionProcessor implements IContentAssistProcessor {
public static class DirectiveComparator implements Comparator<Object> {
/* (non-Javadoc)
* @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
*/
@Override
public int compare(Object o1, Object o2) {
String name1;
String name2;
@ -106,9 +98,7 @@ public class AutomakeCompletionProcessor implements IContentAssistProcessor {
fManager = AutomakeEditorFactory.getDefault().getWorkingCopyManager();
}
/* (non-Javadoc)
* @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#computeCompletionProposals(org.eclipse.jface.text.ITextViewer, int)
*/
@Override
public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int documentOffset) {
WordPartDetector wordPart = new WordPartDetector(viewer, documentOffset);
boolean macro = WordPartDetector.inMacro(viewer, documentOffset);
@ -124,7 +114,7 @@ public class AutomakeCompletionProcessor implements IContentAssistProcessor {
statements = makefile.getTargetRules();
}
ArrayList<ICompletionProposal> proposalList = new ArrayList<ICompletionProposal>(statements.length);
ArrayList<ICompletionProposal> proposalList = new ArrayList<>(statements.length);
// iterate over all the different categories
for (int i = 0; i < statements.length; i++) {
@ -156,19 +146,17 @@ public class AutomakeCompletionProcessor implements IContentAssistProcessor {
proposalList.add(result);
}
}
ICompletionProposal[] proposals = (ICompletionProposal[]) proposalList.toArray(new ICompletionProposal[0]);
ICompletionProposal[] proposals = proposalList.toArray(new ICompletionProposal[0]);
Arrays.sort(proposals, comparator);
return proposals;
}
/* (non-Javadoc)
* @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#computeContextInformation(org.eclipse.jface.text.ITextViewer, int)
*/
@Override
public IContextInformation[] computeContextInformation(ITextViewer viewer, int documentOffset) {
WordPartDetector wordPart = new WordPartDetector(viewer, documentOffset);
boolean macro = WordPartDetector.inMacro(viewer, documentOffset);
IMakefile makefile = fManager.getWorkingCopy(fEditor.getEditorInput());
ArrayList<String> contextList = new ArrayList<String>();
ArrayList<String> contextList = new ArrayList<>();
if (macro) {
IDirective[] statements = makefile.getMacroDefinitions();
for (int i = 0; i < statements.length; i++) {
@ -198,37 +186,29 @@ public class AutomakeCompletionProcessor implements IContentAssistProcessor {
IContextInformation[] result = new IContextInformation[contextList.size()];
for (int i = 0; i < result.length; i++) {
String context = (String)contextList.get(i);
String context = contextList.get(i);
result[i] = new ContextInformation(imageMacro, wordPart.toString(), context);
}
return result;
}
/* (non-Javadoc)
* @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getCompletionProposalAutoActivationCharacters()
*/
@Override
public char[] getCompletionProposalAutoActivationCharacters() {
return null;
}
/* (non-Javadoc)
* @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getContextInformationAutoActivationCharacters()
*/
@Override
public char[] getContextInformationAutoActivationCharacters() {
return null;
}
/* (non-Javadoc)
* @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getErrorMessage()
*/
@Override
public String getErrorMessage() {
return null;
}
/* (non-Javadoc)
* @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getContextInformationValidator()
*/
@Override
public IContextInformationValidator getContextInformationValidator() {
return fValidator;
}

View file

@ -25,6 +25,7 @@ public class AutomakeConfigMacro extends Directive {
return name;
}
@Override
public String toString() {
return name + "\n";
}

View file

@ -32,16 +32,12 @@ public class AutomakeDocumentProvider extends TextFileDocumentProvider implement
public IMakefile fCopy;
}
/*
* @see org.eclipse.ui.editors.text.TextFileDocumentProvider#createEmptyFileInfo()
*/
@Override
protected FileInfo createEmptyFileInfo() {
return new AutomakefileFileInfo();
}
/*
* @see org.eclipse.ui.editors.text.TextFileDocumentProvider#createFileInfo(java.lang.Object)
*/
@Override
protected FileInfo createFileInfo(Object element) throws CoreException {
IMakefile original = null;
if (element instanceof IFileEditorInput) {
@ -81,9 +77,7 @@ public class AutomakeDocumentProvider extends TextFileDocumentProvider implement
return makefile;
}
/*
* @see org.eclipse.cdt.internal.autotools.ui.editors.automake.IMakefileDocumentProvider#getWorkingCopy(java.lang.Object)
*/
@Override
public IMakefile getWorkingCopy(Object element) {
FileInfo fileInfo= getFileInfo(element);
if (fileInfo instanceof AutomakefileFileInfo) {
@ -93,9 +87,7 @@ public class AutomakeDocumentProvider extends TextFileDocumentProvider implement
return null;
}
/*
* @see org.eclipse.cdt.internal.autotools.ui.editors.automake.IMakefileDocumentProvider#shutdown()
*/
@Override
public void shutdown() {
@SuppressWarnings("rawtypes")
Iterator e= getConnectedElementsIterator();
@ -103,6 +95,7 @@ public class AutomakeDocumentProvider extends TextFileDocumentProvider implement
disconnect(e.next());
}
@Override
public void connect(Object element) throws CoreException {
super.connect(element);
IMakefile makefile = getWorkingCopy(element);
@ -110,8 +103,9 @@ public class AutomakeDocumentProvider extends TextFileDocumentProvider implement
errorHandler.update(makefile);
}
@Override
public IDocument getDocument(Object element) {
FileInfo info= (FileInfo) getFileInfo(element);
FileInfo info= getFileInfo(element);
if (info != null)
return info.fTextFileBuffer.getDocument();
return getParentProvider().getDocument(element);

View file

@ -51,7 +51,8 @@ public class AutomakeEditor extends MakefileEditor {
return fgInstance;
}
protected void doSetInput(IEditorInput newInput) throws CoreException
@Override
protected void doSetInput(IEditorInput newInput) throws CoreException
{
super.doSetInput(newInput);
this.input = newInput;
@ -59,9 +60,7 @@ public class AutomakeEditor extends MakefileEditor {
getOutlinePage().setInput(input);
}
/* (non-Javadoc)
* @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#initializeEditor()
*/
@Override
protected void initializeEditor() {
setRangeIndicator(new DefaultRangeIndicator());
setEditorContextMenuId("#MakefileEditorContext"); //$NON-NLS-1$
@ -93,16 +92,12 @@ public class AutomakeEditor extends MakefileEditor {
return ampage;
}
/* (non-Javadoc)
* @see org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
*/
@Override
public void createPartControl(Composite parent) {
super.createPartControl(parent);
}
/* (non-Javadoc)
* Method declared on IAdaptable
*/
@Override
public Object getAdapter(@SuppressWarnings("rawtypes") Class key) {
if (key.equals(IContentOutlinePage.class)) {
return getAutomakeOutlinePage();
@ -114,6 +109,7 @@ public class AutomakeEditor extends MakefileEditor {
return sourceViewerConfiguration;
}
@Override
protected void handlePreferenceStoreChanged(PropertyChangeEvent event) {
super.handlePreferenceStoreChanged(event);
}

View file

@ -38,14 +38,17 @@ public class AutomakeErrorHandler {
super(annotationType, persist, message);
}
@Override
public void setQuickFixable(boolean state) {
// do nothing
}
@Override
public boolean isQuickFixableStateSet() {
return true;
}
@Override
public boolean isQuickFixable() throws AssertionFailedException {
return false;
}

View file

@ -11,8 +11,6 @@
package org.eclipse.cdt.internal.autotools.ui.editors.automake;
public class AutomakeIfElse extends Parent {
String condition;
String type;

View file

@ -34,10 +34,12 @@ class AutomakeMacroDefinitionRule implements IPredicateRule {
this.defaultToken = defaultToken;
}
@Override
public IToken getSuccessToken() {
return token;
}
@Override
public IToken evaluate(ICharacterScanner scanner, boolean resume) {
buffer.setLength(0);
int c;
@ -148,6 +150,7 @@ class AutomakeMacroDefinitionRule implements IPredicateRule {
return c;
}
@Override
public IToken evaluate(ICharacterScanner scanner) {
return evaluate(scanner, false);
}

View file

@ -35,11 +35,13 @@ public class AutomakeMacroReferenceRule extends PatternRule {
}
}
@Override
protected IToken doEvaluate(ICharacterScanner scanner, boolean resume) {
nOfBrackets = 1;
return super.doEvaluate(scanner, resume);
}
@Override
protected boolean endSequenceDetected(ICharacterScanner scanner) {
int c;
char[][] delimiters = scanner.getLegalLineDelimiters();

View file

@ -29,6 +29,7 @@ public class AutomakeTextHover implements ITextHover, ITextHoverExtension {
this.editor = editor;
}
@Override
public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) {
TargetRule target = null;
String[] preReqs = null;
@ -98,20 +99,10 @@ public class AutomakeTextHover implements ITextHover, ITextHoverExtension {
}
}
// IRule[] rules = makefile.getRules();
// for (int i = 0; i < rules.length; i++) {
// rule = rules[i];
// System.out.println("rule: " + rule);
// System.out.println("target: " + rule.getTarget());
// ICommand[] commands = rule.getCommands();
// for (int j = 0; j < commands.length; j++) {
// ICommand command = commands[j];
// System.out.println("command: " + command);
// }
// }
return "";
}
@Override
public IRegion getHoverRegion(ITextViewer textViewer, int offset) {
if (textViewer != null) {
@ -177,6 +168,7 @@ public class AutomakeTextHover implements ITextHover, ITextHoverExtension {
return null;
}
@Override
public IInformationControlCreator getHoverControlCreator() {
// TODO Auto-generated method stub
return null;

View file

@ -17,10 +17,12 @@ public class AutomakeWordDetector implements IWordDetector {
private static final String correctStartSpecChars = "$%*().><"; //$NON-NLS-1$
private static final String correctSpecChars = "?@$/\\<*%"; //$NON-NLS-1$
@Override
public boolean isWordStart(char character) {
return Character.isLetterOrDigit(character) || (correctStartSpecChars.indexOf(character) >= 0);
}
@Override
public boolean isWordPart(char character) {
return Character.isLetterOrDigit(character) || (correctSpecChars.indexOf(character) >= 0);
}

View file

@ -67,6 +67,7 @@ public class AutomakefileCodeScanner extends AbstractMakefileCodeScanner {
initialize();
}
@Override
protected List<IRule> createRules() {
IToken keyword = getToken(ColorManager.MAKE_KEYWORD_COLOR);
IToken function = getToken(ColorManager.MAKE_FUNCTION_COLOR);
@ -75,13 +76,14 @@ public class AutomakefileCodeScanner extends AbstractMakefileCodeScanner {
IToken macroDef = getToken(ColorManager.MAKE_MACRO_DEF_COLOR);
IToken other = getToken(ColorManager.MAKE_DEFAULT_COLOR);
List<IRule> rules = new ArrayList<IRule>();
List<IRule> rules = new ArrayList<>();
// Add rule for single line comments.
rules.add(new EndOfLineRule("#", comment, '\\', true)); //$NON-NLS-1$
// Add generic whitespace rule.
rules.add(new WhitespaceRule(new IWhitespaceDetector() {
@Override
public boolean isWhitespace(char character) {
return Character.isWhitespace(character);
}
@ -136,13 +138,7 @@ public class AutomakefileCodeScanner extends AbstractMakefileCodeScanner {
return rules;
}
public IToken nextToken() {
return super.nextToken();
}
/*
* @see AbstractMakefileCodeScanner#getTokenProperties()
*/
@Override
protected String[] getTokenProperties() {
return fTokenProperties;
}

View file

@ -16,7 +16,6 @@ import java.util.ArrayList;
import java.util.List;
import org.eclipse.cdt.internal.autotools.ui.MakeUIImages;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.TreeViewer;
@ -43,9 +42,7 @@ public class AutomakefileContentOutlinePage extends ContentOutlinePage {
protected IMakefile makefile;
protected IMakefile nullMakefile = new NullMakefile();
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
*/
@Override
public Object[] getChildren(Object element) {
if (element == fInput) {
return getElements(makefile);
@ -55,9 +52,7 @@ public class AutomakefileContentOutlinePage extends ContentOutlinePage {
return new Object[0];
}
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
*/
@Override
public Object getParent(Object element) {
if (element instanceof IMakefile) {
return fInput;
@ -67,9 +62,7 @@ public class AutomakefileContentOutlinePage extends ContentOutlinePage {
return fInput;
}
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
*/
@Override
public boolean hasChildren(Object element) {
if (element == fInput) {
return true;
@ -83,9 +76,7 @@ public class AutomakefileContentOutlinePage extends ContentOutlinePage {
return false;
}
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
*/
@Override
public Object[] getElements(Object inputElement) {
IDirective[] directives;
if (inputElement == fInput) {
@ -101,7 +92,7 @@ public class AutomakefileContentOutlinePage extends ContentOutlinePage {
} else {
directives = new IDirective[0];
}
List<IDirective> list = new ArrayList<IDirective>(directives.length);
List<IDirective> list = new ArrayList<>(directives.length);
for (int i = 0; i < directives.length; i++) {
if (showMacroDefinition && directives[i] instanceof IMacroDefinition) {
list.add(directives[i]);
@ -123,15 +114,11 @@ public class AutomakefileContentOutlinePage extends ContentOutlinePage {
return list.toArray();
}
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.IContentProvider#dispose()
*/
@Override
public void dispose() {
}
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/
@Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
if (oldInput != null) {
makefile = nullMakefile;
@ -147,11 +134,9 @@ public class AutomakefileContentOutlinePage extends ContentOutlinePage {
}
}
private class AutomakefileLabelProvider extends LabelProvider implements ILabelProvider {
private class AutomakefileLabelProvider extends LabelProvider {
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
*/
@Override
public Image getImage(Object element) {
if (element instanceof ITargetRule) {
return MakeUIImages.getImage(MakeUIImages.IMG_OBJS_MAKEFILE_TARGET_RULE);
@ -175,9 +160,7 @@ public class AutomakefileContentOutlinePage extends ContentOutlinePage {
return super.getImage(element);
}
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
*/
@Override
public String getText(Object element) {
String name;
if (element instanceof IRule) {
@ -234,6 +217,7 @@ public class AutomakefileContentOutlinePage extends ContentOutlinePage {
final Control control = viewer.getControl();
if (control != null && !control.isDisposed()) {
control.getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
if (!control.isDisposed()) {
control.setRedraw(false);
@ -247,9 +231,7 @@ public class AutomakefileContentOutlinePage extends ContentOutlinePage {
}
}
/* (non-Javadoc)
* @see org.eclipse.ui.part.IPage#createControl(org.eclipse.swt.widgets.Composite)
*/
@Override
public void createControl(Composite parent) {
super.createControl(parent);
TreeViewer viewer = getTreeViewer();
@ -258,39 +240,9 @@ public class AutomakefileContentOutlinePage extends ContentOutlinePage {
if (fInput != null) {
viewer.setInput(fInput);
}
// MenuManager manager= new MenuManager("#MakefileOutlinerContext"); //$NON-NLS-1$
// manager.setRemoveAllWhenShown(true);
// manager.addMenuListener(new IMenuListener() {
// public void menuAboutToShow(IMenuManager m) {
// contextMenuAboutToShow(m);
// }
// });
// Control tree = viewer.getControl();
// Menu menu = manager.createContextMenu(tree);
// tree.setMenu(menu);
//
// viewer.addDoubleClickListener(new IDoubleClickListener() {
// /* (non-Javadoc)
// * @see org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(org.eclipse.jface.viewers.DoubleClickEvent)
// */
// public void doubleClick(DoubleClickEvent event) {
// if (fOpenIncludeAction != null) {
// fOpenIncludeAction.run();
// }
// }
// });
//
// IPageSite site= getSite();
// site.registerContextMenu(MakeUIPlugin.getPluginId() + ".outline", manager, viewer); //$NON-NLS-1$
// site.setSelectionProvider(viewer);
}
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
public void inputChanged(Object oldInput, Object newInput) {
if (oldInput != null) {
makefile = nullMakefile;
}

View file

@ -39,23 +39,19 @@ public class AutomakefileReconcilingStrategy implements IReconcilingStrategy {
fOutliner= editor.getAutomakeOutlinePage();
fLastRegionOffset = Integer.MAX_VALUE;
fEditor= editor;
input = (IEditorInput) fEditor.getEditorInput();
input = fEditor.getEditorInput();
fManager= AutomakeEditorFactory.getDefault().getWorkingCopyManager();
fDocumentProvider= AutomakeEditorFactory.getDefault().getAutomakefileDocumentProvider();
fErrorHandler= new AutomakeErrorHandler(input);
fMakefileReconcilingParticipant= (IReconcilingParticipant)fEditor;
}
/**
* @see IReconcilingStrategy#reconcile(document)
*/
@Override
public void setDocument(IDocument document) {
}
/**
* @see IReconcilingStrategy#reconcile(region)
*/
@Override
public void reconcile(IRegion region) {
// We use a trick to avoid running the reconciler multiple times
// on a file when it gets changed. This is because this gets called
@ -67,9 +63,7 @@ public class AutomakefileReconcilingStrategy implements IReconcilingStrategy {
fLastRegionOffset = region.getOffset();
}
/**
* @see IReconcilingStrategy#reconcile(dirtyRegion, region)
*/
@Override
public void reconcile(DirtyRegion dirtyRegion, IRegion region) {
// FIXME: This seems to generate too much flashing in
// the contentoutline viewer.

View file

@ -24,7 +24,6 @@ import org.eclipse.jface.text.reconciler.IReconciler;
import org.eclipse.jface.text.reconciler.MonoReconciler;
import org.eclipse.jface.text.rules.DefaultDamagerRepairer;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.jface.text.source.SourceViewerConfiguration;
import org.eclipse.jface.util.PropertyChangeEvent;
@ -54,6 +53,7 @@ public class AutomakefileSourceConfiguration extends
}
@Override
public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) {
if (amHover == null)
amHover = new AutomakeTextHover(editor);
@ -63,6 +63,7 @@ public class AutomakefileSourceConfiguration extends
/**
* @param event
*/
@Override
public void adaptToPreferenceChange(PropertyChangeEvent event) {
AutomakefileCodeScanner scanner = getAutomakeCodeScanner();
scanner.adaptToPreferenceChange(event);
@ -72,11 +73,13 @@ public class AutomakefileSourceConfiguration extends
* @param event
* @return
*/
@Override
public boolean affectsBehavior(PropertyChangeEvent event) {
AutomakefileCodeScanner scanner = getAutomakeCodeScanner();
return scanner.affectsBehavior(event);
}
@Override
public IPresentationReconciler getPresentationReconciler(ISourceViewer v) {
PresentationReconciler reconciler = new PresentationReconciler();
@ -111,10 +114,7 @@ public class AutomakefileSourceConfiguration extends
return reconciler;
}
/**
* @see SourceViewerConfiguration#getReconciler(ISourceViewer)
*/
@Override
public IReconciler getReconciler(ISourceViewer sourceViewer) {
if (editor != null && editor.isEditable()) {
MonoReconciler reconciler= new MonoReconciler(new AutomakefileReconcilingStrategy(editor), false);
@ -125,9 +125,7 @@ public class AutomakefileSourceConfiguration extends
return null;
}
/**
* @see org.eclipse.jface.text.source.SourceViewerConfiguration#getContentAssistant(ISourceViewer)
*/
@Override
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
ContentAssistant assistant = new ContentAssistant();
assistant.setContentAssistProcessor(new AutomakeCompletionProcessor(editor), IDocument.DEFAULT_CONTENT_TYPE);

View file

@ -19,6 +19,7 @@ public class BadDirective extends Directive implements IBadDirective {
line = s;
}
@Override
public String toString() {
return line;
}

View file

@ -37,6 +37,7 @@ public class Command extends Directive implements ICommand {
* target as a prerequisite or has no prerequisites, any error
* found while executing the command will be ignored.
*/
@Override
public boolean shouldIgnoreError() {
// Check for the prefix hyphen in the command.
if (getPrefix() == HYPHEN) {
@ -52,6 +53,7 @@ public class Command extends Directive implements ICommand {
* target as a prerequisite or has no prerequisites, the command
* will not be written to standard output before it is executed.
*/
@Override
public boolean shouldBeSilent() {
// Check for the prefix at sign
if (getPrefix() == AT) {
@ -65,6 +67,7 @@ public class Command extends Directive implements ICommand {
* command line that will be executed even if -n, -q or -t is
* specified.
*/
@Override
public boolean shouldExecute() {
// Check for the prefix at sign
if (getPrefix() == PLUS) {
@ -73,6 +76,7 @@ public class Command extends Directive implements ICommand {
return false;
}
@Override
public String toString() {
StringBuffer cmd = new StringBuffer();
cmd.append( '\t');
@ -83,12 +87,14 @@ public class Command extends Directive implements ICommand {
return cmd.toString();
}
@Override
public boolean equals(Object cmd) {
if (cmd instanceof Command)
return cmd.toString().equals(toString());
return false;
}
@Override
public int hashCode() {
return toString().hashCode();
}
@ -108,9 +114,7 @@ public class Command extends Directive implements ICommand {
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.make.core.makefile.ICommand#execute(java.lang.String[], java.io.File)
*/
@Override
public Process execute(String shell, String[] envp, File dir) throws IOException {
String[] cmdArray = new String[] { shell, "-c", command}; //$NON-NLS-1$
return Runtime.getRuntime().exec(cmdArray, envp, dir);

View file

@ -23,18 +23,21 @@ public class Comment extends Directive implements IComment {
}
}
@Override
public String toString() {
StringBuffer buffer = new StringBuffer();
buffer.append(POUND_STRING).append(comment).append('\n');
return buffer.toString();
}
@Override
public boolean equals(Object cmt) {
if (cmt instanceof Comment)
return cmt.toString().equals(toString());
return false;
}
@Override
public int hashCode() {
return toString().hashCode();
}

View file

@ -18,24 +18,11 @@ import org.eclipse.jface.text.contentassist.ICompletionProposal;
public class CompletionProposalComparator implements Comparator<ICompletionProposal>, Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* Constructor for CompletionProposalComparator.
*/
public CompletionProposalComparator() {
}
/* (non-Javadoc)
* @see Comparator#compare(Object, Object)
*/
@Override
public int compare(ICompletionProposal o1, ICompletionProposal o2) {
ICompletionProposal c1= (ICompletionProposal) o1;
ICompletionProposal c2= (ICompletionProposal) o2;
return c1.getDisplayString().compareToIgnoreCase(c2.getDisplayString());
return o1.getDisplayString().compareToIgnoreCase(o2.getDisplayString());
}
}

View file

@ -37,14 +37,17 @@ public abstract class Conditional extends Parent implements IConditional {
}
@Override
public String getConditional() {
return cond;
}
@Override
public String getArg1() {
return arg1;
}
@Override
public String getArg2() {
return arg2;
}
@ -53,22 +56,27 @@ public abstract class Conditional extends Parent implements IConditional {
return false;
}
@Override
public boolean isIfdef() {
return false;
}
@Override
public boolean isIfndef() {
return false;
}
@Override
public boolean isIfeq() {
return false;
}
@Override
public boolean isIfneq() {
return false;
}
@Override
public boolean isElse() {
return false;
}

View file

@ -17,10 +17,12 @@ public class DefineVariable extends GNUVariableDef {
super(parent, name, value);
}
@Override
public boolean isMultiLine() {
return true;
}
@Override
public String toString() {
StringBuffer sb = new StringBuffer(GNUMakefileConstants.VARIABLE_DEFINE);
sb.append(getName()).append('\n');

Some files were not shown because too many files have changed in this diff Show more