Skip to content

Replace usages of new Image(device, width, height) in Section #2861

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ShahzaibIbrahim
Copy link
Contributor

@ShahzaibIbrahim ShahzaibIbrahim commented Mar 26, 2025

Replace usages of new Image(device, width, height) in Section class. The class needed to be refactored in order to add the ImageGcWrapper.

How To Test

Run this example before and after this change. There should be no changes visibly.

public class EclipseSectionExample {

  public static void main(String[] args) {
      Display display = new Display();
      Shell shell = new Shell(display);
      shell.setText("Eclipse UI Section Example");
      shell.setSize(400, 300);
      shell.setLayout(new FillLayout());

      // Create FormToolkit
      FormToolkit toolkit = new FormToolkit(display);

      // Create a ScrolledForm
      ScrolledForm form = toolkit.createScrolledForm(shell);
      form.setText("Eclipse UI Section Example");
      form.getBody().setLayout(new GridLayout(1, false));

      // Create a section
      Section section = toolkit.createSection(form.getBody(), Section.TITLE_BAR | Section.EXPANDED);
      section.setText("My Section Title");
      section.setDescription("This is a description of the section.");
      section.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));

      // Create the section's client (content inside the section)
      Composite sectionClient = toolkit.createComposite(section);
      sectionClient.setLayout(new GridLayout(1, false));
      toolkit.createLabel(sectionClient, "This is inside the section.");

      // Attach the client to the section
      section.setClient(sectionClient);

      // Open the window
      shell.open();
      while (!shell.isDisposed()) {
          if (!display.readAndDispatch()) {
              display.sleep();
          }
      }

      // Cleanup resources
      toolkit.dispose();
      display.dispose();
  }

image

Copy link
Contributor

github-actions bot commented Mar 26, 2025

Test Results

 1 824 files  ±0   1 824 suites  ±0   1h 35m 1s ⏱️ - 9m 15s
 7 918 tests ±0   7 690 ✅ ±0  228 💤 ±0  0 ❌ ±0 
23 841 runs  ±0  23 093 ✅ ±0  748 💤 ±0  0 ❌ ±0 

Results for commit 0ac546c. ± Comparison against base commit bcd6dd1.

♻️ This comment has been updated with latest results.

@fedejeanne
Copy link
Contributor

Please add a How to test

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.

Replace usages of new Image(device, width, height) / new GC(image)
2 participants