@Override protected Viewer getViewer(Viewer oldViewer, Object input) { if (input instanceof ICompareInput) { if (fSelectedViewerDescriptor != null) { ViewerDescriptor[] array = CompareUIPlugin.getDefault().findStructureViewerDescriptor( oldViewer, (ICompareInput)input, getCompareConfiguration()); List list = array != null ? Arrays.asList(array) : Collections.EMPTY_LIST; if (list.contains(fSelectedViewerDescriptor)) { // use selected viewer only when appropriate for the new input fCompareEditorInput .setStructureViewerDescriptor(fSelectedViewerDescriptor); Viewer viewer = fCompareEditorInput.findStructureViewer( oldViewer, (ICompareInput) input, this); return viewer; } // fallback to default otherwise fSelectedViewerDescriptor = null; } fCompareEditorInput.setStructureViewerDescriptor(null); Viewer viewer = fCompareEditorInput.findStructureViewer(oldViewer, (ICompareInput) input, this); fCompareEditorInput.setStructureViewerDescriptor(fSelectedViewerDescriptor); return viewer; } return null; }
@Override public void setInput(Object input) { super.setInput(input); if (getViewer() == null || !Utilities.okToUse(getViewer().getControl())) return; ViewerDescriptor[] vd = null; if (getInput() instanceof ICompareInput) { vd = CompareUIPlugin.getDefault().findStructureViewerDescriptor( getViewer(), (ICompareInput) getInput(), getCompareConfiguration()); } toolBar.setVisible(vd != null && vd.length > 1); }
ViewerDescriptor[] descriptors = findStructureViewerDescriptor(oldViewer, input, configuration); if (descriptors == null || descriptors.length == 0) {
.findStructureViewerDescriptor(getViewer(), (ICompareInput) getInput(), getCompareConfiguration());