use of org.talend.designer.business.model.business.diagram.edit.parts.BusinessProcessEditPart in project tdi-studio-se by Talend.
the class BusinessModelingAssistantProvider method getTypesForPopupBar.
/**
* @generated
*/
public List getTypesForPopupBar(IAdaptable host) {
IGraphicalEditPart editPart = (IGraphicalEditPart) host.getAdapter(IGraphicalEditPart.class);
if (editPart instanceof BusinessProcessEditPart) {
List types = new ArrayList();
types.add(BusinessElementTypes.ActionBusinessItem_1001);
types.add(BusinessElementTypes.TerminalBusinessItem_1002);
types.add(BusinessElementTypes.DocumentBusinessItem_1003);
types.add(BusinessElementTypes.DatabaseBusinessItem_1004);
types.add(BusinessElementTypes.ListBusinessItem_1005);
types.add(BusinessElementTypes.DataBusinessItem_1006);
types.add(BusinessElementTypes.InputBusinessItem_1007);
types.add(BusinessElementTypes.DecisionBusinessItem_1008);
types.add(BusinessElementTypes.ActorBusinessItem_1009);
types.add(BusinessElementTypes.EllipseBusinessItem_1010);
types.add(BusinessElementTypes.GearBusinessItem_1011);
return types;
}
return Collections.EMPTY_LIST;
}
use of org.talend.designer.business.model.business.diagram.edit.parts.BusinessProcessEditPart in project tdi-studio-se by Talend.
the class BusinessLoadResourceAction method selectionChanged.
/**
* @generated
*/
public void selectionChanged(IAction action, ISelection selection) {
mySelectedElement = null;
if (selection instanceof IStructuredSelection) {
IStructuredSelection structuredSelection = (IStructuredSelection) selection;
if (structuredSelection.size() == 1 && structuredSelection.getFirstElement() instanceof BusinessProcessEditPart) {
mySelectedElement = (BusinessProcessEditPart) structuredSelection.getFirstElement();
}
}
action.setEnabled(isEnabled());
}
use of org.talend.designer.business.model.business.diagram.edit.parts.BusinessProcessEditPart in project tdi-studio-se by Talend.
the class ClipboardActionHandler method getCommand.
@Override
public ICommand getCommand(IGlobalActionContext cntxt) {
IWorkbenchPart part = cntxt.getActivePart();
if (!(part instanceof IDiagramWorkbenchPart)) {
return null;
}
IDiagramWorkbenchPart workbenchPart = (IDiagramWorkbenchPart) part;
DiagramEditPart diagramEditPart = workbenchPart.getDiagramEditPart();
ICommand command = null;
String actionId = cntxt.getActionId();
if (actionId.equals(GlobalActionId.COPY)) {
command = getCopyCommand(cntxt, workbenchPart, false);
transfer(cntxt.getSelection());
isCut = false;
older = workbenchPart;
orginalCopyFrom = workbenchPart;
clonedSourceProcessItemsList = new ArrayList<BusinessItem>(((BusinessProcess) ((Diagram) diagramEditPart.getModel()).getElement()).getBusinessItems());
} else if (actionId.equals(GlobalActionId.CUT) && cntxt.getSelection() != null) {
saveCut(cntxt.getSelection());
command = getCutCommand(cntxt, workbenchPart);
transfer(cntxt.getSelection());
isCut = true;
older = workbenchPart;
clonedSourceProcessItemsList = new ArrayList<BusinessItem>(((BusinessProcess) ((Diagram) diagramEditPart.getModel()).getElement()).getBusinessItems());
} else if (actionId.equals(GlobalActionId.SAVE)) {
if (workbenchPart instanceof IEditorPart) {
IEditorPart editorPart = (IEditorPart) workbenchPart;
if (editorPart.isDirty()) {
IWorkbenchPage page = editorPart.getSite().getPage();
page.saveEditor(editorPart, false);
}
}
}
if (actionId.equals(GlobalActionId.PASTE)) {
// diagramPart.getDiagramGraphicalViewer().setSelection(new
// StructuredSelection(diagramPart.getDiagramEditPart()));
PasteViewRequest pasteReq = createPasteViewRequest();
CommandStack cs = workbenchPart.getDiagramEditDomain().getDiagramCommandStack();
IStructuredSelection selection = (IStructuredSelection) cntxt.getSelection();
if (!(selection.getFirstElement() instanceof BusinessProcessEditPart)) {
selection = new StructuredSelection(workbenchPart.getDiagramEditPart());
}
Object[] objects = selection.toArray();
Collection returnValues = null;
if (objects.length == 1) {
Command paste = ((EditPart) objects[0]).getCommand(pasteReq);
if (paste != null) {
cs.execute(paste);
workbenchPart.getDiagramEditPart().getFigure().invalidate();
workbenchPart.getDiagramEditPart().getFigure().validate();
returnValues = DiagramCommandStack.getReturnValues(paste);
// selectAddedObject(diagramPart.getDiagramGraphicalViewer(), returnValues);
}
}
Object elements = TemplateTransfer.getInstance().getObject();
if (elements instanceof List) {
List<BusinessItem> list = (List<BusinessItem>) elements;
boolean inEditors = false;
if (older != workbenchPart) {
inEditors = true;
} else if (!this.isCut && orginalCopyFrom != workbenchPart) {
// bug 16065 fixed, by xtan. to resolve the copy(A)/parse(B)/parse(B)/parse(B)... problem.
inEditors = true;
}
// always keep the last one as the current selection.
older = workbenchPart;
GmfPastCommand pastBusiness = new GmfPastCommand((BusinessProcess) ((Diagram) diagramEditPart.getModel()).getElement(), list, diagramEditPart, this.cutItemIds, this.isCut | inEditors);
pastBusiness.setClonedSourceProcessItemsList(clonedSourceProcessItemsList);
try {
pastBusiness.execute(null, null);
} catch (ExecutionException e) {
ExceptionHandler.process(e);
}
}
if (returnValues != null) {
selectAddedObject(workbenchPart.getDiagramGraphicalViewer(), returnValues);
}
return null;
}
return command;
}
use of org.talend.designer.business.model.business.diagram.edit.parts.BusinessProcessEditPart in project tdi-studio-se by Talend.
the class BusinessDiagramEditor method selectionChanged.
@Override
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
super.selectionChanged(part, selection);
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
JobSettingsView view = (JobSettingsView) page.findView(JobSettingsView.ID);
getDiagramEditorInput().getItem().getProperty().eAdapters().remove(dirtyListener);
if (view == null) {
return;
}
if (!(selection instanceof IStructuredSelection)) {
return;
}
Object firstElement = ((IStructuredSelection) selection).getFirstElement();
if (!(selection instanceof IStructuredSelection)) {
return;
} else if (firstElement instanceof RepositoryNode) {
return;
}
// for Find Assignment
if (((IStructuredSelection) selection).size() > 0) {
DiagramEditPart diagramEditPart = getDiagramEditPart();
if (diagramEditPart instanceof BusinessProcessEditPart) {
BusinessProcessEditPart processPart = (BusinessProcessEditPart) diagramEditPart;
for (Object object : processPart.getChildren()) {
if (object instanceof BusinessItemShapeEditPart) {
BusinessItemShapeEditPart shapEditPart = (BusinessItemShapeEditPart) object;
IFigure figure = shapEditPart.getFigure();
for (Object child : figure.getChildren()) {
if (child instanceof BusinessItemShapeFigure) {
BusinessItemShapeFigure shapFigure = (BusinessItemShapeFigure) child;
Border border = shapFigure.getBorder();
if (border != null) {
shapFigure.setDrawFrame(false);
shapFigure.revalidate();
shapFigure.repaint();
}
}
}
}
}
}
}
// to refresh the jobsettings view
if (((IStructuredSelection) selection).size() > 1) {
view.cleanDisplay();
} else {
if (firstElement instanceof BusinessItemShapeEditPart || firstElement instanceof BaseBusinessItemRelationShipEditPart || firstElement instanceof NoteEditPart || firstElement instanceof NoteAttachmentEditPart) {
view.refresh(false, firstElement);
} else if (firstElement instanceof BusinessProcessEditPart || firstElement instanceof CompartmentEditPart) {
view.refresh(true, this);
}
}
getDiagramEditorInput().getItem().getProperty().eAdapters().add(dirtyListener);
}
Aggregations