Search in sources :

Example 46 with ImageHyperlink

use of org.eclipse.ui.forms.widgets.ImageHyperlink in project netxms by netxms.

the class LogParserEditor method createMacroSection.

/**
 * @param macroArea
 */
private void createMacroSection(Composite macroArea) {
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    macroArea.setLayout(layout);
    macroList = new TableViewer(macroArea, SWT.BORDER);
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.verticalAlignment = SWT.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.grabExcessVerticalSpace = true;
    gd.verticalSpan = 3;
    final Table table = macroList.getTable();
    table.setLayoutData(gd);
    TableColumn tc = new TableColumn(table, SWT.LEFT);
    tc.setText(Messages.get().LogParserEditor_Name);
    tc.setWidth(100);
    tc = new TableColumn(table, SWT.LEFT);
    tc.setText(Messages.get().LogParserEditor_Value);
    tc.setWidth(200);
    macroList.setContentProvider(new ArrayContentProvider());
    ImageHyperlink link = toolkit.createImageHyperlink(macroArea, SWT.NONE);
    link.setImage(SharedIcons.IMG_ADD_OBJECT);
    link.setText(Messages.get().LogParserEditor_Add);
    gd = new GridData();
    gd.verticalAlignment = SWT.TOP;
    link.setLayoutData(gd);
    link.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        public void linkActivated(HyperlinkEvent e) {
            addMacro();
        }
    });
    link = toolkit.createImageHyperlink(macroArea, SWT.NONE);
    link.setImage(SharedIcons.IMG_EDIT);
    link.setText(Messages.get().LogParserEditor_Edit);
    gd = new GridData();
    gd.verticalAlignment = SWT.TOP;
    link.setLayoutData(gd);
    link.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        public void linkActivated(HyperlinkEvent e) {
            editMacro();
        }
    });
    link = toolkit.createImageHyperlink(macroArea, SWT.NONE);
    link.setImage(SharedIcons.IMG_DELETE_OBJECT);
    link.setText(Messages.get().LogParserEditor_Delete);
    gd = new GridData();
    gd.verticalAlignment = SWT.TOP;
    link.setLayoutData(gd);
    link.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        public void linkActivated(HyperlinkEvent e) {
            deleteMacro();
        }
    });
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Table(org.eclipse.swt.widgets.Table) HyperlinkEvent(org.eclipse.ui.forms.events.HyperlinkEvent) ImageHyperlink(org.eclipse.ui.forms.widgets.ImageHyperlink) GridData(org.eclipse.swt.layout.GridData) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) TableViewer(org.eclipse.jface.viewers.TableViewer) TableColumn(org.eclipse.swt.widgets.TableColumn) HyperlinkAdapter(org.eclipse.ui.forms.events.HyperlinkAdapter)

Example 47 with ImageHyperlink

use of org.eclipse.ui.forms.widgets.ImageHyperlink in project tdq-studio-se by Talend.

the class BusinessRuleAnalysisDetailsPage method createAnalysisTablesSection.

