use of org.eclipse.swt.custom.SashForm in project tdi-studio-se by Talend.
the class MapperUI method createWindow.
public Shell createWindow(final Display display) {
Shell activeShell = display.getActiveShell();
int style = SWT.DIALOG_TRIM | SWT.MIN | SWT.MAX | SWT.APPLICATION_MODAL | SWT.RESIZE;
if (activeShell == null) {
mapperShell = new Shell(mapperShell, style);
} else {
mapperShell = new Shell(activeShell, style);
}
mapperShell.addShellListener(new ShellListener() {
@Override
public void shellActivated(ShellEvent e) {
}
@Override
public void shellClosed(ShellEvent e) {
if (editor != null && editor.isDirty() && !closeWithoutPrompt) {
boolean closeWindow = MessageDialog.openConfirm(mapperShell, "Close without save", Messages.getString("MapperUI.CloseWindow.Message"));
if (!closeWindow) {
e.doit = false;
} else {
prepareClosing(SWT.CANCEL);
}
}
}
@Override
public void shellDeactivated(ShellEvent e) {
}
@Override
public void shellDeiconified(ShellEvent e) {
}
@Override
public void shellIconified(ShellEvent e) {
}
});
mapperShell.setMaximized(true);
mapperShell.setImage(CoreImageProvider.getComponentIcon(mapperComponent.getComponent(), ICON_SIZE.ICON_32));
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
String productName = brandingService.getFullProductName();
mapperShell.setText(productName + " - " + mapperComponent.getComponent().getName() + " - " + //$NON-NLS-1$
mapperComponent.getUniqueName());
GridLayout parentLayout = new GridLayout(1, true);
mapperShell.setLayout(parentLayout);
// Composite composite = new Composite(mapperShell, SWT.NONE);
// composite.setBackground(display.getSystemColor(SWT.COLOR_YELLOW));
mainSashForm = new SashForm(mapperShell, SWT.SMOOTH | SWT.VERTICAL);
GridData mainSashFormGridData = new GridData(GridData.FILL_BOTH);
mainSashForm.setLayoutData(mainSashFormGridData);
datasViewSashForm = new SashForm(mainSashForm, SWT.SMOOTH | SWT.HORIZONTAL | SWT.BORDER);
editor = new XmlMapEditor(mapperManager);
editor.createPartControl(datasViewSashForm);
if (copyOfMapData.getVarTables().isEmpty()) {
VarTable varTable1 = XmlmapFactory.eINSTANCE.createVarTable();
varTable1.setName("Var");
varTable1.setMinimized(true);
copyOfMapData.getVarTables().add(varTable1);
}
editor.setContent(copyOfMapData);
tabFolderEditors = new TabFolderEditors(mainSashForm, mapperManager, SWT.BORDER);
// selectFirstInOutTree();
mainSashForm.setWeights(new int[] { 70, 30 });
footerComposite = new FooterComposite(mapperShell, this);
footerComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
mapperShell.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
ColorProviderMapper.releaseColors();
FontProviderMapper.releaseFonts();
ImageProviderMapper.releaseImages();
}
});
editor.makeDefaultSelection();
mapperShell.open();
return mapperShell;
}
use of org.eclipse.swt.custom.SashForm in project tdi-studio-se by Talend.
the class MultiSchemasUI method createHeaderSashForm.
private void createHeaderSashForm(Composite headerComposite) {
GridLayout layout;
headerSashForm = new SashForm(headerComposite, SWT.NONE);
headerSashForm.setLayout(new FillLayout());
headerSashForm.setLayoutData(new GridData(GridData.FILL_BOTH));
headerSashForm.setSashWidth(ExternalMultiSchemasUIProperties.SASHFORM_WIDTH);
//
multiSchemasFilePreview = new MultiSchemasShadowProcessPreview(this, headerSashForm);
multiSchemasFilePreview.newTablePreview();
Composite struComp = new Composite(headerSashForm, SWT.NONE);
layout = new GridLayout();
layout.marginWidth = 0;
layout.marginHeight = 0;
struComp.setLayout(layout);
headerSashForm.setWeights(ExternalMultiSchemasUIProperties.getHeaderSashformWeights());
//
fetchBtn = new Button(struComp, SWT.PUSH);
fetchBtn.setText(ExternalMultiSchemasUIProperties.FETCH_LABEL);
fetchBtn.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
//
schemaTreeViewer = new TreeViewer(struComp, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
Tree tree = schemaTreeViewer.getTree();
tree.setLayoutData(new GridData(GridData.FILL_BOTH));
tree.setHeaderVisible(true);
tree.setLinesVisible(true);
schemaTreeViewer.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS);
// SchemasTreeDnD dnd = new SchemasTreeDnD(schemaTreeViewer);
// dnd.addDragAndDrop();
schemaTreeViewer.setContentProvider(new SchemasTreeContentProvider());
schemaTreeViewer.setLabelProvider(new SchemasTreeLabelProvider());
// schemaTreeViewer.setSorter(new ViewerSorter() {
//
// @SuppressWarnings("unchecked")
// @Override
// public int compare(Viewer viewer, Object e1, Object e2) {
// if (e1 instanceof SchemasKeyData && e2 instanceof SchemasKeyData) {
// return getComparator().compare(((SchemasKeyData) e1).getKeyName(), ((SchemasKeyData) e2).getKeyName());
// }
// return super.compare(viewer, e1, e2);
// }
//
// });
TreeColumn column = new TreeColumn(tree, SWT.LEFT);
column.setWidth(55);
//$NON-NLS-1$
column.setText("Schema");
column.setResizable(true);
column = new TreeColumn(tree, SWT.LEFT);
column.setWidth(100);
//$NON-NLS-1$
column.setText("Record");
column.setResizable(true);
column = new TreeColumn(tree, SWT.LEFT);
column.setWidth(20);
//$NON-NLS-1$
column.setText("Separator");
column.setResizable(true);
schemaTreeViewer.setColumnProperties(new String[] { ExternalMultiSchemasUIProperties.COLUMN_KEY, ExternalMultiSchemasUIProperties.COLUMN_RECORD, ExternalMultiSchemasUIProperties.COLUMN_SEPARATOR });
// hywang for 10263
int columnCount = schemaTreeViewer.getTree().getColumnCount();
CellEditor[] editors = new CellEditor[columnCount];
for (int i = 0; i < columnCount; i++) {
editors[i] = new TextCellEditor(schemaTreeViewer.getTree());
}
schemaTreeViewer.setCellEditors(editors);
schemaTreeViewer.setCellModifier(new ICellModifier() {
public void modify(Object element, String property, Object value) {
if (element != null) {
if (element instanceof TreeItem) {
TreeItem item = (TreeItem) element;
if (item.getData() != null) {
if (item.getData() instanceof SchemasKeyData) {
SchemasKeyData key = (SchemasKeyData) item.getData();
if (property.equals(ExternalMultiSchemasUIProperties.COLUMN_KEY)) {
final boolean flag = checkKeyValue(key.getUniqueRecord(), value.toString());
if (flag) {
key.setUniqueRecord(value.toString());
}
}
if (property.equals(ExternalMultiSchemasUIProperties.COLUMN_RECORD)) {
key.setRecordType(value.toString());
}
if (property.equals(ExternalMultiSchemasUIProperties.COLUMN_SEPARATOR)) {
key.setSeparator(value.toString());
}
// Object input = schemaTreeViewer.getInput();
// SchemasKeyData in = (SchemasKeyData) input;
// if (in.getChildren().contains(key)) {
// in.getChildren().remove(in.getChildren().indexOf(key));
// List<MultiMetadataColumn> colums = multiSchemaManager.createPropertiesColumns(key);
// key.setMetadataColumns(colums);
// in.getChildren().add(key);
// }
}
schemaTreeViewer.refresh();
}
}
}
}
public Object getValue(Object element, String property) {
String record = "";
if (element != null) {
if (element instanceof SchemasKeyData) {
SchemasKeyData key = (SchemasKeyData) element;
if (property.equals(ExternalMultiSchemasUIProperties.COLUMN_KEY)) {
record = key.getUniqueRecord();
}
if (property.equals(ExternalMultiSchemasUIProperties.COLUMN_RECORD)) {
record = key.getRecordType();
}
if (property.equals(ExternalMultiSchemasUIProperties.COLUMN_SEPARATOR)) {
record = key.getSeparator();
}
}
}
return record;
}
public boolean canModify(Object element, String property) {
return true;
}
});
Composite operateTreeComposite = new Composite(struComp, SWT.NONE);
operateTreeComposite.setLayout(new GridLayout(3, false));
operateTreeComposite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
addRow = new Button(operateTreeComposite, SWT.NONE);
addRow.setText("Add");
removeRow = new Button(operateTreeComposite, SWT.NONE);
removeRow.setText("Remove");
removeRow.setEnabled(false);
editSchema = new Button(operateTreeComposite, SWT.NONE);
editSchema.setText("Edit Columns");
editSchema.setEnabled(false);
Composite operation = new Composite(struComp, SWT.NONE);
operation.setLayout(new GridLayout(2, false));
operation.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
leftBtn = new Button(operation, SWT.PUSH);
leftBtn.setToolTipText("Left");
leftBtn.setImage(ImageProvider.getImage(EImage.LEFT_ICON));
leftBtn.setEnabled(false);
rightBtn = new Button(operation, SWT.PUSH);
rightBtn.setToolTipText("Right");
rightBtn.setImage(ImageProvider.getImage(EImage.RIGHT_ICON));
rightBtn.setEnabled(false);
}
use of org.eclipse.swt.custom.SashForm in project tdi-studio-se by Talend.
the class HL7UI method createContent.
/**
* Comment method "createContent".
*
* @param child
*/
private void createContent(Composite mainComposite) {
judgeRepository();
header = new HeaderComposite(mainComposite, SWT.NONE, this.filePath, startChar, endChar, hl7Manager, this.isRepository);
MsgToSchemaSash = new SashForm(mainComposite, SWT.HORIZONTAL | SWT.SMOOTH);
MsgToSchemaSash.setLayoutData(new GridData(GridData.FILL_BOTH));
MsgToSchemaSash.setBackgroundMode(SWT.INHERIT_FORCE);
addMessageViewer(MsgToSchemaSash, 300, 110);
addSchemaViewer(MsgToSchemaSash, 400, 110);
MsgToSchemaSash.setWeights(new int[] { 40, 60 });
linker = new HL7Tree2SchemaLinker(this.MsgToSchemaSash, this.isRepository);
linker.setMainui(this);
hl7SchemaEditorView.setLinker(linker);
GridData data2 = new GridData(GridData.FILL_HORIZONTAL);
data2.heightHint = 300;
hl7SchemaEditorView.initGraphicComponents();
final Composite tableEditorComposite = hl7SchemaEditorView.getMainComposite();
tableEditorComposite.setLayoutData(data2);
tableEditorComposite.setBackground(null);
//$NON-NLS-1$
metadataEditor = new MetadataEmfTableEditor("");
//$NON-NLS-1$
metadataEditor.setDefaultLabel("newColumn");
metadataEditor.registerDataList(new ArrayList());
hl7SchemaEditorView.setMetadataEditor(metadataEditor);
linker.init(messageViewer, hl7SchemaEditorView);
linker.setManager(hl7Manager);
initMessageTree();
new FooterComposite(mainComposite, SWT.NONE, hl7Manager);
initSchemaCombo(externalNode.getMetadataList());
initTableViewer();
initlinkers();
boolean jobReadOnly = externalNode.getProcess().isReadOnly();
if (externalNode.getOriginalNode().getJobletNode() != null) {
jobReadOnly = externalNode.getOriginalNode().isReadOnly();
}
if (jobReadOnly || isRepository) {
hl7SchemaEditorView.setReadOnly(true);
}
addModifylistener();
}
use of org.eclipse.swt.custom.SashForm in project tdi-studio-se by Talend.
the class CpuDumpEditor method refreshCallersCalleesPage.
/**
* Refreshes the callers/callees page.
*/
private void refreshCallersCalleesPage() {
Label label = null;
SashForm sashForm = null;
for (Control control : callersCalleesPageBook.getChildren()) {
if (control instanceof Label) {
label = (Label) control;
} else if (control instanceof SashForm) {
sashForm = (SashForm) control;
}
}
if (label == null || sashForm == null) {
//$NON-NLS-1$
throw new IllegalStateException("label and sashform cannot be null");
}
Control control = (cpuModel.getCallersCalleesTarget() == null) ? label : sashForm;
callersCalleesPageBook.showPage(control);
}
use of org.eclipse.swt.custom.SashForm in project tdi-studio-se by Talend.
the class ProcessView method createPartControl.
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
*/
@Override
public void createPartControl(Composite parent) {
this.parent = parent;
parent.setLayout(new FillLayout());
sash = new SashForm(parent, SWT.HORIZONTAL | SWT.SMOOTH);
sash.setLayoutData(new GridData(GridData.FILL_BOTH));
sash.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
GridLayout layout = new GridLayout();
sash.setLayout(layout);
Composite left = new Composite(sash, SWT.NONE);
left.setLayout(new FillLayout());
Composite right = new Composite(sash, SWT.NONE);
right.setLayout(new FormLayout());
FormData layouDatag = new FormData();
layouDatag.left = new FormAttachment(0, 0);
layouDatag.width = 32;
layouDatag.top = new FormAttachment(0, 0);
layouDatag.bottom = new FormAttachment(100, 0);
final Composite buttonComposite = new Composite(right, SWT.ERROR);
buttonComposite.setLayoutData(layouDatag);
buttonComposite.setLayout(new GridLayout());
Composite cotextCom = new Composite(right, SWT.NONE);
layouDatag = new FormData();
layouDatag.left = new FormAttachment(0, 32);
layouDatag.right = new FormAttachment(100, 0);
layouDatag.top = new FormAttachment(0, 0);
layouDatag.bottom = new FormAttachment(100, 0);
cotextCom.setLayoutData(layouDatag);
cotextCom.setLayout(new GridLayout());
tabFactory.initComposite(left, false);
moveButton = new Button(buttonComposite, SWT.PUSH);
//$NON-NLS-1$
moveButton.setText(">>");
moveButton.setToolTipText(Messages.getString("ProcessComposite.hideContext"));
final GridData layoutData = new GridData();
layoutData.verticalAlignment = GridData.CENTER;
layoutData.horizontalAlignment = GridData.CENTER;
layoutData.grabExcessHorizontalSpace = true;
layoutData.grabExcessVerticalSpace = true;
moveButton.setLayoutData(layoutData);
addListeners();
sash.setSashWidth(5);
sash.setWeights(new int[] { 18, 5 });
contextComposite = new ProcessContextComposite(cotextCom, SWT.NONE);
contextComposite.setBackground(right.getDisplay().getSystemColor(SWT.COLOR_WHITE));
// processComposite = new ProcessComposite(tabFactory.getTabComposite(), SWT.H_SCROLL | SWT.V_SCROLL |
// SWT.NO_FOCUS);
// dc = processComposite;
// createBasicComposite(tabFactory.getTabComposite(), element, null);
tabFactory.getTabComposite().layout();
tabFactory.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection selection = (IStructuredSelection) event.getSelection();
TalendPropertyTabDescriptor descriptor = (TalendPropertyTabDescriptor) selection.getFirstElement();
if (descriptor == null) {
return;
}
if (currentSelectedTab != null && (currentSelectedTab.getCategory() != descriptor.getCategory())) {
for (Control curControl : tabFactory.getTabComposite().getChildren()) {
curControl.dispose();
}
}
if (currentSelectedTab == null || currentSelectedTab.getCategory() != descriptor.getCategory() || selectedPrimary) {
currentSelectedTab = descriptor;
selectedPrimary = false;
createDynamicComposite(tabFactory.getTabComposite(), (Element) descriptor.getData(), descriptor.getCategory());
}
}
});
setElement();
IHandlerService handlerService = (IHandlerService) getSite().getService(IHandlerService.class);
IHandler handler1;
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
if (brandingService.getBrandingConfiguration().isAllowDebugMode()) {
Action debugAction = new DebugAction();
handler1 = new ActionHandler(debugAction);
handlerService.activateHandler(debugAction.getActionDefinitionId(), handler1);
}
Action killAction = new KillAction();
handler1 = new ActionHandler(killAction);
handlerService.activateHandler(killAction.getActionDefinitionId(), handler1);
FocusListener fl = new FocusListener() {
@Override
public void focusGained(FocusEvent e) {
//$NON-NLS-1$
log.trace(Messages.getString("ProcessView.gainFocusLog"));
IContextService contextService = (IContextService) RunProcessPlugin.getDefault().getWorkbench().getAdapter(IContextService.class);
//$NON-NLS-1$
ca = contextService.activateContext("talend.runProcess");
}
@Override
public void focusLost(FocusEvent e) {
//$NON-NLS-1$
log.trace(Messages.getString("ProcessView.lostFocusLog"));
if (ca != null) {
IContextService contextService = (IContextService) RunProcessPlugin.getDefault().getWorkbench().getAdapter(IContextService.class);
contextService.deactivateContext(ca);
}
}
};
addListenerOnChildren(parent, fl);
rubjobManager.setProcessShell(getSite().getShell());
contextManagerListener = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
if (RunProcessContextManager.PROP_ACTIVE.equals(evt.getPropertyName())) {
// rubjobManager.setBooleanTrace(false);
runningProcessChanged();
}
}
};
RunProcessPlugin.getDefault().getRunProcessContextManager().addPropertyChangeListener(contextManagerListener);
runAction = new RunAction();
}
Aggregations