Bug 196882 - [Schema][Editors] Remove "Label Property" and "Icon" fields from "Element Details" section
Summary: [Schema][Editors] Remove "Label Property" and "Icon" fields from "Element Det...
Status: RESOLVED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 M1   Edit
Assignee: Adam Archer CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2007-07-17 16:49 EDT by Mike Pawlowski CLA
Modified: 2007-07-22 01:29 EDT (History)
1 user (show)

See Also:
mike.pawlowski: review? (wassim.melhem)


Attachments
patch (13.58 KB, patch)
2007-07-19 12:00 EDT, Adam Archer CLA
no flags Details | Diff
patch (15.39 KB, patch)
2007-07-19 17:19 EDT, Adam Archer CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Pawlowski CLA 2007-07-17 16:49:54 EDT
Problems:

(1) Nobody understands what these fields are for
(2) These fields make the details section of elements more cluttered
(3) The fields only affect the presentation of elements in the manifest 
    editor Extensions tree viewer (icon and name)
    -> This should be calculated dynamically rather than having to 
       specified manually

Criteria:

For the element's presentation name, the element's first translatable attribute of type string should be used.

For the element's presentation icon, the element's first attribute of type resource should be used.

Recommendation:

I think the easiest and cleanest way to do this is to update the element's schema annotation everytime a new attribute is added (in the schema editor) only if a value has not already been specified:

         <appInfo>
            <meta.element labelAttribute="name" icon="icon"/>
         </appInfo>

Care has to be taken to preserve values already specified that do not meet the specified criteria above.
Comment 1 Wassim Melhem CLA 2007-07-17 16:51:54 EDT
Mike, can you take a look at bug 195764?
Comment 2 Adam Archer CLA 2007-07-19 12:00:58 EDT
Created attachment 74163 [details]
patch

The fields have been removed. The modelChanged method in AbstractSchemaDetails has been updated to validate and generate the properties if necessary. If the specified attributes become invalid and no suitable replacements are found, the properties are set to null. This will result in the defaults being used, which is the same behaviour as if the fields were left blank previous to this change.
Comment 3 Adam Archer CLA 2007-07-19 17:19:59 EDT
Created attachment 74196 [details]
patch

This is a much better implementation. If the properties are specified in the schema file, they are persisted and used. The "guessed" properties are not written to the schema, however. Instead, the SchemaAttribute.getLabelProperty() and SchemaAttribute.getIconProperty() will simply return the guessed values in the case that the requested property is null.
Comment 4 Wassim Melhem CLA 2007-07-22 01:29:40 EDT
Brilliant!  Thanks Adam.