Search in sources :

Example 46 with ViewerCell

use of org.eclipse.jface.viewers.ViewerCell in project liferay-ide by liferay.

the class FindBreakingChangesPage method _createColumns.

private void _createColumns(final TableViewer problemsViewer) {
    final String[] titles = { "Resolved", "Line", "Problem" };
    TableViewerColumn col0 = _createTableViewerColumn(titles[0], problemsViewer);
    col0.getColumn().pack();
    col0.setEditingSupport(new EditingSupport(problemsViewer) {

        @Override
        protected boolean canEdit(Object element) {
            return true;
        }

        @Override
        protected CellEditor getCellEditor(Object element) {
            return new CheckboxCellEditor(problemsViewer.getTable());
        }

        @Override
        protected Object getValue(Object element) {
            return ((Problem) element).getStatus() == Problem.STATUS_RESOLVED;
        }

        @Override
        protected void setValue(Object element, Object value) {
            if (value == Boolean.TRUE) {
                new MarkDoneAction().run((Problem) element, problemsViewer);
            } else {
                new MarkUndoneAction().run((Problem) element, problemsViewer);
            }
        }
    });
    col0.setLabelProvider(new ColumnLabelProvider() {

        @Override
        public Image getImage(Object element) {
            Problem p = (Problem) element;
            if (p.getStatus() == Problem.STATUS_RESOLVED) {
                return _imageChecked;
            } else {
                return _imageUnchecked;
            }
        }

        @Override
        public String getText(Object element) {
            return null;
        }
    });
    TableViewerColumn col1 = _createTableViewerColumn(titles[1], problemsViewer);
    col1.getColumn().pack();
    col1.setLabelProvider(new ColumnLabelProvider() {

        @Override
        public String getText(Object element) {
            Problem p = (Problem) element;
            return p.lineNumber > -1 ? (p.lineNumber + "") : "";
        }
    });
    TableViewerColumn col2 = _createTableViewerColumn(titles[2], problemsViewer);
    col2.getColumn().pack();
    col2.setLabelProvider(new ColumnLabelProvider() {

        @Override
        public String getText(Object element) {
            Problem p = (Problem) element;
            return p.title;
        }

        @Override
        public void update(ViewerCell cell) {
            super.update(cell);
            Table table = problemsViewer.getTable();
            table.getColumn(2).pack();
        }
    });
    TableColumnLayout tableLayout = new TableColumnLayout();
    TableColumn column0 = col0.getColumn();
    TableColumn column1 = col1.getColumn();
    TableColumn column2 = col2.getColumn();
    tableLayout.setColumnData(column0, new ColumnWeightData(50, column0.getWidth()));
    tableLayout.setColumnData(column1, new ColumnWeightData(50, column1.getWidth()));
    tableLayout.setColumnData(column2, new ColumnWeightData(100, column2.getWidth()));
    Table table = problemsViewer.getTable();
    table.getParent().setLayout(tableLayout);
}
Also used : ColumnWeightData(org.eclipse.jface.viewers.ColumnWeightData) MarkDoneAction(com.liferay.ide.project.ui.migration.MarkDoneAction) Table(org.eclipse.swt.widgets.Table) CheckboxCellEditor(org.eclipse.jface.viewers.CheckboxCellEditor) CellEditor(org.eclipse.jface.viewers.CellEditor) CheckboxCellEditor(org.eclipse.jface.viewers.CheckboxCellEditor) EditingSupport(org.eclipse.jface.viewers.EditingSupport) MarkUndoneAction(com.liferay.ide.project.ui.migration.MarkUndoneAction) Image(org.eclipse.swt.graphics.Image) ViewerCell(org.eclipse.jface.viewers.ViewerCell) TableColumn(org.eclipse.swt.widgets.TableColumn) ColumnLabelProvider(org.eclipse.jface.viewers.ColumnLabelProvider) TableColumnLayout(org.eclipse.jface.layout.TableColumnLayout) Problem(com.liferay.blade.api.Problem) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn)

Example 47 with ViewerCell

