Example usage for org.eclipse.jface.viewers DecoratingLabelProvider DecoratingLabelProvider

List of usage examples for org.eclipse.jface.viewers DecoratingLabelProvider DecoratingLabelProvider

Introduction

In this page you can find the example usage for org.eclipse.jface.viewers DecoratingLabelProvider DecoratingLabelProvider.

Prototype

public DecoratingLabelProvider(ILabelProvider provider, ILabelDecorator decorator) 

Source Link

Document

Creates a decorating label provider which uses the given label decorator to decorate labels provided by the given label provider.

Usage

From source file:org.springframework.ide.eclipse.beans.ui.BeansUIPlugin.java

License:Open Source License

private synchronized ILabelProvider internalGetLabelProvider() {
    if (labelProvider == null) {
        labelProvider = new DecoratingLabelProvider(new BeansModelLabelProvider(true),
                new BeansModelLabelDecorator());
    }//ww w  .j a  v  a2 s  .  com
    return labelProvider;
}

From source file:org.springframework.ide.eclipse.webflow.ui.graph.dialogs.ActionComposite.java

License:Open Source License

protected Control createDialogArea(Composite parent) {
    Group groupActionType = new Group(parent, SWT.NULL);
    GridLayout layoutAttMap = new GridLayout();
    layoutAttMap.marginWidth = 3;//w w w. ja  v a2s. com
    layoutAttMap.marginHeight = 3;
    groupActionType.setLayout(layoutAttMap);
    groupActionType.setText(" Actions ");
    groupActionType.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Composite tableAndButtons = new Composite(groupActionType, SWT.NONE);
    tableAndButtons.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    GridLayout layout2 = new GridLayout();
    layout2.marginHeight = 0;
    layout2.marginWidth = 0;
    layout2.numColumns = 2;
    tableAndButtons.setLayout(layout2);

    Table configsTable = new Table(tableAndButtons,
            SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER);
    GridData data = new GridData(GridData.FILL_BOTH);
    data.widthHint = 150;
    data.heightHint = 200;
    configsTable.setLayoutData(data);
    configsTable.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            handleTableSelectionChanged();
        }
    });
    configsViewer = new TableViewer(configsTable);
    configsViewer.setContentProvider(new ActionContentProvider(this.actions));
    configsViewer.setLabelProvider(
            new DecoratingLabelProvider(new WebflowModelLabelProvider(), new WebflowModelLabelDecorator()));
    configsViewer.setInput(this);

    Composite buttonArea = new Composite(tableAndButtons, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    buttonArea.setLayout(layout);
    buttonArea.setLayoutData(new GridData(GridData.FILL_VERTICAL));
    editButton = new Button(buttonArea, SWT.PUSH);
    editButton.setText("Edit");
    GridData data1 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    data1.widthHint = 40;
    editButton.setLayoutData(data1);
    editButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            IStructuredSelection selection = (IStructuredSelection) configsViewer.getSelection();
            if (selection.getFirstElement() != null) {
                if (selection.getFirstElement() instanceof IActionElement) {
                    TitleAreaDialog dialog = null;
                    IActionElement actionElement = (IActionElement) selection.getFirstElement();
                    if (actionElement instanceof Action) {
                        dialog = new ActionPropertiesDialog(parentShell, parentElement,
                                (Action) selection.getFirstElement());
                    } else if (actionElement instanceof BeanAction) {
                        dialog = new BeanActionPropertiesDialog(parentShell, parentElement,
                                (BeanAction) selection.getFirstElement());
                    } else if (actionElement instanceof EvaluateAction) {
                        dialog = new EvaluateActionPropertiesDialog(parentShell, parentElement,
                                (EvaluateAction) selection.getFirstElement());
                    } else if (actionElement instanceof Set) {
                        dialog = new SetActionPropertiesDialog(parentShell, parentElement,
                                (Set) selection.getFirstElement());
                    }
                    if (Dialog.OK == dialog.open()) {
                        configsViewer.refresh();
                    }
                }
            }
        }
    });

    deleteButton = new Button(buttonArea, SWT.PUSH);
    deleteButton.setText("Delete");
    data1 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    data1.widthHint = 40;
    deleteButton.setLayoutData(data1);
    deleteButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            IStructuredSelection selection = (IStructuredSelection) configsViewer.getSelection();
            if (selection.getFirstElement() != null && selection.getFirstElement() instanceof IActionElement) {
                IActionElement actionElement = (IActionElement) selection.getFirstElement();
                actions.remove(actionElement);
                configsViewer.refresh(true);
            }
        }
    });

    Label sep = new Label(buttonArea, SWT.HORIZONTAL | SWT.SEPARATOR);
    sep.setLayoutData(data1);

    addActionButton = new Button(buttonArea, SWT.PUSH);
    if (WebflowModelXmlUtils.isVersion1Flow(parentElement)) {
        addActionButton.setText("Add Action");
    } else {
        addActionButton.setText("Add Render");
    }
    data1 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    data1.widthHint = 120;
    addActionButton.setLayoutData(data1);
    addActionButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            Action action = new Action();
            action.createNew(parentElement);
            action.setType(type);
            if (DialogUtils.openPropertiesDialog(parentElement, action, true) == Dialog.OK) {
                actions.add(action);
                configsViewer.refresh();
            }
        }
    });
    if (WebflowModelXmlUtils.isVersion1Flow(parentElement)) {
        addBeanActionButton = new Button(buttonArea, SWT.PUSH);
        addBeanActionButton.setText("Add Bean Action");
        data1 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
        data1.widthHint = 120;
        addBeanActionButton.setLayoutData(data1);
        addBeanActionButton.addSelectionListener(new SelectionAdapter() {
            public void widgetSelected(SelectionEvent e) {
                BeanAction action = new BeanAction();
                action.createNew(parentElement);
                action.setType(type);
                if (DialogUtils.openPropertiesDialog(parentElement, action, true) == Dialog.OK) {
                    actions.add(action);
                    configsViewer.refresh();
                }
            }
        });
    }
    addEvaluationButton = new Button(buttonArea, SWT.PUSH);
    if (WebflowModelXmlUtils.isVersion1Flow(parentElement)) {
        addEvaluationButton.setText("Add Evaluation Action");
    } else {
        addEvaluationButton.setText("Add Evaluate");
    }
    data1 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    data1.widthHint = 120;
    addEvaluationButton.setLayoutData(data1);
    addEvaluationButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            EvaluateAction action = new EvaluateAction();
            action.createNew(parentElement);
            action.setType(type);
            if (DialogUtils.openPropertiesDialog(parentElement, action, true) == Dialog.OK) {
                actions.add(action);
                configsViewer.refresh();
            }
        }
    });
    addSetButton = new Button(buttonArea, SWT.PUSH);
    addSetButton.setText("Add Set");
    data1 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    data1.widthHint = 120;
    addSetButton.setLayoutData(data1);
    addSetButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            Set action = new Set();
            action.createNew(parentElement);
            action.setType(type);
            if (DialogUtils.openPropertiesDialog(parentElement, action, true) == Dialog.OK) {
                actions.add(action);
                configsViewer.refresh();
            }
        }
    });

    editButton.setEnabled(false);
    deleteButton.setEnabled(false);

    return groupActionType;
}

