]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/scl/scriptEditor/SCLScriptEditor.java
Fix to problems with outline view and SCL script editor.
[simantics/platform.git] / bundles / org.simantics.modeling.ui / src / org / simantics / modeling / ui / scl / scriptEditor / SCLScriptEditor.java
1 /*******************************************************************************
2  * Copyright (c) 2017 Association for Decentralized Information Management
3  * in Industry THTH ry.
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  *     Semantum Oy - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.modeling.ui.scl.scriptEditor;
13
14 import org.eclipse.swt.widgets.Composite;
15 import org.eclipse.ui.contexts.IContextService;
16 import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
17 import org.simantics.scl.ui.editor.SCLSourceViewerConfigurationNew;
18 import org.simantics.scl.ui.editor2.SCLModuleEditor2;
19
20 /**
21  * @author Tuukka Lehtonen
22  * @since 1.31.0
23  */
24 public class SCLScriptEditor extends SCLModuleEditor2 {
25
26     public SCLScriptEditor() {
27         super();
28         setDocumentProvider(new SCLScriptEditorDocumentProvider((SCLSourceViewerConfigurationNew) getSourceViewerConfiguration()));
29     }
30
31     @Override
32     public void createPartControl(Composite parent) {
33         super.createPartControl(parent);
34         getSite().getService(IContextService.class).activateContext("org.simantics.modeling.ui.scl.scriptEditor.context");
35     }
36     
37     @Override
38     public <T> T getAdapter(Class<T> adapter) {
39         // No outline view for scripts
40         if (IContentOutlinePage.class.equals(adapter)) {
41             return null;
42         }
43         
44         return super.getAdapter(adapter);
45     }
46
47 }