mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-13 19:25:38 +02:00
Bug 515296: Collapse empty space when buttons are not visible
With the new "Preferences" button in CSourceNotFoundEditor always visible, under some conditions (e.g. when no debug info available) there would be a large gap due to invisible buttons. This change does a relayout / exclude when the visibility of the buttons change. Change-Id: I68ae8665c286eb41f37fa823b3d3168175140ba3
This commit is contained in:
parent
c167eeeb1e
commit
fb8e792478
1 changed files with 22 additions and 12 deletions
|
@ -84,8 +84,11 @@ public class CSourceNotFoundEditor extends CommonSourceNotFoundEditor {
|
||||||
private Button disassemblyButton;
|
private Button disassemblyButton;
|
||||||
|
|
||||||
private Button locateFileButton;
|
private Button locateFileButton;
|
||||||
|
private GridData locateFileButtonGridData;
|
||||||
|
|
||||||
private Button editLookupButton;
|
private Button editLookupButton;
|
||||||
|
private GridData editLookupButtonGridData;
|
||||||
|
|
||||||
private boolean isDebugElement;
|
private boolean isDebugElement;
|
||||||
private boolean isTranslationUnit;
|
private boolean isTranslationUnit;
|
||||||
private Text fText;
|
private Text fText;
|
||||||
|
@ -93,6 +96,8 @@ public class CSourceNotFoundEditor extends CommonSourceNotFoundEditor {
|
||||||
private Text preferenceText;
|
private Text preferenceText;
|
||||||
private Button preferenceButton;
|
private Button preferenceButton;
|
||||||
|
|
||||||
|
private Composite buttonParentComposite;
|
||||||
|
|
||||||
public CSourceNotFoundEditor() {
|
public CSourceNotFoundEditor() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
@ -163,11 +168,17 @@ public class CSourceNotFoundEditor extends CommonSourceNotFoundEditor {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void syncButtons() {
|
private void syncButtons() {
|
||||||
|
boolean visible = missingFile.length() > 0;
|
||||||
if (locateFileButton != null) {
|
if (locateFileButton != null) {
|
||||||
locateFileButton.setVisible(missingFile.length() > 0);
|
locateFileButton.setVisible(visible);
|
||||||
|
locateFileButtonGridData.exclude = !visible;
|
||||||
}
|
}
|
||||||
if (editLookupButton != null) {
|
if (editLookupButton != null) {
|
||||||
editLookupButton.setVisible(missingFile.length() > 0);
|
editLookupButton.setVisible(visible);
|
||||||
|
editLookupButtonGridData.exclude = !visible;
|
||||||
|
}
|
||||||
|
if (buttonParentComposite != null) {
|
||||||
|
buttonParentComposite.layout(true, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,6 +210,7 @@ public class CSourceNotFoundEditor extends CommonSourceNotFoundEditor {
|
||||||
@Override
|
@Override
|
||||||
protected void createButtons(Composite parent) {
|
protected void createButtons(Composite parent) {
|
||||||
|
|
||||||
|
this.buttonParentComposite = parent;
|
||||||
if (isDebugElement) {
|
if (isDebugElement) {
|
||||||
GridData data;
|
GridData data;
|
||||||
disassemblyButton = new Button(parent, SWT.PUSH);
|
disassemblyButton = new Button(parent, SWT.PUSH);
|
||||||
|
@ -217,12 +229,11 @@ public class CSourceNotFoundEditor extends CommonSourceNotFoundEditor {
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
GridData data;
|
|
||||||
locateFileButton = new Button(parent, SWT.PUSH);
|
locateFileButton = new Button(parent, SWT.PUSH);
|
||||||
data = new GridData();
|
locateFileButtonGridData = new GridData();
|
||||||
data.grabExcessHorizontalSpace = false;
|
locateFileButtonGridData.grabExcessHorizontalSpace = false;
|
||||||
data.grabExcessVerticalSpace = false;
|
locateFileButtonGridData.grabExcessVerticalSpace = false;
|
||||||
locateFileButton.setLayoutData(data);
|
locateFileButton.setLayoutData(locateFileButtonGridData);
|
||||||
locateFileButton.setText(SourceLookupUIMessages.CSourceNotFoundEditor_1);
|
locateFileButton.setText(SourceLookupUIMessages.CSourceNotFoundEditor_1);
|
||||||
locateFileButton.addSelectionListener(new SelectionAdapter() {
|
locateFileButton.addSelectionListener(new SelectionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -234,12 +245,11 @@ public class CSourceNotFoundEditor extends CommonSourceNotFoundEditor {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isDebugElement) {
|
if (isDebugElement) {
|
||||||
GridData data;
|
|
||||||
editLookupButton = new Button(parent, SWT.PUSH);
|
editLookupButton = new Button(parent, SWT.PUSH);
|
||||||
data = new GridData();
|
editLookupButtonGridData = new GridData();
|
||||||
data.grabExcessHorizontalSpace = false;
|
editLookupButtonGridData.grabExcessHorizontalSpace = false;
|
||||||
data.grabExcessVerticalSpace = false;
|
editLookupButtonGridData.grabExcessVerticalSpace = false;
|
||||||
editLookupButton.setLayoutData(data);
|
editLookupButton.setLayoutData(editLookupButtonGridData);
|
||||||
editLookupButton.setText(SourceLookupUIMessages.CSourceNotFoundEditor_5);
|
editLookupButton.setText(SourceLookupUIMessages.CSourceNotFoundEditor_5);
|
||||||
editLookupButton.addSelectionListener(new SelectionAdapter() {
|
editLookupButton.addSelectionListener(new SelectionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Add table
Reference in a new issue