Search in sources :

Example 11 with PageBook

use of org.eclipse.ui.part.PageBook in project jbosstools-openshift by jbosstools.

the class OpenShiftExplorerView method createPartControl.

@Override
public void createPartControl(Composite parent) {
    FormToolkit toolkit = new FormToolkit(parent.getDisplay());
    this.pageBook = new PageBook(parent, SWT.NONE);
    super.createPartControl(pageBook);
    this.connectionsPane = getCommonViewer().getControl();
    this.explanationsPane = createExplanationPane(connectionsPane, pageBook, toolkit);
    showConnectionsOrExplanations(connectionsPane, explanationsPane);
    ConnectionsRegistrySingleton.getInstance().addListener(this);
    getCommonViewer().refresh();
}
Also used : FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) PageBook(org.eclipse.ui.part.PageBook)

Example 12 with PageBook

use of org.eclipse.ui.part.PageBook in project eclipse-integration-commons by spring-projects.

the class DashboardMainPage method createFeedsSection.

private void createFeedsSection(Composite parent, final String title, FeedType feedType, String feedName) {
    final Section section = new Section(parent, ExpandableComposite.TITLE_BAR) {

        @Override
        public void redraw() {
            GridData compositeData = (GridData) feedsScrolled.getLayoutData();
            compositeData.widthHint = getSize().x - 35;
            compositeData.heightHint = getSize().y - 40;
            compositeData.grabExcessHorizontalSpace = false;
            compositeData.grabExcessVerticalSpace = false;
            super.redraw();
        }
    };
    form.addControlListener(new ControlAdapter() {

        @Override
        public void controlResized(ControlEvent e) {
            GridData data = (GridData) section.getLayoutData();
            data.heightHint = form.getSize().y - FEEDS_TEXT_WRAP_INDENT;
        }
    });
    toolkit.adapt(section);
    section.setTitleBarForeground(toolkit.getColors().getColor(IFormColors.TB_TOGGLE));
    section.setTitleBarBackground(toolkit.getColors().getColor(IFormColors.TB_BG));
    section.setTitleBarBorderColor(toolkit.getColors().getColor(IFormColors.TB_BORDER));
    section.setFont(FormFonts.getInstance().getBoldFont(getSite().getShell().getDisplay(), section.getFont()));
    section.setText(title);
    section.setLayout(new GridLayout());
    GridDataFactory.fillDefaults().grab(true, true).hint(300, 300).applyTo(section);
    final Composite headerComposite = toolkit.createComposite(section, SWT.NONE);
    RowLayout rowLayout = new RowLayout();
    rowLayout.marginTop = 0;
    rowLayout.marginBottom = 0;
    headerComposite.setLayout(rowLayout);
    headerComposite.setBackground(null);
    ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
    toolBarManager.createControl(headerComposite);
    final PageBook pagebook = new PageBook(section, SWT.NONE);
    toolkit.adapt(pagebook);
    pagebook.setLayoutData(new GridLayout());
    final Composite disclaimer = createDisclaimer(pagebook);
    feedsScrolled = new ScrolledComposite(pagebook, SWT.V_SCROLL);
    feedsScrolled.setExpandVertical(false);
    feedsScrolled.setLayout(new GridLayout());
    feedsScrolled.setAlwaysShowScrollBars(false);
    GridDataFactory.fillDefaults().grab(true, false).applyTo(feedsScrolled);
    toolkit.adapt(feedsScrolled);
    feedsComposite = toolkit.createComposite(feedsScrolled);
    feedsComposite.setLayout(new TableWrapLayout());
    GridDataFactory.fillDefaults().grab(true, false).applyTo(feedsComposite);
    feedsScrolled.setContent(feedsComposite);
    feedsComposite.addPaintListener(new PaintListener() {

        public void paintControl(PaintEvent e) {
            GridData data = (GridData) feedsComposite.getLayoutData();
            data.widthHint = section.getSize().x - FEEDS_TEXT_WRAP_INDENT;
            data.heightHint = form.getSize().y - 50;
        }
    });
    section.addControlListener(new ControlAdapter() {

        @Override
        public void controlResized(ControlEvent e) {
            GridData data = (GridData) feedsScrolled.getLayoutData();
            data.heightHint = form.getSize().y - 50;
            data.grabExcessVerticalSpace = false;
            feedsScrolled.setSize(section.getSize().x - 40, form.getSize().y - 50);
            for (Control feedControl : feedControls) {
                if (!feedControl.isDisposed()) {
                    ((TableWrapData) feedControl.getLayoutData()).maxWidth = section.getSize().x - FEEDS_TEXT_WRAP_INDENT;
                // Point size = feedControl.computeSize(data.widthHint,
                // 400);
                // feedControl.setSize(size);
                // feedControl.pack(true);
                }
            }
            feedsComposite.pack();
        }
    });
    feedControls = new HashSet<Control>();
    final Map<String, String> springMap = new HashMap<String, String>();
    String[] urls = ResourceProvider.getUrls(RESOURCE_DASHBOARD_FEEDS_BLOGS);
    for (String url : urls) {
        springMap.put(url, null);
    }
    getEditorSite().getShell().getDisplay().asyncExec(new Runnable() {

        public void run() {
            FeedsReader reader = new FeedsReader();
            CachedFeedsManager manager = new CachedFeedsManager(title, springMap, reader);
            try {
                manager.readCachedFeeds(null);
                Set<SyndEntry> entries = new HashSet<SyndEntry>();
                for (SyndFeed entry : reader.getFeeds()) {
                    entries.addAll(entry.getEntries());
                }
                if (!getManagedForm().getForm().isDisposed()) {
                    displayFeeds(entries, feedsComposite, feedsScrolled, pagebook, disclaimer, section);
                }
            } catch (IllegalArgumentException e) {
                StatusHandler.log(new Status(IStatus.ERROR, IdeUiPlugin.PLUGIN_ID, "An unexpected error occurred while retrieving feed content from cache.", e));
            } catch (FeedException e) {
                StatusHandler.log(new Status(IStatus.ERROR, IdeUiPlugin.PLUGIN_ID, "An unexpected error occurred while retrieving feed content from cache.", e));
            }
        }
    });
    refreshFeedsAction = new Action("Refresh Feeds", CommonImages.REFRESH) {

        @Override
        public void run() {
            Map<String, String> springMap = getFeedsMap();
            displayFeeds(feedsComposite, feedsScrolled, pagebook, disclaimer, springMap, title, section);
        }
    };
    Action configureURLsAction = new Action("Configure URLs", StsUiImages.RSS_CONFIGURE) {

        @Override
        public void run() {
            PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(getSite().getShell(), URL_CONFIGURATION_ID, new String[] { URL_CONFIGURATION_ID }, null);
            dialog.open();
        }
    };
    section.setClient(pagebook);
    section.setTextClient(headerComposite);
    toolBarManager.add(configureURLsAction);
    toolBarManager.add(refreshFeedsAction);
    toolBarManager.update(true);
    refreshFeedsAction.run();
}
Also used : NewWizardAction(org.eclipse.ui.actions.NewWizardAction) Action(org.eclipse.jface.action.Action) Set(java.util.Set) CopyOnWriteArraySet(java.util.concurrent.CopyOnWriteArraySet) HashSet(java.util.HashSet) ControlAdapter(org.eclipse.swt.events.ControlAdapter) HashMap(java.util.HashMap) IToolBarManager(org.eclipse.jface.action.IToolBarManager) ToolBarManager(org.eclipse.jface.action.ToolBarManager) TableWrapData(org.eclipse.ui.forms.widgets.TableWrapData) SyndFeed(com.sun.syndication.feed.synd.SyndFeed) GridLayout(org.eclipse.swt.layout.GridLayout) TextSearchControl(org.eclipse.mylyn.commons.workbench.search.TextSearchControl) Control(org.eclipse.swt.widgets.Control) PreferenceDialog(org.eclipse.jface.preference.PreferenceDialog) RowLayout(org.eclipse.swt.layout.RowLayout) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) Status(org.eclipse.core.runtime.Status) IStatus(org.eclipse.core.runtime.IStatus) PaintEvent(org.eclipse.swt.events.PaintEvent) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) PaintListener(org.eclipse.swt.events.PaintListener) SyndEntry(com.sun.syndication.feed.synd.SyndEntry) FeedException(com.sun.syndication.io.FeedException) Section(org.eclipse.ui.forms.widgets.Section) PageBook(org.eclipse.ui.part.PageBook) TableWrapLayout(org.eclipse.ui.forms.widgets.TableWrapLayout) GridData(org.eclipse.swt.layout.GridData) ControlEvent(org.eclipse.swt.events.ControlEvent) Map(java.util.Map) HashMap(java.util.HashMap)

