-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auto-complete for build.properties: Image Icons #531
Conversation
Test Results 240 files ±0 240 suites ±0 56m 51s ⏱️ + 7m 57s For more details on these errors, see this check. Results for commit 854f8d3. ± Comparison against base commit b1a4e1c. ♻️ This comment has been updated with latest results. |
b508815
to
d64d2f2
Compare
Since I haven't heard any reviews pertaining to the previous commit, I am assuming that this is a reasonable approach and has further added images for all the features in build.properties. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes this is a reasonable approach, thank you for enhancing the content assist.
So is this PR complete from your POV and ready for review?
.../org/eclipse/pde/internal/ui/editor/contentassist/BuildPropertiesContentAssistProcessor.java
Outdated
Show resolved
Hide resolved
@HannesWell @alshamams any chance to finish this as of today? |
d64d2f2
to
db01193
Compare
@laeubi All outstanding review comments have been addressed now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't checked each image but in general it works. Just have one remark regarding the swtich statement.
Furthermore can you please format the class. There seem to be some miss-formatting.
In general the content-assist should be improved to provide more meaning full results and descriptions for each entry. At the moment it looks like in the following picture and I'm not sure if each entry is really useful:
But that's something for another PR. :)
public Image getImage(String element) { | ||
ImageDescriptor desc = null; | ||
switch (element) | ||
{ | ||
case "src.includes", "src.excludes", "src.additionalRoots", "permissions", "root.", "root", ".permissions.", ".link", "folder.", ".folder.", "link", "source.", "sourceFileExtensions", "bin.includes", "bin.excludes", "javacCustomEncodings.", "javacDefaultEncoding." -> desc = PDEPluginImages.DESC_CATEGORY_OBJ; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$//$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$ //$NON-NLS-14$ //$NON-NLS-15$ //$NON-NLS-16$ //$NON-NLS-17$ | ||
case ".jar", "jars.compile.order", "jars.extra.classpath" -> desc = PDEPluginImages.DESC_JAR_LIB_OBJ; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ | ||
case "javacProjectSettings" -> desc = PDEPluginImages.DESC_SETTINGS_OBJ; //$NON-NLS-1$ | ||
case "javacErrors." -> desc = PDEPluginImages.DESC_ERROR_ST_OBJ; //$NON-NLS-1$ | ||
case "significantVersionDigits", "generatedVersionLength" -> desc = PDEPluginImages.DESC_INFO_ST_OBJ; //$NON-NLS-1$ //$NON-NLS-2$ | ||
case "javacWarnings." -> desc = PDEPluginImages.DESC_ALERT_OBJ; //$NON-NLS-1$ | ||
case "jre.compilation.profile" -> desc = PDEPluginImages.DESC_TARGET_ENVIRONMENT; //$NON-NLS-1$ | ||
case "manifest." -> desc = PDEPluginImages.DESC_FOLDER_OBJ; //$NON-NLS-1$ | ||
default -> desc = PDEPluginImages.DESC_DEFAULT_OBJ; | ||
|
||
} | ||
if (desc != null) { | ||
return desc.createImage(); | ||
} | ||
return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use the switch itself as an expression instead of assigning the value of the desc
variable in each case:
public Image getImage(String element) { | |
ImageDescriptor desc = null; | |
switch (element) | |
{ | |
case "src.includes", "src.excludes", "src.additionalRoots", "permissions", "root.", "root", ".permissions.", ".link", "folder.", ".folder.", "link", "source.", "sourceFileExtensions", "bin.includes", "bin.excludes", "javacCustomEncodings.", "javacDefaultEncoding." -> desc = PDEPluginImages.DESC_CATEGORY_OBJ; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$//$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$ //$NON-NLS-14$ //$NON-NLS-15$ //$NON-NLS-16$ //$NON-NLS-17$ | |
case ".jar", "jars.compile.order", "jars.extra.classpath" -> desc = PDEPluginImages.DESC_JAR_LIB_OBJ; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ | |
case "javacProjectSettings" -> desc = PDEPluginImages.DESC_SETTINGS_OBJ; //$NON-NLS-1$ | |
case "javacErrors." -> desc = PDEPluginImages.DESC_ERROR_ST_OBJ; //$NON-NLS-1$ | |
case "significantVersionDigits", "generatedVersionLength" -> desc = PDEPluginImages.DESC_INFO_ST_OBJ; //$NON-NLS-1$ //$NON-NLS-2$ | |
case "javacWarnings." -> desc = PDEPluginImages.DESC_ALERT_OBJ; //$NON-NLS-1$ | |
case "jre.compilation.profile" -> desc = PDEPluginImages.DESC_TARGET_ENVIRONMENT; //$NON-NLS-1$ | |
case "manifest." -> desc = PDEPluginImages.DESC_FOLDER_OBJ; //$NON-NLS-1$ | |
default -> desc = PDEPluginImages.DESC_DEFAULT_OBJ; | |
} | |
if (desc != null) { | |
return desc.createImage(); | |
} | |
return null; | |
public Image getImage(String element) { | |
@SuppressWarnings("nls") | |
ImageDescriptor desc = switch (element) | |
{ | |
case "src.includes", "src.excludes", "src.additionalRoots", "permissions", "root.", "root", ".permissions.", ".link", "folder.", ".folder.", // | |
"link", "source.", "sourceFileExtensions", "bin.includes", "bin.excludes", "javacCustomEncodings.", "javacDefaultEncoding." -> PDEPluginImages.DESC_CATEGORY_OBJ; | |
case ".jar", "jars.compile.order", "jars.extra.classpath" -> PDEPluginImages.DESC_JAR_LIB_OBJ; | |
case "javacProjectSettings" -> PDEPluginImages.DESC_SETTINGS_OBJ; | |
case "javacErrors." -> PDEPluginImages.DESC_ERROR_ST_OBJ; | |
case "significantVersionDigits", "generatedVersionLength" -> PDEPluginImages.DESC_INFO_ST_OBJ; | |
case "javacWarnings." -> PDEPluginImages.DESC_ALERT_OBJ; | |
case "jre.compilation.profile" -> PDEPluginImages.DESC_TARGET_ENVIRONMENT; | |
case "manifest." -> PDEPluginImages.DESC_FOLDER_OBJ; | |
default -> PDEPluginImages.DESC_DEFAULT_OBJ; | |
}; | |
return desc.createImage(); | |
} |
Furthermore in this case I would simply suppress the nls warnings instead of adding
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@HannesWell
I have modified the switch case and suppressed the nls warnings.
After splitting the lines manually though, it reverts back to the original form upon formatting.
Do let me know in case of any more edits.
@alshamams could you update the PR with @HannesWell suggestion? |
@HannesWell @vogella I have been on holiday, and out sick lately. I will look into it, and will update the PR accordingly at the earliest. |
db01193
to
9519630
Compare
@HannesWell |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left few non-blocking comments, otherwise LGTM.
.../org/eclipse/pde/internal/ui/editor/contentassist/BuildPropertiesContentAssistProcessor.java
Show resolved
Hide resolved
case "jre.compilation.profile" -> PDEPluginImages.DESC_TARGET_ENVIRONMENT; | ||
case "manifest." -> PDEPluginImages.DESC_FOLDER_OBJ; | ||
default -> PDEPluginImages.DESC_DEFAULT_OBJ; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra line
ImageDescriptor desc = null; | ||
desc = switch (element) | ||
{ | ||
case "src.includes", "src.excludes", "src.additionalRoots", "permissions", "root.", "root", ".permissions.", ".link", "folder.", ".folder.", "link", "source.", "sourceFileExtensions", "bin.includes", "bin.excludes", "javacCustomEncodings.", "javacDefaultEncoding." -> PDEPluginImages.DESC_CATEGORY_OBJ; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this the result of formatting? if so, ignoring this line alone from formatting and manually breaking the line into 2 or 3 looks like a better thing to do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think that would be best. Will do so. @gireeshpunathil
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that line is a bit long. I suggest to put comments //
at the end of the manually broken line to prevent the formatter to merge them again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, the change looks good.
Just two additional non-blocking remarks about the code style.
This change should be squash-merged
and the resulting message should be cleaned up.
ImageDescriptor desc = null; | ||
desc = switch (element) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ImageDescriptor desc = null; | |
desc = switch (element) | |
ImageDescriptor desc = switch (element) |
if (desc != null) { | ||
return desc.createImage(); | ||
} | ||
return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (desc != null) { | |
return desc.createImage(); | |
} | |
return null; | |
return desc != null ? desc.createImage() : null; |
ImageDescriptor desc = null; | ||
desc = switch (element) | ||
{ | ||
case "src.includes", "src.excludes", "src.additionalRoots", "permissions", "root.", "root", ".permissions.", ".link", "folder.", ".folder.", "link", "source.", "sourceFileExtensions", "bin.includes", "bin.excludes", "javacCustomEncodings.", "javacDefaultEncoding." -> PDEPluginImages.DESC_CATEGORY_OBJ; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that line is a bit long. I suggest to put comments //
at the end of the manually broken line to prevent the formatter to merge them again.
9519630
to
1363fcb
Compare
@alshamams do you want to address the pending remarks? |
Hi @HannesWell, |
1363fcb
to
1b010c2
Compare
The auto-complete feature attaches most relevant image icons to the properties listing, so that the user is able to associate meaning of the property intuitively.
1b010c2
to
854f8d3
Compare
Hi @HannesWell, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR looks good now. Thank you @alshamams!
I have been on sick leave the past week, and I will look into the pending remarks as soon as possible.
No problem, it was just a gentle reminder/a question :)
Refs: #508
This PR addresses one of the pending items in the referenced PR. The auto-complete feature attaches most relevant image icons to the properties listing, so that the user is able to associate meaning of the property intuitively.
The work is incomplete. I have taken some assumptions here, and would like to get some reviews before proceeding further.
Please let me know what you think of the general approach.