use of org.eclipse.swt.layout.GridData in project dbeaver by serge-rider.
the class ProgressPageControl method hideControls.
private void hideControls(boolean showDefaultControls) {
if (searchControlsComposite == null || searchControlsComposite.isDisposed()) {
return;
}
searchControlsComposite.getParent().setRedraw(false);
try {
// Delete all controls created in searchControlsComposite
for (Control child : searchControlsComposite.getChildren()) {
child.dispose();
}
// Nullify all controls
progressBar = null;
searchText = null;
// Create default controls toolbar
if (showDefaultControls) {
((GridLayout) searchControlsComposite.getLayout()).numColumns = 2;
defaultToolbarManager.removeAll();
if (isSearchPossible() && isSearchEnabled()) {
defaultToolbarManager.add(ActionUtils.makeCommandContribution(PlatformUI.getWorkbench(), IWorkbenchCommandConstants.EDIT_FIND_AND_REPLACE, CoreMessages.controls_progress_page_toolbar_title, UIIcon.SEARCH));
}
Label phLabel = new Label(searchControlsComposite, SWT.NONE);
//$NON-NLS-1$
phLabel.setText("");
phLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
ToolBar defaultToolbar = defaultToolbarManager.createControl(searchControlsComposite);
defaultToolbar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_END));
// Recreate custom controls
for (Control child : customControlsComposite.getChildren()) {
child.dispose();
}
customToolbarManager.removeAll();
fillCustomActions(customToolbarManager);
if (!customToolbarManager.isEmpty()) {
ToolBar toolbar = customToolbarManager.createControl(customControlsComposite);
toolbar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_END));
}
}
searchControlsComposite.getParent().layout();
//customControlsComposite.layout();
} finally {
searchControlsComposite.getParent().setRedraw(true);
}
}
use of org.eclipse.swt.layout.GridData in project dbeaver by serge-rider.
the class ProgressPageControl method createContentContainer.
public Composite createContentContainer() {
Composite container = new Composite(this, (getStyle() & SWT.SHEET) == SWT.SHEET ? SWT.NONE : SWT.BORDER);
container.setLayout(new FillLayout());
GridData gd = new GridData(GridData.FILL_BOTH);
gd.horizontalIndent = 0;
gd.verticalIndent = 0;
container.setLayoutData(gd);
return container;
}
use of org.eclipse.swt.layout.GridData in project dbeaver by serge-rider.
the class ProgressPageControl method createSearchControls.
private void createSearchControls() {
if (searchText != null) {
return;
}
hideControls(false);
((GridLayout) searchControlsComposite.getLayout()).numColumns = 2;
searchText = new Text(searchControlsComposite, SWT.BORDER);
UIUtils.addFocusTracker(DBeaverUI.getActiveWorkbenchWindow(), UIUtils.INLINE_WIDGET_EDITOR_ID, this.searchText);
if (curSearchText != null) {
searchText.setText(curSearchText);
searchText.setSelection(curSearchText.length());
}
//searchText.setBackground(searchNotFoundColor);
searchText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
searchText.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
switch(e.keyCode) {
case SWT.ESC:
cancelSearch(true);
break;
case SWT.CR:
case SWT.ARROW_UP:
case SWT.ARROW_DOWN:
if (childPageControl != null) {
childPageControl.setFocus();
}
e.doit = false;
//performSearch(SearchType.NEXT);
break;
}
}
});
searchText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
curSearchText = searchText.getText();
if (curSearchJob == null) {
curSearchJob = new UIJob(CoreMessages.controls_progress_page_job_search) {
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
if (monitor.isCanceled()) {
return Status.CANCEL_STATUS;
}
performSearch(SearchType.NEXT);
curSearchJob = null;
return Status.OK_STATUS;
}
};
curSearchJob.schedule(200);
}
}
});
//ToolBar searchTools = new ToolBar(searchControlsComposite, SWT.HORIZONTAL);
if (searchToolbarManager == null) {
searchToolbarManager = new ToolBarManager(SWT.FLAT | SWT.HORIZONTAL);
// Do not add prev/next buttons - they doesn't make sense now.
// Keep code just in case
/*
searchToolbarManager.add(ActionUtils.makeCommandContribution(
PlatformUI.getWorkbench(),
IWorkbenchActionDefinitionIds.FIND_NEXT,
null,
UIIcon.ARROW_DOWN));
searchToolbarManager.add(ActionUtils.makeCommandContribution(
PlatformUI.getWorkbench(),
IWorkbenchActionDefinitionIds.FIND_PREVIOUS,
null,
UIIcon.ARROW_UP));
*/
searchToolbarManager.add(new Action(CoreMessages.controls_progress_page_action_close, UIUtils.getShardImageDescriptor(ISharedImages.IMG_ELCL_REMOVE)) {
@Override
public void run() {
cancelSearch(true);
}
});
}
searchToolbarManager.createControl(searchControlsComposite);
searchControlsComposite.getParent().layout();
}
use of org.eclipse.swt.layout.GridData in project dbeaver by serge-rider.
the class PairListControl method createButton.
private Button createButton(Composite panel, Image label, SelectionListener listener) {
Button button = new Button(panel, SWT.PUSH);
button.setImage(label);
button.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
button.addSelectionListener(listener);
return button;
}
use of org.eclipse.swt.layout.GridData in project dbeaver by serge-rider.
the class PairListControl method createList.
private Table createList(Composite panel) {
final Table table = new Table(panel, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
GridData gd = new GridData(GridData.FILL_BOTH);
table.setLayoutData(gd);
final TableColumn column = new TableColumn(table, SWT.LEFT);
table.addListener(SWT.Resize, new Listener() {
@Override
public void handleEvent(Event e) {
column.setWidth(table.getClientArea().width);
}
});
return table;
}
Aggregations