Example 13 with PageBook

use of org.eclipse.ui.part.PageBook in project eclipse-integration-commons by spring-projects.

the class DashboardMainPage method createUpdateSection.

private void createUpdateSection(final Composite parent) {
    updateSection = new Section(parent, ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE) {

        @Override
        public void redraw() {
            if (getStoredExpandedState(IIdeUiConstants.PREF_UPDATE_SECTION_COLLAPSE, true)) {
                GridData compositeData = (GridData) updateScrolled.getLayoutData();
                compositeData.widthHint = getSize().x - 55;
                compositeData.heightHint = getSize().y - 40;
                compositeData.grabExcessHorizontalSpace = false;
                compositeData.grabExcessVerticalSpace = false;
            }
            super.redraw();
        }
    };
    // updateSection = toolkit.createSection(parent,
    // ExpandableComposite.TITLE_BAR);
    toolkit.adapt(updateSection);
    updateSection.setTitleBarForeground(toolkit.getColors().getColor(IFormColors.TB_TOGGLE));
    updateSection.setTitleBarBackground(toolkit.getColors().getColor(IFormColors.TB_BG));
    updateSection.setTitleBarBorderColor(toolkit.getColors().getColor(IFormColors.TB_BORDER));
    updateSection.setFont(FormFonts.getInstance().getBoldFont(getSite().getShell().getDisplay(), updateSection.getFont()));
    updateSection.setText("Updates");
    updateSection.setLayout(new GridLayout());
    GridDataFactory.fillDefaults().grab(true, getStoredExpandedState(IIdeUiConstants.PREF_UPDATE_SECTION_COLLAPSE, true)).applyTo(updateSection);
    setUpExpandableSection(updateSection, IIdeUiConstants.PREF_UPDATE_SECTION_COLLAPSE, true);
    final Composite headerComposite = toolkit.createComposite(updateSection, SWT.NONE);
    RowLayout rowLayout = new RowLayout();
    rowLayout.marginTop = 0;
    rowLayout.marginBottom = 0;
    headerComposite.setLayout(rowLayout);
    headerComposite.setBackground(null);
    ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
    toolBarManager.createControl(headerComposite);
    updateSection.setTextClient(headerComposite);
    final PageBook pagebook = new PageBook(updateSection, SWT.NONE);
    toolkit.adapt(pagebook);
    GridDataFactory.fillDefaults().grab(true, true).applyTo(pagebook);
    final Composite disclaimer = createDisclaimer(pagebook);
    updateScrolled = new ScrolledComposite(pagebook, SWT.V_SCROLL);
    updateScrolled.setExpandVertical(false);
    updateScrolled.setLayout(new GridLayout());
    updateScrolled.setAlwaysShowScrollBars(false);
    GridDataFactory.fillDefaults().grab(true, false).applyTo(updateScrolled);
    toolkit.adapt(updateScrolled);
    final Composite composite = toolkit.createComposite(updateScrolled);
    updateScrolled.setContent(composite);
    composite.setLayout(new TableWrapLayout());
    GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);
    displayUpdates(composite, pagebook, disclaimer);
    refreshUpdatesAction = new Action("Refresh Updates", CommonImages.REFRESH) {

        @Override
        public void run() {
            displayUpdates(composite, pagebook, disclaimer);
        }
    };
    toolBarManager.add(refreshUpdatesAction);
    toolBarManager.update(true);
    pagebook.showPage(composite);
    updateSection.addControlListener(new ControlAdapter() {

        @Override
        public void controlResized(ControlEvent e) {
            if (updateSection.isExpanded()) {
                GridData data = (GridData) updateScrolled.getLayoutData();
                data.grabExcessVerticalSpace = false;
                updateScrolled.setSize(updateSection.getSize().x - 14, updateSection.getSize().y - 33);
                for (Control child : composite.getChildren()) {
                    ((TableWrapData) child.getLayoutData()).maxWidth = updateSection.getSize().x - UPDATE_TEXT_WRAP_INDENT;
                }
                composite.pack();
            }
        }
    });
    updateSection.setClient(pagebook);
}
Also used : NewWizardAction(org.eclipse.ui.actions.NewWizardAction) Action(org.eclipse.jface.action.Action) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) ControlAdapter(org.eclipse.swt.events.ControlAdapter) Section(org.eclipse.ui.forms.widgets.Section) IToolBarManager(org.eclipse.jface.action.IToolBarManager) ToolBarManager(org.eclipse.jface.action.ToolBarManager) TableWrapData(org.eclipse.ui.forms.widgets.TableWrapData) GridLayout(org.eclipse.swt.layout.GridLayout) TextSearchControl(org.eclipse.mylyn.commons.workbench.search.TextSearchControl) Control(org.eclipse.swt.widgets.Control) PageBook(org.eclipse.ui.part.PageBook) TableWrapLayout(org.eclipse.ui.forms.widgets.TableWrapLayout) RowLayout(org.eclipse.swt.layout.RowLayout) GridData(org.eclipse.swt.layout.GridData) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) ControlEvent(org.eclipse.swt.events.ControlEvent)

