Skip to content

Commit

Permalink
TEIIDDES-2501 re-worked embedded scrolled composite
Browse files Browse the repository at this point in the history
  • Loading branch information
blafond committed May 19, 2015
1 parent 2416ad3 commit 434c4c7
Showing 1 changed file with 22 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
/**
* @since 8.0
*/
// TODO: read-only, undo/redo, function model 259

public final class VdbEditor extends EditorPart implements IResourceChangeListener {

static final String MODEL_COLUMN_NAME = i18n("modelColumnName"); //$NON-NLS-1$
Expand Down Expand Up @@ -1554,19 +1554,31 @@ public void widgetSelected(SelectionEvent e) {
*/
@Override
public void createPartControl( final Composite parent ) {
parent.setLayout(new GridLayout());
parent.setLayoutData(new GridData());

DefaultScrolledComposite scrollable = new DefaultScrolledComposite(parent);
Composite parentPanel = scrollable.getPanel();
parent.setLayout(new GridLayout());
parent.setLayoutData(new GridData());

// Create Scrolled composite so entire editor panel will scroll if resized
DefaultScrolledComposite scrolledComposite = new DefaultScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
scrolledComposite.setExpandHorizontal(true);
scrolledComposite.setExpandVertical(true);
GridLayoutFactory.fillDefaults().equalWidth(false).applyTo(scrolledComposite);
GridDataFactory.fillDefaults().grab(true, false);

final Composite mainPanel = scrolledComposite.getPanel();
mainPanel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
mainPanel.setLayout(new GridLayout(1, false));
((GridData)mainPanel.getLayoutData()).minimumWidth = 400;
((GridData)mainPanel.getLayoutData()).minimumHeight = 400;

if (vdb == null) {
createErrorPanel(parentPanel);
createErrorPanel(mainPanel);
return;
}

{ // Header Panel
Composite headerPanel = WidgetFactory.createPanel(parentPanel, SWT.NONE, GridData.FILL, 1, 6);
Composite headerPanel = WidgetFactory.createPanel(mainPanel, SWT.NONE, GridData.FILL, 1, 6);

Label projectLabel = new Label(headerPanel, SWT.NONE);
projectLabel.setText(Messages.vdbEditor_location);

Expand Down Expand Up @@ -1604,7 +1616,7 @@ public void createPartControl( final Composite parent ) {
}

// So create another Tab Folder (bottom oriented)
CTabFolder tabFolder = WidgetFactory.createTabFolder(parentPanel);
CTabFolder tabFolder = WidgetFactory.createTabFolder(mainPanel);
tabFolder.setTabPosition(SWT.BOTTOM);
{ // models tab
CTabItem leftTab = new CTabItem(tabFolder, SWT.NONE);
Expand All @@ -1629,7 +1641,7 @@ public void createPartControl( final Composite parent ) {

showImportVdbsButton.setEnabled(!getVdb().getImportVdbEntries().isEmpty());

scrollable.sizeScrolledPanel();
scrolledComposite.sizeScrolledPanel();
}

private void addSynchronizePanel(Composite parent ) {
Expand Down Expand Up @@ -2352,7 +2364,7 @@ public void doSave( final IProgressMonitor monitor ) {
*/
@Override
public void doSaveAs() {
// TODO: implement
// NO implementation
}

/**
Expand Down

0 comments on commit 434c4c7

Please sign in to comment.