use of org.eclipse.wst.xsl.jaxp.launching.IProcessorInstall in project webtools.sourceediting by eclipse.
the class InstalledProcessorsBlock method removeProcessors.
private void removeProcessors() {
IStructuredSelection selection = (IStructuredSelection) tableViewer.getSelection();
IProcessorInstall[] vms = new IProcessorInstall[selection.size()];
Iterator<?> iter = selection.iterator();
int i = 0;
while (iter.hasNext()) {
vms[i] = (IProcessorInstall) iter.next();
i++;
}
removeProcessors(vms);
}
use of org.eclipse.wst.xsl.jaxp.launching.IProcessorInstall in project webtools.sourceediting by eclipse.
the class InstalledProcessorsBlock method createControl.
public void createControl(Composite ancestor) {
Composite parent = new Composite(ancestor, SWT.NULL);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
layout.marginHeight = 0;
layout.marginWidth = 0;
parent.setLayout(layout);
Font font = ancestor.getFont();
parent.setFont(font);
fControl = parent;
GridData data;
Label tableLabel = new Label(parent, SWT.NONE);
tableLabel.setText(Messages.InstalledProcessorsBlock_0);
data = new GridData();
data.horizontalSpan = 2;
tableLabel.setLayoutData(data);
tableLabel.setFont(font);
Table fTable = new Table(parent, SWT.CHECK | SWT.BORDER | SWT.FULL_SELECTION | SWT.V_SCROLL);
data = new GridData(GridData.FILL_BOTH);
data.widthHint = 450;
fTable.setLayoutData(data);
fTable.setFont(font);
fTable.setHeaderVisible(true);
fTable.setLinesVisible(true);
TableColumn column1 = new TableColumn(fTable, SWT.NONE);
column1.setWidth(180);
column1.setResizable(true);
column1.setText(Messages.InstalledProcessorsBlock_1);
column1.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
sortByName();
}
});
TableColumn column2 = new TableColumn(fTable, SWT.NONE);
column2.setWidth(90);
column2.setResizable(true);
column2.setText(Messages.InstalledProcessorsBlock_2);
column2.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
sortByType();
}
});
TableColumn column4 = new TableColumn(fTable, SWT.NONE);
column4.setWidth(180);
column4.setResizable(true);
column4.setText(Messages.InstalledProcessorsBlock_4);
column4.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
sortByVersion();
}
});
tableViewer = new CheckboxTableViewer(fTable);
tableViewer.setLabelProvider(new VMLabelProvider());
tableViewer.setContentProvider(new ProcessorsContentProvider());
tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent evt) {
enableButtons();
}
});
tableViewer.addCheckStateListener(new ICheckStateListener() {
public void checkStateChanged(CheckStateChangedEvent event) {
if (event.getChecked()) {
setCheckedInstall((IProcessorInstall) event.getElement());
} else {
setCheckedInstall(null);
}
}
});
tableViewer.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent e) {
if (!tableViewer.getSelection().isEmpty()) {
editProcessor();
}
}
});
fTable.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent event) {
if (event.character == SWT.DEL && event.stateMask == 0) {
removeProcessors();
}
}
});
Composite buttons = new Composite(parent, SWT.NULL);
buttons.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
buttons.setLayout(layout);
buttons.setFont(font);
fAddButton = createPushButton(buttons, Messages.InstalledProcessorsBlock_5);
fAddButton.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event evt) {
addProcessor();
}
});
fEditButton = createPushButton(buttons, Messages.InstalledProcessorsBlock_6);
fEditButton.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event evt) {
editProcessor();
}
});
fRemoveButton = createPushButton(buttons, Messages.InstalledProcessorsBlock_7);
fRemoveButton.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event evt) {
removeProcessors();
}
});
// copied from ListDialogField.CreateSeparator()
Label separator = new Label(buttons, SWT.NONE);
separator.setVisible(false);
GridData gd = new GridData();
gd.horizontalAlignment = GridData.FILL;
gd.verticalAlignment = GridData.BEGINNING;
gd.heightHint = 4;
separator.setLayoutData(gd);
fillWithWorkspaceProcessors();
enableButtons();
restoreColumnSettings();
}
use of org.eclipse.wst.xsl.jaxp.launching.IProcessorInstall in project webtools.sourceediting by eclipse.
the class ProcessorBlock method performApply.
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
boolean usePreferences = usePreferencesRadio.getSelection();
configuration.setAttribute(JAXPLaunchConfigurationConstants.ATTR_USE_DEFAULT_PROCESSOR, usePreferences);
if (!usePreferences) {
IProcessorInstall runprocessor = (IProcessorInstall) ((IStructuredSelection) runComboViewer.getSelection()).getFirstElement();
configuration.setAttribute(JAXPLaunchConfigurationConstants.ATTR_PROCESSOR, runprocessor.getId());
configuration.setAttribute(JAXPLaunchConfigurationConstants.ATTR_TRANSFORMER_FACTORY, currentFactory == null ? null : currentFactory.getFactoryClass());
}
}
use of org.eclipse.wst.xsl.jaxp.launching.IProcessorInstall in project webtools.sourceediting by eclipse.
the class ProcessorBlock method initializeFrom.
public void initializeFrom(ILaunchConfiguration configuration) {
try {
boolean useDefaultProcessor = configuration.getAttribute(JAXPLaunchConfigurationConstants.ATTR_USE_DEFAULT_PROCESSOR, true);
if (useDefaultProcessor) {
usePreferencesRadio.setSelection(true);
overridePreferencesRadio.setSelection(false);
preferencesSelected();
} else {
usePreferencesRadio.setSelection(false);
overridePreferencesRadio.setSelection(true);
overrideSelected();
IProcessorInstall runInstall = null;
String runId = configuration.getAttribute(JAXPLaunchConfigurationConstants.ATTR_PROCESSOR, (String) null);
if (runId != null)
runInstall = JAXPRuntime.getProcessor(runId);
if (runInstall == null)
runInstall = getRunProcessorPreference();
runComboViewer.setSelection(new StructuredSelection(runInstall));
String factoryId = configuration.getAttribute(JAXPLaunchConfigurationConstants.ATTR_TRANSFORMER_FACTORY, (String) null);
if (factoryId == null) {
currentFactory = runInstall.getProcessorType().getDefaultTransformerFactory();
} else {
for (ITransformerFactory tf : runInstall.getProcessorType().getTransformerFactories()) {
if (tf.getFactoryClass().equals(factoryId)) {
currentFactory = tf;
break;
}
}
}
if (currentFactory == null) {
currentFactory = runInstall.getProcessorType().getDefaultTransformerFactory();
}
if (currentFactory != null) {
factoryComboViewer.setSelection(new StructuredSelection(currentFactory), true);
}
}
} catch (CoreException e) {
XSLDebugUIPlugin.log(e);
}
}
use of org.eclipse.wst.xsl.jaxp.launching.IProcessorInstall in project webtools.sourceediting by eclipse.
the class InstalledProcessorsBlock method removeProcessors.
public void removeProcessors(IProcessorInstall[] theInstalls) {
IStructuredSelection prev = (IStructuredSelection) getSelection();
for (IProcessorInstall element : theInstalls) {
processors.remove(element);
}
tableViewer.refresh();
IStructuredSelection curr = (IStructuredSelection) getSelection();
if (!curr.equals(prev)) {
IProcessorInstall[] installs = getProcessors();
if (curr.size() == 0 && installs.length == 1) {
// pick a default install automatically
setSelection(new StructuredSelection(installs[0]));
} else {
fireSelectionChanged();
}
}
}
Aggregations