use of org.talend.designer.business.diagram.custom.IDiagramModelService in project tdi-studio-se by Talend.
the class JobSettingsView method refresh.
public void refresh(boolean force, Object obj) {
if (force) {
cleanDisplay();
}
final IEditorPart activeEditor = getSite().getPage().getActiveEditor();
if (obj == null) {
if (activeEditor != null && activeEditor instanceof AbstractMultiPageTalendEditor) {
AbstractTalendEditor talendEditor = ((AbstractMultiPageTalendEditor) activeEditor).getTalendEditor();
IProcess process = talendEditor.getProcess();
if (process != null && process instanceof Element) {
this.selectedPrimary = true;
this.cleaned = force;
this.element = (Element) process;
// remove "Job" or "Joblet" from title
String title = activeEditor.getTitle();
if (title.startsWith(VIEW_NAME_JOBLET)) {
title = title.substring(VIEW_NAME_JOBLET.length() + 1);
} else if (title.startsWith(getViewNameLable())) {
title = title.substring(getViewNameLable().length() + 1);
}
setElement(element, title, null);
return;
}
} else {
IDiagramModelService diagramModelService = CorePlugin.getDefault().getDiagramModelService();
if (diagramModelService != null && diagramModelService.isBusinessDiagramEditor(activeEditor)) {
this.selectedPrimary = true;
this.cleaned = force;
IRepositoryViewObject object = retrieveBusiness(activeEditor);
if (object != null) {
//$NON-NLS-1$
String title = object.getLabel() + " " + object.getVersion();
Object type = object.getRepositoryObjectType();
setElement(activeEditor, type + SEPARATOR + title, null);
}
return;
}
}
} else {
this.selectedPrimary = true;
this.cleaned = force;
IRepositoryViewObject object = retrieveBusiness(activeEditor);
if (object != null) {
//$NON-NLS-1$
String title = object.getLabel() + " " + object.getVersion();
Object type = object.getRepositoryObjectType();
setElement(obj, type + SEPARATOR + title, null);
}
return;
}
cleanDisplay();
}
use of org.talend.designer.business.diagram.custom.IDiagramModelService in project tdi-studio-se by Talend.
the class ShowJobSettingsViewAction method run.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.Action#run()
*/
public void run() {
IWorkbench workbench = PlatformUI.getWorkbench();
IWorkbenchPage page = workbench.getActiveWorkbenchWindow().getActivePage();
try {
page.showView(getViewId());
JobSettingsView view = (JobSettingsView) page.findView(getViewId());
IDiagramModelService service = CorePlugin.getDefault().getDiagramModelService();
ISelection selection = service.getBusinessEditorSelection(page.getActiveEditor());
if (selection instanceof IStructuredSelection) {
Object firstElement = ((IStructuredSelection) selection).getFirstElement();
if (firstElement != null) {
BusinessType type = service.getBusinessModelType(firstElement);
if (type == BusinessType.CONNECTION || type == BusinessType.NOTE || type == BusinessType.SHAP) {
view.refresh(false, firstElement);
} else if (type == BusinessType.PROCESS || service.isInstanceOfCompartmentEditPart(firstElement)) {
view.refresh(false, PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor());
}
}
}
} catch (PartInitException e) {
// e.printStackTrace();
ExceptionHandler.process(e);
}
}
use of org.talend.designer.business.diagram.custom.IDiagramModelService in project tdi-studio-se by Talend.
the class BusinessAppearanceComposite method createTextAlignmentGroup.
private void createTextAlignmentGroup(Composite nearby) {
Composite alignComposite = widgetFactory.createFlatFormComposite(this);
alignComposite.setLayout(new GridLayout());
FormData thisFormData = new FormData();
thisFormData = new FormData();
thisFormData.left = new FormAttachment(2, 0);
thisFormData.right = new FormAttachment(100, 0);
thisFormData.top = new FormAttachment(nearby, 2);
thisFormData.bottom = new FormAttachment(100, 0);
alignComposite.setLayoutData(thisFormData);
Group textAlignment = widgetFactory.createGroup(alignComposite, Messages.getString(//$NON-NLS-1$
"BusinessAppearanceComposite.textAlignmentGroup"));
textAlignment.setBackground(getBackground());
textAlignment.setLayout(new GridLayout(2, false));
horizontalGroup = widgetFactory.createGroup(textAlignment, Messages.getString(//$NON-NLS-1$
"BusinessAppearanceComposite.textAlignment.horizontal"));
horizontalGroup.setLayout(new GridLayout(3, false));
leftBtn = widgetFactory.createButton(horizontalGroup, Messages.getString("BusinessAppearanceComposite.textAlignment.horizontal.left"), //$NON-NLS-1$
SWT.RADIO);
hCentre = widgetFactory.createButton(horizontalGroup, Messages.getString("BusinessAppearanceComposite.textAlignment.horizontal.centre"), //$NON-NLS-1$
SWT.RADIO);
rightBtn = widgetFactory.createButton(horizontalGroup, Messages.getString("BusinessAppearanceComposite.textAlignment.horizontal.right"), //$NON-NLS-1$
SWT.RADIO);
verticalGroup = widgetFactory.createGroup(textAlignment, Messages.getString(//$NON-NLS-1$
"BusinessAppearanceComposite.textAlignment.vertical"));
verticalGroup.setLayout(new GridLayout(3, false));
topBtn = widgetFactory.createButton(verticalGroup, Messages.getString("BusinessAppearanceComposite.textAlignment.vertical.top"), //$NON-NLS-1$
SWT.RADIO);
vCentre = widgetFactory.createButton(verticalGroup, Messages.getString("BusinessAppearanceComposite.textAlignment.vertical.centre"), //$NON-NLS-1$
SWT.RADIO);
bottomBtn = widgetFactory.createButton(verticalGroup, Messages.getString("BusinessAppearanceComposite.textAlignment.vertical.bottom"), //$NON-NLS-1$
SWT.RADIO);
Object obj = ((IStructuredSelection) selected).getFirstElement();
IDiagramModelService service = CorePlugin.getDefault().getDiagramModelService();
if (BusinessType.SHAP.equals(service.getBusinessModelType(obj))) {
String horizontalAlignment = service.getBusinessItemAlignment(obj, BusinessAlignment.HORIZONTAL);
if (horizontalAlignment == null) {
horizontalAlignment = BusinessAlignment.LEFT.toString();
}
leftBtn.setSelection(BusinessAlignment.LEFT.toString().equals(horizontalAlignment));
hCentre.setSelection(BusinessAlignment.HCENTRE.toString().equals(horizontalAlignment));
rightBtn.setSelection(BusinessAlignment.RIGHT.toString().equals(horizontalAlignment));
String verticalAlignment = service.getBusinessItemAlignment(obj, BusinessAlignment.VERTICAL);
if (verticalAlignment == null) {
verticalAlignment = BusinessAlignment.TOP.toString();
}
topBtn.setSelection(BusinessAlignment.TOP.toString().equals(verticalAlignment));
vCentre.setSelection(BusinessAlignment.VCENTRE.toString().equals(verticalAlignment));
bottomBtn.setSelection(BusinessAlignment.BOTTOM.toString().equals(verticalAlignment));
}
addListener();
}
use of org.talend.designer.business.diagram.custom.IDiagramModelService in project tdi-studio-se by Talend.
the class BusinessAppearanceComposite method ChangModels.
private void ChangModels(BusinessAlignment alignment, BusinessAlignment type) {
Object obj = ((IStructuredSelection) selected).getFirstElement();
IDiagramModelService service = CorePlugin.getDefault().getDiagramModelService();
if (BusinessType.SHAP.equals(service.getBusinessModelType(obj))) {
service.setBusinessItemAlignment(alignment, type, obj);
} else if (BusinessType.PROCESS.equals(service.getBusinessModelType(obj))) {
service.setBusinessItemsAlignment(alignment, type, obj);
}
}
Aggregations