use of org.talend.designer.core.model.components.DummyComponent in project tdi-studio-se by Talend.
the class NodePart method setSelected.
/*
* (non-Javadoc)
*
* @see org.eclipse.gef.editparts.AbstractEditPart#setSelected(int)
*/
@Override
@SuppressWarnings("unchecked")
public void setSelected(final int value) {
if (value == SELECTED) {
super.setSelected(SELECTED_PRIMARY);
} else {
super.setSelected(value);
}
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
if (value == SELECTED_NONE) {
ComponentSettingsView viewer = (ComponentSettingsView) page.findView(ComponentSettingsView.ID);
if (viewer == null) {
return;
}
ComponentSettingsView compSettings = viewer;
compSettings.cleanDisplay();
return;
}
IEditorPart activeEditor = page.getActiveEditor();
if (activeEditor instanceof AbstractMultiPageTalendEditor) {
GraphicalViewer designerViewer = ((AbstractMultiPageTalendEditor) activeEditor).getTalendEditor().getViewer();
Control ctrl = designerViewer.getControl();
String helpLink = (String) ((Node) getModel()).getPropertyValue(EParameterName.HELP.getName());
String requiredHelpLink = ((Process) ((Node) getModel()).getProcess()).getBaseHelpLink() + ((Node) getModel()).getComponent().getName();
if (helpLink == null || "".equals(helpLink) || !requiredHelpLink.equals(helpLink)) {
//$NON-NLS-1$
helpLink = ((Process) ((Node) getModel()).getProcess()).getBaseHelpLink() + ((Node) getModel()).getComponent().getName();
}
if (ctrl != null) {
PlatformUI.getWorkbench().getHelpSystem().setHelp(ctrl, helpLink);
}
// This code was to update automatically the help view, to set the documentation of the selected component
// remove for TDI-24396
// IViewPart view = page.findView("org.eclipse.help.ui.HelpView"); //$NON-NLS-1$
// if (view != null) {
// PlatformUI.getWorkbench().getHelpSystem().displayHelp(helpLink);
// }
TalendSelectionManager selectionManager = (TalendSelectionManager) designerViewer.getSelectionManager();
if (value == SELECTED || value == SELECTED_PRIMARY) {
ComponentSettingsView viewer = (ComponentSettingsView) page.findView(ComponentSettingsView.ID);
if (viewer == null) {
return;
}
if (selectionManager.getSelectionType() == ETalendSelectionType.SINGLE) {
ComponentSettingsView compSettings = viewer;
compSettings.setElement((Node) getModel());
if (((Node) getModel()).getComponent() instanceof DummyComponent) {
MessageDialog.openWarning(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), //$NON-NLS-1$
Messages.getString("NodePart_warning"), //$NON-NLS-1$
Messages.getString("NodePart_componentNotLoaded"));
return;
}
CodeView.refreshCodeView((Node) getModel());
} else if (!viewer.isCleaned() && selectionManager.getSelectionType() == ETalendSelectionType.MULTIPLE) {
ComponentSettingsView compSettings = viewer;
compSettings.cleanDisplay();
} else if (isDrop()) {
if (value == SELECTED || value == SELECTED_PRIMARY) {
ComponentSettingsView compSettings = viewer;
compSettings.setElement((Node) getModel());
if (((Node) getModel()).getComponent() instanceof DummyComponent) {
MessageDialog.openWarning(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), //$NON-NLS-1$
Messages.getString("NodePart_warning"), //$NON-NLS-1$
Messages.getString("NodePart_componentNotLoaded"));
return;
}
CodeView.refreshCodeView((Node) getModel());
}
}
}
}
}
use of org.talend.designer.core.model.components.DummyComponent in project tdi-studio-se by Talend.
the class NodeUtilTest method testIsBigDataFrameworkNode.
@Test
public void testIsBigDataFrameworkNode() {
DummyComponent comp = Mockito.mock(DummyComponent.class);
Mockito.when(comp.getType()).thenReturn(ComponentCategory.CATEGORY_4_CAMEL.getName());
//$NON-NLS-1$
INode node = new DataNode(comp, "");
assertFalse(NodeUtil.isBigDataFrameworkNode(node));
Mockito.when(comp.getType()).thenReturn(ComponentCategory.CATEGORY_4_DI.getName());
//$NON-NLS-1$
node = new DataNode(comp, "");
assertFalse(NodeUtil.isBigDataFrameworkNode(node));
Mockito.when(comp.getType()).thenReturn(ComponentCategory.CATEGORY_4_MAPREDUCE.getName());
//$NON-NLS-1$
node = new DataNode(comp, "");
assertTrue(NodeUtil.isBigDataFrameworkNode(node));
Mockito.when(comp.getType()).thenReturn(ComponentCategory.CATEGORY_4_SPARK.getName());
//$NON-NLS-1$
node = new DataNode(comp, "");
assertTrue(NodeUtil.isBigDataFrameworkNode(node));
Mockito.when(comp.getType()).thenReturn(ComponentCategory.CATEGORY_4_SPARKSTREAMING.getName());
//$NON-NLS-1$
node = new DataNode(comp, "");
assertTrue(NodeUtil.isBigDataFrameworkNode(node));
Mockito.when(comp.getType()).thenReturn(ComponentCategory.CATEGORY_4_STORM.getName());
//$NON-NLS-1$
node = new DataNode(comp, "");
assertTrue(NodeUtil.isBigDataFrameworkNode(node));
}
Aggregations