import org.eclipse.ui.texteditor.IUpdate;
import org.eclipse.ui.texteditor.SourceViewerDecorationSupport;
import org.eclipse.ui.texteditor.TextNavigationAction;
+import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
import org.simantics.scl.ui.editor.SCLSourceViewerConfigurationNew;
import org.simantics.scl.ui.editor.completion.SCLTextEditorEnvironment;
import org.simantics.scl.ui.editor2.iterator.DocumentCharacterIterator;
import org.simantics.scl.ui.editor2.iterator.JavaWordIterator;
+import org.simantics.scl.ui.outline.SCLModuleOutlinePage;
import com.ibm.icu.text.BreakIterator;
private static final char[] CHARS = new char[] { '(', ')', '{', '}', '[', ']', '<', '>' };
- private static final String MATCHING_BRACKETS = "matchingBrackets";
- private static final String MATCHING_BRACKETS_COLOR = "matchingBracketsColor";
- private static final String HIGHLIGHT_BRACKET_AT_CARET_LOCATION = "highlightBracketAtCaretLocation";
- private static final String ENCLOSING_BRACKETS = "enclosingBrackets";
+ private static final String MATCHING_BRACKETS = "matchingBrackets"; //$NON-NLS-1$
+ private static final String MATCHING_BRACKETS_COLOR = "matchingBracketsColor"; //$NON-NLS-1$
+ private static final String HIGHLIGHT_BRACKET_AT_CARET_LOCATION = "highlightBracketAtCaretLocation"; //$NON-NLS-1$
+ private static final String ENCLOSING_BRACKETS = "enclosingBrackets"; //$NON-NLS-1$
private boolean disposed = false;
protected ResourceManager resourceManager;
private DefaultCharacterPairMatcher matcher;
+ private SCLModuleOutlinePage outline;
+
public SCLModuleEditor2() {
super();
resourceManager = new LocalResourceManager(JFaceResources.getResources());
SCLSourceViewerConfigurationNew sourceViewerConfiguration = new SCLSourceViewerConfigurationNew(resourceManager);
setDocumentProvider(new SCLModuleEditor2DocumentProvider(sourceViewerConfiguration));
setSourceViewerConfiguration(sourceViewerConfiguration);
+ outline = new SCLModuleOutlinePage(this);
}
@Override
throws PartInitException {
super.init(site, input);
getPreferenceStore().setValue(MATCHING_BRACKETS, true);
- getPreferenceStore().setValue(MATCHING_BRACKETS_COLOR, "192,192,192");
+ getPreferenceStore().setValue(MATCHING_BRACKETS_COLOR, "192,192,192"); //$NON-NLS-1$
getPreferenceStore().setValue(HIGHLIGHT_BRACKET_AT_CARET_LOCATION, true);
getPreferenceStore().setValue(ENCLOSING_BRACKETS, true);
}
@Override
public void createPartControl(Composite parent) {
super.createPartControl(parent);
- getEditorSite().getService(IContextService.class).activateContext("org.simantics.scl.ui.editor");
+ getEditorSite().getService(IContextService.class).activateContext("org.simantics.scl.ui.editor"); //$NON-NLS-1$
updatePartName();
}
public IDocument getDocument() {
return getSourceViewer().getDocument();
}
-
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <T> T getAdapter(Class<T> adapter) {
+ if (IContentOutlinePage.class.equals(adapter)) {
+ return (T) outline;
+ }
+ return super.getAdapter(adapter);
+ }
+
/**
* Text navigation action to navigate to the next sub-word.
*