use of org.talend.dataprofiler.core.ui.dialog.TdTaskPropertiesDialog in project tdq-studio-se by Talend.
the class TdAddTaskAction method run.
@Override
public void run() {
try {
TdTaskPropertiesDialog dialog = new TdTaskPropertiesDialog(shell);
ModelElement modelElement = null;
if (navObj instanceof RepositoryNode) {
RepositoryNode node = (RepositoryNode) navObj;
modelElement = RepositoryNodeHelper.getModelElementFromRepositoryNode(node);
} else {
modelElement = (ModelElement) navObj;
}
modelElement = (ModelElement) EObjectHelper.resolveObject(modelElement);
if (modelElement == null || modelElement.eResource() == null || modelElement.getName() == null) {
// $NON-NLS-1$
String fileName = "";
if (navObj instanceof RepositoryNode) {
Item item = ((RepositoryNode) navObj).getObject().getProperty().getItem();
if (item instanceof TDQItem) {
fileName = ((TDQItem) item).getFilename();
}
}
throw ExceptionFactory.getInstance().createBusinessException(fileName);
}
IFile file = WorkspaceUtils.getModelElementResource(modelElement);
TdResourceModel tdResModel = new TdResourceModel(file.getFullPath(), (Workspace) file.getWorkspace(), modelElement);
dialog.setResource(tdResModel);
Map<String, Object> attMap = new HashMap<String, Object>();
attMap.put(MarkerViewUtil.NAME_ATTRIBUTE, modelElement.getName());
attMap.put(IMarker.LOCATION, file.getRawLocation().toString());
attMap.put(IMarker.LINE_NUMBER, file.getRawLocation().toString());
dialog.setInitialAttributes(attMap);
dialog.open();
} catch (BusinessException e) {
ExceptionHandler.process(e, Level.FATAL);
} catch (Exception e1) {
log.error(e1, e1);
}
}
Aggregations