1414
1515import java .lang .reflect .Field ;
1616import java .util .ArrayList ;
17+ import org .eclipse .jface .resource .ImageDescriptor ;
1718import org .eclipse .jface .text .*;
1819import org .eclipse .jface .text .contentassist .ICompletionProposal ;
1920import org .eclipse .pde .internal .build .IBuildPropertiesConstants ;
21+ import org .eclipse .pde .internal .ui .PDEPluginImages ;
2022import org .eclipse .pde .internal .ui .editor .PDESourcePage ;
23+ import org .eclipse .swt .graphics .Image ;
2124
2225public class BuildPropertiesContentAssistProcessor extends TypePackageCompletionProcessor {
2326
2427 protected PDESourcePage fSourcePage ;
28+
2529 public BuildPropertiesContentAssistProcessor (PDESourcePage sourcePage ) {
2630 fSourcePage = sourcePage ;
2731 }
@@ -44,7 +48,8 @@ public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int
4448 continue ;
4549 }
4650 if (element .regionMatches (true , 0 , value , 0 , value .length ())) {
47- TypeCompletionProposal proposal = new TypeCompletionProposal (element , null , element , lineStart ,
51+ Image img = getImage (element );
52+ TypeCompletionProposal proposal = new TypeCompletionProposal (element , img , element , lineStart ,
4853 value .length ());
4954 completions .add (proposal );
5055 }
@@ -54,4 +59,24 @@ public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int
5459 }
5560 return null ;
5661 }
62+
63+ @ SuppressWarnings ("nls" )
64+ public Image getImage (String element ) {
65+ ImageDescriptor desc = switch (element )
66+ {
67+ case "src.includes" , "src.excludes" , "src.additionalRoots" , "permissions" , "root." , // linebreak
68+ "root" , ".permissions." , ".link" , "folder." , ".folder." , "link" , // linebreak
69+ "source." , "sourceFileExtensions" , "bin.includes" , "bin.excludes" , "javacCustomEncodings." , // linebreak
70+ "javacDefaultEncoding." -> PDEPluginImages .DESC_CATEGORY_OBJ ;
71+ case ".jar" , "jars.compile.order" , "jars.extra.classpath" -> PDEPluginImages .DESC_JAR_LIB_OBJ ;
72+ case "javacProjectSettings" -> PDEPluginImages .DESC_SETTINGS_OBJ ;
73+ case "javacErrors." -> PDEPluginImages .DESC_ERROR_ST_OBJ ;
74+ case "significantVersionDigits" , "generatedVersionLength" -> PDEPluginImages .DESC_INFO_ST_OBJ ;
75+ case "javacWarnings." -> PDEPluginImages .DESC_ALERT_OBJ ;
76+ case "jre.compilation.profile" -> PDEPluginImages .DESC_TARGET_ENVIRONMENT ;
77+ case "manifest." -> PDEPluginImages .DESC_FOLDER_OBJ ;
78+ default -> PDEPluginImages .DESC_DEFAULT_OBJ ;
79+ };
80+ return desc != null ? desc .createImage () : null ;
81+ }
5782}
0 commit comments