Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8930593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:55:30+00:00 2026-06-15T08:55:30+00:00

I am implementing the the views for the OS X version of our SWT

  • 0

I am implementing the the views for the OS X version of our SWT Java application, and would like to use the ‘source list’ option offered by NSOutlineView in my SWT Tree.

I implemented this by hacking my own version of Tree.class by adding this code to the #createHandle() method:

long NSTableViewSelectionHighlightStyleSourceList = 1;
long hi = OS.sel_registerName("setSelectionHighlightStyle:");
OS.objc_msgSend(widget.id, hi, NSTableViewSelectionHighlightStyleSourceList);

Which essentially just flags the underlying NSOutlineView to use the NSTableViewSelectionHighlightStyleSourceList style.

It looks like this:

source list

which kind of works, but does not fully emulate the NSOutlineView behavior. For example, when selecting root nodes, even though the title has enough space it still truncates it like this:

source list with truncated title

Another problem with this is that I don’t know how to implement categories (or groups/folders) like you see in Finder.app/iTunes.app/Mail.app/the following example:

Finder.app example

Notice the FAVORITES category, and how it is formatted. This is handled in a regular ObjC application by returning true in the outlineView:isGroupItem method in the outlineView delegate, but I have no idea where to hack that in.

So my question is

How do I go about implementing the category(isGroupItem) functionality in SWT on OS X?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T08:55:31+00:00Added an answer on June 15, 2026 at 8:55 am

    I managed to make the adjustments to the SWT java source and native source to get this working as shown in the image below.

    A custom SWT for mac cocoa x86_64 can be dowloaded here.

    The changes made to the source at the time can be seen in this commit

    A snippet showing how this works is shown below. The SWT.SOURCE_LIST style is used to mark the tree as a source list and the SWT.GROUP_ITEM style is used to mark the items that are group items.

    import org.eclipse.swt.SWT;
    import org.eclipse.swt.layout.FillLayout;
    import org.eclipse.swt.widgets.Display;
    import org.eclipse.swt.widgets.Shell;
    import org.eclipse.swt.widgets.Tree;
    import org.eclipse.swt.widgets.TreeItem;
    
    public class SourceList {
    
        public static void main(String[] args) {
            Display display = new Display();
            Shell shell = new Shell(display);
            shell.setLayout(new FillLayout());
    
            final Tree tree = new Tree (shell, SWT.SOURCE_LIST);
    
            for (int i=0; i<4; i++) {
                final TreeItem iItem = new TreeItem (tree, SWT.GROUP_ITEM);
                display.asyncExec( new Runnable() {
                    public void run() {
                        iItem.setExpanded(true);
                    }
                });
                iItem.setText ("GROUP " + i);
                for (int j = 0; j < 4; j++) {
                    TreeItem jItem = new TreeItem (iItem, 0);
                    jItem.setText ("TreeItem " + j);
                }
            }
    
            shell.open();
            while (!shell.isDisposed()) {
                if (!display.readAndDispatch())
                    display.sleep();
            }
            display.dispose();
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking to use UISwipeGestureRecognizer for implementing a tweetie like interface for my application.
I'm implementing a web application which will support different views according to different browsers.
I've created my cakephp website and now would like to create a mobile version
What would be the rails way of implementing version control in my record management
I'm implementing drag'n'drop for views. When drag is started, I set visibility of the
I was implementing an android FFT guitar tuner. Here, I have 2 text views,
I have a universal binary application and currently working on the iPad version of
I'm working on implementing the code suggested here: Enforcing password strength requirements with django.contrib.auth.views.password_change
I am currently re-implementing some project using Lift. All the old views were done
It is the general way of implementing/connecting views using viewControllers ( as follows ).

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.