From source file:org.springframework.ide.eclipse.webflow.ui.graph.dialogs.DecisionStatePropertiesDialog.java

License:Open Source License

protected Control createDialogArea(Composite parent) {
    Composite parentComposite = (Composite) super.createDialogArea(parent);
    Composite composite = new Composite(parentComposite, SWT.NULL);
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;//w w  w . jav a2 s  . c  o  m
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));

    TabFolder folder = new TabFolder(composite, SWT.NULL);
    TabItem item1 = new TabItem(folder, SWT.NULL);
    item1.setText("General");
    item1.setImage(getImage());
    TabItem item3 = new TabItem(folder, SWT.NULL);
    TabItem item4 = new TabItem(folder, SWT.NULL);
    TabItem item5 = new TabItem(folder, SWT.NULL);
    TabItem item6 = new TabItem(folder, SWT.NULL);

    Group groupActionType = new Group(folder, SWT.NULL);
    GridLayout layoutAttMap = new GridLayout();
    layoutAttMap.marginWidth = 3;
    layoutAttMap.marginHeight = 3;
    groupActionType.setLayout(layoutAttMap);
    groupActionType.setText(" Decision State ");
    GridData grid = new GridData();
    groupActionType.setLayoutData(grid);

    Composite nameGroup = new Composite(groupActionType, SWT.NULL);
    nameGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    GridLayout layout1 = new GridLayout();
    layout1.numColumns = 2;
    layout1.marginWidth = 5;
    nameGroup.setLayout(layout1);
    nameLabel = new Label(nameGroup, SWT.NONE);
    nameLabel.setText("State id");
    nameText = new Text(nameGroup, SWT.SINGLE | SWT.BORDER);
    if (this.decisionState != null && this.decisionState.getId() != null) {
        this.nameText.setText(this.decisionState.getId());
    }
    nameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    nameText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            validateInput();
        }
    });

    if (!WebflowModelXmlUtils.isVersion1Flow(decisionState)) {
        parentLabel = new Label(nameGroup, SWT.NONE);
        parentLabel.setText("Parent state id");
        parentText = new Text(nameGroup, SWT.SINGLE | SWT.BORDER);
        if (this.decisionState != null && this.decisionState.getParent() != null) {
            this.parentText.setText(this.decisionState.getParent());
        }
        parentText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        parentText.addModifyListener(new ModifyListener() {

            public void modifyText(ModifyEvent e) {
                validateInput();
            }
        });
    }

    Group groupIfsType = new Group(groupActionType, SWT.NULL);
    layoutAttMap = new GridLayout();
    layoutAttMap.marginWidth = 3;
    layoutAttMap.marginHeight = 3;
    groupIfsType.setLayout(layoutAttMap);
    groupIfsType.setText(" Ifs ");
    groupIfsType.setLayoutData(new GridData(GridData.FILL_BOTH));

    Composite tableAndButtons = new Composite(groupIfsType, SWT.NONE);
    tableAndButtons.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    GridLayout layout2 = new GridLayout();
    layout2.marginHeight = 0;
    layout2.marginWidth = 0;
    layout2.numColumns = 2;
    tableAndButtons.setLayout(layout2);

    Table configsTable = new Table(tableAndButtons,
            SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER);
    GridData data = new GridData(GridData.FILL_BOTH);
    // data.widthHint = 250;
    data.heightHint = 145;
    configsTable.setLayoutData(data);
    configsTable.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            handleTableSelectionChanged();
        }
    });

    configsViewer = new TableViewer(configsTable);
    configsViewer.setContentProvider(new IfContentProvider(this.decisionStateClone));
    configsViewer.setLabelProvider(
            new DecoratingLabelProvider(new WebflowModelLabelProvider(), new WebflowModelLabelDecorator()));
    configsViewer.setInput(this);

    Composite buttonArea = new Composite(tableAndButtons, SWT.NONE);
    layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    buttonArea.setLayout(layout);
    buttonArea.setLayoutData(new GridData(GridData.FILL_VERTICAL));
    editButton = new Button(buttonArea, SWT.PUSH);
    editButton.setText("Edit");
    GridData data1 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    data1.widthHint = 40;
    editButton.setLayoutData(data1);
    editButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            IStructuredSelection selection = (IStructuredSelection) configsViewer.getSelection();
            if (selection.getFirstElement() != null) {
                if (selection.getFirstElement() instanceof IIf) {
                    IfPropertiesDialog dialog = new IfPropertiesDialog(getShell(), decisionState,
                            (IIf) selection.getFirstElement(), false);
                    if (Dialog.OK == dialog.open()) {
                        configsViewer.refresh();
                    }
                }
            }
        }
    });

    item1.setControl(groupActionType);

    entryActionsComposite = new ActionComposite(this, item3, getShell(), this.entryActions,
            this.decisionStateClone.getEntryActions(), IActionElement.ACTION_TYPE.ENTRY_ACTION);
    item3.setControl(entryActionsComposite.createDialogArea(folder));

    exitActionsComposite = new ActionComposite(this, item4, getShell(), this.exitActions,
            this.decisionStateClone.getExitActions(), IActionElement.ACTION_TYPE.EXIT_ACTION);
    item4.setControl(exitActionsComposite.createDialogArea(folder));

    exceptionHandlerComposite = new ExceptionHandlerComposite(this, item5, getShell(), this.exceptionHandler,
            this.decisionStateClone);
    item5.setControl(exceptionHandlerComposite.createDialogArea(folder));

    properties = new PropertiesComposite(this, item6, getShell(), (IAttributeEnabled) this.decisionStateClone);
    item6.setControl(properties.createDialogArea(folder));

    applyDialogFont(parentComposite);

    return parentComposite;
}

