KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > gjt > sp > jedit > indent > IndentRuleFactory


1 /*
2  * IndentRuleFactory.java
3  * :tabSize=8:indentSize=8:noTabs=false:
4  * :folding=explicit:collapseFolds=1:
5  *
6  * Copyright (C) 2005 Slava Pestov
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21  */

22
23 package org.gjt.sp.jedit.indent;
24
25 import java.util.regex.PatternSyntaxException JavaDoc;
26
27 public class IndentRuleFactory
28 {
29     public static IndentRule indentNextLines(String JavaDoc regexp)
30         throws PatternSyntaxException JavaDoc
31     {
32         return new RegexpIndentRule(regexp,
33             null,
34             new IndentAction.Increase(),
35             null,false);
36     }
37
38     public static IndentRule indentNextLine(String JavaDoc regexp)
39         throws PatternSyntaxException JavaDoc
40     {
41         return new RegexpIndentRule(regexp,
42             new IndentAction.Decrease(),
43             new IndentAction.Increase(),
44             null,true);
45     }
46
47     public static IndentRule unindentThisLine(String JavaDoc regexp)
48         throws PatternSyntaxException JavaDoc
49     {
50         return new RegexpIndentRule(regexp,
51             null,
52             new IndentAction.Increase(),
53             new IndentAction.Decrease(),
54             false);
55     }
56
57     public static IndentRule unindentNextLines(String JavaDoc regexp)
58         throws PatternSyntaxException JavaDoc
59     {
60         return new RegexpIndentRule(regexp,
61             null,
62             new IndentAction.Decrease(),
63             null,
64             false);
65     }
66
67     public static IndentRule indentOpenBracket(char bracket)
68         throws PatternSyntaxException JavaDoc
69     {
70         return new OpenBracketIndentRule(bracket,true);
71     }
72
73     public static IndentRule indentCloseBracket(char bracket)
74         throws PatternSyntaxException JavaDoc
75     {
76         return new CloseBracketIndentRule(bracket,true);
77     }
78
79     public static IndentRule unalignedOpenBracket(char bracket)
80         throws PatternSyntaxException JavaDoc
81     {
82         return new OpenBracketIndentRule(bracket,false);
83     }
84
85     public static IndentRule unalignedCloseBracket(char bracket)
86         throws PatternSyntaxException JavaDoc
87     {
88         return new CloseBracketIndentRule(bracket,false);
89     }
90 }
91
Popular Tags