use of org.eclipse.jface.viewers.ViewerCell in project arduino-eclipse-plugin by Sloeber.

the class PlatformSelectionPage method createContents.

@Override
protected Control createContents(Composite parent) {
    Composite control = new Composite(parent, SWT.NONE);
    control.setLayout(new GridLayout());
    Button btnCheckButton = new Button(control, SWT.CHECK);
    // $NON-NLS-1$
    btnCheckButton.setText("Hide 3th party json files");
    btnCheckButton.setSelection(this.myHideJson);
    btnCheckButton.addListener(SWT.Selection, new Listener() {

        @Override
        public void handleEvent(Event event) {
            PlatformSelectionPage.this.myHideJson = btnCheckButton.getSelection();
            MyPreferences.setHideJson(PlatformSelectionPage.this.myHideJson);
            PlatformSelectionPage.this.viewer.setInput(EMPTY_STRING);
        }
    });
    Text desc = new Text(control, SWT.READ_ONLY);
    desc.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    desc.setBackground(parent.getBackground());
    desc.setText(Messages.platformSelectionTip);
    PatternFilter filter = new PatternFilter() {

        @Override
        protected boolean isLeafMatch(final Viewer viewer1, final Object element) {
            boolean isMatch = false;
            if (element instanceof InstallableVersion) {
                InstallableVersion ver = (InstallableVersion) element;
                isMatch |= wordMatches(ver.getVersion().toString());
                isMatch |= myWordMatches(ver.getPlatform());
            }
            if (element instanceof IndexFile) {
                IndexFile indexFile = (IndexFile) element;
                isMatch |= myWordMatches(indexFile);
            }
            if (element instanceof Package) {
                Package pac = (Package) element;
                isMatch |= myWordMatches(pac);
            }
            if (element instanceof Platform) {
                Platform platform = (Platform) element;
                isMatch |= myWordMatches(platform);
            }
            return isMatch;
        }

        private boolean myWordMatches(Platform platform) {
            boolean ret = wordMatches(platform.getName());
            ret |= wordMatches(platform.getArchitecture());
            ret |= wordMatches(platform.getBoards());
            ret |= myWordMatches(platform.getPackage());
            return ret;
        }

        private boolean myWordMatches(Package pac) {
            boolean ret = wordMatches(pac.getEmail());
            ret |= wordMatches(pac.getMaintainer());
            ret |= wordMatches(pac.getName());
            ret |= wordMatches(pac.getWebsiteURL().toString());
            ret |= wordMatches(pac.getIndexFile().toString());
            return ret;
        }

        private boolean myWordMatches(IndexFile indexFile) {
            return wordMatches(indexFile.getFullName());
        }
    };
    this.myGuiplatformTree = new FilteredTree(control, SWT.CHECK | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION, filter, true) {

        @Override
        protected TreeViewer doCreateTreeViewer(Composite composite, int style) {
            CheckboxTreeViewer viewer1 = new CheckboxTreeViewer(composite);
            viewer1.setCheckStateProvider(new ICheckStateProvider() {

                @Override
                public boolean isChecked(Object element) {
                    if (element instanceof InstallableVersion) {
                        return ((InstallableVersion) element).isInstalled();
                    }
                    if (element instanceof IndexFile) {
                        return ((IndexFile) element).isInstalled();
                    }
                    if (element instanceof Package) {
                        return ((Package) element).isInstalled();
                    }
                    if (element instanceof Platform) {
                        return ((Platform) element).isInstalled();
                    }
                    return false;
                }

                @Override
                public boolean isGrayed(Object element) {
                    if (element instanceof InstallableVersion) {
                        return false;
                    }
                    if (element instanceof IndexFile) {
                        return ((IndexFile) element).isInstalled();
                    }
                    if (element instanceof Package) {
                        return ((Package) element).isInstalled();
                    }
                    if (element instanceof Platform) {
                        return ((Platform) element).isInstalled();
                    }
                    return false;
                }
            });
            viewer1.addCheckStateListener(new ICheckStateListener() {

                @Override
                public void checkStateChanged(CheckStateChangedEvent event) {
                    Object element = event.getElement();
                    if (element instanceof InstallableVersion) {
                        InstallableVersion cur = (InstallableVersion) element;
                        cur.setInstalled(event.getChecked());
                    }
                    PlatformSelectionPage.this.viewer.refresh();
                }
            });
            viewer1.setContentProvider(new ITreeContentProvider() {

                @Override
                public Object[] getElements(Object inputElement) {
                    if (PlatformSelectionPage.this.myHideJson) {
                        Set<Package> packages = PlatformSelectionPage.this.myPlatformTree.getAllPackages();
                        return packages.toArray(new Object[packages.size()]);
                    }
                    Collection<IndexFile> indexFiles = PlatformSelectionPage.this.myPlatformTree.getAllIndexFiles();
                    return indexFiles.toArray(new Object[indexFiles.size()]);
                }

                @Override
                public void dispose() {
                // nothing to do
                }

                @Override
                public void inputChanged(Viewer viewer11, Object oldInput, Object newInput) {
                // nothing to do
                }

                @Override
                public Object[] getChildren(Object parentElement) {
                    if (parentElement instanceof IndexFile) {
                        Collection<Package> packages = ((IndexFile) parentElement).getAllPackages();
                        return packages.toArray(new Object[packages.size()]);
                    }
                    if (parentElement instanceof Package) {
                        Collection<Platform> platforms = ((Package) parentElement).getPlatforms();
                        return platforms.toArray(new Object[platforms.size()]);
                    }
                    if (parentElement instanceof Platform) {
                        Collection<InstallableVersion> versions = ((Platform) parentElement).getVersions();
                        return versions.toArray(new Object[versions.size()]);
                    }
                    return null;
                }

                @Override
                public Object getParent(Object element) {
                    return null;
                }

                @Override
                public boolean hasChildren(Object element) {
                    return !(element instanceof InstallableVersion);
                }
            });
            viewer1.setLabelProvider(new CellLabelProvider() {

                @Override
                public String getToolTipText(Object element) {
                    if (element instanceof IndexFile) {
                        return ((IndexFile) element).getFullName();
                    }
                    if (element instanceof Package) {
                        Package pkg = (Package) element;
                        return // $NON-NLS-1$
                        Messages.packageTooltip.replaceAll("\\$\\{MAINTAINER}", pkg.getMaintainer()).replaceAll("\\$\\{EMAIL}", // $NON-NLS-1$
                        pkg.getEmail()).replaceAll("\\$\\{URL}", // $NON-NLS-1$
                        pkg.getWebsiteURL().toString());
                    }
                    if (element instanceof Platform) {
                        return ((Platform) element).getBoards();
                    }
                    if (element instanceof InstallableVersion) {
                        return null;
                    }
                    return null;
                }

                @Override
                public org.eclipse.swt.graphics.Point getToolTipShift(Object object) {
                    return new org.eclipse.swt.graphics.Point(5, 5);
                }

                @Override
                public int getToolTipDisplayDelayTime(Object object) {
                    return 1000;
                }

                @Override
                public int getToolTipTimeDisplayed(Object object) {
                    return 5000;
                }

                @Override
                public void update(ViewerCell cell) {
                    if (cell.getElement() instanceof IndexFile) {
                        cell.setText(((IndexFile) cell.getElement()).getNiceName());
                    }
                    if (cell.getElement() instanceof Package) {
                        cell.setText(((Package) cell.getElement()).getName());
                    }
                    if (cell.getElement() instanceof Platform) {
                        cell.setText(((Platform) cell.getElement()).getName());
                    }
                    if (cell.getElement() instanceof InstallableVersion) {
                        cell.setText(((InstallableVersion) cell.getElement()).getVersion().toString());
                    }
                }
            });
            return viewer1;
        }
    };
    this.viewer = this.myGuiplatformTree.getViewer();
    ColumnViewerToolTipSupport.enableFor(this.viewer);
    this.myGuiplatformTree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    this.viewer.setInput(EMPTY_STRING);
    return control;
}
Also used : ITreeContentProvider(org.eclipse.jface.viewers.ITreeContentProvider) PatternFilter(org.eclipse.ui.dialogs.PatternFilter) ICheckStateListener(org.eclipse.jface.viewers.ICheckStateListener) Listener(org.eclipse.swt.widgets.Listener) Platform(io.sloeber.core.api.PackageManager.PlatformTree.Platform) CheckboxTreeViewer(org.eclipse.jface.viewers.CheckboxTreeViewer) TreeViewer(org.eclipse.jface.viewers.TreeViewer) ICheckStateListener(org.eclipse.jface.viewers.ICheckStateListener) IndexFile(io.sloeber.core.api.PackageManager.PlatformTree.IndexFile) Viewer(org.eclipse.jface.viewers.Viewer) CheckboxTreeViewer(org.eclipse.jface.viewers.CheckboxTreeViewer) TreeViewer(org.eclipse.jface.viewers.TreeViewer) FilteredTree(org.eclipse.ui.dialogs.FilteredTree) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) CellLabelProvider(org.eclipse.jface.viewers.CellLabelProvider) Composite(org.eclipse.swt.widgets.Composite) ICheckStateProvider(org.eclipse.jface.viewers.ICheckStateProvider) Text(org.eclipse.swt.widgets.Text) ViewerCell(org.eclipse.jface.viewers.ViewerCell) InstallableVersion(io.sloeber.core.api.PackageManager.PlatformTree.InstallableVersion) CheckboxTreeViewer(org.eclipse.jface.viewers.CheckboxTreeViewer) GridData(org.eclipse.swt.layout.GridData) Event(org.eclipse.swt.widgets.Event) CheckStateChangedEvent(org.eclipse.jface.viewers.CheckStateChangedEvent) Package(io.sloeber.core.api.PackageManager.PlatformTree.Package) CheckStateChangedEvent(org.eclipse.jface.viewers.CheckStateChangedEvent)

Example 48 with ViewerCell

use of org.eclipse.jface.viewers.ViewerCell in project jbosstools-openshift by jbosstools.

the class PortForwardingWizardPage method createTable.

protected TableViewer createTable(Composite tableContainer, DataBindingContext dbc) {
    Table table = new Table(tableContainer, SWT.BORDER | SWT.FULL_SELECTION | SWT.V_SCROLL | SWT.H_SCROLL);
    table.setLinesVisible(true);
    table.setHeaderVisible(true);
    TableColumnLayout tableLayout = new TableColumnLayout();
    tableContainer.setLayout(tableLayout);
    TableViewer viewer = new TableViewer(table);
    viewer.setContentProvider(new ArrayContentProvider());
    createTableColumn("Name", 1, new CellLabelProvider() {

        @Override
        public void update(ViewerCell cell) {
            IPortForwardable.PortPair port = (IPortForwardable.PortPair) cell.getElement();
            cell.setText(StringUtils.defaultIfBlank(port.getName(), ""));
        }
    }, viewer, tableLayout);
    createTableColumn("Local Port", 2, new StyledCellLabelProvider() {

        @Override
        public void update(ViewerCell cell) {
            IPortForwardable.PortPair port = (IPortForwardable.PortPair) cell.getElement();
            int local = port.getLocalPort();
            if (wizardModel.getPortForwarding() || !PortForwardingUtils.isPortInUse(local)) {
                cell.setText(Integer.toString(local));
                cell.setStyleRanges(new StyleRange[0]);
            } else {
                String text = Integer.toString(local) + " (in use)";
                StyledString styledString = new StyledString();
                styledString.append(text, usedPortStyler);
                cell.setText(styledString.toString());
                cell.setStyleRanges(styledString.getStyleRanges());
            }
            super.update(cell);
        }
    }, viewer, tableLayout);
    createTableColumn("Remote Port", 2, new CellLabelProvider() {

        @Override
        public void update(ViewerCell cell) {
            IPortForwardable.PortPair port = (IPortForwardable.PortPair) cell.getElement();
            cell.setText(Integer.toString(port.getRemotePort()));
        }
    }, viewer, tableLayout);
    createTableColumn("Status", 1, new CellLabelProvider() {

        @Override
        public void update(ViewerCell cell) {
            final boolean started = wizardModel.getPortForwarding();
            cell.setText(started ? "Started" : "Stopped");
        }
    }, viewer, tableLayout);
    IObservableValue forwardablePortsModelObservable = BeanProperties.value(PortForwardingWizardModel.PROPERTY_FORWARDABLE_PORTS).observe(wizardModel);
    final ForwardablePortListValidator validator = new ForwardablePortListValidator(forwardablePortsModelObservable);
    dbc.addValidationStatusProvider(validator);
    viewer.setInput(wizardModel.getForwardablePorts());
    // 
    return viewer;
}
Also used : StyledCellLabelProvider(org.eclipse.jface.viewers.StyledCellLabelProvider) Table(org.eclipse.swt.widgets.Table) StyleRange(org.eclipse.swt.custom.StyleRange) StyledString(org.eclipse.jface.viewers.StyledString) StyledString(org.eclipse.jface.viewers.StyledString) ViewerCell(org.eclipse.jface.viewers.ViewerCell) IPortForwardable(com.openshift.restclient.capability.resources.IPortForwardable) TableColumnLayout(org.eclipse.jface.layout.TableColumnLayout) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) IObservableValue(org.eclipse.core.databinding.observable.value.IObservableValue) TableViewer(org.eclipse.jface.viewers.TableViewer) CellLabelProvider(org.eclipse.jface.viewers.CellLabelProvider) StyledCellLabelProvider(org.eclipse.jface.viewers.StyledCellLabelProvider)