From source file:org.springframework.ide.eclipse.webflow.ui.graph.dialogs.ExceptionHandlerComposite.java

License:Open Source License

protected Control createDialogArea(Composite parent) {
    Group groupActionType = new Group(parent, SWT.NULL);
    GridLayout layoutAttMap = new GridLayout();
    layoutAttMap.marginWidth = 3;/* w w  w  .  ja  v  a2s. co m*/
    layoutAttMap.marginHeight = 3;
    groupActionType.setLayout(layoutAttMap);
    groupActionType.setText(" Exception Handler ");
    groupActionType.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Composite tableAndButtons = new Composite(groupActionType, SWT.NONE);
    tableAndButtons.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    GridLayout layout2 = new GridLayout();
    layout2.marginHeight = 0;
    layout2.marginWidth = 0;
    layout2.numColumns = 2;
    tableAndButtons.setLayout(layout2);

    Table configsTable = new Table(tableAndButtons,
            SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER);
    GridData data = new GridData(GridData.FILL_BOTH);
    data.widthHint = 250;
    data.heightHint = 200;
    configsTable.setLayoutData(data);
    configsTable.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            handleTableSelectionChanged();
        }
    });
    configsViewer = new TableViewer(configsTable);
    configsViewer.setContentProvider(new ExceptionHandlerContentProvider(this.exceptionHandler));
    configsViewer.setLabelProvider(
            new DecoratingLabelProvider(new WebflowModelLabelProvider(), new WebflowModelLabelDecorator()));
    configsViewer.setInput(this);

    Composite buttonArea = new Composite(tableAndButtons, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    buttonArea.setLayout(layout);
    buttonArea.setLayoutData(new GridData(GridData.FILL_VERTICAL));

    addButton = new Button(buttonArea, SWT.PUSH);
    addButton.setText("Add");
    GridData data1 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    addButton.setLayoutData(data1);
    addButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            ExceptionHandler action = new ExceptionHandler();
            action.createNew(parentElement);
            if (DialogUtils.openPropertiesDialog(parentElement, action, true) == Dialog.OK) {
                exceptionHandler.add(action);
                configsViewer.refresh();
            }
        }
    });
    editButton = new Button(buttonArea, SWT.PUSH);
    editButton.setText("Edit");
    data1 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    editButton.setLayoutData(data1);
    editButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            IStructuredSelection selection = (IStructuredSelection) configsViewer.getSelection();
            if (selection.getFirstElement() != null) {
                if (selection.getFirstElement() instanceof ExceptionHandler) {
                    if (DialogUtils.openPropertiesDialog(parentElement,
                            (ExceptionHandler) selection.getFirstElement(), true) == Dialog.OK) {
                        configsViewer.refresh();
                    }
                }
            }
        }
    });

    deleteButton = new Button(buttonArea, SWT.PUSH);
    deleteButton.setText("Delete");
    data1 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    deleteButton.setLayoutData(data1);
    deleteButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            IStructuredSelection selection = (IStructuredSelection) configsViewer.getSelection();
            if (selection.getFirstElement() != null
                    && selection.getFirstElement() instanceof ExceptionHandler) {
                ExceptionHandler actionElement = (ExceptionHandler) selection.getFirstElement();
                exceptionHandler.remove(actionElement);
                configsViewer.refresh(true);
            }
        }
    });

    editButton.setEnabled(false);
    deleteButton.setEnabled(false);

    return groupActionType;
}

