use of org.talend.designer.core.ui.editor.jobletcontainer.JobletContainer in project tdi-studio-se by Talend.
the class DesignerColorsPreferencePage method changeMRGroupColor.
private void changeMRGroupColor(ProcessPart processPart) {
for (Object o : processPart.getChildren()) {
if (o instanceof SubjobContainerPart) {
for (Object child : ((SubjobContainerPart) o).getChildren()) {
if (child instanceof JobletContainerPart) {
JobletContainer jCon = (JobletContainer) ((JobletContainerPart) child).getModel();
jCon.setPropertyValue(JobletContainer.UPDATE_JOBLET_DISPLAY, DesignerColorUtils.getPreferenceMRGroupRGB(DesignerColorUtils.MRGROUP_COLOR_NAME, DesignerColorUtils.MR_COLOR));
jCon.setPropertyValue(JobletContainer.UPDATE_JOBLET_DISPLAY, DesignerColorUtils.getPreferenceMRGroupRGB(DesignerColorUtils.JOBLET_COLOR_NAME, DesignerColorUtils.JOBLET_COLOR));
}
}
}
}
}
use of org.talend.designer.core.ui.editor.jobletcontainer.JobletContainer in project tdi-studio-se by Talend.
the class AbstractMultiPageTalendEditor method covertJobscriptOnPageChange.
private void covertJobscriptOnPageChange() {
try {
boolean isDirty = jobletEditor.isDirty();
jobletEditor.doSave(null);
IProcess2 oldProcess = getProcess();
ICreateXtextProcessService n = CorePlugin.getDefault().getCreateXtextProcessService();
Item item = oldProcess.getProperty().getItem();
ProcessType processType = null;
if (item instanceof ProcessItem) {
processType = n.convertDesignerEditorInput(((IFile) jobletEditor.getEditorInput().getAdapter(IResource.class)).getLocation().toOSString(), oldProcess.getProperty());
} else if (item instanceof JobletProcessItem) {
processType = n.convertJobletDesignerEditorInput(((IFile) jobletEditor.getEditorInput().getAdapter(IResource.class)).getLocation().toOSString(), oldProcess.getProperty());
}
if (item instanceof ProcessItem) {
((Process) oldProcess).updateProcess(processType);
} else if (item instanceof JobletProcessItem) {
((Process) oldProcess).updateProcess(processType);
}
oldProcess.getUpdateManager().updateAll();
designerEditor.setDirty(isDirty);
List<Node> nodes = (List<Node>) oldProcess.getGraphicalNodes();
List<Node> newNodes = new ArrayList<Node>();
newNodes.addAll(nodes);
for (Node node : newNodes) {
node.getProcess().checkStartNodes();
node.checkAndRefreshNode();
IElementParameter ep = node.getElementParameter("ACTIVATE");
if (ep != null && ep.getValue().equals(Boolean.FALSE)) {
node.setPropertyValue(EParameterName.ACTIVATE.getName(), true);
node.setPropertyValue(EParameterName.ACTIVATE.getName(), false);
} else if (ep != null && ep.getValue().equals(Boolean.TRUE)) {
node.setPropertyValue(EParameterName.ACTIVATE.getName(), false);
node.setPropertyValue(EParameterName.ACTIVATE.getName(), true);
}
for (IElementParameter param : node.getElementParameters()) {
if (!param.getChildParameters().isEmpty()) {
if (param.getValue() != null && param.getValue() instanceof String && ((String) param.getValue()).contains(":")) {
String[] splited = ((String) param.getValue()).split(":");
String childNameNeeded = splited[0].trim();
String valueChild = TalendQuoteUtils.removeQuotes(splited[1].trim());
if (param.getChildParameters().containsKey(childNameNeeded)) {
param.getChildParameters().get(childNameNeeded).setValue(valueChild);
}
}
}
}
if (node.getNodeContainer() instanceof JobletContainer) {
JobletContainer jc = (JobletContainer) node.getNodeContainer();
if (node.isMapReduceStart()) {
//$NON-NLS-1$
jc.updateState("UPDATE_STATUS", "", jc.getPercentMap(), jc.getPercentReduce());
}
}
}
} catch (PersistenceException e) {
}
}
use of org.talend.designer.core.ui.editor.jobletcontainer.JobletContainer in project tdi-studio-se by Talend.
the class ComponentChooseDialog method getJobletPart.
public AbstractMultiPageTalendEditor getJobletPart(JobletContainerPart part) {
AbstractMultiPageTalendEditor openEditor = null;
Node jobletNode = ((JobletContainer) part.getModel()).getNode();
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
if (PluginChecker.isJobLetPluginLoaded()) {
IJobletProviderService service = (IJobletProviderService) GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
if (service != null) {
openEditor = (AbstractMultiPageTalendEditor) service.openJobletEditor(jobletNode, page);
}
}
return openEditor;
}
use of org.talend.designer.core.ui.editor.jobletcontainer.JobletContainer in project tdi-studio-se by Talend.
the class ProcessComposite method refreshNodeContainer.
public void refreshNodeContainer() {
org.talend.core.model.process.IProcess process = processContext.getProcess();
List<? extends INode> nodeList = process.getGraphicalNodes();
for (INode node : nodeList) {
if ((node instanceof Node) && (((Node) node).isMapReduceStart())) {
((JobletContainer) ((Node) node).getNodeContainer()).updateState("UPDATE_STATUS", "CLEAR", new Double(0), //$NON-NLS-1$ //$NON-NLS-2$
new Double(0));
}
}
}
use of org.talend.designer.core.ui.editor.jobletcontainer.JobletContainer in project tdi-studio-se by Talend.
the class GEFDeleteAction method createDeleteCommand.
@Override
public Command createDeleteCommand(List objects) {
objects = filterSameObject(objectsToDelete);
if (objects.isEmpty()) {
return null;
}
if (!(objects.get(0) instanceof EditPart)) {
return null;
}
EditPart object = (EditPart) objects.get(0);
// for TUP-1015
boolean isConnAttachedJLTriggerComp = false;
ConnectionPart connectionPart = null;
if (object instanceof ConnectionPart) {
connectionPart = (ConnectionPart) object;
} else if (object instanceof ConnLabelEditPart) {
connectionPart = (ConnectionPart) object.getParent();
}
if (connectionPart != null) {
Node srcNode = null;
Object srcModel = connectionPart.getSource().getModel();
if (srcModel instanceof Node) {
srcNode = (Node) srcModel;
}
Node tarNode = null;
Object tarModel = connectionPart.getTarget().getModel();
if (tarModel instanceof Node) {
tarNode = (Node) tarModel;
}
if (srcNode == null || tarNode == null) {
return null;
}
IProcess process = srcNode.getProcess();
if (AbstractProcessProvider.isExtensionProcessForJoblet(process)) {
IJobletProviderService service = (IJobletProviderService) GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
if (service != null && (service.isTriggerNode(srcNode) || service.isTriggerNode(tarNode))) {
isConnAttachedJLTriggerComp = true;
}
}
}
IPreferenceStore preferenceStore = DesignerPlugin.getDefault().getPreferenceStore();
String preKey = TalendDesignerPrefConstants.NOT_SHOW_WARNING_WHEN_DELETE_LINK_WITH_JOBLETTRIGGERLINKCOMPONENT;
if (isConnAttachedJLTriggerComp && !preferenceStore.getBoolean(preKey)) {
MessageDialogWithToggle jlTriggerConfirmDialog = new MessageDialogWithToggle(null, //$NON-NLS-1$
Messages.getString("GEFDeleteAction.deleteConnectionDialog.title"), // accept the default window icon
null, Messages.getString("GEFDeleteAction.deleteConnectionDialog.msg"), MessageDialog.WARNING, new String[] { //$NON-NLS-1$
IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0, //$NON-NLS-1$
Messages.getString("GEFDeleteAction.deleteConnectionDialog.toggleMsg"), preferenceStore.getDefaultBoolean(preKey));
jlTriggerConfirmDialog.setPrefStore(preferenceStore);
jlTriggerConfirmDialog.setPrefKey(preKey);
if (jlTriggerConfirmDialog.open() != IDialogConstants.YES_ID) {
return null;
}
preferenceStore.setValue(preKey, jlTriggerConfirmDialog.getToggleState());
}
List nodeParts = new ArrayList();
List noteParts = new ArrayList();
List others = new ArrayList(objects);
for (Object o : objects) {
if (o instanceof NodePart) {
others.remove(o);
Node model = (Node) ((NodePart) o).getModel();
if (model.getJobletNode() != null) {
continue;
}
if (model.getJunitNode() != null) {
continue;
}
nodeParts.add(o);
} else if (o instanceof NoteEditPart) {
noteParts.add(o);
others.remove(o);
} else if (o instanceof SubjobContainerPart) {
others.remove(o);
SubjobContainerPart subjob = (SubjobContainerPart) o;
for (Iterator iterator = subjob.getChildren().iterator(); iterator.hasNext(); ) {
NodeContainerPart nodeContainerPart = (NodeContainerPart) iterator.next();
if (nodeContainerPart instanceof JobletContainerPart) {
JobletContainer jobletCon = (JobletContainer) ((JobletContainerPart) nodeContainerPart).getModel();
JobletContainerFigure jobletFigure = (JobletContainerFigure) ((JobletContainerPart) nodeContainerPart).getFigure();
if (!jobletCon.isCollapsed()) {
jobletFigure.doCollapse();
}
}
NodePart nodePart = nodeContainerPart.getNodePart();
if (nodePart != null) {
Node model = (Node) nodePart.getModel();
if (model.getJunitNode() != null) {
continue;
}
nodeParts.add(nodePart);
}
}
}
}
if (others.size() == 0) {
// so notes & nodes only
CompoundCommand cpdCmd = new CompoundCommand();
//$NON-NLS-1$
cpdCmd.setLabel(Messages.getString("GEFDeleteAction.DeleteItems"));
if (nodeParts.size() != 0) {
GroupRequest deleteReq = new GroupRequest(RequestConstants.REQ_DELETE);
deleteReq.setEditParts(nodeParts);
cpdCmd.add(((NodePart) nodeParts.get(0)).getCommand(deleteReq));
}
if (noteParts.size() != 0) {
GroupRequest deleteReq = new GroupRequest(RequestConstants.REQ_DELETE);
deleteReq.setEditParts(noteParts);
cpdCmd.add(((NoteEditPart) noteParts.get(0)).getCommand(deleteReq));
}
return cpdCmd;
} else {
GroupRequest deleteReq = new GroupRequest(RequestConstants.REQ_DELETE);
deleteReq.setEditParts(objects);
Command cmd = object.getCommand(deleteReq);
return cmd;
}
}
Aggregations