mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-01 06:05:24 +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:
parent
c6a1fab921
commit
6839fa9c6b
205 changed files with 1282 additions and 1605 deletions
|
@ -1,8 +1,101 @@
|
||||||
#Tue Oct 06 15:50:25 EDT 2009
|
|
||||||
eclipse.preferences.version=1
|
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.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.targetPlatform=1.7
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
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.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.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
|
org.eclipse.jdt.core.compiler.source=1.7
|
||||||
|
|
|
@ -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
|
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: %Bundle-Name.0
|
Bundle-Name: %Bundle-Name.0
|
||||||
Bundle-SymbolicName: org.eclipse.cdt.autotools.ui;singleton:=true
|
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-Activator: org.eclipse.cdt.autotools.ui.AutotoolsUIPlugin
|
||||||
Bundle-Localization: plugin
|
Bundle-Localization: plugin
|
||||||
Bundle-Vendor: %provider
|
Bundle-Vendor: %provider
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<version>1.0.1-SNAPSHOT</version>
|
<version>2.0.0-SNAPSHOT</version>
|
||||||
<artifactId>org.eclipse.cdt.autotools.ui</artifactId>
|
<artifactId>org.eclipse.cdt.autotools.ui</artifactId>
|
||||||
<packaging>eclipse-plugin</packaging>
|
<packaging>eclipse-plugin</packaging>
|
||||||
</project>
|
</project>
|
|
@ -74,6 +74,7 @@ public class AutotoolsUIPlugin extends AbstractUIPlugin {
|
||||||
/**
|
/**
|
||||||
* This method is called upon plug-in activation
|
* This method is called upon plug-in activation
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void start(BundleContext context) throws Exception {
|
public void start(BundleContext context) throws Exception {
|
||||||
super.start(context);
|
super.start(context);
|
||||||
}
|
}
|
||||||
|
@ -81,6 +82,7 @@ public class AutotoolsUIPlugin extends AbstractUIPlugin {
|
||||||
/**
|
/**
|
||||||
* This method is called when the plug-in is stopped
|
* This method is called when the plug-in is stopped
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void stop(BundleContext context) throws Exception {
|
public void stop(BundleContext context) throws Exception {
|
||||||
super.stop(context);
|
super.stop(context);
|
||||||
plugin = null;
|
plugin = null;
|
||||||
|
@ -179,6 +181,7 @@ public class AutotoolsUIPlugin extends AbstractUIPlugin {
|
||||||
display = Display.getDefault();
|
display = Display.getDefault();
|
||||||
final IStatus fstatus = status;
|
final IStatus fstatus = status;
|
||||||
display.asyncExec(new Runnable() {
|
display.asyncExec(new Runnable() {
|
||||||
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
ErrorDialog.openError(null, title, null, fstatus);
|
ErrorDialog.openError(null, title, null, fstatus);
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,8 +72,8 @@ public class AutoconfAnnotationHover implements IAnnotationHover, IAnnotationHov
|
||||||
if (model == null)
|
if (model == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
List<Annotation> exact= new ArrayList<Annotation>();
|
List<Annotation> exact= new ArrayList<>();
|
||||||
List<Annotation> including= new ArrayList<Annotation>();
|
List<Annotation> including= new ArrayList<>();
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
Iterator e= model.getAnnotationIterator();
|
Iterator e= model.getAnnotationIterator();
|
||||||
|
@ -95,9 +95,7 @@ public class AutoconfAnnotationHover implements IAnnotationHover, IAnnotationHov
|
||||||
return select(exact, including);
|
return select(exact, including);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
@Override
|
||||||
* @see IVerticalRulerHover#getHoverInfo(ISourceViewer, int)
|
|
||||||
*/
|
|
||||||
public String getHoverInfo(ISourceViewer sourceViewer, int lineNumber) {
|
public String getHoverInfo(ISourceViewer sourceViewer, int lineNumber) {
|
||||||
List<Annotation> annotations = getAnnotationsForLine(sourceViewer, lineNumber);
|
List<Annotation> annotations = getAnnotationsForLine(sourceViewer, lineNumber);
|
||||||
if (annotations != null && annotations.size() > 0) {
|
if (annotations != null && annotations.size() > 0) {
|
||||||
|
@ -105,25 +103,25 @@ public class AutoconfAnnotationHover implements IAnnotationHover, IAnnotationHov
|
||||||
if (annotations.size() == 1) {
|
if (annotations.size() == 1) {
|
||||||
|
|
||||||
// optimization
|
// optimization
|
||||||
Annotation annotation = (Annotation) annotations.get(0);
|
Annotation annotation = annotations.get(0);
|
||||||
String message= annotation.getText();
|
String message= annotation.getText();
|
||||||
if (message != null && message.trim().length() > 0)
|
if (message != null && message.trim().length() > 0)
|
||||||
return formatSingleMessage(message);
|
return formatSingleMessage(message);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
List<String> messages= new ArrayList<String>();
|
List<String> messages= new ArrayList<>();
|
||||||
|
|
||||||
Iterator<Annotation> e= annotations.iterator();
|
Iterator<Annotation> e= annotations.iterator();
|
||||||
while (e.hasNext()) {
|
while (e.hasNext()) {
|
||||||
Annotation annotation = (Annotation) e.next();
|
Annotation annotation = e.next();
|
||||||
String message= annotation.getText();
|
String message= annotation.getText();
|
||||||
if (message != null && message.trim().length() > 0)
|
if (message != null && message.trim().length() > 0)
|
||||||
messages.add(message.trim());
|
messages.add(message.trim());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (messages.size() == 1)
|
if (messages.size() == 1)
|
||||||
return formatSingleMessage((String) messages.get(0));
|
return formatSingleMessage(messages.get(0));
|
||||||
|
|
||||||
if (messages.size() > 1)
|
if (messages.size() > 1)
|
||||||
return formatMultipleMessages(messages);
|
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.
|
* Formats a message as HTML text.
|
||||||
*/
|
*/
|
||||||
|
@ -166,7 +154,7 @@ public class AutoconfAnnotationHover implements IAnnotationHover, IAnnotationHov
|
||||||
HTMLPrinter.startBulletList(buffer);
|
HTMLPrinter.startBulletList(buffer);
|
||||||
Iterator<String> e= messages.iterator();
|
Iterator<String> e= messages.iterator();
|
||||||
while (e.hasNext())
|
while (e.hasNext())
|
||||||
HTMLPrinter.addBullet(buffer, HTMLPrinter.convertToHTMLContent((String) e.next()));
|
HTMLPrinter.addBullet(buffer, HTMLPrinter.convertToHTMLContent(e.next()));
|
||||||
HTMLPrinter.endBulletList(buffer);
|
HTMLPrinter.endBulletList(buffer);
|
||||||
|
|
||||||
HTMLPrinter.addPageEpilog(buffer);
|
HTMLPrinter.addPageEpilog(buffer);
|
||||||
|
@ -178,22 +166,27 @@ public class AutoconfAnnotationHover implements IAnnotationHover, IAnnotationHov
|
||||||
// handles html.
|
// handles html.
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
public IInformationControlCreator getHoverControlCreator() {
|
public IInformationControlCreator getHoverControlCreator() {
|
||||||
return new IInformationControlCreator() {
|
return new IInformationControlCreator() {
|
||||||
|
@Override
|
||||||
public IInformationControl createInformationControl(Shell parent) {
|
public IInformationControl createInformationControl(Shell parent) {
|
||||||
return new DefaultInformationControl(parent, false);
|
return new DefaultInformationControl(parent, false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean canHandleMouseCursor() {
|
public boolean canHandleMouseCursor() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ILineRange getHoverLineRange(ISourceViewer viewer, int lineNumber) {
|
public ILineRange getHoverLineRange(ISourceViewer viewer, int lineNumber) {
|
||||||
return new LineRange(lineNumber, 1);
|
return new LineRange(lineNumber, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object getHoverInfo(ISourceViewer sourceViewer, ILineRange lineRange, int visibleNumberOfLines) {
|
public Object getHoverInfo(ISourceViewer sourceViewer, ILineRange lineRange, int visibleNumberOfLines) {
|
||||||
return getHoverInfo(sourceViewer, lineRange.getStartLine());
|
return getHoverInfo(sourceViewer, lineRange.getStartLine());
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ import org.eclipse.swt.graphics.RGB;
|
||||||
|
|
||||||
public class AutoconfCodeScanner extends RuleBasedScanner {
|
public class AutoconfCodeScanner extends RuleBasedScanner {
|
||||||
|
|
||||||
private Map<String, IToken> fTokenMap= new HashMap<String, IToken>();
|
private Map<String, IToken> fTokenMap= new HashMap<>();
|
||||||
private String[] fPropertyNamesColor;
|
private String[] fPropertyNamesColor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -82,7 +82,7 @@ public class AutoconfCodeScanner extends RuleBasedScanner {
|
||||||
IToken ammacro = getToken(ColorManager.AUTOCONF_AMMACRO_COLOR);
|
IToken ammacro = getToken(ColorManager.AUTOCONF_AMMACRO_COLOR);
|
||||||
IToken code = getToken(ColorManager.AUTOCONF_CODESEQ_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.
|
// Add rule for single line comments.
|
||||||
rules.add(new EndOfLineRule("dnl", comment)); //$NON-NLS-1$
|
rules.add(new EndOfLineRule("dnl", comment)); //$NON-NLS-1$
|
||||||
|
@ -159,9 +159,7 @@ public class AutoconfCodeScanner extends RuleBasedScanner {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
@Override
|
||||||
* @see ITokenScanner#nextToken()
|
|
||||||
*/
|
|
||||||
public IToken nextToken() {
|
public IToken nextToken() {
|
||||||
return super.nextToken();
|
return super.nextToken();
|
||||||
}
|
}
|
||||||
|
@ -246,9 +244,7 @@ public class AutoconfCodeScanner extends RuleBasedScanner {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
@Override
|
||||||
* @see ICharacterScanner#unread()
|
|
||||||
*/
|
|
||||||
public void unread() {
|
public void unread() {
|
||||||
--fOffset;
|
--fOffset;
|
||||||
fColumn = UNDEFINED;
|
fColumn = UNDEFINED;
|
||||||
|
|
|
@ -25,6 +25,7 @@ public class AutoconfDocumentProvider extends TextFileDocumentProvider {
|
||||||
disconnect(e.next());
|
disconnect(e.next());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void connect(Object element) throws CoreException {
|
public void connect(Object element) throws CoreException {
|
||||||
super.connect(element);
|
super.connect(element);
|
||||||
// Remove all error markers for file as we will parse
|
// Remove all error markers for file as we will parse
|
||||||
|
@ -33,8 +34,9 @@ public class AutoconfDocumentProvider extends TextFileDocumentProvider {
|
||||||
// h.removeAllExistingMarkers();
|
// h.removeAllExistingMarkers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IDocument getDocument(Object element) {
|
public IDocument getDocument(Object element) {
|
||||||
FileInfo info= (FileInfo) getFileInfo(element);
|
FileInfo info= getFileInfo(element);
|
||||||
if (info != null)
|
if (info != null)
|
||||||
return info.fTextFileBuffer.getDocument();
|
return info.fTextFileBuffer.getDocument();
|
||||||
return getParentProvider().getDocument(element);
|
return getParentProvider().getDocument(element);
|
||||||
|
|
|
@ -19,6 +19,7 @@ import org.eclipse.jface.text.IDocumentListener;
|
||||||
public class AutoconfDocumentSetupParticipant implements
|
public class AutoconfDocumentSetupParticipant implements
|
||||||
IDocumentSetupParticipant, IDocumentListener {
|
IDocumentSetupParticipant, IDocumentListener {
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setup(IDocument document) {
|
public void setup(IDocument document) {
|
||||||
AutoconfPartitioner partitioner =
|
AutoconfPartitioner partitioner =
|
||||||
new AutoconfPartitioner(
|
new AutoconfPartitioner(
|
||||||
|
@ -34,17 +35,12 @@ public class AutoconfDocumentSetupParticipant implements
|
||||||
// document.addDocumentListener(this);
|
// document.addDocumentListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
@Override
|
||||||
* @see IDocumentListener#documentAboutToBeChanged(DocumentEvent)
|
|
||||||
*/
|
|
||||||
|
|
||||||
public void documentAboutToBeChanged(DocumentEvent e) {
|
public void documentAboutToBeChanged(DocumentEvent e) {
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
@Override
|
||||||
* @see IDocumentListener#documentChanged(DocumentEvent)
|
|
||||||
*/
|
|
||||||
public void documentChanged(DocumentEvent e) {
|
public void documentChanged(DocumentEvent e) {
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,7 +118,8 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void initializeEditor() {
|
@Override
|
||||||
|
protected void initializeEditor() {
|
||||||
super.initializeEditor();
|
super.initializeEditor();
|
||||||
setDocumentProvider(getAutoconfDocumentProvider());
|
setDocumentProvider(getAutoconfDocumentProvider());
|
||||||
IPreferenceStore[] stores = new IPreferenceStore[2];
|
IPreferenceStore[] stores = new IPreferenceStore[2];
|
||||||
|
@ -155,7 +156,8 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro
|
||||||
return document;
|
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
|
// If this editor is for a project file, remove this editor as a property
|
||||||
// change listener.
|
// change listener.
|
||||||
|
@ -177,7 +179,7 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro
|
||||||
{
|
{
|
||||||
IDocument document = getInputDocument();
|
IDocument document = getInputDocument();
|
||||||
|
|
||||||
setRootElement(reparseDocument(document, newInput));
|
setRootElement(reparseDocument(document));
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
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) {
|
public Object getAdapter(Class required) {
|
||||||
if (ProjectionAnnotationModel.class.equals(required)) {
|
if (ProjectionAnnotationModel.class.equals(required)) {
|
||||||
if (fProjectionSupport != null) {
|
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));
|
return ColorManager.getDefault().getColor(PreferenceConverter.getColor(AutotoolsPlugin.getDefault().getPreferenceStore(), key));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void handleProjectPropertyChanged(IProject project, String property) {
|
public void handleProjectPropertyChanged(IProject project, String property) {
|
||||||
if (property.equals(AutotoolsPropertyConstants.AUTOCONF_MACRO_VERSIONING)) {
|
if (property.equals(AutotoolsPropertyConstants.AUTOCONF_MACRO_VERSIONING)) {
|
||||||
ISourceViewer sourceViewer= getSourceViewer();
|
ISourceViewer sourceViewer= getSourceViewer();
|
||||||
|
@ -285,24 +289,21 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro
|
||||||
try {
|
try {
|
||||||
IDocument document = getInputDocument();
|
IDocument document = getInputDocument();
|
||||||
|
|
||||||
setRootElement(reparseDocument(document, getEditorInput()));
|
setRootElement(reparseDocument(document));
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private AutoconfElement reparseDocument(IDocument document,
|
private AutoconfElement reparseDocument(IDocument document) {
|
||||||
IEditorInput editorInput) {
|
|
||||||
AutoconfParser parser = getAutoconfParser();
|
AutoconfParser parser = getAutoconfParser();
|
||||||
((AutoconfErrorHandler)parser.getErrorHandler()).removeAllExistingMarkers();
|
((AutoconfErrorHandler)parser.getErrorHandler()).removeAllExistingMarkers();
|
||||||
|
|
||||||
return parser.parse(document);
|
return parser.parse(document);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
@Override
|
||||||
* @see org.eclipse.ui.texteditor.AbstractTextEditor#handlePreferenceStoreChanged(org.eclipse.jface.util.PropertyChangeEvent)
|
|
||||||
*/
|
|
||||||
protected void handlePreferenceStoreChanged(PropertyChangeEvent event) {
|
protected void handlePreferenceStoreChanged(PropertyChangeEvent event) {
|
||||||
ISourceViewer sourceViewer= getSourceViewer();
|
ISourceViewer sourceViewer= getSourceViewer();
|
||||||
if (sourceViewer == null)
|
if (sourceViewer == null)
|
||||||
|
@ -354,16 +355,12 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro
|
||||||
fHoverInfo= hoverInfo;
|
fHoverInfo= hoverInfo;
|
||||||
fControlCreator= controlCreator;
|
fControlCreator= controlCreator;
|
||||||
}
|
}
|
||||||
/*
|
@Override
|
||||||
* @see org.eclipse.jface.text.information.IInformationProvider#getSubject(org.eclipse.jface.text.ITextViewer, int)
|
public IRegion getSubject(ITextViewer textViewer, int invocationOffset) {
|
||||||
*/
|
|
||||||
public IRegion getSubject(ITextViewer textViewer, int invocationOffset) {
|
|
||||||
return fHoverRegion;
|
return fHoverRegion;
|
||||||
}
|
}
|
||||||
/*
|
@Override
|
||||||
* @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) {
|
||||||
*/
|
|
||||||
public String getInformation(ITextViewer textViewer, IRegion subject) {
|
|
||||||
return fHoverInfo.toString();
|
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)
|
* @see org.eclipse.jface.text.information.IInformationProviderExtension#getInformation2(org.eclipse.jface.text.ITextViewer, org.eclipse.jface.text.IRegion)
|
||||||
* @since 3.2
|
* @since 3.2
|
||||||
*/
|
*/
|
||||||
public Object getInformation2(ITextViewer textViewer, IRegion subject) {
|
@Override
|
||||||
|
public Object getInformation2(ITextViewer textViewer, IRegion subject) {
|
||||||
return fHoverInfo;
|
return fHoverInfo;
|
||||||
}
|
}
|
||||||
/*
|
@Override
|
||||||
* @see org.eclipse.jface.text.information.IInformationProviderExtension2#getInformationPresenterControlCreator()
|
public IInformationControlCreator getInformationPresenterControlCreator() {
|
||||||
*/
|
|
||||||
public IInformationControlCreator getInformationPresenterControlCreator() {
|
|
||||||
return fControlCreator;
|
return fControlCreator;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -408,10 +404,8 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro
|
||||||
fTextOperationAction= textOperationAction;
|
fTextOperationAction= textOperationAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
@Override
|
||||||
* @see org.eclipse.jface.action.IAction#run()
|
public void run() {
|
||||||
*/
|
|
||||||
public void run() {
|
|
||||||
|
|
||||||
ISourceViewer sourceViewer= getSourceViewer();
|
ISourceViewer sourceViewer= getSourceViewer();
|
||||||
if (sourceViewer == null) {
|
if (sourceViewer == null) {
|
||||||
|
@ -589,6 +583,7 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro
|
||||||
*
|
*
|
||||||
* @param listener The reconcile listener to be added
|
* @param listener The reconcile listener to be added
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public final void addReconcilingParticipant(IReconcilingParticipant listener) {
|
public final void addReconcilingParticipant(IReconcilingParticipant listener) {
|
||||||
synchronized (fReconcilingListeners) {
|
synchronized (fReconcilingListeners) {
|
||||||
fReconcilingListeners.add(listener);
|
fReconcilingListeners.add(listener);
|
||||||
|
@ -625,18 +620,14 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro
|
||||||
return AutotoolsPlugin.getDefault().getPreferenceStore().getBoolean(MakefileEditorPreferenceConstants.EDITOR_FOLDING_ENABLED);
|
return AutotoolsPlugin.getDefault().getPreferenceStore().getBoolean(MakefileEditorPreferenceConstants.EDITOR_FOLDING_ENABLED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
@Override
|
||||||
* @see org.eclipse.ui.editors.text.TextEditor#initializeKeyBindingScopes()
|
|
||||||
*/
|
|
||||||
protected void initializeKeyBindingScopes() {
|
protected void initializeKeyBindingScopes() {
|
||||||
setKeyBindingScopes(new String [] { AutotoolsUIPlugin.getUniqueIdentifier() + ".editor.scope" } ); //$NON-NLS-1$
|
setKeyBindingScopes(new String [] { AutotoolsUIPlugin.getUniqueIdentifier() + ".editor.scope" } ); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* @see org.eclipse.ui.texteditor.AbstractTextEditor#createActions()
|
protected void createActions() {
|
||||||
*/
|
|
||||||
protected void createActions() {
|
|
||||||
super.createActions();
|
super.createActions();
|
||||||
// TODO: Figure out how to do this later.
|
// TODO: Figure out how to do this later.
|
||||||
// fFoldingGroup= new FoldingActionGroup(this, getSourceViewer());
|
// fFoldingGroup= new FoldingActionGroup(this, getSourceViewer());
|
||||||
|
@ -667,12 +658,14 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro
|
||||||
|
|
||||||
* @param parent Parent composite of the control.
|
* @param parent Parent composite of the control.
|
||||||
*/
|
*/
|
||||||
public void createPartControl(Composite parent) {
|
@Override
|
||||||
|
public void createPartControl(Composite parent) {
|
||||||
super.createPartControl(parent);
|
super.createPartControl(parent);
|
||||||
|
|
||||||
// Sticky hover support
|
// Sticky hover support
|
||||||
IInformationControlCreator informationControlCreator= new IInformationControlCreator() {
|
IInformationControlCreator informationControlCreator= new IInformationControlCreator() {
|
||||||
public IInformationControl createInformationControl(Shell shell) {
|
@Override
|
||||||
|
public IInformationControl createInformationControl(Shell shell) {
|
||||||
return new DefaultInformationControl(shell, true);
|
return new DefaultInformationControl(shell, true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -705,7 +698,8 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro
|
||||||
// fEditorSelectionChangedListener.install(getSelectionProvider());
|
// 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);
|
ISourceViewer viewer = new ProjectionViewer(parent, ruler, getOverviewRuler(), isOverviewRulerVisible(), styles);
|
||||||
|
|
||||||
// ensure decoration support has been created and configured.
|
// ensure decoration support has been created and configured.
|
||||||
|
@ -715,9 +709,7 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
@Override
|
||||||
* @see org.eclipse.ui.IWorkbenchPart#dispose()
|
|
||||||
*/
|
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
if (fProjectionFileUpdater != null) {
|
if (fProjectionFileUpdater != null) {
|
||||||
fProjectionFileUpdater.uninstall();
|
fProjectionFileUpdater.uninstall();
|
||||||
|
@ -729,9 +721,7 @@ public class AutoconfEditor extends TextEditor implements IAutotoolsEditor, IPro
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
@Override
|
||||||
* @see org.eclipse.ui.texteditor.AbstractTextEditor#performRevert()
|
|
||||||
*/
|
|
||||||
protected void performRevert() {
|
protected void performRevert() {
|
||||||
ProjectionViewer projectionViewer= (ProjectionViewer) getSourceViewer();
|
ProjectionViewer projectionViewer= (ProjectionViewer) getSourceViewer();
|
||||||
projectionViewer.setRedraw(false);
|
projectionViewer.setRedraw(false);
|
||||||
|
|
|
@ -40,9 +40,7 @@ public class AutoconfEditorMacroValidator implements IAutoconfMacroValidator {
|
||||||
fEditor = autoconfEditor;
|
fEditor = autoconfEditor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
@Override
|
||||||
* @see org.eclipse.cdt.autotools.ui.editors.parser.IAutoconfMacroValidator#validateMacroCall(org.eclipse.cdt.autotools.core.ui.editors.parser.AutoconfMacroElement)
|
|
||||||
*/
|
|
||||||
public void validateMacroCall(AutoconfMacroElement macro)
|
public void validateMacroCall(AutoconfMacroElement macro)
|
||||||
throws ParseException, InvalidMacroException {
|
throws ParseException, InvalidMacroException {
|
||||||
AutoconfPrototype p = AutoconfTextHover.getPrototype(macro.getName(), fEditor);
|
AutoconfPrototype p = AutoconfTextHover.getPrototype(macro.getName(), fEditor);
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class AutoconfErrorHandler implements IAutoconfErrorHandler {
|
||||||
private int CDT_WARNING = 1;
|
private int CDT_WARNING = 1;
|
||||||
private int CDT_ERROR = 2;
|
private int CDT_ERROR = 2;
|
||||||
|
|
||||||
private Map<Position, Annotation> annotations = new HashMap<Position, Annotation>();
|
private Map<Position, Annotation> annotations = new HashMap<>();
|
||||||
private AnnotationModel fAnnotationModel;
|
private AnnotationModel fAnnotationModel;
|
||||||
|
|
||||||
public AutoconfErrorHandler(IEditorInput input) {
|
public AutoconfErrorHandler(IEditorInput input) {
|
||||||
|
@ -46,23 +46,24 @@ public class AutoconfErrorHandler implements IAutoconfErrorHandler {
|
||||||
super(annotationType, persist, message);
|
super(annotationType, persist, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setQuickFixable(boolean state) {
|
public void setQuickFixable(boolean state) {
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isQuickFixableStateSet() {
|
public boolean isQuickFixableStateSet() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isQuickFixable() throws AssertionFailedException {
|
public boolean isQuickFixable() throws AssertionFailedException {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
@Override
|
||||||
* @see org.eclipse.cdt.autotools.ui.editors.IAutoconfErrorHandler#handleError(org.eclipse.cdt.autotools.core.ui.editors.parser.ParseException)
|
|
||||||
*/
|
|
||||||
public void handleError(ParseException e) {
|
public void handleError(ParseException e) {
|
||||||
Integer charStart = Integer.valueOf(e.getStartOffset());
|
Integer charStart = Integer.valueOf(e.getStartOffset());
|
||||||
Integer charEnd = Integer.valueOf(e.getEndOffset());
|
Integer charEnd = Integer.valueOf(e.getEndOffset());
|
||||||
|
|
|
@ -26,20 +26,17 @@ public class AutoconfIdentifierRule implements IPredicateRule {
|
||||||
fToken = token;
|
fToken = token;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IToken getSuccessToken() {
|
public IToken getSuccessToken() {
|
||||||
return fToken;
|
return fToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
@Override
|
||||||
* @see IRule#evaluate(ICharacterScanner)
|
|
||||||
*/
|
|
||||||
public IToken evaluate(ICharacterScanner scanner) {
|
public IToken evaluate(ICharacterScanner scanner) {
|
||||||
return evaluate(scanner, false);
|
return evaluate(scanner, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
@Override
|
||||||
* @see IPredicateRule#evaluate(ICharacterScanner, resume)
|
|
||||||
*/
|
|
||||||
public IToken evaluate(ICharacterScanner scanner, boolean resume) {
|
public IToken evaluate(ICharacterScanner scanner, boolean resume) {
|
||||||
int c = scanner.read();
|
int c = scanner.read();
|
||||||
if (Character.isLetterOrDigit((char)c) || fExtraChars.indexOf((char)c) >= 0) {
|
if (Character.isLetterOrDigit((char)c) || fExtraChars.indexOf((char)c) >= 0) {
|
||||||
|
|
|
@ -14,16 +14,12 @@ import org.eclipse.jface.text.rules.IWordDetector;
|
||||||
|
|
||||||
public class AutoconfKeywordDetector implements IWordDetector {
|
public class AutoconfKeywordDetector implements IWordDetector {
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* @see IWordDetector#isWordPart(character)
|
|
||||||
*/
|
|
||||||
public boolean isWordPart(char character) {
|
public boolean isWordPart(char character) {
|
||||||
return (Character.isLetter(character) && Character.isLowerCase(character));
|
return (Character.isLetter(character) && Character.isLowerCase(character));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* @see IWordDetector#isWordStart(char)
|
|
||||||
*/
|
|
||||||
public boolean isWordStart(char character) {
|
public boolean isWordStart(char character) {
|
||||||
return (Character.isLetter(character) && Character.isLowerCase(character));
|
return (Character.isLetter(character) && Character.isLowerCase(character));
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,14 +14,13 @@ import org.eclipse.jface.text.rules.IWordDetector;
|
||||||
|
|
||||||
public class AutoconfM4WordDetector implements IWordDetector {
|
public class AutoconfM4WordDetector implements IWordDetector {
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isWordPart(char c) {
|
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) {
|
public boolean isWordStart(char c) {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return (c == 'm');
|
return (c == 'm');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,11 +36,13 @@ public class AutoconfMacro implements Comparable<Object> {
|
||||||
return (parms.length() > 0);
|
return (parms.length() > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int compareTo(Object x) {
|
public int compareTo(Object x) {
|
||||||
AutoconfMacro y = (AutoconfMacro) x;
|
AutoconfMacro y = (AutoconfMacro) x;
|
||||||
return getName().compareTo(y.getName());
|
return getName().compareTo(y.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean equals(Object x) {
|
public boolean equals(Object x) {
|
||||||
if (x == null)
|
if (x == null)
|
||||||
return false;
|
return false;
|
||||||
|
@ -48,6 +50,7 @@ public class AutoconfMacro implements Comparable<Object> {
|
||||||
return getName().equals(y.getName());
|
return getName().equals(y.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return getName().hashCode();
|
return getName().hashCode();
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ import org.eclipse.swt.graphics.RGB;
|
||||||
|
|
||||||
public class AutoconfMacroCodeScanner extends RuleBasedScanner {
|
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 String[] fPropertyNamesColor;
|
||||||
|
|
||||||
private int quoteLevel;
|
private int quoteLevel;
|
||||||
|
@ -82,7 +82,7 @@ public class AutoconfMacroCodeScanner extends RuleBasedScanner {
|
||||||
IToken ammacro = getToken(ColorManager.AUTOCONF_AMMACRO_COLOR);
|
IToken ammacro = getToken(ColorManager.AUTOCONF_AMMACRO_COLOR);
|
||||||
IToken code = getToken(ColorManager.AUTOCONF_CODESEQ_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.
|
// Add rule for single line comments.
|
||||||
rules.add(new RestrictedEndOfLineRule("dnl", "[]", comment)); //$NON-NLS-1$
|
rules.add(new RestrictedEndOfLineRule("dnl", "[]", comment)); //$NON-NLS-1$
|
||||||
|
@ -131,9 +131,7 @@ public class AutoconfMacroCodeScanner extends RuleBasedScanner {
|
||||||
setRules(result);
|
setRules(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
@Override
|
||||||
* @see ITokenScanner#nextToken()
|
|
||||||
*/
|
|
||||||
public IToken nextToken() {
|
public IToken nextToken() {
|
||||||
int ch = read();
|
int ch = read();
|
||||||
if (ch == '[') {
|
if (ch == '[') {
|
||||||
|
@ -267,9 +265,7 @@ public class AutoconfMacroCodeScanner extends RuleBasedScanner {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
@Override
|
||||||
* @see ICharacterScanner#unread()
|
|
||||||
*/
|
|
||||||
public void unread() {
|
public void unread() {
|
||||||
--fOffset;
|
--fOffset;
|
||||||
fColumn = UNDEFINED;
|
fColumn = UNDEFINED;
|
||||||
|
|
|
@ -46,6 +46,7 @@ public class AutoconfMacroContentAssistProcessor implements
|
||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer,
|
public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer,
|
||||||
int offset) {
|
int offset) {
|
||||||
|
|
||||||
|
@ -62,7 +63,7 @@ public class AutoconfMacroContentAssistProcessor implements
|
||||||
}
|
}
|
||||||
ICompletionProposal[] result = null;
|
ICompletionProposal[] result = null;
|
||||||
if (macros != null) {
|
if (macros != null) {
|
||||||
ArrayList<ICompletionProposal> validList = new ArrayList<ICompletionProposal>();
|
ArrayList<ICompletionProposal> validList = new ArrayList<>();
|
||||||
for (int i = 0; i < macros.length; ++i) {
|
for (int i = 0; i < macros.length; ++i) {
|
||||||
String name = macros[i].getName();
|
String name = macros[i].getName();
|
||||||
if (name.length() >= prefix.length()) {
|
if (name.length() >= prefix.length()) {
|
||||||
|
@ -86,32 +87,37 @@ public class AutoconfMacroContentAssistProcessor implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result = new ICompletionProposal[validList.size()];
|
result = new ICompletionProposal[validList.size()];
|
||||||
result = (ICompletionProposal[])validList.toArray(result);
|
result = validList.toArray(result);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IContextInformation[] computeContextInformation(ITextViewer viewer,
|
public IContextInformation[] computeContextInformation(ITextViewer viewer,
|
||||||
int offset) {
|
int offset) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public char[] getCompletionProposalAutoActivationCharacters() {
|
public char[] getCompletionProposalAutoActivationCharacters() {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public char[] getContextInformationAutoActivationCharacters() {
|
public char[] getContextInformationAutoActivationCharacters() {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IContextInformationValidator getContextInformationValidator() {
|
public IContextInformationValidator getContextInformationValidator() {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return new AutoconfMacroParameterListValidator();
|
return new AutoconfMacroParameterListValidator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getErrorMessage() {
|
public String getErrorMessage() {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -34,9 +34,7 @@ public class AutoconfMacroDamagerRepairer extends DefaultDamagerRepairer {
|
||||||
super(scanner);
|
super(scanner);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
@Override
|
||||||
* @see IPresentationDamager#getDamageRegion(ITypedRegion, DocumentEvent, boolean)
|
|
||||||
*/
|
|
||||||
public IRegion getDamageRegion(ITypedRegion partition, DocumentEvent e, boolean documentPartitioningChanged) {
|
public IRegion getDamageRegion(ITypedRegion partition, DocumentEvent e, boolean documentPartitioningChanged) {
|
||||||
// In the case of a partition with multiline rules, we will punt to
|
// 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
|
// reparse the entire partition because we don't know if the line being
|
||||||
|
@ -46,9 +44,7 @@ public class AutoconfMacroDamagerRepairer extends DefaultDamagerRepairer {
|
||||||
return partition;
|
return partition;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
@Override
|
||||||
* @see IPresentationRepairer#createPresentation(TextPresentation, ITypedRegion)
|
|
||||||
*/
|
|
||||||
public void createPresentation(TextPresentation presentation, ITypedRegion region) {
|
public void createPresentation(TextPresentation presentation, ITypedRegion region) {
|
||||||
|
|
||||||
// int offset = region.getOffset();
|
// int offset = region.getOffset();
|
||||||
|
|
|
@ -39,10 +39,7 @@ public class AutoconfMacroParameterListValidator implements IContextInformationV
|
||||||
public AutoconfMacroParameterListValidator() {
|
public AutoconfMacroParameterListValidator() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* @see IContextInformationValidator#install(IContextInformation, ITextViewer, int)
|
|
||||||
* @see IContextInformationPresenter#install(IContextInformation, ITextViewer, int)
|
|
||||||
*/
|
|
||||||
public void install(IContextInformation info, ITextViewer viewer, int documentPosition) {
|
public void install(IContextInformation info, ITextViewer viewer, int documentPosition) {
|
||||||
|
|
||||||
fPosition= documentPosition;
|
fPosition= documentPosition;
|
||||||
|
@ -130,9 +127,7 @@ public class AutoconfMacroParameterListValidator implements IContextInformationV
|
||||||
return charCount;
|
return charCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* @see IContextInformationValidator#isContextInformationValid(int)
|
|
||||||
*/
|
|
||||||
public boolean isContextInformationValid(int position) {
|
public boolean isContextInformationValid(int position) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -152,9 +147,7 @@ public class AutoconfMacroParameterListValidator implements IContextInformationV
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* @see IContextInformationPresenter#updatePresentation(int, TextPresentation)
|
|
||||||
*/
|
|
||||||
public boolean updatePresentation(int position, TextPresentation presentation) {
|
public boolean updatePresentation(int position, TextPresentation presentation) {
|
||||||
|
|
||||||
int currentParameter= -1;
|
int currentParameter= -1;
|
||||||
|
|
|
@ -45,6 +45,7 @@ public class AutoconfMacroPartitionRule implements IPredicateRule {
|
||||||
m4MacroWordDetector = new AutoconfM4WordDetector();
|
m4MacroWordDetector = new AutoconfM4WordDetector();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IToken getSuccessToken() {
|
public IToken getSuccessToken() {
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
@ -77,12 +78,14 @@ public class AutoconfMacroPartitionRule implements IPredicateRule {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IToken evaluate(ICharacterScanner scanner, boolean resume) {
|
public IToken evaluate(ICharacterScanner scanner, boolean resume) {
|
||||||
// if (resume)
|
// if (resume)
|
||||||
// return Token.UNDEFINED;
|
// return Token.UNDEFINED;
|
||||||
return evaluate(scanner);
|
return evaluate(scanner);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IToken evaluate(ICharacterScanner scanner) {
|
public IToken evaluate(ICharacterScanner scanner) {
|
||||||
int c = scanner.read();
|
int c = scanner.read();
|
||||||
fBuffer.setLength(0);
|
fBuffer.setLength(0);
|
||||||
|
|
|
@ -55,9 +55,7 @@ public class AutoconfMacroProposalContextInformation implements IContextInformat
|
||||||
fInformationDisplayString= informationDisplayString;
|
fInformationDisplayString= informationDisplayString;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
@Override
|
||||||
* @see IContextInformation#equals(Object)
|
|
||||||
*/
|
|
||||||
public boolean equals(Object object) {
|
public boolean equals(Object object) {
|
||||||
if (object instanceof IContextInformation) {
|
if (object instanceof IContextInformation) {
|
||||||
IContextInformation contextInformation= (IContextInformation) object;
|
IContextInformation contextInformation= (IContextInformation) object;
|
||||||
|
@ -69,36 +67,30 @@ public class AutoconfMacroProposalContextInformation implements IContextInformat
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
String combined = fInformationDisplayString.toLowerCase().concat(fContextDisplayString.toLowerCase());
|
String combined = fInformationDisplayString.toLowerCase().concat(fContextDisplayString.toLowerCase());
|
||||||
return combined.hashCode();
|
return combined.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
@Override
|
||||||
* @see IContextInformation#getInformationDisplayString()
|
|
||||||
*/
|
|
||||||
public String getInformationDisplayString() {
|
public String getInformationDisplayString() {
|
||||||
return fInformationDisplayString;
|
return fInformationDisplayString;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
@Override
|
||||||
* @see IContextInformation#getImage()
|
|
||||||
*/
|
|
||||||
public Image getImage() {
|
public Image getImage() {
|
||||||
return fImage;
|
return fImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
@Override
|
||||||
* @see IContextInformation#getContextDisplayString()
|
|
||||||
*/
|
|
||||||
public String getContextDisplayString() {
|
public String getContextDisplayString() {
|
||||||
if (fContextDisplayString != null)
|
if (fContextDisplayString != null)
|
||||||
return fContextDisplayString;
|
return fContextDisplayString;
|
||||||
return fInformationDisplayString;
|
return fInformationDisplayString;
|
||||||
}
|
}
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.text.contentassist.IContextInformationExtension#getContextInformationPosition()
|
@Override
|
||||||
*/
|
|
||||||
public int getContextInformationPosition() {
|
public int getContextInformationPosition() {
|
||||||
return fInformationPosition;
|
return fInformationPosition;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@ public class AutoconfMacroRule implements IRule {
|
||||||
fStartingSequence = startingSequence;
|
fStartingSequence = startingSequence;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IToken evaluate(ICharacterScanner scanner) {
|
public IToken evaluate(ICharacterScanner scanner) {
|
||||||
int c = scanner.read();
|
int c = scanner.read();
|
||||||
fBuffer.setLength(0);
|
fBuffer.setLength(0);
|
||||||
|
|
|
@ -14,11 +14,13 @@ import org.eclipse.jface.text.rules.IWordDetector;
|
||||||
|
|
||||||
public class AutoconfMacroWordDetector implements IWordDetector {
|
public class AutoconfMacroWordDetector implements IWordDetector {
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isWordPart(char c) {
|
public boolean isWordPart(char c) {
|
||||||
return ((Character.isLetter(c) && Character.isUpperCase(c)) ||
|
return ((Character.isLetter(c) && Character.isUpperCase(c)) ||
|
||||||
Character.isDigit(c) || c == '_');
|
Character.isDigit(c) || c == '_');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isWordStart(char c) {
|
public boolean isWordStart(char c) {
|
||||||
return (c == 'A');
|
return (c == 'A');
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,11 +14,13 @@ import org.eclipse.jface.text.rules.IWordDetector;
|
||||||
|
|
||||||
public class AutoconfPKGWordDetector implements IWordDetector {
|
public class AutoconfPKGWordDetector implements IWordDetector {
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isWordPart(char c) {
|
public boolean isWordPart(char c) {
|
||||||
return ((Character.isLetter(c) && Character.isUpperCase(c)) ||
|
return ((Character.isLetter(c) && Character.isUpperCase(c)) ||
|
||||||
Character.isDigit(c) || c == '_');
|
Character.isDigit(c) || c == '_');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isWordStart(char c) {
|
public boolean isWordStart(char c) {
|
||||||
return (c == 'P');
|
return (c == 'P');
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class AutoconfPartitionScanner extends RuleBasedPartitionScanner {
|
||||||
public AutoconfPartitionScanner() {
|
public AutoconfPartitionScanner() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
List<IRule> rules= new ArrayList<IRule>();
|
List<IRule> rules= new ArrayList<>();
|
||||||
Token macro = new Token(AUTOCONF_MACRO);
|
Token macro = new Token(AUTOCONF_MACRO);
|
||||||
Token comment = new Token(AUTOCONF_COMMENT);
|
Token comment = new Token(AUTOCONF_COMMENT);
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ public class AutoconfPartitioner extends FastPartitioner {
|
||||||
// To optionally show partitions, we must do so by overriding the computePartitioning
|
// 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
|
// 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.
|
// at the time and we will end up getting default partitioning from then on.
|
||||||
|
@Override
|
||||||
public ITypedRegion[] computePartitioning(int offset, int length,
|
public ITypedRegion[] computePartitioning(int offset, int length,
|
||||||
boolean includeZeroLength) {
|
boolean includeZeroLength) {
|
||||||
ITypedRegion[] regions = super.computePartitioning(offset, length, includeZeroLength);
|
ITypedRegion[] regions = super.computePartitioning(offset, length, includeZeroLength);
|
||||||
|
|
|
@ -33,6 +33,7 @@ public class AutoconfReconcilingStrategy implements IReconcilingStrategy {
|
||||||
documentProvider = editor.getDocumentProvider();
|
documentProvider = editor.getDocumentProvider();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void reconcile(IRegion partition) {
|
public void reconcile(IRegion partition) {
|
||||||
try {
|
try {
|
||||||
AutoconfParser parser = editor.getAutoconfParser();
|
AutoconfParser parser = editor.getAutoconfParser();
|
||||||
|
@ -45,11 +46,13 @@ public class AutoconfReconcilingStrategy implements IReconcilingStrategy {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void reconcile(DirtyRegion dirtyRegion, IRegion subRegion) {
|
public void reconcile(DirtyRegion dirtyRegion, IRegion subRegion) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setDocument(IDocument document) {
|
public void setDocument(IDocument document) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
|
|
@ -40,16 +40,12 @@ public class AutoconfSourceViewerConfiguration extends
|
||||||
fEditor = editor;
|
fEditor = editor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
@Override
|
||||||
* @see org.eclipse.jface.text.source.SourceViewerConfiguration#getConfiguredDocumentPartitioning(org.eclipse.jface.text.source.ISourceViewer)
|
|
||||||
*/
|
|
||||||
public String getConfiguredDocumentPartitioning(ISourceViewer sourceViewer) {
|
public String getConfiguredDocumentPartitioning(ISourceViewer sourceViewer) {
|
||||||
return AutoconfEditor.AUTOCONF_PARTITIONING;
|
return AutoconfEditor.AUTOCONF_PARTITIONING;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
@Override
|
||||||
* @see org.eclipse.jface.text.source.SourceViewerConfiguration#getContentAssistant(org.eclipse.jface.text.source.ISourceViewer)
|
|
||||||
*/
|
|
||||||
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
|
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
|
||||||
ContentAssistant assistant = new ContentAssistant();
|
ContentAssistant assistant = new ContentAssistant();
|
||||||
|
|
||||||
|
@ -66,39 +62,35 @@ public class AutoconfSourceViewerConfiguration extends
|
||||||
return assistant;
|
return assistant;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
@Override
|
||||||
* Method declared on SourceViewerConfiguration
|
|
||||||
*/
|
|
||||||
public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
|
public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
|
||||||
return new String[] { IDocument.DEFAULT_CONTENT_TYPE,
|
return new String[] { IDocument.DEFAULT_CONTENT_TYPE,
|
||||||
AutoconfPartitionScanner.AUTOCONF_MACRO,
|
AutoconfPartitionScanner.AUTOCONF_MACRO,
|
||||||
AutoconfPartitionScanner.AUTOCONF_COMMENT};
|
AutoconfPartitionScanner.AUTOCONF_COMMENT};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) {
|
public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) {
|
||||||
if (acHover == null)
|
if (acHover == null)
|
||||||
acHover = new AutoconfTextHover(fEditor);
|
acHover = new AutoconfTextHover(fEditor);
|
||||||
return acHover;
|
return acHover;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) {
|
public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) {
|
||||||
if (aaHover == null)
|
if (aaHover == null)
|
||||||
aaHover = new AutoconfAnnotationHover();
|
aaHover = new AutoconfAnnotationHover();
|
||||||
return aaHover;
|
return aaHover;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
@Override
|
||||||
* @see org.eclipse.jface.text.source.SourceViewerConfiguration#getReconciler(org.eclipse.jface.text.source.ISourceViewer)
|
|
||||||
*/
|
|
||||||
public IReconciler getReconciler(ISourceViewer sourceViewer) {
|
public IReconciler getReconciler(ISourceViewer sourceViewer) {
|
||||||
MonoReconciler reconciler= new MonoReconciler(new AutoconfReconcilingStrategy(fEditor), false);
|
MonoReconciler reconciler= new MonoReconciler(new AutoconfReconcilingStrategy(fEditor), false);
|
||||||
reconciler.setDelay(1000);
|
reconciler.setDelay(1000);
|
||||||
reconciler.setProgressMonitor(new NullProgressMonitor());
|
reconciler.setProgressMonitor(new NullProgressMonitor());
|
||||||
return reconciler;
|
return reconciler;
|
||||||
}
|
}
|
||||||
/* (non-Javadoc)
|
@Override
|
||||||
* Method declared on SourceViewerConfiguration
|
|
||||||
*/
|
|
||||||
public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
|
public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
|
||||||
PresentationReconciler reconciler = new PresentationReconciler();
|
PresentationReconciler reconciler = new PresentationReconciler();
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ import org.eclipse.jface.text.rules.IWhitespaceDetector;
|
||||||
|
|
||||||
public class AutoconfWhitespaceDetector implements IWhitespaceDetector {
|
public class AutoconfWhitespaceDetector implements IWhitespaceDetector {
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isWhitespace(char c) {
|
public boolean isWhitespace(char c) {
|
||||||
return (c == ' ' || c == '\t' || c == '\n' || c == '\r');
|
return (c == ' ' || c == '\t' || c == '\n' || c == '\r');
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,16 +17,12 @@ public class AutoconfWordDetector implements IWordDetector {
|
||||||
private static final String correctStartSpecChars = "%*().><"; //$NON-NLS-1$
|
private static final String correctStartSpecChars = "%*().><"; //$NON-NLS-1$
|
||||||
private static final String correctSpecChars = "@$/\\><"; //$NON-NLS-1$
|
private static final String correctSpecChars = "@$/\\><"; //$NON-NLS-1$
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* @see IWordDetector#isWordPart(character)
|
|
||||||
*/
|
|
||||||
public boolean isWordPart(char character) {
|
public boolean isWordPart(char character) {
|
||||||
return Character.isLetterOrDigit(character) || (correctSpecChars.indexOf(character) >= 0);
|
return Character.isLetterOrDigit(character) || (correctSpecChars.indexOf(character) >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* @see IWordDetector#isWordStart(char)
|
|
||||||
*/
|
|
||||||
public boolean isWordStart(char character) {
|
public boolean isWordStart(char character) {
|
||||||
return Character.isLetterOrDigit(character) || (correctStartSpecChars.indexOf(character) >= 0);
|
return Character.isLetterOrDigit(character) || (correctStartSpecChars.indexOf(character) >= 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,6 +60,7 @@ public class InlineDataRule implements IRule {
|
||||||
scanner.unread();
|
scanner.unread();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public IToken evaluate(ICharacterScanner scanner) {
|
public IToken evaluate(ICharacterScanner scanner) {
|
||||||
int c = scanner.read();
|
int c = scanner.read();
|
||||||
fBuffer.setLength(0);
|
fBuffer.setLength(0);
|
||||||
|
|
|
@ -29,9 +29,7 @@ public class MultilineRuleDamagerRepairer extends DefaultDamagerRepairer {
|
||||||
super(scanner);
|
super(scanner);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
@Override
|
||||||
* @see IPresentationDamager#getDamageRegion(ITypedRegion, DocumentEvent, boolean)
|
|
||||||
*/
|
|
||||||
public IRegion getDamageRegion(ITypedRegion partition, DocumentEvent e, boolean documentPartitioningChanged) {
|
public IRegion getDamageRegion(ITypedRegion partition, DocumentEvent e, boolean documentPartitioningChanged) {
|
||||||
// In the case of a partition with multiline rules, we will punt to
|
// 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
|
// reparse the entire partition because we don't know if the line being
|
||||||
|
|
|
@ -30,6 +30,7 @@ public class ParseException extends Exception {
|
||||||
public void setLineNumber(int lineNumber) {
|
public void setLineNumber(int lineNumber) {
|
||||||
this.lineNumber = lineNumber;
|
this.lineNumber = lineNumber;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public String getMessage() {
|
public String getMessage() {
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ public class RecursiveSingleLineRule extends SingleLineRule {
|
||||||
super(startSequence, endSequence, token, escapeCharacter, breaksOnEOF);
|
super(startSequence, endSequence, token, escapeCharacter, breaksOnEOF);
|
||||||
this.startSequence = startSequence;
|
this.startSequence = startSequence;
|
||||||
this.endSequence = endSequence;
|
this.endSequence = endSequence;
|
||||||
rules = new ArrayList<IRule>();
|
rules = new ArrayList<>();
|
||||||
startIndex = 0;
|
startIndex = 0;
|
||||||
endIndex = 0;
|
endIndex = 0;
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ public class RecursiveSingleLineRule extends SingleLineRule {
|
||||||
super(startSequence, endSequence, token, escapeCharacter, breaksOnEOF, escapeContinuesLine);
|
super(startSequence, endSequence, token, escapeCharacter, breaksOnEOF, escapeContinuesLine);
|
||||||
this.startSequence = startSequence;
|
this.startSequence = startSequence;
|
||||||
this.endSequence = endSequence;
|
this.endSequence = endSequence;
|
||||||
rules = new ArrayList<IRule>();
|
rules = new ArrayList<>();
|
||||||
startIndex = 0;
|
startIndex = 0;
|
||||||
endIndex = 0;
|
endIndex = 0;
|
||||||
}
|
}
|
||||||
|
@ -108,6 +108,7 @@ public class RecursiveSingleLineRule extends SingleLineRule {
|
||||||
rules.add(rule);
|
rules.add(rule);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IToken getSuccessToken() {
|
public IToken getSuccessToken() {
|
||||||
// We need to be aware of what success token we are referring to.
|
// We need to be aware of what success token we are referring to.
|
||||||
// The current internal rule index will help us determine which
|
// The current internal rule index will help us determine which
|
||||||
|
@ -125,6 +126,7 @@ public class RecursiveSingleLineRule extends SingleLineRule {
|
||||||
scanner.unread();
|
scanner.unread();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IToken evaluate(ICharacterScanner scanner, boolean resume) {
|
public IToken evaluate(ICharacterScanner scanner, boolean resume) {
|
||||||
int column = scanner.getColumn();
|
int column = scanner.getColumn();
|
||||||
// Check if we are at EOF, in which case rules don't hold
|
// Check if we are at EOF, in which case rules don't hold
|
||||||
|
|
|
@ -71,7 +71,7 @@ public class RestrictedEndOfLineRule extends EndOfLineRule {
|
||||||
super(startSequence, token, escapeCharacter, breaksOnEOF);
|
super(startSequence, token, escapeCharacter, breaksOnEOF);
|
||||||
this.startSequence = startSequence;
|
this.startSequence = startSequence;
|
||||||
this.restrictedChars = restrictedChars;
|
this.restrictedChars = restrictedChars;
|
||||||
rules = new ArrayList<IRule>();
|
rules = new ArrayList<>();
|
||||||
startIndex = 0;
|
startIndex = 0;
|
||||||
endIndex = 0;
|
endIndex = 0;
|
||||||
}
|
}
|
||||||
|
@ -88,6 +88,7 @@ public class RestrictedEndOfLineRule extends EndOfLineRule {
|
||||||
scanner.unread();
|
scanner.unread();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IToken evaluate(ICharacterScanner scanner, boolean resume) {
|
public IToken evaluate(ICharacterScanner scanner, boolean resume) {
|
||||||
int column = scanner.getColumn();
|
int column = scanner.getColumn();
|
||||||
// Check if we are at EOF, in which case rules don't hold
|
// Check if we are at EOF, in which case rules don't hold
|
||||||
|
|
|
@ -43,7 +43,7 @@ public class AutoconfContentOutlinePage extends ContentOutlinePage {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ISelection updateSelection(ISelection sel) {
|
protected ISelection updateSelection(ISelection sel) {
|
||||||
ArrayList<AutoconfElement> newSelection= new ArrayList<AutoconfElement>();
|
ArrayList<AutoconfElement> newSelection= new ArrayList<>();
|
||||||
if (sel instanceof IStructuredSelection) {
|
if (sel instanceof IStructuredSelection) {
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
Iterator iter= ((IStructuredSelection)sel).iterator();
|
Iterator iter= ((IStructuredSelection)sel).iterator();
|
||||||
|
@ -69,6 +69,7 @@ public class AutoconfContentOutlinePage extends ContentOutlinePage {
|
||||||
if (control != null && !control.isDisposed())
|
if (control != null && !control.isDisposed())
|
||||||
{
|
{
|
||||||
control.getDisplay().asyncExec(new Runnable() {
|
control.getDisplay().asyncExec(new Runnable() {
|
||||||
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (!control.isDisposed()) {
|
if (!control.isDisposed()) {
|
||||||
// control.setRedraw(false);
|
// control.setRedraw(false);
|
||||||
|
@ -86,6 +87,7 @@ public class AutoconfContentOutlinePage extends ContentOutlinePage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void createControl(Composite parent) {
|
public void createControl(Composite parent) {
|
||||||
|
|
||||||
super.createControl(parent);
|
super.createControl(parent);
|
||||||
|
@ -102,6 +104,7 @@ public class AutoconfContentOutlinePage extends ContentOutlinePage {
|
||||||
/*
|
/*
|
||||||
* Change in selection
|
* Change in selection
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void selectionChanged(SelectionChangedEvent event)
|
public void selectionChanged(SelectionChangedEvent event)
|
||||||
{
|
{
|
||||||
super.selectionChanged(event);
|
super.selectionChanged(event);
|
||||||
|
|
|
@ -36,11 +36,13 @@ public class AutoconfContentProvider implements ITreeContentProvider {
|
||||||
this.documentProvider = editor.getDocumentProvider();
|
this.documentProvider = editor.getDocumentProvider();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
|
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
|
||||||
if (oldInput != null)
|
if (oldInput != null)
|
||||||
{
|
{
|
||||||
|
@ -69,6 +71,7 @@ public class AutoconfContentProvider implements ITreeContentProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object[] getChildren(Object parentElement) {
|
public Object[] getChildren(Object parentElement) {
|
||||||
if (parentElement instanceof AutoconfElement) {
|
if (parentElement instanceof AutoconfElement) {
|
||||||
AutoconfElement element = (AutoconfElement)parentElement;
|
AutoconfElement element = (AutoconfElement)parentElement;
|
||||||
|
@ -77,10 +80,12 @@ public class AutoconfContentProvider implements ITreeContentProvider {
|
||||||
return new Object[0];
|
return new Object[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object getParent(Object element) {
|
public Object getParent(Object element) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasChildren(Object element) {
|
public boolean hasChildren(Object element) {
|
||||||
if (element instanceof AutoconfElement) {
|
if (element instanceof AutoconfElement) {
|
||||||
return ((AutoconfElement)element).hasChildren();
|
return ((AutoconfElement)element).hasChildren();
|
||||||
|
@ -88,6 +93,7 @@ public class AutoconfContentProvider implements ITreeContentProvider {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object[] getElements(Object inputElement) {
|
public Object[] getElements(Object inputElement) {
|
||||||
return this.getChildren(editor.getRootElement());
|
return this.getChildren(editor.getRootElement());
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,19 +35,24 @@ public class AutoconfLabelProvider implements ILabelProvider {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void addListener(ILabelProviderListener listener) {
|
public void addListener(ILabelProviderListener listener) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isLabelProperty(Object element, String property) {
|
public boolean isLabelProperty(Object element, String property) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void removeListener(ILabelProviderListener listener) {
|
public void removeListener(ILabelProviderListener listener) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Image getImage(Object element) {
|
public Image getImage(Object element) {
|
||||||
if (element instanceof AutoconfIfElement)
|
if (element instanceof AutoconfIfElement)
|
||||||
return AutotoolsUIPluginImages.get(AutotoolsUIPluginImages.IMG_OBJS_IF);
|
return AutotoolsUIPluginImages.get(AutotoolsUIPluginImages.IMG_OBJS_IF);
|
||||||
|
@ -74,6 +79,7 @@ public class AutoconfLabelProvider implements ILabelProvider {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getText(Object element) {
|
public String getText(Object element) {
|
||||||
if (element instanceof AutoconfElement) {
|
if (element instanceof AutoconfElement) {
|
||||||
AutoconfElement e = (AutoconfElement)element;
|
AutoconfElement e = (AutoconfElement)element;
|
||||||
|
|
|
@ -34,16 +34,17 @@ public class AutoconfElement {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.var = var;
|
this.var = var;
|
||||||
this.startOffset = 0;
|
this.startOffset = 0;
|
||||||
this.children = new ArrayList<AutoconfElement>();
|
this.children = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
String source = getSource();
|
String source = getSource();
|
||||||
if (source == null) {
|
if (source == null) {
|
||||||
StringBuffer kids = new StringBuffer();
|
StringBuffer kids = new StringBuffer();
|
||||||
for (Iterator<AutoconfElement> iterator = children.iterator(); iterator.hasNext();) {
|
for (Iterator<AutoconfElement> iterator = children.iterator(); iterator.hasNext();) {
|
||||||
AutoconfElement kid = (AutoconfElement) iterator.next();
|
AutoconfElement kid = iterator.next();
|
||||||
kids.append(kid.toString());
|
kids.append(kid.toString());
|
||||||
kids.append(","); //$NON-NLS-1$
|
kids.append(","); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
@ -64,7 +65,7 @@ public class AutoconfElement {
|
||||||
|
|
||||||
public AutoconfElement getLastChild() {
|
public AutoconfElement getLastChild() {
|
||||||
if (hasChildren())
|
if (hasChildren())
|
||||||
return (AutoconfElement)children.get(children.size() - 1);
|
return children.get(children.size() - 1);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +78,7 @@ public class AutoconfElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
public AutoconfElement[] getChildren() {
|
public AutoconfElement[] getChildren() {
|
||||||
return (AutoconfElement[]) children.toArray(new AutoconfElement[children.size()]);
|
return children.toArray(new AutoconfElement[children.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasChildren() {
|
public boolean hasChildren() {
|
||||||
|
|
|
@ -26,6 +26,7 @@ public class AutoconfMacroArgumentElement extends AutoconfElement {
|
||||||
public AutoconfMacroArgumentElement(String name) {
|
public AutoconfMacroArgumentElement(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public String getVar() {
|
public String getVar() {
|
||||||
return super.getVar();
|
return super.getVar();
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,16 +14,11 @@ package org.eclipse.cdt.autotools.ui.editors.parser;
|
||||||
|
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class AutoconfMacroDetector implements IAutoconfMacroDetector {
|
public class AutoconfMacroDetector implements IAutoconfMacroDetector {
|
||||||
|
|
||||||
private static final Pattern AUTOCONF_MACRO_PATTERN = Pattern.compile("PKG_.*|AC_.*|AM_.*|m4.*"); //$NON-NLS-1$
|
private static final Pattern AUTOCONF_MACRO_PATTERN = Pattern.compile("PKG_.*|AC_.*|AM_.*|m4.*"); //$NON-NLS-1$
|
||||||
|
|
||||||
/* (non-Javadoc)
|
@Override
|
||||||
* @see org.eclipse.cdt.autotools.core.ui.editors.parser.IAutoconfMacroDetector#isMacroIdentifier(java.lang.String)
|
|
||||||
*/
|
|
||||||
public boolean isMacroIdentifier(String name) {
|
public boolean isMacroIdentifier(String name) {
|
||||||
return AUTOCONF_MACRO_PATTERN.matcher(name).matches();
|
return AUTOCONF_MACRO_PATTERN.matcher(name).matches();
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ public class AutoconfMacroElement extends AutoconfElement {
|
||||||
super(name);
|
super(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getVar() {
|
public String getVar() {
|
||||||
if (children.size() > 0)
|
if (children.size() > 0)
|
||||||
return getParameter(0);
|
return getParameter(0);
|
||||||
|
@ -33,7 +34,7 @@ public class AutoconfMacroElement extends AutoconfElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getParameter(int num) {
|
public String getParameter(int num) {
|
||||||
return ((AutoconfElement) children.get(num)).getName();
|
return children.get(num).getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class AutoconfOutlineErrorHandler {
|
||||||
|
|
||||||
int lineNumber = e.getLineNumber();
|
int lineNumber = e.getLineNumber();
|
||||||
|
|
||||||
Map<String, Object> map = new HashMap<String, Object>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
MarkerUtilities.setLineNumber(map, lineNumber);
|
MarkerUtilities.setLineNumber(map, lineNumber);
|
||||||
MarkerUtilities.setMessage(map, e.getMessage());
|
MarkerUtilities.setMessage(map, e.getMessage());
|
||||||
map.put(IMarker.MESSAGE, e.getMessage());
|
map.put(IMarker.MESSAGE, e.getMessage());
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class AutoconfParser {
|
||||||
"format incr decr eval syscmd esyscmd sysval mkstemp maketemp errprint m4exit " + //$NON-NLS-1$
|
"format incr decr eval syscmd esyscmd sysval mkstemp maketemp errprint m4exit " + //$NON-NLS-1$
|
||||||
"__file__ __line__ __program__ "; //$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 {
|
static {
|
||||||
m4builtins.addAll(Arrays.asList(M4_BUILTINS.split(" "))); //$NON-NLS-1$
|
m4builtins.addAll(Arrays.asList(M4_BUILTINS.split(" "))); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
@ -252,7 +252,7 @@ public class AutoconfParser {
|
||||||
else
|
else
|
||||||
exp = "do";
|
exp = "do";
|
||||||
|
|
||||||
handleError(block, token, AutoconfEditorMessages.getFormattedString(MISSING_SPECIFIER, exp));
|
handleError(token, AutoconfEditorMessages.getFormattedString(MISSING_SPECIFIER, exp));
|
||||||
|
|
||||||
// assume we're still in the block...
|
// assume we're still in the block...
|
||||||
tokenizer.unreadToken(token);
|
tokenizer.unreadToken(token);
|
||||||
|
@ -332,7 +332,7 @@ public class AutoconfParser {
|
||||||
setSourceEnd(block, token);
|
setSourceEnd(block, token);
|
||||||
|
|
||||||
if (token.getType() != ITokenConstants.SH_ESAC) {
|
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:
|
case ITokenConstants.EOF:
|
||||||
AutoconfElement element = parent;
|
AutoconfElement element = parent;
|
||||||
while (element != null && !(element instanceof AutoconfRootElement)) {
|
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();
|
element = element.getParent();
|
||||||
}
|
}
|
||||||
throw new BlockEndCondition(token);
|
throw new BlockEndCondition(token);
|
||||||
|
@ -443,12 +443,12 @@ public class AutoconfParser {
|
||||||
// being tolerant of nesting problems by allowing
|
// being tolerant of nesting problems by allowing
|
||||||
// stranded else/elif nodes but reporting errors.
|
// stranded else/elif nodes but reporting errors.
|
||||||
case ITokenConstants.SH_IF:
|
case ITokenConstants.SH_IF:
|
||||||
checkLineStart(parent, token, atStart);
|
checkLineStart(token, atStart);
|
||||||
parseBlock(parent, token, new AutoconfIfElement());
|
parseBlock(parent, token, new AutoconfIfElement());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ITokenConstants.SH_ELIF:
|
case ITokenConstants.SH_ELIF:
|
||||||
checkLineStart(parent, token, atStart);
|
checkLineStart(token, atStart);
|
||||||
checkBlockValidity(
|
checkBlockValidity(
|
||||||
parent, token,
|
parent, token,
|
||||||
new Class[] { AutoconfIfElement.class, AutoconfElifElement.class },
|
new Class[] { AutoconfIfElement.class, AutoconfElifElement.class },
|
||||||
|
@ -458,7 +458,7 @@ public class AutoconfParser {
|
||||||
throw new BlockEndCondition(token);
|
throw new BlockEndCondition(token);
|
||||||
|
|
||||||
case ITokenConstants.SH_ELSE:
|
case ITokenConstants.SH_ELSE:
|
||||||
checkLineStart(parent, token, atStart);
|
checkLineStart(token, atStart);
|
||||||
checkBlockValidity(
|
checkBlockValidity(
|
||||||
parent, token,
|
parent, token,
|
||||||
new Class[] { AutoconfIfElement.class, AutoconfElifElement.class },
|
new Class[] { AutoconfIfElement.class, AutoconfElifElement.class },
|
||||||
|
@ -468,7 +468,7 @@ public class AutoconfParser {
|
||||||
throw new BlockEndCondition(token);
|
throw new BlockEndCondition(token);
|
||||||
|
|
||||||
case ITokenConstants.SH_FI:
|
case ITokenConstants.SH_FI:
|
||||||
checkLineStart(parent, token, atStart);
|
checkLineStart(token, atStart);
|
||||||
checkBlockValidity(
|
checkBlockValidity(
|
||||||
parent, token,
|
parent, token,
|
||||||
new Class[] { AutoconfIfElement.class, AutoconfElifElement.class, AutoconfElseElement.class },
|
new Class[] { AutoconfIfElement.class, AutoconfElifElement.class, AutoconfElseElement.class },
|
||||||
|
@ -478,27 +478,27 @@ public class AutoconfParser {
|
||||||
|
|
||||||
// 4. Look for for/while loops
|
// 4. Look for for/while loops
|
||||||
case ITokenConstants.SH_FOR:
|
case ITokenConstants.SH_FOR:
|
||||||
checkLineStart(parent, token, atStart);
|
checkLineStart(token, atStart);
|
||||||
parseBlock(parent, token, new AutoconfForElement());
|
parseBlock(parent, token, new AutoconfForElement());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ITokenConstants.SH_WHILE:
|
case ITokenConstants.SH_WHILE:
|
||||||
checkLineStart(parent, token, atStart);
|
checkLineStart(token, atStart);
|
||||||
parseBlock(parent, token, new AutoconfWhileElement());
|
parseBlock(parent, token, new AutoconfWhileElement());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ITokenConstants.SH_UNTIL:
|
case ITokenConstants.SH_UNTIL:
|
||||||
checkLineStart(parent, token, atStart);
|
checkLineStart(token, atStart);
|
||||||
parseBlock(parent, token, new AutoconfUntilElement());
|
parseBlock(parent, token, new AutoconfUntilElement());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ITokenConstants.SH_SELECT:
|
case ITokenConstants.SH_SELECT:
|
||||||
checkLineStart(parent, token, atStart);
|
checkLineStart(token, atStart);
|
||||||
parseBlock(parent, token, new AutoconfSelectElement());
|
parseBlock(parent, token, new AutoconfSelectElement());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ITokenConstants.SH_DONE:
|
case ITokenConstants.SH_DONE:
|
||||||
checkLineStart(parent, token, atStart);
|
checkLineStart(token, atStart);
|
||||||
checkBlockValidity(
|
checkBlockValidity(
|
||||||
parent, token,
|
parent, token,
|
||||||
new Class[] { AutoconfForElement.class, AutoconfWhileElement.class,
|
new Class[] { AutoconfForElement.class, AutoconfWhileElement.class,
|
||||||
|
@ -508,7 +508,7 @@ public class AutoconfParser {
|
||||||
|
|
||||||
// 5. Look for case statements
|
// 5. Look for case statements
|
||||||
case ITokenConstants.SH_CASE:
|
case ITokenConstants.SH_CASE:
|
||||||
checkLineStart(parent, token, atStart);
|
checkLineStart(token, atStart);
|
||||||
parseCaseBlock(parent, token, new AutoconfCaseElement());
|
parseCaseBlock(parent, token, new AutoconfCaseElement());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -520,7 +520,7 @@ public class AutoconfParser {
|
||||||
throw new BlockEndCondition(token);
|
throw new BlockEndCondition(token);
|
||||||
|
|
||||||
case ITokenConstants.SH_ESAC:
|
case ITokenConstants.SH_ESAC:
|
||||||
checkLineStart(parent, token, atStart);
|
checkLineStart(token, atStart);
|
||||||
checkBlockValidity(
|
checkBlockValidity(
|
||||||
parent, token,
|
parent, token,
|
||||||
// note: we don't strictly recurse here, so accept either parent
|
// 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) {
|
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) {
|
private void parseHERE(AutoconfElement parent, Token controlToken) {
|
||||||
Token token = tokenizer.readToken();
|
Token token = tokenizer.readToken();
|
||||||
if (token.getType() == ITokenConstants.EOL || token.getType() == ITokenConstants.EOF) {
|
if (token.getType() == ITokenConstants.EOL || token.getType() == ITokenConstants.EOF) {
|
||||||
handleError(parent, token,
|
handleError(token, AutoconfEditorMessages.getString(INCOMPLETE_INLINE_MARKER));
|
||||||
AutoconfEditorMessages.getString(INCOMPLETE_INLINE_MARKER));
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
String hereTag = token.getText();
|
String hereTag = token.getText();
|
||||||
|
@ -564,7 +563,7 @@ public class AutoconfParser {
|
||||||
while (true) {
|
while (true) {
|
||||||
token = tokenizer.readToken();
|
token = tokenizer.readToken();
|
||||||
if (token.getType() == ITokenConstants.EOF) {
|
if (token.getType() == ITokenConstants.EOF) {
|
||||||
handleError(parent, token, AutoconfEditorMessages.getFormattedString(UNTERMINATED_CONSTRUCT, parent.getName()));
|
handleError(token, AutoconfEditorMessages.getFormattedString(UNTERMINATED_CONSTRUCT, parent.getName()));
|
||||||
break;
|
break;
|
||||||
} else if (token.getType() == ITokenConstants.EOL) {
|
} else if (token.getType() == ITokenConstants.EOL) {
|
||||||
atEOL = true;
|
atEOL = true;
|
||||||
|
@ -630,7 +629,7 @@ public class AutoconfParser {
|
||||||
// 5. Abort on unexpected tokens
|
// 5. Abort on unexpected tokens
|
||||||
case ITokenConstants.SH_DO:
|
case ITokenConstants.SH_DO:
|
||||||
case ITokenConstants.SH_THEN:
|
case ITokenConstants.SH_THEN:
|
||||||
handleError(parent, token, AutoconfEditorMessages.getFormattedString(INVALID_SPECIFIER, token.getText()));
|
handleError(token, AutoconfEditorMessages.getFormattedString(INVALID_SPECIFIER, token.getText()));
|
||||||
tokenizer.unreadToken(token);
|
tokenizer.unreadToken(token);
|
||||||
// close enough...
|
// close enough...
|
||||||
return token;
|
return token;
|
||||||
|
@ -644,7 +643,7 @@ public class AutoconfParser {
|
||||||
case ITokenConstants.SH_ELSE:
|
case ITokenConstants.SH_ELSE:
|
||||||
case ITokenConstants.SH_FI:
|
case ITokenConstants.SH_FI:
|
||||||
case ITokenConstants.SH_DONE:
|
case ITokenConstants.SH_DONE:
|
||||||
handleError(parent, token, AutoconfEditorMessages.getFormattedString(UNTERMINATED_CONSTRUCT, parent.getName()));
|
handleError(token, AutoconfEditorMessages.getFormattedString(UNTERMINATED_CONSTRUCT, parent.getName()));
|
||||||
tokenizer.unreadToken(token);
|
tokenizer.unreadToken(token);
|
||||||
throw new BlockEndCondition(token);
|
throw new BlockEndCondition(token);
|
||||||
}
|
}
|
||||||
|
@ -684,7 +683,7 @@ public class AutoconfParser {
|
||||||
// 4. Abort on unexpected tokens
|
// 4. Abort on unexpected tokens
|
||||||
else switch (token.getType()) {
|
else switch (token.getType()) {
|
||||||
case ITokenConstants.SH_THEN:
|
case ITokenConstants.SH_THEN:
|
||||||
handleError(parent, token, AutoconfEditorMessages.getFormattedString(INVALID_SPECIFIER, token.getText()));
|
handleError(token, AutoconfEditorMessages.getFormattedString(INVALID_SPECIFIER, token.getText()));
|
||||||
tokenizer.unreadToken(token);
|
tokenizer.unreadToken(token);
|
||||||
// close enough...
|
// close enough...
|
||||||
//throw new ExprEndCondition(token);
|
//throw new ExprEndCondition(token);
|
||||||
|
@ -699,7 +698,7 @@ public class AutoconfParser {
|
||||||
case ITokenConstants.SH_ELSE:
|
case ITokenConstants.SH_ELSE:
|
||||||
case ITokenConstants.SH_FI:
|
case ITokenConstants.SH_FI:
|
||||||
case ITokenConstants.SH_DONE:
|
case ITokenConstants.SH_DONE:
|
||||||
handleError(parent, token, AutoconfEditorMessages.getFormattedString(UNTERMINATED_CONSTRUCT, parent.getName()));
|
handleError(token, AutoconfEditorMessages.getFormattedString(UNTERMINATED_CONSTRUCT, parent.getName()));
|
||||||
tokenizer.unreadToken(token);
|
tokenizer.unreadToken(token);
|
||||||
throw new BlockEndCondition(token);
|
throw new BlockEndCondition(token);
|
||||||
}
|
}
|
||||||
|
@ -746,9 +745,9 @@ public class AutoconfParser {
|
||||||
case ITokenConstants.SH_DO:
|
case ITokenConstants.SH_DO:
|
||||||
case ITokenConstants.SH_THEN:
|
case ITokenConstants.SH_THEN:
|
||||||
if (parent instanceof AutoconfCaseElement)
|
if (parent instanceof AutoconfCaseElement)
|
||||||
handleError(parent, token, AutoconfEditorMessages.getString(INVALID_IN));
|
handleError(token, AutoconfEditorMessages.getString(INVALID_IN));
|
||||||
else
|
else
|
||||||
handleError(parent, token, AutoconfEditorMessages.getString(IMPROPER_CASE_CONDITION));
|
handleError(token, AutoconfEditorMessages.getString(IMPROPER_CASE_CONDITION));
|
||||||
// close enough...
|
// close enough...
|
||||||
return token;
|
return token;
|
||||||
|
|
||||||
|
@ -761,7 +760,7 @@ public class AutoconfParser {
|
||||||
case ITokenConstants.SH_ELSE:
|
case ITokenConstants.SH_ELSE:
|
||||||
case ITokenConstants.SH_FI:
|
case ITokenConstants.SH_FI:
|
||||||
case ITokenConstants.SH_DONE:
|
case ITokenConstants.SH_DONE:
|
||||||
handleError(parent, token, AutoconfEditorMessages.getFormattedString(UNTERMINATED_CONSTRUCT, parent.getName()));
|
handleError(token, AutoconfEditorMessages.getFormattedString(UNTERMINATED_CONSTRUCT, parent.getName()));
|
||||||
tokenizer.unreadToken(token);
|
tokenizer.unreadToken(token);
|
||||||
throw new BlockEndCondition(token);
|
throw new BlockEndCondition(token);
|
||||||
}
|
}
|
||||||
|
@ -789,8 +788,7 @@ public class AutoconfParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
// not a match
|
// not a match
|
||||||
handleError(parent, token,
|
handleError(token, AutoconfEditorMessages.getFormattedString(errorMessage, parent.getName(), token.getText()));
|
||||||
AutoconfEditorMessages.getFormattedString(errorMessage, parent.getName(), token.getText()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -879,7 +877,7 @@ public class AutoconfParser {
|
||||||
&& !(parent instanceof AutoconfForElement)) {
|
&& !(parent instanceof AutoconfForElement)) {
|
||||||
Token peek = tokenizer.peekToken();
|
Token peek = tokenizer.peekToken();
|
||||||
if (peek.getType() == ITokenConstants.RPAREN) {
|
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) {
|
private void validateMacroParameterCount(AutoconfMacroElement macro, Token token, int count) {
|
||||||
if (macro.getParameterCount() < count) {
|
if (macro.getParameterCount() < count) {
|
||||||
handleError(macro, token, AutoconfEditorMessages.getFormattedString("M4MacroArgsTooFew",
|
handleError(token, AutoconfEditorMessages.getFormattedString("M4MacroArgsTooFew",
|
||||||
macro.getName(), Integer.valueOf(2))); //$NON-NLS-1$
|
macro.getName(), Integer.valueOf(2))); //$NON-NLS-1$
|
||||||
} else if (macro.getParameterCount() > count) {
|
} else if (macro.getParameterCount() > count) {
|
||||||
handleError(macro, token, AutoconfEditorMessages.getFormattedString("M4MacroArgsTooMany",
|
handleError(token, AutoconfEditorMessages.getFormattedString("M4MacroArgsTooMany",
|
||||||
macro.getName(), Integer.valueOf(2))); //$NON-NLS-1$
|
macro.getName(), Integer.valueOf(2))); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -911,7 +909,7 @@ public class AutoconfParser {
|
||||||
|
|
||||||
Token token = tokenizer.readToken();
|
Token token = tokenizer.readToken();
|
||||||
if (token.getType() == ITokenConstants.LPAREN) {
|
if (token.getType() == ITokenConstants.LPAREN) {
|
||||||
token = parseMacroArguments(macro, token);
|
token = parseMacroArguments(macro);
|
||||||
setSourceEnd(macro, token);
|
setSourceEnd(macro, token);
|
||||||
} else {
|
} else {
|
||||||
tokenizer.unreadToken(token);
|
tokenizer.unreadToken(token);
|
||||||
|
@ -940,7 +938,7 @@ public class AutoconfParser {
|
||||||
* @param macro
|
* @param macro
|
||||||
* @return final token (')')
|
* @return final token (')')
|
||||||
*/
|
*/
|
||||||
protected Token parseMacroArguments(AutoconfMacroElement macro, Token lparen) {
|
protected Token parseMacroArguments(AutoconfMacroElement macro) {
|
||||||
Token argStart = null;
|
Token argStart = null;
|
||||||
Token argEnd = null;
|
Token argEnd = null;
|
||||||
Token token;
|
Token token;
|
||||||
|
@ -1009,7 +1007,7 @@ public class AutoconfParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (token.getType() != ITokenConstants.RPAREN) {
|
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
|
// note: moved 15-char truncation to AutoconfLabelProvider
|
||||||
|
@ -1022,13 +1020,13 @@ public class AutoconfParser {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected void handleError(AutoconfElement element, Token token, String message) {
|
protected void handleError(Token token, String message) {
|
||||||
handleMessage(element, token, message, IMarker.SEVERITY_ERROR);
|
handleMessage(token, message, IMarker.SEVERITY_ERROR);
|
||||||
}
|
}
|
||||||
protected void handleWarning(AutoconfElement element, Token token, String message) {
|
protected void handleWarning(Token token, String message) {
|
||||||
handleMessage(element, token, message, IMarker.SEVERITY_WARNING);
|
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) {
|
if (errorHandler != null) {
|
||||||
int lineNumber = 0;
|
int lineNumber = 0;
|
||||||
int startColumn = 0;
|
int startColumn = 0;
|
||||||
|
|
|
@ -32,6 +32,7 @@ public class ParseException extends Exception {
|
||||||
public void setLineNumber(int lineNumber) {
|
public void setLineNumber(int lineNumber) {
|
||||||
this.lineNumber = lineNumber;
|
this.lineNumber = lineNumber;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public String getMessage() {
|
public String getMessage() {
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,6 +50,7 @@ public class Token implements ITokenConstants {
|
||||||
this.length = length;
|
this.length = length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ import org.eclipse.cdt.managedbuilder.ui.properties.AbstractCBuildPropertyTab;
|
||||||
public abstract class AbstractAutotoolsCPropertyTab extends
|
public abstract class AbstractAutotoolsCPropertyTab extends
|
||||||
AbstractCBuildPropertyTab {
|
AbstractCBuildPropertyTab {
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isIndexerAffected() {
|
public boolean isIndexerAffected() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ public class Console implements IConsole {
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
|
|
||||||
|
@Override
|
||||||
public void start(IProject project ) {
|
public void start(IProject project ) {
|
||||||
this.project = project;
|
this.project = project;
|
||||||
fConsoleManager.getConsole(project).start(project);
|
fConsoleManager.getConsole(project).start(project);
|
||||||
|
@ -43,14 +44,17 @@ public class Console implements IConsole {
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
* @see org.eclipse.cdt.core.resources.IConsole#getOutputStream()
|
* @see org.eclipse.cdt.core.resources.IConsole#getOutputStream()
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public ConsoleOutputStream getOutputStream() throws CoreException {
|
public ConsoleOutputStream getOutputStream() throws CoreException {
|
||||||
return fConsoleManager.getConsole(project).getOutputStream();
|
return fConsoleManager.getConsole(project).getOutputStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ConsoleOutputStream getInfoStream() throws CoreException {
|
public ConsoleOutputStream getInfoStream() throws CoreException {
|
||||||
return fConsoleManager.getConsole(project).getInfoStream();
|
return fConsoleManager.getConsole(project).getInfoStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ConsoleOutputStream getErrorStream() throws CoreException {
|
public ConsoleOutputStream getErrorStream() throws CoreException {
|
||||||
return fConsoleManager.getConsole(project).getErrorStream();
|
return fConsoleManager.getConsole(project).getErrorStream();
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,11 +34,7 @@ public class ErrorParserBlock extends AbstractErrorParserBlock {
|
||||||
fPrefs = preferences;
|
fPrefs = preferences;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
@Override
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
|
|
||||||
*/
|
|
||||||
public void createControl(Composite parent) {
|
public void createControl(Composite parent) {
|
||||||
|
|
||||||
if (useBuildInfo == true && fBuildInfo == null) {
|
if (useBuildInfo == true && fBuildInfo == null) {
|
||||||
|
@ -51,11 +47,7 @@ public class ErrorParserBlock extends AbstractErrorParserBlock {
|
||||||
super.createControl(parent);
|
super.createControl(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
@Override
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.cdt.ui.dialogs.ErrorParserBlock#getErrorParserIDs(org.eclipse.core.resources.IProject)
|
|
||||||
*/
|
|
||||||
protected String[] getErrorParserIDs(IProject project) {
|
protected String[] getErrorParserIDs(IProject project) {
|
||||||
if (getContainer().getProject() != null && fBuildInfo == null) {
|
if (getContainer().getProject() != null && fBuildInfo == null) {
|
||||||
try {
|
try {
|
||||||
|
@ -69,12 +61,7 @@ public class ErrorParserBlock extends AbstractErrorParserBlock {
|
||||||
return new String[0];
|
return new String[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
@Override
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.cdt.ui.dialogs.ErrorParserBlock#saveErrorParsers(org.eclipse.core.resources.IProject,
|
|
||||||
* java.lang.String[])
|
|
||||||
*/
|
|
||||||
public void saveErrorParsers(IProject project, String[] parserIDs) throws CoreException {
|
public void saveErrorParsers(IProject project, String[] parserIDs) throws CoreException {
|
||||||
if (getContainer().getProject() != null) {
|
if (getContainer().getProject() != null) {
|
||||||
try {
|
try {
|
||||||
|
@ -88,22 +75,19 @@ public class ErrorParserBlock extends AbstractErrorParserBlock {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
@Override
|
||||||
* @see org.eclipse.cdt.ui.dialogs.AbstractErrorParserBlock#saveErrorParsers(java.lang.String[])
|
|
||||||
*/
|
|
||||||
protected void saveErrorParsers(String[] parserIDs) throws CoreException {
|
protected void saveErrorParsers(String[] parserIDs) throws CoreException {
|
||||||
fBuildInfo = MakeCorePlugin.createBuildInfo(fPrefs, MakeBuilder.BUILDER_ID, false);
|
fBuildInfo = MakeCorePlugin.createBuildInfo(fPrefs, MakeBuilder.BUILDER_ID, false);
|
||||||
fBuildInfo.setErrorParsers(parserIDs);
|
fBuildInfo.setErrorParsers(parserIDs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
@Override
|
||||||
* @see org.eclipse.cdt.ui.dialogs.AbstractErrorParserBlock#getErrorParserIDs(boolean)
|
|
||||||
*/
|
|
||||||
protected String[] getErrorParserIDs(boolean defaults) {
|
protected String[] getErrorParserIDs(boolean defaults) {
|
||||||
fBuildInfo = MakeCorePlugin.createBuildInfo(fPrefs, MakeBuilder.BUILDER_ID, defaults);
|
fBuildInfo = MakeCorePlugin.createBuildInfo(fPrefs, MakeBuilder.BUILDER_ID, defaults);
|
||||||
return fBuildInfo.getErrorParsers();
|
return fBuildInfo.getErrorParsers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setContainer(ICOptionContainer container) {
|
public void setContainer(ICOptionContainer container) {
|
||||||
super.setContainer(container);
|
super.setContainer(container);
|
||||||
if (getContainer().getProject() != null) {
|
if (getContainer().getProject() != null) {
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class HTML2TextReader extends SubstitutionTextReader {
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
||||||
fgTags= new HashSet<String>();
|
fgTags= new HashSet<>();
|
||||||
fgTags.add("b"); //$NON-NLS-1$
|
fgTags.add("b"); //$NON-NLS-1$
|
||||||
fgTags.add("br"); //$NON-NLS-1$
|
fgTags.add("br"); //$NON-NLS-1$
|
||||||
fgTags.add("h5"); //$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("li"); //$NON-NLS-1$
|
||||||
fgTags.add("ul"); //$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("lt", "<"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
fgEntityLookup.put("gt", ">"); //$NON-NLS-1$ //$NON-NLS-2$
|
fgEntityLookup.put("gt", ">"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
fgEntityLookup.put("nbsp", " "); //$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;
|
fTextPresentation= presentation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int read() throws IOException {
|
public int read() throws IOException {
|
||||||
int c= super.read();
|
int c= super.read();
|
||||||
if (c != -1)
|
if (c != -1)
|
||||||
|
@ -98,9 +99,7 @@ public class HTML2TextReader extends SubstitutionTextReader {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* @see SubstitutionTextReader#computeSubstitution(char)
|
|
||||||
*/
|
|
||||||
protected String computeSubstitution(int c) throws IOException {
|
protected String computeSubstitution(int c) throws IOException {
|
||||||
if (c == '<')
|
if (c == '<')
|
||||||
return processHTMLTag();
|
return processHTMLTag();
|
||||||
|
@ -230,7 +229,7 @@ public class HTML2TextReader extends SubstitutionTextReader {
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
String str= (String) fgEntityLookup.get(symbol);
|
String str= fgEntityLookup.get(symbol);
|
||||||
if (str != null) {
|
if (str != null) {
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,9 +89,7 @@ public class HTMLTextPresenter implements DefaultInformationControl.IInformation
|
||||||
return (i == length ? line : line.substring(0, i)) + " "; //$NON-NLS-1$
|
return (i == length ? line : line.substring(0, i)) + " "; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
@Override
|
||||||
* @see IHoverInformationPresenter#updatePresentation(Display display, String, TextPresentation, int, int)
|
|
||||||
*/
|
|
||||||
public String updatePresentation(Display display, String hoverInfo, TextPresentation presentation, int maxWidth, int maxHeight) {
|
public String updatePresentation(Display display, String hoverInfo, TextPresentation presentation, int maxWidth, int maxHeight) {
|
||||||
|
|
||||||
if (hoverInfo == null)
|
if (hoverInfo == null)
|
||||||
|
|
|
@ -124,6 +124,7 @@ public class ResourceLookup {
|
||||||
*/
|
*/
|
||||||
public static void sortFilesByRelevance(IFile[] filesToSort, final IProject preferredProject) {
|
public static void sortFilesByRelevance(IFile[] filesToSort, final IProject preferredProject) {
|
||||||
Collections.sort(Arrays.asList(filesToSort), new Comparator<IFile>() {
|
Collections.sort(Arrays.asList(filesToSort), new Comparator<IFile>() {
|
||||||
|
@Override
|
||||||
public int compare(IFile f1, IFile f2) {
|
public int compare(IFile f1, IFile f2) {
|
||||||
int r1= FileRelevance.getRelevance(f1, preferredProject);
|
int r1= FileRelevance.getRelevance(f1, preferredProject);
|
||||||
int r2= FileRelevance.getRelevance(f2, preferredProject);
|
int r2= FileRelevance.getRelevance(f2, preferredProject);
|
||||||
|
|
|
@ -124,7 +124,7 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
|
||||||
|
|
||||||
public ResourceLookupTree() {
|
public ResourceLookupTree() {
|
||||||
fRootNode= new Node(null, CharArrayUtils.EMPTY, false, false) {};
|
fRootNode= new Node(null, CharArrayUtils.EMPTY, false, false) {};
|
||||||
fFileExtensions= new HashMap<String, Extensions>();
|
fFileExtensions= new HashMap<>();
|
||||||
fUnrefJob= new Job("Timer") { //$NON-NLS-1$
|
fUnrefJob= new Job("Timer") { //$NON-NLS-1$
|
||||||
@Override
|
@Override
|
||||||
protected IStatus run(IProgressMonitor monitor) {
|
protected IStatus run(IProgressMonitor monitor) {
|
||||||
|
@ -152,6 +152,7 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
|
||||||
/**
|
/**
|
||||||
* Handle resource change notifications.
|
* Handle resource change notifications.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void resourceChanged(IResourceChangeEvent event) {
|
public void resourceChanged(IResourceChangeEvent event) {
|
||||||
IResourceDelta delta= event.getDelta();
|
IResourceDelta delta= event.getDelta();
|
||||||
synchronized (fLock) {
|
synchronized (fLock) {
|
||||||
|
@ -182,7 +183,8 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
|
||||||
/**
|
/**
|
||||||
* Handles resource change notifications by visiting the delta.
|
* 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);
|
assert Thread.holdsLock(fLock);
|
||||||
|
|
||||||
final IResource res= delta.getResource();
|
final IResource res= delta.getResource();
|
||||||
|
@ -274,7 +276,8 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
|
||||||
/**
|
/**
|
||||||
* Add a resource tree by using a resource proxy visitor.
|
* 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 (proxy.getType() == IResource.FILE) {
|
||||||
if (fCurrentExtensions.isRelevant(proxy.getName())) {
|
if (fCurrentExtensions.isRelevant(proxy.getName())) {
|
||||||
if (proxy.isLinked()) {
|
if (proxy.isLinked()) {
|
||||||
|
@ -300,7 +303,7 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
|
||||||
public void simulateNodeMapCollection() {
|
public void simulateNodeMapCollection() {
|
||||||
synchronized (fLock) {
|
synchronized (fLock) {
|
||||||
fNodeMap= null;
|
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) {
|
if (fNodeMap == null) {
|
||||||
fFileExtensions.clear();
|
fFileExtensions.clear();
|
||||||
fNodeMap= new HashMap<Integer, Object>();
|
fNodeMap= new HashMap<>();
|
||||||
fNodeMapRef= new SoftReference<Map<Integer, Object>>(fNodeMap);
|
fNodeMapRef= new SoftReference<>(fNodeMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fUnrefJob.cancel();
|
fUnrefJob.cancel();
|
||||||
|
@ -349,13 +352,13 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
|
||||||
private void initFileExtensions() {
|
private void initFileExtensions() {
|
||||||
|
|
||||||
if (fDefaultExtensions == null) {
|
if (fDefaultExtensions == null) {
|
||||||
HashSet<String> cdtContentTypes= new HashSet<String>();
|
HashSet<String> cdtContentTypes= new HashSet<>();
|
||||||
String[] registeredContentTypes= CoreModel.getRegistedContentTypeIds();
|
String[] registeredContentTypes= CoreModel.getRegistedContentTypeIds();
|
||||||
cdtContentTypes.addAll(Arrays.asList(registeredContentTypes));
|
cdtContentTypes.addAll(Arrays.asList(registeredContentTypes));
|
||||||
|
|
||||||
final IContentTypeManager ctm= Platform.getContentTypeManager();
|
final IContentTypeManager ctm= Platform.getContentTypeManager();
|
||||||
final IContentType[] ctts= ctm.getAllContentTypes();
|
final IContentType[] ctts= ctm.getAllContentTypes();
|
||||||
Set<String> result= new HashSet<String>();
|
Set<String> result= new HashSet<>();
|
||||||
outer: for (IContentType ctt : ctts) {
|
outer: for (IContentType ctt : ctts) {
|
||||||
IContentType basedOn= ctt;
|
IContentType basedOn= ctt;
|
||||||
while (basedOn != null) {
|
while (basedOn != null) {
|
||||||
|
@ -368,7 +371,7 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
|
||||||
}
|
}
|
||||||
fCDTProjectExtensions= new Extensions(result, true);
|
fCDTProjectExtensions= new Extensions(result, true);
|
||||||
|
|
||||||
result= new HashSet<String>();
|
result= new HashSet<>();
|
||||||
for (IContentType ctt : ctts) {
|
for (IContentType ctt : ctts) {
|
||||||
IContentType basedOn= ctt;
|
IContentType basedOn= ctt;
|
||||||
while (basedOn != null) {
|
while (basedOn != null) {
|
||||||
|
@ -700,7 +703,7 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
|
||||||
while(suffix.startsWith("../")) { //$NON-NLS-1$
|
while(suffix.startsWith("../")) { //$NON-NLS-1$
|
||||||
suffix= suffix.substring(3);
|
suffix= suffix.substring(3);
|
||||||
}
|
}
|
||||||
Set<String> prjset= new HashSet<String>();
|
Set<String> prjset= new HashSet<>();
|
||||||
for (IProject prj : projects) {
|
for (IProject prj : projects) {
|
||||||
prjset.add(prj.getName());
|
prjset.add(prj.getName());
|
||||||
}
|
}
|
||||||
|
@ -829,7 +832,7 @@ class ResourceLookupTree implements IResourceChangeListener, IResourceDeltaVisit
|
||||||
|
|
||||||
@SuppressWarnings("nls")
|
@SuppressWarnings("nls")
|
||||||
public void dump() {
|
public void dump() {
|
||||||
List<String> lines= new ArrayList<String>();
|
List<String> lines= new ArrayList<>();
|
||||||
synchronized (fLock) {
|
synchronized (fLock) {
|
||||||
for (Iterator<Object> iterator = fNodeMap.values().iterator(); iterator.hasNext();) {
|
for (Iterator<Object> iterator = fNodeMap.values().iterator(); iterator.hasNext();) {
|
||||||
Node[] nodes= convert(iterator.next());
|
Node[] nodes= convert(iterator.next());
|
||||||
|
|
|
@ -20,12 +20,14 @@ public abstract class SingleCharReader extends Reader {
|
||||||
/**
|
/**
|
||||||
* @see Reader#read(char)
|
* @see Reader#read(char)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public abstract int read() throws IOException;
|
public abstract int read() throws IOException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see Reader#read(char[],int,int)
|
* @see Reader#read(char[],int,int)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public int read(char cbuf[], int off, int len) throws IOException {
|
public int read(char cbuf[], int off, int len) throws IOException {
|
||||||
int end= off + len;
|
int end= off + len;
|
||||||
for (int i= off; i < end; i++) {
|
for (int i= off; i < end; i++) {
|
||||||
|
@ -44,7 +46,8 @@ public abstract class SingleCharReader extends Reader {
|
||||||
/**
|
/**
|
||||||
* @see Reader#ready()
|
* @see Reader#ready()
|
||||||
*/
|
*/
|
||||||
public boolean ready() throws IOException {
|
@Override
|
||||||
|
public boolean ready() throws IOException {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,9 +88,7 @@ public abstract class SubstitutionTextReader extends SingleCharReader {
|
||||||
return ch;
|
return ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* @see Reader#read()
|
|
||||||
*/
|
|
||||||
public int read() throws IOException {
|
public int read() throws IOException {
|
||||||
int c;
|
int c;
|
||||||
do {
|
do {
|
||||||
|
@ -111,23 +109,17 @@ public abstract class SubstitutionTextReader extends SingleCharReader {
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* @see Reader#ready()
|
public boolean ready() throws IOException {
|
||||||
*/
|
|
||||||
public boolean ready() throws IOException {
|
|
||||||
return fReader.ready();
|
return fReader.ready();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* @see Reader#close()
|
|
||||||
*/
|
|
||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
fReader.close();
|
fReader.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* @see Reader#reset()
|
|
||||||
*/
|
|
||||||
public void reset() throws IOException {
|
public void reset() throws IOException {
|
||||||
fReader.reset();
|
fReader.reset();
|
||||||
fWasWhiteSpace= true;
|
fWasWhiteSpace= true;
|
||||||
|
|
|
@ -17,7 +17,6 @@ import org.eclipse.cdt.core.model.ICElement;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
import org.eclipse.core.commands.AbstractHandler;
|
import org.eclipse.core.commands.AbstractHandler;
|
||||||
import org.eclipse.core.commands.ExecutionEvent;
|
import org.eclipse.core.commands.ExecutionEvent;
|
||||||
import org.eclipse.core.commands.ExecutionException;
|
|
||||||
import org.eclipse.core.resources.IContainer;
|
import org.eclipse.core.resources.IContainer;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.jface.viewers.ISelection;
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
|
@ -26,7 +25,7 @@ import org.eclipse.ui.handlers.HandlerUtil;
|
||||||
|
|
||||||
public abstract class AbstractAutotoolsHandler extends AbstractHandler {
|
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);
|
ISelection k = HandlerUtil.getCurrentSelection(event);
|
||||||
if (!k.isEmpty() && k instanceof IStructuredSelection) {
|
if (!k.isEmpty() && k instanceof IStructuredSelection) {
|
||||||
Object obj = ((IStructuredSelection)k).getFirstElement();
|
Object obj = ((IStructuredSelection)k).getFirstElement();
|
||||||
|
|
|
@ -51,14 +51,17 @@ public abstract class AbstractTargetAction
|
||||||
fContainer = container;
|
fContainer = container;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
|
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
|
||||||
fPart = targetPart;
|
fPart = targetPart;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void init(IWorkbenchWindow window) {
|
public void init(IWorkbenchWindow window) {
|
||||||
fWindow = window;
|
fWindow = window;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void selectionChanged(IAction action, ISelection selection) {
|
public void selectionChanged(IAction action, ISelection selection) {
|
||||||
boolean enabled = false;
|
boolean enabled = false;
|
||||||
if (selection instanceof IStructuredSelection) {
|
if (selection instanceof IStructuredSelection) {
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
package org.eclipse.cdt.internal.autotools.ui.actions;
|
package org.eclipse.cdt.internal.autotools.ui.actions;
|
||||||
|
|
||||||
import org.eclipse.core.commands.ExecutionEvent;
|
import org.eclipse.core.commands.ExecutionEvent;
|
||||||
import org.eclipse.core.commands.ExecutionException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Jeff Johnston
|
* @author Jeff Johnston
|
||||||
|
@ -19,7 +18,8 @@ import org.eclipse.core.commands.ExecutionException;
|
||||||
*/
|
*/
|
||||||
public class AclocalHandler extends AbstractAutotoolsHandler {
|
public class AclocalHandler extends AbstractAutotoolsHandler {
|
||||||
|
|
||||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
@Override
|
||||||
|
public Object execute(ExecutionEvent event) {
|
||||||
return execute(event, new InvokeAclocalAction());
|
return execute(event, new InvokeAclocalAction());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,11 +11,11 @@
|
||||||
package org.eclipse.cdt.internal.autotools.ui.actions;
|
package org.eclipse.cdt.internal.autotools.ui.actions;
|
||||||
|
|
||||||
import org.eclipse.core.commands.ExecutionEvent;
|
import org.eclipse.core.commands.ExecutionEvent;
|
||||||
import org.eclipse.core.commands.ExecutionException;
|
|
||||||
|
|
||||||
public class AutoconfHandler extends AbstractAutotoolsHandler {
|
public class AutoconfHandler extends AbstractAutotoolsHandler {
|
||||||
|
|
||||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
@Override
|
||||||
|
public Object execute(ExecutionEvent event) {
|
||||||
return execute(event, new InvokeAutoconfAction());
|
return execute(event, new InvokeAutoconfAction());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
package org.eclipse.cdt.internal.autotools.ui.actions;
|
package org.eclipse.cdt.internal.autotools.ui.actions;
|
||||||
|
|
||||||
import org.eclipse.core.commands.ExecutionEvent;
|
import org.eclipse.core.commands.ExecutionEvent;
|
||||||
import org.eclipse.core.commands.ExecutionException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Jeff Johnston
|
* @author Jeff Johnston
|
||||||
|
@ -19,7 +18,8 @@ import org.eclipse.core.commands.ExecutionException;
|
||||||
*/
|
*/
|
||||||
public class AutoheaderHandler extends AbstractAutotoolsHandler {
|
public class AutoheaderHandler extends AbstractAutotoolsHandler {
|
||||||
|
|
||||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
@Override
|
||||||
|
public Object execute(ExecutionEvent event) {
|
||||||
return execute(event, new InvokeAutoheaderAction());
|
return execute(event, new InvokeAutoheaderAction());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,11 +11,11 @@
|
||||||
package org.eclipse.cdt.internal.autotools.ui.actions;
|
package org.eclipse.cdt.internal.autotools.ui.actions;
|
||||||
|
|
||||||
import org.eclipse.core.commands.ExecutionEvent;
|
import org.eclipse.core.commands.ExecutionEvent;
|
||||||
import org.eclipse.core.commands.ExecutionException;
|
|
||||||
|
|
||||||
public class AutomakeHandler extends AbstractAutotoolsHandler {
|
public class AutomakeHandler extends AbstractAutotoolsHandler {
|
||||||
|
|
||||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
@Override
|
||||||
|
public Object execute(ExecutionEvent event) {
|
||||||
return execute(event, new InvokeAutomakeAction());
|
return execute(event, new InvokeAutomakeAction());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
package org.eclipse.cdt.internal.autotools.ui.actions;
|
package org.eclipse.cdt.internal.autotools.ui.actions;
|
||||||
|
|
||||||
import org.eclipse.core.commands.ExecutionEvent;
|
import org.eclipse.core.commands.ExecutionEvent;
|
||||||
import org.eclipse.core.commands.ExecutionException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Jeff Johnston
|
* @author Jeff Johnston
|
||||||
|
@ -19,7 +18,8 @@ import org.eclipse.core.commands.ExecutionException;
|
||||||
*/
|
*/
|
||||||
public class AutoreconfHandler extends AbstractAutotoolsHandler {
|
public class AutoreconfHandler extends AbstractAutotoolsHandler {
|
||||||
|
|
||||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
@Override
|
||||||
|
public Object execute(ExecutionEvent event) {
|
||||||
return execute(event, new InvokeAutoreconfAction());
|
return execute(event, new InvokeAutoreconfAction());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ public class InvokeAclocalAction extends InvokeAction {
|
||||||
private static final String DEFAULT_OPTION = ""; //$NON-NLS-1$
|
private static final String DEFAULT_OPTION = ""; //$NON-NLS-1$
|
||||||
private static final String DEFAULT_COMMAND = "aclocal"; //$NON-NLS-1$
|
private static final String DEFAULT_COMMAND = "aclocal"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
@Override
|
||||||
public void run(IAction action) {
|
public void run(IAction action) {
|
||||||
|
|
||||||
IContainer container = getSelectedContainer();
|
IContainer container = getSelectedContainer();
|
||||||
|
@ -97,6 +98,7 @@ public class InvokeAclocalAction extends InvokeAction {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,7 @@ public abstract class InvokeAction extends AbstractTargetAction {
|
||||||
protected String[] separateTargets(String rawArgList) {
|
protected String[] separateTargets(String rawArgList) {
|
||||||
|
|
||||||
StringTokenizer st = new StringTokenizer(rawArgList, " "); //$NON-NLS-1$
|
StringTokenizer st = new StringTokenizer(rawArgList, " "); //$NON-NLS-1$
|
||||||
ArrayList<String> targetList = new ArrayList<String>();
|
ArrayList<String> targetList = new ArrayList<>();
|
||||||
|
|
||||||
while (st.hasMoreTokens()) {
|
while (st.hasMoreTokens()) {
|
||||||
String currentWord = st.nextToken().trim();
|
String currentWord = st.nextToken().trim();
|
||||||
|
@ -136,7 +136,7 @@ public abstract class InvokeAction extends AbstractTargetAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String[] separateOptions(String rawArgList) {
|
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
|
// May be multiple user-specified options in which case we
|
||||||
// need to split them up into individual options
|
// need to split them up into individual options
|
||||||
rawArgList = rawArgList.trim();
|
rawArgList = rawArgList.trim();
|
||||||
|
@ -162,7 +162,7 @@ public abstract class InvokeAction extends AbstractTargetAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String[] simpleParseOptions(String rawArgList) {
|
protected String[] simpleParseOptions(String rawArgList) {
|
||||||
ArrayList<String> argList = new ArrayList<String>();
|
ArrayList<String> argList = new ArrayList<>();
|
||||||
int lastArgIndex = -1;
|
int lastArgIndex = -1;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (i < rawArgList.length()) {
|
while (i < rawArgList.length()) {
|
||||||
|
@ -208,7 +208,7 @@ public abstract class InvokeAction extends AbstractTargetAction {
|
||||||
protected IPath getExecDir(IContainer container) {
|
protected IPath getExecDir(IContainer container) {
|
||||||
int type = container.getType();
|
int type = container.getType();
|
||||||
IPath execDir = null;
|
IPath execDir = null;
|
||||||
if (type == IContainer.FILE) {
|
if (type == IResource.FILE) {
|
||||||
execDir = container.getLocation().removeLastSegments(1);
|
execDir = container.getLocation().removeLastSegments(1);
|
||||||
} else {
|
} else {
|
||||||
execDir = container.getLocation();
|
execDir = container.getLocation();
|
||||||
|
@ -219,7 +219,7 @@ public abstract class InvokeAction extends AbstractTargetAction {
|
||||||
protected IPath getCWD(IContainer container) {
|
protected IPath getCWD(IContainer container) {
|
||||||
int type = container.getType();
|
int type = container.getType();
|
||||||
IPath cwd = null;
|
IPath cwd = null;
|
||||||
if (type == IContainer.FILE) {
|
if (type == IResource.FILE) {
|
||||||
cwd = container.getFullPath().removeLastSegments(1);
|
cwd = container.getFullPath().removeLastSegments(1);
|
||||||
} else {
|
} else {
|
||||||
cwd = container.getFullPath();
|
cwd = container.getFullPath();
|
||||||
|
@ -244,21 +244,18 @@ public abstract class InvokeAction extends AbstractTargetAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(IProgressMonitor monitor)
|
public void run(IProgressMonitor monitor) throws InvocationTargetException {
|
||||||
throws InvocationTargetException, InterruptedException {
|
|
||||||
ByteArrayOutputStream stdout = new ByteArrayOutputStream();
|
|
||||||
ByteArrayOutputStream stderr = new ByteArrayOutputStream();
|
|
||||||
RemoteCommandLauncher cmdL = new RemoteCommandLauncher();
|
RemoteCommandLauncher cmdL = new RemoteCommandLauncher();
|
||||||
outputs = null;
|
outputs = new HashMap<>();
|
||||||
|
|
||||||
// invoke command
|
// invoke command
|
||||||
try {
|
try (ByteArrayOutputStream stdout = new ByteArrayOutputStream();
|
||||||
monitor.beginTask(
|
ByteArrayOutputStream stderr = new ByteArrayOutputStream()) {
|
||||||
InvokeMessages.getFormattedString("InvokeAction.progress.message", // $NON-NLS-1$
|
monitor.beginTask(InvokeMessages.getFormattedString("InvokeAction.progress.message", // $NON-NLS-1$
|
||||||
new String[]{command.toOSString()}), IProgressMonitor.UNKNOWN);
|
new String[] { command.toOSString() }), IProgressMonitor.UNKNOWN);
|
||||||
monitor.worked(1);
|
monitor.worked(1);
|
||||||
Process process = cmdL.execute(command, argumentList, envList,
|
Process process = cmdL.execute(command, argumentList, envList, execDir, new NullProgressMonitor());
|
||||||
execDir, new NullProgressMonitor());
|
|
||||||
|
|
||||||
if (cmdL.waitAndRead(stdout, stderr, new NullProgressMonitor()) == ICommandLauncher.OK) {
|
if (cmdL.waitAndRead(stdout, stderr, new NullProgressMonitor()) == ICommandLauncher.OK) {
|
||||||
try {
|
try {
|
||||||
|
@ -274,24 +271,15 @@ public abstract class InvokeAction extends AbstractTargetAction {
|
||||||
monitor.done();
|
monitor.done();
|
||||||
return;
|
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();
|
monitor.done();
|
||||||
throw new InvocationTargetException(e);
|
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() {
|
public HashMap<String, String> getOutputs() {
|
||||||
return outputs;
|
return outputs;
|
||||||
}
|
}
|
||||||
|
@ -333,9 +321,6 @@ public abstract class InvokeAction extends AbstractTargetAction {
|
||||||
final ISchedulingRule rule = ResourcesPlugin.getWorkspace().getRoot();
|
final ISchedulingRule rule = ResourcesPlugin.getWorkspace().getRoot();
|
||||||
|
|
||||||
Job backgroundJob = new Job(actionName) {
|
Job backgroundJob = new Job(actionName) {
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected IStatus run(IProgressMonitor monitor) {
|
protected IStatus run(IProgressMonitor monitor) {
|
||||||
try {
|
try {
|
||||||
|
@ -371,7 +356,7 @@ public abstract class InvokeAction extends AbstractTargetAction {
|
||||||
consoleOutStream.write(buf.toString().getBytes());
|
consoleOutStream.write(buf.toString().getBytes());
|
||||||
consoleOutStream.flush();
|
consoleOutStream.flush();
|
||||||
|
|
||||||
ArrayList<String> additionalEnvs = new ArrayList<String>();
|
ArrayList<String> additionalEnvs = new ArrayList<>();
|
||||||
String strippedCommand = AutotoolsNewMakeGenerator.stripEnvVars(command, additionalEnvs);
|
String strippedCommand = AutotoolsNewMakeGenerator.stripEnvVars(command, additionalEnvs);
|
||||||
// Get a launcher for the config command
|
// Get a launcher for the config command
|
||||||
RemoteCommandLauncher launcher = new RemoteCommandLauncher();
|
RemoteCommandLauncher launcher = new RemoteCommandLauncher();
|
||||||
|
@ -380,7 +365,7 @@ public abstract class InvokeAction extends AbstractTargetAction {
|
||||||
IEnvironmentVariable variables[] = ManagedBuildManager
|
IEnvironmentVariable variables[] = ManagedBuildManager
|
||||||
.getEnvironmentVariableProvider().getVariables(cfg, true);
|
.getEnvironmentVariableProvider().getVariables(cfg, true);
|
||||||
String[] env = null;
|
String[] env = null;
|
||||||
ArrayList<String> envList = new ArrayList<String>();
|
ArrayList<String> envList = new ArrayList<>();
|
||||||
if (variables != null) {
|
if (variables != null) {
|
||||||
for (int i = 0; i < variables.length; i++) {
|
for (int i = 0; i < variables.length; i++) {
|
||||||
envList.add(variables[i].getName()
|
envList.add(variables[i].getName()
|
||||||
|
@ -454,8 +439,7 @@ public abstract class InvokeAction extends AbstractTargetAction {
|
||||||
} catch (CoreException e) {
|
} catch (CoreException e) {
|
||||||
return e.getStatus();
|
return e.getStatus();
|
||||||
}
|
}
|
||||||
IStatus returnStatus = Status.OK_STATUS;
|
return Status.OK_STATUS;
|
||||||
return returnStatus;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ import org.eclipse.jface.action.IAction;
|
||||||
public class InvokeAutoconfAction extends InvokeAction {
|
public class InvokeAutoconfAction extends InvokeAction {
|
||||||
|
|
||||||
private final static String DEFAULT_COMMAND = "autoconf"; //$NON-NLS-1$
|
private final static String DEFAULT_COMMAND = "autoconf"; //$NON-NLS-1$
|
||||||
|
@Override
|
||||||
public void run(IAction action) {
|
public void run(IAction action) {
|
||||||
IContainer container = getSelectedContainer();
|
IContainer container = getSelectedContainer();
|
||||||
if (container == null)
|
if (container == null)
|
||||||
|
@ -52,6 +53,7 @@ public class InvokeAutoconfAction extends InvokeAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ public class InvokeAutoheaderAction extends InvokeAction {
|
||||||
private static final String DEFAULT_OPTION = ""; //$NON-NLS-1$
|
private static final String DEFAULT_OPTION = ""; //$NON-NLS-1$
|
||||||
private static final String DEFAULT_COMMAND = "autoheader"; //$NON-NLS-1$
|
private static final String DEFAULT_COMMAND = "autoheader"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
@Override
|
||||||
public void run(IAction action) {
|
public void run(IAction action) {
|
||||||
|
|
||||||
IContainer container = getSelectedContainer();
|
IContainer container = getSelectedContainer();
|
||||||
|
@ -72,6 +73,7 @@ public class InvokeAutoheaderAction extends InvokeAction {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ public class InvokeAutomakeAction extends InvokeAction {
|
||||||
private static final String DEFAULT_OPTION = ""; //$NON-NLS-1$
|
private static final String DEFAULT_OPTION = ""; //$NON-NLS-1$
|
||||||
private static final String DEFAULT_COMMAND = "automake"; //$NON-NLS-1$
|
private static final String DEFAULT_COMMAND = "automake"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
@Override
|
||||||
public void run(IAction action) {
|
public void run(IAction action) {
|
||||||
|
|
||||||
IContainer container = getSelectedContainer();
|
IContainer container = getSelectedContainer();
|
||||||
|
@ -91,6 +92,7 @@ InvokeMessages
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ public class InvokeAutoreconfAction extends InvokeAction {
|
||||||
private static final String DEFAULT_OPTION = ""; //$NON-NLS-1$
|
private static final String DEFAULT_OPTION = ""; //$NON-NLS-1$
|
||||||
private static final String DEFAULT_COMMAND = "autoreconf"; //$NON-NLS-1$
|
private static final String DEFAULT_COMMAND = "autoreconf"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
@Override
|
||||||
public void run(IAction action) {
|
public void run(IAction action) {
|
||||||
|
|
||||||
IContainer container = getSelectedContainer();
|
IContainer container = getSelectedContainer();
|
||||||
|
@ -71,6 +72,7 @@ public class InvokeAutoreconfAction extends InvokeAction {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ public class InvokeLibtoolizeAction extends InvokeAction {
|
||||||
private static final String DEFAULT_OPTION = ""; //$NON-NLS-1$
|
private static final String DEFAULT_OPTION = ""; //$NON-NLS-1$
|
||||||
private static final String DEFAULT_COMMAND = "libtoolize"; //$NON-NLS-1$
|
private static final String DEFAULT_COMMAND = "libtoolize"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
@Override
|
||||||
public void run(IAction action) {
|
public void run(IAction action) {
|
||||||
|
|
||||||
IContainer container = getSelectedContainer();
|
IContainer container = getSelectedContainer();
|
||||||
|
@ -71,6 +72,7 @@ public class InvokeLibtoolizeAction extends InvokeAction {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
package org.eclipse.cdt.internal.autotools.ui.actions;
|
package org.eclipse.cdt.internal.autotools.ui.actions;
|
||||||
|
|
||||||
import org.eclipse.core.commands.ExecutionEvent;
|
import org.eclipse.core.commands.ExecutionEvent;
|
||||||
import org.eclipse.core.commands.ExecutionException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Jeff Johnston
|
* @author Jeff Johnston
|
||||||
|
@ -19,7 +18,8 @@ import org.eclipse.core.commands.ExecutionException;
|
||||||
*/
|
*/
|
||||||
public class LibtoolizeHandler extends AbstractAutotoolsHandler {
|
public class LibtoolizeHandler extends AbstractAutotoolsHandler {
|
||||||
|
|
||||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
@Override
|
||||||
|
public Object execute(ExecutionEvent event) {
|
||||||
return execute(event, new InvokeLibtoolizeAction());
|
return execute(event, new InvokeLibtoolizeAction());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ import org.eclipse.jface.action.IAction;
|
||||||
|
|
||||||
public class ReconfigureAction extends InvokeAction {
|
public class ReconfigureAction extends InvokeAction {
|
||||||
|
|
||||||
|
@Override
|
||||||
public void run(IAction action) {
|
public void run(IAction action) {
|
||||||
IContainer container = getSelectedContainer();
|
IContainer container = getSelectedContainer();
|
||||||
if (container == null)
|
if (container == null)
|
||||||
|
@ -40,14 +41,13 @@ public class ReconfigureAction extends InvokeAction {
|
||||||
final ISchedulingRule rule = ResourcesPlugin.getWorkspace().getRoot();
|
final ISchedulingRule rule = ResourcesPlugin.getWorkspace().getRoot();
|
||||||
|
|
||||||
Job backgroundJob = new Job("Reconfigure Action"){ //$NON-NLS-1$
|
Job backgroundJob = new Job("Reconfigure Action"){ //$NON-NLS-1$
|
||||||
/* (non-Javadoc)
|
@Override
|
||||||
* @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
|
|
||||||
*/
|
|
||||||
protected IStatus run(IProgressMonitor monitor) {
|
protected IStatus run(IProgressMonitor monitor) {
|
||||||
try {
|
try {
|
||||||
ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
|
ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
|
||||||
|
|
||||||
public void run(IProgressMonitor monitor) throws CoreException {
|
@Override
|
||||||
|
public void run(IProgressMonitor monitor) {
|
||||||
IProject project = getSelectedContainer().getProject();
|
IProject project = getSelectedContainer().getProject();
|
||||||
AutotoolsNewMakeGenerator m = new AutotoolsNewMakeGenerator();
|
AutotoolsNewMakeGenerator m = new AutotoolsNewMakeGenerator();
|
||||||
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
|
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
|
||||||
|
@ -72,6 +72,7 @@ public class ReconfigureAction extends InvokeAction {
|
||||||
backgroundJob.schedule();
|
backgroundJob.schedule();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
package org.eclipse.cdt.internal.autotools.ui.actions;
|
package org.eclipse.cdt.internal.autotools.ui.actions;
|
||||||
|
|
||||||
import org.eclipse.core.commands.ExecutionEvent;
|
import org.eclipse.core.commands.ExecutionEvent;
|
||||||
import org.eclipse.core.commands.ExecutionException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Jeff Johnston
|
* @author Jeff Johnston
|
||||||
|
@ -19,7 +18,8 @@ import org.eclipse.core.commands.ExecutionException;
|
||||||
*/
|
*/
|
||||||
public class ReconfigureHandler extends AbstractAutotoolsHandler {
|
public class ReconfigureHandler extends AbstractAutotoolsHandler {
|
||||||
|
|
||||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
@Override
|
||||||
|
public Object execute(ExecutionEvent event) {
|
||||||
return execute(event, new ReconfigureAction());
|
return execute(event, new ReconfigureAction());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,13 +32,12 @@ public class SingleInputDialog extends InputDialog {
|
||||||
this.firstMessage = firstMessage;
|
this.firstMessage = firstMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
@Override
|
||||||
* (non-Javadoc) Method declared on Dialog.
|
|
||||||
*/
|
|
||||||
protected void buttonPressed(int buttonId) {
|
protected void buttonPressed(int buttonId) {
|
||||||
super.buttonPressed(buttonId);
|
super.buttonPressed(buttonId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected Control createDialogArea(Composite parent) {
|
protected Control createDialogArea(Composite parent) {
|
||||||
|
|
||||||
// create composite
|
// create composite
|
||||||
|
|
|
@ -43,9 +43,7 @@ public class TwoInputDialog extends InputDialog {
|
||||||
this.secondMessage = secondMessage;
|
this.secondMessage = secondMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
@Override
|
||||||
* (non-Javadoc) Method declared on Dialog.
|
|
||||||
*/
|
|
||||||
protected void buttonPressed(int buttonId) {
|
protected void buttonPressed(int buttonId) {
|
||||||
if (buttonId == IDialogConstants.OK_ID) {
|
if (buttonId == IDialogConstants.OK_ID) {
|
||||||
secondValue = secondText.getText();
|
secondValue = secondText.getText();
|
||||||
|
@ -55,6 +53,7 @@ public class TwoInputDialog extends InputDialog {
|
||||||
super.buttonPressed(buttonId);
|
super.buttonPressed(buttonId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected Control createDialogArea(Composite parent) {
|
protected Control createDialogArea(Composite parent) {
|
||||||
|
|
||||||
// create composite
|
// create composite
|
||||||
|
@ -78,6 +77,7 @@ public class TwoInputDialog extends InputDialog {
|
||||||
secondText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
|
secondText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
|
||||||
| GridData.HORIZONTAL_ALIGN_FILL));
|
| GridData.HORIZONTAL_ALIGN_FILL));
|
||||||
secondText.addModifyListener(new ModifyListener() {
|
secondText.addModifyListener(new ModifyListener() {
|
||||||
|
@Override
|
||||||
public void modifyText(ModifyEvent e) {
|
public void modifyText(ModifyEvent e) {
|
||||||
validateInput();
|
validateInput();
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,9 +100,7 @@ public class ProjectionFileUpdater implements IProjectionListener {
|
||||||
|
|
||||||
private class ReconcilerParticipant implements IReconcilingParticipant {
|
private class ReconcilerParticipant implements IReconcilingParticipant {
|
||||||
|
|
||||||
/* (non-Javadoc)
|
@Override
|
||||||
* @see org.eclipse.cdt.internal.autotools.ui.editors.automake.IReconcilingParticipant#reconciled()
|
|
||||||
*/
|
|
||||||
public void reconciled() {
|
public void reconciled() {
|
||||||
processReconcile();
|
processReconcile();
|
||||||
}
|
}
|
||||||
|
@ -119,9 +117,7 @@ public class ProjectionFileUpdater implements IProjectionListener {
|
||||||
private boolean fCollapseConditional = false;
|
private boolean fCollapseConditional = false;
|
||||||
private boolean fCollapseLoop = false;
|
private boolean fCollapseLoop = false;
|
||||||
|
|
||||||
/*
|
@Override
|
||||||
* @see org.eclipse.jface.text.source.projection.IProjectionListener#projectionEnabled()
|
|
||||||
*/
|
|
||||||
public void projectionEnabled() {
|
public void projectionEnabled() {
|
||||||
// http://home.ott.oti.com/teams/wswb/anon/out/vms/index.html
|
// http://home.ott.oti.com/teams/wswb/anon/out/vms/index.html
|
||||||
// projectionEnabled messages are not always paired with projectionDisabled
|
// projectionEnabled messages are not always paired with projectionDisabled
|
||||||
|
@ -135,9 +131,7 @@ public class ProjectionFileUpdater implements IProjectionListener {
|
||||||
fEditor.addReconcilingParticipant(fParticipant);
|
fEditor.addReconcilingParticipant(fParticipant);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
@Override
|
||||||
* @see org.eclipse.jface.text.source.projection.IProjectionListener#projectionDisabled()
|
|
||||||
*/
|
|
||||||
public void projectionDisabled() {
|
public void projectionDisabled() {
|
||||||
fCachedDocument= null;
|
fCachedDocument= null;
|
||||||
if (fParticipant != null) {
|
if (fParticipant != null) {
|
||||||
|
@ -187,7 +181,7 @@ public class ProjectionFileUpdater implements IProjectionListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<AutoconfProjectionAnnotation, Position> computeAdditions(AutoconfElement root) {
|
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)
|
if (root instanceof AutoconfRootElement)
|
||||||
computeAdditions(root.getChildren(), map);
|
computeAdditions(root.getChildren(), map);
|
||||||
return map;
|
return map;
|
||||||
|
@ -277,9 +271,9 @@ public class ProjectionFileUpdater implements IProjectionListener {
|
||||||
fCachedDocument= provider.getDocument(fEditor.getEditorInput());
|
fCachedDocument= provider.getDocument(fEditor.getEditorInput());
|
||||||
fAllowCollapsing= false;
|
fAllowCollapsing= false;
|
||||||
|
|
||||||
Map<AutoconfProjectionAnnotation, Position> additions= new HashMap<AutoconfProjectionAnnotation, Position>();
|
Map<AutoconfProjectionAnnotation, Position> additions= new HashMap<>();
|
||||||
List<AutoconfProjectionAnnotation> deletions= new ArrayList<AutoconfProjectionAnnotation>();
|
List<AutoconfProjectionAnnotation> deletions= new ArrayList<>();
|
||||||
List<AutoconfProjectionAnnotation> updates = new ArrayList<AutoconfProjectionAnnotation>();
|
List<AutoconfProjectionAnnotation> updates = new ArrayList<>();
|
||||||
|
|
||||||
Map<AutoconfProjectionAnnotation, Position> updated= computeAdditions(fEditor.getRootElement());
|
Map<AutoconfProjectionAnnotation, Position> updated= computeAdditions(fEditor.getRootElement());
|
||||||
|
|
||||||
|
@ -288,9 +282,9 @@ public class ProjectionFileUpdater implements IProjectionListener {
|
||||||
|
|
||||||
Iterator<AutoconfProjectionAnnotation> e= updated.keySet().iterator();
|
Iterator<AutoconfProjectionAnnotation> e= updated.keySet().iterator();
|
||||||
while (e.hasNext()) {
|
while (e.hasNext()) {
|
||||||
AutoconfProjectionAnnotation annotation= (AutoconfProjectionAnnotation) e.next();
|
AutoconfProjectionAnnotation annotation= e.next();
|
||||||
AutoconfElement element= annotation.getElement();
|
AutoconfElement element= annotation.getElement();
|
||||||
Position position= (Position) updated.get(annotation);
|
Position position= updated.get(annotation);
|
||||||
|
|
||||||
List<AutoconfProjectionAnnotation> annotations= previous.get(element);
|
List<AutoconfProjectionAnnotation> annotations= previous.get(element);
|
||||||
if (annotations == null) {
|
if (annotations == null) {
|
||||||
|
@ -298,7 +292,7 @@ public class ProjectionFileUpdater implements IProjectionListener {
|
||||||
} else {
|
} else {
|
||||||
Iterator<AutoconfProjectionAnnotation> x= annotations.iterator();
|
Iterator<AutoconfProjectionAnnotation> x= annotations.iterator();
|
||||||
while (x.hasNext()) {
|
while (x.hasNext()) {
|
||||||
AutoconfProjectionAnnotation a= (AutoconfProjectionAnnotation) x.next();
|
AutoconfProjectionAnnotation a= x.next();
|
||||||
if (annotation.isComment() == a.isComment()) {
|
if (annotation.isComment() == a.isComment()) {
|
||||||
Position p= model.getPosition(a);
|
Position p= model.getPosition(a);
|
||||||
if (p != null && !position.equals(p)) {
|
if (p != null && !position.equals(p)) {
|
||||||
|
@ -342,19 +336,19 @@ public class ProjectionFileUpdater implements IProjectionListener {
|
||||||
if (deletions.isEmpty() || (additions.isEmpty() && changes.isEmpty()))
|
if (deletions.isEmpty() || (additions.isEmpty() && changes.isEmpty()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
List<AutoconfProjectionAnnotation> newDeletions= new ArrayList<AutoconfProjectionAnnotation>();
|
List<AutoconfProjectionAnnotation> newDeletions= new ArrayList<>();
|
||||||
List<AutoconfProjectionAnnotation> newChanges= new ArrayList<AutoconfProjectionAnnotation>();
|
List<AutoconfProjectionAnnotation> newChanges= new ArrayList<>();
|
||||||
|
|
||||||
Iterator<AutoconfProjectionAnnotation> deletionIterator= deletions.iterator();
|
Iterator<AutoconfProjectionAnnotation> deletionIterator= deletions.iterator();
|
||||||
outer: while (deletionIterator.hasNext()) {
|
outer: while (deletionIterator.hasNext()) {
|
||||||
AutoconfProjectionAnnotation deleted= (AutoconfProjectionAnnotation) deletionIterator.next();
|
AutoconfProjectionAnnotation deleted= deletionIterator.next();
|
||||||
Position deletedPosition= model.getPosition(deleted);
|
Position deletedPosition= model.getPosition(deleted);
|
||||||
if (deletedPosition == null)
|
if (deletedPosition == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Iterator<AutoconfProjectionAnnotation> changesIterator= changes.iterator();
|
Iterator<AutoconfProjectionAnnotation> changesIterator= changes.iterator();
|
||||||
while (changesIterator.hasNext()) {
|
while (changesIterator.hasNext()) {
|
||||||
AutoconfProjectionAnnotation changed= (AutoconfProjectionAnnotation) changesIterator.next();
|
AutoconfProjectionAnnotation changed= changesIterator.next();
|
||||||
if (deleted.isComment() == changed.isComment()) {
|
if (deleted.isComment() == changed.isComment()) {
|
||||||
Position changedPosition= model.getPosition(changed);
|
Position changedPosition= model.getPosition(changed);
|
||||||
if (changedPosition == null)
|
if (changedPosition == null)
|
||||||
|
@ -378,9 +372,9 @@ public class ProjectionFileUpdater implements IProjectionListener {
|
||||||
|
|
||||||
Iterator<AutoconfProjectionAnnotation> additionsIterator= additions.keySet().iterator();
|
Iterator<AutoconfProjectionAnnotation> additionsIterator= additions.keySet().iterator();
|
||||||
while (additionsIterator.hasNext()) {
|
while (additionsIterator.hasNext()) {
|
||||||
AutoconfProjectionAnnotation added= (AutoconfProjectionAnnotation) additionsIterator.next();
|
AutoconfProjectionAnnotation added= additionsIterator.next();
|
||||||
if (deleted.isComment() == added.isComment()) {
|
if (deleted.isComment() == added.isComment()) {
|
||||||
Position addedPosition= (Position) additions.get(added);
|
Position addedPosition= additions.get(added);
|
||||||
|
|
||||||
if (deletedPosition.getOffset() == addedPosition.getOffset()) {
|
if (deletedPosition.getOffset() == addedPosition.getOffset()) {
|
||||||
|
|
||||||
|
@ -403,7 +397,7 @@ public class ProjectionFileUpdater implements IProjectionListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<AutoconfElement, List<AutoconfProjectionAnnotation>> createAnnotationMap(IAnnotationModel model) {
|
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")
|
@SuppressWarnings("rawtypes")
|
||||||
Iterator e= model.getAnnotationIterator();
|
Iterator e= model.getAnnotationIterator();
|
||||||
while (e.hasNext()) {
|
while (e.hasNext()) {
|
||||||
|
@ -412,7 +406,7 @@ public class ProjectionFileUpdater implements IProjectionListener {
|
||||||
AutoconfProjectionAnnotation directive= (AutoconfProjectionAnnotation) annotation;
|
AutoconfProjectionAnnotation directive= (AutoconfProjectionAnnotation) annotation;
|
||||||
List<AutoconfProjectionAnnotation> list= map.get(directive.getElement());
|
List<AutoconfProjectionAnnotation> list= map.get(directive.getElement());
|
||||||
if (list == null) {
|
if (list == null) {
|
||||||
list= new ArrayList<AutoconfProjectionAnnotation>(2);
|
list= new ArrayList<>(2);
|
||||||
map.put(directive.getElement(), list);
|
map.put(directive.getElement(), list);
|
||||||
}
|
}
|
||||||
list.add(directive);
|
list.add(directive);
|
||||||
|
|
|
@ -14,6 +14,7 @@ package org.eclipse.cdt.internal.autotools.ui.editors.automake;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.jface.viewers.ILabelProvider;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.custom.BusyIndicator;
|
import org.eclipse.swt.custom.BusyIndicator;
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
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.Label;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
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
|
* 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() {
|
protected void access$superOpen() {
|
||||||
super.open();
|
super.open();
|
||||||
}
|
}
|
||||||
/*
|
@Override
|
||||||
* @private
|
|
||||||
* @see Dialog#cancelPressed
|
|
||||||
*/
|
|
||||||
protected void cancelPressed() {
|
protected void cancelPressed() {
|
||||||
setResult(null);
|
setResult(null);
|
||||||
super.cancelPressed();
|
super.cancelPressed();
|
||||||
|
@ -64,10 +60,7 @@ public abstract class AbstractElementListSelectionDialog extends SelectionStatus
|
||||||
protected Point computeInitialSize() {
|
protected Point computeInitialSize() {
|
||||||
return new Point(convertWidthInCharsToPixels(60), convertHeightInCharsToPixels(18));
|
return new Point(convertWidthInCharsToPixels(60), convertHeightInCharsToPixels(18));
|
||||||
}
|
}
|
||||||
/*
|
@Override
|
||||||
* @private
|
|
||||||
* @see Window#createDialogArea(Composite)
|
|
||||||
*/
|
|
||||||
protected Control createDialogArea(Composite parent) {
|
protected Control createDialogArea(Composite parent) {
|
||||||
Composite contents= (Composite)super.createDialogArea(parent);
|
Composite contents= (Composite)super.createDialogArea(parent);
|
||||||
|
|
||||||
|
@ -78,9 +71,11 @@ public abstract class AbstractElementListSelectionDialog extends SelectionStatus
|
||||||
fRenderer, fIgnoreCase);
|
fRenderer, fIgnoreCase);
|
||||||
|
|
||||||
fSelectionList.addSelectionListener(new SelectionListener() {
|
fSelectionList.addSelectionListener(new SelectionListener() {
|
||||||
|
@Override
|
||||||
public void widgetDefaultSelected(SelectionEvent e) {
|
public void widgetDefaultSelected(SelectionEvent e) {
|
||||||
handleDoubleClick();
|
handleDoubleClick();
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
verifyCurrentSelection();
|
verifyCurrentSelection();
|
||||||
}
|
}
|
||||||
|
@ -116,6 +111,7 @@ public abstract class AbstractElementListSelectionDialog extends SelectionStatus
|
||||||
* @private
|
* @private
|
||||||
* @see Window#create(Shell)
|
* @see Window#create(Shell)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void create() {
|
public void create() {
|
||||||
super.create();
|
super.create();
|
||||||
if (isEmptyList()) {
|
if (isEmptyList()) {
|
||||||
|
@ -145,7 +141,7 @@ public abstract class AbstractElementListSelectionDialog extends SelectionStatus
|
||||||
*/
|
*/
|
||||||
protected List<Object> getWidgetSelection() {
|
protected List<Object> getWidgetSelection() {
|
||||||
if (fSelectionList == null || fSelectionList.isDisposed())
|
if (fSelectionList == null || fSelectionList.isDisposed())
|
||||||
return new ArrayList<Object>(0);
|
return new ArrayList<>(0);
|
||||||
return fSelectionList.getSelection();
|
return fSelectionList.getSelection();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -195,8 +191,10 @@ public abstract class AbstractElementListSelectionDialog extends SelectionStatus
|
||||||
/*
|
/*
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public int open() {
|
public int open() {
|
||||||
BusyIndicator.showWhile(null, new Runnable() {
|
BusyIndicator.showWhile(null, new Runnable() {
|
||||||
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
access$superOpen();
|
access$superOpen();
|
||||||
}
|
}
|
||||||
|
@ -227,6 +225,7 @@ public abstract class AbstractElementListSelectionDialog extends SelectionStatus
|
||||||
* Sets the message to be shown above the match text field.
|
* Sets the message to be shown above the match text field.
|
||||||
* Must be set before widget creation
|
* Must be set before widget creation
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void setMessage(String message) {
|
public void setMessage(String message) {
|
||||||
fMessageText= message;
|
fMessageText= message;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,144 +39,157 @@ public abstract class AbstractMakefile extends Parent implements IMakefile {
|
||||||
super(parent);
|
super(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public abstract IDirective[] getBuiltins();
|
public abstract IDirective[] getBuiltins();
|
||||||
|
|
||||||
|
@Override
|
||||||
public IRule[] getRules() {
|
public IRule[] getRules() {
|
||||||
IDirective[] stmts = getDirectives(true);
|
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++) {
|
for (int i = 0; i < stmts.length; i++) {
|
||||||
if (stmts[i] instanceof IRule) {
|
if (stmts[i] instanceof IRule) {
|
||||||
array.add((IRule)stmts[i]);
|
array.add((IRule)stmts[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (IRule[]) array.toArray(new IRule[0]);
|
return array.toArray(new IRule[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IRule[] getRules(String target) {
|
public IRule[] getRules(String target) {
|
||||||
IRule[] rules = getRules();
|
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++) {
|
for (int i = 0; i < rules.length; i++) {
|
||||||
if (rules[i].getTarget().toString().equals(target)) {
|
if (rules[i].getTarget().toString().equals(target)) {
|
||||||
array.add(rules[i]);
|
array.add(rules[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (IRule[]) array.toArray(new IRule[0]);
|
return array.toArray(new IRule[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IInferenceRule[] getInferenceRules() {
|
public IInferenceRule[] getInferenceRules() {
|
||||||
IRule[] rules = getRules();
|
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++) {
|
for (int i = 0; i < rules.length; i++) {
|
||||||
if (rules[i] instanceof IInferenceRule) {
|
if (rules[i] instanceof IInferenceRule) {
|
||||||
array.add((IInferenceRule)rules[i]);
|
array.add((IInferenceRule)rules[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (IInferenceRule[]) array.toArray(new IInferenceRule[0]);
|
return array.toArray(new IInferenceRule[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IInferenceRule[] getInferenceRules(String target) {
|
public IInferenceRule[] getInferenceRules(String target) {
|
||||||
IInferenceRule[] irules = getInferenceRules();
|
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++) {
|
for (int i = 0; i < irules.length; i++) {
|
||||||
if (irules[i].getTarget().toString().equals(target)) {
|
if (irules[i].getTarget().toString().equals(target)) {
|
||||||
array.add(irules[i]);
|
array.add(irules[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (IInferenceRule[]) array.toArray(new IInferenceRule[0]);
|
return array.toArray(new IInferenceRule[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ITargetRule[] getTargetRules() {
|
public ITargetRule[] getTargetRules() {
|
||||||
IRule[] trules = getRules();
|
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++) {
|
for (int i = 0; i < trules.length; i++) {
|
||||||
if (trules[i] instanceof ITargetRule) {
|
if (trules[i] instanceof ITargetRule) {
|
||||||
array.add((ITargetRule)trules[i]);
|
array.add((ITargetRule)trules[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (ITargetRule[]) array.toArray(new ITargetRule[0]);
|
return array.toArray(new ITargetRule[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ITargetRule[] getTargetRules(String target) {
|
public ITargetRule[] getTargetRules(String target) {
|
||||||
ITargetRule[] trules = getTargetRules();
|
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++) {
|
for (int i = 0; i < trules.length; i++) {
|
||||||
if (trules[i].getTarget().toString().equals(target)) {
|
if (trules[i].getTarget().toString().equals(target)) {
|
||||||
array.add(trules[i]);
|
array.add(trules[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (ITargetRule[]) array.toArray(new ITargetRule[0]);
|
return array.toArray(new ITargetRule[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IMacroDefinition[] getMacroDefinitions() {
|
public IMacroDefinition[] getMacroDefinitions() {
|
||||||
IDirective[] stmts = getDirectives(true);
|
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++) {
|
for (int i = 0; i < stmts.length; i++) {
|
||||||
if (stmts[i] instanceof IMacroDefinition) {
|
if (stmts[i] instanceof IMacroDefinition) {
|
||||||
array.add((IMacroDefinition)stmts[i]);
|
array.add((IMacroDefinition)stmts[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (IMacroDefinition[]) array.toArray(new IMacroDefinition[0]);
|
return array.toArray(new IMacroDefinition[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IMacroDefinition[] getMacroDefinitions(String name) {
|
public IMacroDefinition[] getMacroDefinitions(String name) {
|
||||||
IMacroDefinition[] variables = getMacroDefinitions();
|
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++) {
|
for (int i = 0; i < variables.length; i++) {
|
||||||
if (variables[i].getName().equals(name)) {
|
if (variables[i].getName().equals(name)) {
|
||||||
array.add(variables[i]);
|
array.add(variables[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (IMacroDefinition[]) array.toArray(new IMacroDefinition[0]);
|
return array.toArray(new IMacroDefinition[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IMacroDefinition[] getBuiltinMacroDefinitions() {
|
public IMacroDefinition[] getBuiltinMacroDefinitions() {
|
||||||
IDirective[] stmts = getBuiltins();
|
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++) {
|
for (int i = 0; i < stmts.length; i++) {
|
||||||
if (stmts[i] instanceof IMacroDefinition) {
|
if (stmts[i] instanceof IMacroDefinition) {
|
||||||
array.add((IMacroDefinition)stmts[i]);
|
array.add((IMacroDefinition)stmts[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (IMacroDefinition[]) array.toArray(new IMacroDefinition[0]);
|
return array.toArray(new IMacroDefinition[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IMacroDefinition[] getBuiltinMacroDefinitions(String name) {
|
public IMacroDefinition[] getBuiltinMacroDefinitions(String name) {
|
||||||
IMacroDefinition[] variables = getBuiltinMacroDefinitions();
|
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++) {
|
for (int i = 0; i < variables.length; i++) {
|
||||||
if (variables[i].getName().equals(name)) {
|
if (variables[i].getName().equals(name)) {
|
||||||
array.add(variables[i]);
|
array.add(variables[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (IMacroDefinition[]) array.toArray(new IMacroDefinition[0]);
|
return array.toArray(new IMacroDefinition[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IInferenceRule[] getBuiltinInferenceRules() {
|
public IInferenceRule[] getBuiltinInferenceRules() {
|
||||||
IDirective[] stmts = getBuiltins();
|
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++) {
|
for (int i = 0; i < stmts.length; i++) {
|
||||||
if (stmts[i] instanceof IInferenceRule) {
|
if (stmts[i] instanceof IInferenceRule) {
|
||||||
array.add((IInferenceRule)stmts[i]);
|
array.add((IInferenceRule)stmts[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (IInferenceRule[]) array.toArray(new IInferenceRule[0]);
|
return array.toArray(new IInferenceRule[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IInferenceRule[] getBuiltinInferenceRules(String target) {
|
public IInferenceRule[] getBuiltinInferenceRules(String target) {
|
||||||
IInferenceRule[] irules = getBuiltinInferenceRules();
|
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++) {
|
for (int i = 0; i < irules.length; i++) {
|
||||||
if (irules[i].getTarget().toString().equals(target)) {
|
if (irules[i].getTarget().toString().equals(target)) {
|
||||||
array.add(irules[i]);
|
array.add(irules[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (IInferenceRule[]) array.toArray(new IInferenceRule[0]);
|
return array.toArray(new IInferenceRule[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String expandString(String line) {
|
public String expandString(String line) {
|
||||||
return expandString(line, false);
|
return expandString(line, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String expandString(String line, boolean recursive) {
|
public String expandString(String line, boolean recursive) {
|
||||||
int len = line.length();
|
int len = line.length();
|
||||||
boolean foundDollar = false;
|
boolean foundDollar = false;
|
||||||
|
@ -258,6 +271,7 @@ public abstract class AbstractMakefile extends Parent implements IMakefile {
|
||||||
return buffer.toString();
|
return buffer.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public URI getFileURI() {
|
public URI getFileURI() {
|
||||||
return filename;
|
return filename;
|
||||||
}
|
}
|
||||||
|
@ -267,17 +281,17 @@ public abstract class AbstractMakefile extends Parent implements IMakefile {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
public IMakefile getMakefile() {
|
public IMakefile getMakefile() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IMakefileReaderProvider getMakefileReaderProvider() {
|
public IMakefileReaderProvider getMakefileReaderProvider() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
@Override
|
||||||
* @see org.eclipse.cdt.make.core.makefile.IMakefile#parse(java.net.URI, org.eclipse.cdt.make.core.makefile.IMakefileReaderProvider)
|
|
||||||
*/
|
|
||||||
public void parse(URI fileURI,
|
public void parse(URI fileURI,
|
||||||
IMakefileReaderProvider makefileReaderProvider) throws IOException {
|
IMakefileReaderProvider makefileReaderProvider) throws IOException {
|
||||||
// not used
|
// not used
|
||||||
|
|
|
@ -35,7 +35,7 @@ import org.eclipse.swt.graphics.RGB;
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractMakefileCodeScanner extends RuleBasedScanner {
|
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;
|
private String[] fPropertyNamesColor;
|
||||||
/**
|
/**
|
||||||
* Preference keys for boolean preferences which are <code>true</code>,
|
* 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) {
|
protected Token getToken(String key) {
|
||||||
return (Token) fTokenMap.get(key);
|
return fTokenMap.get(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addToken(String colorKey, String boldKey, String italicKey) {
|
private void addToken(String colorKey, String boldKey, String italicKey) {
|
||||||
|
|
|
@ -15,6 +15,7 @@ public class AutoconfSubstRule implements IPredicateRule {
|
||||||
private char[][] fSortedLineDelimiters;
|
private char[][] fSortedLineDelimiters;
|
||||||
|
|
||||||
private static class DecreasingCharArrayLengthComparator implements Comparator<Object> {
|
private static class DecreasingCharArrayLengthComparator implements Comparator<Object> {
|
||||||
|
@Override
|
||||||
public int compare(Object o1, Object o2) {
|
public int compare(Object o1, Object o2) {
|
||||||
return ((char[]) o2).length - ((char[]) o1).length;
|
return ((char[]) o2).length - ((char[]) o1).length;
|
||||||
}
|
}
|
||||||
|
@ -26,6 +27,7 @@ public class AutoconfSubstRule implements IPredicateRule {
|
||||||
this.token = token;
|
this.token = token;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IToken evaluate(ICharacterScanner scanner, boolean resume) {
|
public IToken evaluate(ICharacterScanner scanner, boolean resume) {
|
||||||
char[][] originalDelimiters= scanner.getLegalLineDelimiters();
|
char[][] originalDelimiters= scanner.getLegalLineDelimiters();
|
||||||
int count= originalDelimiters.length;
|
int count= originalDelimiters.length;
|
||||||
|
@ -81,10 +83,12 @@ public class AutoconfSubstRule implements IPredicateRule {
|
||||||
return Token.UNDEFINED;
|
return Token.UNDEFINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IToken getSuccessToken() {
|
public IToken getSuccessToken() {
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IToken evaluate(ICharacterScanner scanner) {
|
public IToken evaluate(ICharacterScanner scanner) {
|
||||||
return evaluate(scanner, false);
|
return evaluate(scanner, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,23 +41,17 @@ public class AutomakeCompletionProcessor implements IContentAssistProcessor {
|
||||||
|
|
||||||
protected int fInstallOffset;
|
protected int fInstallOffset;
|
||||||
|
|
||||||
/*
|
@Override
|
||||||
* @see IContextInformationValidator#isContextInformationValid(int)
|
|
||||||
*/
|
|
||||||
public boolean isContextInformationValid(int offset) {
|
public boolean isContextInformationValid(int offset) {
|
||||||
return Math.abs(fInstallOffset - offset) < 5;
|
return Math.abs(fInstallOffset - offset) < 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
@Override
|
||||||
* @see IContextInformationValidator#install(IContextInformation, ITextViewer, int)
|
|
||||||
*/
|
|
||||||
public void install(IContextInformation info, ITextViewer viewer, int offset) {
|
public void install(IContextInformation info, ITextViewer viewer, int offset) {
|
||||||
fInstallOffset = offset;
|
fInstallOffset = offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
@Override
|
||||||
* @see org.eclipse.jface.text.contentassist.IContextInformationPresenter#updatePresentation(int, TextPresentation)
|
|
||||||
*/
|
|
||||||
public boolean updatePresentation(int documentPosition, TextPresentation presentation) {
|
public boolean updatePresentation(int documentPosition, TextPresentation presentation) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -65,9 +59,7 @@ public class AutomakeCompletionProcessor implements IContentAssistProcessor {
|
||||||
|
|
||||||
public static class DirectiveComparator implements Comparator<Object> {
|
public static class DirectiveComparator implements Comparator<Object> {
|
||||||
|
|
||||||
/* (non-Javadoc)
|
@Override
|
||||||
* @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
|
|
||||||
*/
|
|
||||||
public int compare(Object o1, Object o2) {
|
public int compare(Object o1, Object o2) {
|
||||||
String name1;
|
String name1;
|
||||||
String name2;
|
String name2;
|
||||||
|
@ -106,9 +98,7 @@ public class AutomakeCompletionProcessor implements IContentAssistProcessor {
|
||||||
fManager = AutomakeEditorFactory.getDefault().getWorkingCopyManager();
|
fManager = AutomakeEditorFactory.getDefault().getWorkingCopyManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
@Override
|
||||||
* @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#computeCompletionProposals(org.eclipse.jface.text.ITextViewer, int)
|
|
||||||
*/
|
|
||||||
public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int documentOffset) {
|
public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int documentOffset) {
|
||||||
WordPartDetector wordPart = new WordPartDetector(viewer, documentOffset);
|
WordPartDetector wordPart = new WordPartDetector(viewer, documentOffset);
|
||||||
boolean macro = WordPartDetector.inMacro(viewer, documentOffset);
|
boolean macro = WordPartDetector.inMacro(viewer, documentOffset);
|
||||||
|
@ -124,7 +114,7 @@ public class AutomakeCompletionProcessor implements IContentAssistProcessor {
|
||||||
statements = makefile.getTargetRules();
|
statements = makefile.getTargetRules();
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<ICompletionProposal> proposalList = new ArrayList<ICompletionProposal>(statements.length);
|
ArrayList<ICompletionProposal> proposalList = new ArrayList<>(statements.length);
|
||||||
|
|
||||||
// iterate over all the different categories
|
// iterate over all the different categories
|
||||||
for (int i = 0; i < statements.length; i++) {
|
for (int i = 0; i < statements.length; i++) {
|
||||||
|
@ -156,19 +146,17 @@ public class AutomakeCompletionProcessor implements IContentAssistProcessor {
|
||||||
proposalList.add(result);
|
proposalList.add(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ICompletionProposal[] proposals = (ICompletionProposal[]) proposalList.toArray(new ICompletionProposal[0]);
|
ICompletionProposal[] proposals = proposalList.toArray(new ICompletionProposal[0]);
|
||||||
Arrays.sort(proposals, comparator);
|
Arrays.sort(proposals, comparator);
|
||||||
return proposals;
|
return proposals;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
@Override
|
||||||
* @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#computeContextInformation(org.eclipse.jface.text.ITextViewer, int)
|
|
||||||
*/
|
|
||||||
public IContextInformation[] computeContextInformation(ITextViewer viewer, int documentOffset) {
|
public IContextInformation[] computeContextInformation(ITextViewer viewer, int documentOffset) {
|
||||||
WordPartDetector wordPart = new WordPartDetector(viewer, documentOffset);
|
WordPartDetector wordPart = new WordPartDetector(viewer, documentOffset);
|
||||||
boolean macro = WordPartDetector.inMacro(viewer, documentOffset);
|
boolean macro = WordPartDetector.inMacro(viewer, documentOffset);
|
||||||
IMakefile makefile = fManager.getWorkingCopy(fEditor.getEditorInput());
|
IMakefile makefile = fManager.getWorkingCopy(fEditor.getEditorInput());
|
||||||
ArrayList<String> contextList = new ArrayList<String>();
|
ArrayList<String> contextList = new ArrayList<>();
|
||||||
if (macro) {
|
if (macro) {
|
||||||
IDirective[] statements = makefile.getMacroDefinitions();
|
IDirective[] statements = makefile.getMacroDefinitions();
|
||||||
for (int i = 0; i < statements.length; i++) {
|
for (int i = 0; i < statements.length; i++) {
|
||||||
|
@ -198,37 +186,29 @@ public class AutomakeCompletionProcessor implements IContentAssistProcessor {
|
||||||
|
|
||||||
IContextInformation[] result = new IContextInformation[contextList.size()];
|
IContextInformation[] result = new IContextInformation[contextList.size()];
|
||||||
for (int i = 0; i < result.length; i++) {
|
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);
|
result[i] = new ContextInformation(imageMacro, wordPart.toString(), context);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
@Override
|
||||||
* @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getCompletionProposalAutoActivationCharacters()
|
|
||||||
*/
|
|
||||||
public char[] getCompletionProposalAutoActivationCharacters() {
|
public char[] getCompletionProposalAutoActivationCharacters() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
@Override
|
||||||
* @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getContextInformationAutoActivationCharacters()
|
|
||||||
*/
|
|
||||||
public char[] getContextInformationAutoActivationCharacters() {
|
public char[] getContextInformationAutoActivationCharacters() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
@Override
|
||||||
* @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getErrorMessage()
|
|
||||||
*/
|
|
||||||
public String getErrorMessage() {
|
public String getErrorMessage() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
@Override
|
||||||
* @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#getContextInformationValidator()
|
|
||||||
*/
|
|
||||||
public IContextInformationValidator getContextInformationValidator() {
|
public IContextInformationValidator getContextInformationValidator() {
|
||||||
return fValidator;
|
return fValidator;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ public class AutomakeConfigMacro extends Directive {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return name + "\n";
|
return name + "\n";
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,16 +32,12 @@ public class AutomakeDocumentProvider extends TextFileDocumentProvider implement
|
||||||
public IMakefile fCopy;
|
public IMakefile fCopy;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
@Override
|
||||||
* @see org.eclipse.ui.editors.text.TextFileDocumentProvider#createEmptyFileInfo()
|
|
||||||
*/
|
|
||||||
protected FileInfo createEmptyFileInfo() {
|
protected FileInfo createEmptyFileInfo() {
|
||||||
return new AutomakefileFileInfo();
|
return new AutomakefileFileInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
@Override
|
||||||
* @see org.eclipse.ui.editors.text.TextFileDocumentProvider#createFileInfo(java.lang.Object)
|
|
||||||
*/
|
|
||||||
protected FileInfo createFileInfo(Object element) throws CoreException {
|
protected FileInfo createFileInfo(Object element) throws CoreException {
|
||||||
IMakefile original = null;
|
IMakefile original = null;
|
||||||
if (element instanceof IFileEditorInput) {
|
if (element instanceof IFileEditorInput) {
|
||||||
|
@ -81,9 +77,7 @@ public class AutomakeDocumentProvider extends TextFileDocumentProvider implement
|
||||||
return makefile;
|
return makefile;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
@Override
|
||||||
* @see org.eclipse.cdt.internal.autotools.ui.editors.automake.IMakefileDocumentProvider#getWorkingCopy(java.lang.Object)
|
|
||||||
*/
|
|
||||||
public IMakefile getWorkingCopy(Object element) {
|
public IMakefile getWorkingCopy(Object element) {
|
||||||
FileInfo fileInfo= getFileInfo(element);
|
FileInfo fileInfo= getFileInfo(element);
|
||||||
if (fileInfo instanceof AutomakefileFileInfo) {
|
if (fileInfo instanceof AutomakefileFileInfo) {
|
||||||
|
@ -93,9 +87,7 @@ public class AutomakeDocumentProvider extends TextFileDocumentProvider implement
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
@Override
|
||||||
* @see org.eclipse.cdt.internal.autotools.ui.editors.automake.IMakefileDocumentProvider#shutdown()
|
|
||||||
*/
|
|
||||||
public void shutdown() {
|
public void shutdown() {
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
Iterator e= getConnectedElementsIterator();
|
Iterator e= getConnectedElementsIterator();
|
||||||
|
@ -103,6 +95,7 @@ public class AutomakeDocumentProvider extends TextFileDocumentProvider implement
|
||||||
disconnect(e.next());
|
disconnect(e.next());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void connect(Object element) throws CoreException {
|
public void connect(Object element) throws CoreException {
|
||||||
super.connect(element);
|
super.connect(element);
|
||||||
IMakefile makefile = getWorkingCopy(element);
|
IMakefile makefile = getWorkingCopy(element);
|
||||||
|
@ -110,8 +103,9 @@ public class AutomakeDocumentProvider extends TextFileDocumentProvider implement
|
||||||
errorHandler.update(makefile);
|
errorHandler.update(makefile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IDocument getDocument(Object element) {
|
public IDocument getDocument(Object element) {
|
||||||
FileInfo info= (FileInfo) getFileInfo(element);
|
FileInfo info= getFileInfo(element);
|
||||||
if (info != null)
|
if (info != null)
|
||||||
return info.fTextFileBuffer.getDocument();
|
return info.fTextFileBuffer.getDocument();
|
||||||
return getParentProvider().getDocument(element);
|
return getParentProvider().getDocument(element);
|
||||||
|
|
|
@ -51,7 +51,8 @@ public class AutomakeEditor extends MakefileEditor {
|
||||||
return fgInstance;
|
return fgInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void doSetInput(IEditorInput newInput) throws CoreException
|
@Override
|
||||||
|
protected void doSetInput(IEditorInput newInput) throws CoreException
|
||||||
{
|
{
|
||||||
super.doSetInput(newInput);
|
super.doSetInput(newInput);
|
||||||
this.input = newInput;
|
this.input = newInput;
|
||||||
|
@ -59,9 +60,7 @@ public class AutomakeEditor extends MakefileEditor {
|
||||||
getOutlinePage().setInput(input);
|
getOutlinePage().setInput(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
@Override
|
||||||
* @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#initializeEditor()
|
|
||||||
*/
|
|
||||||
protected void initializeEditor() {
|
protected void initializeEditor() {
|
||||||
setRangeIndicator(new DefaultRangeIndicator());
|
setRangeIndicator(new DefaultRangeIndicator());
|
||||||
setEditorContextMenuId("#MakefileEditorContext"); //$NON-NLS-1$
|
setEditorContextMenuId("#MakefileEditorContext"); //$NON-NLS-1$
|
||||||
|
@ -93,16 +92,12 @@ public class AutomakeEditor extends MakefileEditor {
|
||||||
return ampage;
|
return ampage;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
@Override
|
||||||
* @see org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
|
|
||||||
*/
|
|
||||||
public void createPartControl(Composite parent) {
|
public void createPartControl(Composite parent) {
|
||||||
super.createPartControl(parent);
|
super.createPartControl(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
@Override
|
||||||
* Method declared on IAdaptable
|
|
||||||
*/
|
|
||||||
public Object getAdapter(@SuppressWarnings("rawtypes") Class key) {
|
public Object getAdapter(@SuppressWarnings("rawtypes") Class key) {
|
||||||
if (key.equals(IContentOutlinePage.class)) {
|
if (key.equals(IContentOutlinePage.class)) {
|
||||||
return getAutomakeOutlinePage();
|
return getAutomakeOutlinePage();
|
||||||
|
@ -114,6 +109,7 @@ public class AutomakeEditor extends MakefileEditor {
|
||||||
return sourceViewerConfiguration;
|
return sourceViewerConfiguration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void handlePreferenceStoreChanged(PropertyChangeEvent event) {
|
protected void handlePreferenceStoreChanged(PropertyChangeEvent event) {
|
||||||
super.handlePreferenceStoreChanged(event);
|
super.handlePreferenceStoreChanged(event);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,14 +38,17 @@ public class AutomakeErrorHandler {
|
||||||
super(annotationType, persist, message);
|
super(annotationType, persist, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setQuickFixable(boolean state) {
|
public void setQuickFixable(boolean state) {
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isQuickFixableStateSet() {
|
public boolean isQuickFixableStateSet() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isQuickFixable() throws AssertionFailedException {
|
public boolean isQuickFixable() throws AssertionFailedException {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,6 @@
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.autotools.ui.editors.automake;
|
package org.eclipse.cdt.internal.autotools.ui.editors.automake;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class AutomakeIfElse extends Parent {
|
public class AutomakeIfElse extends Parent {
|
||||||
String condition;
|
String condition;
|
||||||
String type;
|
String type;
|
||||||
|
|
|
@ -34,10 +34,12 @@ class AutomakeMacroDefinitionRule implements IPredicateRule {
|
||||||
this.defaultToken = defaultToken;
|
this.defaultToken = defaultToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IToken getSuccessToken() {
|
public IToken getSuccessToken() {
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IToken evaluate(ICharacterScanner scanner, boolean resume) {
|
public IToken evaluate(ICharacterScanner scanner, boolean resume) {
|
||||||
buffer.setLength(0);
|
buffer.setLength(0);
|
||||||
int c;
|
int c;
|
||||||
|
@ -148,6 +150,7 @@ class AutomakeMacroDefinitionRule implements IPredicateRule {
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IToken evaluate(ICharacterScanner scanner) {
|
public IToken evaluate(ICharacterScanner scanner) {
|
||||||
return evaluate(scanner, false);
|
return evaluate(scanner, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,11 +35,13 @@ public class AutomakeMacroReferenceRule extends PatternRule {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected IToken doEvaluate(ICharacterScanner scanner, boolean resume) {
|
protected IToken doEvaluate(ICharacterScanner scanner, boolean resume) {
|
||||||
nOfBrackets = 1;
|
nOfBrackets = 1;
|
||||||
return super.doEvaluate(scanner, resume);
|
return super.doEvaluate(scanner, resume);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected boolean endSequenceDetected(ICharacterScanner scanner) {
|
protected boolean endSequenceDetected(ICharacterScanner scanner) {
|
||||||
int c;
|
int c;
|
||||||
char[][] delimiters = scanner.getLegalLineDelimiters();
|
char[][] delimiters = scanner.getLegalLineDelimiters();
|
||||||
|
|
|
@ -29,6 +29,7 @@ public class AutomakeTextHover implements ITextHover, ITextHoverExtension {
|
||||||
this.editor = editor;
|
this.editor = editor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) {
|
public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) {
|
||||||
TargetRule target = null;
|
TargetRule target = null;
|
||||||
String[] preReqs = 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 "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IRegion getHoverRegion(ITextViewer textViewer, int offset) {
|
public IRegion getHoverRegion(ITextViewer textViewer, int offset) {
|
||||||
|
|
||||||
if (textViewer != null) {
|
if (textViewer != null) {
|
||||||
|
@ -177,6 +168,7 @@ public class AutomakeTextHover implements ITextHover, ITextHoverExtension {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IInformationControlCreator getHoverControlCreator() {
|
public IInformationControlCreator getHoverControlCreator() {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -17,10 +17,12 @@ public class AutomakeWordDetector implements IWordDetector {
|
||||||
private static final String correctStartSpecChars = "$%*().><"; //$NON-NLS-1$
|
private static final String correctStartSpecChars = "$%*().><"; //$NON-NLS-1$
|
||||||
private static final String correctSpecChars = "?@$/\\<*%"; //$NON-NLS-1$
|
private static final String correctSpecChars = "?@$/\\<*%"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isWordStart(char character) {
|
public boolean isWordStart(char character) {
|
||||||
return Character.isLetterOrDigit(character) || (correctStartSpecChars.indexOf(character) >= 0);
|
return Character.isLetterOrDigit(character) || (correctStartSpecChars.indexOf(character) >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isWordPart(char character) {
|
public boolean isWordPart(char character) {
|
||||||
return Character.isLetterOrDigit(character) || (correctSpecChars.indexOf(character) >= 0);
|
return Character.isLetterOrDigit(character) || (correctSpecChars.indexOf(character) >= 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,6 +67,7 @@ public class AutomakefileCodeScanner extends AbstractMakefileCodeScanner {
|
||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected List<IRule> createRules() {
|
protected List<IRule> createRules() {
|
||||||
IToken keyword = getToken(ColorManager.MAKE_KEYWORD_COLOR);
|
IToken keyword = getToken(ColorManager.MAKE_KEYWORD_COLOR);
|
||||||
IToken function = getToken(ColorManager.MAKE_FUNCTION_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 macroDef = getToken(ColorManager.MAKE_MACRO_DEF_COLOR);
|
||||||
IToken other = getToken(ColorManager.MAKE_DEFAULT_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.
|
// Add rule for single line comments.
|
||||||
rules.add(new EndOfLineRule("#", comment, '\\', true)); //$NON-NLS-1$
|
rules.add(new EndOfLineRule("#", comment, '\\', true)); //$NON-NLS-1$
|
||||||
|
|
||||||
// Add generic whitespace rule.
|
// Add generic whitespace rule.
|
||||||
rules.add(new WhitespaceRule(new IWhitespaceDetector() {
|
rules.add(new WhitespaceRule(new IWhitespaceDetector() {
|
||||||
|
@Override
|
||||||
public boolean isWhitespace(char character) {
|
public boolean isWhitespace(char character) {
|
||||||
return Character.isWhitespace(character);
|
return Character.isWhitespace(character);
|
||||||
}
|
}
|
||||||
|
@ -136,13 +138,7 @@ public class AutomakefileCodeScanner extends AbstractMakefileCodeScanner {
|
||||||
return rules;
|
return rules;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IToken nextToken() {
|
@Override
|
||||||
return super.nextToken();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @see AbstractMakefileCodeScanner#getTokenProperties()
|
|
||||||
*/
|
|
||||||
protected String[] getTokenProperties() {
|
protected String[] getTokenProperties() {
|
||||||
return fTokenProperties;
|
return fTokenProperties;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.autotools.ui.MakeUIImages;
|
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.ITreeContentProvider;
|
||||||
import org.eclipse.jface.viewers.LabelProvider;
|
import org.eclipse.jface.viewers.LabelProvider;
|
||||||
import org.eclipse.jface.viewers.TreeViewer;
|
import org.eclipse.jface.viewers.TreeViewer;
|
||||||
|
@ -43,9 +42,7 @@ public class AutomakefileContentOutlinePage extends ContentOutlinePage {
|
||||||
protected IMakefile makefile;
|
protected IMakefile makefile;
|
||||||
protected IMakefile nullMakefile = new NullMakefile();
|
protected IMakefile nullMakefile = new NullMakefile();
|
||||||
|
|
||||||
/* (non-Javadoc)
|
@Override
|
||||||
* @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
|
|
||||||
*/
|
|
||||||
public Object[] getChildren(Object element) {
|
public Object[] getChildren(Object element) {
|
||||||
if (element == fInput) {
|
if (element == fInput) {
|
||||||
return getElements(makefile);
|
return getElements(makefile);
|
||||||
|
@ -55,9 +52,7 @@ public class AutomakefileContentOutlinePage extends ContentOutlinePage {
|
||||||
return new Object[0];
|
return new Object[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
@Override
|
||||||
* @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
|
|
||||||
*/
|
|
||||||
public Object getParent(Object element) {
|
public Object getParent(Object element) {
|
||||||
if (element instanceof IMakefile) {
|
if (element instanceof IMakefile) {
|
||||||
return fInput;
|
return fInput;
|
||||||
|
@ -67,9 +62,7 @@ public class AutomakefileContentOutlinePage extends ContentOutlinePage {
|
||||||
return fInput;
|
return fInput;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
@Override
|
||||||
* @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
|
|
||||||
*/
|
|
||||||
public boolean hasChildren(Object element) {
|
public boolean hasChildren(Object element) {
|
||||||
if (element == fInput) {
|
if (element == fInput) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -83,9 +76,7 @@ public class AutomakefileContentOutlinePage extends ContentOutlinePage {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
@Override
|
||||||
* @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
|
|
||||||
*/
|
|
||||||
public Object[] getElements(Object inputElement) {
|
public Object[] getElements(Object inputElement) {
|
||||||
IDirective[] directives;
|
IDirective[] directives;
|
||||||
if (inputElement == fInput) {
|
if (inputElement == fInput) {
|
||||||
|
@ -101,7 +92,7 @@ public class AutomakefileContentOutlinePage extends ContentOutlinePage {
|
||||||
} else {
|
} else {
|
||||||
directives = new IDirective[0];
|
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++) {
|
for (int i = 0; i < directives.length; i++) {
|
||||||
if (showMacroDefinition && directives[i] instanceof IMacroDefinition) {
|
if (showMacroDefinition && directives[i] instanceof IMacroDefinition) {
|
||||||
list.add(directives[i]);
|
list.add(directives[i]);
|
||||||
|
@ -123,15 +114,11 @@ public class AutomakefileContentOutlinePage extends ContentOutlinePage {
|
||||||
return list.toArray();
|
return list.toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
@Override
|
||||||
* @see org.eclipse.jface.viewers.IContentProvider#dispose()
|
|
||||||
*/
|
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
@Override
|
||||||
* @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(Viewer viewer, Object oldInput, Object newInput) {
|
||||||
if (oldInput != null) {
|
if (oldInput != null) {
|
||||||
makefile = nullMakefile;
|
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)
|
@Override
|
||||||
* @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
|
|
||||||
*/
|
|
||||||
public Image getImage(Object element) {
|
public Image getImage(Object element) {
|
||||||
if (element instanceof ITargetRule) {
|
if (element instanceof ITargetRule) {
|
||||||
return MakeUIImages.getImage(MakeUIImages.IMG_OBJS_MAKEFILE_TARGET_RULE);
|
return MakeUIImages.getImage(MakeUIImages.IMG_OBJS_MAKEFILE_TARGET_RULE);
|
||||||
|
@ -175,9 +160,7 @@ public class AutomakefileContentOutlinePage extends ContentOutlinePage {
|
||||||
return super.getImage(element);
|
return super.getImage(element);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
@Override
|
||||||
* @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
|
|
||||||
*/
|
|
||||||
public String getText(Object element) {
|
public String getText(Object element) {
|
||||||
String name;
|
String name;
|
||||||
if (element instanceof IRule) {
|
if (element instanceof IRule) {
|
||||||
|
@ -234,6 +217,7 @@ public class AutomakefileContentOutlinePage extends ContentOutlinePage {
|
||||||
final Control control = viewer.getControl();
|
final Control control = viewer.getControl();
|
||||||
if (control != null && !control.isDisposed()) {
|
if (control != null && !control.isDisposed()) {
|
||||||
control.getDisplay().asyncExec(new Runnable() {
|
control.getDisplay().asyncExec(new Runnable() {
|
||||||
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (!control.isDisposed()) {
|
if (!control.isDisposed()) {
|
||||||
control.setRedraw(false);
|
control.setRedraw(false);
|
||||||
|
@ -247,9 +231,7 @@ public class AutomakefileContentOutlinePage extends ContentOutlinePage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
@Override
|
||||||
* @see org.eclipse.ui.part.IPage#createControl(org.eclipse.swt.widgets.Composite)
|
|
||||||
*/
|
|
||||||
public void createControl(Composite parent) {
|
public void createControl(Composite parent) {
|
||||||
super.createControl(parent);
|
super.createControl(parent);
|
||||||
TreeViewer viewer = getTreeViewer();
|
TreeViewer viewer = getTreeViewer();
|
||||||
|
@ -258,39 +240,9 @@ public class AutomakefileContentOutlinePage extends ContentOutlinePage {
|
||||||
if (fInput != null) {
|
if (fInput != null) {
|
||||||
viewer.setInput(fInput);
|
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)
|
public void inputChanged(Object oldInput, Object newInput) {
|
||||||
* @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) {
|
|
||||||
if (oldInput != null) {
|
if (oldInput != null) {
|
||||||
makefile = nullMakefile;
|
makefile = nullMakefile;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,23 +39,19 @@ public class AutomakefileReconcilingStrategy implements IReconcilingStrategy {
|
||||||
fOutliner= editor.getAutomakeOutlinePage();
|
fOutliner= editor.getAutomakeOutlinePage();
|
||||||
fLastRegionOffset = Integer.MAX_VALUE;
|
fLastRegionOffset = Integer.MAX_VALUE;
|
||||||
fEditor= editor;
|
fEditor= editor;
|
||||||
input = (IEditorInput) fEditor.getEditorInput();
|
input = fEditor.getEditorInput();
|
||||||
fManager= AutomakeEditorFactory.getDefault().getWorkingCopyManager();
|
fManager= AutomakeEditorFactory.getDefault().getWorkingCopyManager();
|
||||||
fDocumentProvider= AutomakeEditorFactory.getDefault().getAutomakefileDocumentProvider();
|
fDocumentProvider= AutomakeEditorFactory.getDefault().getAutomakefileDocumentProvider();
|
||||||
fErrorHandler= new AutomakeErrorHandler(input);
|
fErrorHandler= new AutomakeErrorHandler(input);
|
||||||
fMakefileReconcilingParticipant= (IReconcilingParticipant)fEditor;
|
fMakefileReconcilingParticipant= (IReconcilingParticipant)fEditor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* @see IReconcilingStrategy#reconcile(document)
|
|
||||||
*/
|
|
||||||
public void setDocument(IDocument document) {
|
public void setDocument(IDocument document) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* @see IReconcilingStrategy#reconcile(region)
|
|
||||||
*/
|
|
||||||
public void reconcile(IRegion region) {
|
public void reconcile(IRegion region) {
|
||||||
// We use a trick to avoid running the reconciler multiple times
|
// We use a trick to avoid running the reconciler multiple times
|
||||||
// on a file when it gets changed. This is because this gets called
|
// 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();
|
fLastRegionOffset = region.getOffset();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* @see IReconcilingStrategy#reconcile(dirtyRegion, region)
|
|
||||||
*/
|
|
||||||
public void reconcile(DirtyRegion dirtyRegion, IRegion region) {
|
public void reconcile(DirtyRegion dirtyRegion, IRegion region) {
|
||||||
// FIXME: This seems to generate too much flashing in
|
// FIXME: This seems to generate too much flashing in
|
||||||
// the contentoutline viewer.
|
// the contentoutline viewer.
|
||||||
|
|
|
@ -24,7 +24,6 @@ import org.eclipse.jface.text.reconciler.IReconciler;
|
||||||
import org.eclipse.jface.text.reconciler.MonoReconciler;
|
import org.eclipse.jface.text.reconciler.MonoReconciler;
|
||||||
import org.eclipse.jface.text.rules.DefaultDamagerRepairer;
|
import org.eclipse.jface.text.rules.DefaultDamagerRepairer;
|
||||||
import org.eclipse.jface.text.source.ISourceViewer;
|
import org.eclipse.jface.text.source.ISourceViewer;
|
||||||
import org.eclipse.jface.text.source.SourceViewerConfiguration;
|
|
||||||
import org.eclipse.jface.util.PropertyChangeEvent;
|
import org.eclipse.jface.util.PropertyChangeEvent;
|
||||||
|
|
||||||
|
|
||||||
|
@ -54,6 +53,7 @@ public class AutomakefileSourceConfiguration extends
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) {
|
public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) {
|
||||||
if (amHover == null)
|
if (amHover == null)
|
||||||
amHover = new AutomakeTextHover(editor);
|
amHover = new AutomakeTextHover(editor);
|
||||||
|
@ -63,6 +63,7 @@ public class AutomakefileSourceConfiguration extends
|
||||||
/**
|
/**
|
||||||
* @param event
|
* @param event
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void adaptToPreferenceChange(PropertyChangeEvent event) {
|
public void adaptToPreferenceChange(PropertyChangeEvent event) {
|
||||||
AutomakefileCodeScanner scanner = getAutomakeCodeScanner();
|
AutomakefileCodeScanner scanner = getAutomakeCodeScanner();
|
||||||
scanner.adaptToPreferenceChange(event);
|
scanner.adaptToPreferenceChange(event);
|
||||||
|
@ -72,11 +73,13 @@ public class AutomakefileSourceConfiguration extends
|
||||||
* @param event
|
* @param event
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean affectsBehavior(PropertyChangeEvent event) {
|
public boolean affectsBehavior(PropertyChangeEvent event) {
|
||||||
AutomakefileCodeScanner scanner = getAutomakeCodeScanner();
|
AutomakefileCodeScanner scanner = getAutomakeCodeScanner();
|
||||||
return scanner.affectsBehavior(event);
|
return scanner.affectsBehavior(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IPresentationReconciler getPresentationReconciler(ISourceViewer v) {
|
public IPresentationReconciler getPresentationReconciler(ISourceViewer v) {
|
||||||
|
|
||||||
PresentationReconciler reconciler = new PresentationReconciler();
|
PresentationReconciler reconciler = new PresentationReconciler();
|
||||||
|
@ -111,10 +114,7 @@ public class AutomakefileSourceConfiguration extends
|
||||||
return reconciler;
|
return reconciler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
/**
|
|
||||||
* @see SourceViewerConfiguration#getReconciler(ISourceViewer)
|
|
||||||
*/
|
|
||||||
public IReconciler getReconciler(ISourceViewer sourceViewer) {
|
public IReconciler getReconciler(ISourceViewer sourceViewer) {
|
||||||
if (editor != null && editor.isEditable()) {
|
if (editor != null && editor.isEditable()) {
|
||||||
MonoReconciler reconciler= new MonoReconciler(new AutomakefileReconcilingStrategy(editor), false);
|
MonoReconciler reconciler= new MonoReconciler(new AutomakefileReconcilingStrategy(editor), false);
|
||||||
|
@ -125,9 +125,7 @@ public class AutomakefileSourceConfiguration extends
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* @see org.eclipse.jface.text.source.SourceViewerConfiguration#getContentAssistant(ISourceViewer)
|
|
||||||
*/
|
|
||||||
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
|
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
|
||||||
ContentAssistant assistant = new ContentAssistant();
|
ContentAssistant assistant = new ContentAssistant();
|
||||||
assistant.setContentAssistProcessor(new AutomakeCompletionProcessor(editor), IDocument.DEFAULT_CONTENT_TYPE);
|
assistant.setContentAssistProcessor(new AutomakeCompletionProcessor(editor), IDocument.DEFAULT_CONTENT_TYPE);
|
||||||
|
|
|
@ -19,6 +19,7 @@ public class BadDirective extends Directive implements IBadDirective {
|
||||||
line = s;
|
line = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@ public class Command extends Directive implements ICommand {
|
||||||
* target as a prerequisite or has no prerequisites, any error
|
* target as a prerequisite or has no prerequisites, any error
|
||||||
* found while executing the command will be ignored.
|
* found while executing the command will be ignored.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean shouldIgnoreError() {
|
public boolean shouldIgnoreError() {
|
||||||
// Check for the prefix hyphen in the command.
|
// Check for the prefix hyphen in the command.
|
||||||
if (getPrefix() == HYPHEN) {
|
if (getPrefix() == HYPHEN) {
|
||||||
|
@ -52,6 +53,7 @@ public class Command extends Directive implements ICommand {
|
||||||
* target as a prerequisite or has no prerequisites, the command
|
* target as a prerequisite or has no prerequisites, the command
|
||||||
* will not be written to standard output before it is executed.
|
* will not be written to standard output before it is executed.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean shouldBeSilent() {
|
public boolean shouldBeSilent() {
|
||||||
// Check for the prefix at sign
|
// Check for the prefix at sign
|
||||||
if (getPrefix() == AT) {
|
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
|
* command line that will be executed even if -n, -q or -t is
|
||||||
* specified.
|
* specified.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean shouldExecute() {
|
public boolean shouldExecute() {
|
||||||
// Check for the prefix at sign
|
// Check for the prefix at sign
|
||||||
if (getPrefix() == PLUS) {
|
if (getPrefix() == PLUS) {
|
||||||
|
@ -73,6 +76,7 @@ public class Command extends Directive implements ICommand {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuffer cmd = new StringBuffer();
|
StringBuffer cmd = new StringBuffer();
|
||||||
cmd.append( '\t');
|
cmd.append( '\t');
|
||||||
|
@ -83,12 +87,14 @@ public class Command extends Directive implements ICommand {
|
||||||
return cmd.toString();
|
return cmd.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean equals(Object cmd) {
|
public boolean equals(Object cmd) {
|
||||||
if (cmd instanceof Command)
|
if (cmd instanceof Command)
|
||||||
return cmd.toString().equals(toString());
|
return cmd.toString().equals(toString());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return toString().hashCode();
|
return toString().hashCode();
|
||||||
}
|
}
|
||||||
|
@ -108,9 +114,7 @@ public class Command extends Directive implements ICommand {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
@Override
|
||||||
* @see org.eclipse.cdt.make.core.makefile.ICommand#execute(java.lang.String[], java.io.File)
|
|
||||||
*/
|
|
||||||
public Process execute(String shell, String[] envp, File dir) throws IOException {
|
public Process execute(String shell, String[] envp, File dir) throws IOException {
|
||||||
String[] cmdArray = new String[] { shell, "-c", command}; //$NON-NLS-1$
|
String[] cmdArray = new String[] { shell, "-c", command}; //$NON-NLS-1$
|
||||||
return Runtime.getRuntime().exec(cmdArray, envp, dir);
|
return Runtime.getRuntime().exec(cmdArray, envp, dir);
|
||||||
|
|
|
@ -23,18 +23,21 @@ public class Comment extends Directive implements IComment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuffer buffer = new StringBuffer();
|
StringBuffer buffer = new StringBuffer();
|
||||||
buffer.append(POUND_STRING).append(comment).append('\n');
|
buffer.append(POUND_STRING).append(comment).append('\n');
|
||||||
return buffer.toString();
|
return buffer.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean equals(Object cmt) {
|
public boolean equals(Object cmt) {
|
||||||
if (cmt instanceof Comment)
|
if (cmt instanceof Comment)
|
||||||
return cmt.toString().equals(toString());
|
return cmt.toString().equals(toString());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return toString().hashCode();
|
return toString().hashCode();
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,24 +18,11 @@ import org.eclipse.jface.text.contentassist.ICompletionProposal;
|
||||||
|
|
||||||
public class CompletionProposalComparator implements Comparator<ICompletionProposal>, Serializable {
|
public class CompletionProposalComparator implements Comparator<ICompletionProposal>, Serializable {
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Constructor for CompletionProposalComparator.
|
|
||||||
*/
|
|
||||||
public CompletionProposalComparator() {
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see Comparator#compare(Object, Object)
|
|
||||||
*/
|
|
||||||
public int compare(ICompletionProposal o1, ICompletionProposal o2) {
|
public int compare(ICompletionProposal o1, ICompletionProposal o2) {
|
||||||
ICompletionProposal c1= (ICompletionProposal) o1;
|
return o1.getDisplayString().compareToIgnoreCase(o2.getDisplayString());
|
||||||
ICompletionProposal c2= (ICompletionProposal) o2;
|
|
||||||
return c1.getDisplayString().compareToIgnoreCase(c2.getDisplayString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,14 +37,17 @@ public abstract class Conditional extends Parent implements IConditional {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getConditional() {
|
public String getConditional() {
|
||||||
return cond;
|
return cond;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getArg1() {
|
public String getArg1() {
|
||||||
return arg1;
|
return arg1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getArg2() {
|
public String getArg2() {
|
||||||
return arg2;
|
return arg2;
|
||||||
}
|
}
|
||||||
|
@ -53,22 +56,27 @@ public abstract class Conditional extends Parent implements IConditional {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isIfdef() {
|
public boolean isIfdef() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isIfndef() {
|
public boolean isIfndef() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isIfeq() {
|
public boolean isIfeq() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isIfneq() {
|
public boolean isIfneq() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isElse() {
|
public boolean isElse() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,10 +17,12 @@ public class DefineVariable extends GNUVariableDef {
|
||||||
super(parent, name, value);
|
super(parent, name, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isMultiLine() {
|
public boolean isMultiLine() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuffer sb = new StringBuffer(GNUMakefileConstants.VARIABLE_DEFINE);
|
StringBuffer sb = new StringBuffer(GNUMakefileConstants.VARIABLE_DEFINE);
|
||||||
sb.append(getName()).append('\n');
|
sb.append(getName()).append('\n');
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue