use of org.eclipse.swt.custom.SashForm in project ACS by ACS-Community.
the class SourcesView method createViewWidgets.
private void createViewWidgets(final Composite parent) {
_sash = new SashForm(parent, SWT.HORIZONTAL);
_sash.setLayout(new FillLayout());
/* Left pane */
_sourcesComp = new Composite(_sash, SWT.NONE);
GridLayout layout = new GridLayout();
layout.numColumns = 1;
_sourcesComp.setLayout(layout);
_listGroup = new Group(_sourcesComp, SWT.SHADOW_ETCHED_IN);
GridData gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.verticalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
gd.grabExcessVerticalSpace = true;
_listGroup.setLayoutData(gd);
GridLayout gl = new GridLayout();
gl.numColumns = 1;
_listGroup.setLayout(gl);
_listGroup.setText("Sources List");
_sourcesList = new List(_listGroup, SWT.BORDER);
gd = new GridData();
gd.verticalAlignment = SWT.FILL;
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessVerticalSpace = true;
gd.grabExcessHorizontalSpace = true;
_sourcesList.setLayoutData(gd);
_sourcesButtonsComp = new Composite(_sourcesComp, SWT.NONE);
layout = new GridLayout();
layout.numColumns = 2;
_sourcesButtonsComp.setLayout(layout);
_addSourceButton = new Button(_sourcesButtonsComp, SWT.None);
_addSourceButton.setText("Add");
_addSourceButton.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_ADD));
_deleteSourceButton = new Button(_sourcesButtonsComp, SWT.None);
_deleteSourceButton.setText("Delete");
_deleteSourceButton.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_ETOOL_DELETE));
/* Please change this in the future when more SOURCES will be available */
_addSourceButton.setEnabled(false);
_deleteSourceButton.setEnabled(false);
_sourcesList.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
public void widgetSelected(SelectionEvent e) {
String source = _sourcesList.getSelection()[0];
Control c = _compInitial.getChildren()[0];
if (c instanceof Label) {
c.dispose();
_group.setVisible(true);
_group.layout();
}
fillSource(source);
_compInitial.layout();
}
});
_addSourceButton.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
InputDialog dialog = new InputDialog(SourcesView.this.getViewSite().getShell(), "New source", "Enter the source name", null, new IInputValidator() {
public String isValid(String newText) {
if (newText.trim().compareTo("") == 0)
return "The name is empty";
return null;
}
});
dialog.setBlockOnOpen(true);
dialog.open();
int returnCode = dialog.getReturnCode();
if (returnCode == InputDialog.OK) {
Source newSource = new Source();
newSource.setSourceId(dialog.getValue());
try {
_sourceManager.addSource(newSource);
} catch (IllegalOperationException e) {
ErrorDialog error = new ErrorDialog(SourcesView.this.getViewSite().getShell(), "Source already exist", "The source " + dialog.getValue() + " already exists in the current configuration", new Status(IStatus.ERROR, "cl.utfsm.acs.acg", e.getMessage()), IStatus.ERROR);
error.setBlockOnOpen(true);
error.open();
return;
}
refreshContents();
if (_sourcesList.getItems().length != 0) {
int lenght = _sourcesList.getItems().length;
lenght -= 1;
_sourcesList.select(lenght);
_descriptionText.setText(_sourcesList.getItem(lenght).toString());
}
}
}
});
_deleteSourceButton.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
boolean choice = MessageDialog.openQuestion(SourcesView.this.getViewSite().getShell(), "Confirmation", "Are you sure you want to delete this Source");
if (choice == true) {
String[] tmp = _sourcesList.getSelection();
if (tmp.length == 0) {
MessageBox box = new MessageBox(getViewSite().getShell(), SWT.OK | SWT.ICON_ERROR | SWT.APPLICATION_MODAL);
box.setText("Empty selection");
box.setMessage("There are no sources selected to be deleted");
box.open();
return;
}
String source = tmp[0];
try {
_sourceManager.deleteSource(_sourceManager.getSource(source));
} catch (IllegalOperationException e) {
ErrorDialog error = new ErrorDialog(SourcesView.this.getViewSite().getShell(), "Cannot delete source", "The source cannot be deleted", new Status(IStatus.ERROR, "cl.utfsm.acs.acg", e.getMessage()), IStatus.ERROR);
error.setBlockOnOpen(true);
error.open();
}
refreshContents();
if (_sourcesList.getItems().length != 0) {
int lenght = _sourcesList.getItems().length;
lenght -= 1;
_sourcesList.select(lenght);
_sourceNameText.setText(_sourcesList.getItem(lenght).toString());
}
}
}
});
/* Right pane */
_compInitial = new Composite(_sash, SWT.NONE);
_compInitial.setLayout(new GridLayout());
new Label(_compInitial, SWT.NONE).setText("Select a source");
layout = new GridLayout();
layout.numColumns = 2;
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.verticalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
gd.grabExcessVerticalSpace = true;
_group = new Group(_compInitial, SWT.SHADOW_ETCHED_IN);
_group.setText("Source information");
_group.setLayout(layout);
_group.setLayoutData(gd);
_sourceNameLabel = new Label(_group, SWT.NONE);
_sourceNameLabel.setText("Source name");
_sourceNameText = new Text(_group, SWT.BORDER);
_descriptionLabel = new Label(_group, SWT.NONE);
_descriptionLabel.setText("Description");
_descriptionText = new Text(_group, SWT.BORDER);
gd = new GridData();
gd.horizontalAlignment = SWT.FILL;
gd.grabExcessHorizontalSpace = true;
_sourceNameText.setLayoutData(gd);
_descriptionText.setLayoutData(gd);
_group.setVisible(false);
_sash.setWeights(new int[] { 3, 5 });
/* TODO: This is temporal, since there is currently only
* one source defined in the AS, and it's hardcoded */
//setEnabled(false);
_descriptionText.addListener(SWT.Modify, new Listener() {
public void handleEvent(Event e) {
updateSource();
}
});
_errorMessageLabel = new Label(_group, SWT.NONE);
_errorMessageLabel.setText("");
_errorMessageLabel.setForeground(getViewSite().getShell().getDisplay().getSystemColor(SWT.COLOR_RED));
gd = new GridData();
gd.grabExcessHorizontalSpace = true;
gd.horizontalAlignment = SWT.FILL;
gd.horizontalSpan = 2;
_errorMessageLabel.setLayoutData(gd);
/* Please change this in the future when more SOURCES will be available */
_sourceNameText.setEnabled(false);
_descriptionText.setEnabled(false);
}
use of org.eclipse.swt.custom.SashForm in project cubrid-manager by CUBRID.
the class TableSchemaCompareComposite method initialize.
public void initialize() {
SashForm tailSash = new SashForm(tabFolder, SWT.VERTICAL);
tailSash.SASH_WIDTH = 1;
tailSash.setBackground(BACK_COLOR);
Composite tableComp = new Composite(tailSash, SWT.NONE);
tableComp.setLayout(new FillLayout());
createSchemaViewer(tableComp);
tabItem = new TableSchemaCompareCTabItem(tabFolder, SWT.NONE, this);
tabItem.setControl(tailSash);
tabItem.setShowClose(true);
tabItem.setImage(schema_compare_icon);
String tabItemText = l_tableSchema.getName();
if (StringUtil.isEmpty(l_tableSchema.getName())) {
tabItemText = r_tableSchema.getName();
}
tabItem.setText(tabItemText);
tabItem.setData("Source", tabItemText);
tabItem.setData("Target", r_tableSchema.getName());
tabFolder.setSelection(tabItem);
}
use of org.eclipse.swt.custom.SashForm in project cubrid-manager by CUBRID.
the class PstmtSQLDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
Composite parentComp = (Composite) super.createDialogArea(parent);
Composite composite = new Composite(parentComp, SWT.NONE);
{
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
GridLayout layout = new GridLayout();
layout.numColumns = 1;
layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
composite.setLayout(layout);
}
SashForm sashForm = new SashForm(composite, SWT.NONE);
{
sashForm.setOrientation(SWT.VERTICAL);
GridData gridData = new GridData(GridData.FILL_BOTH);
gridData.widthHint = 600;
gridData.heightHint = 600;
sashForm.setLayoutData(gridData);
GridLayout layout = new GridLayout();
layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
sashForm.setLayout(layout);
createSqlTextComposite(sashForm);
createBottomComposite(sashForm);
sashForm.setWeights(new int[] { 50, 50 });
}
if (isInsert) {
initial();
}
return parentComp;
}
use of org.eclipse.swt.custom.SashForm in project cubrid-manager by CUBRID.
the class InsertTableDataDialog method createDialogArea.
protected Control createDialogArea(Composite parent) {
Composite parentComp = (Composite) super.createDialogArea(parent);
Composite composite = new Composite(parentComp, SWT.NONE);
{
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
GridLayout layout = new GridLayout();
layout.numColumns = 1;
layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
composite.setLayout(layout);
}
sashForm = new SashForm(composite, SWT.NONE);
{
sashForm.setOrientation(SWT.VERTICAL);
GridData gridData = new GridData(GridData.FILL_BOTH);
gridData.widthHint = 620;
gridData.heightHint = 500;
sashForm.setLayoutData(gridData);
createAttrTable();
sqlHistoryTxt = new StyledText(sashForm, SWT.BORDER | SWT.WRAP | SWT.V_SCROLL | SWT.READ_ONLY);
sqlHistoryTxt.setLayoutData(new GridData(GridData.FILL_BOTH));
CommonUITool.registerContextMenu(sqlHistoryTxt, false);
sashForm.setWeights(new int[] { 60, 40 });
}
lblTotalInsertedCount = new Label(composite, SWT.NONE);
{
lblTotalInsertedCount.setText("");
GridData gridData = new GridData();
gridData.grabExcessHorizontalSpace = true;
gridData.horizontalAlignment = GridData.FILL;
lblTotalInsertedCount.setLayoutData(gridData);
}
setTitle(Messages.insertInstanceMsgTitle);
setMessage(Messages.insertInstanceMsg);
return parentComp;
}
use of org.eclipse.swt.custom.SashForm in project cubrid-manager by CUBRID.
the class PstmtDataDialog method createDialogArea.
protected Control createDialogArea(Composite parent) {
Composite parentComp = (Composite) super.createDialogArea(parent);
Composite composite = new Composite(parentComp, SWT.NONE);
{
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
GridLayout layout = new GridLayout();
layout.numColumns = 1;
layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
composite.setLayout(layout);
}
SashForm sashForm = new SashForm(composite, SWT.NONE);
{
sashForm.setOrientation(SWT.VERTICAL);
GridData gridData = new GridData(GridData.FILL_BOTH);
gridData.widthHint = 600;
gridData.heightHint = 500;
sashForm.setLayoutData(gridData);
GridLayout layout = new GridLayout();
layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
sashForm.setLayout(layout);
createSqlTextComposite(sashForm);
createBottomComposite(sashForm);
sashForm.setWeights(new int[] { 25, 75 });
}
initial();
return parentComp;
}
Aggregations