Search in sources :

Example 6 with IProcessorInstall

use of org.eclipse.wst.xsl.jaxp.launching.IProcessorInstall in project webtools.sourceediting by eclipse.

the class ProcessorRegistry method addPersistedVMs.

private void addPersistedVMs() {
    // Try retrieving the VM preferences from the preference store
    String vmXMLString = JAXPLaunchingPlugin.getDefault().getPluginPreferences().getString(JAXPRuntime.PREF_PROCESSOR_XML);
    // If the preference was found, load VMs from it into memory
    if (vmXMLString.length() > 0) {
        try {
            ByteArrayInputStream inputStream = new ByteArrayInputStream(vmXMLString.getBytes());
            ProcessorPreferences prefs = ProcessorPreferences.fromXML(inputStream);
            String defaultProcessorId = prefs.getDefaultProcessorId();
            userInstalls = prefs.getProcessors();
            for (Iterator<IProcessorInstall> iter = userInstalls.iterator(); iter.hasNext(); ) {
                IProcessorInstall install = iter.next();
                if (install.getId().equals(defaultProcessorId)) {
                    defaultProcessor = install;
                }
            }
            if (defaultProcessor == null) {
                for (Iterator<ProcessorInstall> iter = contributedInstalls.iterator(); iter.hasNext(); ) {
                    IProcessorInstall install = iter.next();
                    if (defaultProcessor == null && install.getId().equals(defaultProcessorId)) {
                        defaultProcessor = install;
                    }
                }
            }
        } catch (CoreException e) {
            JAXPLaunchingPlugin.log(e);
        }
    }
    // make the JRE the default default
    if (defaultProcessor == null) {
        defaultProcessor = jreDefaultProcessor;
    }
}
Also used : ProcessorInstall(org.eclipse.wst.xsl.jaxp.launching.ProcessorInstall) IProcessorInstall(org.eclipse.wst.xsl.jaxp.launching.IProcessorInstall) CoreException(org.eclipse.core.runtime.CoreException) ByteArrayInputStream(java.io.ByteArrayInputStream) ProcessorPreferences(org.eclipse.wst.xsl.jaxp.launching.internal.ProcessorPreferences) IProcessorInstall(org.eclipse.wst.xsl.jaxp.launching.IProcessorInstall)

Example 7 with IProcessorInstall

use of org.eclipse.wst.xsl.jaxp.launching.IProcessorInstall in project webtools.sourceediting by eclipse.

the class ProcessorRegistry method initializeFromStorage.

private void initializeFromStorage() {
    // read from the registry
    ProcessorRegistryReader registryReader = new ProcessorRegistryReader();
    registryReader.addConfigs(this);
    // find the jre default
    for (Iterator<ProcessorInstall> iter = contributedInstalls.iterator(); iter.hasNext(); ) {
        IProcessorInstall install = iter.next();
        if (install.getId().equals(JAXPRuntime.JRE_DEFAULT_PROCESSOR_ID)) {
            jreDefaultProcessor = install;
            break;
        }
    }
    // read from the preferences
    addPersistedVMs();
}
Also used : ProcessorInstall(org.eclipse.wst.xsl.jaxp.launching.ProcessorInstall) IProcessorInstall(org.eclipse.wst.xsl.jaxp.launching.IProcessorInstall) IProcessorInstall(org.eclipse.wst.xsl.jaxp.launching.IProcessorInstall)

Example 8 with IProcessorInstall

use of org.eclipse.wst.xsl.jaxp.launching.IProcessorInstall in project webtools.sourceediting by eclipse.

the class ProcessorRegistry method removeProcessor.

public void removeProcessor(int index) {
    IProcessorInstall removed = installs[index];
    if (!removed.isContributed())
        userInstalls.remove(removed);
    IProcessorInstall[] newinstalls = new IProcessorInstall[installs.length - 1];
    System.arraycopy(installs, 0, newinstalls, 0, index);
    System.arraycopy(installs, index + 1, newinstalls, index, newinstalls.length - index);
    installs = newinstalls;
}
Also used : IProcessorInstall(org.eclipse.wst.xsl.jaxp.launching.IProcessorInstall)

Example 9 with IProcessorInstall

use of org.eclipse.wst.xsl.jaxp.launching.IProcessorInstall in project webtools.sourceediting by eclipse.

the class InstalledProcessorsBlock method editProcessor.

private void editProcessor() {
    IStructuredSelection selection = (IStructuredSelection) tableViewer.getSelection();
    IProcessorInstall install = (IProcessorInstall) selection.getFirstElement();
    if (install == null) {
        return;
    }
    if (!install.isContributed()) {
        // ProcessorDetailsDialog dialog = new ProcessorDetailsDialog(getShell(), install);
        // dialog.open();
        // }
        // else
        // {
        AddProcessorDialog dialog = new AddProcessorDialog(this, getShell(), JAXPRuntime.getProcessorTypesExclJREDefault(), install);
        dialog.setTitle(Messages.AddProcessorDialog_Edit_Title);
        if (dialog.open() != Window.OK) {
            return;
        }
        // fillWithWorkspaceProcessors();
        tableViewer.refresh();
    }
}
Also used : IProcessorInstall(org.eclipse.wst.xsl.jaxp.launching.IProcessorInstall) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Example 10 with IProcessorInstall

use of org.eclipse.wst.xsl.jaxp.launching.IProcessorInstall in project webtools.sourceediting by eclipse.

the class InstalledProcessorsBlock method enableButtons.

private void enableButtons() {
    IStructuredSelection selection = (IStructuredSelection) tableViewer.getSelection();
    int selectionCount = selection.size();
    fEditButton.setEnabled(selectionCount == 1 && !((IProcessorInstall) selection.getFirstElement()).isContributed());
    if (selectionCount > 0 && selectionCount < tableViewer.getTable().getItemCount()) {
        Iterator<?> iterator = selection.iterator();
        while (iterator.hasNext()) {
            IProcessorInstall install = (IProcessorInstall) iterator.next();
            if (install.isContributed()) {
                fRemoveButton.setEnabled(false);
                return;
            }
        }
        fRemoveButton.setEnabled(true);
    } else {
        fRemoveButton.setEnabled(false);
    }
}
Also used : IProcessorInstall(org.eclipse.wst.xsl.jaxp.launching.IProcessorInstall) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Aggregations

IProcessorInstall (org.eclipse.wst.xsl.jaxp.launching.IProcessorInstall)26 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)6 ArrayList (java.util.ArrayList)4 CoreException (org.eclipse.core.runtime.CoreException)4 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)3 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)3 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)3 GridData (org.eclipse.swt.layout.GridData)3 GridLayout (org.eclipse.swt.layout.GridLayout)3 ProcessorInstall (org.eclipse.wst.xsl.jaxp.launching.ProcessorInstall)3 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)2 SelectionEvent (org.eclipse.swt.events.SelectionEvent)2 Font (org.eclipse.swt.graphics.Font)2 Composite (org.eclipse.swt.widgets.Composite)2 Label (org.eclipse.swt.widgets.Label)2 IProcessorInvoker (org.eclipse.wst.xsl.jaxp.launching.IProcessorInvoker)2 IProcessorJar (org.eclipse.wst.xsl.jaxp.launching.IProcessorJar)2 IProcessorType (org.eclipse.wst.xsl.jaxp.launching.IProcessorType)2 ITransformerFactory (org.eclipse.wst.xsl.jaxp.launching.ITransformerFactory)2 Element (org.w3c.dom.Element)2