我的用戶從主應用程序工作區中選擇數據。數據存儲在可寫列表中。用戶然後繼續打開一個對話框以在表格中顯示選定的數據。 當我的用戶第一次打開對話框時。一切都很好,事情按計劃進行。但是當他們關閉對話框然後重新打開它時。我收到以下錯誤。org.eclipse.swt.SWTExecption:控件已處理
他們被允許關閉該對話框,並選擇更多的數據。然後再次打開對話框查看舊數據和新數據。
代碼正在使用的步驟順序錯誤。
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
Label line = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
line.setLayoutData(new GridData(SWT.FILL, SWT.END, true, true));
final GridLayout gridLayout = new GridLayout();
gridLayout.marginWidth = 15;
gridLayout.marginHeight = 10;
composite.setLayout(gridLayout);
GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
composite.setLayoutData(gridData);
createTopButtons(composite);
createTableViewer(composite);
createRemoveButtons(composite);
updateTableViewer();
return composite;
}
在錯誤中,我們可以看到它從updateTableViewer
public void updateTableViewer() {
setRemoveButtonVisibility();
setRemoveAllButtonVisibility();
setPlotButtonVisibility();
setPDFButtonVisibility();
}
未來在錯誤中,我們看到它從setRemoveButtonVisibility未來();
public void setRemoveButtonVisibility() {
if (AplotDataModel.getInstance().getSize() > 0) {
removeButton.setVisible(true);
}
else {
removeButton.setVisible(false);
}
}
這是它指向行:
removeButton.setVisible(true);
if條件正在檢查存儲用戶選擇數據可寫目錄。如果列表爲空,則按鈕不顯示,如果有數據,按鈕確實顯示。
下面是對話按鈕收盤代碼:
protected void createButtonsForButtonBar(Composite parent) {
Button okButton = createButton(parent, OK, "Close Aplot", true);
okButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
viewer = null;
close();
}
});
}
有什麼想法?