Example 14 with PageBook

use of org.eclipse.ui.part.PageBook in project webtools.sourceediting by eclipse.

the class NewEntitySection method createControls.

/**
 * @see org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite,
 *      org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory)
 */
public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory) {
    super.createControls(parent, factory);
    Composite composite = getWidgetFactory().createFlatFormComposite(parent);
    createEntityCommonComposite(composite);
    pageBook = new PageBook(composite, SWT.FLAT);
    FormData data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.right = new FormAttachment(100, 0);
    data.top = new FormAttachment(entityCommonComposite, 0);
    data.bottom = new FormAttachment(100, 0);
    pageBook.setLayoutData(data);
    createExternalEntityComposite(pageBook);
    createInternalEntityComposite(pageBook);
    pageBook.showPage(externalEntityComposite);
}
Also used : FormData(org.eclipse.swt.layout.FormData) Composite(org.eclipse.swt.widgets.Composite) PageBook(org.eclipse.ui.part.PageBook) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 15 with PageBook

use of org.eclipse.ui.part.PageBook in project tdi-studio-se by Talend.

the class TimelineSection method createControls.

/*
     * @see AbstractJvmPropertySection#createControls(Composite)
     */
@Override
protected void createControls(Composite parent) {
    timelinePageBook = new PageBook(parent, SWT.NONE);
    chartsPage = new Composite(timelinePageBook, SWT.NONE);
    messagePage = createMessagePage();
    parent.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    GridLayout layout = new GridLayout(2, true);
    layout.horizontalSpacing = 15;
    chartsPage.setLayout(layout);
    timelinePageBook.showPage(chartsPage);
    mBeanServerChangeListener = new IMBeanServerChangeListener() {

        @Override
        public void serverChanged(MBeanServerEvent event) {
            new RefreshJob(Messages.reconstructChartJobLabel, toString()) {

                @Override
                protected void refreshUI() {
                    IActiveJvm jvm = getJvm();
                    if (jvm != null) {
                        reconstructCharts(jvm, false);
                    }
                }
            }.schedule();
        }
    };
    PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IHelpContextIds.TIMELINE_PAGE);
}
Also used : RefreshJob(org.talend.designer.runtime.visualization.internal.ui.RefreshJob) IActiveJvm(org.talend.designer.runtime.visualization.IActiveJvm) GridLayout(org.eclipse.swt.layout.GridLayout) PageBook(org.eclipse.ui.part.PageBook) Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) IMBeanServerChangeListener(org.talend.designer.runtime.visualization.MBean.IMBeanServerChangeListener) MBeanServerEvent(org.talend.designer.runtime.visualization.MBean.MBeanServerEvent)

