Search in sources :

Example 1 with ProvElementContentProvider

use of org.eclipse.equinox.internal.p2.ui.viewers.ProvElementContentProvider in project translationstudio8 by heartsome.

the class UpdateWizardPage method createControl.

public void createControl(final Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout gridLayout = new GridLayout();
    gridLayout.marginWidth = 0;
    gridLayout.marginHeight = 0;
    composite.setLayout(gridLayout);
    treeViewer = new TreeViewer(composite, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION);
    GridData data = new GridData(GridData.FILL_BOTH);
    Tree tree = treeViewer.getTree();
    tree.setLayoutData(data);
    tree.setHeaderVisible(true);
    IUColumnConfig[] columns = getColumnConfig();
    for (int i = 0; i < columns.length; i++) {
        TreeColumn tc = new TreeColumn(tree, SWT.LEFT, i);
        tc.setResizable(true);
        tc.setText(columns[i].getColumnTitle());
        tc.setWidth(columns[i].getWidthInPixels(tree));
    }
    contentProvider = new ProvElementContentProvider();
    treeViewer.setContentProvider(contentProvider);
    labelProvider = new IUDetailsLabelProvider(null, getColumnConfig(), getShell());
    treeViewer.setLabelProvider(labelProvider);
    setControl(composite);
    final Runnable runnable = new Runnable() {

        public void run() {
            //				updateStatus(input, operation);
            setDrilldownElements(input, operation);
            treeViewer.setInput(input);
        }
    };
    if (operation != null && !operation.hasResolved()) {
        try {
            getContainer().run(true, false, new IRunnableWithProgress() {

                public void run(IProgressMonitor monitor) {
                    operation.resolveModal(monitor);
                    parent.getDisplay().asyncExec(runnable);
                }
            });
        } catch (Exception e) {
            StatusManager.getManager().handle(new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, e.getMessage(), e));
        }
    } else {
        runnable.run();
    }
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.core.runtime.Status) Composite(org.eclipse.swt.widgets.Composite) TreeViewer(org.eclipse.jface.viewers.TreeViewer) ProvElementContentProvider(org.eclipse.equinox.internal.p2.ui.viewers.ProvElementContentProvider) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress) GridLayout(org.eclipse.swt.layout.GridLayout) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) TreeColumn(org.eclipse.swt.widgets.TreeColumn) IUDetailsLabelProvider(org.eclipse.equinox.internal.p2.ui.viewers.IUDetailsLabelProvider) GridData(org.eclipse.swt.layout.GridData) Tree(org.eclipse.swt.widgets.Tree) IUColumnConfig(org.eclipse.equinox.internal.p2.ui.viewers.IUColumnConfig)

Aggregations

IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 IStatus (org.eclipse.core.runtime.IStatus)1 Status (org.eclipse.core.runtime.Status)1 IUColumnConfig (org.eclipse.equinox.internal.p2.ui.viewers.IUColumnConfig)1 IUDetailsLabelProvider (org.eclipse.equinox.internal.p2.ui.viewers.IUDetailsLabelProvider)1 ProvElementContentProvider (org.eclipse.equinox.internal.p2.ui.viewers.ProvElementContentProvider)1 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)1 TreeViewer (org.eclipse.jface.viewers.TreeViewer)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Composite (org.eclipse.swt.widgets.Composite)1 Tree (org.eclipse.swt.widgets.Tree)1 TreeColumn (org.eclipse.swt.widgets.TreeColumn)1