Example 49 with ViewerCell

use of org.eclipse.jface.viewers.ViewerCell in project tdq-studio-se by Talend.

the class GridTreeViewer method updateRowHeader.

private void updateRowHeader(Widget widget) {
    if (rowHeaderLabelProvider != null) {
        ViewerCell cell = getViewerRowFromItem(widget).getCell(Integer.MAX_VALUE);
        rowHeaderLabelProvider.update(cell);
    }
}
Also used : ViewerCell(org.eclipse.jface.viewers.ViewerCell)

Example 50 with ViewerCell

use of org.eclipse.jface.viewers.ViewerCell in project egit by eclipse.

the class GitSynchronizeWizardPage method createControl.

@Override
public void createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(1, false);
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    composite.setLayout(layout);
    for (IProject project : ROOT.getProjects()) {
        RepositoryMapping repositoryMapping = RepositoryMapping.getMapping(project);
        if (repositoryMapping == null)
            continue;
        Repository repo = repositoryMapping.getRepository();
        Set<IProject> projects = resources.get(repo);
        if (projects == null) {
            projects = new HashSet<>();
            resources.put(repo, projects);
        }
        projects.add(project);
    }
    treeViewer = new TreeViewer(composite, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION);
    treeViewer.getTree().setLinesVisible(true);
    treeViewer.getTree().setHeaderVisible(true);
    treeViewer.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    TreeViewerColumn projectsColumn = new TreeViewerColumn(treeViewer, SWT.LEAD);
    projectsColumn.getColumn().setText(UIText.GitBranchSynchronizeWizardPage_repository);
    projectsColumn.getColumn().setImage(repositoryImage);
    projectsColumn.setLabelProvider(new StyledCellLabelProvider() {

        @Override
        public void update(ViewerCell cell) {
            Object element = cell.getElement();
            if (element instanceof Repository) {
                Repository repo = (Repository) element;
                // $NON-NLS-1$
                String descr = "";
                try {
                    // $NON-NLS-1$ //$NON-NLS-2$
                    descr += " [" + repo.getBranch() + "]";
                } catch (IOException e) {
                    Activator.logError(e.getMessage(), e);
                }
                Color decorationsColor = JFaceResources.getColorRegistry().get(JFacePreferences.DECORATIONS_COLOR);
                String repoName = repo.getWorkTree().getName();
                int repoNameLen = repoName.length();
                StyleRange styleRange = new StyleRange(repoNameLen, repoNameLen + descr.length(), decorationsColor, null);
                cell.setImage(repositoryImage);
                cell.setText(repoName + descr);
                cell.setStyleRanges(new StyleRange[] { styleRange });
            }
            super.update(cell);
        }
    });
    TreeViewerColumn dstColumn = new TreeViewerColumn(treeViewer, SWT.LEAD);
    dstColumn.getColumn().setText(UIText.GitBranchSynchronizeWizardPage_destination);
    dstColumn.getColumn().setImage(branchImage);
    dstColumn.getColumn().setWidth(200);
    final ComboBoxCellEditor branchesEditor = new ComboBoxCellEditor(treeViewer.getTree(), new String[0]);
    branchesEditor.setActivationStyle(ComboBoxCellEditor.DROP_DOWN_ON_KEY_ACTIVATION | ComboBoxCellEditor.DROP_DOWN_ON_MOUSE_ACTIVATION);
    ((CCombo) branchesEditor.getControl()).addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            CCombo combo = (CCombo) e.widget;
            TreeSelection sel = (TreeSelection) treeViewer.getSelection();
            int selectedIdx = combo.getSelectionIndex();
            Repository repo = (Repository) sel.getFirstElement();
            if (selectedIdx != -1) {
                selectedBranches.put(repo, combo.getItem(selectedIdx));
                setPageComplete(true);
            } else {
                selectedBranches.put(repo, null);
                setPageComplete(false);
            }
        }
    });
    dstColumn.setEditingSupport(new EditingSupport(treeViewer) {

        @Override
        protected void setValue(Object element, Object value) {
            int intValue = ((Integer) value).intValue();
            if (intValue == -1)
                return;
            CCombo combo = (CCombo) branchesEditor.getControl();
            String branch = combo.getItem(intValue);
            selectedBranches.put((Repository) element, branch);
            treeViewer.refresh(element, true);
            validatePage();
        }

        @Override
        protected Object getValue(Object element) {
            String branch = selectedBranches.get(element);
            CCombo combo = (CCombo) branchesEditor.getControl();
            int index = branch == null ? 0 : combo.indexOf(branch);
            return Integer.valueOf(index);
        }

        @Override
        protected CellEditor getCellEditor(Object element) {
            Repository repo = (Repository) element;
            List<String> refs = new LinkedList<>(repo.getAllRefs().keySet());
            List<Ref> additionalRefs;
            try {
                additionalRefs = repo.getRefDatabase().getAdditionalRefs();
            } catch (IOException e) {
                additionalRefs = null;
            }
            if (additionalRefs != null)
                for (Ref ref : additionalRefs) refs.add(ref.getName());
            Collections.sort(refs, CommonUtils.STRING_ASCENDING_COMPARATOR);
            branchesEditor.setItems(refs.toArray(new String[refs.size()]));
            return branchesEditor;
        }

        @Override
        protected boolean canEdit(Object element) {
            return true;
        }
    });
    dstColumn.setLabelProvider(new ColumnLabelProvider() {

        @Override
        public String getText(Object element) {
            String branch = selectedBranches.get(element);
            // $NON-NLS-1$
            return branch == null ? "" : branch;
        }
    });
    treeViewer.setContentProvider(new ITreeContentProvider() {

        @Override
        public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
        // nothing to do
        }

        @Override
        public void dispose() {
        // nothing to do
        }

        @Override
        public Object[] getElements(Object inputElement) {
            return (Object[]) inputElement;
        }

        @Override
        public boolean hasChildren(Object element) {
            return false;
        }

        @Override
        public Object getParent(Object element) {
            return null;
        }

        @Override
        public Object[] getChildren(Object parentElement) {
            return new Object[0];
        }
    });
    List<Repository> repositoriesList = new ArrayList<>(resources.keySet());
    Collections.sort(repositoriesList, new Comparator<Repository>() {

        @Override
        public int compare(Repository o1, Repository o2) {
            String name1 = o1.getWorkTree().getName();
            String name2 = o2.getWorkTree().getName();
            return name1.compareToIgnoreCase(name2);
        }
    });
    treeViewer.setInput(repositoriesList.toArray(new Repository[repositoriesList.size()]));
    projectsColumn.getColumn().pack();
    Composite buttonsComposite = new Composite(composite, SWT.NONE);
    layout = new GridLayout(4, false);
    layout.numColumns = 1;
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    buttonsComposite.setLayout(layout);
    buttonsComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    final Button fetchChanges = new Button(buttonsComposite, SWT.CHECK);
    fetchChanges.setText(UIText.GitBranchSynchronizeWizardPage_fetchChangesFromRemote);
    fetchChanges.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            forceFetch = fetchChanges.getSelection();
        }
    });
    fetchChanges.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    fetchChanges.setSelection(Activator.getDefault().getPreferenceStore().getBoolean(UIPreferences.SYNC_VIEW_FETCH_BEFORE_LAUNCH));
    final Button includeLocal = new Button(buttonsComposite, SWT.CHECK);
    includeLocal.setText(UIText.GitBranchSynchronizeWizardPage_includeUncommitedChanges);
    includeLocal.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            shouldIncludeLocal = includeLocal.getSelection();
        }
    });
    includeLocal.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    Dialog.applyDialogFont(composite);
    setPageComplete(false);
    setControl(composite);
}
Also used : ITreeContentProvider(org.eclipse.jface.viewers.ITreeContentProvider) TreeViewer(org.eclipse.jface.viewers.TreeViewer) CellEditor(org.eclipse.jface.viewers.CellEditor) ComboBoxCellEditor(org.eclipse.jface.viewers.ComboBoxCellEditor) StyleRange(org.eclipse.swt.custom.StyleRange) ArrayList(java.util.ArrayList) EditingSupport(org.eclipse.jface.viewers.EditingSupport) Viewer(org.eclipse.jface.viewers.Viewer) TreeViewer(org.eclipse.jface.viewers.TreeViewer) ColumnLabelProvider(org.eclipse.jface.viewers.ColumnLabelProvider) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) TreeSelection(org.eclipse.jface.viewers.TreeSelection) RepositoryMapping(org.eclipse.egit.core.project.RepositoryMapping) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) List(java.util.List) StyledCellLabelProvider(org.eclipse.jface.viewers.StyledCellLabelProvider) Composite(org.eclipse.swt.widgets.Composite) Color(org.eclipse.swt.graphics.Color) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) ComboBoxCellEditor(org.eclipse.jface.viewers.ComboBoxCellEditor) IOException(java.io.IOException) ViewerCell(org.eclipse.jface.viewers.ViewerCell) IProject(org.eclipse.core.resources.IProject) TreeViewerColumn(org.eclipse.jface.viewers.TreeViewerColumn) Repository(org.eclipse.jgit.lib.Repository) Ref(org.eclipse.jgit.lib.Ref) CCombo(org.eclipse.swt.custom.CCombo) GridData(org.eclipse.swt.layout.GridData)

Aggregations

ViewerCell (org.eclipse.jface.viewers.ViewerCell)54 TableViewer (org.eclipse.jface.viewers.TableViewer)21 Composite (org.eclipse.swt.widgets.Composite)21 CellLabelProvider (org.eclipse.jface.viewers.CellLabelProvider)18 GridData (org.eclipse.swt.layout.GridData)18 Table (org.eclipse.swt.widgets.Table)18 GridLayout (org.eclipse.swt.layout.GridLayout)17 TableViewerColumn (org.eclipse.jface.viewers.TableViewerColumn)16 SelectionEvent (org.eclipse.swt.events.SelectionEvent)15 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)12 Button (org.eclipse.swt.widgets.Button)12 TableColumnLayout (org.eclipse.jface.layout.TableColumnLayout)11 StyledCellLabelProvider (org.eclipse.jface.viewers.StyledCellLabelProvider)11 Label (org.eclipse.swt.widgets.Label)11 StyledString (org.eclipse.jface.viewers.StyledString)10 ColumnWeightData (org.eclipse.jface.viewers.ColumnWeightData)9 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)9 Point (org.eclipse.swt.graphics.Point)9 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)8 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)8