use of org.eclipse.compare.structuremergeviewer.DiffTreeViewer in project tmdm-studio-se by Talend.
the class ResourceCompareInput method createDiffViewer.
@Override
public Viewer createDiffViewer(Composite parent) {
fDiffViewer = new DiffTreeViewer(parent, getCompareConfiguration()) {
@Override
protected void fillContextMenu(IMenuManager manager) {
if (fOpenAction == null) {
fOpenAction = new Action() {
@Override
public void run() {
handleOpen(null);
}
};
// $NON-NLS-1$
Utilities.initAction(fOpenAction, getBundle(), "action.CompareContents.");
}
boolean enable = false;
ISelection selection = getSelection();
if (selection instanceof IStructuredSelection) {
IStructuredSelection ss = (IStructuredSelection) selection;
if (ss.size() == 1) {
Object element = ss.getFirstElement();
if (element instanceof MyDiffNode) {
ITypedElement te = ((MyDiffNode) element).getId();
if (te != null) {
enable = !ITypedElement.FOLDER_TYPE.equals(te.getType());
}
} else {
enable = true;
}
}
}
fOpenAction.setEnabled(enable);
manager.add(fOpenAction);
super.fillContextMenu(manager);
}
};
fDiffViewer.getControl();
return fDiffViewer;
}
Aggregations