|
Lines 78-83
Link Here
|
| 78 |
import org.eclipse.tptp.platform.probekit.builder.ProbeNature; |
78 |
import org.eclipse.tptp.platform.probekit.builder.ProbeNature; |
| 79 |
import org.eclipse.tptp.platform.probekit.launch.internal.ProbekitLaunchImages; |
79 |
import org.eclipse.tptp.platform.probekit.launch.internal.ProbekitLaunchImages; |
| 80 |
import org.eclipse.tptp.platform.probekit.launch.internal.ProbekitLaunchPlugin; |
80 |
import org.eclipse.tptp.platform.probekit.launch.internal.ProbekitLaunchPlugin; |
|
|
81 |
import org.eclipse.tptp.platform.probekit.launch.internal.ProbekitLaunchUI; |
| 81 |
import org.eclipse.tptp.platform.probekit.registry.ProbeRegistry; |
82 |
import org.eclipse.tptp.platform.probekit.registry.ProbeRegistry; |
| 82 |
import org.eclipse.tptp.platform.probekit.registry.ProbeRegistryEntry; |
83 |
import org.eclipse.tptp.platform.probekit.registry.ProbeRegistryEntry; |
| 83 |
import org.eclipse.tptp.platform.probekit.util.InvalidProbeBundleException; |
84 |
import org.eclipse.tptp.platform.probekit.util.InvalidProbeBundleException; |
|
Lines 88-141
Link Here
|
| 88 |
|
89 |
|
| 89 |
/** |
90 |
/** |
| 90 |
* @author gweidner |
91 |
* @author gweidner |
| 91 |
* |
92 |
* @modified by ldancy |
| 92 |
* See also org.eclipse.hyades.trace.ui.internal.core.TraceProfileOverviewUI. |
93 |
* See also org.eclipse.hyades.trace.ui.internal.core.TraceProfileOverviewUI. |
| 93 |
*/ |
94 |
*/ |
| 94 |
public class ProbekitProfilingType implements IExtendedProfilingType, |
95 |
public class ProbekitProfilingType implements IExtendedProfilingType { |
| 95 |
SelectionListener { |
96 |
|
|
|
97 |
/** |
| 98 |
* Class variables necessary for keeping the IProfilingType |
| 99 |
* interfcaes happy as well as for those IProfilingType |
| 100 |
* methods we which to keep separate from the |
| 101 |
* JVMTI implementation. The remainder of the old class variables have |
| 102 |
* been moved to org.eclipse.tptp.platform.probekit.launch.ProbekitLaunchUI |
| 103 |
* Liz Dancy; Enhancement 141540 |
| 104 |
*/ |
| 105 |
|
| 96 |
private Composite _form; |
106 |
private Composite _form; |
| 97 |
|
107 |
|
| 98 |
private Table _tblProbeSets; |
108 |
private ProbePropertiesUI _propertiesUI; |
| 99 |
|
|
|
| 100 |
private Button _refreshData; |
| 101 |
|
| 102 |
private ProbePropertiesUI _propertiesUI; |
| 103 |
|
| 104 |
private Text _lblTitle; |
| 105 |
|
| 106 |
private TabFolder _folder; |
| 107 |
|
| 108 |
private ProfilingSetsManagerCopy _managerCopy; |
| 109 |
|
| 110 |
private ProbeRegistry _registry; |
| 111 |
|
109 |
|
| 112 |
private IDialogSettings _settings; |
110 |
private IDialogSettings _settings; |
| 113 |
|
111 |
|
| 114 |
private String _description; |
112 |
private ProbekitLaunchUI probeUI; |
| 115 |
|
113 |
|
| 116 |
private String _warning; |
114 |
|
| 117 |
|
115 |
|
| 118 |
protected HashMap _mapProbeFilters; |
116 |
|
| 119 |
|
117 |
|
| 120 |
protected Map _filterSetsCopy; |
|
|
| 121 |
|
| 122 |
private final static int PROBE_NAME_INDEX = 0; |
| 123 |
|
| 124 |
private final static int PROBE_PREFILTERED_INDEX = 1; |
| 125 |
|
| 126 |
private final static int PROBE_IMPORTED_INDEX = 2; |
| 127 |
|
| 128 |
private final static int PROBE_ID_INDEX = 3; |
| 129 |
|
| 130 |
public final static String PROBE_LAUNCH_SELECTION_ATTRIBUTE_STRING = "org.eclipse.tptp.platform.probekit.launch.internal.PROBEUI"; //$NON-NLS-1$ |
| 131 |
|
| 132 |
public final static String PROBE_LAUNCH_SETOPTION_ATTRIBUTE_PREFIX = "SETOPTION_"; //$NON-NLS-1$ |
| 133 |
|
| 134 |
public final static String PROBE_LAUNCH_UNIQUE_PROBESPEC_SUFFIX = "PROBEUI"; //$NON-NLS-1$ |
| 135 |
|
| 136 |
/* Navid Mehregani; Enhancement: 143251 */ |
118 |
/* Navid Mehregani; Enhancement: 143251 */ |
| 137 |
/* @see org.eclipse.hyades.trace.ui.internal.launcher.IExtendedProfilingType */ |
119 |
/* @see org.eclipse.hyades.trace.ui.internal.launcher.IExtendedProfilingType */ |
| 138 |
public String getVMArguments(ILaunchConfiguration conf) { |
120 |
public String getVMArguments(ILaunchConfiguration conf) |
|
|
121 |
{ |
| 139 |
|
122 |
|
| 140 |
/* Will hold the final VM argument */ |
123 |
/* Will hold the final VM argument */ |
| 141 |
String vmArgument = ""; |
124 |
String vmArgument = ""; |
|
Lines 170-176
Link Here
|
| 170 |
String strProbeSpec = (String) activeProbes.get(key); |
153 |
String strProbeSpec = (String) activeProbes.get(key); |
| 171 |
ProbeLaunchConfigString probeConfigDeploy = ProbeLaunchConfigString.fromString(strProbeSpec); |
154 |
ProbeLaunchConfigString probeConfigDeploy = ProbeLaunchConfigString.fromString(strProbeSpec); |
| 172 |
String strProbeID = probeConfigDeploy.getRegistryId(); |
155 |
String strProbeID = probeConfigDeploy.getRegistryId(); |
| 173 |
ProbeRegistryEntry registryEntry = (ProbeRegistryEntry) _registry.lookupById(strProbeID); |
156 |
ProbeRegistryEntry registryEntry = (ProbeRegistryEntry) probeUI.getRegistry().lookupById(strProbeID); |
| 174 |
IResource probeSource = null; |
157 |
IResource probeSource = null; |
| 175 |
|
158 |
|
| 176 |
/* Extract the probe source file */ |
159 |
/* Extract the probe source file */ |
|
Lines 386-395
Link Here
|
| 386 |
/** |
369 |
/** |
| 387 |
* |
370 |
* |
| 388 |
*/ |
371 |
*/ |
| 389 |
public ProbekitProfilingType() { |
372 |
public ProbekitProfilingType() |
|
|
373 |
{ |
| 390 |
super(); |
374 |
super(); |
| 391 |
|
375 |
|
| 392 |
_registry = ProbeRegistry.getRegistry(); |
376 |
//_registry = ProbeRegistry.getRegistry(); |
| 393 |
|
377 |
|
| 394 |
AbstractUIPlugin plugin = (AbstractUIPlugin) ProbekitLaunchPlugin |
378 |
AbstractUIPlugin plugin = (AbstractUIPlugin) ProbekitLaunchPlugin |
| 395 |
.getDefault(); |
379 |
.getDefault(); |
|
Lines 400-412
Link Here
|
| 400 |
section = workbenchSettings.addNewSection("ProbeLaunchDialog");//$NON-NLS-1$ |
384 |
section = workbenchSettings.addNewSection("ProbeLaunchDialog");//$NON-NLS-1$ |
| 401 |
} |
385 |
} |
| 402 |
_settings = section; |
386 |
_settings = section; |
| 403 |
|
387 |
|
| 404 |
_description = ""; //$NON-NLS-1$ |
388 |
probeUI = new ProbekitLaunchUI(); |
| 405 |
|
|
|
| 406 |
_mapProbeFilters = new HashMap(); |
| 407 |
_filterSetsCopy = new HashMap(); |
| 408 |
|
| 409 |
_warning = new String(ProbekitLaunchMessages._18); //$NON-NLS-1$ |
| 410 |
} |
389 |
} |
| 411 |
|
390 |
|
| 412 |
/* |
391 |
/* |
|
Lines 415-561
Link Here
|
| 415 |
* @see org.eclipse.hyades.trace.ui.launcher.IProfilingType#createControl(org.eclipse.swt.widgets.Composite, |
394 |
* @see org.eclipse.hyades.trace.ui.launcher.IProfilingType#createControl(org.eclipse.swt.widgets.Composite, |
| 416 |
* org.eclipse.hyades.trace.ui.launcher.ProfilingSetsManagerCopy) |
395 |
* org.eclipse.hyades.trace.ui.launcher.ProfilingSetsManagerCopy) |
| 417 |
*/ |
396 |
*/ |
| 418 |
public Control createControl(Composite parent, |
397 |
public Control createControl(Composite parent, ProfilingSetsManagerCopy config) |
| 419 |
ProfilingSetsManagerCopy config) { |
398 |
{ |
| 420 |
_form = new Composite(parent, SWT.NULL); |
399 |
return probeUI.CreateControl(parent, config, true); |
| 421 |
PlatformUI.getWorkbench().getHelpSystem().setHelp(_form, |
|
|
| 422 |
ProbekitLaunchPlugin.getPluginId() + "pb_launch1"); |
| 423 |
|
| 424 |
GridData data = GridUtil.createFill(); |
| 425 |
_form.setLayoutData(data); |
| 426 |
|
| 427 |
GridLayout layout = new GridLayout(); |
| 428 |
layout.numColumns = 2; |
| 429 |
_form.setLayout(layout); |
| 430 |
|
| 431 |
_lblTitle = new Text(_form, SWT.LEFT /* | SWT.BORDER */| SWT.READ_ONLY); |
| 432 |
GridData gd = new GridData(GridData.FILL_HORIZONTAL); |
| 433 |
gd.grabExcessHorizontalSpace = true; |
| 434 |
gd.horizontalSpan = 2; |
| 435 |
_lblTitle.setLayoutData(gd); |
| 436 |
|
| 437 |
Composite childTop = new Composite(_form, SWT.NONE); |
| 438 |
data = GridUtil.createVerticalFill(); |
| 439 |
data.widthHint = 200; |
| 440 |
childTop.setLayoutData(data); |
| 441 |
|
| 442 |
layout = new GridLayout(); |
| 443 |
layout.numColumns = 1; |
| 444 |
childTop.setLayout(layout); |
| 445 |
|
| 446 |
// _lblTitle.setFont(JFaceResources.getBannerFont()); |
| 447 |
Font font = _lblTitle.getFont(); |
| 448 |
if (font != null) { |
| 449 |
FontData[] fonts = font.getFontData(); |
| 450 |
if (fonts != null && fonts.length >= 1) { |
| 451 |
// Maintain consistency with built-in Hyades profiling type UIs |
| 452 |
// while still inheriting system font |
| 453 |
_lblTitle.setFont(new Font(Display.getDefault(), fonts[0] |
| 454 |
.getName(), fonts[0].getHeight() + 3, SWT.BOLD)); |
| 455 |
} |
| 456 |
} |
| 457 |
_lblTitle.setText(ProbekitLaunchMessages._25); //$NON-NLS-1$ |
| 458 |
|
| 459 |
_tblProbeSets = new Table(childTop, SWT.CHECK | SWT.SINGLE |
| 460 |
| SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); |
| 461 |
data = GridUtil.createFill(); |
| 462 |
_tblProbeSets.setLayoutData(data); |
| 463 |
|
| 464 |
_refreshData = new Button(childTop, SWT.PUSH); |
| 465 |
_refreshData.setText(ProbekitLaunchMessages._1); |
| 466 |
_refreshData.addSelectionListener(this); |
| 467 |
|
| 468 |
// new Label(childTop, SWT.NULL); |
| 469 |
|
| 470 |
TableLayout layoutTable = new TableLayout(); |
| 471 |
layoutTable.addColumnData(new ColumnPixelData(170, true)); |
| 472 |
_tblProbeSets.setLayout(layoutTable); |
| 473 |
_tblProbeSets.setHeaderVisible(true); |
| 474 |
|
| 475 |
// begin adding columns |
| 476 |
TableColumn tc1 = new TableColumn(_tblProbeSets, SWT.LEFT); |
| 477 |
tc1.setText(ProbekitLaunchMessages._21); //$NON-NLS-1$ |
| 478 |
// end adding columns |
| 479 |
|
| 480 |
this.populateTableFromRegistry(); |
| 481 |
|
| 482 |
_tblProbeSets.addListener(SWT.Selection, new Listener() { |
| 483 |
public void handleEvent(Event event) { |
| 484 |
if (event.item instanceof TableItem) { |
| 485 |
ProbeRegistryEntry entry = (ProbeRegistryEntry) event.item |
| 486 |
.getData(); |
| 487 |
if (entry != null) { |
| 488 |
_propertiesUI.updateWidgetValues(entry); |
| 489 |
// commented out for bugzilla_145401 |
| 490 |
// _filtersUI.updateWidgetValues(entry); |
| 491 |
|
| 492 |
int index = _tblProbeSets |
| 493 |
.indexOf((TableItem) event.item); |
| 494 |
_tblProbeSets.setSelection(index); |
| 495 |
} |
| 496 |
} |
| 497 |
} |
| 498 |
}); |
| 499 |
|
| 500 |
Composite childBottom = new Composite(_form, SWT.NONE); |
| 501 |
data = GridUtil.createFill(); |
| 502 |
|
| 503 |
childBottom.setLayoutData(data); |
| 504 |
|
| 505 |
layout = new GridLayout(); |
| 506 |
layout.numColumns = 1; |
| 507 |
layout.marginHeight = 0; |
| 508 |
childBottom.setLayout(layout); |
| 509 |
|
| 510 |
// _folder = new CTabFolder(childBottom, SWT.BORDER); |
| 511 |
_folder = new TabFolder(childBottom, SWT.TOP); |
| 512 |
data = GridUtil.createFill(); |
| 513 |
// bugzilla_145401 required the uncommenting of this code |
| 514 |
data.heightHint = 320; |
| 515 |
data.grabExcessHorizontalSpace = true; |
| 516 |
_folder.setLayoutData(data); |
| 517 |
|
| 518 |
TabItem item = new TabItem(_folder, SWT.NONE); |
| 519 |
item.setText(ProbekitLaunchMessages._20); //$NON-NLS-1$ |
| 520 |
_propertiesUI = new ProbePropertiesUI(); |
| 521 |
item.setControl(_propertiesUI.createControl(_folder)); |
| 522 |
if (_tblProbeSets.getItemCount() == 0) { |
| 523 |
// Display text pointing user to import |
| 524 |
_propertiesUI.showHint(true); |
| 525 |
} |
| 526 |
|
| 527 |
item.setImage(ProbekitLaunchImages.INSTANCE |
| 528 |
.getImage(ProbekitLaunchImages.IMG_PROP)); |
| 529 |
|
| 530 |
_folder.setSelection(0); |
| 531 |
|
| 532 |
// commented out for bugzilla_145401 |
| 533 |
// TabItem item2 = new TabItem(_folder, SWT.NONE); |
| 534 |
// item2.setText(ProbekitLaunchMessages._19); //$NON-NLS-1$ |
| 535 |
// _filtersUI = new ProbeFiltersUI(); |
| 536 |
// item2.setControl(_propertiesUI.createControl(_folder)); |
| 537 |
// item2.setImage(ProbekitLaunchImages.INSTANCE.getImage(ProbekitLaunchImages.IMG_FILTER)); |
| 538 |
|
| 539 |
if (config != null) { |
| 540 |
_managerCopy = config; |
| 541 |
} else { |
| 542 |
_managerCopy = new ProfilingSetsManagerCopy(); |
| 543 |
} |
| 544 |
|
| 545 |
initializeValues(config); |
| 546 |
|
| 547 |
int sel = _tblProbeSets.getSelectionIndex(); |
| 548 |
if (sel != -1) { |
| 549 |
ProbeRegistryEntry entry = (ProbeRegistryEntry) _tblProbeSets |
| 550 |
.getItem(sel).getData(); |
| 551 |
if (entry != null) { |
| 552 |
_propertiesUI.updateWidgetValues(entry); |
| 553 |
} |
| 554 |
} |
| 555 |
|
| 556 |
_tblProbeSets.setFocus(); |
| 557 |
|
| 558 |
return _form; |
| 559 |
} |
400 |
} |
| 560 |
|
401 |
|
| 561 |
/* |
402 |
/* |
|
Lines 564-569
Link Here
|
| 564 |
* @see org.eclipse.hyades.trace.ui.launcher.IProfilingType#getControl(java.lang.String) |
405 |
* @see org.eclipse.hyades.trace.ui.launcher.IProfilingType#getControl(java.lang.String) |
| 565 |
*/ |
406 |
*/ |
| 566 |
public Control getControl(String profilingSetName) { |
407 |
public Control getControl(String profilingSetName) { |
|
|
408 |
Table _tblProbeSets = probeUI.getProbeSets(); |
| 567 |
if (_tblProbeSets.getItemCount() > 0) { |
409 |
if (_tblProbeSets.getItemCount() > 0) { |
| 568 |
int indexSelection = _tblProbeSets.getSelectionIndex(); |
410 |
int indexSelection = _tblProbeSets.getSelectionIndex(); |
| 569 |
if (indexSelection < 0) { |
411 |
if (indexSelection < 0) { |
|
Lines 585-590
Link Here
|
| 585 |
} |
427 |
} |
| 586 |
|
428 |
|
| 587 |
protected void restoreSelections() { |
429 |
protected void restoreSelections() { |
|
|
430 |
Table _tblProbeSets = probeUI.getProbeSets(); |
| 588 |
String strSelection = ""; //$NON-NLS-1$ |
431 |
String strSelection = ""; //$NON-NLS-1$ |
| 589 |
String strTab = ""; //$NON-NLS-1$ |
432 |
String strTab = ""; //$NON-NLS-1$ |
| 590 |
|
433 |
|
|
Lines 628-678
Link Here
|
| 628 |
// else defaults to "Properties" in createControl() |
471 |
// else defaults to "Properties" in createControl() |
| 629 |
} |
472 |
} |
| 630 |
|
473 |
|
| 631 |
protected void saveSelections() { |
474 |
|
| 632 |
int indexSelection = _tblProbeSets.getSelectionIndex(); |
|
|
| 633 |
|
| 634 |
if (indexSelection >= 0) { |
| 635 |
TableItem tableItem = _tblProbeSets.getItem(indexSelection); |
| 636 |
if (tableItem != null) { |
| 637 |
ProbeRegistryEntry entry = (ProbeRegistryEntry) tableItem |
| 638 |
.getData(); |
| 639 |
if (entry != null) { |
| 640 |
String strID = entry.getId(); |
| 641 |
if (_settings != null) { |
| 642 |
// Store table selection |
| 643 |
_settings.put("ProbeTableSelection", strID); //$NON-NLS-1$ |
| 644 |
} |
| 645 |
} |
| 646 |
} |
| 647 |
} else { |
| 648 |
if (_settings != null) { |
| 649 |
_settings.put("ProbeTableSelection", ""); //$NON-NLS-1$ //$NON-NLS-2$ |
| 650 |
} |
| 651 |
} |
| 652 |
|
| 653 |
// CTabItem item = _folder.getSelection(); |
| 654 |
TabItem[] item = _folder.getSelection(); |
| 655 |
if (item[0] != null) { |
| 656 |
String strName = item[0].getText(); |
| 657 |
if (_settings != null) { |
| 658 |
// Store folder selection |
| 659 |
_settings.put("ProbeFolderSelection", strName); //$NON-NLS-1$ |
| 660 |
} |
| 661 |
} else { |
| 662 |
_settings.put("ProbeFolderSelection", ""); //$NON-NLS-1$ //$NON-NLS-2$ |
| 663 |
} |
| 664 |
} |
| 665 |
|
475 |
|
| 666 |
protected void initializeValues(ProfilingSetsManagerCopy config) { |
476 |
protected void initializeValues(ProfilingSetsManagerCopy config) { |
| 667 |
int iNumProbeSets = _tblProbeSets.getItemCount(); |
477 |
int iNumProbeSets = probeUI.getProbeSets().getItemCount(); |
| 668 |
TableItem[] items = _tblProbeSets.getItems(); |
478 |
TableItem[] items = probeUI.getProbeSets().getItems(); |
| 669 |
|
479 |
|
| 670 |
Map configAttributes = config.getDefaultSet().getAttributes(); |
480 |
Map configAttributes = config.getDefaultSet().getAttributes(); |
| 671 |
// ProfilingAttribute attribute = (ProfilingAttribute) |
481 |
// ProfilingAttribute attribute = (ProfilingAttribute) |
| 672 |
// configAttributes.get("com.ibm.rational.pd.probekit.PROBEKIT_COUNT"); |
482 |
// configAttributes.get("com.ibm.rational.pd.probekit.PROBEKIT_COUNT"); |
| 673 |
int index = 0; |
483 |
int index = 0; |
| 674 |
String strName = ProbeLaunchConfigString.LAUNCH_CONFIG_NAME_PREFIX |
484 |
String strName = ProbeLaunchConfigString.LAUNCH_CONFIG_NAME_PREFIX |
| 675 |
+ PROBE_LAUNCH_UNIQUE_PROBESPEC_SUFFIX + index; |
485 |
+ probeUI.PROBE_LAUNCH_UNIQUE_PROBESPEC_SUFFIX + index; |
| 676 |
ProfilingAttribute attribute = (ProfilingAttribute) configAttributes |
486 |
ProfilingAttribute attribute = (ProfilingAttribute) configAttributes |
| 677 |
.get(strName); |
487 |
.get(strName); |
| 678 |
// if (attribute != null) |
488 |
// if (attribute != null) |
|
Lines 708-714
Link Here
|
| 708 |
index++; |
518 |
index++; |
| 709 |
|
519 |
|
| 710 |
strName = ProbeLaunchConfigString.LAUNCH_CONFIG_NAME_PREFIX |
520 |
strName = ProbeLaunchConfigString.LAUNCH_CONFIG_NAME_PREFIX |
| 711 |
+ PROBE_LAUNCH_UNIQUE_PROBESPEC_SUFFIX + index; |
521 |
+ probeUI.PROBE_LAUNCH_UNIQUE_PROBESPEC_SUFFIX + index; |
| 712 |
attribute = (ProfilingAttribute) configAttributes.get(strName); |
522 |
attribute = (ProfilingAttribute) configAttributes.get(strName); |
| 713 |
// } |
523 |
// } |
| 714 |
} |
524 |
} |
|
Lines 721-727
Link Here
|
| 721 |
*/ |
531 |
*/ |
| 722 |
protected Map getActiveProbes(ILaunchConfiguration launchConfig) { |
532 |
protected Map getActiveProbes(ILaunchConfiguration launchConfig) { |
| 723 |
String strProbeDeployPrefix = ProbeLaunchConfigString.AGENT_CONFIG_NAME_PREFIX |
533 |
String strProbeDeployPrefix = ProbeLaunchConfigString.AGENT_CONFIG_NAME_PREFIX |
| 724 |
+ PROBE_LAUNCH_UNIQUE_PROBESPEC_SUFFIX; |
534 |
+ probeUI.PROBE_LAUNCH_UNIQUE_PROBESPEC_SUFFIX; |
| 725 |
Map map = getOptions(launchConfig, strProbeDeployPrefix); |
535 |
Map map = getOptions(launchConfig, strProbeDeployPrefix); |
| 726 |
return map; |
536 |
return map; |
| 727 |
} |
537 |
} |
|
Lines 766-775
Link Here
|
| 766 |
public ProfilingAttribute[] getAttributes() { |
576 |
public ProfilingAttribute[] getAttributes() { |
| 767 |
List config = new ArrayList(); |
577 |
List config = new ArrayList(); |
| 768 |
int iCheckedCount = 0; |
578 |
int iCheckedCount = 0; |
| 769 |
|
579 |
|
| 770 |
int iNumProbeSets = _tblProbeSets.getItemCount(); |
580 |
int iNumProbeSets = probeUI.getProbeSets().getItemCount(); |
| 771 |
if (iNumProbeSets > 0) { |
581 |
if (iNumProbeSets > 0) { |
| 772 |
TableItem[] items = _tblProbeSets.getItems(); |
582 |
TableItem[] items = probeUI.getProbeSets().getItems(); |
| 773 |
for (int i = 0; i < iNumProbeSets; i++) { |
583 |
for (int i = 0; i < iNumProbeSets; i++) { |
| 774 |
ProbeRegistryEntry entry = (ProbeRegistryEntry) items[i] |
584 |
ProbeRegistryEntry entry = (ProbeRegistryEntry) items[i] |
| 775 |
.getData(); |
585 |
.getData(); |
|
Lines 788-794
Link Here
|
| 788 |
// /if (!entry.hasTargets()) |
598 |
// /if (!entry.hasTargets()) |
| 789 |
// /{ |
599 |
// /{ |
| 790 |
boolean bMatchingSetFound = false; |
600 |
boolean bMatchingSetFound = false; |
| 791 |
FilterSetElement set = _managerCopy |
601 |
FilterSetElement set = probeUI.getManager() |
| 792 |
.getDefaultFilterSet(); |
602 |
.getDefaultFilterSet(); |
| 793 |
|
603 |
|
| 794 |
// build filter string |
604 |
// build filter string |
|
Lines 819-825
Link Here
|
| 819 |
// /} |
629 |
// /} |
| 820 |
|
630 |
|
| 821 |
String strName = ProbeLaunchConfigString.LAUNCH_CONFIG_NAME_PREFIX |
631 |
String strName = ProbeLaunchConfigString.LAUNCH_CONFIG_NAME_PREFIX |
| 822 |
+ PROBE_LAUNCH_UNIQUE_PROBESPEC_SUFFIX |
632 |
+ probeUI.PROBE_LAUNCH_UNIQUE_PROBESPEC_SUFFIX |
| 823 |
+ iCheckedCount; |
633 |
+ iCheckedCount; |
| 824 |
String strValueProbeLaunch = probe.toString(); |
634 |
String strValueProbeLaunch = probe.toString(); |
| 825 |
|
635 |
|
|
Lines 841-847
Link Here
|
| 841 |
ProfilingAttribute[] pOptions = new ProfilingAttribute[config.size()]; |
651 |
ProfilingAttribute[] pOptions = new ProfilingAttribute[config.size()]; |
| 842 |
config.toArray(pOptions); |
652 |
config.toArray(pOptions); |
| 843 |
|
653 |
|
| 844 |
saveSelections(); |
654 |
probeUI.saveSelections(); |
| 845 |
|
655 |
|
| 846 |
return pOptions; |
656 |
return pOptions; |
| 847 |
} |
657 |
} |
|
Lines 851-875
Link Here
|
| 851 |
* |
661 |
* |
| 852 |
* @see org.eclipse.hyades.trace.ui.launcher.IProfilingType#validateConfiguration(org.eclipse.hyades.trace.ui.launcher.ProfilingSetsManagerCopy) |
662 |
* @see org.eclipse.hyades.trace.ui.launcher.IProfilingType#validateConfiguration(org.eclipse.hyades.trace.ui.launcher.ProfilingSetsManagerCopy) |
| 853 |
*/ |
663 |
*/ |
| 854 |
public String validateConfiguration(ProfilingSetsManagerCopy managerCopy) { |
664 |
public String validateConfiguration(ProfilingSetsManagerCopy managerCopy) |
| 855 |
// RATLC00379729 - we should warn, if Probe insertion has no probe |
665 |
{ |
| 856 |
// selected or has no probe import. |
666 |
return probeUI.validateConfiguration(managerCopy); |
| 857 |
int iSelectedProbes = 0; |
|
|
| 858 |
int iAvailableProbes = _tblProbeSets.getItemCount(); |
| 859 |
if (iAvailableProbes > 0) { |
| 860 |
TableItem[] items = _tblProbeSets.getItems(); |
| 861 |
for (int i = 0; i < iAvailableProbes; i++) { |
| 862 |
if (items[i].getChecked()) { |
| 863 |
iSelectedProbes++; |
| 864 |
} |
| 865 |
} |
| 866 |
} |
| 867 |
|
| 868 |
if (iAvailableProbes == 0 || iSelectedProbes == 0) { |
| 869 |
return _warning; |
| 870 |
} else { |
| 871 |
return null; |
| 872 |
} |
| 873 |
} |
667 |
} |
| 874 |
|
668 |
|
| 875 |
/* |
669 |
/* |
|
Lines 895-901
Link Here
|
| 895 |
ProbeLaunchConfigString probeConfigDeploy = ProbeLaunchConfigString |
689 |
ProbeLaunchConfigString probeConfigDeploy = ProbeLaunchConfigString |
| 896 |
.fromString(strProbeSpec); |
690 |
.fromString(strProbeSpec); |
| 897 |
String strProbeID = probeConfigDeploy.getRegistryId(); |
691 |
String strProbeID = probeConfigDeploy.getRegistryId(); |
| 898 |
ProbeRegistryEntry entry = (ProbeRegistryEntry) _registry |
692 |
ProbeRegistryEntry entry = (ProbeRegistryEntry) probeUI.getRegistry() |
| 899 |
.lookupById(strProbeID); |
693 |
.lookupById(strProbeID); |
| 900 |
if (entry == null) { |
694 |
if (entry == null) { |
| 901 |
strMissingOrInvalidProbes = strMissingOrInvalidProbes |
695 |
strMissingOrInvalidProbes = strMissingOrInvalidProbes |
|
Lines 911-917
Link Here
|
| 911 |
|
705 |
|
| 912 |
// Silently remove from registry so it will not show up |
706 |
// Silently remove from registry so it will not show up |
| 913 |
// in subsequent lists, etc. |
707 |
// in subsequent lists, etc. |
| 914 |
_registry.remove(entry); |
708 |
probeUI.getRegistry().remove(entry); |
| 915 |
} |
709 |
} |
| 916 |
} |
710 |
} |
| 917 |
} |
711 |
} |
|
Lines 940-946
Link Here
|
| 940 |
.getProfilingSets().get(setID); |
734 |
.getProfilingSets().get(setID); |
| 941 |
if (set != null) { |
735 |
if (set != null) { |
| 942 |
String strProbeOptionPrefix = ProbeLaunchConfigString.LAUNCH_CONFIG_NAME_PREFIX |
736 |
String strProbeOptionPrefix = ProbeLaunchConfigString.LAUNCH_CONFIG_NAME_PREFIX |
| 943 |
+ PROBE_LAUNCH_UNIQUE_PROBESPEC_SUFFIX; |
737 |
+ probeUI.PROBE_LAUNCH_UNIQUE_PROBESPEC_SUFFIX; |
| 944 |
boolean bRemovedProbes = false; |
738 |
boolean bRemovedProbes = false; |
| 945 |
Map attributes = set.getAttributes(); |
739 |
Map attributes = set.getAttributes(); |
| 946 |
Iterator iterKeys = attributes.keySet() |
740 |
Iterator iterKeys = attributes.keySet() |
|
Lines 987-1069
Link Here
|
| 987 |
return null; |
781 |
return null; |
| 988 |
} |
782 |
} |
| 989 |
|
783 |
|
| 990 |
private void populateTableFromRegistry() { |
784 |
|
| 991 |
_tblProbeSets.removeAll(); |
|
|
| 992 |
_mapProbeFilters.clear(); |
| 993 |
_registry = null; |
| 994 |
|
| 995 |
if (_registry == null) { |
| 996 |
_registry = ProbeRegistry.getRegistry(); |
| 997 |
} |
| 998 |
|
| 999 |
if (_registry != null) { |
| 1000 |
// Enumeration iter = _registry.contents(); |
| 1001 |
ProbeRegistryEntry[] probes = getProbesSortedByName(); |
| 1002 |
// while (iter.hasMoreElements()) |
| 1003 |
for (int i = 0; i < probes.length; i++) { |
| 1004 |
// ProbeRegistryEntry probeEntry = (ProbeRegistryEntry) |
| 1005 |
// iter.nextElement(); |
| 1006 |
ProbeRegistryEntry probeEntry = probes[i]; |
| 1007 |
TableItem item = new TableItem(_tblProbeSets, SWT.NONE); |
| 1008 |
|
| 1009 |
// Name |
| 1010 |
item.setText(PROBE_NAME_INDEX, probeEntry.getName()); |
| 1011 |
|
| 1012 |
// Pre-filtered |
| 1013 |
if (probeEntry.hasTargets()) { |
| 1014 |
item.setText(PROBE_PREFILTERED_INDEX, |
| 1015 |
ProbekitLaunchMessages._7); //$NON-NLS-1$ |
| 1016 |
} else { |
| 1017 |
item.setText(PROBE_PREFILTERED_INDEX, |
| 1018 |
ProbekitLaunchMessages._8); //$NON-NLS-1$ |
| 1019 |
} |
| 1020 |
|
| 1021 |
// /RATLC00379812 - Probekit launch UI needs to be updated to |
| 1022 |
// support 2-tier filtering. |
| 1023 |
// Build map for tracking filter selection with initial default |
| 1024 |
// values |
| 1025 |
// (later updated with any saved settings) |
| 1026 |
_mapProbeFilters.put(probeEntry.getId(), null);// "D", "" |
| 1027 |
|
| 1028 |
// Imported |
| 1029 |
if (probeEntry.isAuthored()) { |
| 1030 |
item.setText(PROBE_IMPORTED_INDEX, |
| 1031 |
ProbekitLaunchMessages._8); //$NON-NLS-1$ |
| 1032 |
} else { |
| 1033 |
item.setText(PROBE_IMPORTED_INDEX, |
| 1034 |
ProbekitLaunchMessages._7); //$NON-NLS-1$ |
| 1035 |
} |
| 1036 |
|
| 1037 |
// ID |
| 1038 |
item.setText(PROBE_ID_INDEX, probeEntry.getId()); |
| 1039 |
|
| 1040 |
// Data |
| 1041 |
item.setData(probeEntry); |
| 1042 |
} |
| 1043 |
} |
| 1044 |
} |
| 1045 |
|
| 1046 |
public ProbeRegistryEntry[] getProbesSortedByName() { |
| 1047 |
Collection probes = new ArrayList(); |
| 1048 |
Iterator iter = _registry.iterator(); |
| 1049 |
while (iter.hasNext()) { |
| 1050 |
ProbeRegistryEntry entry = (ProbeRegistryEntry) iter.next(); |
| 1051 |
probes.add(entry); |
| 1052 |
} |
| 1053 |
|
785 |
|
| 1054 |
ProbeRegistryEntry[] sortedProbes = new ProbeRegistryEntry[probes |
786 |
|
| 1055 |
.size()]; |
|
|
| 1056 |
probes.toArray(sortedProbes); |
| 1057 |
Arrays.sort(sortedProbes, new Comparator() { |
| 1058 |
public int compare(Object obj1, Object obj2) { |
| 1059 |
ProbeRegistryEntry probe1 = (ProbeRegistryEntry) obj1; |
| 1060 |
ProbeRegistryEntry probe2 = (ProbeRegistryEntry) obj2; |
| 1061 |
return probe1.getName().compareTo(probe2.getName()); |
| 1062 |
} |
| 1063 |
}); |
| 1064 |
|
| 1065 |
return sortedProbes; |
| 1066 |
} |
| 1067 |
|
787 |
|
| 1068 |
/* |
788 |
/* |
| 1069 |
* (non-Javadoc) |
789 |
* (non-Javadoc) |
|
Lines 1071-1242
Link Here
|
| 1071 |
* @see org.eclipse.hyades.trace.ui.launcher.IProfilingType#getDescription() |
791 |
* @see org.eclipse.hyades.trace.ui.launcher.IProfilingType#getDescription() |
| 1072 |
*/ |
792 |
*/ |
| 1073 |
public String getDescription(ProfilingSetsManagerCopy config) { |
793 |
public String getDescription(ProfilingSetsManagerCopy config) { |
| 1074 |
|
794 |
|
| 1075 |
String strDelim = "\n"; //$NON-NLS-1$ |
795 |
return probeUI.getDescription(config); |
| 1076 |
String strIndent = " "; //$NON-NLS-1$ |
|
|
| 1077 |
|
| 1078 |
// Empty previous description |
| 1079 |
_description = ""; //$NON-NLS-1$ |
| 1080 |
|
| 1081 |
if (_registry == null) { |
| 1082 |
_registry = ProbeRegistry.getRegistry(); |
| 1083 |
} |
| 1084 |
|
| 1085 |
if (config != null && config.getDefaultSet() != null) { |
| 1086 |
int index = 0; |
| 1087 |
String strName = ProbeLaunchConfigString.LAUNCH_CONFIG_NAME_PREFIX |
| 1088 |
+ PROBE_LAUNCH_UNIQUE_PROBESPEC_SUFFIX + index; |
| 1089 |
|
| 1090 |
Map configAttributes = config.getDefaultSet().getAttributes(); |
| 1091 |
ProfilingAttribute attribute = (ProfilingAttribute) configAttributes |
| 1092 |
.get(strName); |
| 1093 |
|
| 1094 |
while (attribute != null) { |
| 1095 |
String strValue = attribute.getValue(); |
| 1096 |
ProbeLaunchConfigString probeString = ProbeLaunchConfigString |
| 1097 |
.fromString(strValue); |
| 1098 |
|
| 1099 |
String strProbeID = probeString.getRegistryId(); |
| 1100 |
|
| 1101 |
if (strProbeID != null && strProbeID.length() > 0) { |
| 1102 |
if (_registry != null) { |
| 1103 |
ProbeRegistryEntry probeEntry = _registry |
| 1104 |
.lookupById(strProbeID); |
| 1105 |
|
| 1106 |
if (probeEntry != null) { |
| 1107 |
String strProbeName = probeEntry.getName(); |
| 1108 |
|
| 1109 |
if (strProbeName != null) { |
| 1110 |
_description = _description + strIndent |
| 1111 |
+ strProbeName + strDelim; |
| 1112 |
} |
| 1113 |
} |
| 1114 |
} |
| 1115 |
} |
| 1116 |
|
| 1117 |
index++; |
| 1118 |
strName = ProbeLaunchConfigString.LAUNCH_CONFIG_NAME_PREFIX |
| 1119 |
+ PROBE_LAUNCH_UNIQUE_PROBESPEC_SUFFIX + index; |
| 1120 |
attribute = (ProfilingAttribute) configAttributes.get(strName); |
| 1121 |
} |
| 1122 |
} |
| 1123 |
|
| 1124 |
if (_description != null && _description.length() > 0) { |
| 1125 |
// Remove extra new-line at end of string |
| 1126 |
int iLastNewLineIndex = _description.lastIndexOf(strDelim); |
| 1127 |
if (iLastNewLineIndex >= 0) { |
| 1128 |
_description = _description.substring(0, iLastNewLineIndex); |
| 1129 |
} |
| 1130 |
} else { |
| 1131 |
// Return null instead of zero-length string to prevent blank line |
| 1132 |
// _description = null; |
| 1133 |
_description = strIndent + ProbekitLaunchMessages._28; //$NON-NLS-1$ |
| 1134 |
} |
| 1135 |
|
| 1136 |
return _description; |
| 1137 |
} |
| 1138 |
|
| 1139 |
public void widgetSelected(SelectionEvent e) { |
| 1140 |
final ArrayList list = new ArrayList(); |
| 1141 |
IProject[] projects = ResourcesPlugin.getWorkspace().getRoot() |
| 1142 |
.getProjects(); |
| 1143 |
for (int idx = 0; idx < projects.length; idx++) { |
| 1144 |
try { |
| 1145 |
IProject project = projects[idx]; |
| 1146 |
if (project.isOpen() && project.hasNature(JavaCore.NATURE_ID) |
| 1147 |
&& !project.hasNature(ProbeNature.NATURE_NAME)) { |
| 1148 |
IJavaProject jProject = JavaCore.create(project); |
| 1149 |
Object[] resources = jProject.getNonJavaResources(); |
| 1150 |
|
| 1151 |
boolean hasProbe = false; |
| 1152 |
int i = 0; |
| 1153 |
while (i < resources.length && !hasProbe) { |
| 1154 |
String extension = ((IResource) resources[i]) |
| 1155 |
.getFileExtension(); |
| 1156 |
if (extension != null && (extension.equals("probe"))) { |
| 1157 |
hasProbe = true; |
| 1158 |
} |
| 1159 |
i++; |
| 1160 |
|
| 1161 |
} |
| 1162 |
|
| 1163 |
if (hasProbe) { |
| 1164 |
list.add(project); |
| 1165 |
continue; |
| 1166 |
} |
| 1167 |
|
| 1168 |
List sources = JavaUtil.getSourceContainerEntries(jProject); |
| 1169 |
i = 0; |
| 1170 |
while (i < sources.size() && !hasProbe) { |
| 1171 |
IPath path = ((IClasspathEntry) sources.get(i)) |
| 1172 |
.getPath(); |
| 1173 |
IFolder folder = ResourcesPlugin.getWorkspace() |
| 1174 |
.getRoot().getFolder(path); |
| 1175 |
resources = folder.members(); |
| 1176 |
int j = 0; |
| 1177 |
while (!hasProbe && j < resources.length) { |
| 1178 |
|
| 1179 |
String extension = ((IResource) resources[j]) |
| 1180 |
.getFileExtension(); |
| 1181 |
if (extension != null |
| 1182 |
&& (extension.equals("probe") || extension |
| 1183 |
.equals("probescript"))) { |
| 1184 |
hasProbe = true; |
| 1185 |
} |
| 1186 |
j++; |
| 1187 |
} |
| 1188 |
|
| 1189 |
i++; |
| 1190 |
} |
| 1191 |
|
| 1192 |
if (hasProbe) |
| 1193 |
list.add(project); |
| 1194 |
} |
| 1195 |
} catch (Exception exc) { |
| 1196 |
} |
| 1197 |
|
| 1198 |
} |
| 1199 |
|
| 1200 |
/* |
| 1201 |
* N.M. Need to populate the list before checking for list.size(). |
| 1202 |
* bugzilla_140821 |
| 1203 |
*/ |
| 1204 |
populateTableFromRegistry(); |
| 1205 |
|
| 1206 |
if (list.size() == 0) |
| 1207 |
return; |
| 1208 |
|
| 1209 |
IRunnableWithProgress operation = new WorkspaceModifyOperation() { |
| 1210 |
public void execute(IProgressMonitor monitor) { |
| 1211 |
try { |
| 1212 |
AddProbeNatureOperation addProbeNature = new AddProbeNatureOperation( |
| 1213 |
list); |
| 1214 |
addProbeNature.run(monitor); |
| 1215 |
|
| 1216 |
} catch (CoreException ex) { |
| 1217 |
// TODO Auto-generated catch block |
| 1218 |
ex.printStackTrace(); |
| 1219 |
} finally { |
| 1220 |
monitor.done(); |
| 1221 |
} |
| 1222 |
} |
| 1223 |
}; |
| 1224 |
|
| 1225 |
try { |
| 1226 |
new ProgressMonitorDialog(Display.getCurrent().getActiveShell()) |
| 1227 |
.run(true, true, operation); |
| 1228 |
} catch (InvocationTargetException exec) { |
| 1229 |
// TODO Auto-generated catch block |
| 1230 |
exec.printStackTrace(); |
| 1231 |
} catch (InterruptedException exec) { |
| 1232 |
// TODO Auto-generated catch block |
| 1233 |
exec.printStackTrace(); |
| 1234 |
} |
| 1235 |
|
| 1236 |
} |
| 1237 |
|
| 1238 |
public void widgetDefaultSelected(SelectionEvent e) { |
| 1239 |
|
| 1240 |
} |
796 |
} |
| 1241 |
|
797 |
|
|
|
798 |
|
| 1242 |
} |
799 |
} |