use of org.eclipse.ui.internal.part.StatusPart in project dbeaver by serge-rider.
the class ErrorPresentation method createPresentation.
@Override
public void createPresentation(@NotNull IResultSetController controller, @NotNull Composite parent) {
super.createPresentation(controller, parent);
CustomSashForm partDivider = UIUtils.createPartDivider(controller.getSite().getPart(), parent, SWT.HORIZONTAL);
partDivider.setLayoutData(new GridData(GridData.FILL_BOTH));
errorComposite = UIUtils.createComposite(partDivider, 1);
errorComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
statusPart = new StatusPart(errorComposite, status);
for (Control child : errorComposite.getChildren()) {
if (child instanceof Text) {
TextEditorUtils.enableHostEditorKeyBindingsSupport(controller.getSite(), child);
}
}
sqlPanel = UIUtils.createComposite(partDivider, 1);
sqlPanel.setLayout(new FillLayout());
UIServiceSQL serviceSQL = DBWorkbench.getService(UIServiceSQL.class);
try {
editorPanel = serviceSQL.createSQLPanel(controller.getSite(), sqlPanel, controller, "SQL", true, sqlText);
if (editorPanel instanceof TextViewer) {
textWidget = ((TextViewer) editorPanel).getTextWidget();
}
} catch (DBException e) {
textWidget = new StyledText(sqlPanel, SWT.BORDER | SWT.READ_ONLY);
textWidget.setText(sqlText);
}
try {
boolean widthSet = false;
IDialogSettings viewSettings = ResultSetUtils.getViewerSettings(SETTINGS_SECTION_ERROR_PANEL);
String errorWidth = viewSettings.get(PROP_ERROR_WIDTH);
if (errorWidth != null) {
String[] widthStrs = errorWidth.split(":");
if (widthStrs.length == 2) {
partDivider.setWeights(new int[] { Integer.parseInt(widthStrs[0]), Integer.parseInt(widthStrs[1]) });
}
widthSet = true;
}
if (!widthSet) {
partDivider.setWeights(new int[] { 700, 300 });
}
partDivider.addCustomSashFormListener((firstControlWeight, secondControlWeight) -> {
int[] weights = partDivider.getWeights();
viewSettings.put(PROP_ERROR_WIDTH, weights[0] + ":" + weights[1]);
});
} catch (Throwable e) {
log.debug(e);
}
}
use of org.eclipse.ui.internal.part.StatusPart in project dbeaver by dbeaver.
the class ErrorPresentation method createPresentation.
@Override
public void createPresentation(@NotNull IResultSetController controller, @NotNull Composite parent) {
super.createPresentation(controller, parent);
CustomSashForm partDivider = UIUtils.createPartDivider(controller.getSite().getPart(), parent, SWT.HORIZONTAL);
partDivider.setLayoutData(new GridData(GridData.FILL_BOTH));
errorComposite = UIUtils.createComposite(partDivider, 1);
errorComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
statusPart = new StatusPart(errorComposite, status);
for (Control child : errorComposite.getChildren()) {
if (child instanceof Text) {
TextEditorUtils.enableHostEditorKeyBindingsSupport(controller.getSite(), child);
}
}
sqlPanel = UIUtils.createComposite(partDivider, 1);
sqlPanel.setLayout(new FillLayout());
UIServiceSQL serviceSQL = DBWorkbench.getService(UIServiceSQL.class);
try {
editorPanel = serviceSQL.createSQLPanel(controller.getSite(), sqlPanel, controller, "SQL", true, sqlText);
if (editorPanel instanceof TextViewer) {
textWidget = ((TextViewer) editorPanel).getTextWidget();
}
} catch (DBException e) {
textWidget = new StyledText(sqlPanel, SWT.BORDER | SWT.READ_ONLY);
textWidget.setText(sqlText);
}
try {
boolean widthSet = false;
IDialogSettings viewSettings = ResultSetUtils.getViewerSettings(SETTINGS_SECTION_ERROR_PANEL);
String errorWidth = viewSettings.get(PROP_ERROR_WIDTH);
if (errorWidth != null) {
String[] widthStrs = errorWidth.split(":");
if (widthStrs.length == 2) {
partDivider.setWeights(new int[] { Integer.parseInt(widthStrs[0]), Integer.parseInt(widthStrs[1]) });
}
widthSet = true;
}
if (!widthSet) {
partDivider.setWeights(new int[] { 700, 300 });
}
partDivider.addCustomSashFormListener((firstControlWeight, secondControlWeight) -> {
int[] weights = partDivider.getWeights();
viewSettings.put(PROP_ERROR_WIDTH, weights[0] + ":" + weights[1]);
});
} catch (Throwable e) {
log.debug(e);
}
}
Aggregations