use of org.talend.dataprofiler.core.ui.imex.model.ItemRecord in project tdq-studio-se by Talend.
the class FileTreeLabelProviderTest method testGetImageObjectCase2.
/**
* Test method for {@link org.talend.dataprofiler.core.ui.imex.FileTreeLabelProvider#getImage(java.lang.Object)}.
* case 2 :element is parser rule
*/
@Test
public void testGetImageObjectCase2() {
File file = ResourcesPlugin.getWorkspace().getRoot().getFolder(new Path(createTDQParserRuleItem.getDqrule().eResource().getURI().toPlatformString(false))).getLocation().toFile();
ItemRecord itemRecord = new ItemRecord(file);
FileTreeLabelProvider fileTreeLabelProvider = new FileTreeLabelProvider();
Image image = fileTreeLabelProvider.getImage(itemRecord);
Assert.assertEquals(ImageLib.getImage(ImageLib.DQ_RULE), image);
}
use of org.talend.dataprofiler.core.ui.imex.model.ItemRecord in project tdq-studio-se by Talend.
the class ImportWizard method performFinish.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.wizard.Wizard#performFinish()
*/
@Override
public boolean performFinish() {
// TDQ-10715: only close the DQ editors before import items except the sql editor and text editor.
// TDQ-13856: when click cancel, do NOT close any editors.
IWorkbenchPage activePage = CorePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
IEditorPart[] editors = activePage.getEditors();
for (IEditorPart editor : editors) {
if (editor instanceof CommonFormEditor) {
boolean isSaved = activePage.closeEditor(editor, true);
if (!isSaved) {
// $NON-NLS-1$
MessageUI.openWarning(DefaultMessagesImpl.getString("ImportItemAction.closeEditors"));
return true;
}
}
}
// ADD xqliu TDQ-4284 2011-12-26
if (ProxyRepositoryFactory.getInstance().isUserReadOnlyOnCurrentProject()) {
return true;
}
// ~ TDQ-4284
final ItemRecord[] records = importPage.getElements();
final IImportWriter writer = importPage.getWriter();
IRunnableWithProgress op = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
// $NON-NLS-1$
monitor.beginTask("Import Item", records.length);
writer.write(records, monitor);
monitor.done();
}
};
try {
ProgressUI.popProgressDialog(op);
} catch (Exception e) {
log.error(e, e);
}
CorePlugin.getDefault().refreshWorkSpace();
CorePlugin.getDefault().refreshDQView();
return true;
}
use of org.talend.dataprofiler.core.ui.imex.model.ItemRecord in project tdq-studio-se by Talend.
the class ImportWizard method performCancel.
@Override
public boolean performCancel() {
final ItemRecord[] records = importPage.getElements();
if (records.length > 0) {
final IImportWriter writer = importPage.getWriter();
try {
writer.finish(records, null);
writer.postFinish();
} catch (Exception e) {
ExceptionHandler.process(e);
}
}
return super.performCancel();
}
use of org.talend.dataprofiler.core.ui.imex.model.ItemRecord in project tdq-studio-se by Talend.
the class ImportWizardPage method updateErrorList.
/**
* DOC bZhou Comment method "updateErrorList".
*
* @param records
*/
public void updateErrorList(ItemRecord[] records) {
errors.clear();
for (ItemRecord record : records) {
errors.addAll(record.getErrors());
}
errorsList.setInput(errors);
errorsList.refresh();
}
use of org.talend.dataprofiler.core.ui.imex.model.ItemRecord in project tdq-studio-se by Talend.
the class ImportWizardPage method checkforErrors.
/**
* check that directory exist and issue an error message if not. <br>
* check that the folder is a data quality repository or issue an error.<br>
* check that anything is check in the tree or issue an error.<br>
*/
protected void checkforErrors() {
List<String> dErrors = new ArrayList<String>();
if (repositoryTree.getTree().getItems().length == 0) {
// $NON-NLS-1$
dErrors.add(Messages.getString("ImportWizardPage.0"));
}
if (repositoryTree.getCheckedElements().length == 0) {
// $NON-NLS-1$
dErrors.add(Messages.getString("ImportWizardPage.1"));
}
dErrors.addAll(writer.check());
ItemRecord[] elements = getElements();
for (ItemRecord record : elements) {
dErrors.addAll(record.getErrors());
for (File depFile : record.getDependencySet()) {
ItemRecord findRecord = ItemRecord.findRecord(depFile);
if (findRecord == null || !repositoryTree.getChecked(findRecord)) {
// TDQ-12410: if the dependency comes from reference project, we ingore it.
if (!DqFileUtils.isFileUnderBasePath(depFile, writer.getBasePath())) {
continue;
}
ModelElement element = ItemRecord.getElement(depFile);
// Indicator, don't add it into errors even if it is not exist
if (element instanceof IndicatorDefinition) {
String uuid = ResourceHelper.getUUID(element);
if (IndicatorDefinitionFileHelper.isTechnialIndicator(uuid)) {
continue;
}
}
// MOD qiongli 2012-12-13 TDQ-5356 use itself file name for jrxml
boolean isJrxmlDepFile = depFile.getName().endsWith(FactoriesUtil.JRXML);
// MOD msjian TDQ-5909: modify to displayName
String dptLabel = element != null && !isJrxmlDepFile && PropertyHelper.getProperty(element) != null ? PropertyHelper.getProperty(element).getDisplayName() : depFile.getName();
// TDQ-5909~
// $NON-NLS-1$ //$NON-NLS-2$
dErrors.add("\"" + record.getName() + "\" miss dependency :" + dptLabel);
}
}
}
if (!dErrors.isEmpty()) {
setErrorMessage(dErrors.get(0));
} else {
setErrorMessage(null);
}
updatePageStatus();
}
Aggregations