use of org.talend.designer.core.ui.editor.process.Process in project tdi-studio-se by Talend.
the class ColumnListControllerTest method before.
@Before
public void before() {
instance = mock(ColumnListController.class);
IComponent component = ComponentsFactoryProvider.getInstance().get("tRowGenerator", "DI");
Property property = PropertiesFactory.eINSTANCE.createProperty();
Process process = new Process(property);
node = new Node(component, process);
table = node.getMetadataList().get(0);
column = new MetadataColumn();
}
use of org.talend.designer.core.ui.editor.process.Process in project tdi-studio-se by Talend.
the class DesignerUtilitiesTest method testGetMainSchemaParameterName.
@Test
public void testGetMainSchemaParameterName() {
Process process = new Process(new FakePropertyImpl());
// New component
//$NON-NLS-1$ //$NON-NLS-2$
IComponent component = ComponentsFactoryProvider.getInstance().get("tSalesforceInput", "DI");
Node node = new Node(component, process);
String parameterName = DesignerUtilities.getMainSchemaParameterName(node);
//$NON-NLS-1$ //$NON-NLS-2$
assertEquals("module.main.schema" + ":" + EParameterName.REPOSITORY_SCHEMA_TYPE.getName(), parameterName);
// Old component
//$NON-NLS-1$ //$NON-NLS-2$
component = ComponentsFactoryProvider.getInstance().get("tJavaRow", "DI");
node = new Node(component, process);
parameterName = DesignerUtilities.getMainSchemaParameterName(node);
//$NON-NLS-1$
assertEquals("SCHEMA:" + EParameterName.REPOSITORY_SCHEMA_TYPE.getName(), parameterName);
}
use of org.talend.designer.core.ui.editor.process.Process in project tesb-studio-se by Talend.
the class CamelEditorDropTargetListener method createNewComponent.
public void createNewComponent(DropTargetEvent event1) {
boolean quickCreateInput = event1.detail == DND.DROP_LINK;
boolean quickCreateOutput = event1.detail == DND.DROP_COPY;
List<TempStore> list = new ArrayList<TempStore>();
List<IComponent> components = new ArrayList<IComponent>();
for (Object obj : selectSourceList) {
if (obj instanceof RepositoryNode) {
RepositoryNode sourceNode = (RepositoryNode) obj;
ERepositoryObjectType type = sourceNode.getObjectType();
Item item = sourceNode.getObject().getProperty().getItem();
TempStore store = new TempStore();
store.seletetedNode = sourceNode;
getAppropriateComponent(item, quickCreateInput, quickCreateOutput, store, type);
if (store.component != null) {
list.add(store);
} else {
MessageDialog.openInformation(editor.getEditorSite().getShell(), //$NON-NLS-1$
Messages.getString("TalendEditorDropTargetListener.dngsupportdialog.title"), //$NON-NLS-1$
Messages.getString("TalendEditorDropTargetListener.dngsupportdialog.content"));
return;
}
}
org.eclipse.swt.graphics.Point swtLocation = new org.eclipse.swt.graphics.Point(event1.x, event1.y);
Canvas canvas = (Canvas) editor.getViewer().getControl();
/*
* translate to Canvas coordinate
*/
swtLocation = canvas.toControl(swtLocation);
/*
* translate to Viewport coordinate with zoom
*/
org.eclipse.draw2d.geometry.Point draw2dPosition = new org.eclipse.draw2d.geometry.Point(swtLocation.x, swtLocation.y);
/*
* calcule the view port position. Take into acounte the scroll position
*/
ProcessPart part = (ProcessPart) editor.getViewer().getRootEditPart().getRoot().getChildren().get(0);
IFigure targetFigure = part.getFigure();
translateAbsolateToRelative(targetFigure, draw2dPosition);
// creates every node
for (TempStore store : list) {
RepositoryNode selectedNode = store.seletetedNode;
IComponent element = store.component;
if (!components.contains(element)) {
components.add(element);
}
Node node = new Node(element);
IPreferenceStore preferenceStore = DesignerPlugin.getDefault().getPreferenceStore();
if (preferenceStore.getBoolean(TalendDesignerPrefConstants.USE_REPOSITORY_NAME)) {
String LabelValue = null;
if (CorePlugin.getDefault().getDesignerCoreService().getPreferenceStore(TalendDesignerPrefConstants.DEFAULT_LABEL).equals(node.getPropertyValue(EParameterName.LABEL.getName()))) {
// dnd a default
LabelValue = selectedNode.getObject().getLabel();
}
if (LabelValue != null) {
node.setPropertyValue(EParameterName.LABEL.getName(), LabelValue);
}
}
NodeContainer nc = ((Process) node.getProcess()).loadNodeContainer(node, false);
// create the node on the design sheet
execCommandStack(new CreateNodeContainerCommand((Process) editor.getProcess(), nc, draw2dPosition));
// initialize the propertiesView
CompoundCommand cc = new CompoundCommand();
createRefreshingPropertiesCommand(cc, selectedNode, node);
execCommandStack(cc);
draw2dPosition = draw2dPosition.getCopy();
draw2dPosition.x += TalendEditor.GRID_SIZE;
draw2dPosition.y += TalendEditor.GRID_SIZE;
node.checkNode();
}
}
}
use of org.talend.designer.core.ui.editor.process.Process in project tdi-studio-se by Talend.
the class RepositoryUpdateTest method testRepositoryChangeFromConnection.
@Test
public void testRepositoryChangeFromConnection() throws PersistenceException {
//$NON-NLS-1$
String id = "testId";
try {
//$NON-NLS-1$ //$NON-NLS-2$
IComponent component = ComponentsFactoryProvider.getInstance().get("tSalesforceInput", "DI");
Node node = new Node(component, new Process(new FakePropertyImpl()));
GenericConnection connection = (GenericConnection) createBasicConnection(id).getConnection();
setupPropertiesWithoutProxy(id);
updateNodeConnectionOnly(id, node, connection);
//$NON-NLS-1$ //$NON-NLS-2$
testRepositoryValue(node, "connection.userPassword.userId", "\"myUser\"");
//$NON-NLS-1$ //$NON-NLS-2$
testRepositoryValue(node, "connection.userPassword.password", "\"myPassword\"");
//$NON-NLS-1$
testRepositoryValue(node, "connection.proxy.useProxy", Boolean.FALSE);
//$NON-NLS-1$ //$NON-NLS-2$
testRepositoryValue(node, "connection.proxy.host", "\"\"");
//$NON-NLS-1$
testRepositoryValue(node, "connection.proxy.port", null);
//$NON-NLS-1$ //$NON-NLS-2$
testRepositoryValue(node, "connection.proxy.userPassword.userId", "\"\"");
//$NON-NLS-1$ //$NON-NLS-2$
testRepositoryValue(node, "connection.proxy.userPassword.password", "\"\"");
setupPropertiesWithProxy(id);
updateNodeConnectionOnly(id, node, connection);
//$NON-NLS-1$ //$NON-NLS-2$
testRepositoryValue(node, "connection.userPassword.userId", "\"myUser\"");
//$NON-NLS-1$ //$NON-NLS-2$
testRepositoryValue(node, "connection.userPassword.password", "\"myPassword\"");
//$NON-NLS-1$
testRepositoryValue(node, "connection.proxy.useProxy", Boolean.TRUE);
//$NON-NLS-1$ //$NON-NLS-2$
testRepositoryValue(node, "connection.proxy.host", "\"host\"");
//$NON-NLS-1$
testRepositoryValue(node, "connection.proxy.port", 1234);
//$NON-NLS-1$ //$NON-NLS-2$
testRepositoryValue(node, "connection.proxy.userPassword.userId", "\"proxyUser\"");
//$NON-NLS-1$ //$NON-NLS-2$
testRepositoryValue(node, "connection.proxy.userPassword.password", "\"proxyPassword\"");
} finally {
IRepositoryViewObject object = ProxyRepositoryFactory.getInstance().getLastVersion(id);
if (object != null) {
ProxyRepositoryFactory.getInstance().deleteObjectPhysical(object);
}
}
}
use of org.talend.designer.core.ui.editor.process.Process in project tdi-studio-se by Talend.
the class RepositoryUpdateTest method testRepositoryResetParams.
@Test
public void testRepositoryResetParams() throws PersistenceException {
//$NON-NLS-1$
String id = "testId";
try {
//$NON-NLS-1$ //$NON-NLS-2$
IComponent component = ComponentsFactoryProvider.getInstance().get("tSalesforceInput", "DI");
Node node = new Node(component, new Process(new FakePropertyImpl()));
GenericConnection connection = (GenericConnection) createBasicConnection(id).getConnection();
setupPropertiesWithoutProxy(id);
updateNode(id, node, connection);
//$NON-NLS-1$ //$NON-NLS-2$
testRepositoryValue(node, "connection.userPassword.userId", "\"myUser\"");
IElementParameter param = node.getElementParameter("connection.userPassword.userId");
assertTrue(param.isRepositoryValueUsed());
assertNotNull(param.getRepositoryValue());
Form form = node.getComponentProperties().getForm(Form.MAIN);
List<ElementParameter> parameters = new ArrayList<>();
parameters = ComponentsUtils.getParametersFromForm(node, false, EComponentCategory.BASIC, node.getComponentProperties(), form);
node.setElementParameters(parameters);
param = node.getElementParameter("connection.userPassword.userId");
assertTrue(param.isRepositoryValueUsed());
assertNotNull(param.getRepositoryValue());
} finally {
IRepositoryViewObject object = ProxyRepositoryFactory.getInstance().getLastVersion(id);
if (object != null) {
ProxyRepositoryFactory.getInstance().deleteObjectPhysical(object);
}
}
}
Aggregations