use of org.talend.dataprofiler.ecos.model.IEcosComponent in project tdq-studio-se by Talend.
the class ComponentSearcher method getAvailableComponentExtensions.
/**
* get Available Component Extensions depend on isOnFilter.
*
* @param version
* @param categry
* @param isOnFilter
* @return
*/
public static List<IEcosComponent> getAvailableComponentExtensions(String version, IEcosCategory categry, boolean isOnFilter) {
List<IEcosComponent> extensions = new ArrayList<IEcosComponent>();
// when on filter, do not get component from internet
if (isOnFilter) {
return extensions;
}
try {
List<RevisionInfo> revisions = EcosystemService.getRevisionList(categry.getId(), version);
Map<String, IEcosComponent> extensionsMap = new HashMap<String, IEcosComponent>();
for (RevisionInfo revision : revisions) {
IEcosComponent extension = extensionsMap.get(revision.getExtenson_name());
if (extension == null) {
extension = new EcosComponent();
extension.setName(revision.getExtenson_name());
extension.setAuthor(revision.getAuthor_name());
extension.setCategry(categry);
extension.setDescription(revision.getExtension_description());
extensionsMap.put(extension.getName(), extension);
extensions.add(extension);
}
IRevision rev = convertRevision(revision);
extension.getRevisions().add(rev);
if (extension.getLatestRevision() == null || extension.getLatestRevision().getDate().before(rev.getDate())) {
// assumes that the revision with latest release date is the newest one.
extension.setLatestRevision(rev);
}
}
} catch (Exception e) {
log.error(e, e);
}
return extensions;
}
use of org.talend.dataprofiler.ecos.model.IEcosComponent in project tdq-studio-se by Talend.
the class ImportRemotePatternAction method run.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.Action#run()
*/
@Override
public void run() {
setEnabled(false);
try {
Job job = new DownloadJob(components);
fExtensionDownloaded = 0;
fInstalledComponents = new ArrayList<IEcosComponent>();
job.addJobChangeListener(new JobChangeAdapter() {
@Override
public void done(final IJobChangeEvent event) {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
doImportAfterDownload(event);
}
});
}
});
JobService.scheduleUserJob(job);
} catch (Throwable e) {
ExceptionHandler.process(e);
}
}
use of org.talend.dataprofiler.ecos.model.IEcosComponent in project tdq-studio-se by Talend.
the class ImportRemotePatternAction method doImportAfterDownload.
private void doImportAfterDownload(IJobChangeEvent event) {
final List<ReturnCode> information = new ArrayList<ReturnCode>();
setEnabled(true);
if (fExtensionDownloaded > 0) {
// $NON-NLS-1$
String csvFormat = System.getProperty("talend.exchange.csv");
if ("true".equals(csvFormat)) {
// $NON-NLS-1$
for (IEcosComponent componet : fInstalledComponents) {
List<ImportObject> validImportObject = ImportObject.extractImportObject(componet, information);
if (!validImportObject.isEmpty()) {
String categoryName = componet.getCategry().getName();
EEcosCategory ecosCategory = EEcosCategory.getEcosCategory(categoryName);
if (ecosCategory != null) {
EResourceConstant resourceType = ecosCategory.getResource();
for (ImportObject importObject : validImportObject) {
information.addAll(ImportFactory.doImport(resourceType, importObject, componet.getName()));
}
}
}
}
// MOD qiongli 2011-11-28 TDQ-4038,give the message when there is nothing to import.
if (information.isEmpty()) {
information.add(new ReturnCode(DefaultMessagesImpl.getString("ImportRemotePatternAction.NothingImport"), // $NON-NLS-1$
false));
}
ImportInfoDialog.openImportInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), DefaultMessagesImpl.getString("ImportRemotePatternAction.ImportFinish"), // $NON-NLS-1$
information.toArray(new ReturnCode[0]));
CorePlugin.getDefault().refreshDQView();
} else {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
for (IEcosComponent componet : fInstalledComponents) {
try {
ImportFactory.importFromExchange(componet);
} catch (Exception e) {
ExceptionHandler.process(e);
}
}
}
});
}
}
}
use of org.talend.dataprofiler.ecos.model.IEcosComponent in project tdq-studio-se by Talend.
the class ImportRemotePatternActionProvider method fillContextMenu.
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.actions.ActionGroup#fillContextMenu(org.eclipse.jface.action.IMenuManager)
*/
@Override
public void fillContextMenu(IMenuManager menu) {
// MOD mzhao user readonly role on svn repository mode.
if (!isShowMenu()) {
return;
}
TreeSelection currentSelection = ((TreeSelection) this.getContext().getSelection());
List<IEcosComponent> selectedComponents = new ArrayList<IEcosComponent>();
for (Object obj : currentSelection.toArray()) {
if (obj instanceof ExchangeComponentRepNode) {
ExchangeComponentRepNode node = (ExchangeComponentRepNode) obj;
selectedComponents.add(node.getEcosComponent());
}
}
if (selectedComponents.size() > 0) {
ImportRemotePatternAction importAction = new ImportRemotePatternAction(selectedComponents.toArray(new IEcosComponent[selectedComponents.size()]));
menu.add(importAction);
}
}
use of org.talend.dataprofiler.ecos.model.IEcosComponent in project tdq-studio-se by Talend.
the class RespositoryDetailView method selectionChanged.
/*
* (non-Javadoc)
*
* @seeorg.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui. IWorkbenchPart,
* org.eclipse.jface.viewers.ISelection)
*/
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
clearContainer();
boolean isNeedcreateDefault = true;
try {
if (part instanceof DQRespositoryView) {
StructuredSelection sel = (StructuredSelection) selection;
// MOD by zshen for bug 15750 TODO 39(13) make Detail View can be used.
Object fe = sel.getFirstElement();
// MOD klliu 2011-02-24 if choose diffirent node ,that will load diffirent child ,so that not use up.
if (fe instanceof AnalysisRepNode || fe instanceof ReportRepNode || fe instanceof SysIndicatorDefinitionRepNode || fe instanceof PatternRepNode || fe instanceof RuleRepNode) {
fe = ((IRepositoryNode) fe).getObject();
}
if (fe instanceof IFile) {
IFile fe2 = (IFile) fe;
isNeedcreateDefault = createFileDetail(isNeedcreateDefault, fe2);
} else if (fe instanceof IRepositoryViewObject) {
isNeedcreateDefault = createFileDetail(isNeedcreateDefault, (IRepositoryViewObject) fe);
} else if (fe instanceof DBConnectionRepNode) {
DBConnectionRepNode connNode = (DBConnectionRepNode) fe;
// MOD sizhaoliu TDQ-6316
ConnectionItem connectionItem = (ConnectionItem) connNode.getObject().getProperty().getItem();
createDataProviderDetail(connectionItem);
isNeedcreateDefault = false;
} else if (fe instanceof DBCatalogRepNode) {
DBCatalogRepNode catalogNode = (DBCatalogRepNode) fe;
Catalog catalog = catalogNode.getCatalog();
createTdCatalogDetail(catalog);
isNeedcreateDefault = false;
} else if (fe instanceof DBSchemaRepNode) {
DBSchemaRepNode schemaNode = (DBSchemaRepNode) fe;
Schema schema = schemaNode.getSchema();
createTdSchemaDetail(schema);
isNeedcreateDefault = false;
} else if (fe instanceof DBTableRepNode) {
DBTableRepNode tableNode = (DBTableRepNode) fe;
// MOD gdbu 2011-9-14 TDQ-3243
if (!DQRepositoryNode.isOnFilterring()) {
tableNode.getChildren().get(0).getChildren();
}
// ~TDQ-3243
TdTable tdTable = tableNode.getTdTable();
createTableDetail(tdTable);
isNeedcreateDefault = false;
} else if (fe instanceof DBViewRepNode) {
DBViewRepNode viewNode = (DBViewRepNode) fe;
// MOD gdbu 2011-9-14 TDQ-3243
if (!DQRepositoryNode.isOnFilterring()) {
viewNode.getChildren().get(0).getChildren();
}
// ~TDQ-3243
createNameCommentDetail(viewNode.getTdView());
isNeedcreateDefault = false;
} else if (fe instanceof DBColumnRepNode) {
DBColumnRepNode columnNode = (DBColumnRepNode) fe;
TdColumn column = columnNode.getTdColumn();
createTdColumn(column);
isNeedcreateDefault = false;
} else if (fe instanceof IEcosComponent) {
IEcosComponent component = (IEcosComponent) fe;
createEcosComponent(component);
isNeedcreateDefault = false;
} else if (fe instanceof RegularExpression) {
// MOD mzhao 2009-04-20,Bug 6349.
RegularExpression regularExpression = (RegularExpression) fe;
createRegularExpression(regularExpression);
isNeedcreateDefault = false;
} else if (fe instanceof PatternLanguageRepNode) {
// MOD mzhao 2012-08-15,feature TDQ-4037.
PatternLanguageRepNode pattLangNode = (PatternLanguageRepNode) fe;
createRegularExpression(pattLangNode.getRegularExpression());
isNeedcreateDefault = false;
} else if (fe instanceof SourceFileRepNode) {
// MOD klliu 2001-02-28 bug 19154
IPath filePath = WorkbenchUtils.getFilePath((SourceFileRepNode) fe);
DQRepositoryNode node = (DQRepositoryNode) fe;
IFile file = ResourceManager.getRoot().getProject(node.getProject().getTechnicalLabel()).getFile(filePath);
createSqlFileDetail(file);
} else if (fe instanceof ExchangeComponentRepNode) {
// MOD klliu 2001-02-28 bug 19154
IEcosComponent ecosComponent = ((ExchangeComponentRepNode) fe).getEcosComponent();
IEcosComponent component = ecosComponent;
createEcosComponent(component);
isNeedcreateDefault = false;
// ADD by msjian 2011-5-12 21186: don't check whether the selected object is "MDMConnectionRepNode"
} else if (fe instanceof DFConnectionRepNode) {
DFConnectionRepNode dfNode = (DFConnectionRepNode) fe;
DelimitedFileConnection dfConnection = dfNode.getDfConnection();
createDFconnectionName(dfNode.getObject().getLabel());
createDataProviderDetail(dfConnection);
isNeedcreateDefault = false;
}
if (PluginChecker.isTDQLoaded()) {
if (fe instanceof EObject) {
createTechnicalDetail((EObject) fe);
} else if (fe instanceof IFile) {
createTechnicalDetail((IFile) fe);
} else if (fe instanceof IRepositoryViewObject) {
createTechnicalDetail((IRepositoryViewObject) fe);
} else {
createExtDefault();
}
}
if (!scomp.isDisposed()) {
scomp.setMinSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
composite.layout();
}
} else if (part instanceof CommonFormEditor) {
CommonFormEditor editor = (CommonFormEditor) part;
IEditorInput editorInput = editor.getEditorInput();
if (editorInput instanceof IFileEditorInput) {
IFileEditorInput input = (IFileEditorInput) editorInput;
IFile file = input.getFile();
isNeedcreateDefault = createFileDetail(isNeedcreateDefault, file);
}
}
if (isNeedcreateDefault) {
createDefault();
}
// feature 19053
if (!gContainer.isDisposed()) {
gContainer.layout();
if (tContainer != null) {
tContainer.layout();
}
}
} catch (MissingDriverException e) {
if (PluginChecker.isOnlyTopLoaded()) {
MessageDialog.openWarning(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), // $NON-NLS-1$
DefaultMessagesImpl.getString("RespositoryDetailView.warning"), e.getErrorMessage());
} else {
log.error(e, e);
}
}
}
Aggregations