diff --git a/compiler/cli/src/org/jetbrains/jet/cli/jvm/compiler/JetCoreEnvironment.java b/compiler/cli/src/org/jetbrains/jet/cli/jvm/compiler/JetCoreEnvironment.java
index 6c0f03aad62..4c0ee505d0b 100644
--- a/compiler/cli/src/org/jetbrains/jet/cli/jvm/compiler/JetCoreEnvironment.java
+++ b/compiler/cli/src/org/jetbrains/jet/cli/jvm/compiler/JetCoreEnvironment.java
@@ -36,6 +36,8 @@ import com.intellij.psi.PsiManager;
import com.intellij.psi.impl.compiled.ClsCustomNavigationPolicy;
import com.intellij.psi.impl.file.impl.JavaFileManager;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.jet.CompilerModeProvider;
+import org.jetbrains.jet.OperationModeProvider;
import org.jetbrains.jet.asJava.JavaElementFinder;
import org.jetbrains.jet.asJava.LightClassGenerationSupport;
import org.jetbrains.jet.cli.common.CLIConfigurationKeys;
@@ -89,6 +91,8 @@ public class JetCoreEnvironment {
applicationEnvironment.registerParserDefinition(new JavaParserDefinition());
applicationEnvironment.registerParserDefinition(new JetParserDefinition());
+ applicationEnvironment.getApplication().registerService(OperationModeProvider.class, new CompilerModeProvider());
+
projectEnvironment = new JavaCoreProjectEnvironment(parentDisposable, applicationEnvironment);
MockProject project = projectEnvironment.getProject();
diff --git a/compiler/frontend/src/org/jetbrains/jet/CompilerModeProvider.java b/compiler/frontend/src/org/jetbrains/jet/CompilerModeProvider.java
new file mode 100644
index 00000000000..0dcf42cb98c
--- /dev/null
+++ b/compiler/frontend/src/org/jetbrains/jet/CompilerModeProvider.java
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2010-2013 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jetbrains.jet;
+
+public class CompilerModeProvider implements OperationModeProvider {
+ public static final OperationMode COMPILER_MODE = new OperationMode("compiler mode");
+
+ @Override
+ public OperationMode getMode() {
+ return COMPILER_MODE;
+ }
+}
diff --git a/compiler/frontend/src/org/jetbrains/jet/OperationMode.java b/compiler/frontend/src/org/jetbrains/jet/OperationMode.java
new file mode 100644
index 00000000000..ca2476924e2
--- /dev/null
+++ b/compiler/frontend/src/org/jetbrains/jet/OperationMode.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2010-2013 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jetbrains.jet;
+
+import org.jetbrains.annotations.NotNull;
+
+public final class OperationMode {
+ private final String id;
+
+ public OperationMode(@NotNull String id) {
+ this.id = id;
+ }
+
+ @Override
+ public String toString() {
+ return id;
+ }
+}
diff --git a/compiler/frontend/src/org/jetbrains/jet/OperationModeProvider.java b/compiler/frontend/src/org/jetbrains/jet/OperationModeProvider.java
new file mode 100644
index 00000000000..08cb9849224
--- /dev/null
+++ b/compiler/frontend/src/org/jetbrains/jet/OperationModeProvider.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2010-2013 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jetbrains.jet;
+
+import com.intellij.openapi.components.ServiceManager;
+
+public interface OperationModeProvider {
+ class SERVICE {
+ private SERVICE() {
+ }
+
+ public static OperationMode getMode() {
+ return ServiceManager.getService(OperationModeProvider.class).getMode();
+ }
+ }
+
+ OperationMode getMode();
+}
diff --git a/idea/src/META-INF/plugin.xml b/idea/src/META-INF/plugin.xml
index 787020bf0ec..abee33c0135 100644
--- a/idea/src/META-INF/plugin.xml
+++ b/idea/src/META-INF/plugin.xml
@@ -74,6 +74,9 @@
+
+
diff --git a/idea/src/org/jetbrains/jet/plugin/IdeModeProvider.java b/idea/src/org/jetbrains/jet/plugin/IdeModeProvider.java
new file mode 100644
index 00000000000..8e7718498f8
--- /dev/null
+++ b/idea/src/org/jetbrains/jet/plugin/IdeModeProvider.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2010-2013 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jetbrains.jet.plugin;
+
+import org.jetbrains.jet.OperationMode;
+import org.jetbrains.jet.OperationModeProvider;
+
+public class IdeModeProvider implements OperationModeProvider {
+ public static final OperationMode IDE_MODE = new OperationMode("IDE mode");
+
+ @Override
+ public OperationMode getMode() {
+ return IDE_MODE;
+ }
+}