use of com.amalto.workbench.widgets.DescAnnotationComposite in project tmdm-studio-se by Talend.
the class DataModelMainPage method createCharacteristicsContent.
protected void createCharacteristicsContent(FormToolkit toolkit, Composite mainComposite) {
try {
GridLayout layout = new GridLayout();
layout.verticalSpacing = 0;
mainComposite.getParent().setLayout(layout);
GridData gdMainComposite = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
gdMainComposite.widthHint = 1;
gdMainComposite.heightHint = 1;
mainComposite.setLayoutData(gdMainComposite);
WSDataModel wsObject = (WSDataModel) (xobject.getWsObject());
// description
Composite descriptionComposite = toolkit.createComposite(mainComposite, SWT.NONE);
descriptionComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));
descriptionComposite.setLayout(new GridLayout());
desAntionComposite = new // $NON-NLS-1$
DescAnnotationComposite(// $NON-NLS-1$
Messages.DescriptionText, // $NON-NLS-1$
" ...", // $NON-NLS-1$
toolkit, // $NON-NLS-1$
descriptionComposite, null, false);
// $NON-NLS-1$
desAntionComposite.setText(wsObject.getDescription() == null ? "" : wsObject.getDescription());
desAntionComposite.getTextWidget().addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
markDirty();
}
});
desAntionComposite.setEnable(!isReadOnly());
Composite btnCmp = toolkit.createComposite(mainComposite);
btnCmp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));
GridLayout gLayout = new GridLayout();
gLayout.numColumns = 4;
gLayout.horizontalSpacing = 20;
gLayout.verticalSpacing = 0;
btnCmp.setLayout(gLayout);
xsdSchema = getXSDSchema(wsObject.getXsdSchema());
createSash(mainComposite);
hookSelectionProvider();
if (!isReadOnly()) {
createCompDropTarget();
hookContextMenu();
hookDoubleClickAction();
hookTypesContextMenu();
}
// init undo history
initializeOperationHistory();
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
use of com.amalto.workbench.widgets.DescAnnotationComposite in project tmdm-studio-se by Talend.
the class TransformerMainPage method createCharacteristicsContent.
@Override
protected void createCharacteristicsContent(final FormToolkit toolkit, Composite topComposite) {
try {
initTransformer();
descriptionComposite = toolkit.createComposite(topComposite, SWT.NONE);
descriptionComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
descriptionComposite.setLayout(new GridLayout(3, false));
// edit by ymli; fix the bug:0012024 Make Process descriptions multilingual.
// description
/*
* Label descriptionLabel = toolkit.createLabel(descriptionComposite, "Description", SWT.NULL);
* descriptionLabel.setLayoutData( new GridData(SWT.FILL,SWT.CENTER,false,true,1,1) ); descriptionText =
* toolkit.createText(descriptionComposite, "",SWT.BORDER|SWT.MULTI); descriptionText.setLayoutData( new
* GridData(SWT.FILL,SWT.FILL,true,true,1,1) ); ((GridData)descriptionText.getLayoutData()).minimumHeight =
* 30; descriptionText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { if
* (refreshing) return; //commit as we go TransformerMainPage.this.comitting= true;
* //((WSTransformerV2)getXObject().getWsObject()) transformer.setDescription(descriptionText.getText());
* TransformerMainPage.this.comitting= false; //markDirtyWithoutCommit(); markDirtyWithoutCommit(); } });
*/
desAntionComposite = new DescAnnotationComposite(Messages.TransformerMainPage_Description, // $NON-NLS-1$
" ...", // $NON-NLS-1$
toolkit, // $NON-NLS-1$
descriptionComposite, this, false);
desAntionComposite.getTextWidget().addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
if (refreshing) {
return;
}
TransformerMainPage.this.comitting = true;
transformer.setDescription(desAntionComposite.getText());
TransformerMainPage.this.comitting = false;
markDirtyWithoutCommit();
}
});
// make the Page window a DropTarget - we need to dispose it
windowTarget = new DropTarget(this.getPartControl(), DND.DROP_MOVE);
windowTarget.setTransfer(new Transfer[] { TextTransfer.getInstance() });
windowTarget.addDropListener(new DCDropTargetListener());
sequenceGroup = this.getNewSectionComposite(Messages.TransformerMainPage_StepsSequence);
sequenceGroup.setLayout(new GridLayout(1, false));
Composite sequenceComposite = toolkit.createComposite(sequenceGroup, SWT.NONE);
sequenceComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
sequenceComposite.setLayout(new GridLayout(6, false));
Label l3 = toolkit.createLabel(sequenceComposite, Messages.TransformerMainPage_StepDesc, SWT.NULL);
l3.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, true, 1, 1));
// $NON-NLS-1$
stepText = toolkit.createText(sequenceComposite, "", SWT.BORDER | SWT.SINGLE);
stepText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 4, 1));
stepText.addKeyListener(new KeyListener() {
public void keyPressed(KeyEvent e) {
}
public void keyReleased(KeyEvent e) {
if (e.keyCode == 13) {
// enter
performAdd();
int index = stepsList.getItemCount() - 1;
performSelect(index);
}
}
});
// $NON-NLS-1$
Button addStepButton = toolkit.createButton(sequenceComposite, "", SWT.PUSH);
addStepButton.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, false, true, 1, 1));
addStepButton.setToolTipText(Messages.TransformerMainPage_Add);
addStepButton.setImage(ImageCache.getCreatedImage(EImage.ADD_OBJ.getPath()));
addStepButton.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
}
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
// commit as we go
performAdd();
}
});
stepsList = new List(sequenceComposite, SWT.V_SCROLL | SWT.BORDER);
stepsList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 5, 1));
((GridData) stepsList.getLayoutData()).heightHint = 40;
/*
* DragSource stepsSource = new DragSource(stepsList,DND.DROP_MOVE); stepsSource.setTransfer(new
* Transfer[]{TextTransfer.getInstance()}); stepsSource.addDragListener(new DCDragSourceListener());
*/
stepsList.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
public void widgetSelected(SelectionEvent e) {
performSelect(stepsList.getSelectionIndex());
}
});
wrap.Wrap(this, stepsList);
stepsList.addFocusListener(new FocusListener() {
public void focusGained(FocusEvent e) {
if (stepsList.getSelectionIndex() >= 0) {
refreshStep(stepsList.getSelectionIndex());
section.setVisible(true);
}
}
public void focusLost(FocusEvent e) {
}
});
Composite stepUpDownComposite = toolkit.createComposite(sequenceComposite, SWT.NONE);
stepUpDownComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1));
stepUpDownComposite.setLayout(new GridLayout(1, false));
// $NON-NLS-1$
Button stepUpButton = toolkit.createButton(stepUpDownComposite, "", SWT.PUSH | SWT.CENTER);
stepUpButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1));
stepUpButton.setImage(ImageCache.getCreatedImage(EImage.PREV_NAV.getPath()));
stepUpButton.setToolTipText(Messages.TransformerMainPage_MoveUpTheItem);
stepUpButton.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
}
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
int index = TransformerMainPage.this.stepsList.getSelectionIndex();
if (index > 0) {
// commit as we go
TransformerMainPage.this.comitting = true;
String val = TransformerMainPage.this.stepsList.getItem(index);
TransformerMainPage.this.stepsList.remove(index);
TransformerMainPage.this.stepsList.add(val, index - 1);
TransformerMainPage.this.stepsList.select(index - 1);
// (WSTransformerV2)getXObject().getWsObject();
WSTransformerV2 wsTransformer = transformer;
java.util.List<WSTransformerProcessStep> list = wsTransformer.getProcessSteps();
WSTransformerProcessStep spec = list.get(index);
list.remove(index);
list.add(index - 1, spec);
performSelect(index - 1);
TransformerMainPage.this.comitting = false;
TransformerMainPage.this.stepsList.forceFocus();
markDirtyWithoutCommit();
}
}
});
// $NON-NLS-1$
Button stepDownButton = toolkit.createButton(stepUpDownComposite, "", SWT.PUSH | SWT.CENTER);
stepDownButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1));
stepDownButton.setImage(ImageCache.getCreatedImage(EImage.NEXT_NAV.getPath()));
stepDownButton.setToolTipText(Messages.TransformerMainPage_MoveDownTheItem);
stepDownButton.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
}
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
int index = TransformerMainPage.this.stepsList.getSelectionIndex();
if ((index >= 0) && (index < TransformerMainPage.this.stepsList.getItemCount() - 1)) {
// commit as we go
TransformerMainPage.this.comitting = true;
String val = TransformerMainPage.this.stepsList.getItem(index);
TransformerMainPage.this.stepsList.remove(index);
TransformerMainPage.this.stepsList.add(val, index + 1);
TransformerMainPage.this.stepsList.select(index + 1);
// (WSTransformerV2)getXObject().getWsObject();
WSTransformerV2 wsTransformer = transformer;
java.util.List<WSTransformerProcessStep> list = wsTransformer.getProcessSteps();
WSTransformerProcessStep spec = list.get(index);
list.remove(index);
list.add(index + 1, spec);
TransformerMainPage.this.comitting = false;
TransformerMainPage.this.stepsList.forceFocus();
markDirtyWithoutCommit();
}
}
});
// $NON-NLS-1$
Button deleteStepButton = toolkit.createButton(stepUpDownComposite, "", SWT.PUSH | SWT.CENTER);
deleteStepButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1));
deleteStepButton.setImage(ImageCache.getCreatedImage(EImage.DELETE_OBJ.getPath()));
deleteStepButton.setToolTipText(Messages.TransformerMainPage_DelTheItem);
deleteStepButton.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
}
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
int index = TransformerMainPage.this.stepsList.getSelectionIndex();
if ((index >= 0) && (index < TransformerMainPage.this.stepsList.getItemCount())) {
removeStep(index);
}
}
});
// Plugin Specifications
// Sequence
section = this.getNewSection(Messages.TransformerMainPage_StepSpecification);
section.setVisible(false);
sequenceGroup.setLayout(new GridLayout(4, false));
disabledButton = toolkit.createButton((Composite) section.getClient(), Messages.TransformerMainPage_Disabled, SWT.CHECK);
disabledButton.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, true, 4, 1));
specsComposite = toolkit.createComposite((Composite) section.getClient(), SWT.NULL);
specsComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
specsComposite.setLayout(new GridLayout(4, false));
disabledButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
WidgetUtils.enable(specsComposite, !disabledButton.getSelection());
markDirtyWithoutCommit();
if (stepsList.getSelectionIndex() >= 0) {
transformer.getProcessSteps().get(stepsList.getSelectionIndex()).setDisabled(disabledButton.getSelection());
}
}
});
// $NON-NLS-1$
stepLabel = toolkit.createLabel(specsComposite, "", SWT.NULL);
stepLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 4, 1));
FontData fd = stepLabel.getFont().getFontData()[0];
fd.setStyle(SWT.BOLD);
stepLabel.setFont(new Font(Display.getDefault(), fd));
stepWidget = new TransformerStepWidget(toolkit, specsComposite);
stepWidget.create();
btnAutoIndent = new Button(specsComposite, SWT.CHECK);
btnAutoIndent.setText(Messages.TransformerMainPage_AutoIndent);
btnAutoIndent.setImage(ImageCache.getCreatedImage(EImage.INTENT.getPath()));
btnAutoIndent.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
// refreshAutoIndentTooltip();
btnAutoIndent.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
refreshAutoIndentTooltip();
}
});
btnOpenXsltEditor = new Button(specsComposite, SWT.PUSH);
btnOpenXsltEditor.setText(Messages.TransformerMainPage_open);
btnOpenXsltEditor.setToolTipText(Messages.TransformerMainPage_opentext);
btnOpenXsltEditor.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
btnOpenXsltEditor.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
openInXSLTEditor();
}
public void openInXSLTEditor() {
refreshEnableState(false);
try {
// $NON-NLS-1$
IPreferenceStore preference = new ScopedPreferenceStore(new InstanceScope(), "org.eclipse.wst.xsl.ui");
// $NON-NLS-1$
String charSet = preference.getString("outputCodeset");
String xslcontent = parameterEditor.getContent().getContent();
IFile file = FileProvider.createdTempFile(xslcontent, getXSLTFileName(), charSet);
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
xsltEditorInput = new XSLTFileEditorInput(file, new MainPageRefresher(), true);
page.openEditor(xsltEditorInput, XSLTEditor.ID);
} catch (PartInitException e) {
log.error(e.getMessage(), e);
}
}
});
Group parametersGroup = new Group(specsComposite, SWT.SHADOW_NONE);
parametersGroup.setText(Messages.TransformerMainPage_Parameters);
parametersGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 4, 1));
((GridData) parametersGroup.getLayoutData()).minimumHeight = 300;
parametersGroup.setLayout(new GridLayout(1, true));
parameterEditor = new ExtensibleContentEditor(parametersGroup, SWT.NONE, EXCONTENTEDITOR_ID);
parameterEditor.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 4, 1));
parameterEditorListener = new ProcessPluginParameterEditorListener();
refreshParameterEditor();
refreshData();
addToolBarItem();
this.oldBackground = parameterEditor.getBackground();
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
use of com.amalto.workbench.widgets.DescAnnotationComposite in project tmdm-studio-se by Talend.
the class ViewMainPage method createCharacteristicsContent.
@Override
protected void createCharacteristicsContent(FormToolkit toolkit, Composite charComposite) {
try {
Composite descriptionComposite = toolkit.createComposite(charComposite, SWT.NONE);
descriptionComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
descriptionComposite.setLayout(new GridLayout());
desAntionComposite = new DescAnnotationComposite(Messages.ViewMainPage_Description, // $NON-NLS-1$
" ...", // $NON-NLS-1$
toolkit, // $NON-NLS-1$
descriptionComposite, // $NON-NLS-1$
this, false);
Composite comp = toolkit.createComposite(descriptionComposite);
GridLayout layout = new GridLayout(2, false);
layout.marginWidth = 0;
layout.marginLeft = 0;
layout.marginTop = 0;
layout.marginHeight = 0;
layout.marginBottom = 0;
comp.setLayout(layout);
comp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
btnRunProcess = toolkit.createButton(comp, Messages.ViewMainPage_RunResultThroughProcess, SWT.CHECK);
btnRunProcess.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, true, 1, 1));
cboProcessList = new Combo(comp, SWT.READ_ONLY | SWT.DROP_DOWN | SWT.SINGLE);
cboProcessList.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, true, 1, 1));
initProcessCombo();
createSortPart(toolkit, comp);
if (adapter != null) {
adapter.createComposite(this, toolkit, comp);
}
// add listener
btnRunProcess.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
cboProcessList.setEnabled(btnRunProcess.getSelection());
markDirtyWithoutCommit();
}
public void widgetDefaultSelected(SelectionEvent e) {
cboProcessList.setEnabled(btnRunProcess.getSelection());
markDirtyWithoutCommit();
}
});
cboProcessList.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
markDirtyWithoutCommit();
}
});
// make the Page window a DropTarget - we need to dispose it
windowTarget = new DropTarget(this.getPartControl(), DND.DROP_MOVE);
windowTarget.setTransfer(new Transfer[] { TextTransfer.getInstance() });
windowTarget.addDropListener(new DCDropTargetListener());
/**
**
* /viewable Business Elements
***
*/
TreeParent treeParent = (TreeParent) getAdapter(TreeParent.class);
Composite viewablehGroup = this.getNewSectionComposite(Messages.ViewMainPage_ViewableBusinessElements);
viewablehGroup.setLayout(new GridLayout(2, false));
viewableElementColumns[0].setColumnWidth(220);
viewableViewer = getNewTisTableViewer(viewablehGroup, toolkit, Arrays.asList(viewableElementColumns));
viewableViewer.setTreeParent(treeParent);
viewableViewer.setXpath(true);
if (viewName.startsWith(Messages.ViewMainPage_BrowseItems)) {
// $NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
concept = viewName.replaceAll("Browse_items_", "").replaceAll("#.*", "");
}
viewableViewer.setConceptName(concept);
viewableViewer.setMainPage(this);
viewableViewer.setAddMulti(true);
viewableViewer.create();
viewableViewer.setHeight(110);
// wrap.Wrap(this, viewableViewer);
Composite searchGroup = this.getNewSectionComposite(Messages.ViewMainPage_SearchableBusinessElements);
searchGroup.setLayout(new GridLayout(2, false));
searchableElementColumns[0].setColumnWidth(220);
searchableViewer = getNewTisTableViewer(searchGroup, toolkit, Arrays.asList(searchableElementColumns));
searchableViewer.setTreeParent(treeParent);
searchableViewer.setXpath(true);
searchableViewer.setConceptName(concept);
searchableViewer.setMainPage(this);
searchableViewer.setAddMulti(true);
searchableViewer.create();
searchableViewer.setHeight(110);
// wrap.Wrap(this, searchableViewer);
// Where Conditions
// if(viewName.startsWith("Browse_items_"))
// setCompositeView(false);
// else
setCompositeView(true);
initCoditionsColumns();
Composite wcGroup = this.getNewSectionComposite(Messages.ViewMainPage_WhereConditions);
wcGroup.setLayout(new GridLayout(2, false));
conditionsColumns[0].setColumnWidth(250);
conditionsColumns[1].setColumnWidth(150);
conditionsColumns[2].setColumnWidth(250);
conditionsColumns[3].setColumnWidth(120);
conditionViewer = getNewTisTableViewer(wcGroup, toolkit, Arrays.asList(conditionsColumns));
conditionViewer.setTreeParent(treeParent);
conditionViewer.setXpath(true);
conditionViewer.setConceptName(concept);
conditionViewer.setMainPage(this);
conditionViewer.setAddMulti(true);
conditionViewer.create();
conditionViewer.setHeight(110);
// wrap.Wrap(this, conditionViewer);
addToolBarItem();
refreshData();
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
Aggregations