Skip to content
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

Merged
merged 1 commit into from
May 3, 2023

Conversation

alshamams
Copy link
Contributor

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.

  • Classified the headers of the build.properties specification
  • Identified and attached the most meaningful existing images
  • Provided a generic image for the default case(when the work completes I expect only very few items under this category.)

Please let me know what you think of the general approach.

@github-actions
Copy link

github-actions bot commented Mar 24, 2023

Test Results

     240 files  ±0       240 suites  ±0   56m 51s ⏱️ + 7m 57s
  3 278 tests ±0    3 252 ✔️  - 1  24 💤 ±0  0 ±0  2 🔥 +1 
10 131 runs  ±0  10 057 ✔️  - 1  72 💤 ±0  0 ±0  2 🔥 +1 

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.

@alshamams
Copy link
Contributor Author

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.

Copy link
Member

@HannesWell HannesWell left a 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?

@laeubi
Copy link
Contributor

laeubi commented Apr 4, 2023

@HannesWell @alshamams any chance to finish this as of today?

@laeubi laeubi added this to the 4.28 M2 milestone Apr 4, 2023
@alshamams
Copy link
Contributor Author

@HannesWell @alshamams any chance to finish this as of today?

@laeubi All outstanding review comments have been addressed now.

Copy link
Member

@HannesWell HannesWell left a 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:

grafik

But that's something for another PR. :)

Comment on lines 63 to 82
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;
Copy link
Member

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:

Suggested change
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 $NON-NLS-1$ comments up to level 17 and split the line manually to make it readable.

Copy link
Contributor Author

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.

@vogella
Copy link
Contributor

vogella commented Apr 14, 2023

@alshamams could you update the PR with @HannesWell suggestion?

@alshamams
Copy link
Contributor Author

@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.

@alshamams
Copy link
Contributor Author

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:

grafik

But that's something for another PR. :)

@HannesWell
I actually wanted to attach the documented description from the javadoc, which provides full meaning to each of the icons in the list above in the form of help text.
Unfortunately that’s not working, so I’m planning to do this in a follow up PR.

Copy link
Contributor

@gireeshpunathil gireeshpunathil left a 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.

case "jre.compilation.profile" -> PDEPluginImages.DESC_TARGET_ENVIRONMENT;
case "manifest." -> PDEPluginImages.DESC_FOLDER_OBJ;
default -> PDEPluginImages.DESC_DEFAULT_OBJ;

Copy link
Contributor

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;
Copy link
Contributor

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?

Copy link
Contributor Author

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

Copy link
Member

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.

Copy link
Member

@HannesWell HannesWell left a 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.

Comment on lines 65 to 66
ImageDescriptor desc = null;
desc = switch (element)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ImageDescriptor desc = null;
desc = switch (element)
ImageDescriptor desc = switch (element)

Comment on lines 79 to 82
if (desc != null) {
return desc.createImage();
}
return null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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;
Copy link
Member

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.

@HannesWell
Copy link
Member

@alshamams do you want to address the pending remarks?
If yes can you please just squash and force push your branch. Eventually we will squash it any ways.

@alshamams
Copy link
Contributor Author

@alshamams do you want to address the pending remarks?
If yes can you please just squash and force push your branch. Eventually we will squash it any ways.

Hi @HannesWell,
I have been on sick leave the past week, and I will look into the pending remarks as soon as possible.

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.
@alshamams
Copy link
Contributor Author

Hi @HannesWell,
I have addressed all the pending remarks, squashed and force pushed the branch. Kindly let me know in case of any edits.

Copy link
Member

@HannesWell HannesWell left a 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 :)

@HannesWell HannesWell merged commit dabb850 into eclipse-pde:master May 3, 2023
11 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants