use of org.eclipse.swt.custom.SashForm in project translationstudio8 by heartsome.
the class MatchViewPart method createPartControl.
@Override
public void createPartControl(Composite parent) {
GridLayout parentGl = new GridLayout(1, false);
parentGl.marginWidth = 0;
parentGl.marginHeight = 0;
parent.setLayout(parentGl);
final Composite composite = new Composite(parent, SWT.NONE);
GridLayout compositeGl = new GridLayout(1, false);
compositeGl.marginBottom = -1;
compositeGl.marginLeft = -1;
compositeGl.marginRight = -1;
compositeGl.marginTop = 0;
compositeGl.marginWidth = 0;
compositeGl.marginHeight = 0;
compositeGl.verticalSpacing = 0;
composite.setLayout(compositeGl);
composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
// sourceText = new StyledText(composite, SWT.BORDER | SWT.V_SCROLL | SWT.READ_ONLY);
// GridData sTextGd = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1);
// Font f = JFaceResources.getFont(net.heartsome.cat.ts.ui.Constants.MATCH_VIEWER_TEXT_FONT);
// sourceText.setFont(f);
// int lineH = sourceText.getLineHeight() * 3;
// sTextGd.heightHint = lineH;
// sTextGd.minimumHeight = lineH;
// sourceText.setLayoutData(sTextGd);
SashForm sashForm = new SashForm(composite, SWT.VERTICAL);
sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
sourceText = new SegmentViewer(sashForm, SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.READ_ONLY | SWT.V_SCROLL, null);
StyledText srcTextControl = sourceText.getTextWidget();
srcTextControl.setLineSpacing(net.heartsome.cat.ts.ui.Constants.SEGMENT_LINE_SPACING);
srcTextControl.setLeftMargin(net.heartsome.cat.ts.ui.Constants.SEGMENT_LEFT_MARGIN);
srcTextControl.setRightMargin(net.heartsome.cat.ts.ui.Constants.SEGMENT_RIGHT_MARGIN);
srcTextControl.setTopMargin(net.heartsome.cat.ts.ui.Constants.SEGMENT_TOP_MARGIN);
srcTextControl.setBottomMargin(net.heartsome.cat.ts.ui.Constants.SEGMENT_TOP_MARGIN);
srcTextControl.setFont(JFaceResources.getFont(net.heartsome.cat.ts.ui.Constants.MATCH_VIEWER_TEXT_FONT));
sourceText.setSource("");
sourceColunmCellRenderer.setSegmentViewer(sourceText);
GridData sTextGd = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1);
Font f = JFaceResources.getFont(net.heartsome.cat.ts.ui.Constants.MATCH_VIEWER_TEXT_FONT);
srcTextControl.setFont(f);
int lineH = srcTextControl.getLineHeight() * 2;
sTextGd.heightHint = lineH;
sTextGd.minimumHeight = lineH;
srcTextControl.setLayoutData(sTextGd);
net.heartsome.cat.ts.ui.innertag.tagstyle.TagStyleConfigurator.configure(sourceText);
gridTable = new Grid(sashForm, SWT.BORDER | SWT.V_SCROLL);
gridTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
gridTable.setHeaderVisible(false);
gridTable.setAutoHeight(true);
gridTable.setRowsResizeable(true);
gridTable.setData("selectedBgColor", selectedBgColor);
final GridColumn sourceCln = new GridColumn(gridTable, SWT.NONE);
sourceColunmCellRenderer.setFont(JFaceResources.getFont(net.heartsome.cat.ts.ui.Constants.MATCH_VIEWER_TEXT_FONT));
sourceCln.setCellRenderer(sourceColunmCellRenderer);
sourceCln.setText(Messages.getString("view.MatchViewPart.sourceCln"));
sourceCln.setWordWrap(true);
sourceCln.setAlignment(SWT.CENTER);
sourceCln.setResizeable(false);
final GridColumn typeCln = new GridColumn(gridTable, SWT.NONE);
typeColumnCellRenderer.setVerticalAlignment(SWT.CENTER);
typeCln.setCellRenderer(typeColumnCellRenderer);
typeCln.setText(Messages.getString("view.MatchViewPart.typeCln"));
typeCln.setWordWrap(true);
typeCln.setAlignment(SWT.CENTER);
typeCln.setResizeable(false);
final GridColumn targetCln = new GridColumn(gridTable, SWT.NONE);
targetColumnCellRenderer.setFont(JFaceResources.getFont(net.heartsome.cat.ts.ui.Constants.MATCH_VIEWER_TEXT_FONT));
targetCln.setCellRenderer(targetColumnCellRenderer);
targetCln.setText(Messages.getString("view.MatchViewPart.targetCln"));
targetCln.setWordWrap(true);
targetCln.setAlignment(SWT.CENTER);
targetCln.setResizeable(false);
// 设置可复制功能
copyEnable = new GridCopyEnable(gridTable);
sourceColunmCellRenderer.setCopyEnable(copyEnable);
targetColumnCellRenderer.setCopyEnable(copyEnable);
Composite statusComposite = new Composite(composite, SWT.NONE);
GridLayout statusComptGridLayout = new GridLayout(2, false);
statusComptGridLayout.marginBottom = -1;
statusComptGridLayout.marginLeft = -1;
statusComptGridLayout.marginRight = -1;
statusComptGridLayout.marginTop = -1;
statusComptGridLayout.marginWidth = 0;
statusComptGridLayout.marginHeight = 0;
statusComposite.setLayout(statusComptGridLayout);
statusComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
tipLabel = new CLabel(statusComposite, SWT.NONE);
tipLabel.setAlignment(SWT.LEFT);
infoLabel = new CLabel(statusComposite, SWT.NONE);
GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
gd.heightHint = 20;
infoLabel.setLayoutData(gd);
infoLabel.setAlignment(SWT.RIGHT);
// 设置列宽按比例4.5:1:4.5
composite.addControlListener(new ControlAdapter() {
public void controlResized(ControlEvent e) {
Rectangle area = composite.getClientArea();
Point preferredSize = gridTable.computeSize(SWT.DEFAULT, SWT.DEFAULT);
// - 2 * gridTable.getBorderWidth();
int width = area.width;
if (preferredSize.y > area.height + gridTable.getHeaderHeight()) {
Point vBarSize = gridTable.getVerticalBar().getSize();
width -= vBarSize.x;
}
gridTable.setSize(area.width, area.height);
width = width - 42;
sourceCln.setWidth((int) (width * 0.5));
typeCln.setWidth(42);
targetCln.setWidth((int) (width * 0.5));
}
});
gridTable.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
StyledText text = sourceText.getTextWidget();
text.setText(text.getText());
updateActionState();
GridItem[] selItems = gridTable.getSelection();
if (selItems.length != 1) {
return;
}
GridItem item = selItems[0];
setMatchMessage(infoLabelImage, item.getData("info").toString(), item.getData("infoTooltip").toString());
composite.layout();
}
});
gridTable.addListener(SWT.MouseDoubleClick, new Listener() {
public void handleEvent(Event event) {
menuMgr.acceptMatchAction.run();
}
});
createActions();
sashForm.setWeights(new int[] { 3, 8 });
}
use of org.eclipse.swt.custom.SashForm in project tdi-studio-se by Talend.
the class ErrorMessageDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
Composite createDialogArea = (Composite) super.createDialogArea(parent);
createDialogArea.setLayout(new FillLayout());
sashForm = new SashForm(createDialogArea, SWT.VERTICAL);
GridLayout sashGrid = new GridLayout();
sashGrid.numColumns = 5;
sashForm.setLayout(sashGrid);
sashForm.setSize(400, 200);
sashForm.pack();
// Composite comSimple = new Composite(sashForm, SWT.NONE);
// comSimple.pack();
// GridLayout simGrid = new GridLayout();
// simGrid.numColumns = 10;
// comSimple.setLayout(simGrid);
// imageLable = new Label(comSimple, SWT.WRAP);
// imageLable.setImage(ImageProvider.getImage(EImage.ERRORSIMPLEMESS_ICON));
// GridData imaData = new GridData(GridData.FILL_VERTICAL);
// imaData.horizontalSpan = 5;
// imageLable.setLayoutData(imaData);
// imageLable.pack();
// titleLable = new Label(comSimple, SWT.WRAP);
// GridData titleData = new GridData(GridData.FILL_BOTH);
// titleData.horizontalSpan = 5;
// titleLable.setLayoutData(titleData);
// titleLable.pack();
// String str[] = content.split("\n");//$NON-NLS-1$
// String simpleMess;
// if (LanguageManager.getCurrentLanguage().equals(ECodeLanguage.PERL)) {
// if (mergeNode.isCheckProperty()) {
// simpleMess = Messages.getString("ErrorMessageDialog.property_error") + mergeNode.getUniqueName(); //$NON-NLS-1$
// } else {
// if (str.length >= 1) {
// simpleMess = content.split("\n")[0];//$NON-NLS-1$
// } else {
// simpleMess = Messages.getString("ErrorMessageDialog.EXCEP_IN_COM") + mergeNode.getUniqueName();//$NON-NLS-1$
// }
// }
// titleLable.setText(simpleMess);
//
// } else if (LanguageManager.getCurrentLanguage().equals(ECodeLanguage.JAVA)) {
// if (mergeNode.isCheckProperty()) {
// simpleMess = Messages.getString("ErrorMessageDialog.property_error") + mergeNode.getUniqueName(); //$NON-NLS-1$
// } else {
// if (str.length >= 2) {
// simpleMess = content.split("\n")[0] + "\n" + content.split("\n")[1];//$NON-NLS-1$//$NON-NLS-1$//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
// } else {
// simpleMess = Messages.getString("ErrorMessageDialog.EXCEP_IN_COM") + mergeNode.getUniqueName();//$NON-NLS-1$
// }
// }
// titleLable.setText(simpleMess);
// }
//
// Composite comDetail = new Composite(sashForm, SWT.NONE);
// GridLayout detailGrid = new GridLayout();
// detailGrid.numColumns = 15;
// comDetail.setLayout(detailGrid);
// GridData dataBut = new GridData();
// dataBut.horizontalSpan = 15;
// button = new CLabel(comDetail, SWT.FLAT);
// button.pack();
// button.setText(Messages.getString("ErrorMessageDialog.DETAIL")); //$NON-NLS-1$
// button.setImage(ImageProvider.getImage(EImage.RIGHTPRESS_ICON));
textArea = new StyledText(sashForm, SWT.BORDER | SWT.WRAP | SWT.H_SCROLL | SWT.V_SCROLL | SWT.READ_ONLY);
textArea.pack();
if (content != null) {
textArea.setText(content);
} else {
textArea.setText("Error in the component's properties!");
}
textArea.setBackground(new Color(Display.getDefault(), new RGB(255, 255, 255)));
textArea.setForeground(new Color(Display.getDefault(), new RGB(255, 102, 102)));
// addButtonListener();
return createDialogArea;
}
use of org.eclipse.swt.custom.SashForm in project tdi-studio-se by Talend.
the class JobHierarchyViewPart method createPartControl.
@Override
public void createPartControl(Composite container) {
fParent = container;
addResizeListener(fParent);
fPagebook = new PageBook(container, SWT.NONE);
// page 1 of page book (no hierarchy label)
fNoHierarchyShownLabel = new Label(fPagebook, SWT.TOP + SWT.LEFT + SWT.WRAP);
fNoHierarchyShownLabel.setText(showEmptyLabel);
// page 2 of page book (viewers)
fTypeMethodsSplitter = new SashForm(fPagebook, SWT.VERTICAL);
fTypeMethodsSplitter.setVisible(false);
fTypeViewerViewForm = new ViewForm(fTypeMethodsSplitter, SWT.NONE);
Control typeViewerControl = createTypeViewerControl(fTypeViewerViewForm);
fTypeViewerViewForm.setContent(typeViewerControl);
dependencyViewerViewForm = new ViewForm(fTypeMethodsSplitter, SWT.NONE);
fTypeMethodsSplitter.setWeights(new int[] { 65, 35 });
Control dependencyViewerPart = createMethodViewerControl(dependencyViewerViewForm);
dependencyViewerViewForm.setContent(dependencyViewerPart);
dependencyViewerPaneLabel = new CLabel(dependencyViewerViewForm, SWT.NONE);
dependencyViewerViewForm.setTopLeft(dependencyViewerPaneLabel);
ToolBar methodViewerToolBar = new ToolBar(dependencyViewerViewForm, SWT.FLAT | SWT.WRAP);
dependencyViewerViewForm.setTopCenter(methodViewerToolBar);
initDragAndDrop();
MenuManager menu = new MenuManager();
menu.add(focusOnTypeAction);
fNoHierarchyShownLabel.setMenu(menu.createContextMenu(fNoHierarchyShownLabel));
fPagebook.showPage(fNoHierarchyShownLabel);
int layout;
try {
layout = fDialogSettings.getInt(DIALOGSTORE_VIEWLAYOUT);
if (layout < 0 || layout > 3) {
layout = VIEW_LAYOUT_AUTOMATIC;
}
} catch (NumberFormatException e) {
layout = VIEW_LAYOUT_AUTOMATIC;
}
// force the update
fCurrentLayout = -1;
// will fill the main tool bar
setViewLayout(layout);
// set the filter menu items
IActionBars actionBars = getViewSite().getActionBars();
IMenuManager viewMenu = actionBars.getMenuManager();
// for (int i = 0; i < fViewActions.length; i++) {
// ToggleViewAction action = fViewActions[i];
// viewMenu.add(action);
// action.setEnabled(false);
// }
// viewMenu.add(new Separator());
// IMenuManager layoutSubMenu = new MenuManager(TypeHierarchyMessages.TypeHierarchyViewPart_layout_submenu);
//$NON-NLS-1$
IMenuManager layoutSubMenu = new MenuManager(Messages.getString("FocusOnJobAction.TypeHierarchyViewPart_layout_submenu"));
viewMenu.add(layoutSubMenu);
for (int i = 0; i < fToggleOrientationActions.length; i++) {
layoutSubMenu.add(fToggleOrientationActions[i]);
}
viewMenu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
// selection provider
int nHierarchyViewers = fAllViewers.length;
StructuredViewer[] trackedViewers = new StructuredViewer[nHierarchyViewers + 1];
for (int i = 0; i < nHierarchyViewers; i++) {
trackedViewers[i] = fAllViewers[i];
}
trackedViewers[nHierarchyViewers] = dependencyViewer;
fSelectionProviderMediator = new SelectionProviderMediator(trackedViewers, getCurrentViewer());
getSite().setSelectionProvider(fSelectionProviderMediator);
ActionGroup[] actionGroups = new ActionGroup[] { new JobActionGroup() };
fActionGroups = new CompositeActionGroup(actionGroups);
fActionGroups.fillActionBars(actionBars);
}
use of org.eclipse.swt.custom.SashForm in project tdi-studio-se by Talend.
the class TabFolderEditors method createMetadataEditorTab.
/**
* DOC amaumont Comment method "createMetadataEditor".
*/
private void createMetadataEditorTab() {
CTabItem item = new CTabItem(tabFolderEditors, SWT.BORDER);
//$NON-NLS-1$
item.setText(Messages.getString("TabFolderEditors.schemaEditor"));
SashForm inOutMetaEditorContainer = new SashForm(tabFolderEditors, SWT.SMOOTH | SWT.HORIZONTAL | SWT.SHADOW_OUT);
inOutMetaEditorContainer.setLayout(new RowLayout(SWT.HORIZONTAL));
item.setControl(inOutMetaEditorContainer);
CommandStack commandStack = mapperManager.getCommandStack();
inputMetaEditor = new MetadataTableEditorView(inOutMetaEditorContainer, SWT.BORDER);
inputMetaEditor.setCurrentDbms(dbmsId);
inputMetaEditor.setShowDbTypeColumn(true, false, true);
inputMetaEditor.setShowDbColumnName(true, false);
inputMetaEditor.setShowPatternColumn(false);
inputMetaEditor.setShowTalendTypeColumn(false);
inputMetaEditor.initGraphicComponents();
inputMetaEditor.getExtendedTableViewer().setCommandStack(commandStack);
outputMetaEditor = new MetadataTableEditorView(inOutMetaEditorContainer, SWT.BORDER);
outputMetaEditor.setCurrentDbms(dbmsId);
outputMetaEditor.setShowDbTypeColumn(true, false, true);
outputMetaEditor.setShowDbColumnName(true, false);
outputMetaEditor.setShowTalendTypeColumn(false);
outputMetaEditor.setShowPatternColumn(false);
outputMetaEditor.initGraphicComponents();
outputMetaEditor.getExtendedTableViewer().setCommandStack(commandStack);
}
use of org.eclipse.swt.custom.SashForm in project tdi-studio-se by Talend.
the class TabFolderEditors method createComponents.
/**
* qzhang Comment method "createComponents".
*/
private void createComponents() {
CTabItem item = new CTabItem(tabFolderEditors, SWT.BORDER);
//$NON-NLS-1$
item.setText(Messages.getString("TabFolderEditors.FunParamTab.TitleText"));
inOutMetaEditorContainer = new SashForm(tabFolderEditors, SWT.SMOOTH | SWT.HORIZONTAL | SWT.SHADOW_OUT);
inOutMetaEditorContainer.setLayout(new RowLayout(SWT.HORIZONTAL));
item.setControl(inOutMetaEditorContainer);
createTableView();
item = new CTabItem(tabFolderEditors, SWT.BORDER);
//$NON-NLS-1$
item.setText(Messages.getString("TabFolderEditors.PreviewTab.TitleText"));
Composite composite = new Composite(tabFolderEditors, SWT.BORDER);
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 1;
composite.setLayout(gridLayout);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
createPreview(composite, 700, 210);
item.setControl(composite);
tabFolderEditors.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
lastSelectedTab = tabFolderEditors.getSelectionIndex();
}
});
tabFolderEditors.setSelection(0);
}
Aggregations