use of org.eclipse.swt.layout.FillLayout in project cubrid-manager by CUBRID.
the class ImportTypePage method createControl.
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
*/
public void createControl(Composite parent) {
Composite container = new Composite(parent, SWT.NONE);
container.setLayout(new FormLayout());
setControl(container);
Composite leftComposite = new Composite(container, SWT.NONE);
FormData leftData = new FormData();
leftData.top = new FormAttachment(0, 5);
leftData.bottom = new FormAttachment(100, 0);
leftData.left = new FormAttachment(0, 5);
leftData.right = new FormAttachment(50, 0);
GridLayout leftLayout = new GridLayout();
leftLayout.verticalSpacing = 0;
leftComposite.setLayout(leftLayout);
leftComposite.setLayoutData(leftData);
Composite rightComposite = new Composite(container, SWT.NONE);
FormData rightData = new FormData();
rightData.top = new FormAttachment(0, 5);
rightData.bottom = new FormAttachment(100, 0);
rightData.left = new FormAttachment(50, 0);
rightData.right = new FormAttachment(100, -5);
GridLayout rightLayout = new GridLayout();
rightLayout.verticalSpacing = 0;
rightComposite.setLayout(rightLayout);
rightComposite.setLayoutData(rightData);
sqlButton = new Button(leftComposite, SWT.RADIO);
sqlButton.setText(Messages.btnImportSQL);
sqlButton.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
sqlButton.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
public void widgetSelected(SelectionEvent e) {
excelButton.setSelection(!sqlButton.getSelection());
txtButton.setSelection(!sqlButton.getSelection());
historyButton.setSelection(!sqlButton.getSelection());
historyCombo.setEnabled(false);
deleteButton.setEnabled(false);
renameButton.setEnabled(false);
validate();
}
});
Group sqlLabelGroup = new Group(leftComposite, SWT.None);
sqlLabelGroup.setLayoutData(CommonUITool.createGridData(1, 1, 370, 80));
sqlLabelGroup.setLayout(new FillLayout());
Label sqlLabel = new Label(sqlLabelGroup, SWT.WRAP);
sqlLabel.setText(Messages.lblImportSQL);
Label separator1Label = new Label(leftComposite, SWT.None);
separator1Label.setLayoutData(CommonUITool.createGridData(1, 1, 0, 15));
{
Label separator4Label = new Label(leftComposite, SWT.None);
separator4Label.setLayoutData(CommonUITool.createGridData(1, 1, 0, 15));
excelButton = new Button(leftComposite, SWT.RADIO);
excelButton.setText(Messages.btnImportExcel);
excelButton.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
excelButton.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
public void widgetSelected(SelectionEvent e) {
sqlButton.setSelection(!excelButton.getSelection());
txtButton.setSelection(!excelButton.getSelection());
historyButton.setSelection(!excelButton.getSelection());
historyCombo.setEnabled(false);
deleteButton.setEnabled(false);
renameButton.setEnabled(false);
validate();
}
});
Group excelLabelGroup = new Group(leftComposite, SWT.None);
excelLabelGroup.setLayoutData(CommonUITool.createGridData(1, 1, 370, 80));
excelLabelGroup.setLayout(new FillLayout());
Label excelLabel = new Label(excelLabelGroup, SWT.WRAP);
excelLabel.setText(Messages.lblImportExcel);
Label separator2Label = new Label(leftComposite, SWT.None);
separator2Label.setLayoutData(CommonUITool.createGridData(1, 1, 0, 15));
}
// Txt
{
txtButton = new Button(rightComposite, SWT.RADIO);
txtButton.setText(Messages.btnImportTxt);
txtButton.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
txtButton.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
public void widgetSelected(SelectionEvent e) {
sqlButton.setSelection(!txtButton.getSelection());
excelButton.setSelection(!txtButton.getSelection());
historyButton.setSelection(!txtButton.getSelection());
historyCombo.setEnabled(false);
deleteButton.setEnabled(false);
renameButton.setEnabled(false);
validate();
}
});
Group txtLabelGroup = new Group(rightComposite, SWT.None);
txtLabelGroup.setLayoutData(CommonUITool.createGridData(1, 1, 370, 80));
txtLabelGroup.setLayout(new FillLayout());
Label txtLabel = new Label(txtLabelGroup, SWT.WRAP);
txtLabel.setText(Messages.lblImportTxt);
Label separator3Label = new Label(rightComposite, SWT.None);
separator3Label.setLayoutData(CommonUITool.createGridData(1, 1, 0, 15));
}
// History Button
{
Label separator4Label = new Label(rightComposite, SWT.None);
separator4Label.setLayoutData(CommonUITool.createGridData(1, 1, 0, 15));
historyButton = new Button(rightComposite, SWT.RADIO);
historyButton.setText(Messages.btnImportHistory);
historyButton.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
historyButton.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
public void widgetSelected(SelectionEvent e) {
sqlButton.setSelection(!historyButton.getSelection());
excelButton.setSelection(!historyButton.getSelection());
txtButton.setSelection(!historyButton.getSelection());
historyCombo.setEnabled(historyButton.getSelection());
if (historyButton.getSelection()) {
loadHistory();
}
validate();
}
});
Group historyLabelGroup = new Group(rightComposite, SWT.None);
historyLabelGroup.setLayoutData(CommonUITool.createGridData(1, 1, 370, 80));
historyLabelGroup.setLayout(new FillLayout());
Label historyLabel = new Label(historyLabelGroup, SWT.WRAP);
historyLabel.setText(Messages.lblImportHistory);
Composite historyComposite = new Composite(rightComposite, SWT.None);
historyComposite.setLayout(new GridLayout(3, false));
historyComposite.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
historyCombo = new Combo(historyComposite, SWT.READ_ONLY);
historyCombo.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
historyCombo.setEnabled(false);
historyCombo.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
validate();
}
});
loadHistory();
final ImportConfigManager configManager = ImportConfigManager.getInstance();
renameButton = new Button(historyComposite, SWT.None);
renameButton.setText(Messages.btnRenameHistory);
renameButton.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
renameButton.setEnabled(false);
renameButton.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
public void widgetSelected(SelectionEvent e) {
String historyName = historyCombo.getText();
if (historyName == null || historyName.trim().length() == 0) {
return;
}
ImportConfig model = configManager.getConfig(historyName);
if (model == null) {
return;
}
InputDialog dialog = new InputDialog(getShell(), Messages.titleRenameDialog, Messages.descRenameDialog, historyName, new IInputValidator() {
public String isValid(String newText) {
if (newText == null || newText.trim().length() == 0) {
return Messages.msgRenamePleaseInputNewName;
}
if (configManager.getConfig(newText) != null) {
return Messages.msgRenameAlreadyExists;
}
return null;
}
});
if (dialog.open() == IDialogConstants.OK_ID) {
String newName = dialog.getValue();
model.setName(newName);
configManager.saveConfigs();
historyCombo.remove(historyName);
historyCombo.add(newName);
historyCombo.setText(newName);
}
}
});
deleteButton = new Button(historyComposite, SWT.None);
deleteButton.setText(Messages.btnDeleteHistory);
deleteButton.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
deleteButton.setEnabled(false);
deleteButton.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
if (!CommonUITool.openConfirmBox(Messages.confirmDeleteImportHistory)) {
return;
}
boolean result = ImportConfigManager.getInstance().removeConfig(historyCombo.getText());
if (result) {
historyCombo.remove(historyCombo.getText());
validate();
}
}
public void widgetDefaultSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
});
}
}
use of org.eclipse.swt.layout.FillLayout in project cubrid-manager by CUBRID.
the class ERSchemaEditor method createToolBar.
public void createToolBar(Composite parent) {
ScrolledComposite scrolledComp = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
FillLayout flayout = new FillLayout();
scrolledComp.setLayout(flayout);
topPane = new Composite(scrolledComp, SWT.NONE);
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 1;
gridLayout.verticalSpacing = 0;
gridLayout.marginWidth = 0;
gridLayout.marginHeight = 0;
gridLayout.horizontalSpacing = 0;
topPane.setLayout(gridLayout);
topPane.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
scrolledComp.setContent(topPane);
scrolledComp.setExpandHorizontal(true);
scrolledComp.setExpandVertical(true);
final Composite toolBarComposite = new Composite(topPane, SWT.NONE);
toolBarComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
GridLayout gridLayout2 = new GridLayout();
gridLayout2.marginHeight = 0;
gridLayout2.horizontalSpacing = 0;
gridLayout2.marginWidth = 0;
toolBarComposite.setLayout(gridLayout2);
erToolBar = new ERSchemaToolBar(toolBarComposite, SWT.WRAP | SWT.FLAT, this);
erToolBar.init();
topPane.pack();
erToolBar.pack();
}
use of org.eclipse.swt.layout.FillLayout in project cubrid-manager by CUBRID.
the class SQLEditorComposite method createSQLEditor.
/**
* Create the SQL editor
*/
private void createSQLEditor() {
final Composite composite = new Composite(this, SWT.NONE);
composite.setLayout(new FillLayout());
composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
CompositeRuler ruler = new CompositeRuler();
LineNumberRulerColumn lineCol = new LineNumberRulerColumn();
lineCol.setBackground(ResourceManager.getColor(new RGB(236, 233, 216)));
ruler.addDecorator(0, lineCol);
sqlTextViewer = new SQLTextViewer(composite, ruler, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER, queryEditor);
viewerConfig = new SQLViewerConfiguration(queryEditor);
sqlTextViewer.configure(viewerConfig);
document = new SQLDocument();
IDocumentPartitioner partitioner = new FastPartitioner(new SQLPartitionScanner(), SQLPartitionScanner.getAllTypes());
document.setDocumentPartitioner(ISQLPartitions.SQL_PARTITIONING, partitioner);
partitioner.connect(document);
sqlTextViewer.setDocument(document);
findReplaceDocAdapter = new FindReplaceDocumentAdapter(document);
undoManager = new TextViewerUndoManager(50);
undoManager.connect(sqlTextViewer);
contentAssistant = viewerConfig.getContentAssistant(sqlTextViewer);
contentAssistant.install(sqlTextViewer);
recentlyUsedSQLcontentAssistant = viewerConfig.getRecentlyUsedContentAssistant(sqlTextViewer);
recentlyUsedSQLcontentAssistant.install(sqlTextViewer);
formatHandler = new TextViewerOperationHandler(sqlTextViewer, ISourceViewer.FORMAT);
contentAssistHandler = new TextViewerOperationHandler(sqlTextViewer, ISourceViewer.CONTENTASSIST_PROPOSALS);
text = (StyledText) sqlTextViewer.getTextWidget();
text.setIndent(1);
text.setData(SQL_EDITOR_FLAG, sqlTextViewer);
createContextMenu();
addListener();
}
use of org.eclipse.swt.layout.FillLayout in project cubrid-manager by CUBRID.
the class InformationWindow method createContents.
protected Control createContents(Composite parent) {
final Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(new FillLayout());
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
infoText = new StyledText(composite, SWT.None);
infoText.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
infoText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
infoText.setEditable(false);
infoText.setEnabled(false);
infoText.addMouseTrackListener(new MouseTrackListener() {
public void mouseHover(MouseEvent e) {
increaseAlpha();
}
public void mouseExit(MouseEvent e) {
reduceAlpha();
}
public void mouseEnter(MouseEvent e) {
increaseAlpha();
}
});
parentShell.addControlListener(new ControlListener() {
public void controlResized(ControlEvent e) {
updateLocation();
}
public void controlMoved(ControlEvent e) {
updateLocation();
}
});
if (Platform.getOS().equals(Platform.OS_WIN32)) {
parentShell.addPaintListener(new PaintListener() {
public void paintControl(PaintEvent e) {
updateLocation();
}
});
}
this.getShell().setAlpha(minAlpha);
updateLocation();
return parent;
}
use of org.eclipse.swt.layout.FillLayout in project cubrid-manager by CUBRID.
the class QueryRecordListComparator method createQueryTunerTab.
private void createQueryTunerTab(CTabFolder tabFolder) {
CTabItem item = new CTabItem(tabFolder, SWT.None | SWT.MULTI | SWT.V_SCROLL);
item.setText(Messages.tabItemQueryTuner);
tabFolder.setSelection(item);
SashForm form = new SashForm(tabFolder, SWT.HORIZONTAL);
item.setControl(form);
form.setLayout(new FillLayout());
/*Left composite*/
Composite leftComposite = new Composite(form, SWT.BORDER);
leftComposite.setLayout(new GridLayout());
/*Right composite*/
queryPlanContainer = new Composite(form, SWT.BORDER);
queryPlanContainer.setLayout(new FillLayout());
form.setWeights(new int[] { 40, 60 });
ToolBar toolBar = new ToolBar(leftComposite, SWT.None);
runItem = new ToolItem(toolBar, SWT.None);
runItem.setImage(CommonUIPlugin.getImage("icons/queryeditor/query_run.png"));
runItem.setDisabledImage(CommonUIPlugin.getImage("icons/queryeditor/query_run_disabled.png"));
runItem.setToolTipText(Messages.run);
runItem.setEnabled(false);
runItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
runQuery();
}
});
runPlanItem = new ToolItem(toolBar, SWT.None);
runPlanItem.setImage(CommonUIPlugin.getImage("icons/queryeditor/query_execution_plan.png"));
runPlanItem.setToolTipText(Messages.queryPlanTip);
runPlanItem.setEnabled(false);
runPlanItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
runQueryPlan();
}
});
saveQueryItem = new ToolItem(toolBar, SWT.None);
saveQueryItem.setImage(CommonUIPlugin.getImage("icons/queryeditor/file_save.png"));
saveQueryItem.setToolTipText(Messages.ttSaveQueryTuning);
saveQueryItem.setEnabled(false);
saveQueryItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
saveQueryRecord();
}
});
SashForm sashForm = new SashForm(leftComposite, SWT.VERTICAL);
sashForm.setBackground(SASH_COLOR);
sashForm.setLayout(new FillLayout());
sashForm.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
CompositeRuler ruler = new CompositeRuler();
LineNumberRulerColumn lineCol = new LineNumberRulerColumn();
lineCol.setBackground(ResourceManager.getColor(new RGB(236, 233, 216)));
ruler.addDecorator(0, lineCol);
sqlTextViewer = new SQLTextViewer(sashForm, ruler, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER, this);
viewerConfig = new SQLViewerConfiguration(this);
sqlTextViewer.configure(viewerConfig);
SQLDocument document = new SQLDocument();
IDocumentPartitioner partitioner = new FastPartitioner(new SQLPartitionScanner(), SQLPartitionScanner.getAllTypes());
document.setDocumentPartitioner(ISQLPartitions.SQL_PARTITIONING, partitioner);
partitioner.connect(document);
sqlTextViewer.setDocument(document);
undoManager = new TextViewerUndoManager(50);
undoManager.connect(sqlTextViewer);
contentAssistant = viewerConfig.getContentAssistant(sqlTextViewer);
contentAssistant.install(sqlTextViewer);
recentlyUsedSQLcontentAssistant = viewerConfig.getRecentlyUsedContentAssistant(sqlTextViewer);
recentlyUsedSQLcontentAssistant.install(sqlTextViewer);
formatHandler = new TextViewerOperationHandler(sqlTextViewer, ISourceViewer.FORMAT);
contentAssistHandler = new TextViewerOperationHandler(sqlTextViewer, ISourceViewer.CONTENTASSIST_PROPOSALS);
StyledText text = (StyledText) sqlTextViewer.getTextWidget();
text.setIndent(1);
text.setData(SQL_EDITOR_FLAG, sqlTextViewer);
addTextViewerListener(text);
queryResultContainer = new Composite(sashForm, SWT.None);
queryResultContainer.setLayout(new FillLayout());
displayQuery(null);
displayQueryPlan(null);
}
Aggregations