Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Side by Side Diff: editor/tools/plugins/com.google.dart.tools.ui.web/src/com/google/dart/tools/ui/web/utils/WebEditorAutoIndentStrategy.java

Issue 11783009: Big merge from experimental to bleeding edge. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2012, the Dart project authors.
3 *
4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u se this file except
5 * in compliance with the License. You may obtain a copy of the License at
6 *
7 * http://www.eclipse.org/legal/epl-v10.html
8 *
9 * Unless required by applicable law or agreed to in writing, software distribut ed under the License
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K IND, either express
11 * or implied. See the License for the specific language governing permissions a nd limitations under
12 * the License.
13 */
14
15 package com.google.dart.tools.ui.web.utils;
16
17 import org.eclipse.jface.text.DefaultIndentLineAutoEditStrategy;
18 import org.eclipse.jface.text.DocumentCommand;
19 import org.eclipse.jface.text.IDocument;
20 import org.eclipse.jface.text.TextUtilities;
21
22 /**
23 * An abstract implementation for auto-indent strategies.
24 */
25 public abstract class WebEditorAutoIndentStrategy extends DefaultIndentLineAutoE ditStrategy {
26
27 public WebEditorAutoIndentStrategy() {
28
29 }
30
31 @Override
32 public final void customizeDocumentCommand(IDocument d, DocumentCommand c) {
33 if (c.length == 0 && c.text != null
34 && TextUtilities.endsWith(d.getLegalLineDelimiters(), c.text) != -1) {
35 doAutoIndentAfterNewLine(d, c);
36 }
37 }
38
39 protected abstract void doAutoIndentAfterNewLine(IDocument d, DocumentCommand c);
40
41 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698