From source file:org.springframework.ide.eclipse.webflow.ui.graph.dialogs.IfPropertiesDialog.java

License:Open Source License

/**
 * //w w  w .  j av  a  2s  .c  o m
 * 
 * @param button 
 */
private void handleButtonPressed(Button button) {

    if (button.equals(browseThenButton)) {
        ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(),
                new DecoratingLabelProvider(new WebflowModelLabelProvider(), new WebflowModelLabelDecorator()));
        dialog.setBlockOnOpen(true);
        dialog.setElements(WebflowModelXmlUtils.getStates(parent, false).toArray());
        dialog.setEmptySelectionMessage("Enter a valid state id");
        dialog.setTitle("State reference");
        dialog.setMessage("Please select a state reference");
        dialog.setMultipleSelection(false);
        if (Dialog.OK == dialog.open()) {
            this.thenText.setText(((IState) dialog.getFirstResult()).getId());
        }

    } else {
        ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(),
                new DecoratingLabelProvider(new WebflowModelLabelProvider(), new WebflowModelLabelDecorator()));
        dialog.setBlockOnOpen(true);
        dialog.setElements(WebflowModelXmlUtils.getStates(parent, false).toArray());
        dialog.setEmptySelectionMessage("Enter a valid state id");
        dialog.setTitle("State reference");
        dialog.setMessage("Please select a state reference");
        dialog.setMultipleSelection(false);
        if (Dialog.OK == dialog.open()) {
            this.elseText.setText(((IState) dialog.getFirstResult()).getId());
        }
    }
    this.validateInput();

}

