Lines 102-110
Link Here
|
102 |
import org.eclipse.ui.IEditorSite; |
102 |
import org.eclipse.ui.IEditorSite; |
103 |
import org.eclipse.ui.IFileEditorInput; |
103 |
import org.eclipse.ui.IFileEditorInput; |
104 |
import org.eclipse.ui.IPageLayout; |
104 |
import org.eclipse.ui.IPageLayout; |
|
|
105 |
import org.eclipse.ui.IPartListener; |
105 |
import org.eclipse.ui.ISharedImages; |
106 |
import org.eclipse.ui.ISharedImages; |
106 |
import org.eclipse.ui.IStorageEditorInput; |
107 |
import org.eclipse.ui.IStorageEditorInput; |
107 |
import org.eclipse.ui.IWorkbenchActionConstants; |
108 |
import org.eclipse.ui.IWorkbenchActionConstants; |
|
|
109 |
import org.eclipse.ui.IWorkbenchPart; |
108 |
import org.eclipse.ui.PartInitException; |
110 |
import org.eclipse.ui.PartInitException; |
109 |
import org.eclipse.ui.PlatformUI; |
111 |
import org.eclipse.ui.PlatformUI; |
110 |
import org.eclipse.ui.contexts.IContextService; |
112 |
import org.eclipse.ui.contexts.IContextService; |
Lines 181-186
Link Here
|
181 |
import org.eclipse.wst.sse.ui.internal.provisional.extensions.breakpoint.NullSourceEditingTextTools; |
183 |
import org.eclipse.wst.sse.ui.internal.provisional.extensions.breakpoint.NullSourceEditingTextTools; |
182 |
import org.eclipse.wst.sse.ui.internal.provisional.preferences.CommonEditorPreferenceNames; |
184 |
import org.eclipse.wst.sse.ui.internal.provisional.preferences.CommonEditorPreferenceNames; |
183 |
import org.eclipse.wst.sse.ui.internal.reconcile.DocumentRegionProcessor; |
185 |
import org.eclipse.wst.sse.ui.internal.reconcile.DocumentRegionProcessor; |
|
|
186 |
import org.eclipse.wst.sse.ui.internal.reconcile.ISourceReconcilingListener; |
184 |
import org.eclipse.wst.sse.ui.internal.selection.SelectionHistory; |
187 |
import org.eclipse.wst.sse.ui.internal.selection.SelectionHistory; |
185 |
import org.eclipse.wst.sse.ui.internal.style.SemanticHighlightingManager; |
188 |
import org.eclipse.wst.sse.ui.internal.style.SemanticHighlightingManager; |
186 |
import org.eclipse.wst.sse.ui.internal.text.DocumentRegionEdgeMatcher; |
189 |
import org.eclipse.wst.sse.ui.internal.text.DocumentRegionEdgeMatcher; |
Lines 803-808
Link Here
|
803 |
} |
806 |
} |
804 |
} |
807 |
} |
805 |
|
808 |
|
|
|
809 |
private class PartListener implements IPartListener { |
810 |
|
811 |
ITextEditor fEditor; |
812 |
|
813 |
public PartListener(ITextEditor editor) { |
814 |
fEditor = editor; |
815 |
} |
816 |
|
817 |
public void partActivated(IWorkbenchPart part) { |
818 |
if (part.getAdapter(ITextEditor.class) == fEditor) { |
819 |
IReconciler reconciler = getSourceViewerConfiguration().getReconciler(getSourceViewer()); |
820 |
if (reconciler instanceof DocumentRegionProcessor) { |
821 |
((DocumentRegionProcessor) reconciler).forceReconciling(); |
822 |
} |
823 |
} |
824 |
} |
825 |
|
826 |
public void partBroughtToTop(IWorkbenchPart part) { |
827 |
} |
828 |
|
829 |
public void partClosed(IWorkbenchPart part) { |
830 |
} |
831 |
|
832 |
public void partDeactivated(IWorkbenchPart part) { |
833 |
} |
834 |
|
835 |
public void partOpened(IWorkbenchPart part) { |
836 |
} |
837 |
|
838 |
} |
839 |
|
806 |
/** |
840 |
/** |
807 |
* Not API. May be removed in the future. |
841 |
* Not API. May be removed in the future. |
808 |
*/ |
842 |
*/ |
Lines 855-861
Link Here
|
855 |
private OutlinePageListener fOutlinePageListener = null; |
889 |
private OutlinePageListener fOutlinePageListener = null; |
856 |
/** This editor's projection support */ |
890 |
/** This editor's projection support */ |
857 |
private ProjectionSupport fProjectionSupport; |
891 |
private ProjectionSupport fProjectionSupport; |
|
|
892 |
|
858 |
private IPropertySheetPage fPropertySheetPage; |
893 |
private IPropertySheetPage fPropertySheetPage; |
|
|
894 |
|
895 |
private ISourceReconcilingListener[] fReconcilingListeners = new ISourceReconcilingListener[0]; |
896 |
private IPartListener fPartListener; |
897 |
|
859 |
private String fRememberTitle; |
898 |
private String fRememberTitle; |
860 |
/** The ruler context menu to be disposed. */ |
899 |
/** The ruler context menu to be disposed. */ |
861 |
private Menu fRulerContextMenu; |
900 |
private Menu fRulerContextMenu; |
Lines 1285-1291
Link Here
|
1285 |
fInformationPresenter = new InformationPresenter(informationControlCreator); |
1324 |
fInformationPresenter = new InformationPresenter(informationControlCreator); |
1286 |
fInformationPresenter.setSizeConstraints(60, 10, true, true); |
1325 |
fInformationPresenter.setSizeConstraints(60, 10, true, true); |
1287 |
fInformationPresenter.install(getSourceViewer()); |
1326 |
fInformationPresenter.install(getSourceViewer()); |
1288 |
|
1327 |
addReconcilingListeners(getSourceViewerConfiguration(), getTextViewer()); |
|
|
1328 |
fPartListener = new PartListener(this); |
1329 |
getSite().getWorkbenchWindow().getPartService().addPartListener(fPartListener); |
1289 |
installSemanticHighlighting(); |
1330 |
installSemanticHighlighting(); |
1290 |
|
1331 |
|
1291 |
|
1332 |
|
Lines 1529-1535
Link Here
|
1529 |
|
1570 |
|
1530 |
if (fDropTarget != null) |
1571 |
if (fDropTarget != null) |
1531 |
fDropTarget.dispose(); |
1572 |
fDropTarget.dispose(); |
1532 |
|
1573 |
|
|
|
1574 |
if (fPartListener != null) { |
1575 |
getSite().getWorkbenchWindow().getPartService().removePartListener(fPartListener); |
1576 |
fPartListener = null; |
1577 |
} |
1578 |
|
1533 |
uninstallSemanticHighlighting(); |
1579 |
uninstallSemanticHighlighting(); |
1534 |
|
1580 |
|
1535 |
setPreferenceStore(null); |
1581 |
setPreferenceStore(null); |
Lines 2650-2667
Link Here
|
2650 |
* that viewer configuration could be set after editor part was created. |
2696 |
* that viewer configuration could be set after editor part was created. |
2651 |
*/ |
2697 |
*/ |
2652 |
protected void setSourceViewerConfiguration(SourceViewerConfiguration config) { |
2698 |
protected void setSourceViewerConfiguration(SourceViewerConfiguration config) { |
|
|
2699 |
SourceViewerConfiguration oldSourceViewerConfiguration = getSourceViewerConfiguration(); |
2653 |
super.setSourceViewerConfiguration(config); |
2700 |
super.setSourceViewerConfiguration(config); |
2654 |
StructuredTextViewer stv = getTextViewer(); |
2701 |
StructuredTextViewer stv = getTextViewer(); |
2655 |
if (stv != null) { |
2702 |
if (stv != null) { |
2656 |
// there should be no need to unconfigure |
2703 |
/* |
2657 |
// before configure because |
2704 |
* There should be no need to unconfigure before configure because |
2658 |
// configure will |
2705 |
* configure will also unconfigure before configuring |
2659 |
// also unconfigure before configuring |
2706 |
*/ |
|
|
2707 |
removeReconcilingListeners(oldSourceViewerConfiguration, stv); |
2660 |
stv.unconfigure(); |
2708 |
stv.unconfigure(); |
2661 |
stv.configure(config); |
2709 |
stv.configure(config); |
|
|
2710 |
addReconcilingListeners(config, stv); |
2662 |
} |
2711 |
} |
2663 |
} |
2712 |
} |
2664 |
|
2713 |
|
|
|
2714 |
private void removeReconcilingListeners(SourceViewerConfiguration config, StructuredTextViewer stv) { |
2715 |
IReconciler reconciler = config.getReconciler(stv); |
2716 |
if (reconciler instanceof DocumentRegionProcessor) { |
2717 |
for (int i = 0; i < fReconcilingListeners.length; i++) { |
2718 |
((DocumentRegionProcessor) reconciler).removeReconcilingListener(fReconcilingListeners[i]); |
2719 |
} |
2720 |
} |
2721 |
} |
2722 |
|
2723 |
private void addReconcilingListeners(SourceViewerConfiguration config, StructuredTextViewer stv) { |
2724 |
try { |
2725 |
List reconcilingListeners = new ArrayList(fReconcilingListeners.length); |
2726 |
String[] ids = getConfigurationPoints(); |
2727 |
for (int i = 0; i < ids.length; i++) { |
2728 |
reconcilingListeners.addAll(ExtendedConfigurationBuilder.getInstance().getConfigurations("sourceReconcilingListener", ids[i])); //$NON-NLS-1$ |
2729 |
} |
2730 |
fReconcilingListeners = (ISourceReconcilingListener[]) reconcilingListeners.toArray(new ISourceReconcilingListener[reconcilingListeners.size()]); |
2731 |
} |
2732 |
catch (ClassCastException e) { |
2733 |
Logger.log(Logger.ERROR, "Configuration has a reconciling listener that does not implement ISourceReconcilingListener."); //$NON-NLS-1$ |
2734 |
} |
2735 |
|
2736 |
IReconciler reconciler = config.getReconciler(stv); |
2737 |
if (reconciler instanceof DocumentRegionProcessor) { |
2738 |
for (int i = 0; i < fReconcilingListeners.length; i++) |
2739 |
((DocumentRegionProcessor) reconciler).addReconcilingListener(fReconcilingListeners[i]); |
2740 |
} |
2741 |
} |
2665 |
/* |
2742 |
/* |
2666 |
* (non-Javadoc) |
2743 |
* (non-Javadoc) |
2667 |
* |
2744 |
* |