use of org.eclipse.wst.xsl.jaxp.launching.IProcessorType in project webtools.sourceediting by eclipse.
the class ProcessorBlock method createControl.
public void createControl(Composite parent) {
Font font = parent.getFont();
Composite group = new Composite(parent, SWT.NULL);
setControl(group);
group.setLayout(new GridLayout(2, false));
group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
group.setFont(font);
// group.setText(ProcessorMessages.ProcessorBlock_0);
usePreferencesRadio = new Button(group, SWT.RADIO);
usePreferencesRadio.setText(ProcessorMessages.ProcessorBlock_1);
usePreferencesRadio.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
preferencesSelected();
updateLaunchConfigurationDialog();
}
});
alterPreferencesButton = new Button(group, SWT.PUSH);
alterPreferencesButton.setText(ProcessorMessages.ProcessorBlock_2);
GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
gd.widthHint = 150;
alterPreferencesButton.setLayoutData(gd);
alterPreferencesButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
IPreferencePage page = new ProcessorsPreferencePage();
// $NON-NLS-1$
showPrefPage("org.eclipse.wst.xslt.launching.ui.preferences.ProcessorPreferencePage", page);
}
});
overridePreferencesRadio = new Button(group, SWT.RADIO);
overridePreferencesRadio.setText(ProcessorMessages.ProcessorBlock_4);
overridePreferencesRadio.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
overrideSelected();
updateLaunchConfigurationDialog();
}
});
installedProcessorsButton = new Button(group, SWT.PUSH);
installedProcessorsButton.setText(ProcessorMessages.ProcessorsComboBlock_1);
gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
gd.widthHint = 150;
installedProcessorsButton.setLayoutData(gd);
installedProcessorsButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
IPreferencePage page = new ProcessorsPreferencePage();
// $NON-NLS-1$
showPrefPage("org.eclipse.wst.xslt.launching.ui.preferences.ProcessorPreferencePage", page);
}
});
Composite settingsComp = new Composite(group, SWT.NONE);
GridLayout gl = new GridLayout(3, false);
gl.marginHeight = 2;
settingsComp.setLayout(gl);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalIndent = 15;
gd.horizontalSpan = 2;
settingsComp.setLayoutData(gd);
settingsComp.setFont(font);
Label label = new Label(settingsComp, SWT.NONE);
label.setText(ProcessorMessages.ProcessorBlock_6);
runCombo = new Combo(settingsComp, SWT.READ_ONLY | SWT.SINGLE);
runCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
runComboViewer = new ComboViewer(runCombo);
runComboViewer.setContentProvider(new ComboContentProvider());
runComboViewer.setLabelProvider(new ComboLabelProvider());
runComboViewer.setInput(JAXPRuntime.getProcessors());
runComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection sel = (IStructuredSelection) event.getSelection();
if (!sel.isEmpty()) {
IProcessorInstall processor = (IProcessorInstall) sel.getFirstElement();
if (processor.getProcessorType().getTransformerFactories().length > 1)
factoryComboViewer.getCombo().setVisible(true);
else
factoryComboViewer.getCombo().setVisible(false);
factoryComboViewer.setInput(processor.getProcessorType());
boolean found = false;
for (ITransformerFactory tf : processor.getProcessorType().getTransformerFactories()) {
if (tf.equals(currentFactory)) {
found = true;
break;
}
}
if (!found) {
currentFactory = processor.getProcessorType().getDefaultTransformerFactory();
if (currentFactory != null)
factoryComboViewer.setSelection(new StructuredSelection(currentFactory));
}
}
updateLaunchConfigurationDialog();
}
});
Combo factoryCombo = new Combo(settingsComp, SWT.READ_ONLY | SWT.SINGLE);
factoryCombo.setLayoutData(new GridData(80, SWT.DEFAULT));
factoryComboViewer = new ComboViewer(factoryCombo);
factoryComboViewer.setContentProvider(new IStructuredContentProvider() {
private IProcessorType type;
public Object[] getElements(Object inputElement) {
return type.getTransformerFactories();
}
public void dispose() {
}
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
this.type = (IProcessorType) newInput;
}
});
factoryComboViewer.setLabelProvider(new LabelProvider() {
@Override
public String getText(Object element) {
ITransformerFactory f = (ITransformerFactory) element;
// + " - " + f.getFactoryClass();
return f.getName();
}
});
factoryComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
currentFactory = (ITransformerFactory) ((IStructuredSelection) event.getSelection()).getFirstElement();
updateLaunchConfigurationDialog();
}
});
// overridePreferencesButton = new Button(group,SWT.CHECK);
// overridePreferencesButton.setText("Override preferences");
// gd = new GridData(SWT.NONE,SWT.NONE,false,false);
// overridePreferencesButton.setLayoutData(gd);
// overridePreferencesButton.addSelectionListener(new SelectionListener(){
// public void widgetDefaultSelected(SelectionEvent e)
// {}
//
// public void widgetSelected(SelectionEvent e)
// {
// firePreferenceProcessorChanged(overridePreferencesButton.getSelection());
// }
// });
}
use of org.eclipse.wst.xsl.jaxp.launching.IProcessorType in project webtools.sourceediting by eclipse.
the class LaunchHelper method hydrateTransformerFactory.
private static ITransformerFactory hydrateTransformerFactory(ILaunchConfiguration configuration) throws CoreException {
IProcessorType type = getProcessorInstall(configuration).getProcessorType();
boolean useDefaultFactory = configuration.getAttribute(JAXPLaunchConfigurationConstants.ATTR_USE_DEFAULT_PROCESSOR, true);
if (useDefaultFactory)
return type.getDefaultTransformerFactory();
String factoryId = configuration.getAttribute(JAXPLaunchConfigurationConstants.ATTR_TRANSFORMER_FACTORY, (String) null);
if (factoryId == null)
return null;
for (ITransformerFactory factory : type.getTransformerFactories()) {
if (factory.getFactoryClass().equals(factoryId))
return factory;
}
return null;
}
use of org.eclipse.wst.xsl.jaxp.launching.IProcessorType in project webtools.sourceediting by eclipse.
the class LaunchHelper method hydrateAttributes.
private static LaunchAttributes hydrateAttributes(ILaunchConfiguration configuration) throws CoreException {
LaunchAttributes attributes = new LaunchAttributes();
// configuration.getAttribute(JAXPLaunchConfigurationConstants.ATTR_USE_FEATURES_FROM_PREFERENCES,
boolean useDefaultAttributes = false;
// true);
if (useDefaultAttributes) {
IProcessorType pt = getProcessorInstall(configuration).getProcessorType();
Map<String, String> fvals = pt.getAttributeValues();
for (Map.Entry<String, String> entry : fvals.entrySet()) {
String uri = entry.getKey();
getAttribute(pt.getAttributes(), uri);
attributes.addAttribute(new LaunchAttribute(uri, "string", // $NON-NLS-1$
entry.getValue()));
}
} else {
String s = configuration.getAttribute(JAXPLaunchConfigurationConstants.ATTR_ATTRIBUTES, (String) null);
if (s != null && s.length() > 0) {
ByteArrayInputStream inputStream = new ByteArrayInputStream(s.getBytes());
attributes = LaunchAttributes.fromXML(inputStream);
}
}
return attributes;
}
Aggregations