use of org.talend.designer.core.ui.editor.nodecontainer.NodeContainerPart in project tdi-studio-se by Talend.
the class ComponentChooseDialog method handleDrop.
// private void checkRequiredModules() {
// Object newObject = ((CreateRequest) getTargetRequest()).getNewObject();
// if (newObject instanceof Node) {
// IComponent component = ((Node) newObject).getComponent();
// Shell shell = Display.getCurrent().getActiveShell();
// ModulesInstallerUtil.installModules(new Shell(shell), component);
// }
// }
/*
* (non-Javadoc)
*
* @see org.eclipse.gef.dnd.TemplateTransferDropTargetListener#handleDrop()
*/
@Override
protected void handleDrop() {
updateTargetRequest();
updateTargetEditPart();
// checkRequiredModules();
if (fromPalette && getTargetRequest() instanceof CreateRequest) {
if (selectedConnectionPart != null) {
CreateRequest req = ((CreateRequest) getTargetRequest());
Object o = req.getNewObject();
Point location = req.getLocation();
if (o instanceof Node) {
createComponentOnLink((Node) o, location);
}
// checkRequiredModules();
return;
} else if (getTargetEditPart() instanceof ProcessPart) {
// for palette dnd, feature 6457
Object newObject = ((CreateRequest) getTargetRequest()).getNewObject();
if (newObject != null) {
Command command = getCommand();
if (command != null) {
execCommandStack(command);
}
}
// checkRequiredModules();
return;
} else if (getTargetEditPart() instanceof SubjobContainerPart) {
// TDI-24985:for palette dnd.
Object newObject = ((CreateRequest) getTargetRequest()).getNewObject();
if (newObject != null) {
Command command = getCommand();
if (command != null) {
execCommandStack(command);
}
}
return;
} else if (getTargetEditPart() instanceof JobletContainerPart) {
JobletContainerPart jobletPart = (JobletContainerPart) getTargetEditPart();
if (isLock(jobletPart)) {
Shell shell = Display.getCurrent().getActiveShell();
ChooseJobletDialog dialog = new ChooseJobletDialog(new Shell(shell), getDropLocation());
if (dialog.open() == dialog.OK) {
EditPart part = getTargetEditPart();
if (dialog.addToJoblet()) {
AbstractMultiPageTalendEditor openEditor = getJobletPart((JobletContainerPart) part);
part = openEditor.getDesignerEditor().getProcessPart();
// editor = openEditor.getTalendEditor();
setTargetEditPart(part);
Object newObject = ((CreateRequest) getTargetRequest()).getNewObject();
if (newObject != null) {
Command command = getCommand();
if (command != null) {
CommandStack commandStack = (CommandStack) openEditor.getAdapter(CommandStack.class);
if (commandStack != null) {
commandStack.execute(command);
} else {
command.execute();
}
}
}
// checkRequiredModules();
return;
} else {
part = getParentPart(part);
setTargetEditPart(part);
Object newObject = ((CreateRequest) getTargetRequest()).getNewObject();
if (newObject != null) {
Command command = getCommand();
if (command != null) {
execCommandStack(command);
}
}
// checkRequiredModules();
return;
}
}
}
}
}
List<Object> sources = getSelectSource();
if (containsContextSource(sources)) {
createContext(sources);
} else {
if (!(getTargetEditPart() instanceof NodeContainerPart)) {
try {
createNewComponent(getCurrentEvent());
} catch (OperationCanceledException e) {
return;
}
} else {
if (containsSQLPatternSource(sources)) {
createSQLPattern(sources);
} else {
Object obj = getSelection().getFirstElement();
createSchema(obj, getTargetEditPart());
createQuery(obj, getTargetEditPart());
createProperty(obj, getTargetEditPart());
createChildJob(obj, getTargetEditPart());
createValidationRule(obj, getTargetEditPart());
if (obj instanceof IRepositoryNode) {
propaHadoopCfgChanges((IRepositoryNode) obj);
}
for (IExtendedNodeHandler hander : ExtendedNodeManager.getExtendedNodeHandler()) {
boolean updated = hander.updateComponent(obj, getTargetEditPart(), editor.getCommandStack());
if (updated) {
break;
}
}
}
}
}
// in case after drag/drop the editor is dirty but can not get focus
if (editor.isDirty()) {
editor.setFocus();
}
this.eraseTargetFeedback();
}
use of org.talend.designer.core.ui.editor.nodecontainer.NodeContainerPart in project tdi-studio-se by Talend.
the class DynamicTabbedPropertySection method setInput.
// private ISelection lastSelection;
/*
* @Override (non-Java)
*
* @see org.eclipse.ui.views.properties.tabbed.AbstractPropertySection# setInput(org.eclipse.ui.IWorkbenchPart,
* org.eclipse.jface.viewers.ISelection)
*/
@Override
public void setInput(final IWorkbenchPart workbenchPart, final ISelection selection) {
if (!(selection instanceof IStructuredSelection)) {
return;
}
curRowSize = 0;
Object input = ((IStructuredSelection) selection).getFirstElement();
if (input instanceof NodeContainerPart) {
NodeContainerPart nContainer = (NodeContainerPart) input;
elem = (Element) nContainer.getParent().getModel();
} else if (input instanceof NodeTreeEditPart) {
NodeTreeEditPart nTreePart = (NodeTreeEditPart) input;
elem = (Element) nTreePart.getModel();
} else if (!(input instanceof NodeReturnsTreeEditPart)) {
EditPart editPart = (EditPart) input;
elem = (Element) editPart.getModel();
}
if (elem instanceof NodeLabel) {
elem = ((NodeLabel) elem).getNode();
}
if (elem instanceof ConnectionLabel) {
elem = ((ConnectionLabel) elem).getConnection();
}
if (workbenchPart instanceof AbstractMultiPageTalendEditor) {
part = (AbstractMultiPageTalendEditor) workbenchPart;
} else {
if (elem instanceof INode) {
part = (AbstractMultiPageTalendEditor) ((IProcess2) ((INode) elem).getProcess()).getEditor();
} else if (elem instanceof IConnection) {
IConnection conn;
conn = (IConnection) elem;
part = (AbstractMultiPageTalendEditor) ((IProcess2) conn.getSource().getProcess()).getEditor();
} else {
part = (AbstractMultiPageTalendEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
}
}
super.setInput(part, selection);
commandStackEventListener = null;
if ((currentComponent == null) || (!currentComponent.equals(elem.getElementName()))) {
forceRedraw = true;
elem.setPropertyValue(updataComponentParamName, Boolean.TRUE);
}
currentComponent = elem.getElementName();
}
Aggregations