private boolean checkState() { if (fViewer == null) return false; Control control = fViewer.getControl(); if (control == null) return false; return !control.isDisposed(); }
private boolean checkState() { if (fViewer == null) return false; Control control = fViewer.getControl(); if (control == null) return false; return !control.isDisposed(); }
@Override public IStatus runInUIThread(IProgressMonitor monitor) { if (!getControl().isDisposed()) { doDiff(); if (!getControl().isDisposed()) { Diff newDiff = findNewDiff(oldDiff); if (newDiff != null) { updateStatus(newDiff); setCurrentDiff(newDiff, true); } invalidateLines(); updateLines(doc); } } return Status.OK_STATUS; } }.schedule();
private void endOfDocumentReached(boolean down) { Control c= getControl(); if (Utilities.okToUse(c)) { handleEndOfDocumentReached(c.getShell(), down); } }
private void endOfDocumentReached(boolean down) { Control c= getControl(); if (Utilities.okToUse(c)) { handleEndOfDocumentReached(c.getShell(), down); } }
if (ext.isReadOnly(fDocumentKey)) { try { ext.validateState(fDocumentKey, getControl().getShell()); ext.updateStateCache(fDocumentKey); } catch (CoreException e) { ErrorDialog.openError(getControl().getShell(), CompareMessages.TextMergeViewer_12, CompareMessages.TextMergeViewer_13, e.getStatus()); return false; if (ext != null) { if (ext.isReadOnly()) { IStatus status = ext.validateEdit(getControl().getShell()); if (!status.isOK()) { if (status.getSeverity() == IStatus.ERROR) { ErrorDialog.openError(getControl().getShell(), CompareMessages.TextMergeViewer_14, CompareMessages.TextMergeViewer_15, status); return false;
if (ext.isReadOnly(fDocumentKey)) { try { ext.validateState(fDocumentKey, getControl().getShell()); ext.updateStateCache(fDocumentKey); } catch (CoreException e) { ErrorDialog.openError(getControl().getShell(), CompareMessages.TextMergeViewer_12, CompareMessages.TextMergeViewer_13, e.getStatus()); return false; if (ext != null) { if (ext.isReadOnly()) { IStatus status = ext.validateEdit(getControl().getShell()); if (!status.isOK()) { if (status.getSeverity() == IStatus.ERROR) { ErrorDialog.openError(getControl().getShell(), CompareMessages.TextMergeViewer_14, CompareMessages.TextMergeViewer_15, status); return false;
/* package */ void update(boolean includeControls) { if (getControl().isDisposed()) return; if (fHasErrors) { resetDiffs(); } else { doDiff(); } if (includeControls) updateControls(); updateVScrollBar(); updatePresentation(); }
private int getViewportHeight() { StyledText te= fLeft.getTextWidget(); int vh= te.getClientArea().height; if (vh == 0) { Rectangle trim= te.computeTrim(0, 0, 0, 0); int scrollbarHeight= trim.height; int headerHeight= getHeaderHeight(); Composite composite= (Composite) getControl(); Rectangle r= composite.getClientArea(); vh= r.height-headerHeight-scrollbarHeight; } return vh / te.getLineHeight(); }
/* package */ void update(boolean includeControls) { if (getControl().isDisposed()) return; if (fHasErrors) { resetDiffs(); } else { doDiff(); } if (includeControls) updateControls(); updateVScrollBar(); updatePresentation(null); }
private int getViewportHeight() { StyledText te= fLeft.getSourceViewer().getTextWidget(); int vh= te.getClientArea().height; if (vh == 0) { Rectangle trim= te.computeTrim(0, 0, 0, 0); int scrollbarHeight= trim.height; int headerHeight= getHeaderHeight(); Composite composite= (Composite) getControl(); Rectangle r= composite.getClientArea(); vh= r.height-headerHeight-scrollbarHeight; } return vh / te.getLineHeight(); }
private Control createPreviewer(Composite parent) { final CompareConfiguration compareConfiguration = new CompareConfiguration(); compareConfiguration.setLeftLabel(ResourceUtil.getString("CompareResultDialog.expectedLabel")); //$NON-NLS-1$ compareConfiguration.setLeftEditable(false); compareConfiguration.setRightLabel(ResourceUtil.getString("CompareResultDialog.actualLabel")); //$NON-NLS-1$ compareConfiguration.setRightEditable(false); compareConfiguration.setProperty(CompareConfiguration.IGNORE_WHITESPACE, Boolean.FALSE); fViewer = new CompareResultMergeViewer(parent, SWT.NONE, compareConfiguration); fViewer.setInput(new DiffNode(new CompareElement(fExpected), new CompareElement(fActual))); Control control = fViewer.getControl(); control.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { if(compareConfiguration != null) { compareConfiguration.dispose(); } } }); return control; }
Control c= fPreviewViewer.getControl(); c.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) {
private Control createPreviewer(Composite parent) { fCompareConfiguration= new CompareConfiguration(fOverlayStore); fCompareConfiguration.setAncestorLabel(Utilities.getString("ComparePreferencePage.ancestor.label")); //$NON-NLS-1$ fCompareConfiguration.setLeftLabel(Utilities.getString("ComparePreferencePage.left.label")); //$NON-NLS-1$ fCompareConfiguration.setLeftEditable(false); fCompareConfiguration.setRightLabel(Utilities.getString("ComparePreferencePage.right.label")); //$NON-NLS-1$ fCompareConfiguration.setRightEditable(false); TextMergeViewer fPreviewViewer= new TextMergeViewer(parent, SWT.BORDER, fCompareConfiguration); fPreviewViewer.setInput( new DiffNode(Differencer.CONFLICTING, new FakeInput("ComparePreferencePage.previewAncestor"), //$NON-NLS-1$ new FakeInput("ComparePreferencePage.previewLeft"), //$NON-NLS-1$ new FakeInput("ComparePreferencePage.previewRight") //$NON-NLS-1$ ) ); Control c= fPreviewViewer.getControl(); c.addDisposeListener(e -> { if (fCompareConfiguration != null) fCompareConfiguration.dispose(); }); return c; }
int scrollbarHeight= trim.height + trim.x; Composite composite= (Composite) getControl();
int scrollbarHeight= trim.height + trim.x; Composite composite= (Composite) getControl();
private void updateControls() { if (getControl().isDisposed()) return;