use of org.talend.dataprofiler.core.ui.editor.analysis.AnalysisItemEditorInput in project tdq-studio-se by Talend.
the class DataFilterDND method installDND.
public static void installDND(final Text targetControl) {
IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
DQRespositoryView findView = (DQRespositoryView) activePage.findView(DQRespositoryView.ID);
final CommonViewer commonViewer = findView.getCommonViewer();
final LocalSelectionTransfer transfer = LocalSelectionTransfer.getTransfer();
int operations = DND.DROP_COPY | DND.DROP_MOVE;
Transfer[] transfers = new Transfer[] { transfer };
DropTarget dropTarget = new DropTarget(targetControl, operations);
dropTarget.setTransfer(transfers);
dropTarget.addDropListener(new DropTargetAdapter() {
@Override
public void dragEnter(DropTargetEvent event) {
Object obj = ((IStructuredSelection) commonViewer.getSelection()).getFirstElement();
if (!(obj instanceof DBColumnRepNode)) {
event.detail = DND.DROP_NONE;
} else {
event.detail = DND.DROP_MOVE;
event.feedback = DND.FEEDBACK_INSERT_AFTER;
}
}
@Override
public void dropAccept(DropTargetEvent event) {
// do nothing until now
}
@Override
public void drop(DropTargetEvent event) {
if (event.detail != DND.DROP_NONE) {
IStructuredSelection selection = (IStructuredSelection) commonViewer.getSelection();
if (!selection.isEmpty()) {
List list = selection.toList();
IEditorPart currentActiveEditor = CorePlugin.getDefault().getCurrentActiveEditor();
if (currentActiveEditor instanceof AnalysisEditor) {
AnalysisEditor editor = (AnalysisEditor) currentActiveEditor;
AnalysisItemEditorInput input = (AnalysisItemEditorInput) editor.getEditorInput();
for (Object object : list) {
DBColumnRepNode node = (DBColumnRepNode) object;
DbmsLanguage language = DbmsLanguageFactory.createDbmsLanguage((Analysis) input.getModel());
MetadataColumnRepositoryObject columnObject = (MetadataColumnRepositoryObject) node.getObject();
String name = columnObject.getTdColumn().getName();
targetControl.insert(language.quote(name));
// Focus text.
targetControl.forceFocus();
}
}
}
}
}
});
}
use of org.talend.dataprofiler.core.ui.editor.analysis.AnalysisItemEditorInput in project tdq-studio-se by Talend.
the class TableAnalysisWizard method openEditor.
/*
* (non-Javadoc)
*
* @see
* org.talend.dataprofiler.core.ui.wizard.analysis.AbstractAnalysisWizard#openEditor(org.talend.repository.model.IRepositoryNode
* )
*/
@Override
public void openEditor(IRepositoryNode repNode) {
AnalysisItemEditorInput itemEditorInput = new AnalysisItemEditorInput(repNode);
CorePlugin.getDefault().openEditor(itemEditorInput, AnalysisEditor.class.getName());
}
use of org.talend.dataprofiler.core.ui.editor.analysis.AnalysisItemEditorInput in project tdq-studio-se by Talend.
the class AbstractAnalysisWizard method openEditor.
/*
* (non-Javadoc)
*
* @see org.talend.dataprofiler.core.ui.wizard.AbstractWizard#openEditor(org.talend.repository.model.IRepositoryNode)
*/
@Override
public void openEditor(IRepositoryNode repNode) {
String editorID = null;
AnalysisItemEditorInput analysisEditorInput = new AnalysisItemEditorInput(repNode);
IRepositoryNode connectionRepNode = getParameter().getConnectionRepNode();
analysisEditorInput.setConnectionNode(connectionRepNode);
// add support for match analysis editor
Analysis analysis = (Analysis) analysisEditorInput.getModel();
if (analysis.getParameters() != null && analysis.getParameters().getAnalysisType().equals(AnalysisType.MATCH_ANALYSIS)) {
editorID = MatchAnalysisEditor.class.getName();
} else {
editorID = AnalysisEditor.class.getName();
}
CorePlugin.getDefault().openEditor(analysisEditorInput, editorID);
}
use of org.talend.dataprofiler.core.ui.editor.analysis.AnalysisItemEditorInput in project tdq-studio-se by Talend.
the class WorkbenchUtils method getIEditorReference.
/**
* Get Editors which is is same as editorID --used for the analysis editor only
*
* @param editorID
* @param analysisName
* @return
*/
private static List<IEditorReference> getIEditorReference(String editorID, String analysisName) {
List<IEditorReference> returnCode = new ArrayList<IEditorReference>();
IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IEditorReference[] editors = activePage.getEditorReferences();
if (editors != null) {
for (IEditorReference editorRef : editors) {
if (editorRef.getId().equals(editorID)) {
IEditorInput editorInput;
try {
editorInput = editorRef.getEditorInput();
if (editorInput instanceof AbstractItemEditorInput) {
AnalysisItemEditorInput anaItemEditorInput = (AnalysisItemEditorInput) editorInput;
// if not pointed which analysis, add all opened ones.
if (StringUtils.isEmpty(analysisName) || StringUtils.equals(analysisName, anaItemEditorInput.getModel().getName())) {
returnCode.add(editorRef);
}
}
} catch (PartInitException e) {
log.error(e, e);
}
}
}
}
return returnCode;
}
use of org.talend.dataprofiler.core.ui.editor.analysis.AnalysisItemEditorInput in project tdq-studio-se by Talend.
the class TdqContextView method setCompositeReadonly.
/*
* (non-Javadoc)
*
* @see org.talend.core.ui.context.view.AbstractContextView#setCompositeReadonly(org.eclipse.ui.IEditorInput)
*/
@Override
protected void setCompositeReadonly(IEditorInput editorInput) {
if (editorInput != null) {
if (editorInput instanceof ReportItemEditorInput) {
ReportItemEditorInput reportInput = (ReportItemEditorInput) editorInput;
boolean readOnly = reportInput.getModel() == null;
contextComposite.setReadOnly(readOnly);
} else if (editorInput instanceof AnalysisItemEditorInput) {
AnalysisItemEditorInput analysisInput = (AnalysisItemEditorInput) editorInput;
boolean readOnly = analysisInput.getModel() == null;
contextComposite.setReadOnly(readOnly);
}
}
}
Aggregations