use of org.eclipse.swt.events.SelectionEvent in project dbeaver by serge-rider.
the class ValueViewDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
/*
SashForm sash = new SashForm(parent, SWT.VERTICAL);
sash.setLayoutData(new GridData(GridData.FILL_BOTH));
Composite dialogGroup = (Composite)super.createDialogArea(sash);
dialogGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
new ColumnInfoPanel(dialogGroup, SWT.BORDER, getValueController());
Composite editorGroup = (Composite) super.createDialogArea(sash);
editorGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
//editorGroup.setLayout(new GridLayout(1, false));
return editorGroup;
*/
Composite dialogGroup = (Composite) super.createDialogArea(parent);
if (valueController instanceof IAttributeController) {
final Link columnHideLink = new Link(dialogGroup, SWT.NONE);
columnHideLink.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
columnInfoVisible = !columnInfoVisible;
dialogSettings.put(getInfoVisiblePrefId(), columnInfoVisible);
initColumnInfoVisibility(columnHideLink);
getShell().layout();
int width = getShell().getSize().x;
getShell().setSize(width, getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
}
});
columnPanel = new ColumnInfoPanel(dialogGroup, SWT.BORDER, valueController);
columnPanel.setLayoutData(new GridData(GridData.FILL_BOTH));
initColumnInfoVisibility(columnHideLink);
}
return dialogGroup;
}
use of org.eclipse.swt.events.SelectionEvent in project dbeaver by serge-rider.
the class DriverDownloadAutoPage method createControl.
@Override
public void createControl(Composite parent) {
final DriverDownloadWizard wizard = getWizard();
final DriverDescriptor driver = wizard.getDriver();
setMessage("Download " + driver.getFullName() + " driver files");
initializeDialogUnits(parent);
Composite composite = UIUtils.createPlaceholder(parent, 1);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
if (!wizard.isForceDownload()) {
Composite infoGroup = UIUtils.createPlaceholder(composite, 2, 5);
infoGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Label infoText = new Label(infoGroup, SWT.NONE);
infoText.setText(driver.getFullName() + " driver files are missing.\nDBeaver can download these files automatically.\n\n");
infoText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
final Button forceCheckbox = UIUtils.createCheckbox(infoGroup, "Force download / overwrite", wizard.isForceDownload());
forceCheckbox.setToolTipText("Force files download. Will download files even if they are already on the disk");
forceCheckbox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_BEGINNING));
forceCheckbox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
wizard.setForceDownload(forceCheckbox.getSelection());
}
});
}
{
Group filesGroup = UIUtils.createControlGroup(composite, "Files required by driver", 1, -1, -1);
filesGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
depsTree = new DriverDependenciesTree(filesGroup, new RunnableContextDelegate(getContainer()), getWizard().getDependencies(), driver, driver.getDriverLibraries(), true) {
protected void setLibraryVersion(final DBPDriverLibrary library, final String version) {
String curVersion = library.getVersion();
if (CommonUtils.equalObjects(curVersion, version)) {
return;
}
library.setPreferredVersion(version);
resolveLibraries();
}
};
new Label(filesGroup, SWT.NONE).setText("You can change driver version by clicking on version column.\nThen you can choose one of the available versions.");
}
if (!wizard.isForceDownload()) {
Label infoText = new Label(composite, SWT.NONE);
infoText.setText("\nOr you can obtain driver files by yourself and add them in driver editor.");
infoText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
}
createLinksPanel(composite);
setControl(composite);
}
use of org.eclipse.swt.events.SelectionEvent in project dbeaver by serge-rider.
the class DriverDownloadManualPage method createControl.
@Override
public void createControl(Composite parent) {
final DriverDescriptor driver = getWizard().getDriver();
setMessage("Download & configure " + driver.getFullName() + " driver files");
Composite composite = UIUtils.createPlaceholder(parent, 1);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
Link infoText = new Link(composite, SWT.NONE);
infoText.setText(driver.getFullName() + " driver files missing.\n\n" + "According to vendor policy this driver isn't publicly available\nand you have to download it manually from vendor's web site.\n\n" + "After successful driver download you will need to <a>add JAR files</a> in DBeaver libraries list.");
infoText.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
getWizard().getContainer().buttonPressed(DriverDownloadDialog.EDIT_DRIVER_BUTTON_ID);
}
});
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
infoText.setLayoutData(gd);
Group filesGroup = UIUtils.createControlGroup(composite, "Driver files", 1, -1, -1);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.verticalIndent = 10;
filesGroup.setLayoutData(gd);
final Combo sourceCombo = new Combo(filesGroup, SWT.DROP_DOWN | SWT.READ_ONLY);
for (DriverFileSource source : driver.getDriverFileSources()) {
sourceCombo.add(source.getName());
}
final Link driverLink = new Link(filesGroup, SWT.NONE);
driverLink.setText("<a>" + driver.getDriverFileSources().get(0).getUrl() + "</a>");
driverLink.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
driverLink.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
WebUtils.openWebBrowser(driver.getDriverFileSources().get(sourceCombo.getSelectionIndex()).getUrl());
}
});
filesTable = new Table(filesGroup, SWT.BORDER | SWT.FULL_SELECTION);
filesTable.setHeaderVisible(true);
filesTable.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
UIUtils.createTableColumn(filesTable, SWT.LEFT, "File");
UIUtils.createTableColumn(filesTable, SWT.LEFT, "Required");
UIUtils.createTableColumn(filesTable, SWT.LEFT, "Description");
sourceCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
selectFileSource(driver.getDriverFileSources().get(sourceCombo.getSelectionIndex()));
driverLink.setText("<a>" + driver.getDriverFileSources().get(sourceCombo.getSelectionIndex()).getUrl() + "</a>");
}
});
sourceCombo.select(0);
selectFileSource(driver.getDriverFileSources().get(0));
UIUtils.packColumns(filesTable, true);
createLinksPanel(composite);
composite.setTabList(ArrayUtils.remove(Control.class, composite.getTabList(), infoText));
setControl(composite);
}
use of org.eclipse.swt.events.SelectionEvent in project dbeaver by serge-rider.
the class BinaryEditor method createPartControl.
@Override
public void createPartControl(Composite parent) {
IStorage storage = EditorUtils.getStorageFromInput(getEditorInput());
manager = new HexManager();
manager.setTextFont(HexPreferencesPage.getPrefFontData());
manager.setMenuListener(this);
int editorStyle = SWT.NONE;
if (storage != null && storage.isReadOnly()) {
editorStyle = SWT.READ_ONLY;
}
manager.createEditorPart(parent, editorStyle);
FillLayout fillLayout = new FillLayout();
parent.setLayout(fillLayout);
loadBinaryContent();
// Register any global actions with the site's IActionBars.
IActionBars bars = getEditorSite().getActionBars();
createEditorAction(bars, IWorkbenchCommandConstants.EDIT_UNDO);
createEditorAction(bars, IWorkbenchCommandConstants.EDIT_REDO);
createEditorAction(bars, IWorkbenchCommandConstants.EDIT_CUT);
createEditorAction(bars, IWorkbenchCommandConstants.EDIT_COPY);
createEditorAction(bars, IWorkbenchCommandConstants.EDIT_PASTE);
createEditorAction(bars, IWorkbenchCommandConstants.EDIT_DELETE);
createEditorAction(bars, IWorkbenchCommandConstants.EDIT_SELECT_ALL);
createEditorAction(bars, IWorkbenchCommandConstants.EDIT_FIND_AND_REPLACE);
createEditorAction(bars, ITextEditorActionConstants.GOTO_LINE);
manager.addListener(new Listener() {
@Override
public void handleEvent(Event event) {
firePropertyChange(PROP_DIRTY);
updateActionsStatus();
}
});
bars.updateActionBars();
preferencesChangeListener = new DBPPreferenceListener() {
@Override
public void preferenceChange(PreferenceChangeEvent event) {
if (HexPreferencesPage.PROP_FONT_DATA.equals(event.getProperty()))
manager.setTextFont((FontData) event.getNewValue());
}
};
DBPPreferenceStore store = DBeaverCore.getGlobalPreferenceStore();
store.addPropertyChangeListener(preferencesChangeListener);
manager.addLongSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (selectionListeners == null)
return;
long[] longSelection = HexEditControl.getLongSelection(e);
SelectionChangedEvent event = new SelectionChangedEvent(BinaryEditor.this, new StructuredSelection(new Object[] { longSelection[0], longSelection[1] }));
for (ISelectionChangedListener selectionListener : selectionListeners) {
selectionListener.selectionChanged(event);
}
}
});
}
use of org.eclipse.swt.events.SelectionEvent in project dbeaver by serge-rider.
the class DriverManagerDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
List<DataSourceProviderDescriptor> providers = DataSourceProviderRegistry.getInstance().getDataSourceProviders();
{
DataSourceProviderDescriptor manProvider = null;
for (DataSourceProviderDescriptor provider : providers) {
if (provider.isDriversManagable()) {
if (manProvider != null) {
manProvider = null;
break;
}
manProvider = provider;
}
}
if (manProvider != null) {
onlyManagableProvider = manProvider;
}
}
getShell().setText(CoreMessages.dialog_driver_manager_title);
getShell().setMinimumSize(300, 300);
//$NON-NLS-1$
dialogImage = DBeaverActivator.getImageDescriptor("/icons/driver_manager.png").createImage();
getShell().setImage(dialogImage);
Composite group = UIUtils.createPlaceholder((Composite) super.createDialogArea(parent), 2);
group.setLayoutData(new GridData(GridData.FILL_BOTH));
{
treeControl = new DriverTreeControl(group, this, providers, false);
GridData gd = new GridData(GridData.FILL_BOTH);
gd.heightHint = 300;
gd.widthHint = 300;
treeControl.setLayoutData(gd);
}
{
Composite buttonBar = new Composite(group, SWT.TOP);
buttonBar.setLayout(new GridLayout(1, false));
GridData gd = new GridData(GridData.FILL_VERTICAL);
gd.minimumWidth = 100;
buttonBar.setLayoutData(gd);
newButton = new Button(buttonBar, SWT.FLAT | SWT.PUSH);
newButton.setText(CoreMessages.dialog_driver_manager_button_new);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.widthHint = 100;
newButton.setLayoutData(gd);
newButton.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
createDriver();
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
}
});
editButton = new Button(buttonBar, SWT.FLAT | SWT.PUSH);
editButton.setText(CoreMessages.dialog_driver_manager_button_edit);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.widthHint = 100;
editButton.setLayoutData(gd);
editButton.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
editDriver();
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
}
});
deleteButton = new Button(buttonBar, SWT.FLAT | SWT.PUSH);
deleteButton.setText(CoreMessages.dialog_driver_manager_button_delete);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.widthHint = 100;
deleteButton.setLayoutData(gd);
deleteButton.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
deleteDriver();
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
}
});
{
final Composite legend = UIUtils.createPlaceholder(buttonBar, 2, 5);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.verticalIndent = 5;
gd.horizontalSpan = 2;
legend.setLayoutData(gd);
UIUtils.createLabel(legend, DBIcon.OVER_LAMP);
UIUtils.createLabel(legend, CoreMessages.dialog_driver_manager_label_user_defined);
UIUtils.createLabel(legend, DBIcon.OVER_ERROR);
UIUtils.createLabel(legend, CoreMessages.dialog_driver_manager_label_unavailable);
}
}
descText = new Text(group, SWT.READ_ONLY);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.verticalIndent = 5;
gd.horizontalSpan = 2;
gd.grabExcessHorizontalSpace = true;
descText.setLayoutData(gd);
/*
monitorPart = new ProgressMonitorPart(group, null, true);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.verticalIndent = 5;
gd.horizontalSpan = 2;
gd.grabExcessHorizontalSpace = true;
monitorPart.setLayoutData(gd);
monitorPart.setVisible(false);
*/
setDefaultSelection();
this.updateButtons();
return group;
}
Aggregations