void createAnalysisTablesSection(final ScrolledForm form1, Composite anasisDataComp) {
    analysisTableSection = createSection(form1, anasisDataComp, DefaultMessagesImpl.getString("TableMasterDetailsPage.analyzeTable"), // $NON-NLS-1$
    null);
    Composite topComp1 = toolkit.createComposite(analysisTableSection);
    topComp1.setLayout(new GridLayout());
    // ~ MOD mzhao 2009-05-05,Bug 6587.
    createConnBindWidget(topComp1);
    // ~
    Composite actionBarComp = toolkit.createComposite(topComp1);
    GridLayout gdLayout = new GridLayout();
    gdLayout.numColumns = 3;
    actionBarComp.setLayout(gdLayout);
    ImageHyperlink collapseAllImageLink = toolkit.createImageHyperlink(actionBarComp, SWT.NONE);
    // $NON-NLS-1$
    collapseAllImageLink.setToolTipText(DefaultMessagesImpl.getString("TableMasterDetailsPage.collapseAllTables"));
    WorkbenchUtils.setHyperlinkImage(collapseAllImageLink, ImageLib.getImage(ImageLib.COLLAPSE_ALL));
    collapseAllImageLink.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        public void linkActivated(HyperlinkEvent e) {
            TreeItem[] items = treeViewer.getTree().getItems();
            expandTreeItems(items, false);
            packOtherColumns();
        }
    });
    ImageHyperlink expandAllImageLink = toolkit.createImageHyperlink(actionBarComp, SWT.NONE);
    // $NON-NLS-1$
    expandAllImageLink.setToolTipText(DefaultMessagesImpl.getString("TableMasterDetailsPage.expandAllTables"));
    WorkbenchUtils.setHyperlinkImage(expandAllImageLink, ImageLib.getImage(ImageLib.EXPAND_ALL));
    expandAllImageLink.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        public void linkActivated(HyperlinkEvent e) {
            TreeItem[] items = treeViewer.getTree().getItems();
            expandTreeItems(items, true);
            packOtherColumns();
        }
    });
    Button clmnBtn = // $NON-NLS-1$
    toolkit.createButton(// $NON-NLS-1$
    actionBarComp, // $NON-NLS-1$
    DefaultMessagesImpl.getString("TableMasterDetailsPage.selectTable"), SWT.NONE);
    clmnBtn.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseDown(MouseEvent e) {
            openTableSelectionDialog();
        }
    });
    Composite treeComp = toolkit.createComposite(topComp1, SWT.NONE);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(treeComp);
    treeComp.setLayout(new GridLayout());
    ((GridData) treeComp.getLayoutData()).heightHint = TREE_MAX_LENGTH;
    treeComp.setBackgroundMode(SWT.INHERIT_DEFAULT);
    treeViewer = new AnalysisTableTreeViewer(treeComp, this);
    treeViewer.setDirty(false);
    treeViewer.addPropertyChangeListener(this);
    analysisTableSection.setClient(topComp1);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) AnalysisTableTreeViewer(org.talend.dataprofiler.core.ui.editor.composite.AnalysisTableTreeViewer) HyperlinkEvent(org.eclipse.ui.forms.events.HyperlinkEvent) MouseEvent(org.eclipse.swt.events.MouseEvent) Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) ImageHyperlink(org.eclipse.ui.forms.widgets.ImageHyperlink) Button(org.eclipse.swt.widgets.Button) MouseAdapter(org.eclipse.swt.events.MouseAdapter) HyperlinkAdapter(org.eclipse.ui.forms.events.HyperlinkAdapter)

Example 48 with ImageHyperlink

use of org.eclipse.ui.forms.widgets.ImageHyperlink in project tdq-studio-se by Talend.

the class ColumnAnalysisResultPage method createCollapseAllLink.

/**
 * create CollapseAll Link for result section.
 *
 * @param composite
 */
private void createCollapseAllLink(Composite composite) {
    ImageHyperlink collapseAllImageLink = toolkit.createImageHyperlink(composite, SWT.NONE);
    // $NON-NLS-1$
    collapseAllImageLink.setToolTipText(DefaultMessagesImpl.getString("CollapseAllColumns"));
    WorkbenchUtils.setHyperlinkImage(collapseAllImageLink, ImageLib.getImage(ImageLib.COLLAPSE_ALL));
    collapseAllImageLink.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        public void linkActivated(HyperlinkEvent e) {
            List<ExpandableComposite> expandableCompositeList = getExpandableCompositeList();
            if (expandableCompositeList != null && !expandableCompositeList.isEmpty()) {
                for (ExpandableComposite comp : expandableCompositeList) {
                    comp.setExpanded(false);
                    comp.getParent().pack();
                }
            }
            form.reflow(true);
        }
    });
}
Also used : HyperlinkEvent(org.eclipse.ui.forms.events.HyperlinkEvent) ImageHyperlink(org.eclipse.ui.forms.widgets.ImageHyperlink) ArrayList(java.util.ArrayList) List(java.util.List) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) HyperlinkAdapter(org.eclipse.ui.forms.events.HyperlinkAdapter)

Example 49 with ImageHyperlink

use of org.eclipse.ui.forms.widgets.ImageHyperlink in project tdq-studio-se by Talend.

the class DynamicAnalysisMasterPage method createExpandAllLink.