Aggregations

PageBook (org.eclipse.ui.part.PageBook)26 GridData (org.eclipse.swt.layout.GridData)12 Composite (org.eclipse.swt.widgets.Composite)10 GridLayout (org.eclipse.swt.layout.GridLayout)6 Label (org.eclipse.swt.widgets.Label)5 FormToolkit (org.eclipse.ui.forms.widgets.FormToolkit)4 IToolBarManager (org.eclipse.jface.action.IToolBarManager)3 FillLayout (org.eclipse.swt.layout.FillLayout)3 Control (org.eclipse.swt.widgets.Control)3 ExpandableComposite (org.eclipse.ui.forms.widgets.ExpandableComposite)3 Action (org.eclipse.jface.action.Action)2 IMenuManager (org.eclipse.jface.action.IMenuManager)2 MenuManager (org.eclipse.jface.action.MenuManager)2 ToolBarManager (org.eclipse.jface.action.ToolBarManager)2 TextSearchControl (org.eclipse.mylyn.commons.workbench.search.TextSearchControl)2 CLabel (org.eclipse.swt.custom.CLabel)2 SashForm (org.eclipse.swt.custom.SashForm)2 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)2 ControlAdapter (org.eclipse.swt.events.ControlAdapter)2 ControlEvent (org.eclipse.swt.events.ControlEvent)2