Skip to content

Commit

Permalink
TEIIDDES-2420 interim fix by moving add/remove buttons to top of
Browse files Browse the repository at this point in the history
parameter and header properties panels to stay visible.
  • Loading branch information
blafond committed Jan 12, 2015
1 parent 2efb54f commit 7470887
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 75 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,44 @@ private void createPanel(Composite parent) {
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
gd.horizontalSpan = 2;
panel.setLayoutData(gd);

//
// add toolbar above the table
//

Composite toolbarPanel = WidgetFactory.createPanel(panel, SWT.NONE, GridData.VERTICAL_ALIGN_BEGINNING, 1, 2);
((GridLayout)toolbarPanel.getLayout()).marginHeight = 0;

this.addPropertyButton = WidgetFactory.createButton(toolbarPanel, GridData.FILL);
this.addPropertyButton.setImage(DatatoolsUiPlugin.getDefault().getImage(Images.ADD_PROPERTY_ICON));
this.addPropertyButton.setToolTipText(UTIL.getString("HeaderPropertiesPanel_addNewPropertyButton_tooltip")); //$NON-NLS-1$
this.addPropertyButton.addSelectionListener(new SelectionListener() {

@Override
public void widgetSelected(SelectionEvent e) {
handleAddProperty();
}

@Override
public void widgetDefaultSelected(SelectionEvent e) {
}
});

this.removePropertyButton = WidgetFactory.createButton(toolbarPanel, GridData.FILL);
this.removePropertyButton.setImage(DatatoolsUiPlugin.getDefault().getImage(Images.REMOVE_PROPERTY_ICON));
this.removePropertyButton.setToolTipText(UTIL.getString("HeaderPropertiesPanel_removePropertyButton_tooltip")); //$NON-NLS-1$
this.removePropertyButton.addSelectionListener(new SelectionListener() {

@Override
public void widgetSelected(SelectionEvent e) {
handleRemoveProperty();
}

@Override
public void widgetDefaultSelected(SelectionEvent e) {
}
});
this.removePropertyButton.setEnabled(false);

this.propertiesViewer = new TableViewerBuilder(panel, (SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.BORDER));
GridDataFactory.fillDefaults().grab(true, true).span(2, 1).applyTo(propertiesViewer.getTableComposite());
Expand Down Expand Up @@ -198,43 +236,6 @@ public void selectionChanged( SelectionChangedEvent event ) {
handlePropertySelected();
}
});

//
// add toolbar below the table
//

Composite toolbarPanel = WidgetFactory.createPanel(panel, SWT.NONE, GridData.VERTICAL_ALIGN_BEGINNING, 1, 2);

this.addPropertyButton = WidgetFactory.createButton(toolbarPanel, GridData.FILL);
this.addPropertyButton.setImage(DatatoolsUiPlugin.getDefault().getImage(Images.ADD_PROPERTY_ICON));
this.addPropertyButton.setToolTipText(UTIL.getString("HeaderPropertiesPanel_addNewPropertyButton_tooltip")); //$NON-NLS-1$
this.addPropertyButton.addSelectionListener(new SelectionListener() {

@Override
public void widgetSelected(SelectionEvent e) {
handleAddProperty();
}

@Override
public void widgetDefaultSelected(SelectionEvent e) {
}
});

this.removePropertyButton = WidgetFactory.createButton(toolbarPanel, GridData.FILL);
this.removePropertyButton.setImage(DatatoolsUiPlugin.getDefault().getImage(Images.REMOVE_PROPERTY_ICON));
this.removePropertyButton.setToolTipText(UTIL.getString("HeaderPropertiesPanel_removePropertyButton_tooltip")); //$NON-NLS-1$
this.removePropertyButton.addSelectionListener(new SelectionListener() {

@Override
public void widgetSelected(SelectionEvent e) {
handleRemoveProperty();
}

@Override
public void widgetDefaultSelected(SelectionEvent e) {
}
});
this.removePropertyButton.setEnabled(false);

