@Override public IWorkbenchPart getWorkbenchPart() { if (fContainer != null) return fContainer.getWorkbenchPart(); return null; }
@Override public void addCompareInputChangeListener(ICompareInput input, ICompareInputChangeListener listener) { if (fContainer == null) { input.addCompareInputChangeListener(listener); } else { fContainer.addCompareInputChangeListener(input, listener); } }
private IActionBars getActionBars() { return fContainer.getActionBars(); }
private void initialize() { if (fHandlerService == null) { IServiceLocator serviceLocator = fContainer.getServiceLocator(); if (serviceLocator != null) { IHandlerService service = (IHandlerService)serviceLocator.getService(IHandlerService.class); if (service != null) fHandlerService = service; } if (fHandlerService == null && fContainer.getWorkbenchPart() == null && fExpression != null) { // We're in a dialog so we can use an active shell expression IHandlerService service = (IHandlerService)PlatformUI.getWorkbench().getService(IHandlerService.class); if (service != null) { fHandlerService = service; } } } }
public MergeSourceViewer(SourceViewer sourceViewer, ResourceBundle bundle, ICompareContainer container) { Assert.isNotNull(sourceViewer); fSourceViewer= sourceViewer; fResourceBundle= bundle; fContainer = container; MenuManager menu= new MenuManager(); menu.setRemoveAllWhenShown(true); menu.addMenuListener(this); StyledText te= getSourceViewer().getTextWidget(); te.setMenu(menu.createContextMenu(te)); fContainer.registerContextMenu(menu, getSourceViewer()); // for listening to editor show/hide line number preference value fPreferenceChangeListener= event -> MergeSourceViewer.this.handlePropertyChangeEvent(event); EditorsUI.getPreferenceStore().addPropertyChangeListener(fPreferenceChangeListener); fShowLineNumber= EditorsUI.getPreferenceStore().getBoolean(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER); if(fShowLineNumber){ updateLineNumberRuler(); } IOperationHistory history = getHistory(); if (history != null) history.addOperationHistoryListener(this); // don't add save when in a dialog, IWorkbenchPart is null in dialog containers fAddSaveAction = fContainer.getWorkbenchPart() != null; }
container.removeCompareInputChangeListener((ICompareInput)oldInput, fCompareInputChangeListener); container.addCompareInputChangeListener((ICompareInput)input, fCompareInputChangeListener);
private boolean hasNextElement(boolean down) { ICompareNavigator navigator = getCompareConfiguration().getContainer().getNavigator(); if (navigator instanceof CompareNavigator) { CompareNavigator n = (CompareNavigator) navigator; return n.hasChange(down); } return false; }
@Override public void removeCompareInputChangeListener(ICompareInput input, ICompareInputChangeListener listener) { if (fContainer == null) { input.removeCompareInputChangeListener(listener); } else { fContainer.removeCompareInputChangeListener(input, listener); } }
@Override public void registerContextMenu(MenuManager menu, ISelectionProvider selectionProvider) { if (fContainer != null) fContainer.registerContextMenu(menu, selectionProvider); }
@Override public IServiceLocator getServiceLocator() { IServiceLocator serviceLocator = fContainer.getServiceLocator(); if (serviceLocator == null && !fContainerProvided) { // The old way to find the service locator return Utilities.findSite(fComposite); } return serviceLocator; }
private void initialize() { if (fHandlerService == null) { IServiceLocator serviceLocator = fContainer.getServiceLocator(); if (serviceLocator != null) { IHandlerService service = serviceLocator.getService(IHandlerService.class); if (service != null) fHandlerService = service; } if (fHandlerService == null && fContainer.getWorkbenchPart() == null && fExpression != null) { // We're in a dialog so we can use an active shell expression IHandlerService service = PlatformUI.getWorkbench().getService(IHandlerService.class); if (service != null) { fHandlerService = service; } } } }
container.removeCompareInputChangeListener((ICompareInput)oldInput, fCompareInputChangeListener); container.addCompareInputChangeListener((ICompareInput)input, fCompareInputChangeListener);
private boolean hasNextElement(boolean down) { ICompareNavigator navigator = getCompareConfiguration().getContainer().getNavigator(); if (navigator instanceof CompareNavigator) { CompareNavigator n = (CompareNavigator) navigator; return n.hasChange(down); } return false; }
public void removeCompareInputChangeListener(ICompareInput input, ICompareInputChangeListener listener) { if (fContainer == null) { input.removeCompareInputChangeListener(listener); } else { fContainer.removeCompareInputChangeListener(input, listener); } }
public void registerContextMenu(MenuManager menu, ISelectionProvider selectionProvider) { if (fContainer != null) fContainer.registerContextMenu(menu, selectionProvider); }
public IServiceLocator getServiceLocator() { IServiceLocator serviceLocator = fContainer.getServiceLocator(); if (serviceLocator == null && !fContainerProvided) { // The old way to find the service locator return Utilities.findSite(fComposite); } return serviceLocator; }
public IWorkbenchPart getWorkbenchPart() { if (fContainer != null) return fContainer.getWorkbenchPart(); return null; }
public static CompareHandlerService createFor(ICompareContainer container, Shell shell) { IServiceLocator serviceLocator = container.getServiceLocator(); if (serviceLocator != null) { IHandlerService service = serviceLocator.getService(IHandlerService.class); if (service != null) return new CompareHandlerService(container, null); } if (container.getWorkbenchPart() == null && shell != null) { // We're in a dialog so we can use an active shell expression IHandlerService service = PlatformUI.getWorkbench().getService(IHandlerService.class); if (service != null) { Expression e = new ActiveShellExpression(shell); return new CompareHandlerService(container, e); } } return new CompareHandlerService(null, null); }
private IActionBars getActionBars() { return fContainer.getActionBars(); }
private void performEndOfDocumentAction(Shell shell, IPreferenceStore store, String key, boolean next) { String value = store.getString(key); if (value.equals(ICompareUIConstants.PREF_VALUE_DO_NOTHING)) { return; } if (value.equals(ICompareUIConstants.PREF_VALUE_NEXT)) { ICompareNavigator navigator = getCompareConfiguration() .getContainer().getNavigator(); if (hasNextElement(next)) { navigator.selectChange(next); } } else { selectFirstDiff(next); } }