|
1 | 1 | /******************************************************************************* |
2 | | - * Copyright (c) 2000, 2022 IBM Corporation and others. |
| 2 | + * Copyright (c) 2000, 2025 IBM Corporation and others. |
3 | 3 | * |
4 | 4 | * This program and the accompanying materials |
5 | 5 | * are made available under the terms of the Eclipse Public License 2.0 |
|
20 | 20 | import java.util.Set; |
21 | 21 |
|
22 | 22 | import org.eclipse.swt.SWT; |
| 23 | +import org.eclipse.swt.custom.CTabFolder; |
| 24 | +import org.eclipse.swt.custom.CTabItem; |
23 | 25 | import org.eclipse.swt.widgets.Composite; |
24 | 26 | import org.eclipse.swt.widgets.Control; |
25 | 27 | import org.eclipse.swt.widgets.Shell; |
@@ -405,11 +407,20 @@ public BuildPathBasePage switchToTab(Class<? extends BuildPathBasePage> tabClass |
405 | 407 | JavaPlugin.logErrorMessage("Page does not support tab switching: "+this.getClass()); //$NON-NLS-1$ |
406 | 408 | return null; |
407 | 409 | } |
408 | | - TabFolder tabFolder= (TabFolder) fSWTControl.getParent(); |
409 | | - for (TabItem tabItem : tabFolder.getItems()) { |
410 | | - if (tabClass.isInstance(tabItem.getData())) { |
411 | | - tabFolder.setSelection(tabItem); |
412 | | - return (BuildPathBasePage) tabItem.getData(); |
| 410 | + if(fSWTControl.getParent() instanceof TabFolder tabFolder) { |
| 411 | + for (TabItem tabItem : tabFolder.getItems()) { |
| 412 | + if (tabClass.isInstance(tabItem.getData())) { |
| 413 | + tabFolder.setSelection(tabItem); |
| 414 | + return (BuildPathBasePage) tabItem.getData(); |
| 415 | + } |
| 416 | + } |
| 417 | + } |
| 418 | + if(fSWTControl.getParent() instanceof CTabFolder cTabFolder) { |
| 419 | + for (CTabItem ctabItem : cTabFolder.getItems()) { |
| 420 | + if (tabClass.isInstance(ctabItem.getData())) { |
| 421 | + cTabFolder.setSelection(ctabItem); |
| 422 | + return (BuildPathBasePage) ctabItem.getData(); |
| 423 | + } |
413 | 424 | } |
414 | 425 | } |
415 | 426 | return null; |
|
0 commit comments