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();
}
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();
}
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);
}
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);
}
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);
}
Aggregations