public ComparePreviewer(Composite parent) { super(parent, SWT.BORDER | SWT.FLAT, true); fCompareConfiguration= new CompareConfiguration(); fCompareConfiguration.setLeftEditable(false); fCompareConfiguration.setLeftLabel(RefactoringUIMessages.ComparePreviewer_original_source); fCompareConfiguration.setRightEditable(false); fCompareConfiguration.setRightLabel(RefactoringUIMessages.ComparePreviewer_refactored_source); addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { if (fImage != null && !fImage.isDisposed()) fImage.dispose(); } }); Dialog.applyDialogFont(this); } public void setLabel(String label) {
private static CompareConfiguration createCompareConfiguration(ISynchronizePageConfiguration pageConfiguration) { CompareConfiguration compareConfiguration = new CompareConfiguration(); Object o = pageConfiguration.getProperty(IGNORE_WHITSPACE_PAGE_PROPERTY); if (o != null && (o.equals(Boolean.TRUE) || o.equals(Boolean.FALSE))) { compareConfiguration.setProperty(CompareConfiguration.IGNORE_WHITESPACE, o); } return compareConfiguration; }
/** * <b>Only the views are mirrored. All model values for left and right are not changed!</b> * * @return true if the left and right side of the viewer are mirrored. Default is false. * @since 3.7 */ public boolean isMirrored() { Object property = getProperty(MIRRORED); return property instanceof Boolean && (Boolean) property; }
CompareDialog(Shell parent, ResourceBundle bundle) { super(parent, bundle); fCompareConfiguration= new CompareConfiguration(); fCompareConfiguration.setLeftEditable(false); fCompareConfiguration.setRightEditable(false); }
private CompareConfiguration getCompareConfiguration() { if (fCompareConfiguration == null) { fCompareConfiguration= new CompareConfiguration(); fCompareConfiguration.setLeftEditable(false); fCompareConfiguration.setRightEditable(false); fCompareConfiguration.setContainer(new CompareContainer() { public void setStatusMessage(String message) { if (statusLabel != null && !statusLabel.isDisposed()) { if (message == null) { statusLabel.setText(""); //$NON-NLS-1$ } else { statusLabel.setText(message); } } } }); } return fCompareConfiguration; }
private void initLabels() { CompareConfiguration cc = getCompareConfiguration(); // set left editable so that unmatched hunks can be edited cc.setLeftEditable(true); cc.setRightEditable(false); //cc.setProperty(CompareEditor.CONFIRM_SAVE_PROPERTY, Boolean.FALSE); cc.setLeftLabel(getCompareConfiguration().getLeftLabel(root)); cc.setLeftImage(getCompareConfiguration().getLeftImage(root)); cc.setRightLabel(getCompareConfiguration().getRightLabel(root)); cc.setRightImage(getCompareConfiguration().getRightImage(root)); }
@Override public void prepareInput(ICompareInput input, CompareConfiguration configuration, IProgressMonitor monitor) { Object right = input.getRight(); if (right != null) { String label = getLabel(right); if (label != null) configuration.setRightLabel(label); Image image = getImage(right); if (image != null) configuration.setRightImage(image); } Object left = input.getLeft(); if (left != null) { String label = getLabel(left); if (label != null) configuration.setLeftLabel(label); Image image = getImage(left); if (image != null) configuration.setLeftImage(image); } }
private void initLabels() { CompareConfiguration cc = getCompareConfiguration(); cc.setLeftEditable(false); cc.setRightEditable(false); cc.setLeftLabel(l.getName()); cc.setLeftImage(l.getImage()); cc.setRightLabel(r.getName()); cc.setRightImage(r.getImage()); }
/** * Initializes the images in the compare configuration. */ void initializeCompareConfiguration() { CompareConfiguration cc= getCompareConfiguration(); if (fLeftResource != null) { cc.setLeftLabel(buildLabel(fLeftResource)); cc.setLeftImage(CompareUIPlugin.getImage(fLeftResource)); } if (fRightResource != null) { cc.setRightLabel(buildLabel(fRightResource)); cc.setRightImage(CompareUIPlugin.getImage(fRightResource)); } if (fThreeWay && fAncestorResource != null) { cc.setAncestorLabel(buildLabel(fAncestorResource)); cc.setAncestorImage(CompareUIPlugin.getImage(fAncestorResource)); } }
public void open(OpenEvent event) { IStructuredSelection sel= (IStructuredSelection) event.getSelection(); Object obj= sel.getFirstElement(); if (obj instanceof HunkDiffNode) { getCompareConfiguration().setLeftLabel(PatchMessages.PreviewPatchPage2_PatchedLocalFile); getCompareConfiguration().setRightLabel(PatchMessages.PreviewPatchPage2_OrphanedHunk); } else { getCompareConfiguration().setLeftLabel(PatchMessages.PatcherCompareEditorInput_LocalCopy); getCompareConfiguration().setRightLabel(PatchMessages.PatcherCompareEditorInput_AfterPatch); } }
@Override protected ICompareInput prepareCompareInput(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { monitor.beginTask(TeamUIMessages.SyncInfoCompareInput_3, 100); monitor.setTaskName(TeamUIMessages.SyncInfoCompareInput_3); getCompareConfiguration().setLeftEditable(isLeftEditable(input)); getCompareConfiguration().setRightEditable(false); try { ISynchronizationCompareInput adapter = asModelCompareInput(input); if (adapter != null) { adapter.prepareInput(getCompareConfiguration(), Policy.subMonitorFor(monitor, 100)); } } catch (CoreException e) { throw new InvocationTargetException(e); } finally { monitor.done(); } return input; }
/** * Create an operation for the given part and resource. This method is a convenience * method that calls {@link #ApplyPatchOperation(IWorkbenchPart, IStorage, IResource, CompareConfiguration)} * with appropriate defaults for the other parameters. * @param targetPart an IResource which the patch is to be applied to or <code>null</code> * @param resource an IResource which the patch is to be applied to or <code>null</code> * @see #ApplyPatchOperation(IWorkbenchPart, IStorage, IResource, CompareConfiguration) */ public ApplyPatchOperation(IWorkbenchPart targetPart, IResource resource) { this(targetPart, null, resource, new CompareConfiguration()); }
public static void updateLabels(SyncInfo sync, CompareConfiguration config) { final IResourceVariant remote = sync.getRemote(); final IResourceVariant base = sync.getBase(); String localContentId = sync.getLocalContentIdentifier(); if (localContentId != null) { config.setLeftLabel(NLS.bind(TeamUIMessages.SyncInfoCompareInput_localLabelExists, new String[] { localContentId })); } else { config.setLeftLabel(TeamUIMessages.SyncInfoCompareInput_localLabel); } if (remote != null) { config.setRightLabel(NLS.bind(TeamUIMessages.SyncInfoCompareInput_remoteLabelExists, new String[] { remote.getContentIdentifier() })); } else { config.setRightLabel(TeamUIMessages.SyncInfoCompareInput_remoteLabel); } if (base != null) { config.setAncestorLabel(NLS.bind(TeamUIMessages.SyncInfoCompareInput_baseLabelExists, new String[] { base.getContentIdentifier() })); } else { config.setAncestorLabel(TeamUIMessages.SyncInfoCompareInput_baseLabel); } }
protected Viewer createMergeViewer(Composite parent, CompareConfiguration compareConfiguration) { compareConfiguration.setProperty(DefaultMergeEditor.PROVIDER, mergeEditorProvider); return new DefaultMergeViewer(parent, SWT.NULL, compareConfiguration, documentProvider, sourceViewerConfigurationProvider); }
/** * @param useWorkspace * if <code>true</code>, use the workspace content (i.e. the * Git-merged version) as "left" content, otherwise use HEAD * (i.e. the previous, non-merged version) * @param resources * as selected by the user */ public GitMergeEditorInput(boolean useWorkspace, IResource... resources) { super(new CompareConfiguration()); this.useWorkspace = useWorkspace; this.resources = resources; CompareConfiguration config = getCompareConfiguration(); config.setLeftEditable(true); }
void setProperty(boolean state) { if (fCompareConfiguration != null) { Map filters = new HashMap(); if (fCompareConfiguration.getProperty(COMPARE_FILTERS) != null) { filters.putAll((Map) fCompareConfiguration .getProperty(COMPARE_FILTERS)); } if (state) { filters.put(fCompareFilterDescriptor.getFilterId(), fCompareFilter); } else { filters.remove(fCompareFilterDescriptor.getFilterId()); } fCompareConfiguration.setProperty(COMPARE_FILTERS, filters); } }
public void widgetDisposed(DisposeEvent e) { if(compareConfiguration != null) { compareConfiguration.dispose(); } } });
private static CompareEditorInput prepareCompareInput( Repository repository, String gitPath, ITypedElement base, String refName) throws IOException { final ObjectId destCommitId = repository.resolve(refName); RevWalk rw = new RevWalk(repository); RevCommit commit = rw.parseCommit(destCommitId); rw.release(); final ITypedElement destCommit = getFileRevisionTypedElement(gitPath, commit, repository); final ITypedElement commonAncestor; if (base != null && commit != null) { final ObjectId headCommitId = repository.resolve(Constants.HEAD); commonAncestor = getFileRevisionTypedElementForCommonAncestor( gitPath, headCommitId, destCommitId, repository); } else { commonAncestor = null; } final GitCompareFileRevisionEditorInput in = new GitCompareFileRevisionEditorInput( base, destCommit, commonAncestor, null); in.getCompareConfiguration().setRightLabel(refName); return in; }
public void prepareInput(ICompareInput input, CompareConfiguration configuration, IProgressMonitor monitor) { Object right = input.getRight(); if (right != null) { String label = getLabel(right); if (label != null) configuration.setRightLabel(label); Image image = getImage(right); if (image != null) configuration.setRightImage(image); } Object left = input.getLeft(); if (left != null) { String label = getLabel(left); if (label != null) configuration.setLeftLabel(label); Image image = getImage(left); if (image != null) configuration.setLeftImage(image); } }
private void initLabels() { CompareConfiguration cc = getCompareConfiguration(); // set left editable so that unmatched hunks can be edited cc.setLeftEditable(true); cc.setRightEditable(false); //cc.setProperty(CompareEditor.CONFIRM_SAVE_PROPERTY, new Boolean(false)); cc.setLeftLabel(getCompareConfiguration().getLeftLabel(root)); cc.setLeftImage(getCompareConfiguration().getLeftImage(root)); cc.setRightLabel(getCompareConfiguration().getRightLabel(root)); cc.setRightImage(getCompareConfiguration().getRightImage(root)); }