this.propertiesViewer.setInput(this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,47 @@ public ParameterPanel(PropertyPage propertyPage, Composite parent, Map<String, P
private void createPanel(Composite parent) {

Composite panel = WidgetFactory.createGroup(parent, StringConstants.EMPTY_STRING, SWT.FILL, 2, 1); //$NON-NLS-1$
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false);
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
gd.horizontalSpan = 2;
panel.setLayoutData(gd);

//
// add toolbar above the table
//

Composite toolbarPanel = WidgetFactory.createPanel(panel, SWT.NONE, GridData.VERTICAL_ALIGN_BEGINNING, 1, 2);
((GridLayout)toolbarPanel.getLayout()).marginHeight = 0;

this.addPropertyButton = WidgetFactory.createButton(toolbarPanel, GridData.FILL);
this.addPropertyButton.setImage(DatatoolsUiPlugin.getDefault().getImage(Images.ADD_PROPERTY_ICON));
this.addPropertyButton.setToolTipText(UTIL.getString("ParametersPanel_addNewParameterButton_tooltip")); //$NON-NLS-1$
this.addPropertyButton.addSelectionListener(new SelectionListener() {

@Override
public void widgetSelected(SelectionEvent e) {
handleAddProperty();
}

@Override
public void widgetDefaultSelected(SelectionEvent e) {
}
});

this.removePropertyButton = WidgetFactory.createButton(toolbarPanel, GridData.FILL);
this.removePropertyButton.setImage(DatatoolsUiPlugin.getDefault().getImage(Images.REMOVE_PROPERTY_ICON));
this.removePropertyButton.setToolTipText(UTIL.getString("ParametersPanel_removeParameterButton_tooltip")); //$NON-NLS-1$
this.removePropertyButton.addSelectionListener(new SelectionListener() {

@Override
public void widgetSelected(SelectionEvent e) {
handleRemoveProperty();
}

@Override
public void widgetDefaultSelected(SelectionEvent e) {
}
});
this.removePropertyButton.setEnabled(false);

this.propertiesViewer = new TableViewerBuilder(panel, (SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.BORDER));
GridDataFactory.fillDefaults().grab(true, true).span(3, 1).hint(360, 160).applyTo(propertiesViewer.getTableComposite());
Expand Down Expand Up @@ -206,43 +244,6 @@ public void selectionChanged( SelectionChangedEvent event ) {
handlePropertySelected();
}
});

//
// add toolbar below the table
//

Composite toolbarPanel = WidgetFactory.createPanel(panel, SWT.NONE, GridData.VERTICAL_ALIGN_BEGINNING, 1, 2);

this.addPropertyButton = WidgetFactory.createButton(toolbarPanel, GridData.FILL);
this.addPropertyButton.setImage(DatatoolsUiPlugin.getDefault().getImage(Images.ADD_PROPERTY_ICON));
this.addPropertyButton.setToolTipText(UTIL.getString("ParametersPanel_addNewParameterButton_tooltip")); //$NON-NLS-1$
this.addPropertyButton.addSelectionListener(new SelectionListener() {

@Override
public void widgetSelected(SelectionEvent e) {
handleAddProperty();
}

@Override
public void widgetDefaultSelected(SelectionEvent e) {
}
});

this.removePropertyButton = WidgetFactory.createButton(toolbarPanel, GridData.FILL);
this.removePropertyButton.setImage(DatatoolsUiPlugin.getDefault().getImage(Images.REMOVE_PROPERTY_ICON));
this.removePropertyButton.setToolTipText(UTIL.getString("ParametersPanel_removeParameterButton_tooltip")); //$NON-NLS-1$
this.removePropertyButton.addSelectionListener(new SelectionListener() {

@Override
public void widgetSelected(SelectionEvent e) {
handleRemoveProperty();
}

@Override
public void widgetDefaultSelected(SelectionEvent e) {
}
});
this.removePropertyButton.setEnabled(false);

this.propertiesViewer.setInput(this);
}
Expand Down

0 comments on commit 7470887

Please sign in to comment.