|
Lines 37-48
Link Here
|
| 37 |
import org.eclipse.jface.dialogs.IDialogConstants; |
37 |
import org.eclipse.jface.dialogs.IDialogConstants; |
| 38 |
import org.eclipse.jface.viewers.ISelection; |
38 |
import org.eclipse.jface.viewers.ISelection; |
| 39 |
import org.eclipse.jface.viewers.IStructuredSelection; |
39 |
import org.eclipse.jface.viewers.IStructuredSelection; |
| 40 |
import org.eclipse.jface.viewers.SelectionChangedEvent; |
|
|
| 41 |
import org.eclipse.jface.viewers.StructuredSelection; |
40 |
import org.eclipse.jface.viewers.StructuredSelection; |
| 42 |
import org.eclipse.jface.viewers.Viewer; |
41 |
import org.eclipse.jface.viewers.Viewer; |
| 43 |
import org.eclipse.swt.SWT; |
42 |
import org.eclipse.swt.SWT; |
| 44 |
import org.eclipse.swt.custom.BusyIndicator; |
43 |
import org.eclipse.swt.custom.BusyIndicator; |
| 45 |
import org.eclipse.swt.custom.CLabel; |
|
|
| 46 |
import org.eclipse.swt.custom.CTabFolder; |
44 |
import org.eclipse.swt.custom.CTabFolder; |
| 47 |
import org.eclipse.swt.custom.CTabItem; |
45 |
import org.eclipse.swt.custom.CTabItem; |
| 48 |
import org.eclipse.swt.custom.StackLayout; |
46 |
import org.eclipse.swt.custom.StackLayout; |
|
Lines 67-73
Link Here
|
| 67 |
import org.eclipse.swt.widgets.Text; |
65 |
import org.eclipse.swt.widgets.Text; |
| 68 |
import org.eclipse.ui.IWorkbenchPreferenceConstants; |
66 |
import org.eclipse.ui.IWorkbenchPreferenceConstants; |
| 69 |
import org.eclipse.ui.PlatformUI; |
67 |
import org.eclipse.ui.PlatformUI; |
| 70 |
import org.eclipse.ui.activities.WorkbenchActivityHelper; |
|
|
| 71 |
|
68 |
|
| 72 |
import com.ibm.icu.text.MessageFormat; |
69 |
import com.ibm.icu.text.MessageFormat; |
| 73 |
|
70 |
|
|
Lines 309-332
Link Here
|
| 309 |
modes.remove(getLaunchConfigurationDialog().getMode()); |
306 |
modes.remove(getLaunchConfigurationDialog().getMode()); |
| 310 |
ILaunchConfigurationWorkingCopy wc = getWorkingCopy(); |
307 |
ILaunchConfigurationWorkingCopy wc = getWorkingCopy(); |
| 311 |
wc.setModes(modes); |
308 |
wc.setModes(modes); |
| 312 |
refresh(); |
|
|
| 313 |
refreshStatus(); |
309 |
refreshStatus(); |
| 314 |
} |
310 |
} |
| 315 |
} |
311 |
} |
| 316 |
} |
312 |
} |
| 317 |
else if(hasDuplicateDelegates()) { |
313 |
else if(hasMultipleDelegates()) { |
| 318 |
Set modes = new HashSet(); |
314 |
((LaunchConfigurationsDialog)getLaunchConfigurationDialog()).getPropertiesAction().run(); |
| 319 |
modes.add(getLaunchConfigurationDialog().getMode()); |
|
|
| 320 |
modes.addAll(getWorkingCopy().getModes()); |
| 321 |
SelectLaunchDelegatesDialog sld = new SelectLaunchDelegatesDialog(getShell(), fTabType.getDelegates(modes)); |
| 322 |
if(sld.open() == IDialogConstants.OK_ID) { |
| 323 |
Object[] res = sld.getResult(); |
| 324 |
if(res != null) { |
| 325 |
fTabType.setPreferredDelegate(modes, (ILaunchDelegate) res[0]); |
| 326 |
disposeExistingTabs(); |
| 327 |
displayInstanceTabs(); |
| 328 |
} |
| 329 |
} |
| 330 |
} |
315 |
} |
| 331 |
} catch (CoreException ex) {} |
316 |
} catch (CoreException ex) {} |
| 332 |
} |
317 |
} |
|
Lines 366-385
Link Here
|
| 366 |
} |
351 |
} |
| 367 |
|
352 |
|
| 368 |
/** |
353 |
/** |
| 369 |
* Simple method to create a spacer in the page |
|
|
| 370 |
* |
| 371 |
* @param composite the composite to add the spacer to |
| 372 |
* @param columnSpan the amount of space for the spacer |
| 373 |
* @since 3.2 |
| 374 |
*/ |
| 375 |
protected void createSpacer(Composite composite, int columnSpan) { |
| 376 |
Label label = new Label(composite, SWT.NONE); |
| 377 |
GridData gd = new GridData(); |
| 378 |
gd.horizontalSpan = columnSpan; |
| 379 |
label.setLayoutData(gd); |
| 380 |
} |
| 381 |
|
| 382 |
/** |
| 383 |
* Creates some help text for the tab group launch types |
354 |
* Creates some help text for the tab group launch types |
| 384 |
* @param parent thep arent composite |
355 |
* @param parent thep arent composite |
| 385 |
* @since 3.2 |
356 |
* @since 3.2 |
|
Lines 387-410
Link Here
|
| 387 |
private void createGettingStarted(Composite parent) { |
358 |
private void createGettingStarted(Composite parent) { |
| 388 |
Font font = parent.getFont(); |
359 |
Font font = parent.getFont(); |
| 389 |
GridData gd = null; |
360 |
GridData gd = null; |
| 390 |
createWrapLabel(parent, null, LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_1); |
361 |
int width = parent.getBounds().width - 30; |
| 391 |
createWrapLabel(parent, DebugUITools.getImage(IInternalDebugUIConstants.IMG_ELCL_NEW_CONFIG), |
362 |
SWTUtil.createWrapLabel(parent, LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_1, 1, width); |
| 392 |
LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_2); |
363 |
SWTUtil.createWrapCLabel(parent, LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_2, DebugUITools.getImage(IInternalDebugUIConstants.IMG_ELCL_NEW_CONFIG), 1, width); |
| 393 |
createWrapLabel(parent, DebugUITools.getImage(IInternalDebugUIConstants.IMG_ELCL_DUPLICATE_CONFIG), |
364 |
SWTUtil.createWrapCLabel(parent, LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_6, DebugUITools.getImage(IInternalDebugUIConstants.IMG_ELCL_DUPLICATE_CONFIG), 1, width); |
| 394 |
LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_6); |
365 |
SWTUtil.createWrapCLabel(parent, LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_4, DebugUITools.getImage(IInternalDebugUIConstants.IMG_ELCL_DELETE_CONFIG), 1, width); |
| 395 |
createWrapLabel(parent, DebugUITools.getImage(IInternalDebugUIConstants.IMG_ELCL_DELETE_CONFIG), |
366 |
SWTUtil.createWrapCLabel(parent, LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_8, DebugUITools.getImage(IInternalDebugUIConstants.IMG_ELCL_FILTER_CONFIGS), 1, width); |
| 396 |
LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_4); |
367 |
SWTUtil.createWrapCLabel(parent, LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_3, DebugUITools.getImage(IInternalDebugUIConstants.IMG_OVR_TRANSPARENT), 1, width); |
| 397 |
createWrapLabel(parent, DebugUITools.getImage(IInternalDebugUIConstants.IMG_ELCL_FILTER_CONFIGS), |
|
|
| 398 |
LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_8); |
| 399 |
createWrapLabel(parent, DebugUITools.getImage(IInternalDebugUIConstants.IMG_OVR_TRANSPARENT), |
| 400 |
LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_3); |
| 401 |
|
368 |
|
| 402 |
createSpacer(parent, 2); |
369 |
SWTUtil.createHorizontalSpacer(parent, 2); |
| 403 |
Link link = new Link(parent, SWT.LEFT | SWT.WRAP); |
370 |
Link link = new Link(parent, SWT.LEFT | SWT.WRAP); |
| 404 |
link.setText(LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_5); |
371 |
link.setText(LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_5); |
| 405 |
link.setFont(font); |
372 |
link.setFont(font); |
| 406 |
gd = new GridData(GridData.FILL_HORIZONTAL); |
373 |
gd = new GridData(GridData.FILL_HORIZONTAL); |
| 407 |
gd.widthHint = parent.getBounds().width - 30; |
374 |
gd.widthHint = width; |
| 408 |
link.setLayoutData(gd); |
375 |
link.setLayoutData(gd); |
| 409 |
link.addSelectionListener(new SelectionListener() { |
376 |
link.addSelectionListener(new SelectionListener() { |
| 410 |
public void widgetSelected(SelectionEvent e) { |
377 |
public void widgetSelected(SelectionEvent e) { |
|
Lines 413-434
Link Here
|
| 413 |
public void widgetDefaultSelected(SelectionEvent e) {} |
380 |
public void widgetDefaultSelected(SelectionEvent e) {} |
| 414 |
}); |
381 |
}); |
| 415 |
} |
382 |
} |
| 416 |
|
|
|
| 417 |
/** |
| 418 |
* Create a label on the given parent that wraps text. |
| 419 |
* |
| 420 |
* @param parent |
| 421 |
* @param text |
| 422 |
*/ |
| 423 |
private void createWrapLabel(Composite parent, Image image, String text) { |
| 424 |
CLabel lbl = new CLabel(parent, SWT.NONE | SWT.WRAP); |
| 425 |
lbl.setImage(image); |
| 426 |
lbl.setFont(parent.getFont()); |
| 427 |
lbl.setText(text); |
| 428 |
GridData gd = new GridData(GridData.FILL_HORIZONTAL); |
| 429 |
gd.widthHint = parent.getBounds().width - 30; |
| 430 |
lbl.setLayoutData(gd); |
| 431 |
} |
| 432 |
|
383 |
|
| 433 |
/** |
384 |
/** |
| 434 |
* Creates the tab folder for displaying config instances |
385 |
* Creates the tab folder for displaying config instances |
|
Lines 519-528
Link Here
|
| 519 |
* @see org.eclipse.jface.viewers.ISelectionProvider#getSelection() |
470 |
* @see org.eclipse.jface.viewers.ISelectionProvider#getSelection() |
| 520 |
*/ |
471 |
*/ |
| 521 |
public ISelection getSelection() { |
472 |
public ISelection getSelection() { |
| 522 |
if (getActiveTab() == null) { |
473 |
return new StructuredSelection(fWorkingCopy); |
| 523 |
return new StructuredSelection(); |
|
|
| 524 |
} |
| 525 |
return new StructuredSelection(getActiveTab()); |
| 526 |
} |
474 |
} |
| 527 |
|
475 |
|
| 528 |
/** |
476 |
/** |
|
Lines 540-562
Link Here
|
| 540 |
// update error ticks |
488 |
// update error ticks |
| 541 |
CTabItem item = null; |
489 |
CTabItem item = null; |
| 542 |
boolean error = false; |
490 |
boolean error = false; |
|
|
491 |
Image image = null; |
| 543 |
for (int i = 0; i < tabs.length; i++) { |
492 |
for (int i = 0; i < tabs.length; i++) { |
| 544 |
tabs[i].isValid(getWorkingCopy()); |
493 |
error = tabs[i].getErrorMessage() != null && !tabs[i].isValid(getWorkingCopy()); |
| 545 |
error = tabs[i].getErrorMessage() != null; |
494 |
image = tabs[i].getImage(); |
| 546 |
item = fTabFolder.getItem(i); |
495 |
item = fTabFolder.getItem(i); |
| 547 |
setTabIcon(item, error, tabs[i]); |
496 |
if(error) { |
|
|
497 |
item.setImage(DebugUIPlugin.getDefault().getLaunchConfigurationManager().getErrorTabImage(tabs[i])); |
| 498 |
} |
| 499 |
else { |
| 500 |
item.setImage(image); |
| 501 |
} |
| 548 |
} |
502 |
} |
| 549 |
if(!canLaunchWithModes()) { |
503 |
showLink(); |
| 550 |
fOptionsLink.setText(LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_13); |
504 |
} |
|
|
505 |
} |
| 506 |
|
| 507 |
/** |
| 508 |
* Shows the link for either multiple launch delegates or bad launch mode combinations |
| 509 |
* |
| 510 |
* @since 3.3 |
| 511 |
* |
| 512 |
* EXPERIMENTAL |
| 513 |
*/ |
| 514 |
private void showLink() { |
| 515 |
String text = null; |
| 516 |
if(!canLaunchWithModes()) { |
| 517 |
text = LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_13; |
| 518 |
} |
| 519 |
else if(hasMultipleDelegates()) { |
| 520 |
ILaunchDelegate delegate = getPreferredDelegate(); |
| 521 |
if(delegate != null) { |
| 522 |
String name = delegate.getName(); |
| 523 |
if(name == null) { |
| 524 |
text = LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_15; |
| 525 |
} |
| 526 |
else { |
| 527 |
text = MessageFormat.format(LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_16, new String[] {name}); |
| 528 |
} |
| 551 |
} |
529 |
} |
| 552 |
else if(hasDuplicateDelegates()) { |
530 |
else { |
| 553 |
fOptionsLink.setText(LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_15); |
531 |
text = LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_17; |
| 554 |
} |
532 |
} |
| 555 |
fOptionsLink.setVisible(!canLaunchWithModes() || hasDuplicateDelegates()); |
|
|
| 556 |
fOptionsLink.getParent().layout(); |
| 557 |
} |
533 |
} |
|
|
534 |
if(text != null) { |
| 535 |
fOptionsLink.setText(text); |
| 536 |
} |
| 537 |
fOptionsLink.setVisible(!canLaunchWithModes() || hasMultipleDelegates()); |
| 538 |
fOptionsLink.getParent().layout(); |
| 558 |
} |
539 |
} |
| 559 |
|
540 |
|
|
|
541 |
/** |
| 542 |
* Returns the preferred launch delegate for the current launch configuration and mode set |
| 543 |
* @return the preferred launch delegate |
| 544 |
* |
| 545 |
* @since 3.3 |
| 546 |
* |
| 547 |
* EXPERIMENTAL |
| 548 |
*/ |
| 549 |
protected ILaunchDelegate getPreferredDelegate() { |
| 550 |
ILaunchDelegate preferred = null; |
| 551 |
ILaunchConfigurationWorkingCopy config = getWorkingCopy(); |
| 552 |
if(config != null) { |
| 553 |
try { |
| 554 |
Set modes = getCurrentModeSet(); |
| 555 |
preferred = config.getPreferredDelegate(modes); |
| 556 |
if(preferred == null) { |
| 557 |
preferred = config.getType().getPreferredDelegate(modes); |
| 558 |
} |
| 559 |
} |
| 560 |
catch(CoreException ce) {DebugUIPlugin.log(ce);} |
| 561 |
} |
| 562 |
return preferred; |
| 563 |
} |
| 564 |
|
| 565 |
/** |
| 566 |
* Returns the listing of modes for the current config |
| 567 |
* @return the listing of modes for the current config |
| 568 |
* @since 3.3 |
| 569 |
* |
| 570 |
* EXPERIMENTAL |
| 571 |
*/ |
| 572 |
private Set getCurrentModeSet() { |
| 573 |
Set set = new HashSet(); |
| 574 |
ILaunchConfigurationWorkingCopy config = getWorkingCopy(); |
| 575 |
if(config != null) { |
| 576 |
try { |
| 577 |
set.addAll(config.getModes()); |
| 578 |
set.add(getLaunchConfigurationDialog().getMode()); |
| 579 |
} |
| 580 |
catch(CoreException ce) {DebugUIPlugin.log(ce);} |
| 581 |
} |
| 582 |
return set; |
| 583 |
} |
| 584 |
|
| 560 |
/** |
585 |
/** |
| 561 |
* updates the button states |
586 |
* updates the button states |
| 562 |
*/ |
587 |
*/ |
|
Lines 565-584
Link Here
|
| 565 |
fApplyButton.setEnabled(dirty && canSave()); |
590 |
fApplyButton.setEnabled(dirty && canSave()); |
| 566 |
fRevertButton.setEnabled(dirty); |
591 |
fRevertButton.setEnabled(dirty); |
| 567 |
} |
592 |
} |
| 568 |
|
|
|
| 569 |
/** |
| 570 |
* Set the specified tab item's icon to an error icon if <code>error</code> is true, |
| 571 |
* or a transparent icon of the same size otherwise. |
| 572 |
*/ |
| 573 |
private void setTabIcon(CTabItem tabItem, boolean error, ILaunchConfigurationTab tab) { |
| 574 |
Image image = null; |
| 575 |
if (error) { |
| 576 |
image = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getErrorTabImage(tab); |
| 577 |
} else { |
| 578 |
image = tab.getImage(); |
| 579 |
} |
| 580 |
tabItem.setImage(image); |
| 581 |
} |
| 582 |
|
593 |
|
| 583 |
/* (non-Javadoc) |
594 |
/* (non-Javadoc) |
| 584 |
* @see org.eclipse.jface.viewers.Viewer#setInput(java.lang.Object) |
595 |
* @see org.eclipse.jface.viewers.Viewer#setInput(java.lang.Object) |
|
Lines 673-679
Link Here
|
| 673 |
*/ |
684 |
*/ |
| 674 |
protected void setFocusOnName() { |
685 |
protected void setFocusOnName() { |
| 675 |
fNameWidget.setFocus(); |
686 |
fNameWidget.setFocus(); |
| 676 |
|
|
|
| 677 |
} |
687 |
} |
| 678 |
|
688 |
|
| 679 |
/** |
689 |
/** |
|
Lines 730-768
Link Here
|
| 730 |
* launch configuration type. |
740 |
* launch configuration type. |
| 731 |
*/ |
741 |
*/ |
| 732 |
private void showInstanceTabsFor(ILaunchConfigurationType configType) { |
742 |
private void showInstanceTabsFor(ILaunchConfigurationType configType) { |
| 733 |
|
|
|
| 734 |
// Don't do any work if the current tabs are for the current config type |
| 735 |
if (fTabType != null && fTabType.equals(configType)) { |
| 736 |
return; |
| 737 |
} |
| 738 |
|
| 739 |
// try to keep on same tab |
743 |
// try to keep on same tab |
| 740 |
Class tabKind = null; |
744 |
Class tabKind = null; |
| 741 |
if (getActiveTab() != null) { |
745 |
if (getActiveTab() != null) { |
| 742 |
tabKind = getActiveTab().getClass(); |
746 |
tabKind = getActiveTab().getClass(); |
| 743 |
} |
747 |
} |
| 744 |
|
|
|
| 745 |
// Build the new tabs |
748 |
// Build the new tabs |
| 746 |
ILaunchConfigurationTabGroup group = null; |
749 |
ILaunchConfigurationTabGroup group = null; |
| 747 |
try { |
750 |
try { |
| 748 |
group = createGroup(configType); |
751 |
group = createGroup(); |
| 749 |
} catch (CoreException ce) { |
752 |
} catch (CoreException ce) { |
| 750 |
DebugUIPlugin.errorDialog(getShell(), LaunchConfigurationsMessages.LaunchConfigurationDialog_Error_19, LaunchConfigurationsMessages.LaunchConfigurationDialog_Exception_occurred_creating_launch_configuration_tabs_27,ce); // |
753 |
DebugUIPlugin.errorDialog(getShell(), LaunchConfigurationsMessages.LaunchConfigurationDialog_Error_19, LaunchConfigurationsMessages.LaunchConfigurationDialog_Exception_occurred_creating_launch_configuration_tabs_27,ce); // |
| 751 |
return; |
754 |
return; |
| 752 |
} |
755 |
} |
| 753 |
|
756 |
disposeExistingTabs(); |
| 754 |
showTabsFor(group); |
|
|
| 755 |
fTabGroup = group; |
757 |
fTabGroup = group; |
| 756 |
fTabType = configType; |
758 |
fTabType = configType; |
| 757 |
|
|
|
| 758 |
// select same tab as before, if possible |
| 759 |
ILaunchConfigurationTab[] tabs = getTabs(); |
759 |
ILaunchConfigurationTab[] tabs = getTabs(); |
|
|
760 |
CTabItem tab = null; |
| 761 |
String name = EMPTY_STRING; |
| 762 |
Control control = null; |
| 763 |
for (int i = 0; i < tabs.length; i++) { |
| 764 |
tab = new CTabItem(fTabFolder, SWT.BORDER); |
| 765 |
name = tabs[i].getName(); |
| 766 |
if (name == null) { |
| 767 |
name = LaunchConfigurationsMessages.LaunchConfigurationDialog_unspecified_28; |
| 768 |
} |
| 769 |
tab.setText(name); |
| 770 |
tab.setImage(tabs[i].getImage()); |
| 771 |
tabs[i].createControl(tab.getParent()); |
| 772 |
control = tabs[i].getControl(); |
| 773 |
if (control != null) { |
| 774 |
tab.setControl(control); |
| 775 |
} |
| 776 |
} |
| 760 |
//set the default tab as the first one |
777 |
//set the default tab as the first one |
| 761 |
setActiveTab(tabs[0]); |
778 |
setActiveTab(tabs[0]); |
|
|
779 |
// select same tab as before, if possible |
| 762 |
for (int i = 0; i < tabs.length; i++) { |
780 |
for (int i = 0; i < tabs.length; i++) { |
| 763 |
ILaunchConfigurationTab tab = tabs[i]; |
781 |
if (tabs[i].getClass().equals(tabKind)) { |
| 764 |
if (tab.getClass().equals(tabKind)) { |
782 |
setActiveTab(tabs[i]); |
| 765 |
setActiveTab(tab); |
|
|
| 766 |
break; |
783 |
break; |
| 767 |
} |
784 |
} |
| 768 |
} |
785 |
} |
|
Lines 782-830
Link Here
|
| 782 |
String mode = fDialog.getMode(); |
799 |
String mode = fDialog.getMode(); |
| 783 |
description = LaunchConfigurationPresentationManager.getDefault().getDescription(configType, mode); |
800 |
description = LaunchConfigurationPresentationManager.getDefault().getDescription(configType, mode); |
| 784 |
} |
801 |
} |
| 785 |
if (description == null) |
802 |
if (description == null) { |
| 786 |
description = EMPTY_STRING; |
803 |
description = EMPTY_STRING; |
|
|
804 |
} |
| 787 |
return description; |
805 |
return description; |
| 788 |
} |
806 |
} |
| 789 |
|
807 |
|
| 790 |
/** |
808 |
/** |
| 791 |
* Create the tabs in the configuration edit area for the given tab group. |
|
|
| 792 |
*/ |
| 793 |
private void showTabsFor(ILaunchConfigurationTabGroup tabGroup) { |
| 794 |
// Dispose the current tabs |
| 795 |
disposeExistingTabs(); |
| 796 |
|
| 797 |
fTabGroup = tabGroup; |
| 798 |
|
| 799 |
// Create the Control for each tab |
| 800 |
ILaunchConfigurationTab[] tabs = tabGroup.getTabs(); |
| 801 |
CTabItem tab = null; |
| 802 |
String name = EMPTY_STRING; |
| 803 |
Control control = null; |
| 804 |
for (int i = 0; i < tabs.length; i++) { |
| 805 |
tab = new CTabItem(fTabFolder, SWT.BORDER); |
| 806 |
name = tabs[i].getName(); |
| 807 |
if (name == null) { |
| 808 |
name = LaunchConfigurationsMessages.LaunchConfigurationDialog_unspecified_28; |
| 809 |
} |
| 810 |
tab.setText(name); |
| 811 |
tab.setImage(tabs[i].getImage()); |
| 812 |
tabs[i].createControl(tab.getParent()); |
| 813 |
control = tabs[i].getControl(); |
| 814 |
if (control != null) { |
| 815 |
tab.setControl(control); |
| 816 |
} |
| 817 |
} |
| 818 |
|
| 819 |
} |
| 820 |
|
| 821 |
/** |
| 822 |
* Returns tab group for the given type of launch configuration. |
809 |
* Returns tab group for the given type of launch configuration. |
| 823 |
* Tabs are initialized to be contained in this dialog. |
810 |
* Tabs are initialized to be contained in this dialog. |
| 824 |
* |
811 |
* |
| 825 |
* @exception CoreException if unable to instantiate a tab group |
812 |
* @exception CoreException if unable to instantiate a tab group |
| 826 |
*/ |
813 |
*/ |
| 827 |
protected ILaunchConfigurationTabGroup createGroup(final ILaunchConfigurationType configType) throws CoreException { |
814 |
protected ILaunchConfigurationTabGroup createGroup() throws CoreException { |
| 828 |
// Use a final Object array to store the tab group and any exception that |
815 |
// Use a final Object array to store the tab group and any exception that |
| 829 |
// results from the Runnable |
816 |
// results from the Runnable |
| 830 |
final Object[] finalArray = new Object[2]; |
817 |
final Object[] finalArray = new Object[2]; |
|
Lines 869-876
Link Here
|
| 869 |
if (object instanceof ILaunchConfigurationTab) { |
856 |
if (object instanceof ILaunchConfigurationTab) { |
| 870 |
ILaunchConfigurationTab[] tabs = getTabs(); |
857 |
ILaunchConfigurationTab[] tabs = getTabs(); |
| 871 |
for (int i = 0; i < tabs.length; i++) { |
858 |
for (int i = 0; i < tabs.length; i++) { |
| 872 |
ILaunchConfigurationTab tab = tabs[i]; |
859 |
if (tabs[i].equals(object)) { |
| 873 |
if (tab.equals(object)) { |
|
|
| 874 |
fCurrentTabIndex = i; |
860 |
fCurrentTabIndex = i; |
| 875 |
fTabFolder.setSelection(i); |
861 |
fTabFolder.setSelection(i); |
| 876 |
} |
862 |
} |
|
Lines 1029-1035
Link Here
|
| 1029 |
return false; |
1015 |
return false; |
| 1030 |
} |
1016 |
} |
| 1031 |
} |
1017 |
} |
| 1032 |
|
|
|
| 1033 |
return true; |
1018 |
return true; |
| 1034 |
} |
1019 |
} |
| 1035 |
|
1020 |
|
|
Lines 1053-1061
Link Here
|
| 1053 |
try { |
1038 |
try { |
| 1054 |
ILaunchConfigurationWorkingCopy wc = getWorkingCopy(); |
1039 |
ILaunchConfigurationWorkingCopy wc = getWorkingCopy(); |
| 1055 |
if(wc != null) { |
1040 |
if(wc != null) { |
| 1056 |
Set modes = wc.getModes(); |
1041 |
return wc.getType().supportsModeCombination(getCurrentModeSet()); |
| 1057 |
modes.add(getLaunchConfigurationDialog().getMode()); |
|
|
| 1058 |
return wc.getType().supportsModeCombination(modes); |
| 1059 |
} |
1042 |
} |
| 1060 |
} catch (CoreException e) { |
1043 |
} catch (CoreException e) { |
| 1061 |
} |
1044 |
} |
|
Lines 1077-1100
Link Here
|
| 1077 |
if(fInitializingTabs) { |
1060 |
if(fInitializingTabs) { |
| 1078 |
return false; |
1061 |
return false; |
| 1079 |
} |
1062 |
} |
| 1080 |
try { |
1063 |
ILaunchConfiguration config = getWorkingCopy(); |
| 1081 |
ILaunchConfiguration config = getWorkingCopy(); |
1064 |
if(config != null) { |
| 1082 |
if(config != null) { |
1065 |
if(hasMultipleDelegates()) { |
| 1083 |
Set modes = config.getModes(); |
1066 |
return getPreferredDelegate() == null; |
| 1084 |
modes.add(getLaunchConfigurationDialog().getMode()); |
1067 |
} |
|
|
1068 |
} |
| 1069 |
return false; |
| 1070 |
} |
| 1071 |
|
| 1072 |
/** |
| 1073 |
* Determines if the currently showing launch configuration has multiple launch delegates for the same mode set, but does not care |
| 1074 |
* if there has been a default selected yet or not |
| 1075 |
* @return true if the current launch configuraiton has multiple launch delegates, false otherwise |
| 1076 |
*/ |
| 1077 |
private boolean hasMultipleDelegates() { |
| 1078 |
ILaunchConfiguration config = getWorkingCopy(); |
| 1079 |
if(config != null) { |
| 1080 |
try { |
| 1081 |
Set modes = getCurrentModeSet(); |
| 1085 |
ILaunchDelegate[] delegates = LaunchConfigurationManager.filterLaunchDelegates(fTabType, modes); |
1082 |
ILaunchDelegate[] delegates = LaunchConfigurationManager.filterLaunchDelegates(fTabType, modes); |
| 1086 |
if(delegates.length > 1) { |
1083 |
return delegates.length > 1; |
| 1087 |
ILaunchDelegate preferred = fTabType.getPreferredDelegate(modes); |
|
|
| 1088 |
if(preferred == null) { |
| 1089 |
return true; |
| 1090 |
} |
| 1091 |
else if(WorkbenchActivityHelper.filterItem(new LaunchDelegateContribution(preferred))) { |
| 1092 |
return true; |
| 1093 |
} |
| 1094 |
} |
| 1095 |
} |
1084 |
} |
|
|
1085 |
catch (CoreException ce) {DebugUIPlugin.log(ce);} |
| 1096 |
} |
1086 |
} |
| 1097 |
catch(CoreException ce) {DebugUIPlugin.log(ce);} |
|
|
| 1098 |
return false; |
1087 |
return false; |
| 1099 |
} |
1088 |
} |
| 1100 |
|
1089 |
|
|
Lines 1141-1170
Link Here
|
| 1141 |
return temp.toString(); |
1130 |
return temp.toString(); |
| 1142 |
} |
1131 |
} |
| 1143 |
} |
1132 |
} |
| 1144 |
if(getWorkingCopy() != null) { |
1133 |
if(getWorkingCopy().isReadOnly()) { |
| 1145 |
if(getWorkingCopy().isReadOnly()) { |
1134 |
return LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_9; |
| 1146 |
return LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_9; |
|
|
| 1147 |
} |
| 1148 |
} |
1135 |
} |
| 1149 |
//EXPERIMENTAL |
1136 |
//EXPERIMENTAL |
| 1150 |
if(!canLaunchWithModes()) { |
1137 |
if(!canLaunchWithModes()) { |
| 1151 |
try { |
1138 |
Set modes = getCurrentModeSet(); |
| 1152 |
Set modes = getWorkingCopy().getModes(); |
1139 |
List names = LaunchConfigurationPresentationManager.getDefault().getLaunchModeNames(modes); |
| 1153 |
modes.add(getLaunchConfigurationDialog().getMode()); |
1140 |
return MessageFormat.format(LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_14, new String[]{names.toString()}); |
| 1154 |
List names = LaunchConfigurationPresentationManager.getDefault().getLaunchModeNames(modes); |
|
|
| 1155 |
return MessageFormat.format(LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_14, new String[]{names.toString()}); |
| 1156 |
} catch (CoreException e) { |
| 1157 |
return e.getMessage(); |
| 1158 |
} |
| 1159 |
} |
| 1160 |
if(hasDuplicateDelegates()) { |
| 1161 |
try { |
| 1162 |
Set modes = getWorkingCopy().getModes(); |
| 1163 |
modes.add(getLaunchConfigurationDialog().getMode()); |
| 1164 |
List names = LaunchConfigurationPresentationManager.getDefault().getLaunchModeNames(modes); |
| 1165 |
return MessageFormat.format(LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_16, new String[] {names.toString()}); |
| 1166 |
} |
| 1167 |
catch (CoreException e) {DebugUIPlugin.log(e);} |
| 1168 |
} |
1141 |
} |
| 1169 |
return null; |
1142 |
return null; |
| 1170 |
} |
1143 |
} |
|
Lines 1293-1300
Link Here
|
| 1293 |
} |
1266 |
} |
| 1294 |
} |
1267 |
} |
| 1295 |
fCurrentTabIndex = fTabFolder.getSelectionIndex(); |
1268 |
fCurrentTabIndex = fTabFolder.getSelectionIndex(); |
| 1296 |
SelectionChangedEvent event = new SelectionChangedEvent(this, getSelection()); |
|
|
| 1297 |
fireSelectionChanged(event); |
| 1298 |
} |
1269 |
} |
| 1299 |
|
1270 |
|
| 1300 |
/** |
1271 |
/** |
|
Lines 1342-1348
Link Here
|
| 1342 |
if(fTabGroup != null) { |
1313 |
if(fTabGroup != null) { |
| 1343 |
fTabGroup.initializeFrom(fOriginal); |
1314 |
fTabGroup.initializeFrom(fOriginal); |
| 1344 |
fWorkingCopy = fOriginal.getWorkingCopy(); |
1315 |
fWorkingCopy = fOriginal.getWorkingCopy(); |
| 1345 |
refresh(); |
|
|
| 1346 |
refreshStatus(); |
1316 |
refreshStatus(); |
| 1347 |
} |
1317 |
} |
| 1348 |
} |
1318 |
} |
|
Lines 1366-1376
Link Here
|
| 1366 |
*/ |
1336 |
*/ |
| 1367 |
public void setActiveTab(ILaunchConfigurationTab tab) { |
1337 |
public void setActiveTab(ILaunchConfigurationTab tab) { |
| 1368 |
ILaunchConfigurationTab[] tabs = getTabs(); |
1338 |
ILaunchConfigurationTab[] tabs = getTabs(); |
| 1369 |
for (int i = 0; i < tabs.length; i++) { |
1339 |
if(tabs != null) { |
| 1370 |
ILaunchConfigurationTab configurationTab = tabs[i]; |
1340 |
for (int i = 0; i < tabs.length; i++) { |
| 1371 |
if (configurationTab.equals(tab)) { |
1341 |
if (tabs[i].getClass().equals(tab.getClass())) { |
| 1372 |
setActiveTab(i); |
1342 |
setActiveTab(i); |
| 1373 |
return; |
1343 |
return; |
|
|
1344 |
} |
| 1374 |
} |
1345 |
} |
| 1375 |
} |
1346 |
} |
| 1376 |
} |
1347 |
} |