Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 12398 Details for
Bug 37648
Exceptions after one of the compare viewer inputs got deleted
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
fix for compare plugin
37648a.txt (text/plain), 6.81 KB, created by
Andre Weinand
on 2004-06-17 11:58:26 EDT
(
hide
)
Description:
fix for compare plugin
Filename:
MIME Type:
Creator:
Andre Weinand
Created:
2004-06-17 11:58:26 EDT
Size:
6.81 KB
patch
obsolete
>Index: compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.compare/compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java,v >retrieving revision 1.136 >diff -u -r1.136 TextMergeViewer.java >--- compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java 10 Jun 2004 13:05:48 -0000 1.136 >+++ compare/org/eclipse/compare/contentmergeviewer/TextMergeViewer.java 17 Jun 2004 15:01:34 -0000 >@@ -60,6 +60,7 @@ > import org.eclipse.compare.internal.ICompareContextIds; > import org.eclipse.compare.internal.MergeSourceViewer; > import org.eclipse.compare.internal.BufferedCanvas; >+import org.eclipse.compare.internal.MergeViewerContentProvider; > import org.eclipse.compare.internal.Utilities; > import org.eclipse.compare.internal.TokenComparator; > import org.eclipse.compare.internal.DocLineComparator; >@@ -257,6 +258,8 @@ > private IPositionUpdater fPositionUpdater; > private boolean fIsMotif; > private boolean fIsCarbon; >+ >+ private boolean fHasErrors; > > > // SWT widgets >@@ -1664,16 +1667,18 @@ > fChangeDiffs= null; > fAllDiffs= null; > fEndOfDocReached= false; >+ fHasErrors= false; // start with no errors > > CompareConfiguration cc= getCompareConfiguration(); > IMergeViewerContentProvider cp= getMergeContentProvider(); > >- boolean rightEditable= cc.isRightEditable() && cp.isRightEditable(input); >- boolean leftEditable= cc.isLeftEditable() && cp.isLeftEditable(input); >+ if (cp instanceof MergeViewerContentProvider) { >+ MergeViewerContentProvider mcp= (MergeViewerContentProvider) cp; >+ mcp.setAncestorError(null); >+ mcp.setLeftError(null); >+ mcp.setRightError(null); >+ } > >- fRight.setEditable(rightEditable); >- fLeft.setEditable(leftEditable); >- > // set new documents > setDocument(fLeft, 'L', left); > fLeftLineCount= fLeft.getLineCount(); >@@ -1685,13 +1690,21 @@ > > setDocument(fAncestor, 'A', ancestor); > >- doDiff(); >- >+ updateHeader(); >+ updateControls(); >+ updateToolItems(); >+ >+ if (!fHasErrors) >+ doDiff(); >+ >+ fRight.setEditable(cc.isRightEditable() && cp.isRightEditable(input)); >+ fLeft.setEditable(cc.isLeftEditable() && cp.isLeftEditable(input)); >+ > invalidateLines(); > updateVScrollBar(); > refreshBirdsEyeView(); > >- if (!emptyInput && !fComposite.isDisposed()) { >+ if (!fHasErrors && !emptyInput && !fComposite.isDisposed()) { > Diff selectDiff= null; > if (FIX_47640) { > if (leftRange != null) >@@ -1878,6 +1891,25 @@ > return 0; > } > >+ private void setError(char type, String message) { >+ IMergeViewerContentProvider cp= getMergeContentProvider(); >+ if (cp instanceof MergeViewerContentProvider) { >+ MergeViewerContentProvider mcp= (MergeViewerContentProvider) cp; >+ switch (type) { >+ case 'A': >+ mcp.setAncestorError(message); >+ break; >+ case 'L': >+ mcp.setLeftError(message); >+ break; >+ case 'R': >+ mcp.setRightError(message); >+ break; >+ } >+ } >+ fHasErrors= true; >+ } >+ > /** > * Returns true if a new Document could be installed. > */ >@@ -1906,7 +1938,7 @@ > try { > s= Utilities.readString(sca); > } catch (CoreException ex) { >- // NeedWork >+ setError(type, ex.getMessage()); > } > > newDoc= new Document(s != null ? s : ""); //$NON-NLS-1$ >@@ -3161,6 +3193,17 @@ > > if (fIgnoreAncestorItem != null) > fIgnoreAncestorItem.setVisible(isThreeWay()); >+ >+ if (fCopyDiffLeftToRightItem != null) { >+ IAction a= fCopyDiffLeftToRightItem.getAction(); >+ if (a != null) >+ a.setEnabled(a.isEnabled() && !fHasErrors); >+ } >+ if (fCopyDiffRightToLeftItem != null) { >+ IAction a= fCopyDiffRightToLeftItem.getAction(); >+ if (a != null) >+ a.setEnabled(a.isEnabled() && !fHasErrors); >+ } > > super.updateToolItems(); > } >Index: compare/org/eclipse/compare/internal/MergeViewerContentProvider.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.compare/compare/org/eclipse/compare/internal/MergeViewerContentProvider.java,v >retrieving revision 1.8 >diff -u -r1.8 MergeViewerContentProvider.java >--- compare/org/eclipse/compare/internal/MergeViewerContentProvider.java 11 Dec 2003 15:43:30 -0000 1.8 >+++ compare/org/eclipse/compare/internal/MergeViewerContentProvider.java 17 Jun 2004 15:01:34 -0000 >@@ -25,11 +25,18 @@ > public class MergeViewerContentProvider implements IMergeViewerContentProvider { > > private CompareConfiguration fCompareConfiguration; >+ private String fAncestorError; >+ private String fLeftError; >+ private String fRightError; > > public MergeViewerContentProvider(CompareConfiguration cc) { > fCompareConfiguration= cc; > } > >+ private boolean hasError() { >+ return fAncestorError != null || fLeftError != null || fRightError != null; >+ } >+ > public void dispose() { > } > >@@ -39,11 +46,19 @@ > > //---- ancestor > >+ public void setAncestorError(String errorMessage) { >+ fAncestorError= errorMessage; >+ } >+ > public String getAncestorLabel(Object element) { >+ if (fAncestorError != null) >+ return fAncestorError; > return fCompareConfiguration.getAncestorLabel(element); > } > > public Image getAncestorImage(Object element) { >+ if (fAncestorError != null) >+ return null; > return fCompareConfiguration.getAncestorImage(element); > } > >@@ -62,11 +77,19 @@ > > //---- left > >+ public void setLeftError(String errorMessage) { >+ fLeftError= errorMessage; >+ } >+ > public String getLeftLabel(Object element) { >+ if (fLeftError != null) >+ return fLeftError; > return fCompareConfiguration.getLeftLabel(element); > } > > public Image getLeftImage(Object element) { >+ if (fLeftError != null) >+ return null; > return fCompareConfiguration.getLeftImage(element); > } > >@@ -77,6 +100,8 @@ > } > > public boolean isLeftEditable(Object element) { >+ if (hasError()) >+ return false; > if (element instanceof ICompareInput) { > Object left= ((ICompareInput) element).getLeft(); > if (left == null) { >@@ -112,11 +137,19 @@ > > //---- right > >+ public void setRightError(String errorMessage) { >+ fRightError= errorMessage; >+ } >+ > public String getRightLabel(Object element) { >+ if (fRightError != null) >+ return fRightError; > return fCompareConfiguration.getRightLabel(element); > } > > public Image getRightImage(Object element) { >+ if (fRightError != null) >+ return null; > return fCompareConfiguration.getRightImage(element); > } > >@@ -127,6 +160,8 @@ > } > > public boolean isRightEditable(Object element) { >+ if (hasError()) >+ return false; > if (element instanceof ICompareInput) { > Object right= ((ICompareInput) element).getRight(); > if (right == null) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 37648
: 12398 |
12399