private void updateContentProvider() { setContentProvider(getCompareConfiguration().isMirrored() ? new MirroredMergeViewerContentProvider(getCompareConfiguration(), fDefaultContentProvider) : fDefaultContentProvider); }
@Override public void run() { IPreferenceStore preferences = getCompareConfiguration().getPreferenceStore(); preferences.setValue(ComparePreferencePage.SWAPPED, !getCompareConfiguration().isMirrored()); if (preferences instanceof IPersistentPreferenceStore) { try { ((IPersistentPreferenceStore) preferences).save(); } catch (IOException e) { CompareUIPlugin.log(e); } } } };
private void setAncestorVisibility(boolean visible, boolean enabled) { if (fAncestorItem != null) { Action action= (Action) fAncestorItem.getAction(); if (action != null) { action.setChecked(visible); action.setEnabled(enabled); } } getCompareConfiguration().setProperty(ICompareUIConstants.PROP_ANCESTOR_VISIBLE, Boolean.valueOf(visible)); }
private void setAncestorVisibility(boolean visible, boolean enabled) { if (fAncestorItem != null) { Action action= (Action) fAncestorItem.getAction(); if (action != null) { action.setChecked(visible); action.setEnabled(enabled); } } getCompareConfiguration().setProperty(ICompareUIConstants.PROP_ANCESTOR_VISIBLE, new Boolean(visible)); }
/** * Callback that is invoked when a property in the compare configuration * ({@link #getCompareConfiguration()} changes. * @param event the property change event * @since 3.3 */ protected void handlePropertyChangeEvent(PropertyChangeEvent event) { String key= event.getProperty(); if (key.equals(ICompareUIConstants.PROP_ANCESTOR_VISIBLE)) { fAncestorVisible= Utilities.getBoolean(getCompareConfiguration(), ICompareUIConstants.PROP_ANCESTOR_VISIBLE, fAncestorVisible); fComposite.layout(true); updateCursor(fLeftLabel, VERTICAL); updateCursor(fDirectionLabel, HORIZONTAL | VERTICAL); updateCursor(fRightLabel, VERTICAL); return; } if (key.equals(ICompareUIConstants.PROP_IGNORE_ANCESTOR)) { setAncestorVisibility(false, !Utilities.getBoolean(getCompareConfiguration(), ICompareUIConstants.PROP_IGNORE_ANCESTOR, false)); return; } }
/** * Callback that is invoked when a property in the compare configuration * ({@link #getCompareConfiguration()} changes. * @param event the property change event * @since 3.3 */ protected void handlePropertyChangeEvent(PropertyChangeEvent event) { String key= event.getProperty(); if (key.equals(ICompareUIConstants.PROP_ANCESTOR_VISIBLE)) { fAncestorVisible= Utilities.getBoolean(getCompareConfiguration(), ICompareUIConstants.PROP_ANCESTOR_VISIBLE, fAncestorVisible); fComposite.layout(true); updateCursor(fLeftLabel, VERTICAL); updateCursor(fDirectionLabel, HORIZONTAL | VERTICAL); updateCursor(fRightLabel, VERTICAL); return; } if (key.equals(ICompareUIConstants.PROP_IGNORE_ANCESTOR)) { setAncestorVisibility(false, !Utilities.getBoolean(getCompareConfiguration(), ICompareUIConstants.PROP_IGNORE_ANCESTOR, false)); return; } }
ICompareInputLabelProvider lp = getCompareConfiguration().getLabelProvider(); if (lp != null) lp.removeListener(labelChangeListener); ICompareContainer container = getCompareConfiguration().getContainer(); container.removeCompareInputChangeListener((ICompareInput)oldInput, fCompareInputChangeListener); ICompareContainer container = getCompareConfiguration().getContainer(); container.addCompareInputChangeListener((ICompareInput)input, fCompareInputChangeListener); ICompareInputLabelProvider lp = getCompareConfiguration().getLabelProvider(); if (lp != null) lp.addListener(labelChangeListener);
protected final void inputChanged(Object input, Object oldInput) { if (input != oldInput && oldInput != null) { ICompareInputLabelProvider lp = getCompareConfiguration().getLabelProvider(); if (lp != null) lp.removeListener(labelChangeListener); ICompareContainer container = getCompareConfiguration().getContainer(); container.removeCompareInputChangeListener((ICompareInput)oldInput, fCompareInputChangeListener); ICompareContainer container = getCompareConfiguration().getContainer(); container.addCompareInputChangeListener((ICompareInput)input, fCompareInputChangeListener); ICompareInputLabelProvider lp = getCompareConfiguration().getLabelProvider(); if (lp != null) lp.addListener(labelChangeListener);
void flushLeftSide(Object input, IProgressMonitor monitor) { IMergeViewerContentProvider content = (IMergeViewerContentProvider) getContentProvider(); boolean rightEmpty = content.getRightContent(input) == null; if (getCompareConfiguration().isLeftEditable() && isLeftDirty()) { byte[] bytes = getContents(true); if (rightEmpty && bytes != null && bytes.length == 0) bytes = null; setLeftDirty(false); content.saveLeftContent(input, bytes); } }
void flushRightSide(Object input, IProgressMonitor monitor) { IMergeViewerContentProvider content = (IMergeViewerContentProvider) getContentProvider(); boolean leftEmpty = content.getLeftContent(input) == null; if (getCompareConfiguration().isRightEditable() && isRightDirty()) { byte[] bytes = getContents(false); if (leftEmpty && bytes != null && bytes.length == 0) bytes = null; setRightDirty(false); content.saveRightContent(input, bytes); } }
boolean rightEmpty= content.getRightContent(input) == null; if (getCompareConfiguration().isLeftEditable() && isLeftDirty()) { byte[] bytes= getContents(true); if (rightEmpty && bytes != null && bytes.length == 0) if (getCompareConfiguration().isRightEditable() && isRightDirty()) { byte[] bytes= getContents(false); if (leftEmpty && bytes != null && bytes.length == 0)
ICompareContainer container = getCompareConfiguration().getContainer(); container.removeCompareInputChangeListener((ICompareInput)input, fCompareInputChangeListener); ICompareInputLabelProvider lp = getCompareConfiguration().getLabelProvider(); if (lp != null) lp.removeListener(labelChangeListener);
ICompareContainer container = getCompareConfiguration().getContainer(); container.removeCompareInputChangeListener((ICompareInput)input, fCompareInputChangeListener); ICompareInputLabelProvider lp = getCompareConfiguration().getLabelProvider(); if (lp != null) lp.removeListener(labelChangeListener);
/** * Updates the enabled state of the toolbar items. * <p> * This method is called whenever the state of the items needs updating. * <p> * Subclasses may extend this method, although this is generally not required. */ protected void updateToolItems() { IMergeViewerContentProvider content= getMergeContentProvider(); Object input= getInput(); if (copyLeftToRightItem != null) { boolean rightEditable = content.isRightEditable(input); copyLeftToRightItem.setVisible(rightEditable); copyLeftToRightItem.getAction().setEnabled(rightEditable); } if (copyRightToLeftItem != null) { boolean leftEditable = content.isLeftEditable(input); copyRightToLeftItem.setVisible(leftEditable); copyRightToLeftItem.getAction().setEnabled(leftEditable); } if (fSwitchLeftAndRight != null) { fSwitchLeftAndRight.setChecked(getCompareConfiguration().isMirrored()); } }
tbm.add(new Separator("navigation")); //$NON-NLS-1$ CompareConfiguration cc= getCompareConfiguration(); final ChangePropertyAction a= new ChangePropertyAction(fBundle, getCompareConfiguration(), "action.EnableAncestor.", ICompareUIConstants.PROP_ANCESTOR_VISIBLE); //$NON-NLS-1$ a.setChecked(fAncestorVisible); fAncestorItem= new ActionContributionItem(a);
fPreferenceChangeListener = event -> { if (event.getProperty().equals(ComparePreferencePage.SWAPPED)) { getCompareConfiguration().setProperty(CompareConfiguration.MIRRORED, event.getNewValue()); updateContentProvider(); updateToolItems();
fHandlerService= CompareHandlerService.createFor(getCompareConfiguration().getContainer(), fComposite.getShell());
fHandlerService= CompareHandlerService.createFor(getCompareConfiguration().getContainer(), fComposite.getShell());
tbm.appendToGroup("modes", fSwitchLeftAndRight); //$NON-NLS-1$ final ChangePropertyAction a= new ChangePropertyAction(fBundle, getCompareConfiguration(), "action.EnableAncestor.", ICompareUIConstants.PROP_ANCESTOR_VISIBLE); //$NON-NLS-1$ a.setChecked(fAncestorVisible); fAncestorItem= new ActionContributionItem(a);