Lines 536-541
Link Here
|
536 |
} |
536 |
} |
537 |
} |
537 |
} |
538 |
|
538 |
|
|
|
539 |
/* (non-Javadoc) |
540 |
* @see org.eclipse.ui.editors.text.IEncodingSupport#setEncoding(java.lang.String) |
541 |
*/ |
539 |
public void setEncoding(String encoding) { |
542 |
public void setEncoding(String encoding) { |
540 |
if (fDocumentKey == null || fDocumentProvider == null) { |
543 |
if (fDocumentKey == null || fDocumentProvider == null) { |
541 |
return; |
544 |
return; |
Lines 553-565
Link Here
|
553 |
} catch (CoreException e) { |
556 |
} catch (CoreException e) { |
554 |
CompareUIPlugin.log(e); |
557 |
CompareUIPlugin.log(e); |
555 |
} finally { |
558 |
} finally { |
556 |
update(true); |
559 |
encodingChanged(fLeg); |
557 |
} |
560 |
} |
558 |
} |
561 |
} |
559 |
} |
562 |
} |
560 |
} |
563 |
} |
561 |
} |
564 |
} |
562 |
|
565 |
|
|
|
566 |
/* (non-Javadoc) |
567 |
* @see org.eclipse.ui.editors.text.IEncodingSupport#getEncoding() |
568 |
*/ |
563 |
public String getEncoding() { |
569 |
public String getEncoding() { |
564 |
if (fDocumentProvider != null && fDocumentKey != null |
570 |
if (fDocumentProvider != null && fDocumentKey != null |
565 |
&& fDocumentProvider instanceof IStorageDocumentProvider) { |
571 |
&& fDocumentProvider instanceof IStorageDocumentProvider) { |
Lines 569-574
Link Here
|
569 |
return null; |
575 |
return null; |
570 |
} |
576 |
} |
571 |
|
577 |
|
|
|
578 |
/* (non-Javadoc) |
579 |
* @see org.eclipse.ui.editors.text.IEncodingSupport#getDefaultEncoding() |
580 |
*/ |
572 |
public String getDefaultEncoding() { |
581 |
public String getDefaultEncoding() { |
573 |
if (fDocumentProvider != null && fDocumentKey != null |
582 |
if (fDocumentProvider != null && fDocumentKey != null |
574 |
&& fDocumentProvider instanceof IStorageDocumentProvider) { |
583 |
&& fDocumentProvider instanceof IStorageDocumentProvider) { |
Lines 579-584
Link Here
|
579 |
} |
588 |
} |
580 |
|
589 |
|
581 |
private String internalGetEncoding() { |
590 |
private String internalGetEncoding() { |
|
|
591 |
if (fElement instanceof IEncodedStreamContentAccessor) { |
592 |
try { |
593 |
fEncoding = ((IEncodedStreamContentAccessor) fElement) |
594 |
.getCharset(); |
595 |
} catch (CoreException e) { |
596 |
// silently ignored |
597 |
} |
598 |
} |
582 |
if (fEncoding != null) { |
599 |
if (fEncoding != null) { |
583 |
return fEncoding; |
600 |
return fEncoding; |
584 |
} |
601 |
} |
Lines 1007-1013
Link Here
|
1007 |
// recalculate diffs and update controls |
1024 |
// recalculate diffs and update controls |
1008 |
new UIJob(CompareMessages.DocumentMerger_0) { |
1025 |
new UIJob(CompareMessages.DocumentMerger_0) { |
1009 |
public IStatus runInUIThread(IProgressMonitor monitor) { |
1026 |
public IStatus runInUIThread(IProgressMonitor monitor) { |
1010 |
update(true); |
1027 |
encodingChanged(fLeg); |
1011 |
return Status.OK_STATUS; |
1028 |
return Status.OK_STATUS; |
1012 |
} |
1029 |
} |
1013 |
}.schedule(); |
1030 |
}.schedule(); |
Lines 4972-4979
Link Here
|
4972 |
return false; |
4989 |
return false; |
4973 |
} |
4990 |
} |
4974 |
|
4991 |
|
|
|
4992 |
/** |
4993 |
* This method returns {@link ITextEditor} used in the |
4994 |
* {@link ChangeEncodingAction}. It provides implementation of methods that |
4995 |
* are used by the action by delegating them to {@link ContributorInfo} that |
4996 |
* corresponds to the side that has focus. |
4997 |
* |
4998 |
* @return |
4999 |
*/ |
4975 |
private ITextEditor getTextEditorAdapter() { |
5000 |
private ITextEditor getTextEditorAdapter() { |
4976 |
return new ITextEditor () { |
5001 |
return new ITextEditor() { |
4977 |
public void close(boolean save) { |
5002 |
public void close(boolean save) { |
4978 |
// Implementing interface method |
5003 |
// Implementing interface method |
4979 |
} |
5004 |
} |
Lines 5176-5179
Link Here
|
5176 |
} |
5201 |
} |
5177 |
}; |
5202 |
}; |
5178 |
} |
5203 |
} |
|
|
5204 |
|
5205 |
private void encodingChanged(char leg) { |
5206 |
update(true); |
5207 |
String key = null; |
5208 |
switch (leg) { |
5209 |
case ANCESTOR_CONTRIBUTOR: |
5210 |
key = "ANCESTOR_ENCODING"; //$NON-NLS-1$ |
5211 |
break; |
5212 |
case LEFT_CONTRIBUTOR: |
5213 |
key = "LEFT_ENCODING"; //$NON-NLS-1$ |
5214 |
break; |
5215 |
case RIGHT_CONTRIBUTOR: |
5216 |
key = "RIGHT_ENCODING"; //$NON-NLS-1$ |
5217 |
break; |
5218 |
} |
5219 |
getCompareConfiguration().setProperty(key, null); |
5220 |
} |
5221 |
|
5179 |
} |
5222 |
} |