equal
deleted
inserted
replaced
|
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
|
2 // Use of this source code is governed by a BSD-style license that can be |
|
3 // found in the LICENSE file. |
|
4 |
|
5 package org.chromium.debug.ui.editors; |
|
6 |
|
7 import org.chromium.debug.ui.PluginUtil; |
|
8 import org.eclipse.ui.editors.text.TextEditor; |
|
9 |
|
10 /** |
|
11 * A simplistic JavaScript editor which supports its own key binding scope. |
|
12 */ |
|
13 public class JsEditor extends TextEditor { |
|
14 |
|
15 /** The ID of this editor as defined in plugin.xml */ |
|
16 public static final String EDITOR_ID = |
|
17 "org.chromium.debug.ui.editors.JsEditor"; //$NON-NLS-1$ |
|
18 |
|
19 /** The ID of the editor context menu */ |
|
20 public static final String EDITOR_CONTEXT = EDITOR_ID + ".context"; //$NON-NLS-1$ |
|
21 |
|
22 /** The ID of the editor ruler context menu */ |
|
23 public static final String RULER_CONTEXT = EDITOR_ID + ".ruler"; //$NON-NLS-1$ |
|
24 |
|
25 @Override |
|
26 protected void initializeEditor() { |
|
27 super.initializeEditor(); |
|
28 setEditorContextMenuId(EDITOR_CONTEXT); |
|
29 setRulerContextMenuId(RULER_CONTEXT); |
|
30 setDocumentProvider(new JsDocumentProvider()); |
|
31 } |
|
32 |
|
33 public JsEditor() { |
|
34 setSourceViewerConfiguration(new JsSourceViewerConfiguration()); |
|
35 setKeyBindingScopes(new String[] { "org.eclipse.ui.textEditorScope", //$NON-NLS-1$ |
|
36 "org.chromium.debug.ui.editors.JsEditor.context" }); //$NON-NLS-1$ |
|
37 } |
|
38 |
|
39 @Override |
|
40 protected void setPartName(String partName) { |
|
41 super.setPartName(PluginUtil.stripChromiumExtension(partName)); |
|
42 } |
|
43 } |