From source file:org.springframework.ide.eclipse.webflow.ui.graph.properties.StateTransitionSection.java

License:Open Source License

/**
 * /*from w  w  w. j av  a  2  s . c o  m*/
 */
protected void handleSelectionChanged() {
    ElementListSelectionDialog dialog = new ElementListSelectionDialog(getPart().getSite().getShell(),
            new DecoratingLabelProvider(new WebflowModelLabelProvider(), new WebflowModelLabelDecorator()));
    dialog.setBlockOnOpen(true);
    dialog.setElements(WebflowModelXmlUtils
            .getStates((IWebflowModelElement) this.stateTransition.getElementParent(), false).toArray());
    dialog.setEmptySelectionMessage("Enter a valid state id");
    dialog.setTitle("State reference");
    dialog.setMessage("Please select a state reference");
    dialog.setMultipleSelection(false);
    if (Dialog.OK == dialog.open()) {
        this.toText.setText(((IState) dialog.getFirstResult()).getId());
    }
}

From source file:org.talend.mdm.repository.ui.dialogs.lock.LockedObjectDialog.java

License:Open Source License

/**
 * Create contents of the dialog.// w  w w .java  2 s.  c om
 * 
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
    Composite container = (Composite) super.createDialogArea(parent);
    GridLayout gridLayout = (GridLayout) container.getLayout();
    gridLayout.marginHeight = 5;

    titleLabel = new Label(container, SWT.WRAP);
    GridData gd_titleLabel = new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1);
    gd_titleLabel.heightHint = 40;
    gd_titleLabel.verticalIndent = 5;
    titleLabel.setLayoutData(gd_titleLabel);
    if (mutliObjAlertMsg != null) {
        if (canContinueRestOperation()) {
            titleLabel.setText(mutliObjAlertMsg);
        } else {
            titleLabel.setText(singleObjAlertMsg);
        }
    }
    treeViewer = new TreeViewer(container, SWT.BORDER);
    Tree tree = treeViewer.getTree();
    GridData gd_tree = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
    gd_tree.verticalIndent = 5;
    tree.setLayoutData(gd_tree);
    treeViewer.setContentProvider(new TreeContentProvider());
    ILabelDecorator labelDecorator = RepositoryPlugin.getDefault().getWorkbench().getDecoratorManager()
            .getLabelDecorator();
    DecoratingLabelProvider labelProvider = new DecoratingLabelProvider(new MDMRepositoryLabelProvider(),
            labelDecorator);
    treeViewer.setLabelProvider(labelProvider);

    // init input
    treeViewer.setInput(lockedObjs);

    return container;
}

From source file:org.tigris.subversion.subclipse.ui.internal.GlobalRefreshResourceSelectionPage.java

License:Open Source License

public void createControl(Composite parent2) {
    Composite top = new Composite(parent2, SWT.NULL);
    top.setLayout(new GridLayout());
    initializeDialogUnits(top);/*from  ww w .j a  v  a2 s .  c om*/

    GridData data = new GridData(GridData.FILL_BOTH);
    data.widthHint = 50;
    top.setLayoutData(data);
    setControl(top);

    Label l = new Label(top, SWT.NULL);
    l.setText(Policy.bind("GlobalRefreshResourceSelectionPage.5")); //$NON-NLS-1$

    // The viewer
    fViewer = new ContainerCheckedTreeViewer(top, SWT.BORDER);
    data = new GridData(GridData.FILL_BOTH);
    //data.widthHint = 200;
    data.heightHint = 100;
    fViewer.getControl().setLayoutData(data);
    fViewer.setContentProvider(new MyContentProvider());
    fViewer.setLabelProvider(new DecoratingLabelProvider(new MyLabelProvider(),
            PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator()));
    fViewer.addCheckStateListener(new ICheckStateListener() {

        public void checkStateChanged(CheckStateChangedEvent event) {
            updateOKStatus();
        }
    });
    fViewer.setSorter(new ResourceSorter(ResourceSorter.NAME));
    fViewer.setInput(resources);

    Composite selectGroup = new Composite(top, SWT.NULL);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    //layout.makeColumnsEqualWidth = false;
    selectGroup.setLayout(layout);
    data = new GridData(GridData.FILL_HORIZONTAL);
    selectGroup.setLayoutData(data);

    Button selectAll = new Button(selectGroup, SWT.NULL);
    selectAll.setText(Policy.bind("GlobalRefreshResourceSelectionPage.12")); //$NON-NLS-1$
    selectAll.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            participantScope.setSelection(true);
            selectedResourcesScope.setSelection(false);
            workingSetScope.setSelection(false);
            updateParticipantScope();
            scopeCheckingElement = true;
            updateOKStatus();
            scopeCheckingElement = false;
        }
    });
    setButtonLayoutData(selectAll);

    Button deSelectAll = new Button(selectGroup, SWT.NULL);
    deSelectAll.setText(Policy.bind("GlobalRefreshResourceSelectionPage.13")); //$NON-NLS-1$
    deSelectAll.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            fViewer.setCheckedElements(new Object[0]);
            updateOKStatus();
        }
    });
    setButtonLayoutData(deSelectAll);

    // Scopes
    Group scopeGroup = new Group(top, SWT.NULL);
    scopeGroup.setText(Policy.bind("GlobalRefreshResourceSelectionPage.6")); //$NON-NLS-1$
    layout = new GridLayout();
    layout.numColumns = 3;
    layout.makeColumnsEqualWidth = false;
    scopeGroup.setLayout(layout);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = 50;
    scopeGroup.setLayoutData(data);

    participantScope = new Button(scopeGroup, SWT.RADIO);
    participantScope.setText(Policy.bind("GlobalRefreshResourceSelectionPage.7")); //$NON-NLS-1$
    participantScope.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            updateParticipantScope();
        }
    });

    selectedResourcesScope = new Button(scopeGroup, SWT.RADIO);
    selectedResourcesScope.setText(Policy.bind("GlobalRefreshResourceSelectionPage.8")); //$NON-NLS-1$
    selectedResourcesScope.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            updateSelectedResourcesScope();
        }
    });
    data = new GridData();
    data.horizontalSpan = 2;
    selectedResourcesScope.setLayoutData(data);

    workingSetScope = new Button(scopeGroup, SWT.RADIO);
    workingSetScope.setText(Policy.bind("GlobalRefreshResourceSelectionPage.10")); //$NON-NLS-1$
    workingSetScope.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            if (workingSetScope.getSelection()) {
                updateWorkingSetScope();
            }
        }
    });

    workingSetLabel = new Text(scopeGroup, SWT.BORDER);
    workingSetLabel.setEditable(false);
    data = new GridData(GridData.FILL_HORIZONTAL);
    workingSetLabel.setLayoutData(data);

    Button selectWorkingSetButton = new Button(scopeGroup, SWT.NULL);
    selectWorkingSetButton.setText(Policy.bind("GlobalRefreshResourceSelectionPage.11")); //$NON-NLS-1$
    selectWorkingSetButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            selectWorkingSetAction();
        }
    });
    data = new GridData(GridData.HORIZONTAL_ALIGN_END);
    selectWorkingSetButton.setLayoutData(data);
    Dialog.applyDialogFont(selectWorkingSetButton);

    initializeScopingHint();
    Dialog.applyDialogFont(top);
}

