use of org.eclipse.linuxtools.internal.callgraph.core.SystemTapView in project linuxtools by eclipse.
the class SystemTapOptionsTab method createParserOption.
private void createParserOption(Composite parserTop) {
Composite browseTop = new Composite(parserTop, SWT.NONE);
browseTop.setLayout(new GridLayout(1, false));
GridData browseData = new GridData(GridData.FILL_HORIZONTAL);
browseTop.setLayoutData(browseData);
Label suppFileLabel = new Label(browseTop, SWT.NONE);
// $NON-NLS-1$
suppFileLabel.setText("Parser");
parser = new Text(browseTop, SWT.BORDER);
parser.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
parser.addModifyListener(modifyListener);
Button parserButton = createPushButton(browseTop, "Find parsers", // $NON-NLS-1$
null);
parserButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), new ListLabelProvider());
// $NON-NLS-1$
dialog.setTitle("Select parser");
// $NON-NLS-1$
dialog.setMessage("Select parser to use.");
IExtensionRegistry reg = Platform.getExtensionRegistry();
IConfigurationElement[] extensions = reg.getConfigurationElementsFor(PluginConstants.PARSER_RESOURCE, PluginConstants.PARSER_NAME);
dialog.setElements(extensions);
if (dialog.open() == IDialogConstants.OK_ID) {
String arg = getUsefulLabel(dialog.getFirstResult());
parser.setText(arg);
}
}));
viewer = new Text(browseTop, SWT.BORDER);
viewer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
viewer.addModifyListener(modifyListener);
Button viewerButton = createPushButton(browseTop, "Find viewers", // $NON-NLS-1$
null);
viewerButton.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), new ListLabelProvider());
// $NON-NLS-1$
dialog.setTitle("Select viewer");
// $NON-NLS-1$
dialog.setMessage("Select viewer to use.");
IExtensionRegistry reg = Platform.getExtensionRegistry();
IConfigurationElement[] extensions = reg.getConfigurationElementsFor(PluginConstants.VIEW_RESOURCE, PluginConstants.VIEW_NAME);
ArrayList<IConfigurationElement> ext = new ArrayList<>();
for (IConfigurationElement el : extensions) {
if (// $NON-NLS-1$
!el.getNamespaceIdentifier().contains("org.eclipse.linuxtools"))
continue;
// org.eclipse.linuxtools, then see if the class extends SystemTapView
try {
if (el.createExecutableExtension(PluginConstants.ATTR_CLASS) instanceof SystemTapView) {
ext.add(el);
}
} catch (CoreException e1) {
}
}
dialog.setElements(ext.toArray());
if (dialog.open() == IDialogConstants.OK_ID) {
String arg = getUsefulLabel(dialog.getFirstResult());
viewer.setText(arg);
}
}));
}
Aggregations