2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org
.jetbrains
.plugins
.groovy
.compiler
;
19 import com
.intellij
.openapi
.Disposable
;
20 import com
.intellij
.openapi
.compiler
.options
.ExcludedEntriesConfiguration
;
21 import com
.intellij
.openapi
.components
.*;
22 import com
.intellij
.openapi
.project
.Project
;
23 import com
.intellij
.openapi
.util
.Disposer
;
24 import com
.intellij
.util
.xmlb
.annotations
.Tag
;
25 import org
.jdom
.Element
;
31 name
= "GroovyCompilerConfiguration",
33 @Storage(id
= "default", file
= "$WORKSPACE_FILE$"),
34 @Storage(id
= "dir", file
= "$PROJECT_CONFIG_DIR$/groovyc.xml", scheme
= StorageScheme
.DIRECTORY_BASED
)
37 public class GroovyCompilerConfiguration
implements PersistentStateComponent
<GroovyCompilerConfiguration
.MyStateBean
>, Disposable
{
38 private String myHeapSize
= "400";
39 private boolean myUseGroovycStubs
= false;
40 private final ExcludedEntriesConfiguration myExcludeFromStubGeneration
= new ExcludedEntriesConfiguration();
42 public MyStateBean
getState() {
43 final MyStateBean bean
= new MyStateBean();
44 bean
.heapSize
= myHeapSize
;
45 bean
.useGroovycStubs
= myUseGroovycStubs
;
46 myExcludeFromStubGeneration
.writeExternal(bean
.excludes
);
50 public static ExcludedEntriesConfiguration
getExcludeConfiguration(Project project
) {
51 return getInstance(project
).myExcludeFromStubGeneration
;
54 public ExcludedEntriesConfiguration
getExcludeFromStubGeneration() {
55 return myExcludeFromStubGeneration
;
58 public void loadState(MyStateBean state
) {
59 myHeapSize
= state
.heapSize
;
60 myUseGroovycStubs
= state
.useGroovycStubs
;
62 myExcludeFromStubGeneration
.readExternal(state
.excludes
);
65 public static GroovyCompilerConfiguration
getInstance(Project project
) {
66 return ServiceManager
.getService(project
, GroovyCompilerConfiguration
.class);
69 public String
getHeapSize() {
73 public void setHeapSize(String heapSize
) {
74 myHeapSize
= heapSize
;
77 public boolean isUseGroovycStubs() {
78 return myUseGroovycStubs
;
81 public void setUseGroovycStubs(boolean useGroovycStubs
) {
82 myUseGroovycStubs
= useGroovycStubs
;
85 public void dispose() {
86 Disposer
.dispose(myExcludeFromStubGeneration
);
89 public static class MyStateBean
{
90 public String heapSize
= "400";
92 @Tag("excludes") public Element excludes
= new Element("aaa");
94 public boolean useGroovycStubs
= false;