|
Lines 36-41
Link Here
|
| 36 |
import org.eclipse.jface.viewers.Viewer; |
36 |
import org.eclipse.jface.viewers.Viewer; |
| 37 |
import org.eclipse.swt.SWT; |
37 |
import org.eclipse.swt.SWT; |
| 38 |
import org.eclipse.swt.custom.BusyIndicator; |
38 |
import org.eclipse.swt.custom.BusyIndicator; |
|
|
39 |
import org.eclipse.swt.custom.StackLayout; |
| 39 |
import org.eclipse.swt.events.ModifyEvent; |
40 |
import org.eclipse.swt.events.ModifyEvent; |
| 40 |
import org.eclipse.swt.events.ModifyListener; |
41 |
import org.eclipse.swt.events.ModifyListener; |
| 41 |
import org.eclipse.swt.events.SelectionAdapter; |
42 |
import org.eclipse.swt.events.SelectionAdapter; |
|
Lines 148-153
Link Here
|
| 148 |
* launch configuration type or <code>null</code> if none. |
149 |
* launch configuration type or <code>null</code> if none. |
| 149 |
*/ |
150 |
*/ |
| 150 |
private String fDescription = null; |
151 |
private String fDescription = null; |
|
|
152 |
|
| 153 |
/** |
| 154 |
* A placeholder for switching between the tabs for a config and the getting started tab |
| 155 |
* @since 3.2 |
| 156 |
*/ |
| 157 |
private Composite fTabPlaceHolder = null; |
| 158 |
|
| 159 |
/** |
| 160 |
* A new composite replacing the perspectives tab |
| 161 |
* @since 3.2 |
| 162 |
*/ |
| 163 |
private Composite fGettingStarted = null; |
| 151 |
|
164 |
|
| 152 |
/** |
165 |
/** |
| 153 |
* Constructs a viewer in the given composite, contained by the given |
166 |
* Constructs a viewer in the given composite, contained by the given |
|
Lines 232-249
Link Here
|
| 232 |
gd = new GridData(); |
245 |
gd = new GridData(); |
| 233 |
gd.horizontalSpan = 2; |
246 |
gd.horizontalSpan = 2; |
| 234 |
spacer.setLayoutData(gd); |
247 |
spacer.setLayoutData(gd); |
| 235 |
|
248 |
|
| 236 |
fTabComposite = new Composite(container, SWT.NONE); |
249 |
/* |
|
|
250 |
* fix for bug 66576 and 79709 |
| 251 |
*/ |
| 252 |
fTabPlaceHolder = new Composite(container, SWT.NONE); |
| 253 |
fTabPlaceHolder.setLayout(new StackLayout()); |
| 254 |
gd = new GridData(GridData.FILL_BOTH); |
| 255 |
gd.horizontalSpan = 2; |
| 256 |
fTabPlaceHolder.setLayoutData(gd); |
| 257 |
|
| 258 |
fGettingStarted = new Composite(fTabPlaceHolder, SWT.NONE); |
| 259 |
fGettingStarted.setLayout(new GridLayout()); |
| 260 |
gd = new GridData(GridData.FILL_BOTH); |
| 261 |
fGettingStarted.setLayoutData(gd); |
| 262 |
|
| 263 |
createGettingStarted(fGettingStarted); |
| 264 |
|
| 265 |
fTabComposite = new Composite(fTabPlaceHolder, SWT.NONE); |
| 237 |
GridLayout outerTabCompositeLayout = new GridLayout(); |
266 |
GridLayout outerTabCompositeLayout = new GridLayout(); |
| 238 |
outerTabCompositeLayout.marginHeight = 0; |
267 |
outerTabCompositeLayout.marginHeight = 0; |
| 239 |
outerTabCompositeLayout.marginWidth = 0; |
268 |
outerTabCompositeLayout.marginWidth = 0; |
| 240 |
fTabComposite.setLayout(outerTabCompositeLayout); |
269 |
fTabComposite.setLayout(outerTabCompositeLayout); |
| 241 |
gd = new GridData(GridData.FILL_BOTH); |
270 |
gd = new GridData(GridData.FILL_BOTH); |
| 242 |
gd.horizontalSpan = 2; |
|
|
| 243 |
fTabComposite.setLayoutData(gd); |
271 |
fTabComposite.setLayoutData(gd); |
| 244 |
|
272 |
|
| 245 |
createTabFolder(fTabComposite); |
273 |
createTabFolder(fTabComposite); |
| 246 |
|
274 |
|
| 247 |
Composite buttonComp = new Composite(container, SWT.NONE); |
275 |
Composite buttonComp = new Composite(container, SWT.NONE); |
| 248 |
GridLayout buttonCompLayout = new GridLayout(); |
276 |
GridLayout buttonCompLayout = new GridLayout(); |
| 249 |
buttonCompLayout.numColumns = 2; |
277 |
buttonCompLayout.numColumns = 2; |
|
Lines 278-283
Link Here
|
| 278 |
|
306 |
|
| 279 |
} |
307 |
} |
| 280 |
|
308 |
|
|
|
309 |
/** |
| 310 |
* Simple method to create a spacer in the page |
| 311 |
* |
| 312 |
* @param composite the composite to add the spacer to |
| 313 |
* @param columnSpan the amount of space for the spacer |
| 314 |
* @since 3.2 |
| 315 |
*/ |
| 316 |
protected void createSpacer(Composite composite, int columnSpan) { |
| 317 |
Label label = new Label(composite, SWT.NONE); |
| 318 |
GridData gd = new GridData(); |
| 319 |
gd.horizontalSpan = columnSpan; |
| 320 |
label.setLayoutData(gd); |
| 321 |
}// end createSpacer |
| 322 |
|
| 323 |
/** |
| 324 |
* Creates some help text for the tab group launch types |
| 325 |
* @param parent thep arent composite |
| 326 |
* @since 3.2 |
| 327 |
*/ |
| 328 |
private void createGettingStarted(Composite parent) { |
| 329 |
Font font = parent.getFont(); |
| 330 |
GridData gd = null; |
| 331 |
createSpacer(parent, 1); |
| 332 |
Label label = new Label(parent, SWT.LEFT | SWT.WRAP); |
| 333 |
label.setFont(font); |
| 334 |
label.setText(MessageFormat.format(LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_2, null)); |
| 335 |
gd = new GridData(GridData.FILL_HORIZONTAL); |
| 336 |
gd.widthHint = parent.getBounds().width - 30; |
| 337 |
label.setLayoutData(gd); |
| 338 |
createSpacer(parent, 1); |
| 339 |
label = new Label(parent, SWT.LEFT | SWT.WRAP); |
| 340 |
label.setFont(font); |
| 341 |
label.setText(MessageFormat.format(LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_1, null)); |
| 342 |
gd = new GridData(GridData.FILL_HORIZONTAL); |
| 343 |
gd.widthHint = parent.getBounds().width - 30; |
| 344 |
label.setLayoutData(gd); |
| 345 |
} |
| 346 |
|
| 347 |
/** |
| 348 |
* Creates the tab folder for displaying config instances |
| 349 |
* @param parent |
| 350 |
*/ |
| 281 |
private void createTabFolder(Composite parent) { |
351 |
private void createTabFolder(Composite parent) { |
| 282 |
Point size = null; |
352 |
Point size = null; |
| 283 |
if (fTabFolder != null) { |
353 |
if (fTabFolder != null) { |
|
Lines 465-482
Link Here
|
| 465 |
public void run() { |
535 |
public void run() { |
| 466 |
try { |
536 |
try { |
| 467 |
if (fInput instanceof ILaunchConfiguration) { |
537 |
if (fInput instanceof ILaunchConfiguration) { |
|
|
538 |
/* |
| 539 |
* fix for bug 66576 and 79709 |
| 540 |
*/ |
| 541 |
((StackLayout)fTabPlaceHolder.getLayout()).topControl = fTabComposite; |
| 542 |
fTabPlaceHolder.layout(true); |
| 468 |
ILaunchConfiguration configuration = (ILaunchConfiguration)fInput; |
543 |
ILaunchConfiguration configuration = (ILaunchConfiguration)fInput; |
| 469 |
setOriginal(configuration); |
544 |
setOriginal(configuration); |
| 470 |
setWorkingCopy(configuration.getWorkingCopy()); |
545 |
setWorkingCopy(configuration.getWorkingCopy()); |
| 471 |
displayInstanceTabs(); |
546 |
displayInstanceTabs(); |
| 472 |
} else if (fInput instanceof ILaunchConfigurationType) { |
547 |
} else if (fInput instanceof ILaunchConfigurationType) { |
| 473 |
ILaunchConfiguration configuration = LaunchConfigurationManager.getSharedTypeConfig((ILaunchConfigurationType)fInput); |
548 |
/* |
| 474 |
setOriginal(configuration); |
549 |
* fix for bug 66576 and 79709 |
| 475 |
setWorkingCopy(configuration.getWorkingCopy()); |
550 |
*/ |
| 476 |
displaySharedTabs(); |
551 |
fDescription = getDescription((ILaunchConfigurationType)fInput); |
|
|
552 |
fNameLabel.setVisible(false); |
| 553 |
fNameWidget.setVisible(false); |
| 554 |
setNoInput(); |
| 555 |
refreshStatus(); |
| 477 |
} else { |
556 |
} else { |
| 478 |
setNoInput(); |
557 |
setNoInput(); |
| 479 |
} |
558 |
}//end else |
| 480 |
setRedraw(true); |
559 |
setRedraw(true); |
| 481 |
} catch (CoreException ce) { |
560 |
} catch (CoreException ce) { |
| 482 |
errorDialog(ce); |
561 |
errorDialog(ce); |
|
Lines 491-497
Link Here
|
| 491 |
private void setNoInput() { |
570 |
private void setNoInput() { |
| 492 |
setOriginal(null); |
571 |
setOriginal(null); |
| 493 |
setWorkingCopy(null); |
572 |
setWorkingCopy(null); |
| 494 |
getVisibleArea().setVisible(false); |
573 |
((StackLayout)fTabPlaceHolder.getLayout()).topControl = fGettingStarted; |
|
|
574 |
fTabPlaceHolder.layout(true); |
| 495 |
disposeExistingTabs(); |
575 |
disposeExistingTabs(); |
| 496 |
} |
576 |
} |
| 497 |
|
577 |
|
|
Lines 558-623
Link Here
|
| 558 |
} |
638 |
} |
| 559 |
|
639 |
|
| 560 |
/** |
640 |
/** |
| 561 |
* Displays tabs for the current config type |
|
|
| 562 |
*/ |
| 563 |
protected void displaySharedTabs() { |
| 564 |
// Turn on initializing flag to ignore message updates |
| 565 |
setInitializingTabs(true); |
| 566 |
|
| 567 |
ILaunchConfigurationType type = null; |
| 568 |
try { |
| 569 |
type = getWorkingCopy().getType(); |
| 570 |
showSharedTabsFor(type); |
| 571 |
} catch (CoreException e) { |
| 572 |
errorDialog(e); |
| 573 |
setInitializingTabs(false); |
| 574 |
return; |
| 575 |
} |
| 576 |
|
| 577 |
// hide the name area |
| 578 |
fNameLabel.setVisible(false); |
| 579 |
fNameWidget.setVisible(false); |
| 580 |
// Update the name field before to avoid verify error |
| 581 |
getNameWidget().setText(getWorkingCopy().getName()); |
| 582 |
|
| 583 |
// Retrieve the current tab group. If there is none, clean up and leave |
| 584 |
ILaunchConfigurationTabGroup tabGroup = getTabGroup(); |
| 585 |
if (tabGroup == null) { |
| 586 |
IStatus status = new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), 0, MessageFormat.format(LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_No_tabs_defined_for_launch_configuration_type__0__1, new String[]{type.getName()}), null); |
| 587 |
CoreException e = new CoreException(status); |
| 588 |
errorDialog(e); |
| 589 |
setInitializingTabs(false); |
| 590 |
return; |
| 591 |
} |
| 592 |
|
| 593 |
// Update the tabs with the new working copy |
| 594 |
tabGroup.initializeFrom(getWorkingCopy()); |
| 595 |
|
| 596 |
// Update the name field after in case client changed it |
| 597 |
getNameWidget().setText(getWorkingCopy().getName()); |
| 598 |
|
| 599 |
fCurrentTabIndex = getTabFolder().getSelectionIndex(); |
| 600 |
|
| 601 |
// Turn off initializing flag to update message |
| 602 |
setInitializingTabs(false); |
| 603 |
|
| 604 |
if (!getVisibleArea().isVisible()) { |
| 605 |
getVisibleArea().setVisible(true); |
| 606 |
} |
| 607 |
|
| 608 |
fDescription = getDescription(null); |
| 609 |
|
| 610 |
refreshStatus(); |
| 611 |
} |
| 612 |
|
| 613 |
/** |
| 614 |
* Populate the tabs in the configuration edit area to be appropriate to the current |
641 |
* Populate the tabs in the configuration edit area to be appropriate to the current |
| 615 |
* launch configuration type. |
642 |
* launch configuration type. |
| 616 |
*/ |
643 |
*/ |
| 617 |
private void showInstanceTabsFor(ILaunchConfigurationType configType) { |
644 |
private void showInstanceTabsFor(ILaunchConfigurationType configType) { |
| 618 |
|
645 |
|
| 619 |
// Don't do any work if the current tabs are for the current config type |
646 |
// Don't do any work if the current tabs are for the current config type |
| 620 |
if (getTabType() != null && getTabType().equals(configType) && !(getTabGroup() instanceof PerspectiveTabGroup)) { |
647 |
if (getTabType() != null && getTabType().equals(configType)) { |
| 621 |
return; |
648 |
return; |
| 622 |
} |
649 |
} |
| 623 |
|
650 |
|
|
Lines 672-701
Link Here
|
| 672 |
} |
699 |
} |
| 673 |
|
700 |
|
| 674 |
/** |
701 |
/** |
| 675 |
* Populate the tabs in the configuration edit area for the shared info |
|
|
| 676 |
* for the given launch config type. |
| 677 |
*/ |
| 678 |
private void showSharedTabsFor(ILaunchConfigurationType configType) { |
| 679 |
|
| 680 |
// Don't do any work if the current tabs are for the current config type |
| 681 |
if (getTabType() != null && getTabType().equals(configType) && (getTabGroup() instanceof PerspectiveTabGroup)) { |
| 682 |
return; |
| 683 |
} |
| 684 |
|
| 685 |
// Build the new tabs |
| 686 |
ILaunchConfigurationTabGroup group = new PerspectiveTabGroup(configType); |
| 687 |
group.createTabs(getLaunchConfigurationDialog(), getLaunchConfigurationDialog().getMode()); |
| 688 |
ILaunchConfigurationTab[] tabs = group.getTabs(); |
| 689 |
for (int i = 0; i < tabs.length; i++) { |
| 690 |
tabs[i].setLaunchConfigurationDialog(getLaunchConfigurationDialog()); |
| 691 |
} |
| 692 |
|
| 693 |
showTabsFor(group); |
| 694 |
setTabType(configType); |
| 695 |
setTabGroup(group); |
| 696 |
} |
| 697 |
|
| 698 |
/** |
| 699 |
* Create the tabs in the configuration edit area for the given tab group. |
702 |
* Create the tabs in the configuration edit area for the given tab group. |
| 700 |
*/ |
703 |
*/ |
| 701 |
private void showTabsFor(ILaunchConfigurationTabGroup tabGroup) { |
704 |
private void showTabsFor(ILaunchConfigurationTabGroup tabGroup) { |
|
Lines 934-944
Link Here
|
| 934 |
if(isInitializingTabs()) { |
937 |
if(isInitializingTabs()) { |
| 935 |
return false; |
938 |
return false; |
| 936 |
} |
939 |
} |
| 937 |
|
|
|
| 938 |
if (getActiveTab() instanceof PerspectivesTab) { |
| 939 |
return false; |
| 940 |
} |
| 941 |
|
| 942 |
if (getWorkingCopy() == null) { |
940 |
if (getWorkingCopy() == null) { |
| 943 |
return false; |
941 |
return false; |
| 944 |
} |
942 |
} |
|
Lines 1224-1234
Link Here
|
| 1224 |
* Notification that the 'Revert' button has been pressed |
1222 |
* Notification that the 'Revert' button has been pressed |
| 1225 |
*/ |
1223 |
*/ |
| 1226 |
protected void handleRevertPressed() { |
1224 |
protected void handleRevertPressed() { |
| 1227 |
if (getActiveTab() instanceof PerspectivesTab) { |
1225 |
inputChanged(getOriginal()); |
| 1228 |
inputChanged(getTabType()); |
|
|
| 1229 |
} else { |
| 1230 |
inputChanged(getOriginal()); |
| 1231 |
} |
| 1232 |
} |
1226 |
} |
| 1233 |
|
1227 |
|
| 1234 |
/** |
1228 |
/** |