private void createExpandAllLink(Composite actionBarComp) {
    ImageHyperlink expandAllImageLink = toolkit.createImageHyperlink(actionBarComp, SWT.NONE);
    expandAllImageLink.setToolTipText(getExpandString());
    WorkbenchUtils.setHyperlinkImage(expandAllImageLink, ImageLib.getImage(ImageLib.EXPAND_ALL));
    expandAllImageLink.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        public void linkActivated(HyperlinkEvent e) {
            List<ExpandableComposite> previewChartList = getPreviewChartList();
            if (previewChartList != null && !previewChartList.isEmpty()) {
                for (ExpandableComposite comp : previewChartList) {
                    comp.setExpanded(true);
                    comp.getParent().pack();
                }
            }
            if (getChartComposite() != null) {
                getChartComposite().getParent().pack();
            }
        }
    });
}
Also used : HyperlinkEvent(org.eclipse.ui.forms.events.HyperlinkEvent) ImageHyperlink(org.eclipse.ui.forms.widgets.ImageHyperlink) List(java.util.List) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) HyperlinkAdapter(org.eclipse.ui.forms.events.HyperlinkAdapter)

Example 50 with ImageHyperlink

use of org.eclipse.ui.forms.widgets.ImageHyperlink in project egit by eclipse.

the class ReflogView method updateRefLink.

private void updateRefLink(final String name) {
    IToolBarManager toolbar = form.getToolBarManager();
    toolbar.removeAll();
    ControlContribution refLabelControl = new ControlContribution(// $NON-NLS-1$
    "refLabel") {

        @Override
        protected Control createControl(Composite cParent) {
            Composite composite = toolkit.createComposite(cParent);
            composite.setLayout(new RowLayout());
            composite.setBackground(null);
            final ImageHyperlink refLink = new ImageHyperlink(composite, SWT.NONE);
            Image image = UIIcons.BRANCH.createImage();
            UIUtils.hookDisposal(refLink, image);
            refLink.setImage(image);
            refLink.setFont(JFaceResources.getBannerFont());
            refLink.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
            refLink.addHyperlinkListener(new HyperlinkAdapter() {

                @Override
                public void linkActivated(HyperlinkEvent event) {
                    Repository repository = getRepository();
                    if (repository == null)
                        return;
                    RefSelectionDialog dialog = new RefSelectionDialog(refLink.getShell(), repository);
                    if (Window.OK == dialog.open())
                        showReflogFor(repository, dialog.getRefName());
                }
            });
            refLink.setText(Repository.shortenRefName(name));
            return composite;
        }
    };
    toolbar.add(refLabelControl);
    toolbar.update(true);
}
Also used : Repository(org.eclipse.jgit.lib.Repository) HyperlinkEvent(org.eclipse.ui.forms.events.HyperlinkEvent) Composite(org.eclipse.swt.widgets.Composite) ImageHyperlink(org.eclipse.ui.forms.widgets.ImageHyperlink) IToolBarManager(org.eclipse.jface.action.IToolBarManager) RowLayout(org.eclipse.swt.layout.RowLayout) ControlContribution(org.eclipse.jface.action.ControlContribution) Image(org.eclipse.swt.graphics.Image) HyperlinkAdapter(org.eclipse.ui.forms.events.HyperlinkAdapter)

Aggregations

ImageHyperlink (org.eclipse.ui.forms.widgets.ImageHyperlink)50 HyperlinkEvent (org.eclipse.ui.forms.events.HyperlinkEvent)46 HyperlinkAdapter (org.eclipse.ui.forms.events.HyperlinkAdapter)45 GridLayout (org.eclipse.swt.layout.GridLayout)37 Composite (org.eclipse.swt.widgets.Composite)35 GridData (org.eclipse.swt.layout.GridData)34 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)19 TableViewer (org.eclipse.jface.viewers.TableViewer)17 Section (org.eclipse.ui.forms.widgets.Section)16 TableWrapData (org.eclipse.ui.forms.widgets.TableWrapData)16 ExpandableComposite (org.eclipse.ui.forms.widgets.ExpandableComposite)8 CLabel (org.eclipse.swt.custom.CLabel)7 List (java.util.List)5 Image (org.eclipse.swt.graphics.Image)5 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)4 Control (org.eclipse.swt.widgets.Control)4 Label (org.eclipse.swt.widgets.Label)4 ArrayList (java.util.ArrayList)3 ILabelProvider (org.eclipse.jface.viewers.ILabelProvider)3 DisposeEvent (org.eclipse.swt.events.DisposeEvent)3