Lines 309-315
Link Here
|
309 |
* reimplement. |
309 |
* reimplement. |
310 |
* |
310 |
* |
311 |
* @param input the input of this editor. |
311 |
* @param input the input of this editor. |
312 |
* @since 3.0 |
312 |
* |
313 |
*/ |
313 |
*/ |
314 |
protected void setDocumentProvider(IEditorInput input) { |
314 |
protected void setDocumentProvider(IEditorInput input) { |
315 |
IDocumentProvider provider = DocumentProviderRegistry.getDefault().getDocumentProvider(input, new IDocumentProviderSelector() { |
315 |
IDocumentProvider provider = DocumentProviderRegistry.getDefault().getDocumentProvider(input, new IDocumentProviderSelector() { |
Lines 327-333
Link Here
|
327 |
* reimplement. |
327 |
* reimplement. |
328 |
* |
328 |
* |
329 |
* @param input the input of this editor. |
329 |
* @param input the input of this editor. |
330 |
* @since 3.0 |
330 |
* |
331 |
*/ |
331 |
*/ |
332 |
protected IDocumentProvider getDocumentProvider(IEditorInput input) { |
332 |
protected IDocumentProvider getDocumentProvider(IEditorInput input) { |
333 |
IDocumentProvider provider = DocumentProviderRegistry.getDefault().getDocumentProvider(input, new IDocumentProviderSelector() { |
333 |
IDocumentProvider provider = DocumentProviderRegistry.getDefault().getDocumentProvider(input, new IDocumentProviderSelector() { |
Lines 470-476
Link Here
|
470 |
* Disposes of the connection with the document provider. Subclasses |
470 |
* Disposes of the connection with the document provider. Subclasses |
471 |
* may extend. |
471 |
* may extend. |
472 |
* |
472 |
* |
473 |
* @since 3.0 |
473 |
* |
474 |
*/ |
474 |
*/ |
475 |
protected void disposeDocumentProvider() { |
475 |
protected void disposeDocumentProvider() { |
476 |
IDocumentProvider provider= getDocumentProvider(); |
476 |
IDocumentProvider provider= getDocumentProvider(); |
Lines 494-500
Link Here
|
494 |
* necessary to extend this method. |
494 |
* necessary to extend this method. |
495 |
* |
495 |
* |
496 |
* @return the progress monitor related to this editor |
496 |
* @return the progress monitor related to this editor |
497 |
* @since 2.1 |
497 |
* |
498 |
*/ |
498 |
*/ |
499 |
protected IProgressMonitor getProgressMonitor() { |
499 |
protected IProgressMonitor getProgressMonitor() { |
500 |
|
500 |
|
Lines 650-656
Link Here
|
650 |
/** |
650 |
/** |
651 |
* Enables/disables sanity checking. |
651 |
* Enables/disables sanity checking. |
652 |
* @param enable <code>true</code> if sanity checking should be enabled, <code>false</code> otherwise |
652 |
* @param enable <code>true</code> if sanity checking should be enabled, <code>false</code> otherwise |
653 |
* @since 2.0 |
653 |
* |
654 |
*/ |
654 |
*/ |
655 |
protected void enableSanityChecking(boolean enable) { |
655 |
protected void enableSanityChecking(boolean enable) { |
656 |
synchronized (this) { |
656 |
synchronized (this) { |
Lines 661-667
Link Here
|
661 |
/** |
661 |
/** |
662 |
* Checks the state of the given editor input if sanity checking is enabled. |
662 |
* Checks the state of the given editor input if sanity checking is enabled. |
663 |
* @param input the editor input whose state is to be checked |
663 |
* @param input the editor input whose state is to be checked |
664 |
* @since 2.0 |
664 |
* |
665 |
*/ |
665 |
*/ |
666 |
protected void safelySanityCheckState(IEditorInput input) { |
666 |
protected void safelySanityCheckState(IEditorInput input) { |
667 |
boolean enabled= false; |
667 |
boolean enabled= false; |
Lines 677-683
Link Here
|
677 |
/** |
677 |
/** |
678 |
* Checks the state of the given editor input. |
678 |
* Checks the state of the given editor input. |
679 |
* @param input the editor input whose state is to be checked |
679 |
* @param input the editor input whose state is to be checked |
680 |
* @since 2.0 |
680 |
* |
681 |
*/ |
681 |
*/ |
682 |
protected void sanityCheckState(IEditorInput input) { |
682 |
protected void sanityCheckState(IEditorInput input) { |
683 |
|
683 |
|
Lines 697-703
Link Here
|
697 |
/** |
697 |
/** |
698 |
* Enables/disables state validation. |
698 |
* Enables/disables state validation. |
699 |
* @param enable <code>true</code> if state validation should be enabled, <code>false</code> otherwise |
699 |
* @param enable <code>true</code> if state validation should be enabled, <code>false</code> otherwise |
700 |
* @since 2.1 |
700 |
* |
701 |
*/ |
701 |
*/ |
702 |
protected void enableStateValidation(boolean enable) { |
702 |
protected void enableStateValidation(boolean enable) { |
703 |
synchronized (this) { |
703 |
synchronized (this) { |
Lines 711-717
Link Here
|
711 |
* the input can persistently be changed. |
711 |
* the input can persistently be changed. |
712 |
* |
712 |
* |
713 |
* @param input the input to be validated |
713 |
* @param input the input to be validated |
714 |
* @since 2.0 |
714 |
* |
715 |
*/ |
715 |
*/ |
716 |
protected void validateState(IEditorInput input) { |
716 |
protected void validateState(IEditorInput input) { |
717 |
|
717 |
|
Lines 782-788
Link Here
|
782 |
* Updates the state of the given editor input such as read-only flag. |
782 |
* Updates the state of the given editor input such as read-only flag. |
783 |
* |
783 |
* |
784 |
* @param input the input to be validated |
784 |
* @param input the input to be validated |
785 |
* @since 2.0 |
785 |
* |
786 |
*/ |
786 |
*/ |
787 |
protected void updateState(IEditorInput input) { |
787 |
protected void updateState(IEditorInput input) { |
788 |
IDocumentProvider provider= getDocumentProvider(); |
788 |
IDocumentProvider provider= getDocumentProvider(); |
Lines 810-816
Link Here
|
810 |
* |
810 |
* |
811 |
* @param overwrite indicates whether or not overwriting is allowed |
811 |
* @param overwrite indicates whether or not overwriting is allowed |
812 |
* @param progressMonitor the monitor in which to run the operation |
812 |
* @param progressMonitor the monitor in which to run the operation |
813 |
* @since 3.0 |
813 |
* |
814 |
*/ |
814 |
*/ |
815 |
protected void performSave(boolean overwrite, IProgressMonitor progressMonitor) { |
815 |
protected void performSave(boolean overwrite, IProgressMonitor progressMonitor) { |
816 |
|
816 |
|
Lines 836-842
Link Here
|
836 |
|
836 |
|
837 |
/** |
837 |
/** |
838 |
* The number of re-entrances into error correction code while saving. |
838 |
* The number of re-entrances into error correction code while saving. |
839 |
* @since 2.0 |
839 |
* |
840 |
*/ |
840 |
*/ |
841 |
private int fErrorCorrectionOnSave; |
841 |
private int fErrorCorrectionOnSave; |
842 |
|
842 |
|
Lines 904-910
Link Here
|
904 |
* @param ex the core exception |
904 |
* @param ex the core exception |
905 |
* @return <code>true</code> iff the given core exception is exactly the |
905 |
* @return <code>true</code> iff the given core exception is exactly the |
906 |
* exception which is thrown for a non-synchronized element |
906 |
* exception which is thrown for a non-synchronized element |
907 |
* @since 3.1 |
907 |
* |
908 |
*/ |
908 |
*/ |
909 |
private boolean isNotSynchronizedException(CoreException ex) { |
909 |
private boolean isNotSynchronizedException(CoreException ex) { |
910 |
if (ex == null) |
910 |
if (ex == null) |
Lines 946-952
Link Here
|
946 |
* <p> |
946 |
* <p> |
947 |
* Clients may extended this method. |
947 |
* Clients may extended this method. |
948 |
* |
948 |
* |
949 |
* @since 3.0 |
949 |
* |
950 |
*/ |
950 |
*/ |
951 |
protected void handleElementContentReplaced() { |
951 |
protected void handleElementContentReplaced() { |
952 |
initializeGraphicalViewerContents(); |
952 |
initializeGraphicalViewerContents(); |
Lines 958-964
Link Here
|
958 |
* <p> |
958 |
* <p> |
959 |
* Clients may extended this method. |
959 |
* Clients may extended this method. |
960 |
* |
960 |
* |
961 |
* @since 3.0 |
961 |
* |
962 |
*/ |
962 |
*/ |
963 |
protected void handleElementContentAboutToBeReplaced() { |
963 |
protected void handleElementContentAboutToBeReplaced() { |
964 |
releaseInput(); |
964 |
releaseInput(); |
Lines 967-973
Link Here
|
967 |
/** |
967 |
/** |
968 |
* Returns the status line manager of this editor. |
968 |
* Returns the status line manager of this editor. |
969 |
* @return the status line manager of this editor |
969 |
* @return the status line manager of this editor |
970 |
* @since 2.0 |
970 |
* |
971 |
*/ |
971 |
*/ |
972 |
private IStatusLineManager getStatusLineManager() { |
972 |
private IStatusLineManager getStatusLineManager() { |
973 |
|
973 |
|
Lines 984-990
Link Here
|
984 |
/** |
984 |
/** |
985 |
* Hook which gets called when the editor has been saved. |
985 |
* Hook which gets called when the editor has been saved. |
986 |
* Subclasses may extend. |
986 |
* Subclasses may extend. |
987 |
* @since 2.1 |
987 |
* |
988 |
*/ |
988 |
*/ |
989 |
protected void editorSaved() { |
989 |
protected void editorSaved() { |
990 |
// nothing to do |
990 |
// nothing to do |
Lines 1015-1021
Link Here
|
1015 |
|
1015 |
|
1016 |
/** |
1016 |
/** |
1017 |
* The editor's activation listener. |
1017 |
* The editor's activation listener. |
1018 |
* @since 2.0 |
1018 |
* |
1019 |
*/ |
1019 |
*/ |
1020 |
private ActivationListener fActivationListener; |
1020 |
private ActivationListener fActivationListener; |
1021 |
// private final String fReadOnlyLabel= EditorMessages.Editor_statusline_state_readonly_label; |
1021 |
// private final String fReadOnlyLabel= EditorMessages.Editor_statusline_state_readonly_label; |
Lines 1028-1049
Link Here
|
1028 |
private IDocumentProvider fExplicitDocumentProvider; |
1028 |
private IDocumentProvider fExplicitDocumentProvider; |
1029 |
/** |
1029 |
/** |
1030 |
* Indicates whether sanity checking in enabled. |
1030 |
* Indicates whether sanity checking in enabled. |
1031 |
* @since 2.0 |
1031 |
* |
1032 |
*/ |
1032 |
*/ |
1033 |
private boolean fIsSanityCheckEnabled= true; |
1033 |
private boolean fIsSanityCheckEnabled= true; |
1034 |
/** |
1034 |
/** |
1035 |
* Indicates whether state validation is enabled. |
1035 |
* Indicates whether state validation is enabled. |
1036 |
* @since 2.1 |
1036 |
* |
1037 |
*/ |
1037 |
*/ |
1038 |
private boolean fIsStateValidationEnabled= true; |
1038 |
private boolean fIsStateValidationEnabled= true; |
1039 |
/** |
1039 |
/** |
1040 |
* Cached modification stamp of the editor's input. |
1040 |
* Cached modification stamp of the editor's input. |
1041 |
* @since 2.0 |
1041 |
* |
1042 |
*/ |
1042 |
*/ |
1043 |
private long fModificationStamp= IResource.NULL_STAMP; |
1043 |
private long fModificationStamp= IResource.NULL_STAMP; |
1044 |
/** |
1044 |
/** |
1045 |
* Internal part and shell activation listener for triggering state validation. |
1045 |
* Internal part and shell activation listener for triggering state validation. |
1046 |
* @since 2.0 |
1046 |
* |
1047 |
*/ |
1047 |
*/ |
1048 |
class ActivationListener implements IPartListener, IWindowListener { |
1048 |
class ActivationListener implements IPartListener, IWindowListener { |
1049 |
|
1049 |
|
Lines 1053-1059
Link Here
|
1053 |
private boolean fIsHandlingActivation= false; |
1053 |
private boolean fIsHandlingActivation= false; |
1054 |
/** |
1054 |
/** |
1055 |
* The part service. |
1055 |
* The part service. |
1056 |
* @since 3.1 |
1056 |
* |
1057 |
*/ |
1057 |
*/ |
1058 |
private IPartService fPartService; |
1058 |
private IPartService fPartService; |
1059 |
|
1059 |
|
Lines 1061-1067
Link Here
|
1061 |
* Creates this activation listener. |
1061 |
* Creates this activation listener. |
1062 |
* |
1062 |
* |
1063 |
* @param partService the part service on which to add the part listener |
1063 |
* @param partService the part service on which to add the part listener |
1064 |
* @since 3.1 |
1064 |
* |
1065 |
*/ |
1065 |
*/ |
1066 |
public ActivationListener(IPartService partService) { |
1066 |
public ActivationListener(IPartService partService) { |
1067 |
fPartService= partService; |
1067 |
fPartService= partService; |
Lines 1070-1076
Link Here
|
1070 |
/** |
1070 |
/** |
1071 |
* Disposes this activation listener. |
1071 |
* Disposes this activation listener. |
1072 |
* |
1072 |
* |
1073 |
* @since 3.1 |
1073 |
* |
1074 |
*/ |
1074 |
*/ |
1075 |
public void dispose() { |
1075 |
public void dispose() { |
1076 |
fPartService= null; |
1076 |
fPartService= null; |
Lines 1141-1147
Link Here
|
1141 |
|
1141 |
|
1142 |
/* |
1142 |
/* |
1143 |
* @see org.eclipse.ui.IWindowListener#windowActivated(org.eclipse.ui.IWorkbenchWindow) |
1143 |
* @see org.eclipse.ui.IWindowListener#windowActivated(org.eclipse.ui.IWorkbenchWindow) |
1144 |
* @since 3.1 |
1144 |
* |
1145 |
*/ |
1145 |
*/ |
1146 |
public void windowActivated(IWorkbenchWindow window) { |
1146 |
public void windowActivated(IWorkbenchWindow window) { |
1147 |
if (window == getEditorSite().getWorkbenchWindow()) { |
1147 |
if (window == getEditorSite().getWorkbenchWindow()) { |
Lines 1160-1166
Link Here
|
1160 |
|
1160 |
|
1161 |
/* |
1161 |
/* |
1162 |
* @see org.eclipse.ui.IWindowListener#windowDeactivated(org.eclipse.ui.IWorkbenchWindow) |
1162 |
* @see org.eclipse.ui.IWindowListener#windowDeactivated(org.eclipse.ui.IWorkbenchWindow) |
1163 |
* @since 3.1 |
1163 |
* |
1164 |
*/ |
1164 |
*/ |
1165 |
public void windowDeactivated(IWorkbenchWindow window) { |
1165 |
public void windowDeactivated(IWorkbenchWindow window) { |
1166 |
// nothing to do |
1166 |
// nothing to do |
Lines 1168-1174
Link Here
|
1168 |
|
1168 |
|
1169 |
/* |
1169 |
/* |
1170 |
* @see org.eclipse.ui.IWindowListener#windowClosed(org.eclipse.ui.IWorkbenchWindow) |
1170 |
* @see org.eclipse.ui.IWindowListener#windowClosed(org.eclipse.ui.IWorkbenchWindow) |
1171 |
* @since 3.1 |
1171 |
* |
1172 |
*/ |
1172 |
*/ |
1173 |
public void windowClosed(IWorkbenchWindow window) { |
1173 |
public void windowClosed(IWorkbenchWindow window) { |
1174 |
// nothing to do |
1174 |
// nothing to do |
Lines 1176-1182
Link Here
|
1176 |
|
1176 |
|
1177 |
/* |
1177 |
/* |
1178 |
* @see org.eclipse.ui.IWindowListener#windowOpened(org.eclipse.ui.IWorkbenchWindow) |
1178 |
* @see org.eclipse.ui.IWindowListener#windowOpened(org.eclipse.ui.IWorkbenchWindow) |
1179 |
* @since 3.1 |
1179 |
* |
1180 |
*/ |
1180 |
*/ |
1181 |
public void windowOpened(IWorkbenchWindow window) { |
1181 |
public void windowOpened(IWorkbenchWindow window) { |
1182 |
// nothing to do |
1182 |
// nothing to do |
Lines 1190-1196
Link Here
|
1190 |
|
1190 |
|
1191 |
/** |
1191 |
/** |
1192 |
* The display used for posting runnable into the UI thread. |
1192 |
* The display used for posting runnable into the UI thread. |
1193 |
* @since 3.0 |
1193 |
* |
1194 |
*/ |
1194 |
*/ |
1195 |
private Display fDisplay; |
1195 |
private Display fDisplay; |
1196 |
|
1196 |
|
Lines 1363-1369
Link Here
|
1363 |
* @param movedElement the moved element |
1363 |
* @param movedElement the moved element |
1364 |
* @return whether this editor can handle the move of the original element |
1364 |
* @return whether this editor can handle the move of the original element |
1365 |
* so that it ends up being the moved element |
1365 |
* so that it ends up being the moved element |
1366 |
* @since 2.0 |
1366 |
* |
1367 |
*/ |
1367 |
*/ |
1368 |
protected boolean canHandleMove(IEditorInput originalElement, IEditorInput movedElement) { |
1368 |
protected boolean canHandleMove(IEditorInput originalElement, IEditorInput movedElement) { |
1369 |
return true; |
1369 |
return true; |
Lines 1371-1377
Link Here
|
1371 |
|
1371 |
|
1372 |
/* |
1372 |
/* |
1373 |
* @see IElementStateListenerExtension#elementStateChanging(Object) |
1373 |
* @see IElementStateListenerExtension#elementStateChanging(Object) |
1374 |
* @since 2.0 |
1374 |
* |
1375 |
*/ |
1375 |
*/ |
1376 |
public void elementStateChanging(Object element) { |
1376 |
public void elementStateChanging(Object element) { |
1377 |
if (element != null && element.equals(getEditorInput())) |
1377 |
if (element != null && element.equals(getEditorInput())) |
Lines 1380-1386
Link Here
|
1380 |
|
1380 |
|
1381 |
/* |
1381 |
/* |
1382 |
* @see IElementStateListenerExtension#elementStateChangeFailed(Object) |
1382 |
* @see IElementStateListenerExtension#elementStateChangeFailed(Object) |
1383 |
* @since 2.0 |
1383 |
* |
1384 |
*/ |
1384 |
*/ |
1385 |
public void elementStateChangeFailed(Object element) { |
1385 |
public void elementStateChangeFailed(Object element) { |
1386 |
if (element != null && element.equals(getEditorInput())) |
1386 |
if (element != null && element.equals(getEditorInput())) |
Lines 1396-1402
Link Here
|
1396 |
* |
1396 |
* |
1397 |
* @param runnable runnable to be executed |
1397 |
* @param runnable runnable to be executed |
1398 |
* @param postAsync <code>true</code> if the runnable must be posted asynchronous, <code>false</code> otherwise |
1398 |
* @param postAsync <code>true</code> if the runnable must be posted asynchronous, <code>false</code> otherwise |
1399 |
* @since 3.0 |
1399 |
* |
1400 |
*/ |
1400 |
*/ |
1401 |
private void execute(Runnable runnable, boolean postAsync) { |
1401 |
private void execute(Runnable runnable, boolean postAsync) { |
1402 |
if (postAsync || Display.getCurrent() == null) { |
1402 |
if (postAsync || Display.getCurrent() == null) { |