From source file:org.tigris.subversion.subclipse.ui.repository.RepositoriesView.java

License:Open Source License

public void createPartControl(Composite parent) {
    treeViewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
    contentProvider = new RemoteContentProvider();
    treeViewer.setContentProvider(contentProvider);
    final RepositoriesViewDecorator decorator = new RepositoriesViewDecorator();
    DecoratingLabelProvider labelProvider = new DecoratingLabelProvider(new WorkbenchLabelProvider(),
            new ILabelDecorator() {
                public Image decorateImage(Image image, Object obj) {
                    if (obj instanceof RemoteFile) {
                        RemoteFile remoteFile = (RemoteFile) obj;
                        if (remoteFile.getLock() != null) {
                            return decorator.getImage(image);
                        }//from   w  w w  .ja va2 s  .co  m
                    }
                    return null;
                }

                public String decorateText(String text, Object obj) {
                    return null;
                }

                public void addListener(ILabelProviderListener listener) {
                }

                public void dispose() {
                }

                public boolean isLabelProperty(Object obj, String prop) {
                    return false;
                }

                public void removeListener(ILabelProviderListener listener) {
                }
            });
    treeViewer.setLabelProvider(labelProvider);

    getSite().setSelectionProvider(treeViewer);
    root = new AllRootsElement();
    treeViewer.setInput(root);
    treeViewer.setSorter(new RepositorySorter());
    drillPart = new DrillDownAdapter(treeViewer);

    contributeActions();

    // F1 Help
    String helpID = getHelpContextId();
    if (helpID != null)
        PlatformUI.getWorkbench().getHelpSystem().setHelp(treeViewer.getControl(), helpID);
    initializeListeners();
    SVNUIPlugin.getPlugin().getRepositoryManager().addRepositoryListener(repositoryListener);
}

From source file:org.tigris.subversion.subclipse.ui.wizards.SVNWizardPage.java

License:Open Source License

protected TreeViewer createResourceSelectionTree(Composite composite, int types, int span) {
    TreeViewer tree = new TreeViewer(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    tree.setUseHashlookup(true);//from  w w w. j a  va2s  .  c o m
    tree.setContentProvider(getResourceProvider(types));
    tree.setLabelProvider(new DecoratingLabelProvider(new WorkbenchLabelProvider(),
            SVNUIPlugin.getPlugin().getWorkbench().getDecoratorManager().getLabelDecorator()));
    tree.setSorter(new ResourceSorter(ResourceSorter.NAME));

    GridData data = new GridData(GridData.FILL_BOTH | GridData.GRAB_VERTICAL);
    data.heightHint = LIST_HEIGHT_HINT;
    data.horizontalSpan = span;
    tree.getControl().setLayoutData(data);
    return tree;
}