matthiasblaesing commented on issue #7909:
URL: https://github.com/apache/netbeans/issues/7909#issuecomment-2455428317

   Have a look here: 
https://bits.netbeans.org/23/javadoc/org-openide-modules/org/openide/modules/doc-files/i18n-branding.html
   
   The idea is, that the IDE/Platform contains many strings/formats you might 
want to customize. you need to set the Branding token, that identifies your 
application and create a ResourceBundle for that. Minimal sample:
   
   ```java
   import java.awt.BorderLayout;
   import java.awt.EventQueue;
   import java.util.ArrayList;
   import java.util.Collections;
   import java.util.List;
   import javax.swing.JFrame;
   import org.openide.explorer.view.OutlineView;
   import org.openide.util.NbBundle;
   
   public class TestX {
   
       public static void main(String[] args) {
           EventQueue.invokeLater(() -> {
               NbBundle.setBranding("dummy");
               OutlineView outlineView = new OutlineView() {
   
               };
               final List<String> attributes = new ArrayList<>();
               attributes.add("test1");
               attributes.add("test2");
               attributes.add("test3");
               Collections.sort(attributes);
               final String[] propertyColumns = new String[attributes.size() * 
2];
               int i = 0;
               for (String attr : attributes) {
                   propertyColumns[i++] = attr; // name
                   propertyColumns[i++] = null; // display name
               }
               outlineView.setPropertyColumns(propertyColumns);
               JFrame jframe = new JFrame("X");
               jframe.setSize(800, 600);
               jframe.setLayout(new BorderLayout());
               jframe.add(outlineView);
               jframe.setVisible(true);
           });
       }
   }
   ```
   
   The Branding token is here set programmatically, the NB launcher should take 
care of it. Create the ResourceBundle in file 
`org/openide/explorer/view/Bundle_dummy.properties`. Input this:
   
   ```properties
   OutlineViewOutline_NameAndDesc={0}
   ```
   
   This code: 
   
   
https://github.com/apache/netbeans/blob/45696ba6af2d663818daf33c49c3b2710e8d35e1/platform/openide.explorer/src/org/openide/explorer/view/OutlineView.java#L1913-L1935
   
   Builds the menu entry string via:
   
   
https://github.com/apache/netbeans/blob/45696ba6af2d663818daf33c49c3b2710e8d35e1/platform/o.n.swing.outline/src/org/netbeans/swing/etable/ColumnSelectionPanel.java#L122-L219
   
   You can't set the description to `null` (`FeatureDescription` will return 
the displayname in that case), so you will always land here:
   
   
https://github.com/apache/netbeans/blob/45696ba6af2d663818daf33c49c3b2710e8d35e1/platform/openide.explorer/src/org/openide/explorer/view/OutlineView.java#L1924
   
   And there is the Key you need to override (the path comes from the package).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to