use of org.talend.dq.nodes.DQRepositoryNode in project tdq-studio-se by Talend.
the class AnalysisUtils method getSelectDialogInputData.
/**
* get Select Dialog Input Data.
*
* @param eResourceConstant: for select UDI dialog is EResourceConstant.USER_DEFINED_INDICATORS
* @return DQRepositoryNode
*/
public static DQRepositoryNode getSelectDialogInputData(EResourceConstant eResourceConstant) {
DQRepositoryNode node = new DQRepositoryNode(null, null, ENodeType.SYSTEM_FOLDER, ProjectManager.getInstance().getCurrentProject());
node.getChildren().clear();
if (ProxyRepositoryManager.getInstance().isMergeRefProject()) {
IRepositoryNode librariesFolderNode = RepositoryNodeHelper.getLibrariesFolderNode(eResourceConstant);
node.getChildren().add(librariesFolderNode);
} else {
java.util.Set<Project> allProjects = ProxyRepositoryManager.getInstance().getAllProjects();
for (Project project : allProjects) {
IRepositoryNode librariesFolderNode = RepositoryNodeHelper.getLibrariesFolderNode(eResourceConstant, project);
node.getChildren().add(librariesFolderNode);
}
}
return node;
}
use of org.talend.dq.nodes.DQRepositoryNode in project tdq-studio-se by Talend.
the class AnalysisUtils method getAnalysisSelectDialogInputData.
/**
* get Analysis Select Dialog Input Data.
*
* @param eResourceConstant
* @return
*/
public static DQRepositoryNode getAnalysisSelectDialogInputData(EResourceConstant eResourceConstant) {
DQRepositoryNode node = new DQRepositoryNode(null, null, ENodeType.SYSTEM_FOLDER, ProjectManager.getInstance().getCurrentProject());
node.getChildren().clear();
if (ProxyRepositoryManager.getInstance().isMergeRefProject()) {
IRepositoryNode analysisFolderNode = RepositoryNodeHelper.getDataProfilingFolderNode(eResourceConstant);
node.getChildren().add(analysisFolderNode);
} else {
java.util.Set<Project> allProjects = ProxyRepositoryManager.getInstance().getAllProjects();
for (Project project : allProjects) {
IRepositoryNode analysisFolderNode = RepositoryNodeHelper.getDataProfilingFolderNode(eResourceConstant, project);
node.getChildren().add(analysisFolderNode);
}
}
return node;
}
use of org.talend.dq.nodes.DQRepositoryNode in project tdq-studio-se by Talend.
the class AnalysisUtils method getMetadataSelectDialogInputData.
/**
* get Metadata Select Dialog Input Data.
*
* @param eResourceConstant
* @return DQRepositoryNode
*/
public static DQRepositoryNode getMetadataSelectDialogInputData(EResourceConstant eResourceConstant) {
DQRepositoryNode node = new DQRepositoryNode(null, null, ENodeType.SYSTEM_FOLDER, ProjectManager.getInstance().getCurrentProject());
node.getChildren().clear();
if (ProxyRepositoryManager.getInstance().isMergeRefProject()) {
IRepositoryNode librariesFolderNode = RepositoryNodeHelper.getMetadataFolderNode(eResourceConstant);
node.getChildren().add(librariesFolderNode);
} else {
java.util.Set<Project> allProjects = ProxyRepositoryManager.getInstance().getAllProjects();
for (Project project : allProjects) {
IRepositoryNode librariesFolderNode = RepositoryNodeHelper.getMetadataFolderNode(eResourceConstant, project);
node.getChildren().add(librariesFolderNode);
}
}
return node;
}
use of org.talend.dq.nodes.DQRepositoryNode in project tdq-studio-se by Talend.
the class NominalValuesDPSelectionPage method addListeners.
/*
* (non-Javadoc)
*
* @see org.talend.dataprofiler.core.ui.wizard.analysis.column.ColumnAnalysisDOSelectionPage#addListeners()
*/
@Override
protected void addListeners() {
addListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
Object object = ((IStructuredSelection) event.getSelection()).getFirstElement();
if (object instanceof ColumnRepNode) {
RepositoryNode repositoryNode = (ColumnRepNode) object;
DFColumnRepNode columnNode = new DFColumnRepNode(repositoryNode.getObject(), repositoryNode.getParent(), ENodeType.TDQ_REPOSITORY_ELEMENT, ((DQRepositoryNode) repositoryNode).getProject());
int javaSQLType = TalendTypeConvert.convertToJDBCType(columnNode.getMetadataColumn().getTalendType());
// int javaSQLType = TalendTypeConvert.convertToJDBCType(column.getTalendType());
if (Java2SqlType.isTextInSQL(javaSQLType)) {
advanceToNextPageOrFinish();
} else {
List<DFColumnRepNode> tempList = new ArrayList<DFColumnRepNode>();
tempList.add(columnNode);
setAddTextIndicator(false);
if (!tempList.isEmpty()) {
ElementListSelectionDialog dialog = new ElementListSelectionDialog(null, new DQRepositoryViewLabelProvider());
dialog.setElements(tempList.toArray());
// $NON-NLS-1$
dialog.setTitle(DefaultMessagesImpl.getString("CreateNominalAnalysisAction.dataTypeWarning"));
// $NON-NLS-1$
dialog.setMessage(DefaultMessagesImpl.getString("CreateNominalAnalysisAction.string"));
dialog.setSize(80, 20);
dialog.create();
if (Window.OK == dialog.open()) {
// use MetadataHelper
for (DFColumnRepNode col : tempList) {
MetadataHelper.setDataminingType(DataminingType.NOMINAL, col.getMetadataColumn());
}
advanceToNextPageOrFinish();
}
}
}
}
}
});
addListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
try {
Object object = ((IStructuredSelection) event.getSelection()).getFirstElement();
nodes = new ArrayList<IRepositoryNode>();
if (object instanceof ColumnRepNode) {
List<IRepositoryNode> list = ((IStructuredSelection) event.getSelection()).toList();
nodes.addAll(list);
if (nodes.size() == 0 || RepNodeUtils.isValidSelectionFromSameTable(nodes)) {
List<DFColumnRepNode> tempList = new ArrayList<DFColumnRepNode>();
for (IRepositoryNode obj : nodes) {
if (object instanceof ColumnRepNode) {
RepositoryNode repositoryNode = (ColumnRepNode) obj;
DFColumnRepNode columnNode = new DFColumnRepNode(repositoryNode.getObject(), repositoryNode.getParent(), ENodeType.TDQ_REPOSITORY_ELEMENT, ((DQRepositoryNode) repositoryNode).getProject());
int javaSQLType = TalendTypeConvert.convertToJDBCType(columnNode.getMetadataColumn().getTalendType());
if (!Java2SqlType.isTextInSQL(javaSQLType)) {
tempList.add(columnNode);
setAddTextIndicator(false);
}
}
}
if (!tempList.isEmpty()) {
ElementListSelectionDialog dialog = new ElementListSelectionDialog(null, new DQRepositoryViewLabelProvider());
dialog.setElements(tempList.toArray());
// $NON-NLS-1$
dialog.setTitle(DefaultMessagesImpl.getString("CreateNominalAnalysisAction.dataTypeWarning"));
// $NON-NLS-1$
dialog.setMessage(DefaultMessagesImpl.getString("CreateNominalAnalysisAction.string"));
dialog.setSize(80, 20);
dialog.create();
if (Window.OK == dialog.open()) {
// zqin get the column and change their datamining type to "Nominal"
for (DFColumnRepNode column : tempList) {
MetadataHelper.setDataminingType(DataminingType.NOMINAL, column.getMetadataColumn());
}
setPageComplete(true);
setMessage(chooseConnStr);
}
} else {
setPageComplete(true);
setMessage(chooseConnStr);
}
} else {
setPageComplete(false);
// $NON-NLS-1$
setMessage(DefaultMessagesImpl.getString("ColumnAnalysisDOSelectionPage.selectColumnError1"), ERROR);
}
} else {
setPageComplete(false);
setMessage(chooseConnStr);
}
} catch (Exception e) {
log.error(e, e);
}
}
});
}
use of org.talend.dq.nodes.DQRepositoryNode in project tdq-studio-se by Talend.
the class OpenItemEditorAction method duRun.
protected void duRun(IRepositoryNode repNode) throws BusinessException {
// TDQ-12200: fix a NPE when the open item is unsynchronized status(for example is deleted by others).
repositoryObjectCRUD.refreshDQViewForRemoteProject();
// TDQ-13357: fix NPE, because for ReportFileRepNode, repNode.getObject() == null
if (repNode.getObject() != null) {
if (repNode.getObject().getProperty() == null) {
repositoryObjectCRUD.showWarningDialog();
return;
}
// TDQ-12771: for local, also can avoid error when the cache node is changed but not save it.
try {
ProxyRepositoryFactory.getInstance().reload(repNode.getObject().getProperty());
IFile objFile = PropertyHelper.getItemFile(repNode.getObject().getProperty());
objFile.refreshLocal(IResource.DEPTH_INFINITE, null);
} catch (Exception e1) {
log.error(e1, e1);
}
}
// TDQ-12034~
IEditorInput itemEditorInput = computeEditorInput(repNode, true);
if (itemEditorInput != null) {
// open ItemEditorInput
CorePlugin.getDefault().openEditor(itemEditorInput, editorID);
} else {
// not find ItemEditorInput
if (repNode.getObject() == null) {
// open Report's genetated doc file
if (repNode != null && repNode instanceof ReportFileRepNode) {
ReportFileRepNode reportFileNode = (ReportFileRepNode) repNode;
IPath location = Path.fromOSString(reportFileNode.getResource().getRawLocation().toOSString());
// TDQ-5458 sizhaoliu 2012-07-17 add "." before the full name to make sure it is ignored by SVN.
IFile latestRepIFile = ResourceManager.getRootProject().getFile(PluginConstant.DOT_STRING + location.lastSegment());
try {
// TDQ-5458 sizhaoliu 2012-07-17 the link creation should be after report generation, but not at
// the openning.
// latestRepIFile.createLink(location, IResource.REPLACE, null);
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
// MOD yyin 20121224 TDQ-5329, using the default editor setted by the user.
IDE.openEditor(page, latestRepIFile);
} catch (PartInitException e) {
MessageDialog.openError(Display.getCurrent().getActiveShell(), // $NON-NLS-1$
Messages.getString("NewFolderWizard.failureTitle"), e.getMessage());
ExceptionHandler.process(e);
}
}
} else {
// if there don't found the correct ItemEditorInput and it is not Report's genetated doc file, try to
// open it as a File, this code will not be execute when method computeEditorInput() work well
IPath append = WorkbenchUtils.getFilePath(repNode.getObject().getRepositoryNode());
DQRepositoryNode node = (DQRepositoryNode) repNode.getObject().getRepositoryNode();
file = ResourceManager.getRoot().getProject(node.getProject().getTechnicalLabel()).getFile(append);
if (!file.exists()) {
throw ExceptionFactory.getInstance().createBusinessException(repNode.getObject());
}
try {
IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), file, true);
} catch (PartInitException e) {
log.error(e, e);
}
}
}
}
Aggregations