Search in sources :

Example 1 with AbstractDashboardPart

use of org.springsource.ide.eclipse.dashboard.ui.AbstractDashboardPart in project eclipse-integration-commons by spring-projects.

the class DashboardMainPage method setUpExpandableSection.

private void setUpExpandableSection(final Section section, final String prefId, boolean defaultExpanded) {
    section.setExpanded(getStoredExpandedState(prefId, defaultExpanded));
    section.addExpansionListener(new ExpansionAdapter() {

        @Override
        public void expansionStateChanged(ExpansionEvent e) {
            if (e.getState()) {
                prefStore.setValue(prefId, IIdeUiConstants.SECTION_EXPANDED);
            } else {
                prefStore.setValue(prefId, IIdeUiConstants.SECTION_COLLAPSED);
            }
            if (isContributedSection(section)) {
                // If we're expanding a contributed section, close the
                // update section...
                updateSection.setExpanded(false);
                prefStore.setValue(IIdeUiConstants.PREF_UPDATE_SECTION_COLLAPSE, IIdeUiConstants.SECTION_COLLAPSED);
            }
            // interest
            for (AbstractDashboardPart part : parts) {
                if (!section.equals(part.getControl()) && part.getControl() instanceof Section) {
                    ((Section) part.getControl()).setExpanded(false);
                    prefStore.setValue(getExpansionPropertyId(part), IIdeUiConstants.SECTION_COLLAPSED);
                }
            }
            adjustCollapsableSections();
        }
    });
}
Also used : AbstractDashboardPart(org.springsource.ide.eclipse.dashboard.ui.AbstractDashboardPart) ExpansionAdapter(org.eclipse.ui.forms.events.ExpansionAdapter) ExpansionEvent(org.eclipse.ui.forms.events.ExpansionEvent) Section(org.eclipse.ui.forms.widgets.Section)

Example 2 with AbstractDashboardPart

use of org.springsource.ide.eclipse.dashboard.ui.AbstractDashboardPart in project eclipse-integration-commons by spring-projects.

the class DashboardMainPage method createFormContent.

@Override
protected void createFormContent(IManagedForm managedForm) {
    toolkit = managedForm.getToolkit();
    form = managedForm.getForm();
    unfinishedJobs = new CopyOnWriteArraySet<AggregateFeedJob>();
    // get dark gray color as FormText display it lighter as other widgets
    feedColor = new Color(Display.getDefault(), 70, 70, 70);
    // getHeaderForm().setText(null);// "SpringSource Tool Suite");
    toolkit.decorateFormHeading(form.getForm());
    prefStore = IdeUiPlugin.getDefault().getPreferenceStore();
    GridLayout compositeLayout = new GridLayout(2, true);
    compositeLayout.marginHeight = 0;
    compositeLayout.marginTop = 5;
    compositeLayout.verticalSpacing = 0;
    Composite body = form.getBody();
    body.setLayout(compositeLayout);
    Composite leftComposite = toolkit.createComposite(body);
    leftComposite.setLayout(new GridLayout());
    GridDataFactory.fillDefaults().grab(true, true).applyTo(leftComposite);
    Composite rightComposite = toolkit.createComposite(body);
    rightComposite.setLayout(new GridLayout());
    GridDataFactory.fillDefaults().grab(true, true).applyTo(rightComposite);
    createHeader();
    createNewProjectsSection(leftComposite);
    createUpdateSection(leftComposite);
    parts = contributeParts(leftComposite, AbstractDashboardPart.ID_PATH_DOC);
    for (AbstractDashboardPart part : parts) {
        if (part.getControl() instanceof Section) {
            String expansionProp = getExpansionPropertyId(part);
            Section section = (Section) part.getControl();
            GridDataFactory.fillDefaults().grab(false, getStoredExpandedState(expansionProp, false)).applyTo(section);
            setUpExpandableSection(section, expansionProp, false);
        }
    }
    createHelpSection(leftComposite);
    createFeedsSection(rightComposite, "Feeds", FeedType.BLOG, "blog");
    searchBox.setFocus();
    ResourceProvider.getInstance().addPropertyChangeListener(this);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) Color(org.eclipse.swt.graphics.Color) AbstractDashboardPart(org.springsource.ide.eclipse.dashboard.ui.AbstractDashboardPart) Section(org.eclipse.ui.forms.widgets.Section)

Example 3 with AbstractDashboardPart

use of org.springsource.ide.eclipse.dashboard.ui.AbstractDashboardPart in project eclipse-integration-commons by spring-projects.

the class DashboardMainPage method adjustCollapsableSections.

private void adjustCollapsableSections() {
    GridDataFactory.fillDefaults().grab(true, updateSection.isExpanded()).applyTo(updateSection);
    for (AbstractDashboardPart part : parts) {
        if (part.getControl() instanceof Section) {
            Section section = (Section) part.getControl();
            GridDataFactory.fillDefaults().grab(true, section.isExpanded()).applyTo(section);
        }
    }
    GridDataFactory.fillDefaults().grab(true, !updateSection.isExpanded() && areAllContributedSectionsCollapsed() && helpSection.isExpanded()).applyTo(helpSection);
    form.getBody().layout(true, true);
    form.reflow(true);
}
Also used : AbstractDashboardPart(org.springsource.ide.eclipse.dashboard.ui.AbstractDashboardPart) Section(org.eclipse.ui.forms.widgets.Section)

Aggregations

Section (org.eclipse.ui.forms.widgets.Section)3 AbstractDashboardPart (org.springsource.ide.eclipse.dashboard.ui.AbstractDashboardPart)3 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)1 Color (org.eclipse.swt.graphics.Color)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Composite (org.eclipse.swt.widgets.Composite)1 ExpansionAdapter (org.eclipse.ui.forms.events.ExpansionAdapter)1 ExpansionEvent (org.eclipse.ui.forms.events.ExpansionEvent)1 ExpandableComposite (org.eclipse.ui.forms.widgets.ExpandableComposite)1